Skip to content

Commit

Permalink
- issue 3235: use spinbox rather than line edit
Browse files Browse the repository at this point in the history
  • Loading branch information
fbergmann committed May 14, 2024
1 parent f98b225 commit 7e8de8f
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
12 changes: 7 additions & 5 deletions copasi/plotUI/CQCustomPlot.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
# include <QApplication>
# include <QScrollBar>
# include <QStatusBar>
# include <QLineEdit>
# include <QSpinBox>

class CHistoHelper
{
Expand Down Expand Up @@ -1440,10 +1440,12 @@ void CQCustomPlot::setupStatusbar(QStatusBar * bar)

if (!mpMaxLegend)
{
mpMaxLegend = new QLineEdit(this);
mpMaxLegend = new QSpinBox(this);
mpMaxLegend->setToolTip("Maximum number of legend items to show");
mpMaxLegend->setText(QString::number(9));
QObject::connect(mpMaxLegend, &QLineEdit::textChanged, this, &CQCustomPlot::setupLegend);
mpMaxLegend->setValue(9);
mpMaxLegend->setMinimum(1);
mpMaxLegend->setMaximum(1000);
QObject::connect(mpMaxLegend, &QSpinBox::valueChanged, this, &CQCustomPlot::setupLegend);
}
bar->addPermanentWidget(mpMaxLegend, 0);

Expand Down Expand Up @@ -2347,7 +2349,7 @@ void CQCustomPlot::setupLegend()
if (!mpMaxLegend || !legend || !mpScrollbar || !mpPosLabel)
return;

int maxItems = mpMaxLegend->text().toInt();
int maxItems = mpMaxLegend->value();
if (maxItems == 0)
return;

Expand Down
4 changes: 2 additions & 2 deletions copasi/plotUI/CQCustomPlot.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ class CHistoHelper;
class CPlotSpec2Vector;
class CPlotSpecification;
class CPlotSpectogram;
class QLineEdit;
class QSpinBox;
class QScrollBar;

class CQCustomPlot
Expand Down Expand Up @@ -353,7 +353,7 @@ private slots:

bool mHaveNewData;
QScrollBar * mpScrollbar;
QLineEdit * mpMaxLegend;
QSpinBox * mpMaxLegend;
QLabel * mpPosLabel;
QCPRange mOldX;
QCPRange mOldY;
Expand Down

0 comments on commit 7e8de8f

Please sign in to comment.