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 @@
#include <QSettings>
ProteinListQactionColumn::ProteinListQactionColumn(ProteinListWindow * parent, ProteinListColumn column):QAction(parent) {
this->setText(ProteinTableModel::getTitle(column));
this->setCheckable(true);
//evalue_action.setChecked(_display_evalue);
//connect(p_action, SIGNAL(toggled(bool)), this, SLOT(showEvalueColumn(bool)));
_column = column;
_p_protein_list_window = parent;
this->setCheckable(true);
this->setChecked(parent->getProteinListColumnDisplay(column));
//evalue_action.setChecked(_display_evalue);
//connect(p_action, SIGNAL(toggled(bool)), this, SLOT(showEvalueColumn(bool)));
_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()
{
//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):
QMainWindow(parent),
......@@ -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:
explicit ProteinListQactionColumn(ProteinListWindow * parent, ProteinListColumn column);
~ProteinListQactionColumn();
public slots:
void doToggled(bool toggled);
private:
ProteinListWindow * _p_protein_list_window;
ProteinListColumn _column;
......@@ -59,6 +63,8 @@ public:
explicit ProteinListWindow(ProjectWindow * parent = 0);
~ProteinListWindow();
void setIdentificationGroup(IdentificationGroup * p_identification_group);
void setProteinListColumnDisplay(ProteinListColumn column, bool toggled);
bool getProteinListColumnDisplay(ProteinListColumn column) const;
void edited();
......
......@@ -207,3 +207,12 @@ void ProteinTableProxyModel::setSearchOn(QString search_on) {
void ProteinTableProxyModel::setProteinSearchString(QString 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 @@
#include <QAbstractTableModel>
#include <QSortFilterProxyModel>
#include "../../core/project.h"
#include "proteintablemodel.h"
class ProteinListWindow;
class ProteinTableModel;
class ProteinTableProxyModel : public QSortFilterProxyModel
{
Q_OBJECT
......@@ -49,6 +51,8 @@ public:
void hideNotGrouped(bool hide);
void setProteinSearchString(QString protein_search_string);
void setSearchOn(QString search_on);
void setProteinListColumnDisplay(ProteinListColumn column, bool toggled);
bool getProteinListColumnDisplay(ProteinListColumn column) const;
public slots:
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