diff --git a/src/gui/protein_list_view/proteinlistwindow.cpp b/src/gui/protein_list_view/proteinlistwindow.cpp index 02c29b859e07f0acfa44bee1bff13c3bde412970..3b3b55d737e95bf1f55075c7326315f5cc671df2 100644 --- a/src/gui/protein_list_view/proteinlistwindow.cpp +++ b/src/gui/protein_list_view/proteinlistwindow.cpp @@ -38,23 +38,24 @@ ProteinListWindow::ProteinListWindow(QWidget *parent): connect(&workerThread, &QThread::finished, worker, &QObject::deleteLater); connect(this, &PtSpectrumViewer::operateMsDataFile, worker, &PwizLoaderThread::doMsDataFileLoad); connect(worker, &PwizLoaderThread::msDataReady, this, &PtSpectrumViewer::handleMsDataFile); -*/ + */ #else // Qt4 code -/* - connect(&workerThread, SIGNAL(finished()), worker, SLOT(deleteLater())); - connect(this, SIGNAL(operateMsDataFile(QString)), worker,SLOT(doMsDataFileLoad(QString))); - connect(worker, SIGNAL(msDataReady(pwiz::msdata::MSDataFile *)), this, SLOT(handleMsDataFile(pwiz::msdata::MSDataFile *))); - */ + /* + connect(&workerThread, SIGNAL(finished()), worker, SLOT(deleteLater())); + connect(this, SIGNAL(operateMsDataFile(QString)), worker,SLOT(doMsDataFileLoad(QString))); + connect(worker, SIGNAL(msDataReady(pwiz::msdata::MSDataFile *)), this, SLOT(handleMsDataFile(pwiz::msdata::MSDataFile *))); + */ #endif /* */ _protein_table_model_p = new ProteinTableModel(0); - - - _p_proxy_model = new ProteinTableProxyModel(); + + + _p_proxy_model = new ProteinTableProxyModel(this); _p_proxy_model->setSourceModel(_protein_table_model_p); + _p_proxy_model->setDynamicSortFilter(true); ui->tableView->setModel( _p_proxy_model ); } @@ -66,6 +67,8 @@ ProteinListWindow::~ProteinListWindow() } - void ProteinListWindow::setProject(Project* project_p) { - _protein_table_model_p->setProject(project_p); - } +void ProteinListWindow::setProject(Project* project_p) { + _protein_table_model_p->setProject(project_p); + _p_proxy_model->setSourceModel(_protein_table_model_p); + +} diff --git a/src/gui/protein_list_view/proteintablemodel.cpp b/src/gui/protein_list_view/proteintablemodel.cpp index 2d46cd76b041cf39b9791c88579d1a09e4ad5f34..b798a8e30e7b75f3e79cd3e1162a2520276e241f 100644 --- a/src/gui/protein_list_view/proteintablemodel.cpp +++ b/src/gui/protein_list_view/proteintablemodel.cpp @@ -31,6 +31,16 @@ ProteinTableProxyModel::ProteinTableProxyModel(QObject *parent): QSortFilterProx { } +bool ProteinTableProxyModel::filterAcceptsRow(int source_row, + const QModelIndex &source_parent) const { + return true; +} +QVariant ProteinTableProxyModel::headerData(int section, Qt::Orientation orientation, + int role) const { + return sourceModel()->headerData(section, orientation, + role); +} + ProteinTableModel::ProteinTableModel(QObject *parent) :QAbstractTableModel(parent) { @@ -43,16 +53,18 @@ ProteinTableModel::ProteinTableModel(QObject *parent) void ProteinTableModel::setProject(Project * p_project) { - qDebug() << "ProteinTableModel::setProject begin " << p_project->getProteinList().size(); + qDebug() << "ProteinTableModel::setProject begin " << p_project->getProteinList().size(); _p_project = p_project; - + QModelIndex topLeft = createIndex(0,0); + QModelIndex bottomRight = createIndex(rowCount(),columnCount()); + emit dataChanged(topLeft, bottomRight); emit headerDataChanged(Qt::Horizontal, 0,3); - emit dataChanged(topLeft, topLeft); } int ProteinTableModel::rowCount(const QModelIndex &parent ) const { if (_p_project != nullptr) { + qDebug() << "ProteinTableModel::rowCount(const QModelIndex &parent ) " << _p_project->getProteinList().size(); return _p_project->getProteinList().size(); } return 0; diff --git a/src/gui/protein_list_view/proteintablemodel.h b/src/gui/protein_list_view/proteintablemodel.h index bc6aa5cd493cb66bfa743bedf6c3e0aed730dabe..eef8b80b245b5c0471e8f90fbabee5d51e49efc3 100644 --- a/src/gui/protein_list_view/proteintablemodel.h +++ b/src/gui/protein_list_view/proteintablemodel.h @@ -34,14 +34,14 @@ class ProteinTableProxyModel : public QSortFilterProxyModel Q_OBJECT public: ProteinTableProxyModel(QObject* parent = 0); - //bool filterAcceptsRow(int source_row, - // const QModelIndex &source_parent) const; - // QVariant headerData(int section, Qt::Orientation orientation, - // int role) const; + bool filterAcceptsRow(int source_row, + const QModelIndex &source_parent) const; + QVariant headerData(int section, Qt::Orientation orientation, + int role) const; public slots: //void setMinGravity(double minGravity); - // void setMinDensity(double minDensity); + // void setMinDensity(double minDensity); private: double m_minGravity; double m_minDensity;