diff options
-rw-r--r-- | src/quicktemplates2/qquickpage.cpp | 22 | ||||
-rw-r--r-- | src/quicktemplates2/qquickpage_p.h | 5 |
2 files changed, 27 insertions, 0 deletions
diff --git a/src/quicktemplates2/qquickpage.cpp b/src/quicktemplates2/qquickpage.cpp index d6ef07b7..463ecc40 100644 --- a/src/quicktemplates2/qquickpage.cpp +++ b/src/quicktemplates2/qquickpage.cpp @@ -98,6 +98,7 @@ public: void itemImplicitWidthChanged(QQuickItem *item) override; void itemImplicitHeightChanged(QQuickItem *item) override; + QString title; QQuickItem *header; QQuickItem *footer; }; @@ -161,6 +162,27 @@ QQuickPage::QQuickPage(QQuickItem *parent) : } /*! + \qmlproperty string QtQuick.Controls::Page::title + + This property holds the page title. +*/ + +QString QQuickPage::title() const +{ + return d_func()->title; +} + +void QQuickPage::setTitle(const QString &title) +{ + Q_D(QQuickPage); + if (d->title == title) + return; + + d->title = title; + emit titleChanged(); +} + +/*! \qmlproperty Item QtQuick.Controls::Page::header This property holds the page header item. The header item is positioned to diff --git a/src/quicktemplates2/qquickpage_p.h b/src/quicktemplates2/qquickpage_p.h index 7dab76a8..be6bffae 100644 --- a/src/quicktemplates2/qquickpage_p.h +++ b/src/quicktemplates2/qquickpage_p.h @@ -58,6 +58,7 @@ class QQuickPagePrivate; class Q_QUICKTEMPLATES2_EXPORT QQuickPage : public QQuickControl { Q_OBJECT + Q_PROPERTY(QString title READ title WRITE setTitle NOTIFY titleChanged FINAL) Q_PROPERTY(QQuickItem *header READ header WRITE setHeader NOTIFY headerChanged FINAL) Q_PROPERTY(QQuickItem *footer READ footer WRITE setFooter NOTIFY footerChanged FINAL) Q_PROPERTY(QQmlListProperty<QObject> contentData READ contentData FINAL) @@ -67,6 +68,9 @@ class Q_QUICKTEMPLATES2_EXPORT QQuickPage : public QQuickControl public: explicit QQuickPage(QQuickItem *parent = nullptr); + QString title() const; + void setTitle(const QString &title); + QQuickItem *header() const; void setHeader(QQuickItem *header); @@ -77,6 +81,7 @@ public: QQmlListProperty<QQuickItem> contentChildren(); Q_SIGNALS: + void titleChanged(); void headerChanged(); void footerChanged(); void contentChildrenChanged(); |