37#include <QApplication>
43#include <klocalizedstring.h>
77 QHBoxLayout*
const hlay =
new QHBoxLayout(
this);
79 d->resetButton =
new QToolButton(
this);
80 d->resetButton->setAutoRaise(
true);
81 d->resetButton->setFocusPolicy(Qt::NoFocus);
83 d->resetButton->setToolTip(i18nc(
"@info:tooltip",
"Reset to default value"));
85 hlay->addWidget(
d->input);
86 hlay->addWidget(
d->resetButton);
87 hlay->setContentsMargins(QMargins());
88 hlay->setStretchFactor(
d->input, 10);
89 hlay->setSpacing(QApplication::style()->pixelMetric(QStyle::PM_LayoutHorizontalSpacing));
93 connect(
d->resetButton, &QToolButton::clicked,
107 d->input->setRange(min, max);
108 d->input->setSingleStep(step);
113 return d->input->value();
118 d->input->setValue(
v);
123 return d->defaultValue;
129 d->input->setValue(
d->defaultValue);
135 d->input->setSuffix(suffix);
140 d->input->setValue(
d->defaultValue);
141 d->resetButton->setEnabled(
false);
147 d->resetButton->setEnabled(
v !=
d->defaultValue);
176 QHBoxLayout*
const hlay =
new QHBoxLayout(
this);
178 d->resetButton =
new QToolButton(
this);
179 d->resetButton->setAutoRaise(
true);
180 d->resetButton->setFocusPolicy(Qt::NoFocus);
182 d->resetButton->setToolTip(i18nc(
"@info:tooltip",
"Reset to default value"));
184 hlay->addWidget(
d->input);
185 hlay->addWidget(
d->resetButton);
186 hlay->setContentsMargins(QMargins());
187 hlay->setStretchFactor(
d->input, 10);
188 hlay->setSpacing(QApplication::style()->pixelMetric(QStyle::PM_LayoutHorizontalSpacing));
192 connect(
d->resetButton, &QToolButton::clicked,
206 d->input->setRange(
d->input->minimum(),
d->input->maximum(),
p);
211 d->input->setRange(min, max, (
int) -floor(log10(step)));
212 d->input->setFastSliderStep(5 * step);
213 d->input->setSingleStep(step);
218 return d->input->value();
223 d->input->setValue(
v);
228 return d->defaultValue;
234 d->input->setValue(
d->defaultValue);
240 d->input->setSuffix(suffix);
245 d->input->setValue(
d->defaultValue);
246 d->resetButton->setEnabled(
false);
252 d->resetButton->setEnabled(
v !=
d->defaultValue);
connect(this, SIGNAL(optionsChanged()), this, SLOT(saveOptions()))
void valueChanged(double value)
void valueChanged(int value)
QIcon loadIcon(const QString &name)
Save space slider widget.