Skip to content

Commit

Permalink
- add plus / minus buttons to increase number of opt items visible
Browse files Browse the repository at this point in the history
  • Loading branch information
fbergmann committed Oct 15, 2024
1 parent b4e164b commit e0d4238
Show file tree
Hide file tree
Showing 4 changed files with 79 additions and 0 deletions.
38 changes: 38 additions & 0 deletions copasi/UI/CQFittingWidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -373,6 +373,44 @@ void CQFittingWidget::init()
mpCurrentList = mpParameters;
mpExperimentSet = NULL;
mpCrossValidationSet = NULL;

// add 2 more tab pages that when clicked will increase / decrease the height of the tab widget
QToolButton * tb = new QToolButton();
tb->setText("+");
QObject::connect(tb, SIGNAL(clicked()), this, SLOT(slotIncreaseTabHeight()));
// Add empty, not enabled tab to tabWidget
mpTabWidget->addTab(new QLabel("Add height by pressing \"+\""), QString());
mpTabWidget->setTabEnabled(2, false);
// Add tab button to current tab. Button will be enabled, but tab -- not
mpTabWidget->tabBar()->setTabButton(2, QTabBar::RightSide, tb);

tb = new QToolButton();
tb->setText("-");
QObject::connect(tb, SIGNAL(clicked()), this, SLOT(slotDecreaseTabHeight()));
// Add empty, not enabled tab to tabWidget
mpTabWidget->addTab(new QLabel("Remove height by pressing \"-\""), QString());
mpTabWidget->setTabEnabled(3, false);
// Add tab button to current tab. Button will be enabled, but tab -- not
mpTabWidget->tabBar()->setTabButton(3, QTabBar::RightSide, tb);


}

void CQFittingWidget::slotIncreaseTabHeight()
{
auto height = mpTabWidget->height();
height += 100;
mpTabWidget->setMinimumHeight(height);
}


void CQFittingWidget::slotDecreaseTabHeight()
{
auto height = mpTabWidget->height();
if (height < 300)
return;
height -= 100;
mpTabWidget->setMinimumHeight(height);
}

void CQFittingWidget::slotParameterNumberChanged(int number)
Expand Down
2 changes: 2 additions & 0 deletions copasi/UI/CQFittingWidget.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@ class CQFittingWidget : public TaskWidget, public Ui::CQFittingWidget
public slots:
void slotParameterNumberChanged(int number);
void slotConstraintNumberChanged(int number);
void slotIncreaseTabHeight();
void slotDecreaseTabHeight();

protected:
CQFittingItemWidget * mpCurrentList;
Expand Down
36 changes: 36 additions & 0 deletions copasi/UI/CQOptimizationWidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -242,8 +242,44 @@ void CQOptimizationWidget::init()
connect(mpConstraints, SIGNAL(numberChanged(int)), this, SLOT(slotConstraintNumberChanged(int)));

mpCurrentList = mpParameters;

// add 2 more tab pages that when clicked will increase / decrease the height of the tab widget
QToolButton * tb = new QToolButton();
tb->setText("+");
QObject::connect(tb, SIGNAL(clicked()), this, SLOT(slotIncreaseTabHeight()));
// Add empty, not enabled tab to tabWidget
mpTabWidget->addTab(new QLabel("Add height by pressing \"+\""), QString());
mpTabWidget->setTabEnabled(2, false);
// Add tab button to current tab. Button will be enabled, but tab -- not
mpTabWidget->tabBar()->setTabButton(2, QTabBar::RightSide, tb);

tb = new QToolButton();
tb->setText("-");
QObject::connect(tb, SIGNAL(clicked()), this, SLOT(slotDecreaseTabHeight()));
// Add empty, not enabled tab to tabWidget
mpTabWidget->addTab(new QLabel("Remove height by pressing \"-\""), QString());
mpTabWidget->setTabEnabled(3, false);
// Add tab button to current tab. Button will be enabled, but tab -- not
mpTabWidget->tabBar()->setTabButton(3, QTabBar::RightSide, tb);
}

void CQOptimizationWidget::slotIncreaseTabHeight()
{
auto height = mpTabWidget->height();
height += 100;
mpTabWidget->setMinimumHeight(height);
}

void CQOptimizationWidget::slotDecreaseTabHeight()
{
auto height = mpTabWidget->height();
if (height < 300)
return;
height -= 100;
mpTabWidget->setMinimumHeight(height);
}


void CQOptimizationWidget::destroy()
{}

Expand Down
3 changes: 3 additions & 0 deletions copasi/UI/CQOptimizationWidget.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,9 @@ public slots:
void slotParameterNumberChanged(int number);
void slotConstraintNumberChanged(int number);
virtual void slotEditExpression();
void slotIncreaseTabHeight();
void slotDecreaseTabHeight();


protected:
CQFittingItemWidget * mpCurrentList;
Expand Down

0 comments on commit e0d4238

Please sign in to comment.