Skip to content
Snippets Groups Projects
Commit 7d3d4c2e authored by Langella Olivier's avatar Langella Olivier
Browse files

new item delegate to display minutes and seconds

parent 2fa0e54c
No related branches found
No related tags found
No related merge requests found
......@@ -87,6 +87,11 @@ PeptideListWindow::PeptideListWindow(ProjectWindow *parent):
ui->tableView->setItemDelegateForColumn((std::int8_t) PeptideListColumn::theoretical_mhplus, item_delegate);
ui->tableView->setItemDelegateForColumn((std::int8_t) PeptideListColumn::experimental_mz, item_delegate);
MinuteItemDelegate * minute_delegate = new MinuteItemDelegate(ui->tableView);
ui->tableView->setItemDelegateForColumn((std::int8_t) PeptideListColumn::rtmin, minute_delegate);
SecondItemDelegate * second_delegate = new SecondItemDelegate(ui->tableView);
ui->tableView->setItemDelegateForColumn((std::int8_t) PeptideListColumn::rt, second_delegate);
//connect(ui->tableView, SIGNAL(clicked(const QModelIndex &)), _p_proxy_model, SLOT(onTableClicked(const QModelIndex &)));
......
......@@ -82,8 +82,8 @@ ProteinListWindow::ProteinListWindow(ProjectWindow *parent):
ui->tableView->setSortingEnabled(true);
ui->tableView->setAlternatingRowColors(true);
PercentItemDelegate * item_delegate = new PercentItemDelegate(ui->tableView);
ui->tableView->setItemDelegateForColumn((std::int8_t) ProteinListColumn::coverage, item_delegate);
PercentItemDelegate * percent_delegate = new PercentItemDelegate(ui->tableView);
ui->tableView->setItemDelegateForColumn((std::int8_t) ProteinListColumn::coverage, percent_delegate);
QSettings settings;
bool hide = settings.value("proteinview/hidenotvalid", "true").toBool();
......
......@@ -31,6 +31,38 @@
#include <QStyledItemDelegate>
class MinuteItemDelegate : public QStyledItemDelegate
{
Q_OBJECT
public:
MinuteItemDelegate(QObject *parent = 0) : QStyledItemDelegate(parent) {}
QString displayText(const QVariant & value, const QLocale & locale) const override
{
QString str = QString("%1'").arg(QString::number(value.toDouble(), 'f', 4));
return str;
}
};
class SecondItemDelegate : public QStyledItemDelegate
{
Q_OBJECT
public:
SecondItemDelegate(QObject *parent = 0) : QStyledItemDelegate(parent) {}
QString displayText(const QVariant & value, const QLocale & locale) const override
{
QString str = QString("%1\"").arg(QString::number(value.toDouble(), 'f', 4));
return str;
}
};
class PercentItemDelegate : public QStyledItemDelegate
{
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment