KSane

labeledslider.h
1/*
2 * SPDX-FileCopyrightText: 2007-2011 Kare Sars <kare.sars@iki .fi>
3 * SPDX-FileCopyrightText: 2014 Gregor Mitsch : port to KDE5 frameworks
4 *
5 * SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL
6 */
7
8#ifndef LABELED_SLIDER_H
9#define LABELED_SLIDER_H
10
11#include "ksaneoptionwidget.h"
12
13class QSlider;
14
15/**
16 *@author Kåre Särs
17 */
18
21
22namespace KSaneIface
23{
24
25/**
26 * A combination of a label a slider and a spinbox.
27 * The slider is connected to the spinbox so that they have the same value.
28 */
30{
32
33public:
34
35 /**
36 * Create the slider.
37 *
38 * \param parent parent widget
39 * \param text is the text describing the slider value. If the text
40 * contains a '&', a buddy for the slider will be created.
41 * \param min minimum slider value
42 * \param max maximum slider value
43 * \param st is the step between values.
44 */
45 LabeledSlider(QWidget *parent, const QString &text,
46 int min, int max, int st);
47
49 ~LabeledSlider() override;
50
51 int value() const;
52
53public Q_SLOTS:
54
55 /** Set the slider value */
56 void setValue(const QVariant &val);
57 void setRange(int min, int max);
58 void setStep(int);
59 /** Set the unit */
60 void setSuffix(const KLocalizedString &text);
61
62
63
64private Q_SLOTS:
65
66 /** Sync the values and emit valueChanged() */
67 void syncValues(int);
68 /** Ensure step value is followed */
69 void fixValue();
70
72
73 /**
74 * Emit the slider value changes
75 */
76 void valueChanged(const QVariant &val);
77
78private:
79 void initSlider(int minValue, int maxValue, int stepValue);
80 QSlider *m_slider;
82 int m_step;
83};
84
85} // NameSpace KSaneIface
86
87#endif // LABELED_SLIDER_H
Base class for option widgets.
A combination of a label a slider and a spinbox.
void setValue(const QVariant &val)
Set the slider value.
void setSuffix(const KLocalizedString &text)
Set the unit.
void valueChanged(const QVariant &val)
Emit the slider value changes.
LabeledSlider(QWidget *parent, const QString &text, int min, int max, int st)
Create the slider.
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 Mon Nov 18 2024 12:18:32 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.