pqLineEdit.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 pqLineEdit_h
5 #define pqLineEdit_h
6 
7 #include "pqWidgetsModule.h"
8 #include <QLineEdit>
25 class PQWIDGETS_EXPORT pqLineEdit : public QLineEdit
26 {
27  Q_OBJECT
28  Q_PROPERTY(QString text2 READ text WRITE setTextAndResetCursor)
29  Q_PROPERTY(bool resetCursorPositionOnEditingFinished READ resetCursorPositionOnEditingFinished
30  WRITE setResetCursorPositionOnEditingFinished)
31 
32  typedef QLineEdit Superclass;
33 
34 public:
35  pqLineEdit(QWidget* parent = nullptr);
36  pqLineEdit(const QString& contents, QWidget* parent = nullptr);
37 
38  ~pqLineEdit() override;
39 
46  {
47  return this->ResetCursorPositionOnEditingFinished;
48  }
49 
50 Q_SIGNALS:
57  void textChangedAndEditingFinished();
58 
69  void blank();
70 
71 public Q_SLOTS:
77  void setTextAndResetCursor(const QString& text);
78 
85  {
86  this->ResetCursorPositionOnEditingFinished = val;
87  }
88 
89 private Q_SLOTS:
90  void onTextEdited();
91  void onEditingFinished();
92 
93 protected:
94  friend class pqLineEditEventPlayer;
100  void triggerTextChangedAndEditingFinished();
101 
102  // Override to select all text in the widget when it gains focus
103  void focusInEvent(QFocusEvent* event) override;
104 
105 private:
106  Q_DISABLE_COPY(pqLineEdit)
107 
108  bool EditingFinishedPending;
109  bool ResetCursorPositionOnEditingFinished;
110 };
111 
112 #endif
void setResetCursorPositionOnEditingFinished(bool val)
To enable/disable whether the cursor position is reset to 0 after editingFinished() is fired...
Definition: pqLineEdit.h:84
pqLineEditEventPlayer extends pqAbstractStringEventPlayer to ensure that pqLineEdit fires textChanged...
#define PQWIDGETS_EXPORT
pqLineEdit is a specialization of QLineEdit which provide a new property &#39;text2&#39;. ...
Definition: pqLineEdit.h:25
bool resetCursorPositionOnEditingFinished() const
To enable/disable whether the cursor position is reset to 0 after editingFinished() is fired...
Definition: pqLineEdit.h:45