pqScaledSpinBox.h
Go to the documentation of this file.
1 // SPDX-FileCopyrightText: Copyright (c) Kitware Inc.
2 // SPDX-FileCopyrightText: Copyright (c) Sandia Corporation
3 // SPDX-License-Identifier: BSD-3-Clause
4 
5 #ifndef pqScaledSpinBox_h
6 #define pqScaledSpinBox_h
7 
8 #include "pqWidgetsModule.h"
9 #include <QDoubleSpinBox>
10 
14 class PQWIDGETS_EXPORT pqScaledSpinBox : public QDoubleSpinBox
15 {
16  Q_OBJECT
17 
18 public Q_SLOTS:
20  void setValue(double val);
21 
22 public: // NOLINT(readability-redundant-access-specifiers)
24  explicit pqScaledSpinBox(QWidget* parent = nullptr);
26  explicit pqScaledSpinBox(QDoubleSpinBox* other);
28  ~pqScaledSpinBox() override;
29 
33  void setScalingFactor(double scaleFactor);
34 
35 protected:
37  void keyPressEvent(QKeyEvent* event) override;
38 
39 protected Q_SLOTS: // NOLINT(readability-redundant-access-specifiers)
40  void onValueChanged(double newValue);
41 
42 private:
43  void initialize();
44  void scaledStepUp();
45  void scaledStepDown();
46 
47  double LastValue;
48  double ScaleFactor;
49 };
50 
51 #endif // pqScaledSpinBox_h
Identical to a QDoubleSpinBox, but doubles/halves the value upon button presses.
#define PQWIDGETS_EXPORT