27 #include <QFormLayout>
36 setWindowTitle(
"Properties");
37 setAttribute(Qt::WA_StyledBackground,
true);
38 setProperty(
"stylable",
true);
58 if (!sessionItemWidget)
80 axesUnitsDescriptor = p->axesUnits();
81 xAxisItem = p->xAxisItem();
82 yAxisItem = p->yAxisItem();
84 axesUnitsDescriptor = p->axesUnitsDescriptor();
85 xAxisItem = p->xAxisItem();
86 yAxisItem = p->yAxisItem();
93 auto* xGroup =
new QGroupBox(
"X axis",
this);
94 auto* xFormLayout =
new QFormLayout(xGroup);
95 xFormLayout->setContentsMargins(0, 0, 0, 0);
96 xFormLayout->setSpacing(5);
105 auto* yGroup =
new QGroupBox(
"Y axis",
this);
106 auto* yFormLayout =
new QFormLayout(yGroup);
107 yFormLayout->setContentsMargins(0, 0, 0, 0);
108 yFormLayout->setSpacing(5);
136 [=](
double newValue) { d.
set(newValue); });
138 m_updaters << [=]() { spinBox->updateValue(); };
145 auto* edit =
new QLineEdit(
this);
146 connect(edit, &QLineEdit::textEdited, [=](
const QString& t) { item->
setValue(t); });
156 title, [=]() {
return item->
value().toBool(); }, [=](
bool b) { item->
setValue(b); });
160 function<
void(
bool)> setter)
162 auto* checkBox =
new QCheckBox(title,
this);
163 connect(checkBox, &QCheckBox::stateChanged, [=]() { setter(checkBox->isChecked()); });
166 QSignalBlocker b(checkBox);
167 checkBox->setChecked(getter());
175 auto* combo =
new QComboBox(
this);
177 combo->setMaxCount(d.
options.size());
179 connect(combo, qOverload<int>(&QComboBox::currentIndexChanged),
183 QSignalBlocker b(combo);
Defines various axis items.
Defines class ComboProperty.
Defines class Data1DViewItem.
Defines class DoubleSpinBox.
Defines namespace GUI::Util::Layout.
Defines class SpecularDataItem.
SessionItem * logScaleItem() const
DoubleDescriptor min(const QString &unit=QString()) const
SessionItem * titleItem() const
DoubleDescriptor max(const QString &unit=QString()) const
View model for 1D DataItem. Can represent several items at once. In current implementation the first ...
static void updateAxesUnits(SessionItem *item, const QString &name, InstrumentItem *instrumentItem)
Describes properties of a double value which are necessary to allow GUI representation,...
function< void(double)> set
function to set the value
SpinBox for DoubleDescriptors, supporting units.
void baseValueChanged(double newBaseValue)
Emitted whenever the value changes.
void unsubscribe(const void *caller)
Cancels all subscriptions of given caller.
void setOnPropertyChange(std::function< void(QString)> f, const void *caller=nullptr)
void setOnChildPropertyChange(std::function< void(SessionItem *, QString)> f, const void *caller=nullptr)
Calls back on child property change, report childItem and property name.
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.
Base class for a GUI data item.
QVariant value() const
Get value.
bool setValue(QVariant value)
Set value, ensure that variant types match.
ModelMapper * mapper()
Returns the current model mapper of this item. Creates new one if necessary.
QString const & name(EShape k)
void clearLayout(QLayout *layout, bool deleteWidgets=true)
Removes content from box layout.