summaryrefslogtreecommitdiff
path: root/src/controls/Private/qquickcontrolsprivate.cpp
diff options
context:
space:
mode:
authorTor Arne Vestbø <tor.arne.vestbo@digia.com>2015-03-25 14:42:18 +0100
committerTor Arne Vestbø <tor.arne.vestbo@theqtcompany.com>2015-03-25 14:16:46 +0000
commit7fd1a0709bc0e7737a6f48433ab04129e43a1b57 (patch)
tree59167dfac7bd3d808171fd5b5b4da2ed208e2d7f /src/controls/Private/qquickcontrolsprivate.cpp
parent3ac0be60ce9ed9985e40066ba1c8612125582d35 (diff)
downloadqtquickcontrols-7fd1a0709bc0e7737a6f48433ab04129e43a1b57.tar.gz
Add private attached property to access QQuickWindow from any item
Should really be in QQuickWindowAttached, but until the naming is settled we expose it privately in Controls. Change-Id: Id239197303bcb2e1ff1a108c78e5610bb193f0a3 Reviewed-by: J-P Nurmi <jpnurmi@theqtcompany.com>
Diffstat (limited to 'src/controls/Private/qquickcontrolsprivate.cpp')
-rw-r--r--src/controls/Private/qquickcontrolsprivate.cpp75
1 files changed, 75 insertions, 0 deletions
diff --git a/src/controls/Private/qquickcontrolsprivate.cpp b/src/controls/Private/qquickcontrolsprivate.cpp
new file mode 100644
index 00000000..61282668
--- /dev/null
+++ b/src/controls/Private/qquickcontrolsprivate.cpp
@@ -0,0 +1,75 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Quick 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$
+**
+****************************************************************************/
+
+#include "qquickcontrolsprivate_p.h"
+#include <qquickitem.h>
+#include <qquickwindow.h>
+
+QT_BEGIN_NAMESPACE
+
+QQuickControlsPrivateAttached::QQuickControlsPrivateAttached(QObject *attachee)
+ : m_attachee(qobject_cast<QQuickItem*>(attachee))
+{
+ if (m_attachee)
+ connect(m_attachee, &QQuickItem::windowChanged, this, &QQuickControlsPrivateAttached::windowChanged);
+}
+
+QQuickWindow *QQuickControlsPrivateAttached::window() const
+{
+ return m_attachee ? m_attachee->window() : 0;
+}
+
+QObject *QQuickControlsPrivate::registerTooltipModule(QQmlEngine *engine, QJSEngine *jsEngine)
+{
+ Q_UNUSED(engine);
+ Q_UNUSED(jsEngine);
+ return new QQuickTooltip();
+}
+
+QObject *QQuickControlsPrivate::registerSettingsModule(QQmlEngine *engine, QJSEngine *jsEngine)
+{
+ Q_UNUSED(jsEngine);
+ return new QQuickControlSettings(engine);
+}
+
+QQuickControlsPrivateAttached *QQuickControlsPrivate::qmlAttachedProperties(QObject *object)
+{
+ return new QQuickControlsPrivateAttached(object);
+}
+
+QT_END_NAMESPACE
+
+