pqDoubleLineEdit.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 #ifndef pqDoubleLineEdit_h
5 #define pqDoubleLineEdit_h
6 
7 // Qt Includes.
8 #include <QScopedPointer> // for ivar
9 #include <QTextStream> // for formatDouble
10 
11 // ParaView Includes.
12 #include "pqLineEdit.h"
13 #include "pqWidgetsModule.h"
14 
36 {
37  Q_OBJECT
38  Q_ENUMS(RealNumberNotation)
39  Q_PROPERTY(RealNumberNotation notation READ notation WRITE setNotation)
40  Q_PROPERTY(int precision READ precision WRITE setPrecision)
41  Q_PROPERTY(bool useGlobalPrecisionAndNotation READ useGlobalPrecisionAndNotation WRITE
42  setUseGlobalPrecisionAndNotation)
43  using Superclass = pqLineEdit;
44 
45 public:
46  pqDoubleLineEdit(QWidget* parent = nullptr);
47  ~pqDoubleLineEdit() override;
48 
53  {
54  MixedNotation = 0,
57  FullNotation
58  };
59 
64  RealNumberNotation notation() const;
65 
70  int precision() const;
71 
77  bool useGlobalPrecisionAndNotation() const;
78 
80 
85  static void setGlobalPrecisionAndNotation(int precision, RealNumberNotation notation);
86  static int globalPrecision();
87  static RealNumberNotation globalNotation();
89 
94  QString simplifiedText() const;
95 
104  static QString formatDouble(double value, pqDoubleLineEdit::RealNumberNotation notation,
105  int precision, int fullLowExponent = -6, int fullHighExponent = 20);
106 
107 public Q_SLOTS: // NOLINT(readability-redundant-access-specifiers)
112  void setNotation(RealNumberNotation _notation);
113 
118  void setPrecision(int precision);
119 
124  void setUseGlobalPrecisionAndNotation(bool value);
125 
126 protected:
127  void paintEvent(QPaintEvent* evt) override;
128  void resizeEvent(QResizeEvent* event) override;
129 
130 private:
131  Q_DISABLE_COPY(pqDoubleLineEdit)
132 
133  static int GlobalPrecision;
134  static RealNumberNotation GlobalNotation;
135 
136  class pqInternals;
137  QScopedPointer<pqInternals> Internals;
138 };
139 
140 #endif
RealNumberNotation
This enum specifies which notations to use for displaying the value.
#define PQWIDGETS_EXPORT
pqLineEdit subclass that supports a low precision view when inactive
pqLineEdit is a specialization of QLineEdit which provide a new property &#39;text2&#39;. ...
Definition: pqLineEdit.h:25