diff options
Diffstat (limited to 'src/controls/qquickpopupwindow.cpp')
-rw-r--r-- | src/controls/qquickpopupwindow.cpp | 63 |
1 files changed, 33 insertions, 30 deletions
diff --git a/src/controls/qquickpopupwindow.cpp b/src/controls/qquickpopupwindow.cpp index ac961709..9a6519ed 100644 --- a/src/controls/qquickpopupwindow.cpp +++ b/src/controls/qquickpopupwindow.cpp @@ -1,34 +1,37 @@ /**************************************************************************** ** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ +** Copyright (C) 2016 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ ** ** This file is part of the Qt Quick Controls module of the Qt Toolkit. ** -** $QT_BEGIN_LICENSE:LGPL3$ +** $QT_BEGIN_LICENSE:LGPL$ ** 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. +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://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 +** Foundation and appearing in the file LICENSE.LGPL3 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. +** will be met: https://www.gnu.org/licenses/lgpl-3.0.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. +** General Public License version 2.0 or (at your option) the GNU General +** Public license version 3 or any later version approved by the KDE Free +** Qt Foundation. The licenses are as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-2.0.html and +** https://www.gnu.org/licenses/gpl-3.0.html. ** ** $QT_END_LICENSE$ ** @@ -43,7 +46,7 @@ QT_BEGIN_NAMESPACE -QQuickPopupWindow::QQuickPopupWindow() : +QQuickPopupWindow1::QQuickPopupWindow1() : QQuickWindow(), m_parentItem(0), m_contentItem(0), m_mouseMoved(false), m_needsActivatedEvent(true), m_dismissed(false), m_pressed(false) @@ -53,13 +56,13 @@ QQuickPopupWindow::QQuickPopupWindow() : this, SLOT(applicationStateChanged(Qt::ApplicationState))); } -void QQuickPopupWindow::applicationStateChanged(Qt::ApplicationState state) +void QQuickPopupWindow1::applicationStateChanged(Qt::ApplicationState state) { if (state != Qt::ApplicationActive) dismissPopup(); } -void QQuickPopupWindow::show() +void QQuickPopupWindow1::show() { qreal posx = x(); qreal posy = y(); @@ -96,7 +99,7 @@ void QQuickPopupWindow::show() } emit geometryChanged(); - if (!qobject_cast<QQuickPopupWindow *>(transientParent())) { // No need for parent menu windows + if (!qobject_cast<QQuickPopupWindow1 *>(transientParent())) { // No need for parent menu windows if (QQuickWindow *w = qobject_cast<QQuickWindow *>(transientParent())) { if (QQuickItem *mg = w->mouseGrabberItem()) mg->ungrabMouse(); @@ -110,14 +113,14 @@ void QQuickPopupWindow::show() setKeyboardGrabEnabled(true); } -void QQuickPopupWindow::setParentItem(QQuickItem *item) +void QQuickPopupWindow1::setParentItem(QQuickItem *item) { m_parentItem = item; if (m_parentItem) setTransientParent(m_parentItem->window()); } -void QQuickPopupWindow::setPopupContentItem(QQuickItem *contentItem) +void QQuickPopupWindow1::setPopupContentItem(QQuickItem *contentItem) { if (!contentItem) return; @@ -128,20 +131,20 @@ void QQuickPopupWindow::setPopupContentItem(QQuickItem *contentItem) m_contentItem = contentItem; } -void QQuickPopupWindow::updateSize() +void QQuickPopupWindow1::updateSize() { setGeometry(x(), y(), popupContentItem()->width(), popupContentItem()->height()); emit geometryChanged(); } -void QQuickPopupWindow::dismissPopup() +void QQuickPopupWindow1::dismissPopup() { m_dismissed = true; emit popupDismissed(); hide(); } -void QQuickPopupWindow::mouseMoveEvent(QMouseEvent *e) +void QQuickPopupWindow1::mouseMoveEvent(QMouseEvent *e) { QRect rect = QRect(QPoint(), size()); m_mouseMoved = true; @@ -154,7 +157,7 @@ void QQuickPopupWindow::mouseMoveEvent(QMouseEvent *e) forwardEventToTransientParent(e); } -void QQuickPopupWindow::mousePressEvent(QMouseEvent *e) +void QQuickPopupWindow1::mousePressEvent(QMouseEvent *e) { m_pressed = true; QRect rect = QRect(QPoint(), size()); @@ -165,7 +168,7 @@ void QQuickPopupWindow::mousePressEvent(QMouseEvent *e) forwardEventToTransientParent(e); } -void QQuickPopupWindow::mouseReleaseEvent(QMouseEvent *e) +void QQuickPopupWindow1::mouseReleaseEvent(QMouseEvent *e) { QRect rect = QRect(QPoint(), size()); if (rect.contains(e->pos())) { @@ -183,11 +186,11 @@ void QQuickPopupWindow::mouseReleaseEvent(QMouseEvent *e) m_pressed = false; } -void QQuickPopupWindow::forwardEventToTransientParent(QMouseEvent *e) +void QQuickPopupWindow1::forwardEventToTransientParent(QMouseEvent *e) { bool forwardEvent = true; - if (!qobject_cast<QQuickPopupWindow*>(transientParent()) + if (!qobject_cast<QQuickPopupWindow1*>(transientParent()) && ((m_mouseMoved && e->type() == QEvent::MouseButtonRelease) || e->type() == QEvent::MouseButtonPress)) { // Clicked outside any popup @@ -202,12 +205,12 @@ void QQuickPopupWindow::forwardEventToTransientParent(QMouseEvent *e) } } -bool QQuickPopupWindow::shouldForwardEventAfterDismiss(QMouseEvent*) const +bool QQuickPopupWindow1::shouldForwardEventAfterDismiss(QMouseEvent*) const { return false; } -void QQuickPopupWindow::exposeEvent(QExposeEvent *e) +void QQuickPopupWindow1::exposeEvent(QExposeEvent *e) { if (isExposed() && m_needsActivatedEvent) { m_needsActivatedEvent = false; @@ -220,7 +223,7 @@ void QQuickPopupWindow::exposeEvent(QExposeEvent *e) QQuickWindow::exposeEvent(e); } -void QQuickPopupWindow::hideEvent(QHideEvent *e) +void QQuickPopupWindow1::hideEvent(QHideEvent *e) { if (QWindow *tp = !m_needsActivatedEvent ? transientParent() : 0) { m_needsActivatedEvent = true; @@ -232,14 +235,14 @@ void QQuickPopupWindow::hideEvent(QHideEvent *e) } /*! \reimp */ -bool QQuickPopupWindow::event(QEvent *event) +bool QQuickPopupWindow1::event(QEvent *event) { //QTBUG-45079 //This is a workaround for popup menu not being closed when using touch input. //Currently mouse synthesized events are not created for touch events which are //outside the qquickwindow. - if (event->type() == QEvent::TouchBegin && !qobject_cast<QQuickPopupWindow*>(transientParent())) { + if (event->type() == QEvent::TouchBegin && !qobject_cast<QQuickPopupWindow1*>(transientParent())) { QRect rect = QRect(QPoint(), size()); QTouchEvent *touch = static_cast<QTouchEvent*>(event); QTouchEvent::TouchPoint point = touch->touchPoints().first(); |