trikRuntime
digitSelector.h
Go to the documentation of this file.
1 /* Copyright 2014 CyberTech Labs Ltd.
2  *
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at
6  *
7  * http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License. */
14 
15 #pragma once
16 
17 #include <QtCore/qglobal.h>
18 
19 #if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
20  #include <QtGui/QLineEdit>
21 #else
22  #include <QtWidgets/QLineEdit>
23 #endif
24 
25 namespace trikGui {
26 
29 class DigitSelector : public QLineEdit
30 {
31  Q_OBJECT
32 
33 public:
38  DigitSelector(bool &editingMode, int height);
39 
40 signals:
42  void valueChanged(int newValue);
43 
46  void upPressed();
47 
50  void downPressed();
51 
52 protected:
53  void keyPressEvent(QKeyEvent *event) override;
54  void paintEvent(QPaintEvent *event) override;
55 
56 private:
58  bool &mEditingMode;
59 };
60 
61 }
Widget that allows to select one digit by Up/Down keys and can switch states between editing and inac...
Definition: digitSelector.h:29
DigitSelector(bool &editingMode, int height)
Constructor.
Definition: digitSelector.cpp:22
void upPressed()
Widget is not in editing mode and user pressed "up".
Definition: abstractIndicator.h:21
void downPressed()
Widget is not in editing mode and user pressed "down".
void keyPressEvent(QKeyEvent *event) override
Definition: digitSelector.cpp:33
void valueChanged(int newValue)
Digit is changed by user.
void paintEvent(QPaintEvent *event) override
Definition: digitSelector.cpp:67