Back to home page

EIC code displayed by LXR

 
 

    


Warning, file /include/QtWidgets/qlineedit.h was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).

0001 // Copyright (C) 2016 The Qt Company Ltd.
0002 // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
0003 
0004 #ifndef QLINEEDIT_H
0005 #define QLINEEDIT_H
0006 
0007 #include <QtWidgets/qtwidgetsglobal.h>
0008 #include <QtWidgets/qframe.h>
0009 #include <QtGui/qtextcursor.h>
0010 #include <QtCore/qstring.h>
0011 #include <QtCore/qmargins.h>
0012 
0013 QT_REQUIRE_CONFIG(lineedit);
0014 
0015 QT_BEGIN_NAMESPACE
0016 
0017 class QValidator;
0018 class QMenu;
0019 class QLineEditPrivate;
0020 class QCompleter;
0021 class QStyleOptionFrame;
0022 class QAbstractSpinBox;
0023 class QDateTimeEdit;
0024 class QIcon;
0025 class QToolButton;
0026 
0027 class Q_WIDGETS_EXPORT QLineEdit : public QWidget
0028 {
0029     Q_OBJECT
0030 
0031     Q_PROPERTY(QString inputMask READ inputMask WRITE setInputMask)
0032     Q_PROPERTY(QString text READ text WRITE setText NOTIFY textChanged USER true)
0033     Q_PROPERTY(int maxLength READ maxLength WRITE setMaxLength)
0034     Q_PROPERTY(bool frame READ hasFrame WRITE setFrame)
0035     Q_PROPERTY(EchoMode echoMode READ echoMode WRITE setEchoMode)
0036     Q_PROPERTY(QString displayText READ displayText)
0037     Q_PROPERTY(int cursorPosition READ cursorPosition WRITE setCursorPosition)
0038     Q_PROPERTY(Qt::Alignment alignment READ alignment WRITE setAlignment)
0039     Q_PROPERTY(bool modified READ isModified WRITE setModified DESIGNABLE false)
0040     Q_PROPERTY(bool hasSelectedText READ hasSelectedText)
0041     Q_PROPERTY(QString selectedText READ selectedText)
0042     Q_PROPERTY(bool dragEnabled READ dragEnabled WRITE setDragEnabled)
0043     Q_PROPERTY(bool readOnly READ isReadOnly WRITE setReadOnly)
0044     Q_PROPERTY(bool undoAvailable READ isUndoAvailable)
0045     Q_PROPERTY(bool redoAvailable READ isRedoAvailable)
0046     Q_PROPERTY(bool acceptableInput READ hasAcceptableInput)
0047     Q_PROPERTY(QString placeholderText READ placeholderText WRITE setPlaceholderText)
0048     Q_PROPERTY(Qt::CursorMoveStyle cursorMoveStyle READ cursorMoveStyle WRITE setCursorMoveStyle)
0049     Q_PROPERTY(bool clearButtonEnabled READ isClearButtonEnabled WRITE setClearButtonEnabled)
0050 public:
0051     enum ActionPosition {
0052         LeadingPosition,
0053         TrailingPosition
0054     };
0055     Q_ENUM(ActionPosition)
0056 
0057     explicit QLineEdit(QWidget *parent = nullptr);
0058     explicit QLineEdit(const QString &, QWidget *parent = nullptr);
0059     ~QLineEdit();
0060 
0061     QString text() const;
0062 
0063     QString displayText() const;
0064 
0065     QString placeholderText() const;
0066     void setPlaceholderText(const QString &);
0067 
0068     int maxLength() const;
0069     void setMaxLength(int);
0070 
0071     void setFrame(bool);
0072     bool hasFrame() const;
0073 
0074     void setClearButtonEnabled(bool enable);
0075     bool isClearButtonEnabled() const;
0076 
0077     enum EchoMode { Normal, NoEcho, Password, PasswordEchoOnEdit };
0078     Q_ENUM(EchoMode)
0079     EchoMode echoMode() const;
0080     void setEchoMode(EchoMode);
0081 
0082     bool isReadOnly() const;
0083     void setReadOnly(bool);
0084 
0085 #ifndef QT_NO_VALIDATOR
0086     void setValidator(const QValidator *);
0087     const QValidator * validator() const;
0088 #endif
0089 
0090 #if QT_CONFIG(completer)
0091     void setCompleter(QCompleter *completer);
0092     QCompleter *completer() const;
0093 #endif
0094 
0095     QSize sizeHint() const override;
0096     QSize minimumSizeHint() const override;
0097 
0098     int cursorPosition() const;
0099     void setCursorPosition(int);
0100     int cursorPositionAt(const QPoint &pos);
0101 
0102     void setAlignment(Qt::Alignment flag);
0103     Qt::Alignment alignment() const;
0104 
0105     void cursorForward(bool mark, int steps = 1);
0106     void cursorBackward(bool mark, int steps = 1);
0107     void cursorWordForward(bool mark);
0108     void cursorWordBackward(bool mark);
0109     void backspace();
0110     void del();
0111     void home(bool mark);
0112     void end(bool mark);
0113 
0114     bool isModified() const;
0115     void setModified(bool);
0116 
0117     void setSelection(int, int);
0118     bool hasSelectedText() const;
0119     QString selectedText() const;
0120     int selectionStart() const;
0121     int selectionEnd() const;
0122     int selectionLength() const;
0123 
0124     bool isUndoAvailable() const;
0125     bool isRedoAvailable() const;
0126 
0127     void setDragEnabled(bool b);
0128     bool dragEnabled() const;
0129 
0130     void setCursorMoveStyle(Qt::CursorMoveStyle style);
0131     Qt::CursorMoveStyle cursorMoveStyle() const;
0132 
0133     QString inputMask() const;
0134     void setInputMask(const QString &inputMask);
0135     bool hasAcceptableInput() const;
0136 
0137     void setTextMargins(int left, int top, int right, int bottom);
0138     void setTextMargins(const QMargins &margins);
0139     QMargins textMargins() const;
0140 
0141 #if QT_CONFIG(action)
0142     using QWidget::addAction;
0143     void addAction(QAction *action, ActionPosition position);
0144     QAction *addAction(const QIcon &icon, ActionPosition position);
0145 #endif
0146 
0147 public Q_SLOTS:
0148     void setText(const QString &);
0149     void clear();
0150     void selectAll();
0151     void undo();
0152     void redo();
0153 #ifndef QT_NO_CLIPBOARD
0154     void cut();
0155     void copy() const;
0156     void paste();
0157 #endif
0158 
0159 public:
0160     void deselect();
0161     void insert(const QString &);
0162 #ifndef QT_NO_CONTEXTMENU
0163     QMenu *createStandardContextMenu();
0164 #endif
0165 
0166 Q_SIGNALS:
0167     void textChanged(const QString &);
0168     void textEdited(const QString &);
0169     void cursorPositionChanged(int, int);
0170     void returnPressed();
0171     void editingFinished();
0172     void selectionChanged();
0173     void inputRejected();
0174 
0175 protected:
0176     void mousePressEvent(QMouseEvent *) override;
0177     void mouseMoveEvent(QMouseEvent *) override;
0178     void mouseReleaseEvent(QMouseEvent *) override;
0179     void mouseDoubleClickEvent(QMouseEvent *) override;
0180     void keyPressEvent(QKeyEvent *) override;
0181     void keyReleaseEvent(QKeyEvent *) override;
0182     void focusInEvent(QFocusEvent *) override;
0183     void focusOutEvent(QFocusEvent *) override;
0184     void paintEvent(QPaintEvent *) override;
0185 #if QT_CONFIG(draganddrop)
0186     void dragEnterEvent(QDragEnterEvent *) override;
0187     void dragMoveEvent(QDragMoveEvent *e) override;
0188     void dragLeaveEvent(QDragLeaveEvent *e) override;
0189     void dropEvent(QDropEvent *) override;
0190 #endif
0191     void changeEvent(QEvent *) override;
0192 #ifndef QT_NO_CONTEXTMENU
0193     void contextMenuEvent(QContextMenuEvent *) override;
0194 #endif
0195 
0196     void inputMethodEvent(QInputMethodEvent *) override;
0197     virtual void initStyleOption(QStyleOptionFrame *option) const;
0198 public:
0199     QVariant inputMethodQuery(Qt::InputMethodQuery) const override;
0200     Q_INVOKABLE QVariant inputMethodQuery(Qt::InputMethodQuery property, QVariant argument) const;
0201     void timerEvent(QTimerEvent *) override;
0202     bool event(QEvent *) override;
0203 protected:
0204     QRect cursorRect() const;
0205 
0206 public:
0207 
0208 private:
0209     friend class QAbstractSpinBox;
0210     friend class QAccessibleLineEdit;
0211     friend class QComboBox;
0212 #ifdef QT_KEYPAD_NAVIGATION
0213     friend class QDateTimeEdit;
0214 #endif
0215     Q_DISABLE_COPY(QLineEdit)
0216     Q_DECLARE_PRIVATE(QLineEdit)
0217 };
0218 
0219 QT_END_NAMESPACE
0220 
0221 #endif // QLINEEDIT_H