diff options
author | J-P Nurmi <jpnurmi@theqtcompany.com> | 2016-01-18 11:26:12 +0100 |
---|---|---|
committer | J-P Nurmi <jpnurmi@theqtcompany.com> | 2016-01-18 12:51:21 +0000 |
commit | 47b3a29210042c22627a04445055bdacf1f9c722 (patch) | |
tree | 2fba07b35db3f51d827c784e492c4ba4fa1bedce /src | |
parent | 15b6d955d3d5c345a2d4b6c5d7fd804bc83a31d4 (diff) |
Add Page
For page-specific headers & footers (ToolBars & TabBars).
Change-Id: Ifafe9131655b74a14bc34cf69b4363013a9a2501
Task-number: QTBUG-50332
Reviewed-by: Mitch Curtis <mitch.curtis@theqtcompany.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/imports/controls/Page.qml | 52 | ||||
-rw-r--r-- | src/imports/controls/controls.pri | 3 | ||||
-rw-r--r-- | src/imports/controls/doc/images/qtlabscontrols-page-wireframe.png | bin | 0 -> 5283 bytes | |||
-rw-r--r-- | src/imports/controls/doc/src/qtlabscontrols-containers.qdoc | 6 | ||||
-rw-r--r-- | src/imports/controls/material/Page.qml | 53 | ||||
-rw-r--r-- | src/imports/controls/material/material.pri | 3 | ||||
-rw-r--r-- | src/imports/controls/qtlabscontrolsplugin.cpp | 3 | ||||
-rw-r--r-- | src/imports/controls/universal/Page.qml | 53 | ||||
-rw-r--r-- | src/imports/controls/universal/universal.pri | 3 | ||||
-rw-r--r-- | src/imports/templates/qtlabstemplatesplugin.cpp | 2 | ||||
-rw-r--r-- | src/templates/qquickapplicationwindow.cpp | 6 | ||||
-rw-r--r-- | src/templates/qquickpage.cpp | 279 | ||||
-rw-r--r-- | src/templates/qquickpage_p.h | 102 | ||||
-rw-r--r-- | src/templates/templates.pri | 2 |
14 files changed, 560 insertions, 7 deletions
diff --git a/src/imports/controls/Page.qml b/src/imports/controls/Page.qml new file mode 100644 index 00000000..37eb57d0 --- /dev/null +++ b/src/imports/controls/Page.qml @@ -0,0 +1,52 @@ +/**************************************************************************** +** +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ +** +** This file is part of the Qt Labs Controls module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL3$ +** 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 http://www.qt.io/terms-conditions. For further +** information use the contact form at http://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.LGPLv3 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.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 later as published by the Free +** Software Foundation and appearing in the file LICENSE.GPL included in +** the packaging of this file. Please review the following information to +** ensure the GNU General Public License version 2.0 requirements will be +** met: http://www.gnu.org/licenses/gpl-2.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 2.6 +import Qt.labs.templates 1.0 as T + +T.Page { + id: control + + //! [contentItem] + contentItem: Item { } + //! [contentItem] + + //! [background] + background: Rectangle { + color: "#ffffff" + } + //! [background] +} diff --git a/src/imports/controls/controls.pri b/src/imports/controls/controls.pri index 6b3c4fc9..c3391929 100644 --- a/src/imports/controls/controls.pri +++ b/src/imports/controls/controls.pri @@ -12,8 +12,9 @@ QML_FILES = \ Label.qml \ Menu.qml \ MenuItem.qml \ - Pane.qml \ + Page.qml \ PageIndicator.qml \ + Pane.qml \ Popup.qml \ ProgressBar.qml \ RadioButton.qml \ diff --git a/src/imports/controls/doc/images/qtlabscontrols-page-wireframe.png b/src/imports/controls/doc/images/qtlabscontrols-page-wireframe.png Binary files differnew file mode 100644 index 00000000..d45ae400 --- /dev/null +++ b/src/imports/controls/doc/images/qtlabscontrols-page-wireframe.png diff --git a/src/imports/controls/doc/src/qtlabscontrols-containers.qdoc b/src/imports/controls/doc/src/qtlabscontrols-containers.qdoc index a627a26a..803695c9 100644 --- a/src/imports/controls/doc/src/qtlabscontrols-containers.qdoc +++ b/src/imports/controls/doc/src/qtlabscontrols-containers.qdoc @@ -57,6 +57,12 @@ \l GroupBox is used to layout a logical group of controls together, within a titled visual frame. + \section1 Page Control + + \image qtlabscontrols-page-wireframe.png + + \l Page provides page-specific header and footer items. + \section1 Pane Control \image qtlabscontrols-pane.png diff --git a/src/imports/controls/material/Page.qml b/src/imports/controls/material/Page.qml new file mode 100644 index 00000000..4ff3541f --- /dev/null +++ b/src/imports/controls/material/Page.qml @@ -0,0 +1,53 @@ +/**************************************************************************** +** +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ +** +** This file is part of the Qt Labs Controls module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL3$ +** 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 http://www.qt.io/terms-conditions. For further +** information use the contact form at http://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.LGPLv3 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.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 later as published by the Free +** Software Foundation and appearing in the file LICENSE.GPL included in +** the packaging of this file. Please review the following information to +** ensure the GNU General Public License version 2.0 requirements will be +** met: http://www.gnu.org/licenses/gpl-2.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 2.6 +import Qt.labs.templates 1.0 as T +import Qt.labs.controls.material 1.0 + +T.Page { + id: control + + //! [contentItem] + contentItem: Item { } + //! [contentItem] + + //! [background] + background: Rectangle { + color: control.Material.backgroundColor + } + //! [background] +} diff --git a/src/imports/controls/material/material.pri b/src/imports/controls/material/material.pri index bc5f85d1..bcdc0de9 100644 --- a/src/imports/controls/material/material.pri +++ b/src/imports/controls/material/material.pri @@ -22,8 +22,9 @@ QML_FILES += \ $$PWD/Label.qml \ $$PWD/Menu.qml \ $$PWD/MenuItem.qml \ - $$PWD/Pane.qml \ + $$PWD/Page.qml \ $$PWD/PageIndicator.qml \ + $$PWD/Pane.qml \ $$PWD/Popup.qml \ $$PWD/ProgressBar.qml \ $$PWD/RadioButton.qml \ diff --git a/src/imports/controls/qtlabscontrolsplugin.cpp b/src/imports/controls/qtlabscontrolsplugin.cpp index b56df31a..4258fb9c 100644 --- a/src/imports/controls/qtlabscontrolsplugin.cpp +++ b/src/imports/controls/qtlabscontrolsplugin.cpp @@ -89,8 +89,9 @@ void QtLabsControlsPlugin::registerTypes(const char *uri) qmlRegisterType(selector.select(QStringLiteral("/Label.qml")), uri, 1, 0, "Label"); qmlRegisterType(selector.select(QStringLiteral("/Menu.qml")), uri, 1, 0, "Menu"); qmlRegisterType(selector.select(QStringLiteral("/MenuItem.qml")), uri, 1, 0, "MenuItem"); - qmlRegisterType(selector.select(QStringLiteral("/Pane.qml")), uri, 1, 0, "Pane"); + qmlRegisterType(selector.select(QStringLiteral("/Page.qml")), uri, 1, 0, "Page"); qmlRegisterType(selector.select(QStringLiteral("/PageIndicator.qml")), uri, 1, 0, "PageIndicator"); + qmlRegisterType(selector.select(QStringLiteral("/Pane.qml")), uri, 1, 0, "Pane"); qmlRegisterType(selector.select(QStringLiteral("/Popup.qml")), uri, 1, 0, "Popup"); qmlRegisterType(selector.select(QStringLiteral("/ProgressBar.qml")), uri, 1, 0, "ProgressBar"); qmlRegisterType(selector.select(QStringLiteral("/RadioButton.qml")), uri, 1, 0, "RadioButton"); diff --git a/src/imports/controls/universal/Page.qml b/src/imports/controls/universal/Page.qml new file mode 100644 index 00000000..975ddfe0 --- /dev/null +++ b/src/imports/controls/universal/Page.qml @@ -0,0 +1,53 @@ +/**************************************************************************** +** +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ +** +** This file is part of the Qt Labs Controls module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL3$ +** 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 http://www.qt.io/terms-conditions. For further +** information use the contact form at http://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.LGPLv3 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.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 later as published by the Free +** Software Foundation and appearing in the file LICENSE.GPL included in +** the packaging of this file. Please review the following information to +** ensure the GNU General Public License version 2.0 requirements will be +** met: http://www.gnu.org/licenses/gpl-2.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 2.6 +import Qt.labs.templates 1.0 as T +import Qt.labs.controls.universal 1.0 + +T.Page { + id: control + + //! [contentItem] + contentItem: Item { } + //! [contentItem] + + //! [background] + background: Rectangle { + color: control.Universal.altHighColor + } + //! [background] +} diff --git a/src/imports/controls/universal/universal.pri b/src/imports/controls/universal/universal.pri index 8736d352..b84a8cf0 100644 --- a/src/imports/controls/universal/universal.pri +++ b/src/imports/controls/universal/universal.pri @@ -11,8 +11,9 @@ QML_FILES += \ $$PWD/Label.qml \ $$PWD/Menu.qml \ $$PWD/MenuItem.qml \ - $$PWD/Pane.qml \ + $$PWD/Page.qml \ $$PWD/PageIndicator.qml \ + $$PWD/Pane.qml \ $$PWD/ProgressBar.qml \ $$PWD/RadioButton.qml \ $$PWD/RangeSlider.qml \ diff --git a/src/imports/templates/qtlabstemplatesplugin.cpp b/src/imports/templates/qtlabstemplatesplugin.cpp index 76698b90..635a2006 100644 --- a/src/imports/templates/qtlabstemplatesplugin.cpp +++ b/src/imports/templates/qtlabstemplatesplugin.cpp @@ -53,6 +53,7 @@ #include <QtLabsTemplates/private/qquickmenu_p.h> #include <QtLabsTemplates/private/qquickmenuitem_p.h> #include <QtLabsTemplates/private/qquickoverlay_p.h> +#include <QtLabsTemplates/private/qquickpage_p.h> #include <QtLabsTemplates/private/qquickpageindicator_p.h> #include <QtLabsTemplates/private/qquickpane_p.h> #include <QtLabsTemplates/private/qquickpopup_p.h> @@ -105,6 +106,7 @@ void QtLabsTemplatesPlugin::registerTypes(const char *uri) qmlRegisterType<QQuickMenu>(uri, 1, 0, "Menu"); qmlRegisterType<QQuickMenuItem>(uri, 1, 0, "MenuItem"); qmlRegisterType<QQuickOverlay>(); + qmlRegisterType<QQuickPage>(uri, 1, 0, "Page"); qmlRegisterType<QQuickPageIndicator>(uri, 1, 0, "PageIndicator"); qmlRegisterType<QQuickPane>(uri, 1, 0, "Pane"); qmlRegisterType<QQuickPopup>(uri, 1, 0, "Popup"); diff --git a/src/templates/qquickapplicationwindow.cpp b/src/templates/qquickapplicationwindow.cpp index 3e6734d7..71adf87e 100644 --- a/src/templates/qquickapplicationwindow.cpp +++ b/src/templates/qquickapplicationwindow.cpp @@ -81,7 +81,7 @@ QT_BEGIN_NAMESPACE \note By default, an ApplicationWindow is not visible. - \sa {Container Controls} + \sa Page, {Container Controls} */ class QQuickApplicationWindowPrivate : public QQuickItemChangeListener @@ -228,7 +228,7 @@ QQuickApplicationWindow::~QQuickApplicationWindow() This property holds the window header item. The header item is positioned to the top, and resized to the width of the window. The default value is \c null. - \sa footer + \sa footer, Page::header */ QQuickItem *QQuickApplicationWindow::header() const { @@ -262,7 +262,7 @@ void QQuickApplicationWindow::setHeader(QQuickItem *header) This property holds the window footer item. The footer item is positioned to the bottom, and resized to the width of the window. The default value is \c null. - \sa header + \sa header, Page::footer */ QQuickItem *QQuickApplicationWindow::footer() const { diff --git a/src/templates/qquickpage.cpp b/src/templates/qquickpage.cpp new file mode 100644 index 00000000..8302dca0 --- /dev/null +++ b/src/templates/qquickpage.cpp @@ -0,0 +1,279 @@ +/**************************************************************************** +** +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ +** +** This file is part of the Qt Labs Templates module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL3$ +** 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 http://www.qt.io/terms-conditions. For further +** information use the contact form at http://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.LGPLv3 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.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 later as published by the Free +** Software Foundation and appearing in the file LICENSE.GPL included in +** the packaging of this file. Please review the following information to +** ensure the GNU General Public License version 2.0 requirements will be +** met: http://www.gnu.org/licenses/gpl-2.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qquickpage_p.h" +#include "qquickcontrol_p_p.h" + +#include <QtQuick/private/qquickitemchangelistener_p.h> + +QT_BEGIN_NAMESPACE + +/*! + \qmltype Page + \inherits Control + \instantiates QQuickPage + \inqmlmodule Qt.labs.controls + \ingroup qtlabscontrols-containers + \brief A page control. + + Page is a container control which makes it convenient to add + a \l header and \l footer item to a page. + + \image qtlabscontrols-page-wireframe.png + + The following example snippet illustrates how to use a page-specific + toolbar header and an application-wide tabbar footer. + + \qml + import Qt.labs.controls 1.0 + + ApplicationWindow { + visible: true + + StackView { + anchors.fill: parent + + initialItem: Page { + header: ToolBar { + // ... + } + } + } + + footer: TabBar { + // ... + } + } + \endqml + + \sa ApplicationWindow, {Container Controls} +*/ + +class QQuickPagePrivate : public QQuickControlPrivate, public QQuickItemChangeListener +{ + Q_DECLARE_PUBLIC(QQuickPage) + +public: + QQuickPagePrivate(); + + void relayout(); + + void itemImplicitWidthChanged(QQuickItem *item) Q_DECL_OVERRIDE; + void itemImplicitHeightChanged(QQuickItem *item) Q_DECL_OVERRIDE; + + QQuickItem *header; + QQuickItem *footer; +}; + +QQuickPagePrivate::QQuickPagePrivate() : header(Q_NULLPTR), footer(Q_NULLPTR) +{ +} + +void QQuickPagePrivate::relayout() +{ + Q_Q(QQuickPage); + QQuickItem *content = q->contentItem(); + const qreal hh = header ? header->height() : 0; + const qreal fh = footer ? footer->height() : 0; + + content->setY(hh + q->topPadding()); + content->setX(q->leftPadding()); + content->setWidth(q->availableWidth()); + content->setHeight(q->availableHeight() - hh - fh); + + if (header) + header->setWidth(q->width()); + + if (footer) { + footer->setY(q->height() - fh); + footer->setWidth(q->width()); + } +} + +void QQuickPagePrivate::itemImplicitWidthChanged(QQuickItem *item) +{ + Q_UNUSED(item); + relayout(); +} + +void QQuickPagePrivate::itemImplicitHeightChanged(QQuickItem *item) +{ + Q_UNUSED(item); + relayout(); +} + +QQuickPage::QQuickPage(QQuickItem *parent) : + QQuickControl(*(new QQuickPagePrivate), parent) +{ + setFlag(ItemIsFocusScope); + setAcceptedMouseButtons(Qt::AllButtons); +} + +/*! + \qmlproperty Item Qt.labs.controls::Page::header + + This property holds the page header item. The header item is positioned to + the top, and resized to the width of the page. The default value is \c null. + + \sa footer, ApplicationWindow::header +*/ +QQuickItem *QQuickPage::header() const +{ + Q_D(const QQuickPage); + return d->header; +} + +void QQuickPage::setHeader(QQuickItem *header) +{ + Q_D(QQuickPage); + if (d->header != header) { + if (d->header) + QQuickItemPrivate::get(d->header)->removeItemChangeListener(d, QQuickItemPrivate::ImplicitWidth | QQuickItemPrivate::ImplicitHeight); + d->header = header; + if (header) { + header->setParentItem(this); + QQuickItemPrivate *p = QQuickItemPrivate::get(header); + p->addItemChangeListener(d, QQuickItemPrivate::ImplicitWidth | QQuickItemPrivate::ImplicitHeight); + if (qFuzzyIsNull(header->z())) + header->setZ(1); + if (isComponentComplete()) + d->relayout(); + } + emit headerChanged(); + } +} + +/*! + \qmlproperty Item Qt.labs.controls::Page::footer + + This property holds the page footer item. The footer item is positioned to + the bottom, and resized to the width of the page. The default value is \c null. + + \sa header, ApplicationWindow::footer +*/ +QQuickItem *QQuickPage::footer() const +{ + Q_D(const QQuickPage); + return d->footer; +} + +void QQuickPage::setFooter(QQuickItem *footer) +{ + Q_D(QQuickPage); + if (d->footer != footer) { + if (d->footer) + QQuickItemPrivate::get(d->footer)->removeItemChangeListener(d, QQuickItemPrivate::ImplicitWidth | QQuickItemPrivate::ImplicitHeight); + d->footer = footer; + if (footer) { + footer->setParentItem(this); + QQuickItemPrivate *p = QQuickItemPrivate::get(footer); + p->addItemChangeListener(d, QQuickItemPrivate::ImplicitWidth | QQuickItemPrivate::ImplicitHeight); + if (qFuzzyIsNull(footer->z())) + footer->setZ(1); + if (isComponentComplete()) + d->relayout(); + } + emit footerChanged(); + } +} + +/*! + \qmlproperty list<Object> Qt.labs.controls::Page::contentData + \default + + This property holds the list of content data. + + \sa Item::data +*/ +QQmlListProperty<QObject> QQuickPage::contentData() +{ + Q_D(QQuickPage); + return QQmlListProperty<QObject>(d->contentItem, Q_NULLPTR, + QQuickItemPrivate::data_append, + QQuickItemPrivate::data_count, + QQuickItemPrivate::data_at, + QQuickItemPrivate::data_clear); +} + +/*! + \qmlproperty list<Item> Qt.labs.controls::Page::contentChildren + + This property holds the list of content children. + + \sa Item::children +*/ +QQmlListProperty<QQuickItem> QQuickPage::contentChildren() +{ + Q_D(QQuickPage); + return QQmlListProperty<QQuickItem>(d->contentItem, Q_NULLPTR, + QQuickItemPrivate::children_append, + QQuickItemPrivate::children_count, + QQuickItemPrivate::children_at, + QQuickItemPrivate::children_clear); +} + +void QQuickPage::contentItemChange(QQuickItem *newItem, QQuickItem *oldItem) +{ + QQuickControl::contentItemChange(newItem, oldItem); + if (oldItem) + disconnect(oldItem, &QQuickItem::childrenChanged, this, &QQuickPage::contentChildrenChanged); + if (newItem) + connect(newItem, &QQuickItem::childrenChanged, this, &QQuickPage::contentChildrenChanged); + emit contentChildrenChanged(); +} + +void QQuickPage::geometryChanged(const QRectF &newGeometry, const QRectF &oldGeometry) +{ + Q_D(QQuickPage); + QQuickControl::geometryChanged(newGeometry, oldGeometry); + d->relayout(); +} + +void QQuickPage::paddingChange(const QMarginsF &newPadding, const QMarginsF &oldPadding) +{ + Q_D(QQuickPage); + QQuickControl::paddingChange(newPadding, oldPadding); + d->relayout(); +} + +#ifndef QT_NO_ACCESSIBILITY +QAccessible::Role QQuickPage::accessibleRole() const +{ + return QAccessible::PageTab; +} +#endif + +QT_END_NAMESPACE diff --git a/src/templates/qquickpage_p.h b/src/templates/qquickpage_p.h new file mode 100644 index 00000000..157f0507 --- /dev/null +++ b/src/templates/qquickpage_p.h @@ -0,0 +1,102 @@ +/**************************************************************************** +** +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ +** +** This file is part of the Qt Labs Templates module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL3$ +** 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 http://www.qt.io/terms-conditions. For further +** information use the contact form at http://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.LGPLv3 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.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 later as published by the Free +** Software Foundation and appearing in the file LICENSE.GPL included in +** the packaging of this file. Please review the following information to +** ensure the GNU General Public License version 2.0 requirements will be +** met: http://www.gnu.org/licenses/gpl-2.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QQUICKPAGE_P_H +#define QQUICKPAGE_P_H + +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// + +#include <QtLabsTemplates/private/qquickcontrol_p.h> +#include <QtQml/qqmllist.h> + +QT_BEGIN_NAMESPACE + +class QQuickPagePrivate; + +class Q_LABSTEMPLATES_EXPORT QQuickPage : public QQuickControl +{ + Q_OBJECT + 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) + Q_PROPERTY(QQmlListProperty<QQuickItem> contentChildren READ contentChildren NOTIFY contentChildrenChanged FINAL) + Q_CLASSINFO("DefaultProperty", "contentData") + +public: + explicit QQuickPage(QQuickItem *parent = Q_NULLPTR); + + QQuickItem *header() const; + void setHeader(QQuickItem *header); + + QQuickItem *footer() const; + void setFooter(QQuickItem *footer); + + QQmlListProperty<QObject> contentData(); + QQmlListProperty<QQuickItem> contentChildren(); + +Q_SIGNALS: + void headerChanged(); + void footerChanged(); + void contentChildrenChanged(); + +protected: + void contentItemChange(QQuickItem *newItem, QQuickItem *oldItem) Q_DECL_OVERRIDE; + void geometryChanged(const QRectF &newGeometry, const QRectF &oldGeometry) Q_DECL_OVERRIDE; + void paddingChange(const QMarginsF &newPadding, const QMarginsF &oldPadding) Q_DECL_OVERRIDE; + +#ifndef QT_NO_ACCESSIBILITY + QAccessible::Role accessibleRole() const Q_DECL_OVERRIDE; +#endif + +private: + Q_DISABLE_COPY(QQuickPage) + Q_DECLARE_PRIVATE(QQuickPage) +}; + +QT_END_NAMESPACE + +QML_DECLARE_TYPE(QQuickPage) + +#endif // QQUICKPAGE_P_H diff --git a/src/templates/templates.pri b/src/templates/templates.pri index 1ae46e85..c4651d82 100644 --- a/src/templates/templates.pri +++ b/src/templates/templates.pri @@ -25,6 +25,7 @@ HEADERS += \ $$PWD/qquickmenu_p_p.h \ $$PWD/qquickmenuitem_p.h \ $$PWD/qquickoverlay_p.h \ + $$PWD/qquickpage_p.h \ $$PWD/qquickpageindicator_p.h \ $$PWD/qquickpane_p.h \ $$PWD/qquickpane_p_p.h \ @@ -71,6 +72,7 @@ SOURCES += \ $$PWD/qquickmenu.cpp \ $$PWD/qquickmenuitem.cpp \ $$PWD/qquickoverlay.cpp \ + $$PWD/qquickpage.cpp \ $$PWD/qquickpageindicator.cpp \ $$PWD/qquickpane.cpp \ $$PWD/qquickpopup.cpp \ |