15 #ifndef BORNAGAIN_GUI_VIEW_TOOL_WIDGETUTILS_H
16 #define BORNAGAIN_GUI_VIEW_TOOL_WIDGETUTILS_H
46 std::function<
void(
int)> slot =
nullptr)
48 auto* combo =
new QComboBox(parent);
50 combo->setMaxCount(d.
options.size());
55 QObject::connect(combo, qOverload<int>(&QComboBox::currentIndexChanged),
59 QObject::connect(combo, qOverload<int>(&QComboBox::currentIndexChanged),
60 [=](
int newIndex) { slot(newIndex); });
76 std::function<
void(uint)> slot =
nullptr);
98 std::function<
void(
double)> slot =
nullptr);
112 std::function<
void(
double)> slot =
nullptr);
117 QString
labelWithUnit(
const QString& label, std::variant<QString, Unit> unit);
Defines classes releted to event filtering.
Defines class SelectionDescriptor.
Describes properties of a double value which are necessary to allow GUI representation,...
SpinBox for DoubleDescriptors, supporting units.
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,...
static void install(QObject *obj)
ScientificSpinBox * createScientificSpinBox(QFormLayout *parentLayout, const DoubleDescriptor &d, std::function< void(double)> slot=nullptr)
Create a label and a scientific spin box with the information found in a DoubleDescriptor and place t...
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.
QSpinBox * createSpinBox(QWidget *parent, const UIntDescriptor &d, std::function< void(uint)> slot=nullptr)
Create a spin box with the information found in a UIntDescriptor.
QString labelWithUnit(const QString &label, std::variant< QString, Unit > unit)
Create a label with an optional unit in brackets.