From bf17e30c8e98b311cdee397f1272e70863247ebc Mon Sep 17 00:00:00 2001 From: Shawn Rutledge Date: Tue, 22 Mar 2016 13:28:33 +0100 Subject: QApplication: remove unused static qt_tabletChokeMouse It was only set, never tested, not exported, and the name is awful. Change-Id: Ie6a783341984a11139b1481e94af09cb7d1bb9b8 Reviewed-by: Marc Mutz --- src/widgets/kernel/qapplication.cpp | 3 --- 1 file changed, 3 deletions(-) (limited to 'src/widgets/kernel') diff --git a/src/widgets/kernel/qapplication.cpp b/src/widgets/kernel/qapplication.cpp index 2e68c7888f..141f15637c 100644 --- a/src/widgets/kernel/qapplication.cpp +++ b/src/widgets/kernel/qapplication.cpp @@ -436,8 +436,6 @@ Qt::NavigationMode QApplicationPrivate::navigationMode = Qt::NavigationModeKeypa QWidget *QApplicationPrivate::oldEditFocus = 0; #endif -bool qt_tabletChokeMouse = false; - inline bool QApplicationPrivate::isAlien(QWidget *widget) { return widget && !widget->isWindow(); @@ -3459,7 +3457,6 @@ bool QApplication::notify(QObject *receiver, QEvent *e) w = w->parentWidget(); } tablet->setAccepted(eventAccepted); - qt_tabletChokeMouse = tablet->isAccepted(); } break; #endif // QT_NO_TABLETEVENT -- cgit v1.2.3 From 663263c124339db432cd5596b87462343096dd83 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Mon, 21 Mar 2016 14:17:18 +0100 Subject: QWidget::create(): Mark parameter window as ignored. Remove parameter from QWidgetPrivate::createWinId(), add a warning and fixme comments. Update the documentation to point the users to QWindow::fromWinId() and QWidget::createWindowContainer(). Task-number: QTBUG-33079 Task-number: QTBUG-51853 Change-Id: I03ae922b31bb46a411889cc0260ea14a4d933492 Reviewed-by: Marc Mutz --- src/widgets/kernel/qwidget.cpp | 30 ++++++++++++++---------------- src/widgets/kernel/qwidget_p.h | 2 +- 2 files changed, 15 insertions(+), 17 deletions(-) (limited to 'src/widgets/kernel') diff --git a/src/widgets/kernel/qwidget.cpp b/src/widgets/kernel/qwidget.cpp index 6fdd5d3d0e..c57ca41815 100644 --- a/src/widgets/kernel/qwidget.cpp +++ b/src/widgets/kernel/qwidget.cpp @@ -1243,11 +1243,14 @@ void QWidgetPrivate::createRecursively() } - +// ### fixme: Qt 6: Remove parameter window from QWidget::create() /*! - Creates a new widget window if \a window is 0, otherwise sets the - widget's window to \a window. + Creates a new widget window. + + The parameter \a window is ignored in Qt 5. Please use + QWindow::fromWinId() to create a QWindow wrapping a foreign + window and pass it to QWidget::createWindowContainer() instead. Initializes the window (sets the geometry etc.) if \a initializeWindow is true. If \a initializeWindow is false, no @@ -1260,11 +1263,15 @@ void QWidgetPrivate::createRecursively() The QWidget constructor calls create(0,true,true) to create a window for this widget. + + \sa createWindowContainer(), QWindow::fromWinId() */ void QWidget::create(WId window, bool initializeWindow, bool destroyOldWindow) { Q_D(QWidget); + if (Q_UNLIKELY(window)) + qWarning("QWidget::create(): Parameter 'window' does not have any effect."); if (testAttribute(Qt::WA_WState_Created) && window == 0 && internalWinId()) return; @@ -1288,7 +1295,7 @@ void QWidget::create(WId window, bool initializeWindow, bool destroyOldWindow) // We're about to create a native child widget that doesn't have a native parent; // enforce a native handle for the parent unless the Qt::WA_DontCreateNativeAncestors // attribute is set. - d->createWinId(window); + d->createWinId(); // Nothing more to do. Q_ASSERT(testAttribute(Qt::WA_WState_Created)); Q_ASSERT(internalWinId()); @@ -2520,13 +2527,12 @@ WId QWidget::winId() const return data->winid; } - -void QWidgetPrivate::createWinId(WId winid) +void QWidgetPrivate::createWinId() { Q_Q(QWidget); #ifdef ALIEN_DEBUG - qDebug() << "QWidgetPrivate::createWinId for" << q << winid; + qDebug() << "QWidgetPrivate::createWinId for" << q; #endif const bool forceNativeWindow = q->testAttribute(Qt::WA_NativeWindow); if (!q->testAttribute(Qt::WA_WState_Created) || (forceNativeWindow && !q->internalWinId())) { @@ -2543,15 +2549,7 @@ void QWidgetPrivate::createWinId(WId winid) QWidget *w = qobject_cast(pd->children.at(i)); if (w && !w->isWindow() && (!w->testAttribute(Qt::WA_WState_Created) || (!w->internalWinId() && w->testAttribute(Qt::WA_NativeWindow)))) { - if (w!=q) { - w->create(); - } else { - w->create(winid); - // if the window has already been created, we - // need to raise it to its proper stacking position - if (winid) - w->raise(); - } + w->create(); } } } else { diff --git a/src/widgets/kernel/qwidget_p.h b/src/widgets/kernel/qwidget_p.h index a5c7aa5815..9d4bdc7f89 100644 --- a/src/widgets/kernel/qwidget_p.h +++ b/src/widgets/kernel/qwidget_p.h @@ -333,7 +333,7 @@ public: void init(QWidget *desktopWidget, Qt::WindowFlags f); void create_sys(WId window, bool initializeWindow, bool destroyOldWindow); void createRecursively(); - void createWinId(WId id = 0); + void createWinId(); void createTLExtra(); void createExtra(); -- cgit v1.2.3 From 536da5eb6ab1b4b07c13ad9f4c0f69dba5ca1624 Mon Sep 17 00:00:00 2001 From: hjk Date: Fri, 18 Mar 2016 13:20:43 +0100 Subject: Use default nullptr parents in QAction constructors In user code it is not uncommon to have QActions as proper members in structures. Being forced to pass a null parent in their constructors is uncomfortable. Change-Id: I10d0b0b39d7f8c2b158af1136367b44f1150d4df Reviewed-by: Marc Mutz --- src/widgets/kernel/qaction.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/widgets/kernel') diff --git a/src/widgets/kernel/qaction.h b/src/widgets/kernel/qaction.h index abfa2cdd42..bd491c89ca 100644 --- a/src/widgets/kernel/qaction.h +++ b/src/widgets/kernel/qaction.h @@ -90,9 +90,9 @@ public: NormalPriority = 128, HighPriority = 256}; Q_ENUM(Priority) - explicit QAction(QObject* parent); - QAction(const QString &text, QObject* parent); - QAction(const QIcon &icon, const QString &text, QObject* parent); + explicit QAction(QObject *parent = nullptr); + explicit QAction(const QString &text, QObject *parent = nullptr); + explicit QAction(const QIcon &icon, const QString &text, QObject *parent = nullptr); ~QAction(); -- cgit v1.2.3 From 6cacd19db56b632964c3b2453bc273dac50446c9 Mon Sep 17 00:00:00 2001 From: Alexander Volkov Date: Mon, 22 Feb 2016 12:47:19 +0300 Subject: Don't propagate unsolicited events from QWidgetWindow to QWidget Show and Hide events were not propagated before this change. Add Timer, DynamicPropertyChange, ChildAdded, and ChildRemoved, because they are supposed to be delivered to one QObject. Also don't propagate these events if WA_DontShowOnScreen is set. Change-Id: I134bf3909d46141e4d3e39f41983f493a4f35478 Reviewed-by: Olivier Goffart (Woboq GmbH) --- src/widgets/kernel/qwidgetwindow.cpp | 24 +++++++++++++++++++----- 1 file changed, 19 insertions(+), 5 deletions(-) (limited to 'src/widgets/kernel') diff --git a/src/widgets/kernel/qwidgetwindow.cpp b/src/widgets/kernel/qwidgetwindow.cpp index 01832a4f2b..b638c6c377 100644 --- a/src/widgets/kernel/qwidgetwindow.cpp +++ b/src/widgets/kernel/qwidgetwindow.cpp @@ -156,11 +156,29 @@ QObject *QWidgetWindow::focusObject() const return widget; } +static inline bool shouldBePropagatedToWidget(QEvent *event) +{ + switch (event->type()) { + // Handing show events to widgets would cause them to be triggered twice + case QEvent::Show: + case QEvent::Hide: + case QEvent::Timer: + case QEvent::DynamicPropertyChange: + case QEvent::ChildAdded: + case QEvent::ChildRemoved: + return false; + default: + return true; + } +} + bool QWidgetWindow::event(QEvent *event) { if (m_widget->testAttribute(Qt::WA_DontShowOnScreen)) { // \a event is uninteresting for QWidgetWindow, the event was probably // generated before WA_DontShowOnScreen was set + if (!shouldBePropagatedToWidget(event)) + return true; return QCoreApplication::sendEvent(m_widget, event); } @@ -285,10 +303,6 @@ bool QWidgetWindow::event(QEvent *event) return true; #endif - // Handing show events to widgets (see below) here would cause them to be triggered twice - case QEvent::Show: - case QEvent::Hide: - return QWindow::event(event); case QEvent::WindowBlocked: qt_button_down = 0; break; @@ -303,7 +317,7 @@ bool QWidgetWindow::event(QEvent *event) break; } - if (QCoreApplication::sendEvent(m_widget, event) && event->type() != QEvent::Timer) + if (shouldBePropagatedToWidget(event) && QCoreApplication::sendEvent(m_widget, event)) return true; return QWindow::event(event); -- cgit v1.2.3 From cd46a2daf57dea2e0b661d72f6eb2171079797ba Mon Sep 17 00:00:00 2001 From: Jani Heikkinen Date: Fri, 22 Jan 2016 14:24:00 +0200 Subject: Unify license header usage. Update files using old header.LGPL3 to header.LGPL Update files using old FDL template to use new one Update files using old BSD template to use new one Change-Id: I36a78272516f9953d02956522f285b40adfc8915 Reviewed-by: Lars Knoll --- src/widgets/kernel/qdesktopwidget.qdoc | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'src/widgets/kernel') diff --git a/src/widgets/kernel/qdesktopwidget.qdoc b/src/widgets/kernel/qdesktopwidget.qdoc index abdbd35f5b..c23e942eec 100644 --- a/src/widgets/kernel/qdesktopwidget.qdoc +++ b/src/widgets/kernel/qdesktopwidget.qdoc @@ -1,7 +1,7 @@ /**************************************************************************** ** -** 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 documentation of the Qt Toolkit. ** @@ -11,8 +11,8 @@ ** 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 Free Documentation License Usage ** Alternatively, this file may be used under the terms of the GNU Free @@ -20,7 +20,7 @@ ** 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. +** will be met: https://www.gnu.org/licenses/fdl-1.3.html. ** $QT_END_LICENSE$ ** ****************************************************************************/ -- cgit v1.2.3