Skip to content

Commit

Permalink
Merge ElucidataInc#1378 from MdAzmatAli/fix_buttonToggle
Browse files Browse the repository at this point in the history
[FIX] fixed the tic button toggling
  • Loading branch information
saif-el authored Feb 17, 2021
2 parents 5408a7c + 2bae636 commit 813b019
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 20 deletions.
15 changes: 15 additions & 0 deletions src/gui/mzroll/eicwidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1774,6 +1774,21 @@ void EicWidget::print(QPaintDevice* printer) {
render(&painter);
}

void EicWidget::showTicLine(bool f) {
_showTicLine = f;
optionTicChecked(f);
}

void EicWidget::showBarPlot(bool f) {
_showBarPlot = f;
optionBarPlotChecked(f);
}

void EicWidget::showBoxPlot(bool f) {
_showBoxPlot = f;
optionBoxPlotChecked(f);
}

void EicWidget::contextMenuEvent(QContextMenuEvent * event)
{
event->ignore();
Expand Down
18 changes: 8 additions & 10 deletions src/gui/mzroll/eicwidget.h
Original file line number Diff line number Diff line change
Expand Up @@ -97,9 +97,7 @@ public Q_SLOTS:
void showPeaks(bool f) {
_showPeaks = f;
}
void showTicLine(bool f) {
_showTicLine = f;
}
void showTicLine(bool f);
void showBicLine(bool f) { //TODO: Sahil Added while mergin eicWidget
_showBicLine=f;
}
Expand Down Expand Up @@ -137,12 +135,9 @@ public Q_SLOTS:
f ? setCursor(Qt::SizeHorCursor) : setCursor(Qt::ArrowCursor);
}

void showBarPlot(bool f) {
_showBarPlot = f;
}
void showBoxPlot(bool f) {
_showBoxPlot = f;
}
void showBarPlot(bool f);

void showBoxPlot(bool f);

void autoZoom(bool f) {
_autoZoom = f;
Expand Down Expand Up @@ -192,7 +187,10 @@ public Q_SLOTS:
void peakMarkedEicWidget();
void groupSet(shared_ptr<PeakGroup>);
void compoundSet(Compound*);

void optionTicChecked(bool);
void optionBarPlotChecked(bool);
void optionBoxPlotChecked(bool);

private:
EICLogic* eicParameters;
float _focusLineRt; // 0
Expand Down
21 changes: 11 additions & 10 deletions src/gui/mzroll/mainwindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4207,15 +4207,13 @@ QWidget* MainWindowWidgetAction::createWidget(QWidget *parent) {

QToolButton *btnShowTic = new QToolButton(parent);
btnShowTic->setCheckable(true);
btnShowTic->setChecked(false);
btnShowTic->setChecked(false);
btnShowTic->setIcon(QIcon(rsrcPath + "/tic.png"));
btnShowTic->setToolTip(tr("Show TICs"));
connect(btnShowTic, SIGNAL(toggled(bool)), mw->getEicWidget(),
SLOT(showTicLine(bool)));
connect(btnShowTic, SIGNAL(toggled(bool)), mw->getEicWidget(), SLOT(replot()));

connect(btnShowTic, &QToolButton::toggled, mw->getEicWidget(), &EicWidget::showTicLine);
connect(btnShowTic, SIGNAL(toggled(bool)), mw->getEicWidget(), SLOT(replot()));
connect(mw->getEicWidget(), &EicWidget::optionTicChecked, btnShowTic, &QToolButton::setChecked);
return btnShowTic;

}
else if (btnName == "btnShowBarplot") {

Expand All @@ -4224,8 +4222,9 @@ QWidget* MainWindowWidgetAction::createWidget(QWidget *parent) {
btnShowBarplot->setToolTip(tr("Show bar-plot"));
btnShowBarplot->setCheckable(true);
btnShowBarplot->setChecked(true);
connect(btnShowBarplot,SIGNAL(toggled(bool)), mw->getEicWidget(), SLOT(showBarPlot(bool)));
connect(btnShowBarplot,&QToolButton::toggled, mw->getEicWidget(), &EicWidget::showBarPlot);
connect(btnShowBarplot,SIGNAL(toggled(bool)), mw->getEicWidget(), SLOT(replot()));
connect(mw->getEicWidget(), &EicWidget::optionBarPlotChecked, btnShowBarplot, &QToolButton::setChecked);
return btnShowBarplot;
}
else if (btnName == "btnShowIsotopeplot") {
Expand All @@ -4248,9 +4247,11 @@ QWidget* MainWindowWidgetAction::createWidget(QWidget *parent) {
btnShowBoxplot->setToolTip(tr("Show box-plot"));
btnShowBoxplot->setCheckable(true);
btnShowBoxplot->setChecked(false);
connect(btnShowBoxplot,SIGNAL(toggled(bool)), mw->getEicWidget(),SLOT(showBoxPlot(bool)));
connect(btnShowBoxplot,SIGNAL(toggled(bool)),mw,SLOT(analyticsBoxPlot()));
connect(btnShowBoxplot,SIGNAL(toggled(bool)), mw->getEicWidget(), SLOT(replot()));
connect(btnShowBoxplot, &QToolButton::toggled, mw->getEicWidget(), &EicWidget::showBoxPlot);
connect(btnShowBoxplot, SIGNAL(toggled(bool)), mw, SLOT(analyticsBoxPlot()));
connect(btnShowBoxplot, SIGNAL(toggled(bool)), mw->getEicWidget(), SLOT(replot()));
connect(mw->getEicWidget(), &EicWidget::optionBoxPlotChecked, btnShowBoxplot, &QToolButton::setChecked);

return btnShowBoxplot;
}
else if (btnName == "spacer") {
Expand Down

0 comments on commit 813b019

Please sign in to comment.