aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/imports/controls/Pane.qml60
-rw-r--r--src/imports/controls/controls.pri1
-rw-r--r--src/imports/controls/doc/images/qtlabscontrols-pane-background.pngbin0 -> 341 bytes
-rw-r--r--src/imports/controls/doc/images/qtlabscontrols-pane.pngbin0 -> 5022 bytes
-rw-r--r--src/imports/controls/doc/snippets/qtlabscontrols-pane-background.qml38
-rw-r--r--src/imports/controls/doc/snippets/qtlabscontrols-pane.qml41
-rw-r--r--src/imports/controls/doc/src/qtlabscontrols-containers.qdoc7
-rw-r--r--src/imports/controls/doc/src/qtlabscontrols-customize.qdoc11
-rw-r--r--src/imports/controls/material/Pane.qml61
-rw-r--r--src/imports/controls/material/material.pri1
-rw-r--r--src/imports/controls/qtlabscontrolsplugin.cpp1
-rw-r--r--src/imports/controls/universal/Pane.qml61
-rw-r--r--src/imports/controls/universal/universal.pri1
-rw-r--r--src/imports/templates/qtlabstemplatesplugin.cpp2
-rw-r--r--src/templates/qquickframe.cpp111
-rw-r--r--src/templates/qquickframe_p.h24
-rw-r--r--src/templates/qquickframe_p_p.h8
-rw-r--r--src/templates/qquickpane.cpp182
-rw-r--r--src/templates/qquickpane_p.h102
-rw-r--r--src/templates/qquickpane_p_p.h72
-rw-r--r--src/templates/templates.pri3
21 files changed, 652 insertions, 135 deletions
diff --git a/src/imports/controls/Pane.qml b/src/imports/controls/Pane.qml
new file mode 100644
index 00000000..7bd72493
--- /dev/null
+++ b/src/imports/controls/Pane.qml
@@ -0,0 +1,60 @@
+/****************************************************************************
+**
+** 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.Frame {
+ id: control
+
+ implicitWidth: Math.max(background ? background.implicitWidth : 0, contentWidth + leftPadding + rightPadding)
+ implicitHeight: Math.max(background ? background.implicitHeight : 0, contentHeight + topPadding + bottomPadding)
+
+ contentWidth: contentChildren.length === 1 ? contentChildren[0].implicitWidth : 0
+ contentHeight: contentChildren.length === 1 ? contentChildren[0].implicitHeight : 0
+
+ padding: 6
+
+ //! [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 63e3373e..7cd0af87 100644
--- a/src/imports/controls/controls.pri
+++ b/src/imports/controls/controls.pri
@@ -12,6 +12,7 @@ QML_FILES = \
Label.qml \
Menu.qml \
MenuItem.qml \
+ Pane.qml \
PageIndicator.qml \
ProgressBar.qml \
RadioButton.qml \
diff --git a/src/imports/controls/doc/images/qtlabscontrols-pane-background.png b/src/imports/controls/doc/images/qtlabscontrols-pane-background.png
new file mode 100644
index 00000000..a379d915
--- /dev/null
+++ b/src/imports/controls/doc/images/qtlabscontrols-pane-background.png
Binary files differ
diff --git a/src/imports/controls/doc/images/qtlabscontrols-pane.png b/src/imports/controls/doc/images/qtlabscontrols-pane.png
new file mode 100644
index 00000000..ba0c0479
--- /dev/null
+++ b/src/imports/controls/doc/images/qtlabscontrols-pane.png
Binary files differ
diff --git a/src/imports/controls/doc/snippets/qtlabscontrols-pane-background.qml b/src/imports/controls/doc/snippets/qtlabscontrols-pane-background.qml
new file mode 100644
index 00000000..d1d9f22f
--- /dev/null
+++ b/src/imports/controls/doc/snippets/qtlabscontrols-pane-background.qml
@@ -0,0 +1,38 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:FDL$
+** 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 Free Documentation License Usage
+** Alternatively, this file may be used under the terms of the GNU Free
+** Documentation License version 1.3 as published by the Free Software
+** Foundation and appearing in the file included in the packaging of
+** this file. Please review the following information to ensure
+** the GNU Free Documentation License version 1.3 requirements
+** will be met: http://www.gnu.org/copyleft/fdl.html.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+import Qt.labs.controls 1.0
+
+Pane {
+ width: 100
+ height: 100
+ background: Rectangle {
+ color: 'transparent'
+ border.color: 'red'
+ }
+}
diff --git a/src/imports/controls/doc/snippets/qtlabscontrols-pane.qml b/src/imports/controls/doc/snippets/qtlabscontrols-pane.qml
new file mode 100644
index 00000000..09bfa6a0
--- /dev/null
+++ b/src/imports/controls/doc/snippets/qtlabscontrols-pane.qml
@@ -0,0 +1,41 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:FDL$
+** 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 Free Documentation License Usage
+** Alternatively, this file may be used under the terms of the GNU Free
+** Documentation License version 1.3 as published by the Free Software
+** Foundation and appearing in the file included in the packaging of
+** this file. Please review the following information to ensure
+** the GNU Free Documentation License version 1.3 requirements
+** will be met: http://www.gnu.org/copyleft/fdl.html.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+import QtQuick.Layouts 1.0
+import Qt.labs.controls 1.0
+
+//! [1]
+Pane {
+ ColumnLayout {
+ anchors.fill: parent
+ CheckBox { text: qsTr("E-mail") }
+ CheckBox { text: qsTr("Calendar") }
+ CheckBox { text: qsTr("Contacts") }
+ }
+}
+//! [1]
diff --git a/src/imports/controls/doc/src/qtlabscontrols-containers.qdoc b/src/imports/controls/doc/src/qtlabscontrols-containers.qdoc
index cf47499c..a627a26a 100644
--- a/src/imports/controls/doc/src/qtlabscontrols-containers.qdoc
+++ b/src/imports/controls/doc/src/qtlabscontrols-containers.qdoc
@@ -57,6 +57,13 @@
\l GroupBox is used to layout a logical group of controls together,
within a titled visual frame.
+ \section1 Pane Control
+
+ \image qtlabscontrols-pane.png
+
+ \l Pane provides a background color that matches with the application
+ style and theme.
+
\section1 StackView Control
\image qtlabscontrols-stackview-wireframe.png
diff --git a/src/imports/controls/doc/src/qtlabscontrols-customize.qdoc b/src/imports/controls/doc/src/qtlabscontrols-customize.qdoc
index 524cd23a..4aff46a4 100644
--- a/src/imports/controls/doc/src/qtlabscontrols-customize.qdoc
+++ b/src/imports/controls/doc/src/qtlabscontrols-customize.qdoc
@@ -260,6 +260,17 @@
TODO
+ \section1 Customizing Pane
+
+ Pane consists of a \l {Control::background}{background}.
+
+ \section3 Background
+
+ \image qtlabscontrols-pane-background.png
+
+ \snippet Pane.qml background
+
+
\section1 Customizing ProgressBar
ProgressBar consists of two visual items: \l {Control::background}{background}
diff --git a/src/imports/controls/material/Pane.qml b/src/imports/controls/material/Pane.qml
new file mode 100644
index 00000000..abb94808
--- /dev/null
+++ b/src/imports/controls/material/Pane.qml
@@ -0,0 +1,61 @@
+/****************************************************************************
+**
+** 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.Frame {
+ id: control
+
+ implicitWidth: Math.max(background ? background.implicitWidth : 0, contentWidth + leftPadding + rightPadding)
+ implicitHeight: Math.max(background ? background.implicitHeight : 0, contentHeight + topPadding + bottomPadding)
+
+ contentWidth: contentChildren.length === 1 ? contentChildren[0].implicitWidth : 0
+ contentHeight: contentChildren.length === 1 ? contentChildren[0].implicitHeight : 0
+
+ padding: 6
+
+ //! [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 1c71b9fa..a1e99550 100644
--- a/src/imports/controls/material/material.pri
+++ b/src/imports/controls/material/material.pri
@@ -20,6 +20,7 @@ QML_FILES += \
$$PWD/GroupBox.qml \
$$PWD/ItemDelegate.qml \
$$PWD/Label.qml \
+ $$PWD/Pane.qml \
$$PWD/PageIndicator.qml \
$$PWD/ProgressBar.qml \
$$PWD/RadioButton.qml \
diff --git a/src/imports/controls/qtlabscontrolsplugin.cpp b/src/imports/controls/qtlabscontrolsplugin.cpp
index 2d71284e..fef5e41e 100644
--- a/src/imports/controls/qtlabscontrolsplugin.cpp
+++ b/src/imports/controls/qtlabscontrolsplugin.cpp
@@ -80,6 +80,7 @@ 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("/PageIndicator.qml")), uri, 1, 0, "PageIndicator");
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/Pane.qml b/src/imports/controls/universal/Pane.qml
new file mode 100644
index 00000000..8477dccf
--- /dev/null
+++ b/src/imports/controls/universal/Pane.qml
@@ -0,0 +1,61 @@
+/****************************************************************************
+**
+** 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.Frame {
+ id: control
+
+ implicitWidth: Math.max(background ? background.implicitWidth : 0, contentWidth + leftPadding + rightPadding)
+ implicitHeight: Math.max(background ? background.implicitHeight : 0, contentHeight + topPadding + bottomPadding)
+
+ contentWidth: contentChildren.length === 1 ? contentChildren[0].implicitWidth : 0
+ contentHeight: contentChildren.length === 1 ? contentChildren[0].implicitHeight : 0
+
+ padding: 12
+
+ //! [contentItem]
+ contentItem: Item { }
+ //! [contentItem]
+
+ //! [background]
+ background: Rectangle {
+ color: Universal.altHighColor
+ }
+ //! [background]
+}
diff --git a/src/imports/controls/universal/universal.pri b/src/imports/controls/universal/universal.pri
index c0f4eb66..12c939c1 100644
--- a/src/imports/controls/universal/universal.pri
+++ b/src/imports/controls/universal/universal.pri
@@ -11,6 +11,7 @@ QML_FILES += \
$$PWD/Label.qml \
$$PWD/Menu.qml \
$$PWD/MenuItem.qml \
+ $$PWD/Pane.qml \
$$PWD/PageIndicator.qml \
$$PWD/ProgressBar.qml \
$$PWD/RadioButton.qml \
diff --git a/src/imports/templates/qtlabstemplatesplugin.cpp b/src/imports/templates/qtlabstemplatesplugin.cpp
index 44a08fb3..41e572d2 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/qquickpageindicator_p.h>
+#include <QtLabsTemplates/private/qquickpane_p.h>
#include <QtLabsTemplates/private/qquickpopup_p.h>
#include <QtLabsTemplates/private/qquickprogressbar_p.h>
#include <QtLabsTemplates/private/qquickradiobutton_p.h>
@@ -103,6 +104,7 @@ void QtLabsTemplatesPlugin::registerTypes(const char *uri)
qmlRegisterType<QQuickMenu>(uri, 1, 0, "Menu");
qmlRegisterType<QQuickMenuItem>(uri, 1, 0, "MenuItem");
qmlRegisterType<QQuickPageIndicator>(uri, 1, 0, "PageIndicator");
+ qmlRegisterType<QQuickPane>(uri, 1, 0, "Pane");
qmlRegisterType<QQuickPopup>(uri, 1, 0, "Popup");
qmlRegisterType<QQuickProgressBar>(uri, 1, 0, "ProgressBar");
qmlRegisterType<QQuickRadioButton>(uri, 1, 0, "RadioButton");
diff --git a/src/templates/qquickframe.cpp b/src/templates/qquickframe.cpp
index 69a7abb0..386aa5fb 100644
--- a/src/templates/qquickframe.cpp
+++ b/src/templates/qquickframe.cpp
@@ -41,7 +41,7 @@ QT_BEGIN_NAMESPACE
/*!
\qmltype Frame
- \inherits Control
+ \inherits Pane
\instantiates QQuickFrame
\inqmlmodule Qt.labs.controls
\ingroup qtlabscontrols-containers
@@ -63,76 +63,18 @@ QT_BEGIN_NAMESPACE
\sa {Customizing Frame}, {Container Controls}
*/
-QQuickFramePrivate::QQuickFramePrivate() : contentWidth(0), contentHeight(0), frame(Q_NULLPTR)
+QQuickFramePrivate::QQuickFramePrivate() : frame(Q_NULLPTR)
{
}
-void QQuickFramePrivate::init()
-{
- Q_Q(QQuickFrame);
- q->setFlag(QQuickItem::ItemIsFocusScope);
- q->setAcceptedMouseButtons(Qt::AllButtons);
-
-}
-
QQuickFrame::QQuickFrame(QQuickItem *parent) :
- QQuickControl(*(new QQuickFramePrivate), parent)
+ QQuickPane(*(new QQuickFramePrivate), parent)
{
- d_func()->init();
}
QQuickFrame::QQuickFrame(QQuickFramePrivate &dd, QQuickItem *parent) :
- QQuickControl(dd, parent)
+ QQuickPane(dd, parent)
{
- d_func()->init();
-}
-
-/*!
- \qmlproperty real Qt.labs.controls::Frame::contentWidth
-
- This property holds the content width. It is used for calculating the
- total implicit width of the frame.
-
- \note If only a single item is used within the frame, the implicit width
- of its contained item is used as the content width.
-*/
-qreal QQuickFrame::contentWidth() const
-{
- Q_D(const QQuickFrame);
- return d->contentWidth;
-}
-
-void QQuickFrame::setContentWidth(qreal width)
-{
- Q_D(QQuickFrame);
- if (d->contentWidth != width) {
- d->contentWidth = width;
- emit contentWidthChanged();
- }
-}
-
-/*!
- \qmlproperty real Qt.labs.controls::Frame::contentHeight
-
- This property holds the content height. It is used for calculating the
- total implicit height of the frame.
-
- \note If only a single item is used within the frame, the implicit height
- of its contained item is used as the content height.
-*/
-qreal QQuickFrame::contentHeight() const
-{
- Q_D(const QQuickFrame);
- return d->contentHeight;
-}
-
-void QQuickFrame::setContentHeight(qreal height)
-{
- Q_D(QQuickFrame);
- if (d->contentHeight != height) {
- d->contentHeight = height;
- emit contentHeightChanged();
- }
}
/*!
@@ -160,49 +102,4 @@ void QQuickFrame::setFrame(QQuickItem *frame)
}
}
-/*!
- \qmlproperty list<Object> Qt.labs.controls::Frame::contentData
- \default
-
- This property holds the list of content data.
-
- \sa Item::data
-*/
-QQmlListProperty<QObject> QQuickFrame::contentData()
-{
- Q_D(QQuickFrame);
- 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::Frame::contentChildren
-
- This property holds the list of content children.
-
- \sa Item::children
-*/
-QQmlListProperty<QQuickItem> QQuickFrame::contentChildren()
-{
- Q_D(QQuickFrame);
- return QQmlListProperty<QQuickItem>(d->contentItem, Q_NULLPTR,
- QQuickItemPrivate::children_append,
- QQuickItemPrivate::children_count,
- QQuickItemPrivate::children_at,
- QQuickItemPrivate::children_clear);
-}
-
-void QQuickFrame::contentItemChange(QQuickItem *newItem, QQuickItem *oldItem)
-{
- QQuickControl::contentItemChange(newItem, oldItem);
- if (oldItem)
- disconnect(oldItem, &QQuickItem::childrenChanged, this, &QQuickFrame::contentChildrenChanged);
- if (newItem)
- connect(newItem, &QQuickItem::childrenChanged, this, &QQuickFrame::contentChildrenChanged);
- emit contentChildrenChanged();
-}
-
QT_END_NAMESPACE
diff --git a/src/templates/qquickframe_p.h b/src/templates/qquickframe_p.h
index 7d4db523..b59335ce 100644
--- a/src/templates/qquickframe_p.h
+++ b/src/templates/qquickframe_p.h
@@ -48,49 +48,29 @@
// We mean it.
//
-#include <QtLabsTemplates/private/qquickcontrol_p.h>
-#include <QtQml/qqmllist.h>
+#include <QtLabsTemplates/private/qquickpane_p.h>
QT_BEGIN_NAMESPACE
class QQuickFramePrivate;
-class Q_LABSTEMPLATES_EXPORT QQuickFrame : public QQuickControl
+class Q_LABSTEMPLATES_EXPORT QQuickFrame : public QQuickPane
{
Q_OBJECT
- Q_PROPERTY(qreal contentWidth READ contentWidth WRITE setContentWidth NOTIFY contentWidthChanged FINAL)
- Q_PROPERTY(qreal contentHeight READ contentHeight WRITE setContentHeight NOTIFY contentHeightChanged FINAL)
Q_PROPERTY(QQuickItem *frame READ frame WRITE setFrame NOTIFY frameChanged 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 QQuickFrame(QQuickItem *parent = Q_NULLPTR);
- qreal contentWidth() const;
- void setContentWidth(qreal width);
-
- qreal contentHeight() const;
- void setContentHeight(qreal height);
-
QQuickItem *frame() const;
void setFrame(QQuickItem *frame);
- QQmlListProperty<QObject> contentData();
- QQmlListProperty<QQuickItem> contentChildren();
-
Q_SIGNALS:
- void contentWidthChanged();
- void contentHeightChanged();
- void contentChildrenChanged();
void frameChanged();
protected:
QQuickFrame(QQuickFramePrivate &dd, QQuickItem *parent);
- void contentItemChange(QQuickItem *newItem, QQuickItem *oldItem) Q_DECL_OVERRIDE;
-
private:
Q_DISABLE_COPY(QQuickFrame)
Q_DECLARE_PRIVATE(QQuickFrame)
diff --git a/src/templates/qquickframe_p_p.h b/src/templates/qquickframe_p_p.h
index 73a8cd85..4186ff36 100644
--- a/src/templates/qquickframe_p_p.h
+++ b/src/templates/qquickframe_p_p.h
@@ -48,23 +48,19 @@
// We mean it.
//
-#include <QtLabsTemplates/private/qquickcontrol_p_p.h>
+#include <QtLabsTemplates/private/qquickpane_p_p.h>
QT_BEGIN_NAMESPACE
class QQuickFrame;
-class Q_LABSTEMPLATES_EXPORT QQuickFramePrivate : public QQuickControlPrivate
+class Q_LABSTEMPLATES_EXPORT QQuickFramePrivate : public QQuickPanePrivate
{
Q_DECLARE_PUBLIC(QQuickFrame)
public:
QQuickFramePrivate();
- void init();
-
- qreal contentWidth;
- qreal contentHeight;
QQuickItem *frame;
};
diff --git a/src/templates/qquickpane.cpp b/src/templates/qquickpane.cpp
new file mode 100644
index 00000000..9f1f50dd
--- /dev/null
+++ b/src/templates/qquickpane.cpp
@@ -0,0 +1,182 @@
+/****************************************************************************
+**
+** 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 "qquickpane_p.h"
+#include "qquickpane_p_p.h"
+
+QT_BEGIN_NAMESPACE
+
+/*!
+ \qmltype Pane
+ \inherits Control
+ \instantiates QQuickPane
+ \inqmlmodule Qt.labs.controls
+ \ingroup qtlabscontrols-containers
+ \brief A pane control.
+
+ Pane provides a background color that matches with the application style
+ and theme. Pane does not provide a layout of its own, but requires you to
+ position its contents, for instance by creating a \l RowLayout or a
+ \l ColumnLayout.
+
+ If only a single item is used within a Pane, it will resize to fit the
+ implicit size of its contained item. This makes it particularly suitable
+ for use together with layouts.
+
+ \image qtlabscontrols-pane.png
+
+ \snippet qtlabscontrols-pane.qml 1
+
+ \sa {Customizing Pane}, {Container Controls}
+*/
+
+QQuickPanePrivate::QQuickPanePrivate() : contentWidth(0), contentHeight(0)
+{
+}
+
+QQuickPane::QQuickPane(QQuickItem *parent) :
+ QQuickControl(*(new QQuickPanePrivate), parent)
+{
+ setFlag(QQuickItem::ItemIsFocusScope);
+}
+
+QQuickPane::QQuickPane(QQuickPanePrivate &dd, QQuickItem *parent) :
+ QQuickControl(dd, parent)
+{
+ setFlag(QQuickItem::ItemIsFocusScope);
+}
+
+/*!
+ \qmlproperty real Qt.labs.controls::Pane::contentWidth
+
+ This property holds the content width. It is used for calculating the
+ total implicit width of the pane.
+
+ \note If only a single item is used within the pane, the implicit width
+ of its contained item is used as the content width.
+*/
+qreal QQuickPane::contentWidth() const
+{
+ Q_D(const QQuickPane);
+ return d->contentWidth;
+}
+
+void QQuickPane::setContentWidth(qreal width)
+{
+ Q_D(QQuickPane);
+ if (d->contentWidth != width) {
+ d->contentWidth = width;
+ emit contentWidthChanged();
+ }
+}
+
+/*!
+ \qmlproperty real Qt.labs.controls::Pane::contentHeight
+
+ This property holds the content height. It is used for calculating the
+ total implicit height of the pane.
+
+ \note If only a single item is used within the pane, the implicit height
+ of its contained item is used as the content height.
+*/
+qreal QQuickPane::contentHeight() const
+{
+ Q_D(const QQuickPane);
+ return d->contentHeight;
+}
+
+void QQuickPane::setContentHeight(qreal height)
+{
+ Q_D(QQuickPane);
+ if (d->contentHeight != height) {
+ d->contentHeight = height;
+ emit contentHeightChanged();
+ }
+}
+
+/*!
+ \qmlproperty list<Object> Qt.labs.controls::Pane::contentData
+ \default
+
+ This property holds the list of content data.
+
+ \sa Item::data
+*/
+QQmlListProperty<QObject> QQuickPane::contentData()
+{
+ Q_D(QQuickPane);
+ 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::Pane::contentChildren
+
+ This property holds the list of content children.
+
+ \sa Item::children
+*/
+QQmlListProperty<QQuickItem> QQuickPane::contentChildren()
+{
+ Q_D(QQuickPane);
+ return QQmlListProperty<QQuickItem>(d->contentItem, Q_NULLPTR,
+ QQuickItemPrivate::children_append,
+ QQuickItemPrivate::children_count,
+ QQuickItemPrivate::children_at,
+ QQuickItemPrivate::children_clear);
+}
+
+void QQuickPane::contentItemChange(QQuickItem *newItem, QQuickItem *oldItem)
+{
+ QQuickControl::contentItemChange(newItem, oldItem);
+ if (oldItem)
+ disconnect(oldItem, &QQuickItem::childrenChanged, this, &QQuickPane::contentChildrenChanged);
+ if (newItem)
+ connect(newItem, &QQuickItem::childrenChanged, this, &QQuickPane::contentChildrenChanged);
+ emit contentChildrenChanged();
+}
+
+#ifndef QT_NO_ACCESSIBILITY
+QAccessible::Role QQuickPane::accessibleRole() const
+{
+ return QAccessible::Pane;
+}
+#endif
+
+QT_END_NAMESPACE
diff --git a/src/templates/qquickpane_p.h b/src/templates/qquickpane_p.h
new file mode 100644
index 00000000..e42e10ef
--- /dev/null
+++ b/src/templates/qquickpane_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 QQUICKPANE_P_H
+#define QQUICKPANE_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 QQuickPanePrivate;
+
+class Q_LABSTEMPLATES_EXPORT QQuickPane : public QQuickControl
+{
+ Q_OBJECT
+ Q_PROPERTY(qreal contentWidth READ contentWidth WRITE setContentWidth NOTIFY contentWidthChanged FINAL)
+ Q_PROPERTY(qreal contentHeight READ contentHeight WRITE setContentHeight NOTIFY contentHeightChanged 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 QQuickPane(QQuickItem *parent = Q_NULLPTR);
+
+ qreal contentWidth() const;
+ void setContentWidth(qreal width);
+
+ qreal contentHeight() const;
+ void setContentHeight(qreal height);
+
+ QQmlListProperty<QObject> contentData();
+ QQmlListProperty<QQuickItem> contentChildren();
+
+Q_SIGNALS:
+ void contentWidthChanged();
+ void contentHeightChanged();
+ void contentChildrenChanged();
+
+protected:
+ QQuickPane(QQuickPanePrivate &dd, QQuickItem *parent);
+
+ void contentItemChange(QQuickItem *newItem, QQuickItem *oldItem) Q_DECL_OVERRIDE;
+
+#ifndef QT_NO_ACCESSIBILITY
+ QAccessible::Role accessibleRole() const Q_DECL_OVERRIDE;
+#endif
+
+private:
+ Q_DISABLE_COPY(QQuickPane)
+ Q_DECLARE_PRIVATE(QQuickPane)
+};
+
+Q_DECLARE_TYPEINFO(QQuickPane, Q_COMPLEX_TYPE);
+
+QT_END_NAMESPACE
+
+#endif // QQUICKPANE_P_H
diff --git a/src/templates/qquickpane_p_p.h b/src/templates/qquickpane_p_p.h
new file mode 100644
index 00000000..3ff50042
--- /dev/null
+++ b/src/templates/qquickpane_p_p.h
@@ -0,0 +1,72 @@
+/****************************************************************************
+**
+** 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 QQUICKPANE_P_P_H
+#define QQUICKPANE_P_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_p.h>
+
+QT_BEGIN_NAMESPACE
+
+class QQuickPane;
+
+class Q_LABSTEMPLATES_EXPORT QQuickPanePrivate : public QQuickControlPrivate
+{
+ Q_DECLARE_PUBLIC(QQuickPane)
+
+public:
+ QQuickPanePrivate();
+
+ qreal contentWidth;
+ qreal contentHeight;
+};
+
+Q_DECLARE_TYPEINFO(QQuickPanePrivate, Q_COMPLEX_TYPE);
+
+QT_END_NAMESPACE
+
+#endif // QQUICKPANE_P_P_H
diff --git a/src/templates/templates.pri b/src/templates/templates.pri
index 3f608eb2..1ae46e85 100644
--- a/src/templates/templates.pri
+++ b/src/templates/templates.pri
@@ -26,6 +26,8 @@ HEADERS += \
$$PWD/qquickmenuitem_p.h \
$$PWD/qquickoverlay_p.h \
$$PWD/qquickpageindicator_p.h \
+ $$PWD/qquickpane_p.h \
+ $$PWD/qquickpane_p_p.h \
$$PWD/qquickpopup_p.h \
$$PWD/qquickpopup_p_p.h \
$$PWD/qquickpressandholdhelper_p.h \
@@ -70,6 +72,7 @@ SOURCES += \
$$PWD/qquickmenuitem.cpp \
$$PWD/qquickoverlay.cpp \
$$PWD/qquickpageindicator.cpp \
+ $$PWD/qquickpane.cpp \
$$PWD/qquickpopup.cpp \
$$PWD/qquickpressandholdhelper.cpp \
$$PWD/qquickprogressbar.cpp \