23 #include <QFormLayout>
24 #include <QPushButton>
25 #include <QVBoxLayout>
29 , m_currentItem(nullptr)
31 setWindowTitle(QLatin1String(
"Minimizer Settings"));
32 setAttribute(Qt::WA_StyledBackground,
true);
33 setProperty(
"stylable",
true);
48 ASSERT(minimizerItem);
62 QSignalBlocker b(minimizerCombo);
63 minimizerCombo->setCurrentIndex(minimizerDescriptor.currentIndex());
67 auto* w =
new QWidget(
this);
81 auto* combo =
new QComboBox(
this);
83 combo->setMaxCount(d.
options.size());
86 connect(combo, qOverload<int>(&QComboBox::currentIndexChanged),
90 QSignalBlocker b(combo);
100 spinBox->setToolTip(d.
tooltip);
102 [=](
double newValue) { d.
set(newValue); });
104 m_updaters << [=]() { spinBox->updateValue(); };
111 auto* spinBox =
new QSpinBox(
this);
112 spinBox->setToolTip(d.
tooltip);
113 spinBox->setMaximum(std::numeric_limits<int>::max());
114 spinBox->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Fixed);
116 if (d.
limits.hasLowerLimit())
117 spinBox->setMinimum(
static_cast<int>(d.
limits.lowerLimit()));
118 if (d.
limits.hasUpperLimit())
119 spinBox->setMaximum(
static_cast<int>(d.
limits.upperLimit()));
121 spinBox->setValue(d.
get());
123 QObject::connect(spinBox, QOverload<int>::of(&QSpinBox::valueChanged),
124 [=](
int newValue) { d.
set(newValue); });
127 QSignalBlocker b(spinBox);
128 spinBox->setValue(d.
get());
139 if (std::holds_alternative<DoubleDescriptor>(v)) {
140 auto d = std::get<DoubleDescriptor>(v);
143 auto d = std::get<SelectionDescriptor<QString>>(v);
145 }
else if (std::holds_alternative<UIntDescriptor>(v)) {
146 auto d = std::get<UIntDescriptor>(v);
Defines class DoubleSpinBox.
Defines class FitSuiteItem.
Defines namespace GUI::Util::Layout.
Defines MinimizerItem class.
Describes properties of a double value which are necessary to allow GUI representation,...
function< void(double)> set
function to set the value
QString tooltip
Tooltip text.
SpinBox for DoubleDescriptors, supporting units.
void baseValueChanged(double newBaseValue)
Emitted whenever the value changes.
MinimizerContainerItem * minimizerContainerItem()
FitSuiteItem * fitSuiteItem()
The MinimizerContainerItem class holds collection of minimizers.
SelectionDescriptor< QString > objectiveMetric() const
SelectionDescriptor< MinimizerItem * > minimizers() const
SelectionDescriptor< QString > normFunction() const
Describes a selection (various possibilities and the current one).
int currentIndex() const override
Get currently selected option.
QStringList options
List of options, usually presented as combo entries.
void setCurrentIndex(int newIndex) const override
Set currently selected option.
QString tooltip
Tooltip text.
Describes properties of a uint value which are necessary to allow GUI representation,...
function< void(uint)> set
function to set the value
QString tooltip
Tooltip text.
RealLimits limits
Limits of the value.
function< uint()> get
function to get the current value
void clearLayout(QLayout *layout, bool deleteWidgets=true)
Removes content from box layout.
QComboBox * createSelectionCombo(QWidget *parent, const SelectionDescriptor< T > d, std::function< void(int)> slot=nullptr)
Create a combo box with the information found in a selection descriptor.