aboutsummaryrefslogtreecommitdiffstats
path: root/src/quick/items/qquicktextinput_p.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/quick/items/qquicktextinput_p.h')
-rw-r--r--src/quick/items/qquicktextinput_p.h82
1 files changed, 37 insertions, 45 deletions
diff --git a/src/quick/items/qquicktextinput_p.h b/src/quick/items/qquicktextinput_p.h
index ee06eb88e7..5212e6117e 100644
--- a/src/quick/items/qquicktextinput_p.h
+++ b/src/quick/items/qquicktextinput_p.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtQuick module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QQUICKTEXTINPUT_P_H
#define QQUICKTEXTINPUT_P_H
@@ -52,16 +16,19 @@
//
#include "qquickimplicitsizeitem_p.h"
+#include "qquicktextinterface_p.h"
#include <QtGui/qtextoption.h>
+#if QT_CONFIG(validator)
#include <QtGui/qvalidator.h>
+#endif
QT_BEGIN_NAMESPACE
class QQuickTextInputPrivate;
-class QValidator;
-class Q_QUICK_PRIVATE_EXPORT QQuickTextInput : public QQuickImplicitSizeItem
+class Q_QUICK_EXPORT QQuickTextInput : public QQuickImplicitSizeItem, public QQuickTextInterface
{
Q_OBJECT
+ Q_INTERFACES(QQuickTextInterface)
Q_PROPERTY(QString text READ text WRITE setText NOTIFY textChanged)
Q_PROPERTY(int length READ length NOTIFY textChanged)
@@ -85,7 +52,9 @@ class Q_QUICK_PRIVATE_EXPORT QQuickTextInput : public QQuickImplicitSizeItem
Q_PROPERTY(QString selectedText READ selectedText NOTIFY selectedTextChanged)
Q_PROPERTY(int maximumLength READ maxLength WRITE setMaxLength NOTIFY maximumLengthChanged)
+#if QT_CONFIG(validator)
Q_PROPERTY(QValidator* validator READ validator WRITE setValidator NOTIFY validatorChanged)
+#endif
Q_PROPERTY(QString inputMask READ inputMask WRITE setInputMask NOTIFY inputMaskChanged)
Q_PROPERTY(Qt::InputMethodHints inputMethodHints READ inputMethodHints WRITE setInputMethodHints NOTIFY inputMethodHintsChanged)
@@ -115,6 +84,9 @@ class Q_QUICK_PRIVATE_EXPORT QQuickTextInput : public QQuickImplicitSizeItem
Q_PROPERTY(qreal bottomPadding READ bottomPadding WRITE setBottomPadding RESET resetBottomPadding NOTIFY bottomPaddingChanged REVISION(2, 6))
QML_NAMED_ELEMENT(TextInput)
QML_ADDED_IN_VERSION(2, 0)
+#if QT_VERSION < QT_VERSION_CHECK(7, 0, 0)
+ QML_ADDED_IN_VERSION(6, 4)
+#endif
public:
QQuickTextInput(QQuickItem * parent=nullptr);
@@ -166,12 +138,13 @@ public:
Q_ENUM(CursorPosition)
enum RenderType { QtRendering,
- NativeRendering
+ NativeRendering,
+ CurveRendering
};
Q_ENUM(RenderType)
//Auxilliary functions needed to control the TextInput from QML
- Q_INVOKABLE void positionAt(QQmlV4Function *args) const;
+ Q_INVOKABLE void positionAt(QQmlV4FunctionPtr args) const;
Q_INVOKABLE QRectF positionToRectangle(int pos) const;
Q_INVOKABLE void moveCursorSelection(int pos);
Q_INVOKABLE void moveCursorSelection(int pos, SelectionMode mode);
@@ -226,8 +199,10 @@ public:
int maxLength() const;
void setMaxLength(int ml);
+#if QT_CONFIG(validator)
QValidator * validator() const;
void setValidator(QValidator* v);
+#endif
QString inputMask() const;
void setInputMask(const QString &im);
@@ -311,6 +286,8 @@ public:
void setBottomPadding(qreal padding);
void resetBottomPadding();
+ void invalidate() override;
+
Q_SIGNALS:
void textChanged();
void cursorPositionChanged();
@@ -334,7 +311,9 @@ Q_SIGNALS:
void cursorDelegateChanged();
void overwriteModeChanged(bool overwriteMode);
void maximumLengthChanged(int maximumLength);
+#if QT_CONFIG(validator)
void validatorChanged();
+#endif
void inputMaskChanged(const QString &inputMask);
void echoModeChanged(QQuickTextInput::EchoMode echoMode);
void passwordCharacterChanged();
@@ -362,12 +341,16 @@ Q_SIGNALS:
private:
void invalidateFontCaches();
- void ensureActiveFocus();
+ void ensureActiveFocus(Qt::FocusReason reason);
protected:
QQuickTextInput(QQuickTextInputPrivate &dd, QQuickItem *parent = nullptr);
+#if QT_VERSION < QT_VERSION_CHECK(7, 0, 0)
+ void setOldSelectionDefault();
+#endif
void geometryChange(const QRectF &newGeometry, const QRectF &oldGeometry) override;
+ void itemChange(ItemChange change, const ItemChangeData &value) override;
void mousePressEvent(QMouseEvent *event) override;
void mouseMoveEvent(QMouseEvent *event) override;
@@ -421,8 +404,17 @@ private:
Q_DECLARE_PRIVATE(QQuickTextInput)
};
-QT_END_NAMESPACE
+#if QT_VERSION < QT_VERSION_CHECK(7, 0, 0)
+class QQuickPre64TextInput : public QQuickTextInput {
+ Q_OBJECT
+ QML_NAMED_ELEMENT(TextInput)
+ QML_ADDED_IN_VERSION(2, 0)
+ QML_REMOVED_IN_VERSION(6, 4)
+public:
+ QQuickPre64TextInput(QQuickItem *parent = nullptr);
+};
+#endif
-QML_DECLARE_TYPE(QQuickTextInput)
+QT_END_NAMESPACE
#endif // QQUICKTEXTINPUT_P_H