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

working context menu

parent 8625aff0
No related branches found
No related tags found
No related merge requests found
...@@ -28,21 +28,42 @@ ...@@ -28,21 +28,42 @@
#include <QSettings> #include <QSettings>
ProteinListQactionColumn::ProteinListQactionColumn(ProteinListWindow * parent, ProteinListColumn column):QAction(parent) { ProteinListQactionColumn::ProteinListQactionColumn(ProteinListWindow * parent, ProteinListColumn column):QAction(parent) {
this->setText(ProteinTableModel::getTitle(column)); this->setText(ProteinTableModel::getTitle(column));
this->setCheckable(true); this->setCheckable(true);
//evalue_action.setChecked(_display_evalue); this->setChecked(parent->getProteinListColumnDisplay(column));
//connect(p_action, SIGNAL(toggled(bool)), this, SLOT(showEvalueColumn(bool))); //evalue_action.setChecked(_display_evalue);
_column = column; //connect(p_action, SIGNAL(toggled(bool)), this, SLOT(showEvalueColumn(bool)));
_p_protein_list_window = parent; _column = column;
_p_protein_list_window = parent;
#if QT_VERSION >= 0x050000
// Qt5 code
/*
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 (this, SIGNAL(toggled(bool)), this,SLOT(doToggled(bool)));
#endif
} }
ProteinListQactionColumn::~ProteinListQactionColumn() ProteinListQactionColumn::~ProteinListQactionColumn()
{ {
//if (_p_ms_data_file != nullptr) delete _p_ms_data_file; //if (_p_ms_data_file != nullptr) delete _p_ms_data_file;
qDebug() << "ProteinListQactionColumn::~ProteinListQactionColumn begin ";
} }
void ProteinListQactionColumn::doToggled(bool toggled) {
qDebug() << "ProteinListQactionColumn::doToggled begin " << toggled;
setChecked(toggled);
_p_protein_list_window->setProteinListColumnDisplay(_column, toggled);
qDebug() << "ProteinListQactionColumn::doToggled end";
}
ProteinListWindow::ProteinListWindow(ProjectWindow *parent): ProteinListWindow::ProteinListWindow(ProjectWindow *parent):
QMainWindow(parent), QMainWindow(parent),
...@@ -261,3 +282,10 @@ void ProteinListWindow::updateStatusBar() { ...@@ -261,3 +282,10 @@ void ProteinListWindow::updateStatusBar() {
} }
} }
void ProteinListWindow::setProteinListColumnDisplay(ProteinListColumn column, bool toggled) {
_p_proxy_model->setProteinListColumnDisplay(column, toggled);
}
bool ProteinListWindow::getProteinListColumnDisplay(ProteinListColumn column) const {
return _p_proxy_model->getProteinListColumnDisplay(column);
}
...@@ -44,6 +44,10 @@ public: ...@@ -44,6 +44,10 @@ public:
explicit ProteinListQactionColumn(ProteinListWindow * parent, ProteinListColumn column); explicit ProteinListQactionColumn(ProteinListWindow * parent, ProteinListColumn column);
~ProteinListQactionColumn(); ~ProteinListQactionColumn();
public slots:
void doToggled(bool toggled);
private: private:
ProteinListWindow * _p_protein_list_window; ProteinListWindow * _p_protein_list_window;
ProteinListColumn _column; ProteinListColumn _column;
...@@ -59,6 +63,8 @@ public: ...@@ -59,6 +63,8 @@ public:
explicit ProteinListWindow(ProjectWindow * parent = 0); explicit ProteinListWindow(ProjectWindow * parent = 0);
~ProteinListWindow(); ~ProteinListWindow();
void setIdentificationGroup(IdentificationGroup * p_identification_group); void setIdentificationGroup(IdentificationGroup * p_identification_group);
void setProteinListColumnDisplay(ProteinListColumn column, bool toggled);
bool getProteinListColumnDisplay(ProteinListColumn column) const;
void edited(); void edited();
......
...@@ -207,3 +207,12 @@ void ProteinTableProxyModel::setSearchOn(QString search_on) { ...@@ -207,3 +207,12 @@ void ProteinTableProxyModel::setSearchOn(QString search_on) {
void ProteinTableProxyModel::setProteinSearchString(QString protein_search_string) { void ProteinTableProxyModel::setProteinSearchString(QString protein_search_string) {
_protein_search_string = protein_search_string; _protein_search_string = protein_search_string;
} }
void ProteinTableProxyModel::setProteinListColumnDisplay(ProteinListColumn column, bool toggled) {
qDebug() << "ProteinTableProxyModel::setProteinListColumnDisplay begin " << toggled;
beginResetModel();
_column_display[(std::int8_t) column] = toggled;
endResetModel();
}
bool ProteinTableProxyModel::getProteinListColumnDisplay(ProteinListColumn column) const {
return _column_display[(std::int8_t) column];
}
...@@ -27,10 +27,12 @@ ...@@ -27,10 +27,12 @@
#include <QAbstractTableModel> #include <QAbstractTableModel>
#include <QSortFilterProxyModel> #include <QSortFilterProxyModel>
#include "../../core/project.h" #include "../../core/project.h"
#include "proteintablemodel.h"
class ProteinListWindow; class ProteinListWindow;
class ProteinTableModel; class ProteinTableModel;
class ProteinTableProxyModel : public QSortFilterProxyModel class ProteinTableProxyModel : public QSortFilterProxyModel
{ {
Q_OBJECT Q_OBJECT
...@@ -49,6 +51,8 @@ public: ...@@ -49,6 +51,8 @@ public:
void hideNotGrouped(bool hide); void hideNotGrouped(bool hide);
void setProteinSearchString(QString protein_search_string); void setProteinSearchString(QString protein_search_string);
void setSearchOn(QString search_on); void setSearchOn(QString search_on);
void setProteinListColumnDisplay(ProteinListColumn column, bool toggled);
bool getProteinListColumnDisplay(ProteinListColumn column) const;
public slots: public slots:
void onTableClicked(const QModelIndex &index); void onTableClicked(const QModelIndex &index);
......
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