pqLineEdit.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: ParaView
4  Module: pqLineEdit.h
5 
6  Copyright (c) 2005,2006 Sandia Corporation, Kitware Inc.
7  All rights reserved.
8 
9  ParaView is a free software; you can redistribute it and/or modify it
10  under the terms of the ParaView license version 1.2.
11 
12  See License_v1.2.txt for the full ParaView license.
13  A copy of this license can be obtained by contacting
14  Kitware Inc.
15  28 Corporate Drive
16  Clifton Park, NY 12065
17  USA
18 
19 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
20 ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
21 LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
22 A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR
23 CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
24 EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
25 PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
26 PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
27 LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
28 NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
29 SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30 
31 ========================================================================*/
32 #ifndef pqLineEdit_h
33 #define pqLineEdit_h
34 
35 #include "pqWidgetsModule.h"
36 #include <QLineEdit>
53 class PQWIDGETS_EXPORT pqLineEdit : public QLineEdit
54 {
55  Q_OBJECT
56  Q_PROPERTY(QString text2 READ text WRITE setTextAndResetCursor)
57  Q_PROPERTY(bool resetCursorPositionOnEditingFinished READ resetCursorPositionOnEditingFinished
58  WRITE setResetCursorPositionOnEditingFinished)
59 
60  typedef QLineEdit Superclass;
61 
62 public:
63  pqLineEdit(QWidget* parent = nullptr);
64  pqLineEdit(const QString& contents, QWidget* parent = nullptr);
65 
66  ~pqLineEdit() override;
67 
74  {
75  return this->ResetCursorPositionOnEditingFinished;
76  }
77 
78 Q_SIGNALS:
85  void textChangedAndEditingFinished();
86 
97  void blank();
98 
99 public Q_SLOTS:
105  void setTextAndResetCursor(const QString& text);
106 
113  {
114  this->ResetCursorPositionOnEditingFinished = val;
115  }
116 
117 private Q_SLOTS:
118  void onTextEdited();
119  void onEditingFinished();
120 
121 protected:
122  friend class pqLineEditEventPlayer;
128  void triggerTextChangedAndEditingFinished();
129 
130  // Override to select all text in the widget when it gains focus
131  void focusInEvent(QFocusEvent* event) override;
132 
133 private:
134  Q_DISABLE_COPY(pqLineEdit)
135 
136  bool EditingFinishedPending;
137  bool ResetCursorPositionOnEditingFinished;
138 };
139 
140 #endif
void setResetCursorPositionOnEditingFinished(bool val)
To enable/disable whether the cursor position is reset to 0 after editingFinished() is fired...
Definition: pqLineEdit.h:112
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:53
bool resetCursorPositionOnEditingFinished() const
To enable/disable whether the cursor position is reset to 0 after editingFinished() is fired...
Definition: pqLineEdit.h:73