1 | /* $Id: QIAdvancedSlider.h 98103 2023-01-17 14:15:46Z vboxsync $ */
|
---|
2 | /** @file
|
---|
3 | * VBox Qt GUI - Qt extensions: QIAdvancedSlider class declaration.
|
---|
4 | */
|
---|
5 |
|
---|
6 | /*
|
---|
7 | * Copyright (C) 2009-2023 Oracle and/or its affiliates.
|
---|
8 | *
|
---|
9 | * This file is part of VirtualBox base platform packages, as
|
---|
10 | * available from https://www.virtualbox.org.
|
---|
11 | *
|
---|
12 | * This program is free software; you can redistribute it and/or
|
---|
13 | * modify it under the terms of the GNU General Public License
|
---|
14 | * as published by the Free Software Foundation, in version 3 of the
|
---|
15 | * License.
|
---|
16 | *
|
---|
17 | * This program is distributed in the hope that it will be useful, but
|
---|
18 | * WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
19 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
---|
20 | * General Public License for more details.
|
---|
21 | *
|
---|
22 | * You should have received a copy of the GNU General Public License
|
---|
23 | * along with this program; if not, see <https://www.gnu.org/licenses>.
|
---|
24 | *
|
---|
25 | * SPDX-License-Identifier: GPL-3.0-only
|
---|
26 | */
|
---|
27 |
|
---|
28 | #ifndef FEQT_INCLUDED_SRC_extensions_QIAdvancedSlider_h
|
---|
29 | #define FEQT_INCLUDED_SRC_extensions_QIAdvancedSlider_h
|
---|
30 | #ifndef RT_WITHOUT_PRAGMA_ONCE
|
---|
31 | # pragma once
|
---|
32 | #endif
|
---|
33 |
|
---|
34 | /* Qt includes: */
|
---|
35 | #include <QWidget>
|
---|
36 |
|
---|
37 | /* GUI includes: */
|
---|
38 | #include "UILibraryDefs.h"
|
---|
39 |
|
---|
40 | /* Forward declarations: */
|
---|
41 | class UIPrivateSlider;
|
---|
42 |
|
---|
43 | /** QWidget extension providing GUI with advanced QSlider functionality. */
|
---|
44 | class SHARED_LIBRARY_STUFF QIAdvancedSlider : public QWidget
|
---|
45 | {
|
---|
46 | Q_OBJECT;
|
---|
47 | Q_PROPERTY(int value READ value WRITE setValue);
|
---|
48 |
|
---|
49 | signals:
|
---|
50 |
|
---|
51 | /** Notifies about value changed to @a iValue. */
|
---|
52 | void valueChanged(int iValue);
|
---|
53 |
|
---|
54 | /** Notifies about slider moved to @a iValue. */
|
---|
55 | void sliderMoved(int iValue);
|
---|
56 |
|
---|
57 | /** Notifies about slider pressed. */
|
---|
58 | void sliderPressed();
|
---|
59 | /** Notifies about slider released. */
|
---|
60 | void sliderReleased();
|
---|
61 |
|
---|
62 | public:
|
---|
63 |
|
---|
64 | /** Constructs advanced-slider passing @a pParent to the base-class. */
|
---|
65 | QIAdvancedSlider(QWidget *pParent = 0);
|
---|
66 | /** Constructs advanced-slider passing @a pParent to the base-class.
|
---|
67 | * @param enmOrientation Brings the slider orientation. */
|
---|
68 | QIAdvancedSlider(Qt::Orientation enmOrientation, QWidget *pParent = 0);
|
---|
69 |
|
---|
70 | /** Returns the slider value. */
|
---|
71 | int value() const;
|
---|
72 |
|
---|
73 | /** Defines the slider range to be from @a iMin to @a iMax. */
|
---|
74 | void setRange(int iMin, int iMax);
|
---|
75 |
|
---|
76 | /** Defines the slider @a iMaximum. */
|
---|
77 | void setMaximum(int iMaximum);
|
---|
78 | /** Returns the slider maximum. */
|
---|
79 | int maximum() const;
|
---|
80 |
|
---|
81 | /** Defines the slider @a iMinimum. */
|
---|
82 | void setMinimum(int iMinimum);
|
---|
83 | /** Returns the slider minimum. */
|
---|
84 | int minimum() const;
|
---|
85 |
|
---|
86 | /** Defines the slider @a iPageStep. */
|
---|
87 | void setPageStep(int iPageStep);
|
---|
88 | /** Returns the slider page step. */
|
---|
89 | int pageStep() const;
|
---|
90 |
|
---|
91 | /** Defines the slider @a iSingleStep. */
|
---|
92 | void setSingleStep(int val);
|
---|
93 | /** Returns the slider single step. */
|
---|
94 | int singelStep() const;
|
---|
95 |
|
---|
96 | /** Defines the slider @a iTickInterval. */
|
---|
97 | void setTickInterval(int val);
|
---|
98 | /** Returns the slider tick interval. */
|
---|
99 | int tickInterval() const;
|
---|
100 |
|
---|
101 | /** Returns the slider orientation. */
|
---|
102 | Qt::Orientation orientation() const;
|
---|
103 |
|
---|
104 | /** Defines whether snapping is @a fEnabled. */
|
---|
105 | void setSnappingEnabled(bool fEnabled);
|
---|
106 | /** Returns whether snapping is enabled. */
|
---|
107 | bool isSnappingEnabled() const;
|
---|
108 |
|
---|
109 | /** Defines the optimal hint to be from @a iMin to @a iMax. */
|
---|
110 | void setOptimalHint(int iMin, int iMax);
|
---|
111 | /** Defines the warning hint to be from @a iMin to @a iMax. */
|
---|
112 | void setWarningHint(int iMin, int iMax);
|
---|
113 | /** Defines the error hint to be from @a iMin to @a iMax. */
|
---|
114 | void setErrorHint(int iMin, int iMax);
|
---|
115 |
|
---|
116 | /** Defines slider @a strToolTip. */
|
---|
117 | void setToolTip(const QString &strToolTip);
|
---|
118 |
|
---|
119 | public slots:
|
---|
120 |
|
---|
121 | /** Defines the slider @a enmOrientation. */
|
---|
122 | void setOrientation(Qt::Orientation enmOrientation);
|
---|
123 |
|
---|
124 | /** Defines current slider @a iValue. */
|
---|
125 | void setValue(int iValue);
|
---|
126 |
|
---|
127 | private slots:
|
---|
128 |
|
---|
129 | /** Handles the slider move to @a iValue. */
|
---|
130 | void sltSliderMoved(int iValue);
|
---|
131 |
|
---|
132 | private:
|
---|
133 |
|
---|
134 | /** Prepares all. */
|
---|
135 | void prepare(Qt::Orientation fOrientation = Qt::Horizontal);
|
---|
136 |
|
---|
137 | /** Returns snapped value for passed @a iValue. */
|
---|
138 | int snapValue(int iValue);
|
---|
139 |
|
---|
140 | /** Holds the private QSlider instance. */
|
---|
141 | UIPrivateSlider *m_pSlider;
|
---|
142 | /** Holds the whether slider snapping is enabled. */
|
---|
143 | bool m_fSnappingEnabled;
|
---|
144 | };
|
---|
145 |
|
---|
146 | #endif /* !FEQT_INCLUDED_SRC_extensions_QIAdvancedSlider_h */
|
---|