KSane

labeledfslider.h
1/*
2 * SPDX-FileCopyrightText: 2007-2011 Kare Sars <kare.sars@iki .fi>
3 *
4 * SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL
5 */
6
7#ifndef LABELED_FSLIDER_H
8#define LABELED_FSLIDER_H
9
10#include "ksaneoptionwidget.h"
11
12// Qt includes
13#include <QSlider>
14#include <QDoubleSpinBox>
15
16/**
17 *@author Kåre Särs
18 */
19
20namespace KSaneIface
21{
22
23/**
24 * A combination of a label a slider and a spinbox.
25 * The slider is connected to the spinbox so that they have the same value.
26 */
28{
30
31public:
32
33 /**
34 * Create the slider.
35 *
36 * \param parent parent widget
37 * \param text is the text describing the slider value. If the text
38 * contains a '&', a buddy for the slider will be created.
39 * \param min minimum slider value
40 * \param max maximum slider value
41 * \param step is the step between values.
42 */
44 double min, double max, double step);
45
47 ~LabeledFSlider() override;
48
49 /**
50 * \return the slider value.
51 */
52 double value() const;
53 double step() const;
54
55public Q_SLOTS:
56
57 /** Set the slider/spinbox value */
58 void setValue(const QVariant &value);
59 void setRange(double min, double max);
60 void setStep(double step);
61 /** Set the unit */
62 void setSuffix(const QString &text);
63
64private Q_SLOTS:
65
66 /**
67 * Sync the values and emit valueChanged()
68 */
69 // FIXME this has to be changes later
70 void syncValues(int);
71 void syncValues(double);
72 void fixValue();
73
75
76 /**
77 * Emit the slider value changes
78 */
79 void valueChanged(const QVariant &val);
80
81private:
82 void initFSlider(double minValue, double maxValue, double stepValue);
83
84 QSlider *m_slider;
85 QDoubleSpinBox *m_spinb;
86 double m_fstep;
87 int m_istep;
88};
89
90} // NameSpace KSaneIface
91
92#endif // LABELED_SFSLIDER_H
Base class for option widgets.
A combination of a label a slider and a spinbox.
LabeledFSlider(QWidget *parent, const QString &text, double min, double max, double step)
Create the slider.
void valueChanged(const QVariant &val)
Emit the slider value changes.
void setValue(const QVariant &value)
Set the slider/spinbox value.
void setSuffix(const QString &text)
Set the unit.
Q_OBJECTQ_OBJECT
Q_SIGNALSQ_SIGNALS
Q_SLOTSQ_SLOTS
QObject * parent() const const
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Fri Dec 20 2024 11:58:15 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.