aboutsummaryrefslogtreecommitdiffstats
path: root/src/quicktemplates2/qquicktextarea_p.h
diff options
context:
space:
mode:
authorJ-P Nurmi <jpnurmi@qt.io>2016-04-22 00:18:25 +0200
committerJ-P Nurmi <jpnurmi@qt.io>2016-04-26 13:31:06 +0000
commit67f3da65d7d11af025a9bdd54d08ca0bf764c3ce (patch)
tree9fc5e79e31a82d39d25f8a00835a1115b55b08a7 /src/quicktemplates2/qquicktextarea_p.h
parent1780a817fce77f4875f001c2b95b41cd2cd06f2b (diff)
Allow attaching TextArea to a Flickable
It is not always possible to let TextArea grow infinitely, but in some cases it should be scrollable on its own. Even though it is not a built-in feature of TextArea like in Qt Quick Controls 1, this change makes it straight-forward to attach TextArea to a Flickable. This makes TextArea behave like a standalone scrollable editor. Change-Id: I8181e8ebe0edbcdfef2c30c9e102db7cbe4ff705 Task-number: QTBUG-51677 Task-number: QTBUG-52169 Reviewed-by: Mitch Curtis <mitch.curtis@theqtcompany.com>
Diffstat (limited to 'src/quicktemplates2/qquicktextarea_p.h')
-rw-r--r--src/quicktemplates2/qquicktextarea_p.h26
1 files changed, 26 insertions, 0 deletions
diff --git a/src/quicktemplates2/qquicktextarea_p.h b/src/quicktemplates2/qquicktextarea_p.h
index c62d35dfc2..7c145a9aa9 100644
--- a/src/quicktemplates2/qquicktextarea_p.h
+++ b/src/quicktemplates2/qquicktextarea_p.h
@@ -55,6 +55,7 @@ QT_BEGIN_NAMESPACE
class QQuickText;
class QQuickTextAreaPrivate;
+class QQuickTextAreaAttached;
class QQuickMouseEvent;
class Q_QUICKTEMPLATES2_EXPORT QQuickTextArea : public QQuickTextEdit
@@ -71,6 +72,8 @@ public:
explicit QQuickTextArea(QQuickItem *parent = nullptr);
~QQuickTextArea();
+ static QQuickTextAreaAttached *qmlAttachedProperties(QObject *object);
+
QFont font() const;
void setFont(const QFont &font);
@@ -111,8 +114,31 @@ private:
Q_DECLARE_PRIVATE(QQuickTextArea)
};
+class QQuickTextAreaAttachedPrivate;
+
+class Q_QUICKTEMPLATES2_EXPORT QQuickTextAreaAttached : public QObject
+{
+ Q_OBJECT
+ Q_PROPERTY(QQuickTextArea *flickable READ flickable WRITE setFlickable NOTIFY flickableChanged FINAL)
+
+public:
+ explicit QQuickTextAreaAttached(QObject *parent);
+ ~QQuickTextAreaAttached();
+
+ QQuickTextArea *flickable() const;
+ void setFlickable(QQuickTextArea *control);
+
+Q_SIGNALS:
+ void flickableChanged();
+
+private:
+ Q_DISABLE_COPY(QQuickTextAreaAttached)
+ Q_DECLARE_PRIVATE(QQuickTextAreaAttached)
+};
+
QT_END_NAMESPACE
QML_DECLARE_TYPE(QQuickTextArea)
+QML_DECLARE_TYPEINFO(QQuickTextArea, QML_HAS_ATTACHED_PROPERTIES)
#endif // QQUICKTEXTAREA_P_H