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

delegates ok for protein list

parent aea56bb7
No related branches found
No related tags found
No related merge requests found
......@@ -44,6 +44,13 @@ PeptideTableProxyModel::PeptideTableProxyModel(PeptideListWindow * p_peptide_lis
_second_delegate = new SecondItemDelegate(_p_peptide_list_window);
}
PeptideTableProxyModel::~PeptideTableProxyModel()
{
// delete _mass_delegate ;
// delete _minute_delegate ;
// delete _second_delegate ;
}
bool PeptideTableProxyModel::filterAcceptsColumn(int source_column, const QModelIndex & source_parent) const {
if (_peptide_table_model_p->getPeptideListColumn(source_column) == PeptideListColumn::label) {
if (_p_peptide_list_window->getProjectWindow()->getProjectP()->getLabelingMethodSp().get() == nullptr) {
......@@ -257,7 +264,7 @@ void PeptideTableProxyModel::setPeptideListColumnDisplay(PeptideListColumn colum
void PeptideTableProxyModel::resteItemDelegates() const {
for (int i = 0; i < columnCount(); ++i) {
_p_peptide_list_window->ui->tableView->setItemDelegateForColumn(i, _p_peptide_list_window->ui->tableView->itemDelegate());
if (mapToSource(index(0, i)).column() == (std::int8_t) PeptideListColumn::experimental_mhplus) {
......@@ -276,10 +283,10 @@ void PeptideTableProxyModel::resteItemDelegates() const {
_p_peptide_list_window->ui->tableView->setItemDelegateForColumn(i, _second_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);
*/
/*
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);
*/
}
......@@ -39,6 +39,7 @@ class PeptideTableProxyModel : public QSortFilterProxyModel
Q_OBJECT
public:
PeptideTableProxyModel(PeptideListWindow * p_peptide_list_window, PeptideTableModel* peptide_table_model_p);
virtual ~PeptideTableProxyModel();
bool filterAcceptsRow(int source_row,
const QModelIndex &source_parent) const override;
bool filterAcceptsColumn(int source_column, const QModelIndex & source_parent) const override;
......
......@@ -25,7 +25,6 @@
#include "ui_protein_view.h"
#include "../mainwindow.h"
#include "../widgets/massitemdelegate.h"
#include <QSettings>
ProteinListQactionColumn::ProteinListQactionColumn(ProteinListWindow * parent, ProteinListColumn column):QAction(parent) {
......@@ -81,10 +80,7 @@ ProteinListWindow::ProteinListWindow(ProjectWindow *parent):
ui->tableView->setModel( _p_proxy_model );
ui->tableView->setSortingEnabled(true);
ui->tableView->setAlternatingRowColors(true);
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();
if (hide) {
......@@ -321,7 +317,7 @@ void ProteinListWindow::setIdentificationGroup(IdentificationGroup * p_identific
completer->setFilterMode(Qt::MatchContains);
ui->mod_auto_completion->setCompleter(completer);
_p_proxy_model->resteItemDelegates();
}
else {
qDebug() << "ProteinListWindow::setIdentificationGroup null";
......
......@@ -40,8 +40,15 @@ ProteinTableProxyModel::ProteinTableProxyModel(ProteinListWindow * p_protein_lis
_column_display[i] = settings.value(QString("protein_list_columns/%1").arg(_protein_table_model_p->getTitle((ProteinListColumn)i)), "true").toBool();
}
_percent_delegate = new PercentItemDelegate(p_protein_list_window->ui->tableView);
}
ProteinTableProxyModel::~ProteinTableProxyModel()
{
//delete _percent_delegate;
}
bool ProteinTableProxyModel::filterAcceptsColumn(int source_column, const QModelIndex & source_parent) const {
return _column_display[source_column];
}
......@@ -271,7 +278,21 @@ void ProteinTableProxyModel::setProteinListColumnDisplay(ProteinListColumn colum
_column_display[(std::int8_t) column] = toggled;
endResetModel();
resteItemDelegates();
}
bool ProteinTableProxyModel::getProteinListColumnDisplay(ProteinListColumn column) const {
return _column_display[(std::int8_t) column];
}
void ProteinTableProxyModel::resteItemDelegates() const {
for (int i = 0; i < columnCount(); ++i) {
_p_protein_list_window->ui->tableView->setItemDelegateForColumn(i, _p_protein_list_window->ui->tableView->itemDelegate());
if (mapToSource(index(0, i)).column() == (std::int8_t) ProteinListColumn::coverage) {
_p_protein_list_window->ui->tableView->setItemDelegateForColumn(i, _percent_delegate);
}
}
}
......@@ -28,6 +28,7 @@
#include <QSortFilterProxyModel>
#include "../../core/project.h"
#include "proteintablemodel.h"
#include "../widgets/massitemdelegate.h"
class ProteinListWindow;
......@@ -38,6 +39,8 @@ class ProteinTableProxyModel : public QSortFilterProxyModel
Q_OBJECT
public:
ProteinTableProxyModel(ProteinListWindow * p_protein_list_window, ProteinTableModel* protein_table_model_p);
virtual ~ProteinTableProxyModel();
bool filterAcceptsRow(int source_row,
const QModelIndex &source_parent) const override;
bool filterAcceptsColumn(int source_column, const QModelIndex & source_parent) const override;
......@@ -54,9 +57,11 @@ public:
void setSearchOn(QString search_on);
void setProteinListColumnDisplay(ProteinListColumn column, bool toggled);
bool getProteinListColumnDisplay(ProteinListColumn column) const;
void resteItemDelegates() const;
public slots:
void onTableClicked(const QModelIndex &index);
private:
ProteinTableModel* _protein_table_model_p;
......@@ -67,6 +72,7 @@ private:
bool _hide_not_checked = true;
bool _hide_not_grouped = true;
std::vector<bool> _column_display;
PercentItemDelegate * _percent_delegate;
};
#endif // PROTEINTABLEPROXYMODEL_H
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