aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/imports/templates/qtlabstemplatesplugin.cpp2
-rw-r--r--src/templates/qquickapplicationwindow.cpp19
-rw-r--r--src/templates/qquickapplicationwindow_p.h3
-rw-r--r--src/templates/qquickoverlay.cpp150
-rw-r--r--src/templates/qquickoverlay_p.h86
-rw-r--r--src/templates/qquickpanel.cpp272
-rw-r--r--src/templates/qquickpanel_p.h121
-rw-r--r--src/templates/qquickpanel_p_p.h105
-rw-r--r--src/templates/templates.pri5
9 files changed, 763 insertions, 0 deletions
diff --git a/src/imports/templates/qtlabstemplatesplugin.cpp b/src/imports/templates/qtlabstemplatesplugin.cpp
index 5a976aca..8352714a 100644
--- a/src/imports/templates/qtlabstemplatesplugin.cpp
+++ b/src/imports/templates/qtlabstemplatesplugin.cpp
@@ -49,6 +49,7 @@
#include <QtLabsTemplates/private/qquickgroupbox_p.h>
#include <QtLabsTemplates/private/qquicklabel_p.h>
#include <QtLabsTemplates/private/qquickpageindicator_p.h>
+#include <QtLabsTemplates/private/qquickpanel_p.h>
#include <QtLabsTemplates/private/qquickprogressbar_p.h>
#include <QtLabsTemplates/private/qquickradiobutton_p.h>
#include <QtLabsTemplates/private/qquickrangeslider_p.h>
@@ -93,6 +94,7 @@ void QtLabsTemplatesPlugin::registerTypes(const char *uri)
qmlRegisterType<QQuickGroupBox>(uri, 1, 0, "GroupBox");
qmlRegisterType<QQuickLabel>(uri, 1, 0, "Label");
qmlRegisterType<QQuickPageIndicator>(uri, 1, 0, "PageIndicator");
+ qmlRegisterType<QQuickPanel>(uri, 1, 0, "Panel");
qmlRegisterType<QQuickProgressBar>(uri, 1, 0, "ProgressBar");
qmlRegisterType<QQuickRadioButton>(uri, 1, 0, "RadioButton");
qmlRegisterType<QQuickRangeSlider>(uri, 1, 0, "RangeSlider");
diff --git a/src/templates/qquickapplicationwindow.cpp b/src/templates/qquickapplicationwindow.cpp
index ae64b06b..38f9c5dd 100644
--- a/src/templates/qquickapplicationwindow.cpp
+++ b/src/templates/qquickapplicationwindow.cpp
@@ -35,6 +35,7 @@
****************************************************************************/
#include "qquickapplicationwindow_p.h"
+#include "qquickoverlay_p.h"
#include <QtQuick/private/qquickitem_p.h>
#include <QtQuick/private/qquickitemchangelistener_p.h>
@@ -69,6 +70,7 @@ public:
, contentItem(Q_NULLPTR)
, header(Q_NULLPTR)
, footer(Q_NULLPTR)
+ , overlay(Q_NULLPTR)
{ }
void relayout();
@@ -80,6 +82,7 @@ public:
QQuickItem *contentItem;
QQuickItem *header;
QQuickItem *footer;
+ QQuickOverlay *overlay;
QQuickApplicationWindow *q_ptr;
};
@@ -95,6 +98,12 @@ void QQuickApplicationWindowPrivate::relayout()
content->setWidth(q->width());
content->setHeight(q->height() - hh - fh);
+ if (overlay) {
+ overlay->setWidth(q->width());
+ overlay->setHeight(q->height());
+ overlay->stackAfter(content);
+ }
+
if (header) {
header->setY(-hh);
QQuickItemPrivate *p = QQuickItemPrivate::get(header);
@@ -224,6 +233,16 @@ QQuickItem *QQuickApplicationWindow::contentItem() const
return d->contentItem;
}
+QQuickItem *QQuickApplicationWindow::overlay() const
+{
+ QQuickApplicationWindowPrivate *d = const_cast<QQuickApplicationWindowPrivate *>(d_func());
+ if (!d->overlay) {
+ d->overlay = new QQuickOverlay(QQuickWindow::contentItem());
+ d->relayout();
+ }
+ return d->overlay;
+}
+
bool QQuickApplicationWindow::isComponentComplete() const
{
Q_D(const QQuickApplicationWindow);
diff --git a/src/templates/qquickapplicationwindow_p.h b/src/templates/qquickapplicationwindow_p.h
index e23e3ba9..95ea0806 100644
--- a/src/templates/qquickapplicationwindow_p.h
+++ b/src/templates/qquickapplicationwindow_p.h
@@ -62,6 +62,7 @@ class Q_LABSTEMPLATES_EXPORT QQuickApplicationWindow : public QQuickWindowQmlImp
Q_PROPERTY(QQmlListProperty<QObject> data READ contentData 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(QQuickItem *overlay READ overlay CONSTANT FINAL)
Q_CLASSINFO("DefaultProperty", "data")
public:
@@ -77,6 +78,8 @@ public:
QQuickItem *footer() const;
void setFooter(QQuickItem *footer);
+ QQuickItem *overlay() const;
+
Q_SIGNALS:
void headerChanged();
void footerChanged();
diff --git a/src/templates/qquickoverlay.cpp b/src/templates/qquickoverlay.cpp
new file mode 100644
index 00000000..d786f3c7
--- /dev/null
+++ b/src/templates/qquickoverlay.cpp
@@ -0,0 +1,150 @@
+/****************************************************************************
+**
+** 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 "qquickoverlay_p.h"
+#include "qquickpanel_p.h"
+#include <QtQml/qqmlinfo.h>
+#include <QtQuick/private/qquickitem_p.h>
+
+QT_BEGIN_NAMESPACE
+
+QQuickOverlay::QQuickOverlay(QQuickItem *parent)
+ : QQuickItem(parent), m_modalPanels(0)
+{
+ setAcceptedMouseButtons(Qt::AllButtons);
+ setFiltersChildMouseEvents(true);
+ setVisible(false);
+}
+
+void QQuickOverlay::itemChange(ItemChange change, const ItemChangeData &data)
+{
+ QQuickItem::itemChange(change, data);
+
+ QQuickItem *panelItem = const_cast<QQuickItem *>(data.item);
+ QQuickPanel *panel = Q_NULLPTR;
+ if (change == ItemChildAddedChange || change == ItemChildRemovedChange)
+ panel = qobject_cast<QQuickPanel *>(panelItem->parent());
+ if (!panel)
+ return;
+
+ if (change == ItemChildAddedChange) {
+ if (QQuickPanel *prevPanel = m_panels.value(panelItem)) {
+ qmlInfo(panel).nospace() << "Panel is sharing item " << panelItem << " with " << prevPanel
+ << ". This is not supported and strange things are about to happen.";
+ return;
+ }
+
+ m_panels.insert(panelItem, panel);
+ if (panel->isModal())
+ ++m_modalPanels;
+
+ connect(this, &QQuickOverlay::pressed, panel, &QQuickPanel::pressedOutside);
+ connect(this, &QQuickOverlay::released, panel, &QQuickPanel::releasedOutside);
+
+ if (!isVisible())
+ setVisible(true);
+ } else if (change == ItemChildRemovedChange) {
+ Q_ASSERT(panel == m_panels.value(panelItem));
+
+ disconnect(this, &QQuickOverlay::pressed, panel, &QQuickPanel::pressedOutside);
+ disconnect(this, &QQuickOverlay::released, panel, &QQuickPanel::releasedOutside);
+
+ if (panel->isModal())
+ --m_modalPanels;
+ m_panels.remove(panelItem);
+ if (m_panels.isEmpty())
+ setVisible(false);
+ }
+}
+
+void QQuickOverlay::keyPressEvent(QKeyEvent *event)
+{
+ event->setAccepted(m_modalPanels > 0);
+}
+
+void QQuickOverlay::keyReleaseEvent(QKeyEvent *event)
+{
+ event->setAccepted(m_modalPanels > 0);
+}
+
+void QQuickOverlay::mousePressEvent(QMouseEvent *event)
+{
+ event->setAccepted(m_modalPanels > 0);
+ emit pressed();
+}
+
+void QQuickOverlay::mouseMoveEvent(QMouseEvent *event)
+{
+ event->setAccepted(m_modalPanels > 0);
+}
+
+void QQuickOverlay::mouseReleaseEvent(QMouseEvent *event)
+{
+ event->setAccepted(m_modalPanels > 0);
+ emit released();
+}
+
+bool QQuickOverlay::childMouseEventFilter(QQuickItem *item, QEvent *event)
+{
+ if (m_modalPanels == 0)
+ return false;
+ // TODO Filter touch events
+ if (event->type() != QEvent::MouseButtonPress)
+ return false;
+ while (item->parentItem() != this)
+ item = item->parentItem();
+
+ bool modalBlocked = false;
+ const QQuickItemPrivate *priv = QQuickItemPrivate::get(this);
+ const QList<QQuickItem *> &sortedChildren = priv->paintOrderChildItems();
+ for (int i = sortedChildren.count() - 1; i >= 0; --i) {
+ QQuickItem *panelItem = sortedChildren[i];
+ if (panelItem == item)
+ break;
+
+ QQuickPanel *panel = m_panels.value(panelItem);
+ if (panel) {
+ emit panel->pressedOutside();
+
+ if (!modalBlocked && panel->isModal())
+ modalBlocked = true;
+ }
+ }
+
+ return modalBlocked;
+}
+
+QT_END_NAMESPACE
diff --git a/src/templates/qquickoverlay_p.h b/src/templates/qquickoverlay_p.h
new file mode 100644
index 00000000..c5f9b719
--- /dev/null
+++ b/src/templates/qquickoverlay_p.h
@@ -0,0 +1,86 @@
+/****************************************************************************
+**
+** 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 QQUICKOVERLAY_P_H
+#define QQUICKOVERLAY_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 <QtQuick/qquickitem.h>
+
+QT_BEGIN_NAMESPACE
+
+class QQuickPanel;
+
+class QQuickOverlay : public QQuickItem
+{
+ Q_OBJECT
+
+public:
+ explicit QQuickOverlay(QQuickItem *parent = Q_NULLPTR);
+
+Q_SIGNALS:
+ void pressed();
+ void released();
+
+protected:
+ void itemChange(ItemChange change, const ItemChangeData &data) Q_DECL_OVERRIDE;
+
+ void keyPressEvent(QKeyEvent *event) Q_DECL_OVERRIDE;
+ void keyReleaseEvent(QKeyEvent *event) Q_DECL_OVERRIDE;
+ void mousePressEvent(QMouseEvent *event) Q_DECL_OVERRIDE;
+ void mouseMoveEvent(QMouseEvent *event) Q_DECL_OVERRIDE;
+ void mouseReleaseEvent(QMouseEvent *event) Q_DECL_OVERRIDE;
+ bool childMouseEventFilter(QQuickItem *item, QEvent *event) Q_DECL_OVERRIDE;
+
+private:
+ Q_DISABLE_COPY(QQuickOverlay)
+ QHash<QQuickItem *, QQuickPanel *> m_panels;
+ int m_modalPanels;
+};
+
+QT_END_NAMESPACE
+
+#endif // QQUICKOVERLAY_P_H
diff --git a/src/templates/qquickpanel.cpp b/src/templates/qquickpanel.cpp
new file mode 100644
index 00000000..4f852ee3
--- /dev/null
+++ b/src/templates/qquickpanel.cpp
@@ -0,0 +1,272 @@
+/****************************************************************************
+**
+** 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 "qquickpanel_p.h"
+#include "qquickpanel_p_p.h"
+#include "qquickapplicationwindow_p.h"
+#include "qquickoverlay_p.h"
+#include <QtQml/qqmlinfo.h>
+#include <QtQuick/qquickitem.h>
+#include <QtQuick/private/qquicktransition_p.h>
+#include <QtQuick/private/qquickitem_p.h>
+
+QT_BEGIN_NAMESPACE
+
+QQuickPanelPrivate::QQuickPanelPrivate()
+ : QObjectPrivate()
+ , contentItem(Q_NULLPTR)
+ , overlay(Q_NULLPTR)
+ , focus(false)
+ , modal(false)
+ , showTransition(Q_NULLPTR)
+ , hideTransition(Q_NULLPTR)
+ , transitionManager(this)
+{ }
+
+QQuickPanelPrivate::~QQuickPanelPrivate()
+{ }
+
+void QQuickPanelPrivate::finalizeShowTransition()
+{
+ if (focus)
+ contentItem->setFocus(true);
+}
+
+void QQuickPanelPrivate::finalizeHideTransition()
+{
+ overlay = Q_NULLPTR;
+ contentItem->setParentItem(Q_NULLPTR);
+ emit q_func()->visibleChanged();
+}
+
+QQuickPanelTransitionManager::QQuickPanelTransitionManager(QQuickPanelPrivate *priv)
+ : QQuickTransitionManager()
+ , state(Off)
+ , pp(priv)
+{ }
+
+void QQuickPanelTransitionManager::transitionShow()
+{
+ if (isRunning())
+ return;
+ QList<QQuickStateAction> actions;
+ state = Show;
+ transition(actions, pp->showTransition, pp->contentItem);
+}
+
+void QQuickPanelTransitionManager::transitionHide()
+{
+ if (isRunning())
+ return;
+ QList<QQuickStateAction> actions;
+ state = Hide;
+ transition(actions, pp->hideTransition, pp->contentItem);
+}
+
+void QQuickPanelTransitionManager::finished()
+{
+ if (state == Show)
+ pp->finalizeShowTransition();
+ else if (state == Hide)
+ pp->finalizeHideTransition();
+
+ state = Off;
+}
+
+QQuickPanel::QQuickPanel(QObject *parent)
+ : QObject(*(new QQuickPanelPrivate), parent)
+{
+}
+
+QQuickPanel::QQuickPanel(QQuickPanelPrivate &dd, QObject *parent)
+ : QObject(dd, parent)
+{
+}
+
+QQuickPanel::~QQuickPanel()
+{
+}
+
+void QQuickPanel::show()
+{
+ Q_D(QQuickPanel);
+ if (!d->contentItem) {
+ qmlInfo(this) << "no panel content to show.";
+ return;
+ }
+ if (d->overlay) {
+ // FIXME qmlInfo needs to know about QQuickWindow and/or QObject
+ static_cast<QDebug>(qmlInfo(this) << "panel already showing in window") << d->overlay->window();
+ return;
+ }
+
+ QQuickWindow *win = Q_NULLPTR;
+ QObject *p = parent();
+ while (p && !win) {
+ if (QQuickItem *item = qobject_cast<QQuickItem *>(p)) {
+ win = item->window();
+ if (!win)
+ p = item->parentItem();
+ } else {
+ win = qobject_cast<QQuickWindow *>(p);
+ if (!win)
+ p = p->parent();
+ }
+ }
+ if (!win) {
+ qmlInfo(this) << "cannot find any window to show panel.";
+ return;
+ }
+
+ if (QQuickApplicationWindow *appWin = qobject_cast<QQuickApplicationWindow*>(win)) {
+ d->overlay = static_cast<QQuickOverlay *>(appWin->overlay());
+ d->contentItem->setParentItem(d->overlay);
+ } else {
+ // FIXME Maybe try to show it somehow on that window
+ qmlInfo(this) << "is not in an ApplicationWindow.";
+ return;
+ }
+
+ emit aboutToShow();
+ d->transitionManager.transitionShow();
+ emit visibleChanged();
+}
+
+void QQuickPanel::hide()
+{
+ Q_D(QQuickPanel);
+
+ if (!d->overlay) {
+ // TODO This could mean we showed the panel item on a plain QQuickWindow
+ qmlInfo(this) << "trying to hide non-visible Panel.";
+ return;
+ }
+
+ d->contentItem->setFocus(false);
+ emit aboutToHide();
+ d->transitionManager.transitionHide();
+}
+
+void QQuickPanel::setContentItem(QQuickItem *item)
+{
+ Q_D(QQuickPanel);
+ if (d->overlay) {
+ // FIXME qmlInfo needs to know about QQuickItem and/or QObject
+ static_cast<QDebug>(qmlInfo(this) << "cannot set content item") << item << "while Panel is visible.";
+ return;
+ }
+ if (d->contentItem != item) {
+ delete d->contentItem;
+ d->contentItem = item;
+ if (item)
+ QQuickItemPrivate::get(item)->isTabFence = true;
+ emit contentItemChanged();
+ }
+}
+
+QQuickItem *QQuickPanel::contentItem() const
+{
+ Q_D(const QQuickPanel);
+ return d->contentItem;
+}
+
+bool QQuickPanel::hasFocus() const
+{
+ Q_D(const QQuickPanel);
+ return d->focus;
+}
+
+void QQuickPanel::setFocus(bool focus)
+{
+ Q_D(QQuickPanel);
+ if (d->focus == focus)
+ return;
+ d->focus = focus;
+ emit focusChanged();
+}
+
+bool QQuickPanel::isModal() const
+{
+ Q_D(const QQuickPanel);
+ return d->modal;
+}
+
+void QQuickPanel::setModal(bool modal)
+{
+ Q_D(QQuickPanel);
+ if (d->modal == modal)
+ return;
+ d->modal = modal;
+ emit modalChanged();
+}
+
+bool QQuickPanel::isVisible() const
+{
+ Q_D(const QQuickPanel);
+ return d->overlay != Q_NULLPTR /*&& !d->transitionManager.isRunning()*/;
+}
+
+QQuickTransition *QQuickPanel::showTransition() const
+{
+ return d_func()->showTransition;
+}
+
+void QQuickPanel::setShowTransition(QQuickTransition *t)
+{
+ Q_D(QQuickPanel);
+ if (d->showTransition == t)
+ return;
+ d->showTransition = t;
+ emit showTransitionChanged();
+}
+
+QQuickTransition *QQuickPanel::hideTransition() const
+{
+ return d_func()->hideTransition;
+}
+
+void QQuickPanel::setHideTransition(QQuickTransition *t)
+{
+ Q_D(QQuickPanel);
+ if (d->hideTransition == t)
+ return;
+ d->hideTransition = t;
+ emit hideTransitionChanged();
+}
+
+QT_END_NAMESPACE
+
+#include "moc_qquickpanel_p.cpp"
diff --git a/src/templates/qquickpanel_p.h b/src/templates/qquickpanel_p.h
new file mode 100644
index 00000000..6d6f4df9
--- /dev/null
+++ b/src/templates/qquickpanel_p.h
@@ -0,0 +1,121 @@
+/****************************************************************************
+**
+** 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 QQUICKPANEL_P_H
+#define QQUICKPANEL_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 <QtCore/qobject.h>
+#include <QtLabsTemplates/private/qtlabstemplatesglobal_p.h>
+
+QT_BEGIN_NAMESPACE
+
+class QQuickItem;
+class QQuickPanelPrivate;
+class QQuickTransition;
+
+class Q_LABSTEMPLATES_EXPORT QQuickPanel : public QObject
+{
+ Q_OBJECT
+ Q_PROPERTY(QQuickItem *contentItem READ contentItem WRITE setContentItem NOTIFY contentItemChanged FINAL)
+ Q_PROPERTY(bool focus READ hasFocus WRITE setFocus NOTIFY focusChanged)
+ Q_PROPERTY(bool modal READ isModal WRITE setModal NOTIFY modalChanged)
+ Q_PROPERTY(bool visible READ isVisible NOTIFY visibleChanged)
+ Q_PROPERTY(QQuickTransition *showTransition READ showTransition WRITE setShowTransition NOTIFY showTransitionChanged FINAL)
+ Q_PROPERTY(QQuickTransition *hideTransition READ showTransition WRITE setHideTransition NOTIFY hideTransitionChanged FINAL)
+
+public:
+ explicit QQuickPanel(QObject *parent = Q_NULLPTR);
+ ~QQuickPanel();
+
+ QQuickItem *contentItem() const;
+ void setContentItem(QQuickItem *item);
+
+ bool hasFocus() const;
+ void setFocus(bool focus);
+
+ bool isModal() const;
+ void setModal(bool modal);
+
+ bool isVisible() const;
+
+ QQuickTransition *showTransition() const;
+ void setShowTransition(QQuickTransition *);
+
+ QQuickTransition *hideTransition() const;
+ void setHideTransition(QQuickTransition *);
+
+Q_SIGNALS:
+ void contentItemChanged();
+ void focusChanged();
+ void modalChanged();
+ void visibleChanged();
+ void showTransitionChanged();
+ void hideTransitionChanged();
+
+ void pressedOutside();
+ void releasedOutside();
+ void clickedOutside();
+
+ void aboutToShow();
+ void aboutToHide();
+
+
+public Q_SLOTS:
+ void show();
+ void hide();
+
+protected:
+ QQuickPanel(QQuickPanelPrivate &dd, QObject *parent);
+
+private:
+ Q_DISABLE_COPY(QQuickPanel)
+ Q_DECLARE_PRIVATE(QQuickPanel)
+};
+
+QT_END_NAMESPACE
+
+#endif // QQUICKPANEL_P_H
diff --git a/src/templates/qquickpanel_p_p.h b/src/templates/qquickpanel_p_p.h
new file mode 100644
index 00000000..42c06cd9
--- /dev/null
+++ b/src/templates/qquickpanel_p_p.h
@@ -0,0 +1,105 @@
+/****************************************************************************
+**
+** 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 QQUICKPANEL_P_P_H
+#define QQUICKPANEL_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 <QtCore/private/qobject_p.h>
+#include <QtQuick/private/qquicktransitionmanager_p_p.h>
+
+QT_BEGIN_NAMESPACE
+
+class QQuickItem;
+class QQuickTransition;
+class QQuickTransitionManager;
+class QQuickPanel;
+class QQuickPanelPrivate;
+class QQuickOverlay;
+
+class QQuickPanelTransitionManager : public QQuickTransitionManager
+{
+public:
+ QQuickPanelTransitionManager(QQuickPanelPrivate *);
+ void transitionShow();
+ void transitionHide();
+
+protected:
+ void finished() Q_DECL_OVERRIDE;
+
+private:
+ enum TransitionState {
+ Off, Show, Hide
+ };
+
+ TransitionState state;
+ QQuickPanelPrivate *pp;
+};
+
+class QQuickPanelPrivate : public QObjectPrivate
+{
+ Q_DECLARE_PUBLIC(QQuickPanel)
+
+public:
+ QQuickPanelPrivate();
+ ~QQuickPanelPrivate();
+
+ void finalizeShowTransition();
+ void finalizeHideTransition();
+
+ QQuickItem *contentItem;
+ QQuickOverlay *overlay;
+ bool focus;
+ bool modal;
+ QQuickTransition *showTransition;
+ QQuickTransition *hideTransition;
+ QQuickPanelTransitionManager transitionManager;
+};
+
+QT_END_NAMESPACE
+
+#endif // QQUICKPANEL_P_P_H
+
diff --git a/src/templates/templates.pri b/src/templates/templates.pri
index 1c470b3a..34344e03 100644
--- a/src/templates/templates.pri
+++ b/src/templates/templates.pri
@@ -19,7 +19,10 @@ HEADERS += \
$$PWD/qquickgroupbox_p.h \
$$PWD/qquicklabel_p.h \
$$PWD/qquicklabel_p_p.h \
+ $$PWD/qquickoverlay_p.h \
$$PWD/qquickpageindicator_p.h \
+ $$PWD/qquickpanel_p.h \
+ $$PWD/qquickpanel_p_p.h \
$$PWD/qquickpressandholdhelper_p.h \
$$PWD/qquickprogressbar_p.h \
$$PWD/qquickradiobutton_p.h \
@@ -56,7 +59,9 @@ SOURCES += \
$$PWD/qquickframe.cpp \
$$PWD/qquickgroupbox.cpp \
$$PWD/qquicklabel.cpp \
+ $$PWD/qquickoverlay.cpp \
$$PWD/qquickpageindicator.cpp \
+ $$PWD/qquickpanel.cpp \
$$PWD/qquickpressandholdhelper.cpp \
$$PWD/qquickprogressbar.cpp \
$$PWD/qquickradiobutton.cpp \