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 
15 #include "vtkParaViewDeprecation.h" // for PARAVIEW_DEPRECATED_IN_5_12_0
16 
38 {
39  Q_OBJECT
40  Q_ENUMS(RealNumberNotation)
41  Q_PROPERTY(RealNumberNotation notation READ notation WRITE setNotation)
42  Q_PROPERTY(int precision READ precision WRITE setPrecision)
43  Q_PROPERTY(bool useGlobalPrecisionAndNotation READ useGlobalPrecisionAndNotation WRITE
44  setUseGlobalPrecisionAndNotation)
45  using Superclass = pqLineEdit;
46 
47 public:
48  pqDoubleLineEdit(QWidget* parent = nullptr);
49  ~pqDoubleLineEdit() override;
50 
55  {
56  MixedNotation = 0,
59  FullNotation
60  };
61 
66  RealNumberNotation notation() const;
67 
72  int precision() const;
73 
79  bool useGlobalPrecisionAndNotation() const;
80 
82 
87  static void setGlobalPrecisionAndNotation(int precision, RealNumberNotation notation);
88  static int globalPrecision();
89  static RealNumberNotation globalNotation();
91 
96  QString simplifiedText() const;
97 
106  "Use `pqDoubleLineEdit::formatDouble(double,pqDoubleLineEdit::RealNumberNotation,int)` instead")
107  static QString formatDouble(
108  double value, QTextStream::RealNumberNotation notation, int precision);
109 
118  static QString formatDouble(double value, pqDoubleLineEdit::RealNumberNotation notation,
119  int precision, int fullLowExponent = -6, int fullHighExponent = 20);
120 
125  PARAVIEW_DEPRECATED_IN_5_12_0("Use `pqCoreUtilities::formatNumber()` instead")
126  static QString formatDoubleUsingGlobalPrecisionAndNotation(double value);
127 
128 public Q_SLOTS: // NOLINT(readability-redundant-access-specifiers)
133  void setNotation(RealNumberNotation _notation);
134 
139  void setPrecision(int precision);
140 
145  void setUseGlobalPrecisionAndNotation(bool value);
146 
151  "Use `pqDoubleLineEdit::setNotation(pqDoubleLineEdit::FullNotation)` instead")
152  void setAlwaysUseFullPrecision(bool value);
153 
154 protected:
155  void paintEvent(QPaintEvent* evt) override;
156  void resizeEvent(QResizeEvent* event) override;
157 
158 private:
159  Q_DISABLE_COPY(pqDoubleLineEdit)
160 
161  static int GlobalPrecision;
162  static RealNumberNotation GlobalNotation;
163 
164  class pqInternals;
165  QScopedPointer<pqInternals> Internals;
166 };
167 
168 #endif
#define PARAVIEW_DEPRECATED_IN_5_12_0(reason)
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
pqCoreUtilities is a collection of arbitrary utility functions that can be used by the application...