diff options
Diffstat (limited to 'src/widgets/kernel')
64 files changed, 1064 insertions, 939 deletions
diff --git a/src/widgets/kernel/qaction.cpp b/src/widgets/kernel/qaction.cpp index b6cf7779a4..9fbcf28aad 100644 --- a/src/widgets/kernel/qaction.cpp +++ b/src/widgets/kernel/qaction.cpp @@ -1,7 +1,7 @@ /**************************************************************************** ** -** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ ** ** This file is part of the QtWidgets module of the Qt Toolkit. ** @@ -10,9 +10,9 @@ ** 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 Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. +** 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 @@ -23,8 +23,8 @@ ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ** $QT_END_LICENSE$ diff --git a/src/widgets/kernel/qaction.h b/src/widgets/kernel/qaction.h index 15364b4785..1d69694699 100644 --- a/src/widgets/kernel/qaction.h +++ b/src/widgets/kernel/qaction.h @@ -1,7 +1,7 @@ /**************************************************************************** ** -** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ ** ** This file is part of the QtWidgets module of the Qt Toolkit. ** @@ -10,9 +10,9 @@ ** 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 Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. +** 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 @@ -23,8 +23,8 @@ ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ** $QT_END_LICENSE$ @@ -55,8 +55,6 @@ class Q_WIDGETS_EXPORT QAction : public QObject Q_OBJECT Q_DECLARE_PRIVATE(QAction) - Q_ENUMS(MenuRole) - Q_ENUMS(Priority) Q_PROPERTY(bool checkable READ isCheckable WRITE setCheckable NOTIFY changed) Q_PROPERTY(bool checked READ isChecked WRITE setChecked DESIGNABLE isCheckable NOTIFY toggled) Q_PROPERTY(bool enabled READ isEnabled WRITE setEnabled NOTIFY changed) @@ -81,9 +79,11 @@ public: // note this is copied into qplatformmenu.h, which must stay in sync enum MenuRole { NoRole = 0, TextHeuristicRole, ApplicationSpecificRole, AboutQtRole, AboutRole, PreferencesRole, QuitRole }; + Q_ENUM(MenuRole) enum Priority { LowPriority = 0, 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); @@ -170,7 +170,7 @@ public: #endif protected: - bool event(QEvent *); + bool event(QEvent *) Q_DECL_OVERRIDE; QAction(QActionPrivate &dd, QObject *parent); public Q_SLOTS: diff --git a/src/widgets/kernel/qaction_p.h b/src/widgets/kernel/qaction_p.h index a33f663a6f..3312056aaa 100644 --- a/src/widgets/kernel/qaction_p.h +++ b/src/widgets/kernel/qaction_p.h @@ -1,7 +1,7 @@ /**************************************************************************** ** -** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ ** ** This file is part of the QtWidgets module of the Qt Toolkit. ** @@ -10,9 +10,9 @@ ** 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 Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. +** 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 @@ -23,8 +23,8 @@ ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ** $QT_END_LICENSE$ diff --git a/src/widgets/kernel/qactiongroup.cpp b/src/widgets/kernel/qactiongroup.cpp index 052dbe2aa0..680fc994a6 100644 --- a/src/widgets/kernel/qactiongroup.cpp +++ b/src/widgets/kernel/qactiongroup.cpp @@ -1,7 +1,7 @@ /**************************************************************************** ** -** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ ** ** This file is part of the QtWidgets module of the Qt Toolkit. ** @@ -10,9 +10,9 @@ ** 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 Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. +** 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 @@ -23,8 +23,8 @@ ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ** $QT_END_LICENSE$ diff --git a/src/widgets/kernel/qactiongroup.h b/src/widgets/kernel/qactiongroup.h index b402f50164..982bc09ef7 100644 --- a/src/widgets/kernel/qactiongroup.h +++ b/src/widgets/kernel/qactiongroup.h @@ -1,7 +1,7 @@ /**************************************************************************** ** -** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ ** ** This file is part of the QtWidgets module of the Qt Toolkit. ** @@ -10,9 +10,9 @@ ** 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 Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. +** 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 @@ -23,8 +23,8 @@ ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ** $QT_END_LICENSE$ diff --git a/src/widgets/kernel/qapplication.cpp b/src/widgets/kernel/qapplication.cpp index abd0231b00..78c842f7e1 100644 --- a/src/widgets/kernel/qapplication.cpp +++ b/src/widgets/kernel/qapplication.cpp @@ -1,7 +1,7 @@ /**************************************************************************** ** -** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ ** ** This file is part of the QtWidgets module of the Qt Toolkit. ** @@ -10,9 +10,9 @@ ** 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 Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. +** 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 @@ -23,8 +23,8 @@ ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ** $QT_END_LICENSE$ @@ -64,6 +64,7 @@ #include <QtWidgets/qgraphicsproxywidget.h> #include <QtGui/qstylehints.h> #include <QtGui/qinputmethod.h> +#include <QtGui/private/qwindow_p.h> #include <qpa/qplatformtheme.h> #ifndef QT_NO_WHATSTHIS #include <QtWidgets/QWhatsThis> @@ -116,6 +117,14 @@ static void initResources() QT_BEGIN_NAMESPACE +// Helper macro for static functions to check on the existence of the application class. +#define CHECK_QAPP_INSTANCE(...) \ + if (Q_LIKELY(QCoreApplication::instance())) { \ + } else { \ + qWarning("Must construct a QApplication first."); \ + return __VA_ARGS__; \ + } + Q_CORE_EXPORT void qt_call_post_routines(); QApplicationPrivate *QApplicationPrivate::self = 0; @@ -431,9 +440,7 @@ inline bool QApplicationPrivate::isAlien(QWidget *widget) bool Q_WIDGETS_EXPORT qt_tab_all_widgets() { - if (const QPlatformTheme *theme = QGuiApplicationPrivate::platformTheme()) - return theme->themeHint(QPlatformTheme::TabAllWidgets).toBool(); - return true; + return QGuiApplication::styleHints()->tabFocusBehavior() == Qt::TabFocusAllControls; } // ######## move to QApplicationPrivate @@ -629,6 +636,9 @@ void QApplicationPrivate::initialize() // needed for a static build. qRegisterWidgetsVariant(); + // needed for widgets in QML + QAbstractDeclarativeData::setWidgetParent = QWidgetPrivate::setWidgetParentHelper; + if (application_type != QApplicationPrivate::Tty) (void) QApplication::style(); // trigger creation of application style #ifndef QT_NO_STATEMACHINE @@ -636,7 +646,7 @@ void QApplicationPrivate::initialize() qRegisterGuiStateMachine(); #endif - if (qgetenv("QT_USE_NATIVE_WINDOWS").toInt() > 0) + if (qEnvironmentVariableIntValue("QT_USE_NATIVE_WINDOWS") > 0) QCoreApplication::setAttribute(Qt::AA_NativeWindows); #ifdef Q_OS_WINCE @@ -658,8 +668,12 @@ void QApplicationPrivate::initialize() initializeMultitouch(); if (QApplication::desktopSettingsAware()) - if (const QPlatformTheme *theme = QGuiApplicationPrivate::platformTheme()) + if (const QPlatformTheme *theme = QGuiApplicationPrivate::platformTheme()) { QApplicationPrivate::enabledAnimations = theme->themeHint(QPlatformTheme::UiEffects).toInt(); +#ifndef QT_NO_WHEELEVENT + QApplicationPrivate::wheel_scroll_lines = theme->themeHint(QPlatformTheme::WheelScrollLines).toInt(); +#endif + } is_app_running = true; // no longer starting up } @@ -821,7 +835,7 @@ QApplication::~QApplication() if (QWidgetPrivate::allWidgets) { QWidgetSet *mySet = QWidgetPrivate::allWidgets; QWidgetPrivate::allWidgets = 0; - for (QWidgetSet::ConstIterator it = mySet->constBegin(); it != mySet->constEnd(); ++it) { + for (QWidgetSet::ConstIterator it = mySet->constBegin(), cend = mySet->constEnd(); it != cend; ++it) { QWidget *w = *it; if (!w->parent()) // window w->destroy(true, true); @@ -1184,7 +1198,7 @@ void QApplication::setStyle(QStyle *style) // clean up the old style if (QApplicationPrivate::app_style) { if (QApplicationPrivate::is_app_running && !QApplicationPrivate::is_app_closing) { - for (QWidgetList::ConstIterator it = all.constBegin(); it != all.constEnd(); ++it) { + for (QWidgetList::ConstIterator it = all.constBegin(), cend = all.constEnd(); it != cend; ++it) { QWidget *w = *it; if (!(w->windowType() == Qt::Desktop) && // except desktop w->testAttribute(Qt::WA_WState_Polished)) { // has been polished @@ -1232,8 +1246,8 @@ void QApplication::setStyle(QStyle *style) // re-polish existing widgets if necessary if (QApplicationPrivate::is_app_running && !QApplicationPrivate::is_app_closing) { - for (QWidgetList::ConstIterator it1 = all.constBegin(); it1 != all.constEnd(); ++it1) { - QWidget *w = *it1; + for (QWidgetList::ConstIterator it = all.constBegin(), cend = all.constEnd(); it != cend; ++it) { + QWidget *w = *it; if (w->windowType() != Qt::Desktop && w->testAttribute(Qt::WA_WState_Polished)) { if (w->style() == QApplicationPrivate::app_style) QApplicationPrivate::app_style->polish(w); // repolish @@ -1244,8 +1258,8 @@ void QApplication::setStyle(QStyle *style) } } - for (QWidgetList::ConstIterator it2 = all.constBegin(); it2 != all.constEnd(); ++it2) { - QWidget *w = *it2; + for (QWidgetList::ConstIterator it = all.constBegin(), cend = all.constEnd(); it != cend; ++it) { + QWidget *w = *it; if (w->windowType() != Qt::Desktop && !w->testAttribute(Qt::WA_SetStyle)) { QEvent e(QEvent::StyleChange); QApplication::sendEvent(w, &e); @@ -1410,12 +1424,15 @@ void QApplication::setGlobalStrut(const QSize& strut) */ QPalette QApplication::palette(const QWidget* w) { + typedef PaletteHash::const_iterator PaletteHashConstIt; + PaletteHash *hash = app_palettes(); if (w && hash && hash->size()) { - QHash<QByteArray, QPalette>::ConstIterator it = hash->constFind(w->metaObject()->className()); - if (it != hash->constEnd()) + PaletteHashConstIt it = hash->constFind(w->metaObject()->className()); + const PaletteHashConstIt cend = hash->constEnd(); + if (it != cend) return *it; - for (it = hash->constBegin(); it != hash->constEnd(); ++it) { + for (it = hash->constBegin(); it != cend; ++it) { if (w->inherits(it.key())) return it.value(); } @@ -1474,7 +1491,7 @@ void QApplicationPrivate::setPalette_helper(const QPalette &palette, const char* QApplication::sendEvent(QApplication::instance(), &e); QWidgetList wids = QApplication::allWidgets(); - for (QWidgetList::ConstIterator it = wids.constBegin(); it != wids.constEnd(); ++it) { + for (QWidgetList::ConstIterator it = wids.constBegin(), cend = wids.constEnd(); it != cend; ++it) { QWidget *w = *it; if (all || (!className && w->isWindow()) || w->inherits(className)) // matching class QApplication::sendEvent(w, &e); @@ -1576,6 +1593,8 @@ QFont QApplication::font() QFont QApplication::font(const QWidget *widget) { + typedef FontHash::const_iterator FontHashConstIt; + FontHash *hash = app_fonts(); if (widget && hash && hash->size()) { @@ -1587,11 +1606,11 @@ QFont QApplication::font(const QWidget *widget) return hash->value(QByteArrayLiteral("QMiniFont")); } #endif - QHash<QByteArray, QFont>::ConstIterator it = - hash->constFind(widget->metaObject()->className()); - if (it != hash->constEnd()) + FontHashConstIt it = hash->constFind(widget->metaObject()->className()); + const FontHashConstIt cend = hash->constEnd(); + if (it != cend) return it.value(); - for (it = hash->constBegin(); it != hash->constEnd(); ++it) { + for (it = hash->constBegin(); it != cend; ++it) { if (widget->inherits(it.key())) return it.value(); } @@ -1656,7 +1675,7 @@ void QApplication::setFont(const QFont &font, const char *className) QApplication::sendEvent(QApplication::instance(), &e); QWidgetList wids = QApplication::allWidgets(); - for (QWidgetList::ConstIterator it = wids.constBegin(); it != wids.constEnd(); ++it) { + for (QWidgetList::ConstIterator it = wids.constBegin(), cend = wids.constEnd(); it != cend; ++it) { QWidget *w = *it; if (all || (!className && w->isWindow()) || w->inherits(className)) // matching class sendEvent(w, &e); @@ -1761,7 +1780,7 @@ QWidgetList QApplication::topLevelWidgets() QWidgetList list; QWidgetList all = allWidgets(); - for (QWidgetList::ConstIterator it = all.constBegin(); it != all.constEnd(); ++it) { + for (QWidgetList::ConstIterator it = all.constBegin(), cend = all.constEnd(); it != cend; ++it) { QWidget *w = *it; if (w->isWindow() && w->windowType() != Qt::Desktop) list.append(w); @@ -2140,7 +2159,7 @@ void QApplication::setActiveWindow(QWidget* act) if (QApplicationPrivate::focus_widget) { if (QApplicationPrivate::focus_widget->testAttribute(Qt::WA_InputMethodEnabled)) - qApp->inputMethod()->commit(); + QGuiApplication::inputMethod()->commit(); QFocusEvent focusAboutToChange(QEvent::FocusAboutToChange, Qt::ActiveWindowFocusReason); QApplication::sendEvent(QApplicationPrivate::focus_widget, &focusAboutToChange); @@ -2485,7 +2504,7 @@ bool QApplicationPrivate::isWindowBlocked(QWindow *window, QWindow **blockingWin } QWidget *popupWidget = QApplication::activePopupWidget(); QWindow *popupWindow = popupWidget ? popupWidget->windowHandle() : 0; - if (popupWindow == window) { + if (popupWindow == window || (!popupWindow && QWindowPrivate::get(window)->isPopup())) { *blockingWindow = 0; return false; } @@ -2844,6 +2863,7 @@ void QApplicationPrivate::sendSyntheticEnterLeave(QWidget *widget) */ QDesktopWidget *QApplication::desktop() { + CHECK_QAPP_INSTANCE(Q_NULLPTR) if (!qt_desktopWidget || // not created yet !(qt_desktopWidget->windowType() == Qt::Desktop)) { // reparented away qt_desktopWidget = new QDesktopWidget(); @@ -2881,7 +2901,7 @@ void QApplication::setStartDragTime(int ms) int QApplication::startDragTime() { - return qApp->styleHints()->startDragTime(); + return QGuiApplication::styleHints()->startDragTime(); } /* @@ -2919,7 +2939,7 @@ void QApplication::setStartDragDistance(int l) int QApplication::startDragDistance() { - return qApp->styleHints()->startDragDistance(); + return QGuiApplication::styleHints()->startDragDistance(); } /*! @@ -3122,39 +3142,15 @@ bool QApplication::notify(QObject *receiver, QEvent *e) } switch (e->type()) { - case QEvent::KeyPress: - { - bool isWidget = receiver->isWidgetType(); - bool isWindow = receiver->isWindowType(); - bool isGraphicsWidget = false; -#ifndef QT_NO_GRAPHICSVIEW - isGraphicsWidget = !isWidget && !isWindow && qobject_cast<QGraphicsWidget *>(receiver); -#endif - if (!isWidget && !isGraphicsWidget && !isWindow) { - return d->notify_helper(receiver, e); - } - - QKeyEvent* key = static_cast<QKeyEvent*>(e); -#ifndef QT_NO_SHORTCUT - // Try looking for a Shortcut before sending key events - QObject *shortcutReceiver = receiver; - if (!isWidget && isWindow) { - QWindow *w = qobject_cast<QWindow *>(receiver); - QObject *focus = w ? w->focusObject() : 0; - if (focus) - shortcutReceiver = focus; - } - if (qApp->d_func()->shortcutMap.tryShortcutEvent(shortcutReceiver, key)) - return true; -#endif - qt_in_tab_key_event = (key->key() == Qt::Key_Backtab - || key->key() == Qt::Key_Tab - || key->key() == Qt::Key_Left - || key->key() == Qt::Key_Up - || key->key() == Qt::Key_Right - || key->key() == Qt::Key_Down); - - } + case QEvent::KeyPress: { + int key = static_cast<QKeyEvent*>(e)->key(); + qt_in_tab_key_event = (key == Qt::Key_Backtab + || key == Qt::Key_Tab + || key == Qt::Key_Left + || key == Qt::Key_Up + || key == Qt::Key_Right + || key == Qt::Key_Down); + } default: break; } @@ -3334,7 +3330,7 @@ bool QApplication::notify(QObject *receiver, QEvent *e) while (w) { QWheelEvent we(relpos, wheel->globalPos(), wheel->pixelDelta(), wheel->angleDelta(), wheel->delta(), wheel->orientation(), wheel->buttons(), - wheel->modifiers(), wheel->phase()); + wheel->modifiers(), wheel->phase(), wheel->source()); we.spont = wheel->spontaneous(); res = d->notify_helper(w, w == receiver ? wheel : &we); eventAccepted = ((w == receiver) ? wheel : &we)->isAccepted(); @@ -3986,7 +3982,7 @@ void QApplication::setCursorFlashTime(int msecs) int QApplication::cursorFlashTime() { - return qApp->styleHints()->cursorFlashTime(); + return QGuiApplication::styleHints()->cursorFlashTime(); } /*! @@ -4004,7 +4000,7 @@ void QApplication::setDoubleClickInterval(int ms) int QApplication::doubleClickInterval() { - return qApp->styleHints()->mouseDoubleClickInterval(); + return QGuiApplication::styleHints()->mouseDoubleClickInterval(); } /*! @@ -4032,7 +4028,7 @@ void QApplication::setKeyboardInputInterval(int ms) int QApplication::keyboardInputInterval() { - return qApp->styleHints()->keyboardInputInterval(); + return QGuiApplication::styleHints()->keyboardInputInterval(); } /*! @@ -4123,6 +4119,7 @@ void QApplication::setEffectEnabled(Qt::UIEffect effect, bool enable) */ bool QApplication::isEffectEnabled(Qt::UIEffect effect) { + CHECK_QAPP_INSTANCE(false) return QColormap::instance().depth() >= 16 && (QApplicationPrivate::enabledAnimations & QPlatformTheme::GeneralUiEffect) && (QApplicationPrivate::enabledAnimations & uiEffectToFlag(effect)); diff --git a/src/widgets/kernel/qapplication.h b/src/widgets/kernel/qapplication.h index ceba0c96c4..d4b2326afd 100644 --- a/src/widgets/kernel/qapplication.h +++ b/src/widgets/kernel/qapplication.h @@ -1,7 +1,7 @@ /**************************************************************************** ** -** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ ** ** This file is part of the QtWidgets module of the Qt Toolkit. ** @@ -10,9 +10,9 @@ ** 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 Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. +** 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 @@ -23,8 +23,8 @@ ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ** $QT_END_LICENSE$ @@ -42,9 +42,6 @@ #ifdef QT_INCLUDE_COMPAT # include <QtWidgets/qdesktopwidget.h> #endif -#ifdef Q_NO_USING_KEYWORD -#include <QtGui/qpalette.h> -#endif #include <QtGui/qguiapplication.h> QT_BEGIN_NAMESPACE @@ -104,11 +101,7 @@ public: QT_DEPRECATED static inline void setGraphicsSystem(const QString &) {} #endif -#if defined(Q_NO_USING_KEYWORD) && !defined(Q_QDOC) - static QPalette palette() { return QGuiApplication::palette(); } -#else using QGuiApplication::palette; -#endif static QPalette palette(const QWidget *); static QPalette palette(const char *className); static void setPalette(const QPalette &, const char* className = 0); @@ -172,13 +165,13 @@ public: #if QT_DEPRECATED_SINCE(5, 0) QT_DEPRECATED static QLocale keyboardInputLocale() - { return qApp ? qApp->inputMethod()->locale() : QLocale::c(); } + { return qApp ? QGuiApplication::inputMethod()->locale() : QLocale::c(); } QT_DEPRECATED static Qt::LayoutDirection keyboardInputDirection() - { return qApp ? qApp->inputMethod()->inputDirection() : Qt::LeftToRight; } + { return qApp ? QGuiApplication::inputMethod()->inputDirection() : Qt::LeftToRight; } #endif static int exec(); - bool notify(QObject *, QEvent *); + bool notify(QObject *, QEvent *) Q_DECL_OVERRIDE; #ifdef QT_KEYPAD_NAVIGATION static Q_DECL_DEPRECATED void setKeypadNavigationEnabled(bool); @@ -206,8 +199,8 @@ public Q_SLOTS: static void aboutQt(); protected: - bool event(QEvent *); - bool compressEvent(QEvent *, QObject *receiver, QPostEventList *); + bool event(QEvent *) Q_DECL_OVERRIDE; + bool compressEvent(QEvent *, QObject *receiver, QPostEventList *) Q_DECL_OVERRIDE; private: Q_DISABLE_COPY(QApplication) diff --git a/src/widgets/kernel/qapplication_p.h b/src/widgets/kernel/qapplication_p.h index 7d97235c66..46359d7940 100644 --- a/src/widgets/kernel/qapplication_p.h +++ b/src/widgets/kernel/qapplication_p.h @@ -1,7 +1,7 @@ /**************************************************************************** ** -** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ ** ** This file is part of the QtWidgets module of the Qt Toolkit. ** @@ -10,9 +10,9 @@ ** 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 Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. +** 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 @@ -23,8 +23,8 @@ ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ** $QT_END_LICENSE$ @@ -108,13 +108,13 @@ public: QApplicationPrivate(int &argc, char **argv, int flags); ~QApplicationPrivate(); - virtual void notifyLayoutDirectionChange(); - virtual void notifyActiveWindowChange(QWindow *); + virtual void notifyLayoutDirectionChange() Q_DECL_OVERRIDE; + virtual void notifyActiveWindowChange(QWindow *) Q_DECL_OVERRIDE; - virtual bool shouldQuit(); + virtual bool shouldQuit() Q_DECL_OVERRIDE; bool tryCloseAllWindows() Q_DECL_OVERRIDE; -#if defined(Q_WS_X11) +#if defined(Q_DEAD_CODE_FROM_QT4_X11) #ifndef QT_NO_SETTINGS static bool x11_apply_settings(); #endif @@ -127,7 +127,7 @@ public: static QString desktopStyleKey(); - void createEventDispatcher(); + void createEventDispatcher() Q_DECL_OVERRIDE; static void dispatchEnterLeave(QWidget *enter, QWidget *leave, const QPointF &globalPosF); void notifyWindowIconChanged() Q_DECL_OVERRIDE; @@ -137,7 +137,7 @@ public: static bool isBlockedByModal(QWidget *widget); static bool modalState(); static bool tryModalHelper(QWidget *widget, QWidget **rettop = 0); -#ifdef Q_WS_MAC +#ifdef Q_DEAD_CODE_FROM_QT4_MAC static QWidget *tryModalHelper_sys(QWidget *top); bool canQuit(); #endif @@ -151,14 +151,14 @@ public: bool notify_helper(QObject *receiver, QEvent * e); void construct( -#ifdef Q_WS_X11 +#ifdef Q_DEAD_CODE_FROM_QT4_X11 Display *dpy = 0, Qt::HANDLE visual = 0, Qt::HANDLE cmap = 0 #endif ); void initialize(); void process_cmdline(); -#if defined(Q_WS_X11) +#if defined(Q_DEAD_CODE_FROM_QT4_X11) static void x11_initialize_style(); #endif @@ -188,9 +188,9 @@ public: static QPalette *set_pal; protected: - void notifyThemeChanged(); + void notifyThemeChanged() Q_DECL_OVERRIDE; #ifndef QT_NO_DRAGANDDROP - void notifyDragStarted(const QDrag *); + void notifyDragStarted(const QDrag *) Q_DECL_OVERRIDE; #endif // QT_NO_DRAGANDDROP public: @@ -213,7 +213,7 @@ public: static void initializeWidgetFontHash(); static void setSystemFont(const QFont &font); -#if defined(Q_WS_X11) +#if defined(Q_DEAD_CODE_FROM_QT4_X11) static void applyX11SpecificCommandLineArguments(QWidget *main_widget); #endif @@ -226,7 +226,7 @@ public: static Qt::NavigationMode navigationMode; #endif -#if defined(Q_WS_MAC) || defined(Q_WS_X11) +#if defined(Q_DEAD_CODE_FROM_QT4_MAC) || defined(Q_DEAD_CODE_FROM_QT4_X11) void _q_alertTimeOut(); QHash<QWidget *, QTimer *> alertTimerHash; #endif @@ -266,12 +266,12 @@ public: QGestureManager *gestureManager; QWidget *gestureWidget; #endif -#if defined(Q_WS_X11) || defined(Q_WS_WIN) +#if defined(Q_DEAD_CODE_FROM_QT4_X11) || defined(Q_DEAD_CODE_FROM_QT4_WIN) QPixmap *move_cursor; QPixmap *copy_cursor; QPixmap *link_cursor; #endif -#if defined(Q_WS_WIN) +#if defined(Q_DEAD_CODE_FROM_QT4_WIN) QPixmap *ignore_cursor; #endif @@ -289,7 +289,7 @@ public: ulong timestamp); static void translateTouchCancel(QTouchDevice *device, ulong timestamp); - QPixmap applyQIconStyleHelper(QIcon::Mode mode, const QPixmap& base) const; + QPixmap applyQIconStyleHelper(QIcon::Mode mode, const QPixmap& base) const Q_DECL_OVERRIDE; private: static QApplicationPrivate *self; static bool tryCloseAllWidgetWindows(QWindowList *processedWindows); @@ -301,9 +301,9 @@ private: static bool isAlien(QWidget *); }; -#if defined(Q_WS_WIN) +#if defined(Q_DEAD_CODE_FROM_QT4_WIN) extern void qt_win_set_cursor(QWidget *, bool); -#elif defined(Q_WS_X11) +#elif defined(Q_DEAD_CODE_FROM_QT4_X11) extern void qt_x11_enforce_cursor(QWidget *, bool); extern void qt_x11_enforce_cursor(QWidget *); #else diff --git a/src/widgets/kernel/qboxlayout.cpp b/src/widgets/kernel/qboxlayout.cpp index 631d3394dd..17eb8d98c4 100644 --- a/src/widgets/kernel/qboxlayout.cpp +++ b/src/widgets/kernel/qboxlayout.cpp @@ -1,7 +1,7 @@ /**************************************************************************** ** -** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ ** ** This file is part of the QtWidgets module of the Qt Toolkit. ** @@ -10,9 +10,9 @@ ** 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 Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. +** 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 @@ -23,8 +23,8 @@ ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ** $QT_END_LICENSE$ diff --git a/src/widgets/kernel/qboxlayout.h b/src/widgets/kernel/qboxlayout.h index c2da23f34c..5ce9ca26f6 100644 --- a/src/widgets/kernel/qboxlayout.h +++ b/src/widgets/kernel/qboxlayout.h @@ -1,7 +1,7 @@ /**************************************************************************** ** -** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ ** ** This file is part of the QtWidgets module of the Qt Toolkit. ** @@ -10,9 +10,9 @@ ** 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 Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. +** 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 @@ -23,8 +23,8 @@ ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ** $QT_END_LICENSE$ @@ -67,7 +67,7 @@ public: void addWidget(QWidget *, int stretch = 0, Qt::Alignment alignment = 0); void addLayout(QLayout *layout, int stretch = 0); void addStrut(int); - void addItem(QLayoutItem *); + void addItem(QLayoutItem *) Q_DECL_OVERRIDE; void insertSpacing(int index, int size); void insertStretch(int index, int stretch = 0); @@ -84,20 +84,20 @@ public: void setStretch(int index, int stretch); int stretch(int index) const; - QSize sizeHint() const; - QSize minimumSize() const; - QSize maximumSize() const; + QSize sizeHint() const Q_DECL_OVERRIDE; + QSize minimumSize() const Q_DECL_OVERRIDE; + QSize maximumSize() const Q_DECL_OVERRIDE; - bool hasHeightForWidth() const; - int heightForWidth(int) const; - int minimumHeightForWidth(int) const; + bool hasHeightForWidth() const Q_DECL_OVERRIDE; + int heightForWidth(int) const Q_DECL_OVERRIDE; + int minimumHeightForWidth(int) const Q_DECL_OVERRIDE; - Qt::Orientations expandingDirections() const; - void invalidate(); - QLayoutItem *itemAt(int) const; - QLayoutItem *takeAt(int); - int count() const; - void setGeometry(const QRect&); + Qt::Orientations expandingDirections() const Q_DECL_OVERRIDE; + void invalidate() Q_DECL_OVERRIDE; + QLayoutItem *itemAt(int) const Q_DECL_OVERRIDE; + QLayoutItem *takeAt(int) Q_DECL_OVERRIDE; + int count() const Q_DECL_OVERRIDE; + void setGeometry(const QRect&) Q_DECL_OVERRIDE; private: Q_DISABLE_COPY(QBoxLayout) diff --git a/src/widgets/kernel/qdesktopwidget.cpp b/src/widgets/kernel/qdesktopwidget.cpp index 563707b021..94716025b9 100644 --- a/src/widgets/kernel/qdesktopwidget.cpp +++ b/src/widgets/kernel/qdesktopwidget.cpp @@ -1,7 +1,7 @@ /**************************************************************************** ** -** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ ** ** This file is part of the QtWidgets module of the Qt Toolkit. ** @@ -10,9 +10,9 @@ ** 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 Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. +** 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 @@ -23,8 +23,8 @@ ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ** $QT_END_LICENSE$ diff --git a/src/widgets/kernel/qdesktopwidget.h b/src/widgets/kernel/qdesktopwidget.h index e8ce49503b..5412c5bc4a 100644 --- a/src/widgets/kernel/qdesktopwidget.h +++ b/src/widgets/kernel/qdesktopwidget.h @@ -1,7 +1,7 @@ /**************************************************************************** ** -** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ ** ** This file is part of the QtWidgets module of the Qt Toolkit. ** @@ -10,9 +10,9 @@ ** 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 Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. +** 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 @@ -23,8 +23,8 @@ ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ** $QT_END_LICENSE$ @@ -79,7 +79,7 @@ Q_SIGNALS: void screenCountChanged(int); protected: - void resizeEvent(QResizeEvent *e); + void resizeEvent(QResizeEvent *e) Q_DECL_OVERRIDE; private: Q_DISABLE_COPY(QDesktopWidget) diff --git a/src/widgets/kernel/qdesktopwidget.qdoc b/src/widgets/kernel/qdesktopwidget.qdoc index e8bda3c805..822bb47a15 100644 --- a/src/widgets/kernel/qdesktopwidget.qdoc +++ b/src/widgets/kernel/qdesktopwidget.qdoc @@ -1,7 +1,7 @@ /**************************************************************************** ** -** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ ** ** This file is part of the documentation of the Qt Toolkit. ** @@ -10,15 +10,15 @@ ** 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 Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. +** 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 +** 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$ diff --git a/src/widgets/kernel/qdesktopwidget_p.h b/src/widgets/kernel/qdesktopwidget_p.h index 29daaa4f97..1fcad7fa65 100644 --- a/src/widgets/kernel/qdesktopwidget_p.h +++ b/src/widgets/kernel/qdesktopwidget_p.h @@ -1,7 +1,7 @@ /**************************************************************************** ** -** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ ** ** This file is part of the QtWidgets module of the Qt Toolkit. ** @@ -10,9 +10,9 @@ ** 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 Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. +** 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 @@ -23,8 +23,8 @@ ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ** $QT_END_LICENSE$ @@ -48,6 +48,8 @@ #include "QDesktopWidget" #include "private/qwidget_p.h" +#include <QtCore/qalgorithms.h> + QT_BEGIN_NAMESPACE class QDesktopScreenWidget : public QWidget { diff --git a/src/widgets/kernel/qformlayout.cpp b/src/widgets/kernel/qformlayout.cpp index b77082b7f4..a7f9021c42 100644 --- a/src/widgets/kernel/qformlayout.cpp +++ b/src/widgets/kernel/qformlayout.cpp @@ -1,7 +1,7 @@ /**************************************************************************** ** -** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ ** ** This file is part of the QtWidgets module of the Qt Toolkit. ** @@ -10,9 +10,9 @@ ** 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 Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. +** 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 @@ -23,8 +23,8 @@ ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ** $QT_END_LICENSE$ diff --git a/src/widgets/kernel/qformlayout.h b/src/widgets/kernel/qformlayout.h index 06100f858f..18f3c84354 100644 --- a/src/widgets/kernel/qformlayout.h +++ b/src/widgets/kernel/qformlayout.h @@ -1,7 +1,7 @@ /**************************************************************************** ** -** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ ** ** This file is part of the QtWidgets module of the Qt Toolkit. ** @@ -10,9 +10,9 @@ ** 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 Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. +** 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 @@ -23,8 +23,8 @@ ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ** $QT_END_LICENSE$ @@ -44,7 +44,6 @@ class QFormLayoutPrivate; class Q_WIDGETS_EXPORT QFormLayout : public QLayout { Q_OBJECT - Q_ENUMS(FieldGrowthPolicy RowWrapPolicy ItemRole) Q_DECLARE_PRIVATE(QFormLayout) Q_PROPERTY(FieldGrowthPolicy fieldGrowthPolicy READ fieldGrowthPolicy WRITE setFieldGrowthPolicy RESET resetFieldGrowthPolicy) Q_PROPERTY(RowWrapPolicy rowWrapPolicy READ rowWrapPolicy WRITE setRowWrapPolicy RESET resetRowWrapPolicy) @@ -59,18 +58,21 @@ public: ExpandingFieldsGrow, AllNonFixedFieldsGrow }; + Q_ENUM(FieldGrowthPolicy) enum RowWrapPolicy { DontWrapRows, WrapLongRows, WrapAllRows }; + Q_ENUM(RowWrapPolicy) enum ItemRole { LabelRole = 0, FieldRole = 1, SpanningRole = 2 }; + Q_ENUM(ItemRole) explicit QFormLayout(QWidget *parent = 0); ~QFormLayout(); @@ -118,19 +120,19 @@ public: QWidget *labelForField(QLayout *field) const; // reimplemented from QLayout - void addItem(QLayoutItem *item); - QLayoutItem *itemAt(int index) const; - QLayoutItem *takeAt(int index); - - void setGeometry(const QRect &rect); - QSize minimumSize() const; - QSize sizeHint() const; - void invalidate(); - - bool hasHeightForWidth() const; - int heightForWidth(int width) const; - Qt::Orientations expandingDirections() const; - int count() const; + void addItem(QLayoutItem *item) Q_DECL_OVERRIDE; + QLayoutItem *itemAt(int index) const Q_DECL_OVERRIDE; + QLayoutItem *takeAt(int index) Q_DECL_OVERRIDE; + + void setGeometry(const QRect &rect) Q_DECL_OVERRIDE; + QSize minimumSize() const Q_DECL_OVERRIDE; + QSize sizeHint() const Q_DECL_OVERRIDE; + void invalidate() Q_DECL_OVERRIDE; + + bool hasHeightForWidth() const Q_DECL_OVERRIDE; + int heightForWidth(int width) const Q_DECL_OVERRIDE; + Qt::Orientations expandingDirections() const Q_DECL_OVERRIDE; + int count() const Q_DECL_OVERRIDE; int rowCount() const; diff --git a/src/widgets/kernel/qgesture.cpp b/src/widgets/kernel/qgesture.cpp index 2b8f04ccdf..713a019cc3 100644 --- a/src/widgets/kernel/qgesture.cpp +++ b/src/widgets/kernel/qgesture.cpp @@ -1,7 +1,7 @@ /**************************************************************************** ** -** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ ** ** This file is part of the QtWidgets module of the Qt Toolkit. ** @@ -10,9 +10,9 @@ ** 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 Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. +** 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 @@ -23,8 +23,8 @@ ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ** $QT_END_LICENSE$ @@ -36,6 +36,7 @@ #include "private/qstandardgestures_p.h" #include "qgraphicsview.h" +#include <QtCore/QDebug> #ifndef QT_NO_GESTURES QT_BEGIN_NAMESPACE @@ -1086,46 +1087,79 @@ QPointF QGestureEvent::mapToGraphicsScene(const QPointF &gesturePoint) const } #endif //QT_NO_GRAPHICSVIEW -#ifdef Q_NO_USING_KEYWORD -/*! - \fn void QGestureEvent::setAccepted(bool accepted) - - Sets or clears the event's internal flag that determines whether it should - be delivered to other objects. - - Calling this function with a value of true for \a accepted indicates that the - caller has accepted the event and that it should not be propagated further. - Calling this function with a value of false indicates that the caller has - ignored the event and that it should be delivered to other objects. - - For convenience, the accept flag can also be set with accept(), and cleared - with ignore(). - - \sa QEvent::accepted -*/ -/*! - \fn bool QGestureEvent::isAccepted() const +#ifndef QT_NO_DEBUG_STREAM - Returns \c true is the event has been accepted; otherwise returns \c false. - - \sa QEvent::accepted -*/ -/*! - \fn void QGestureEvent::accept() - - Accepts the event, the equivalent of calling setAccepted(true). - - \sa QEvent::accept() -*/ -/*! - \fn void QGestureEvent::ignore() +static void formatGestureHeader(QDebug d, const char *className, const QGesture *gesture) +{ + d << className << "(state=" << gesture->state(); + if (gesture->hasHotSpot()) + d << ",hotSpot=" << gesture->hotSpot(); +} - Ignores the event, the equivalent of calling setAccepted(false). +Q_WIDGETS_EXPORT QDebug operator<<(QDebug d, const QGesture *gesture) +{ + QDebugStateSaver saver(d); + d.nospace(); + switch (gesture->gestureType()) { + case Qt::TapGesture: + formatGestureHeader(d, "QTapGesture", gesture); + d << ",position=" << static_cast<const QTapGesture*>(gesture)->position() << ')'; + break; + case Qt::TapAndHoldGesture: { + const QTapAndHoldGesture *tap = static_cast<const QTapAndHoldGesture*>(gesture); + formatGestureHeader(d, "QTapAndHoldGesture", tap); + d << ",position=" << tap->position() << ",timeout=" << tap->timeout() << ')'; + } + break; + case Qt::PanGesture: { + const QPanGesture *pan = static_cast<const QPanGesture*>(gesture); + formatGestureHeader(d, "QPanGesture", pan); + d << ",lastOffset=" << pan->lastOffset() << ",offset=" << pan->offset() + << ",acceleration=" << pan->acceleration() + << ",delta=" << pan->delta() << ')'; + } + break; + case Qt::PinchGesture: { + const QPinchGesture *pinch = static_cast<const QPinchGesture*>(gesture); + formatGestureHeader(d, "QPinchGesture", pinch); + d << ",totalChangeFlags=" << pinch->totalChangeFlags() + << ",changeFlags=" << pinch->changeFlags() + << ",startCenterPoint=" << pinch->startCenterPoint() + << ",lastCenterPoint=" << pinch->lastCenterPoint() + << ",centerPoint=" << pinch->centerPoint() + << ",totalScaleFactor=" << pinch->totalScaleFactor() + << ",lastScaleFactor=" << pinch->lastScaleFactor() + << ",scaleFactor=" << pinch->scaleFactor() + << ",totalRotationAngle=" << pinch->totalRotationAngle() + << ",lastRotationAngle=" << pinch->lastRotationAngle() + << ",rotationAngle=" << pinch->rotationAngle() << ')'; + } + break; + case Qt::SwipeGesture: { + const QSwipeGesture *swipe = static_cast<const QSwipeGesture*>(gesture); + formatGestureHeader(d, "QSwipeGesture", swipe); + d << ",horizontalDirection=" << swipe->horizontalDirection() + << ",verticalDirection=" << swipe->verticalDirection() + << ",swipeAngle=" << swipe->swipeAngle() << ')'; + } + break; + default: + formatGestureHeader(d, "Custom gesture", gesture); + d << ",type=" << gesture->gestureType() << ')'; + break; + } + return d; +} - \sa QEvent::ignore() -*/ -#endif +Q_WIDGETS_EXPORT QDebug operator<<(QDebug d, const QGestureEvent *gestureEvent) +{ + QDebugStateSaver saver(d); + d.nospace(); + d << "QGestureEvent(" << gestureEvent->gestures() << ')'; + return d; +} +#endif // !QT_NO_DEBUG_STREAM QT_END_NAMESPACE #include <moc_qgesture.cpp> diff --git a/src/widgets/kernel/qgesture.h b/src/widgets/kernel/qgesture.h index 9e3ee64c87..dfe9450365 100644 --- a/src/widgets/kernel/qgesture.h +++ b/src/widgets/kernel/qgesture.h @@ -1,7 +1,7 @@ /**************************************************************************** ** -** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ ** ** This file is part of the QtWidgets module of the Qt Toolkit. ** @@ -10,9 +10,9 @@ ** 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 Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. +** 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 @@ -23,8 +23,8 @@ ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ** $QT_END_LICENSE$ @@ -200,7 +200,6 @@ class Q_WIDGETS_EXPORT QSwipeGesture : public QGesture { Q_OBJECT Q_DECLARE_PRIVATE(QSwipeGesture) - Q_ENUMS(SwipeDirection) Q_PROPERTY(SwipeDirection horizontalDirection READ horizontalDirection STORED false) Q_PROPERTY(SwipeDirection verticalDirection READ verticalDirection STORED false) @@ -209,6 +208,7 @@ class Q_WIDGETS_EXPORT QSwipeGesture : public QGesture public: enum SwipeDirection { NoDirection, Left, Right, Up, Down }; + Q_ENUM(SwipeDirection) explicit QSwipeGesture(QObject *parent = 0); ~QSwipeGesture(); @@ -275,18 +275,10 @@ public: QList<QGesture *> activeGestures() const; QList<QGesture *> canceledGestures() const; -#ifdef Q_NO_USING_KEYWORD - inline void setAccepted(bool accepted) { QEvent::setAccepted(accepted); } - inline bool isAccepted() const { return QEvent::isAccepted(); } - - inline void accept() { QEvent::accept(); } - inline void ignore() { QEvent::ignore(); } -#else using QEvent::setAccepted; using QEvent::isAccepted; using QEvent::accept; using QEvent::ignore; -#endif void setAccepted(QGesture *, bool); void accept(QGesture *); @@ -315,6 +307,11 @@ private: friend class QGestureManager; }; +# ifndef QT_NO_DEBUG_STREAM +Q_WIDGETS_EXPORT QDebug operator<<(QDebug, const QGesture *); +Q_WIDGETS_EXPORT QDebug operator<<(QDebug, const QGestureEvent *); +# endif + QT_END_NAMESPACE Q_DECLARE_METATYPE(QGesture::GestureCancelPolicy) diff --git a/src/widgets/kernel/qgesture_p.h b/src/widgets/kernel/qgesture_p.h index 26d9ede59d..bb6c8fe8ad 100644 --- a/src/widgets/kernel/qgesture_p.h +++ b/src/widgets/kernel/qgesture_p.h @@ -1,7 +1,7 @@ /**************************************************************************** ** -** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ ** ** This file is part of the QtWidgets module of the Qt Toolkit. ** @@ -10,9 +10,9 @@ ** 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 Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. +** 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 @@ -23,8 +23,8 @@ ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ** $QT_END_LICENSE$ diff --git a/src/widgets/kernel/qgesturemanager.cpp b/src/widgets/kernel/qgesturemanager.cpp index f0aceaacf7..b5d3a56d3f 100644 --- a/src/widgets/kernel/qgesturemanager.cpp +++ b/src/widgets/kernel/qgesturemanager.cpp @@ -1,7 +1,7 @@ /**************************************************************************** ** -** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ ** ** This file is part of the QtWidgets module of the Qt Toolkit. ** @@ -10,9 +10,9 @@ ** 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 Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. +** 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 @@ -23,8 +23,8 @@ ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ** $QT_END_LICENSE$ @@ -46,23 +46,19 @@ #ifdef Q_OS_OSX #include "qmacgesturerecognizer_p.h" #endif -#if defined(Q_WS_WIN) && !defined(QT_NO_NATIVE_GESTURES) +#if defined(Q_DEAD_CODE_FROM_QT4_WIN) && !defined(QT_NO_NATIVE_GESTURES) #include "qwinnativepangesturerecognizer_win_p.h" #endif #include "qdebug.h" - -// #define GESTURE_DEBUG -#ifndef GESTURE_DEBUG -# define DEBUG if (0) qDebug -#else -# define DEBUG qDebug -#endif +#include <QtCore/QLoggingCategory> #ifndef QT_NO_GESTURES QT_BEGIN_NAMESPACE +Q_LOGGING_CATEGORY(lcGestureManager, "qt.widgets.gestures") + #if !defined(Q_OS_OSX) static inline int panTouchPoints() { @@ -98,7 +94,7 @@ QGestureManager::QGestureManager(QObject *parent) registerGestureRecognizer(new QSwipeGestureRecognizer); registerGestureRecognizer(new QTapGestureRecognizer); #endif -#if defined(Q_WS_WIN) +#if defined(Q_DEAD_CODE_FROM_QT4_WIN) #if !defined(QT_NO_NATIVE_GESTURES) if (QApplicationPrivate::HasTouchSupport) registerGestureRecognizer(new QWinNativePanGestureRecognizer); @@ -231,9 +227,8 @@ QGesture *QGestureManager::getState(QObject *object, QGestureRecognizer *recogni // if the recognizer didn't fill in the gesture type, then this // is a custom gesture with autogenerated id and we fill it. state->d_func()->gestureType = type; -#if defined(GESTURE_DEBUG) - state->setObjectName(QString::number((int)type)); -#endif + if (lcGestureManager().isDebugEnabled()) + state->setObjectName(QString::number((int)type)); } m_objectGestures[QGestureManager::ObjectGesture(object, type)].append(state); m_gestureToRecognizer[state] = recognizer; @@ -275,26 +270,26 @@ bool QGestureManager::filterEventThroughContexts(const QMultiMap<QObject *, QGestureRecognizer::Result recognizerState = recognizerResult & QGestureRecognizer::ResultState_Mask; QGestureRecognizer::Result resultHint = recognizerResult & QGestureRecognizer::ResultHint_Mask; if (recognizerState == QGestureRecognizer::TriggerGesture) { - DEBUG() << "QGestureManager:Recognizer: gesture triggered: " << state; + qCDebug(lcGestureManager) << "QGestureManager:Recognizer: gesture triggered: " << state << event; triggeredGestures << state; } else if (recognizerState == QGestureRecognizer::FinishGesture) { - DEBUG() << "QGestureManager:Recognizer: gesture finished: " << state; + qCDebug(lcGestureManager) << "QGestureManager:Recognizer: gesture finished: " << state << event; finishedGestures << state; } else if (recognizerState == QGestureRecognizer::MayBeGesture) { - DEBUG() << "QGestureManager:Recognizer: maybe gesture: " << state; + qCDebug(lcGestureManager) << "QGestureManager:Recognizer: maybe gesture: " << state << event; newMaybeGestures << state; } else if (recognizerState == QGestureRecognizer::CancelGesture) { - DEBUG() << "QGestureManager:Recognizer: not gesture: " << state; + qCDebug(lcGestureManager) << "QGestureManager:Recognizer: not gesture: " << state << event; notGestures << state; } else if (recognizerState == QGestureRecognizer::Ignore) { - DEBUG() << "QGestureManager:Recognizer: ignored the event: " << state; + qCDebug(lcGestureManager) << "QGestureManager:Recognizer: ignored the event: " << state << event; } else { - DEBUG() << "QGestureManager:Recognizer: hm, lets assume the recognizer" - << "ignored the event: " << state; + qCDebug(lcGestureManager) << "QGestureManager:Recognizer: hm, lets assume the recognizer" + << "ignored the event: " << state << event; } if (resultHint & QGestureRecognizer::ConsumeEventHint) { - DEBUG() << "QGestureManager: we were asked to consume the event: " - << state; + qCDebug(lcGestureManager) << "QGestureManager: we were asked to consume the event: " + << state << event; consumeEventHint = true; } } @@ -363,7 +358,7 @@ bool QGestureManager::filterEventThroughContexts(const QMultiMap<QObject *, if (!m_activeGestures.isEmpty() || !m_maybeGestures.isEmpty() || !startedGestures.isEmpty() || !triggeredGestures.isEmpty() || !finishedGestures.isEmpty() || !canceledGestures.isEmpty()) { - DEBUG() << "QGestureManager::filterEventThroughContexts:" + qCDebug(lcGestureManager) << "QGestureManager::filterEventThroughContexts:" << "\n\tactiveGestures:" << m_activeGestures << "\n\tmaybeGestures:" << m_maybeGestures << "\n\tstarted:" << startedGestures @@ -381,7 +376,7 @@ bool QGestureManager::filterEventThroughContexts(const QMultiMap<QObject *, if (undeliveredGestures.contains(g)) continue; if (g->gestureCancelPolicy() == QGesture::CancelAllInContext) { - DEBUG() << "lets try to cancel some"; + qCDebug(lcGestureManager) << "lets try to cancel some"; // find gestures in context in Qt::GestureStarted or Qt::GestureUpdated state and cancel them cancelGesturesForChildren(g); } @@ -421,7 +416,7 @@ void QGestureManager::cancelGesturesForChildren(QGesture *original) QWidget *widget = m_gestureTargets.value(*iter); // note that we don't touch the gestures for our originatingWidget if (widget != originatingWidget && originatingWidget->isAncestorOf(widget)) { - DEBUG() << " found a gesture to cancel" << (*iter); + qCDebug(lcGestureManager) << " found a gesture to cancel" << (*iter); (*iter)->d_func()->state = Qt::GestureCanceled; cancelledGestures << *iter; iter = m_activeGestures.erase(iter); @@ -623,7 +618,7 @@ void QGestureManager::deliverEvents(const QSet<QGesture *> &gestures, if (gesture->hasHotSpot()) { // guess the target widget using the hotspot of the gesture QPoint pt = gesture->hotSpot().toPoint(); - if (QWidget *topLevel = qApp->topLevelAt(pt)) { + if (QWidget *topLevel = QApplication::topLevelAt(pt)) { QWidget *child = topLevel->childAt(topLevel->mapFromGlobal(pt)); target = child ? child : topLevel; } @@ -648,7 +643,7 @@ void QGestureManager::deliverEvents(const QSet<QGesture *> &gestures, normalStartedGestures[target].append(gesture); } } else { - DEBUG() << "QGestureManager::deliverEvent: could not find the target for gesture" + qCDebug(lcGestureManager) << "QGestureManager::deliverEvent: could not find the target for gesture" << gesture->gestureType(); qWarning("QGestureManager::deliverEvent: could not find the target for gesture"); undeliveredGestures->insert(gesture); @@ -656,7 +651,7 @@ void QGestureManager::deliverEvents(const QSet<QGesture *> &gestures, } getGestureTargets(startedGestures, &conflictedGestures, &normalStartedGestures); - DEBUG() << "QGestureManager::deliverEvents:" + qCDebug(lcGestureManager) << "QGestureManager::deliverEvents:" << "\nstarted: " << startedGestures << "\nconflicted: " << conflictedGestures << "\nnormal: " << normalStartedGestures @@ -667,7 +662,7 @@ void QGestureManager::deliverEvents(const QSet<QGesture *> &gestures, e = conflictedGestures.constEnd(); it != e; ++it) { QWidget *receiver = it.key(); QList<QGesture *> gestures = it.value(); - DEBUG() << "QGestureManager::deliverEvents: sending GestureOverride to" + qCDebug(lcGestureManager) << "QGestureManager::deliverEvents: sending GestureOverride to" << receiver << "gestures:" << gestures; QGestureEvent event(gestures); @@ -683,13 +678,13 @@ void QGestureManager::deliverEvents(const QSet<QGesture *> &gestures, if (eventAccepted || event.isAccepted(gesture)) { QWidget *w = event.m_targetWidgets.value(gesture->gestureType(), 0); Q_ASSERT(w); - DEBUG() << "override event: gesture was accepted:" << gesture << w; + qCDebug(lcGestureManager) << "override event: gesture was accepted:" << gesture << w; QList<QGesture *> &gestures = normalStartedGestures[w]; gestures.append(gesture); // override the target m_gestureTargets[gesture] = w; } else { - DEBUG() << "override event: gesture wasn't accepted. putting back:" << gesture; + qCDebug(lcGestureManager) << "override event: gesture wasn't accepted. putting back:" << gesture; QList<QGesture *> &gestures = normalStartedGestures[receiver]; gestures.append(gesture); } @@ -700,7 +695,7 @@ void QGestureManager::deliverEvents(const QSet<QGesture *> &gestures, for (GesturesPerWidget::const_iterator it = normalStartedGestures.constBegin(), e = normalStartedGestures.constEnd(); it != e; ++it) { if (!it.value().isEmpty()) { - DEBUG() << "QGestureManager::deliverEvents: sending to" << it.key() + qCDebug(lcGestureManager) << "QGestureManager::deliverEvents: sending to" << it.key() << "gestures:" << it.value(); QGestureEvent event(it.value()); QApplication::sendEvent(it.key(), &event); @@ -710,7 +705,7 @@ void QGestureManager::deliverEvents(const QSet<QGesture *> &gestures, (eventAccepted || event.isAccepted(gesture))) { QWidget *w = event.m_targetWidgets.value(gesture->gestureType(), 0); Q_ASSERT(w); - DEBUG() << "started gesture was delivered and accepted by" << w; + qCDebug(lcGestureManager) << "started gesture was delivered and accepted by" << w; m_gestureTargets[gesture] = w; } } diff --git a/src/widgets/kernel/qgesturemanager_p.h b/src/widgets/kernel/qgesturemanager_p.h index 6b27f41fc2..8ba253d17e 100644 --- a/src/widgets/kernel/qgesturemanager_p.h +++ b/src/widgets/kernel/qgesturemanager_p.h @@ -1,7 +1,7 @@ /**************************************************************************** ** -** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ ** ** This file is part of the QtWidgets module of the Qt Toolkit. ** @@ -10,9 +10,9 @@ ** 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 Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. +** 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 @@ -23,8 +23,8 @@ ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ** $QT_END_LICENSE$ diff --git a/src/widgets/kernel/qgesturerecognizer.cpp b/src/widgets/kernel/qgesturerecognizer.cpp index 084b110f41..16770539b0 100644 --- a/src/widgets/kernel/qgesturerecognizer.cpp +++ b/src/widgets/kernel/qgesturerecognizer.cpp @@ -1,7 +1,7 @@ /**************************************************************************** ** -** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ ** ** This file is part of the QtWidgets module of the Qt Toolkit. ** @@ -10,9 +10,9 @@ ** 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 Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. +** 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 @@ -23,8 +23,8 @@ ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ** $QT_END_LICENSE$ diff --git a/src/widgets/kernel/qgesturerecognizer.h b/src/widgets/kernel/qgesturerecognizer.h index ff42b7f7a9..838e262307 100644 --- a/src/widgets/kernel/qgesturerecognizer.h +++ b/src/widgets/kernel/qgesturerecognizer.h @@ -1,7 +1,7 @@ /**************************************************************************** ** -** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ ** ** This file is part of the QtWidgets module of the Qt Toolkit. ** @@ -10,9 +10,9 @@ ** 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 Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. +** 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 @@ -23,8 +23,8 @@ ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ** $QT_END_LICENSE$ diff --git a/src/widgets/kernel/qgridlayout.cpp b/src/widgets/kernel/qgridlayout.cpp index 3de0eb7960..0e0c1588a1 100644 --- a/src/widgets/kernel/qgridlayout.cpp +++ b/src/widgets/kernel/qgridlayout.cpp @@ -1,7 +1,7 @@ /**************************************************************************** ** -** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ ** ** This file is part of the QtWidgets module of the Qt Toolkit. ** @@ -10,9 +10,9 @@ ** 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 Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. +** 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 @@ -23,8 +23,8 @@ ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ** $QT_END_LICENSE$ diff --git a/src/widgets/kernel/qgridlayout.h b/src/widgets/kernel/qgridlayout.h index 95d8a0a445..a582d31634 100644 --- a/src/widgets/kernel/qgridlayout.h +++ b/src/widgets/kernel/qgridlayout.h @@ -1,7 +1,7 @@ /**************************************************************************** ** -** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ ** ** This file is part of the QtWidgets module of the Qt Toolkit. ** @@ -10,9 +10,9 @@ ** 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 Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. +** 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 @@ -23,8 +23,8 @@ ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ** $QT_END_LICENSE$ @@ -59,9 +59,9 @@ public: ~QGridLayout(); - QSize sizeHint() const; - QSize minimumSize() const; - QSize maximumSize() const; + QSize sizeHint() const Q_DECL_OVERRIDE; + QSize minimumSize() const Q_DECL_OVERRIDE; + QSize maximumSize() const Q_DECL_OVERRIDE; void setHorizontalSpacing(int spacing); int horizontalSpacing() const; @@ -85,12 +85,12 @@ public: QRect cellRect(int row, int column) const; - bool hasHeightForWidth() const; - int heightForWidth(int) const; - int minimumHeightForWidth(int) const; + bool hasHeightForWidth() const Q_DECL_OVERRIDE; + int heightForWidth(int) const Q_DECL_OVERRIDE; + int minimumHeightForWidth(int) const Q_DECL_OVERRIDE; - Qt::Orientations expandingDirections() const; - void invalidate(); + Qt::Orientations expandingDirections() const Q_DECL_OVERRIDE; + void invalidate() Q_DECL_OVERRIDE; inline void addWidget(QWidget *w) { QLayout::addWidget(w); } void addWidget(QWidget *, int row, int column, Qt::Alignment = 0); @@ -101,11 +101,11 @@ public: void setOriginCorner(Qt::Corner); Qt::Corner originCorner() const; - QLayoutItem *itemAt(int index) const; + QLayoutItem *itemAt(int index) const Q_DECL_OVERRIDE; QLayoutItem *itemAtPosition(int row, int column) const; - QLayoutItem *takeAt(int index); - int count() const; - void setGeometry(const QRect&); + QLayoutItem *takeAt(int index) Q_DECL_OVERRIDE; + int count() const Q_DECL_OVERRIDE; + void setGeometry(const QRect&) Q_DECL_OVERRIDE; void addItem(QLayoutItem *item, int row, int column, int rowSpan = 1, int columnSpan = 1, Qt::Alignment = 0); @@ -113,7 +113,7 @@ public: void getItemPosition(int idx, int *row, int *column, int *rowSpan, int *columnSpan) const; protected: - void addItem(QLayoutItem *); + void addItem(QLayoutItem *) Q_DECL_OVERRIDE; private: Q_DISABLE_COPY(QGridLayout) diff --git a/src/widgets/kernel/qlayout.cpp b/src/widgets/kernel/qlayout.cpp index f124f1ed8e..822690942e 100644 --- a/src/widgets/kernel/qlayout.cpp +++ b/src/widgets/kernel/qlayout.cpp @@ -1,7 +1,7 @@ /**************************************************************************** ** -** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ ** ** This file is part of the QtWidgets module of the Qt Toolkit. ** @@ -10,9 +10,9 @@ ** 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 Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. +** 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 @@ -23,8 +23,8 @@ ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ** $QT_END_LICENSE$ @@ -268,14 +268,6 @@ bool QLayout::setAlignment(QLayout *l, Qt::Alignment alignment) } /*! - \fn void QLayout::setAlignment(Qt::Alignment alignment) - - Sets the alignment of this item to \a alignment. - - \sa QLayoutItem::setAlignment() -*/ - -/*! \property QLayout::margin \brief the width of the outside border of the layout \obsolete diff --git a/src/widgets/kernel/qlayout.h b/src/widgets/kernel/qlayout.h index 38568e434c..62a05906e0 100644 --- a/src/widgets/kernel/qlayout.h +++ b/src/widgets/kernel/qlayout.h @@ -1,7 +1,7 @@ /**************************************************************************** ** -** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ ** ** This file is part of the QtWidgets module of the Qt Toolkit. ** @@ -10,9 +10,9 @@ ** 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 Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. +** 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 @@ -23,8 +23,8 @@ ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ** $QT_END_LICENSE$ @@ -56,7 +56,6 @@ class Q_WIDGETS_EXPORT QLayout : public QObject, public QLayoutItem Q_OBJECT Q_DECLARE_PRIVATE(QLayout) - Q_ENUMS(SizeConstraint) Q_PROPERTY(int margin READ margin WRITE setMargin) Q_PROPERTY(int spacing READ spacing WRITE setSpacing) Q_PROPERTY(SizeConstraint sizeConstraint READ sizeConstraint WRITE setSizeConstraint) @@ -69,6 +68,7 @@ public: SetMaximumSize, SetMinAndMaxSize }; + Q_ENUM(SizeConstraint) QLayout(QWidget *parent); QLayout(); @@ -88,11 +88,7 @@ public: bool setAlignment(QWidget *w, Qt::Alignment alignment); bool setAlignment(QLayout *l, Qt::Alignment alignment); -#ifdef Q_NO_USING_KEYWORD - inline void setAlignment(Qt::Alignment alignment) { QLayoutItem::setAlignment(alignment); } -#else using QLayoutItem::setAlignment; -#endif void setSizeConstraint(SizeConstraint); SizeConstraint sizeConstraint() const; @@ -101,8 +97,8 @@ public: QWidget *parentWidget() const; - void invalidate(); - QRect geometry() const; + void invalidate() Q_DECL_OVERRIDE; + QRect geometry() const Q_DECL_OVERRIDE; bool activate(); void update(); @@ -112,16 +108,16 @@ public: void removeWidget(QWidget *w); void removeItem(QLayoutItem *); - Qt::Orientations expandingDirections() const; - QSize minimumSize() const; - QSize maximumSize() const; - virtual void setGeometry(const QRect&); + Qt::Orientations expandingDirections() const Q_DECL_OVERRIDE; + QSize minimumSize() const Q_DECL_OVERRIDE; + QSize maximumSize() const Q_DECL_OVERRIDE; + virtual void setGeometry(const QRect&) Q_DECL_OVERRIDE; virtual QLayoutItem *itemAt(int index) const = 0; virtual QLayoutItem *takeAt(int index) = 0; virtual int indexOf(QWidget *) const; virtual int count() const = 0; - bool isEmpty() const; - QSizePolicy::ControlTypes controlTypes() const; + bool isEmpty() const Q_DECL_OVERRIDE; + QSizePolicy::ControlTypes controlTypes() const Q_DECL_OVERRIDE; // ### Qt 6 make this function virtual QLayoutItem *replaceWidget(QWidget *from, QWidget *to, Qt::FindChildOptions options = Qt::FindChildrenRecursively); @@ -130,7 +126,7 @@ public: QSize totalMinimumSize() const; QSize totalMaximumSize() const; QSize totalSizeHint() const; - QLayout *layout(); + QLayout *layout() Q_DECL_OVERRIDE; void setEnabled(bool); bool isEnabled() const; @@ -140,7 +136,7 @@ public: protected: void widgetEvent(QEvent *); - void childEvent(QChildEvent *e); + void childEvent(QChildEvent *e) Q_DECL_OVERRIDE; void addChildLayout(QLayout *l); void addChildWidget(QWidget *w); bool adoptLayout(QLayout *layout); diff --git a/src/widgets/kernel/qlayout_p.h b/src/widgets/kernel/qlayout_p.h index 4d6e0c76ad..07cc5de555 100644 --- a/src/widgets/kernel/qlayout_p.h +++ b/src/widgets/kernel/qlayout_p.h @@ -1,7 +1,7 @@ /**************************************************************************** ** -** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ ** ** This file is part of the QtWidgets module of the Qt Toolkit. ** @@ -10,9 +10,9 @@ ** 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 Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. +** 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 @@ -23,8 +23,8 @@ ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ** $QT_END_LICENSE$ diff --git a/src/widgets/kernel/qlayoutengine.cpp b/src/widgets/kernel/qlayoutengine.cpp index a134d3a3ef..ae10b84e81 100644 --- a/src/widgets/kernel/qlayoutengine.cpp +++ b/src/widgets/kernel/qlayoutengine.cpp @@ -1,7 +1,7 @@ /**************************************************************************** ** -** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ ** ** This file is part of the QtWidgets module of the Qt Toolkit. ** @@ -10,9 +10,9 @@ ** 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 Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. +** 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 @@ -23,8 +23,8 @@ ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ** $QT_END_LICENSE$ @@ -37,7 +37,7 @@ #include "qvector.h" #include "qwidget.h" -#include <qlist.h> +#include <qvarlengtharray.h> #include <qdebug.h> #include <algorithm> @@ -121,12 +121,13 @@ void qGeomCalc(QVector<QLayoutStruct> &chain, int start, int count, sumSpacing = spacer * spacerCount; } - QList<int> list; + QVarLengthArray<int, 32> minimumSizes; + minimumSizes.reserve(count); for (i = start; i < start + count; i++) - list << chain.at(i).minimumSize; + minimumSizes << chain.at(i).minimumSize; - std::sort(list.begin(), list.end()); + std::sort(minimumSizes.begin(), minimumSizes.end()); int space_left = space - sumSpacing; @@ -135,7 +136,7 @@ void qGeomCalc(QVector<QLayoutStruct> &chain, int start, int count, int space_used=0; int current = 0; while (idx < count && space_used < space_left) { - current = list.at(idx); + current = minimumSizes.at(idx); space_used = sum + current * (count - idx); sum += current; ++idx; diff --git a/src/widgets/kernel/qlayoutengine_p.h b/src/widgets/kernel/qlayoutengine_p.h index 98bfa9c4a7..f0a3a66f9a 100644 --- a/src/widgets/kernel/qlayoutengine_p.h +++ b/src/widgets/kernel/qlayoutengine_p.h @@ -1,7 +1,7 @@ /**************************************************************************** ** -** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ ** ** This file is part of the QtWidgets module of the Qt Toolkit. ** @@ -10,9 +10,9 @@ ** 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 Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. +** 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 @@ -23,8 +23,8 @@ ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ** $QT_END_LICENSE$ @@ -76,9 +76,9 @@ struct QLayoutStruct int sizeHint; int maximumSize; int minimumSize; + int spacing; bool expansive; bool empty; - int spacing; // temporary storage bool done; diff --git a/src/widgets/kernel/qlayoutitem.cpp b/src/widgets/kernel/qlayoutitem.cpp index e30e1f0724..f195ac81c9 100644 --- a/src/widgets/kernel/qlayoutitem.cpp +++ b/src/widgets/kernel/qlayoutitem.cpp @@ -1,7 +1,7 @@ /**************************************************************************** ** -** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ ** ** This file is part of the QtWidgets module of the Qt Toolkit. ** @@ -10,9 +10,9 @@ ** 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 Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. +** 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 @@ -23,8 +23,8 @@ ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ** $QT_END_LICENSE$ diff --git a/src/widgets/kernel/qlayoutitem.h b/src/widgets/kernel/qlayoutitem.h index c5137b3fb8..7de94852e6 100644 --- a/src/widgets/kernel/qlayoutitem.h +++ b/src/widgets/kernel/qlayoutitem.h @@ -1,7 +1,7 @@ /**************************************************************************** ** -** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ ** ** This file is part of the QtWidgets module of the Qt Toolkit. ** @@ -10,9 +10,9 @@ ** 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 Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. +** 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 @@ -23,8 +23,8 @@ ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ** $QT_END_LICENSE$ diff --git a/src/widgets/kernel/qmacgesturerecognizer.cpp b/src/widgets/kernel/qmacgesturerecognizer.cpp index 3b88eb6054..47003f5866 100644 --- a/src/widgets/kernel/qmacgesturerecognizer.cpp +++ b/src/widgets/kernel/qmacgesturerecognizer.cpp @@ -1,7 +1,7 @@ /**************************************************************************** ** -** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ ** ** This file is part of the QtWidgets module of the Qt Toolkit. ** @@ -10,9 +10,9 @@ ** 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 Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. +** 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 @@ -23,8 +23,8 @@ ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ** $QT_END_LICENSE$ diff --git a/src/widgets/kernel/qmacgesturerecognizer_p.h b/src/widgets/kernel/qmacgesturerecognizer_p.h index 86a0dc3d3a..81b8242315 100644 --- a/src/widgets/kernel/qmacgesturerecognizer_p.h +++ b/src/widgets/kernel/qmacgesturerecognizer_p.h @@ -1,7 +1,7 @@ /**************************************************************************** ** -** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ ** ** This file is part of the QtWidgets module of the Qt Toolkit. ** @@ -10,9 +10,9 @@ ** 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 Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. +** 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 @@ -23,8 +23,8 @@ ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ** $QT_END_LICENSE$ diff --git a/src/widgets/kernel/qopenglwidget.cpp b/src/widgets/kernel/qopenglwidget.cpp index 12e054626c..f63685c37a 100644 --- a/src/widgets/kernel/qopenglwidget.cpp +++ b/src/widgets/kernel/qopenglwidget.cpp @@ -1,7 +1,7 @@ /**************************************************************************** ** -** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ ** ** This file is part of the QtWidgets module of the Qt Toolkit. ** @@ -10,9 +10,9 @@ ** 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 Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. +** 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 @@ -23,8 +23,8 @@ ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ** $QT_END_LICENSE$ @@ -420,10 +420,25 @@ QT_BEGIN_NAMESPACE the intention is to have a semi-transparent window. In that case the traditional approach of setting Qt::WA_TranslucentBackground is sufficient. + QOpenGLWidget supports multiple update behaviors, just like QOpenGLWindow. In + preserved mode the rendered content from the previous paintGL() call is + available in the next one, allowing incremental rendering. In non-preserved + mode the content is lost and paintGL() implementations are expected to redraw + everything in the view. + + Before Qt 5.5 the default behavior of QOpenGLWidget was to preserve the + rendered contents between paintGL() calls. Since Qt 5.5 the default behavior + is non-preserved because this provides better performance and the majority of + applications have no need for the previous content. This also resembles the + semantics of an OpenGL-based QWindow and matches the default behavior of + QOpenGLWindow in that the color and ancillary buffers are invalidated for + each frame. To restore the preserved behavior, call setUpdateBehavior() with + \c PartialUpdate. + \e{OpenGL is a trademark of Silicon Graphics, Inc. in the United States and other countries.} - \sa QOpenGLFunctions, QOpenGLWindow, Qt::AA_ShareOpenGLContexts + \sa QOpenGLFunctions, QOpenGLWindow, Qt::AA_ShareOpenGLContexts, UpdateBehavior */ /*! @@ -455,6 +470,30 @@ QT_BEGIN_NAMESPACE due to resizing the widget. */ +/*! + \enum QOpenGLWidget::UpdateBehavior + \since 5.5 + + This enum describes the update semantics of QOpenGLWidget. + + \value NoPartialUpdate QOpenGLWidget will discard the + contents of the color buffer and the ancillary buffers after the + QOpenGLWidget is rendered to screen. This is the same behavior that can be + expected by calling QOpenGLContext::swapBuffers with a default opengl + enabled QWindow as the argument. NoPartialUpdate can have some performance + benefits on certain hardware architectures common in the mobile and + embedded space when a framebuffer object is used as the rendering target. + The framebuffer object is invalidated between frames with + glDiscardFramebufferEXT if supported or a glClear. Please see the + documentation of EXT_discard_framebuffer for more information: + https://www.khronos.org/registry/gles/extensions/EXT/EXT_discard_framebuffer.txt + + \value PartialUpdate The framebuffer objects color buffer and ancillary + buffers are not invalidated between frames. + + \sa updateBehavior(), setUpdateBehavior() +*/ + class QOpenGLWidgetPaintDevicePrivate : public QOpenGLPaintDevicePrivate { public: @@ -486,9 +525,11 @@ public: surface(0), initialized(false), fakeHidden(false), - paintDevice(0), inBackingStorePaint(false), - flushPending(false) + hasBeenComposed(false), + flushPending(false), + paintDevice(0), + updateBehavior(QOpenGLWidget::NoPartialUpdate) { requestedFormat = QSurfaceFormat::defaultFormat(); } @@ -507,6 +548,8 @@ public: void invokeUserPaint(); void render(); + void invalidateFbo(); + QImage grabFramebuffer() Q_DECL_OVERRIDE; void beginBackingStorePainting() Q_DECL_OVERRIDE { inBackingStorePaint = true; } void endBackingStorePainting() Q_DECL_OVERRIDE { inBackingStorePaint = false; } @@ -522,10 +565,12 @@ public: QOffscreenSurface *surface; bool initialized; bool fakeHidden; - QOpenGLPaintDevice *paintDevice; bool inBackingStorePaint; - QSurfaceFormat requestedFormat; + bool hasBeenComposed; bool flushPending; + QOpenGLPaintDevice *paintDevice; + QSurfaceFormat requestedFormat; + QOpenGLWidget::UpdateBehavior updateBehavior; }; void QOpenGLWidgetPaintDevicePrivate::beginPaint() @@ -648,6 +693,7 @@ void QOpenGLWidgetPrivate::beginCompose() q->makeCurrent(); context->functions()->glFlush(); } + hasBeenComposed = true; emit q->aboutToCompose(); } @@ -743,9 +789,31 @@ void QOpenGLWidgetPrivate::render() return; q->makeCurrent(); + + if (updateBehavior == QOpenGLWidget::NoPartialUpdate && hasBeenComposed) { + invalidateFbo(); + hasBeenComposed = false; + } + invokeUserPaint(); } +void QOpenGLWidgetPrivate::invalidateFbo() +{ + QOpenGLExtensions *f = static_cast<QOpenGLExtensions *>(QOpenGLContext::currentContext()->functions()); + if (f->hasOpenGLExtension(QOpenGLExtensions::DiscardFramebuffer)) { + const int gl_color_attachment0 = 0x8CE0; // GL_COLOR_ATTACHMENT0 + const int gl_depth_attachment = 0x8D00; // GL_DEPTH_ATTACHMENT + const int gl_stencil_attachment = 0x8D20; // GL_STENCIL_ATTACHMENT + const GLenum attachments[] = { + gl_color_attachment0, gl_depth_attachment, gl_stencil_attachment + }; + f->glDiscardFramebufferEXT(GL_FRAMEBUFFER, sizeof attachments / sizeof *attachments, attachments); + } else { + f->glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT); + } +} + extern Q_GUI_EXPORT QImage qt_gl_read_framebuffer(const QSize &size, bool alpha_format, bool include_alpha); QImage QOpenGLWidgetPrivate::grabFramebuffer() @@ -795,10 +863,45 @@ QOpenGLWidget::QOpenGLWidget(QWidget *parent, Qt::WindowFlags f) } /*! - Destroys the widget - */ + Destroys the QOpenGLWidget instance, freeing its resources. + + The QOpenGLWidget's context is made current in the destructor, allowing for + safe destruction of any child object that may need to release OpenGL + resources belonging to the context provided by this widget. + + \warning if you have objects wrapping OpenGL resources (such as + QOpenGLBuffer, QOpenGLShaderProgram, etc.) as members of a OpenGLWidget + subclass, you may need to add a call to makeCurrent() in that subclass' + destructor as well. Due to the rules of C++ object destruction, those objects + will be destroyed \e{before} calling this function (but after that the + destructor of the subclass has run), therefore making the OpenGL context + current in this function happens too late for their safe disposal. + + \sa makeCurrent +*/ QOpenGLWidget::~QOpenGLWidget() { + makeCurrent(); +} + +/*! + Sets this widget's update behavior to \a updateBehavior. + \since 5.5 +*/ +void QOpenGLWidget::setUpdateBehavior(UpdateBehavior updateBehavior) +{ + Q_D(QOpenGLWidget); + d->updateBehavior = updateBehavior; +} + +/*! + \return the update behavior of the widget. + \since 5.5 +*/ +QOpenGLWidget::UpdateBehavior QOpenGLWidget::updateBehavior() const +{ + Q_D(const QOpenGLWidget); + return d->updateBehavior; } /*! @@ -877,10 +980,8 @@ bool QOpenGLWidget::isValid() const void QOpenGLWidget::makeCurrent() { Q_D(QOpenGLWidget); - if (!d->initialized) { - qWarning("QOpenGLWidget: Cannot make uninitialized widget current"); + if (!d->initialized) return; - } d->context->makeCurrent(d->surface); diff --git a/src/widgets/kernel/qopenglwidget.h b/src/widgets/kernel/qopenglwidget.h index 2439fe65ce..4a9edb8180 100644 --- a/src/widgets/kernel/qopenglwidget.h +++ b/src/widgets/kernel/qopenglwidget.h @@ -1,7 +1,7 @@ /**************************************************************************** ** -** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ ** ** This file is part of the QtWidgets module of the Qt Toolkit. ** @@ -10,9 +10,9 @@ ** 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 Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. +** 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 @@ -23,8 +23,8 @@ ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ** $QT_END_LICENSE$ @@ -52,9 +52,17 @@ class Q_WIDGETS_EXPORT QOpenGLWidget : public QWidget Q_DECLARE_PRIVATE(QOpenGLWidget) public: + enum UpdateBehavior { + NoPartialUpdate, + PartialUpdate + }; + explicit QOpenGLWidget(QWidget* parent = 0, Qt::WindowFlags f = 0); ~QOpenGLWidget(); + void setUpdateBehavior(UpdateBehavior updateBehavior); + UpdateBehavior updateBehavior() const; + void setFormat(const QSurfaceFormat &format); QSurfaceFormat format() const; diff --git a/src/widgets/kernel/qshortcut.cpp b/src/widgets/kernel/qshortcut.cpp index 3349b45467..c4326aaa5a 100644 --- a/src/widgets/kernel/qshortcut.cpp +++ b/src/widgets/kernel/qshortcut.cpp @@ -1,7 +1,7 @@ /**************************************************************************** ** -** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ ** ** This file is part of the QtWidgets module of the Qt Toolkit. ** @@ -10,9 +10,9 @@ ** 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 Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. +** 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 @@ -23,8 +23,8 @@ ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ** $QT_END_LICENSE$ diff --git a/src/widgets/kernel/qshortcut.h b/src/widgets/kernel/qshortcut.h index 86db4bcdab..9171f855ba 100644 --- a/src/widgets/kernel/qshortcut.h +++ b/src/widgets/kernel/qshortcut.h @@ -1,7 +1,7 @@ /**************************************************************************** ** -** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ ** ** This file is part of the QtWidgets module of the Qt Toolkit. ** @@ -10,9 +10,9 @@ ** 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 Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. +** 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 @@ -23,8 +23,8 @@ ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ** $QT_END_LICENSE$ @@ -84,7 +84,7 @@ Q_SIGNALS: void activatedAmbiguously(); protected: - bool event(QEvent *e); + bool event(QEvent *e) Q_DECL_OVERRIDE; }; #endif // QT_NO_SHORTCUT diff --git a/src/widgets/kernel/qsizepolicy.h b/src/widgets/kernel/qsizepolicy.h index 41adf5c58a..2376a2c644 100644 --- a/src/widgets/kernel/qsizepolicy.h +++ b/src/widgets/kernel/qsizepolicy.h @@ -1,7 +1,7 @@ /**************************************************************************** ** -** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ ** ** This file is part of the QtWidgets module of the Qt Toolkit. ** @@ -10,9 +10,9 @@ ** 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 Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. +** 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 @@ -23,8 +23,8 @@ ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ** $QT_END_LICENSE$ @@ -44,7 +44,7 @@ class QVariant; class Q_WIDGETS_EXPORT QSizePolicy { Q_GADGET - Q_ENUMS(Policy) + Q_FLAGS(ControlTypes) public: enum PolicyFlag { @@ -63,6 +63,7 @@ public: Expanding = GrowFlag | ShrinkFlag | ExpandFlag, Ignored = ShrinkFlag | GrowFlag | IgnoreFlag }; + Q_ENUM(Policy) enum ControlType { DefaultType = 0x00000001, @@ -100,12 +101,8 @@ public: void setControlType(ControlType type); Qt::Orientations expandingDirections() const { - Qt::Orientations result; - if (verticalPolicy() & ExpandFlag) - result |= Qt::Vertical; - if (horizontalPolicy() & ExpandFlag) - result |= Qt::Horizontal; - return result; + return ( (verticalPolicy() & ExpandFlag) ? Qt::Vertical : Qt::Orientations() ) + | ( (horizontalPolicy() & ExpandFlag) ? Qt::Horizontal : Qt::Orientations() ) ; } void setHeightForWidth(bool b) { bits.hfw = b; } diff --git a/src/widgets/kernel/qsizepolicy.qdoc b/src/widgets/kernel/qsizepolicy.qdoc index d82f3837f2..e84412bc46 100644 --- a/src/widgets/kernel/qsizepolicy.qdoc +++ b/src/widgets/kernel/qsizepolicy.qdoc @@ -1,7 +1,7 @@ /**************************************************************************** ** -** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ ** ** This file is part of the documentation of the Qt Toolkit. ** @@ -10,15 +10,15 @@ ** 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 Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. +** 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 +** 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$ diff --git a/src/widgets/kernel/qstackedlayout.cpp b/src/widgets/kernel/qstackedlayout.cpp index d9a7745686..957b6f09b5 100644 --- a/src/widgets/kernel/qstackedlayout.cpp +++ b/src/widgets/kernel/qstackedlayout.cpp @@ -1,7 +1,7 @@ /**************************************************************************** ** -** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ ** ** This file is part of the QtWidgets module of the Qt Toolkit. ** @@ -10,9 +10,9 @@ ** 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 Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. +** 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 @@ -23,8 +23,8 @@ ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ** $QT_END_LICENSE$ @@ -140,11 +140,6 @@ QLayoutItem* QStackedLayoutPrivate::replaceAt(int idx, QLayoutItem *newitem) */ /*! - \fn QWidget *QStackedLayout::widget() - \internal -*/ - -/*! Constructs a QStackedLayout with no parent. This QStackedLayout must be installed on a widget later on to diff --git a/src/widgets/kernel/qstackedlayout.h b/src/widgets/kernel/qstackedlayout.h index b715f02069..dcd1c94295 100644 --- a/src/widgets/kernel/qstackedlayout.h +++ b/src/widgets/kernel/qstackedlayout.h @@ -1,7 +1,7 @@ /**************************************************************************** ** -** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ ** ** This file is part of the QtWidgets module of the Qt Toolkit. ** @@ -10,9 +10,9 @@ ** 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 Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. +** 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 @@ -23,8 +23,8 @@ ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ** $QT_END_LICENSE$ @@ -45,7 +45,6 @@ class Q_WIDGETS_EXPORT QStackedLayout : public QLayout { Q_OBJECT Q_DECLARE_PRIVATE(QStackedLayout) - Q_ENUMS(StackingMode) Q_PROPERTY(int currentIndex READ currentIndex WRITE setCurrentIndex NOTIFY currentChanged) Q_PROPERTY(StackingMode stackingMode READ stackingMode WRITE setStackingMode) QDOC_PROPERTY(int count READ count) @@ -55,6 +54,7 @@ public: StackOne, StackAll }; + Q_ENUM(StackingMode) QStackedLayout(); explicit QStackedLayout(QWidget *parent); @@ -66,26 +66,22 @@ public: QWidget *currentWidget() const; int currentIndex() const; -#ifdef Q_NO_USING_KEYWORD - inline QWidget *widget() { return QLayout::widget(); } -#else using QLayout::widget; -#endif QWidget *widget(int) const; - int count() const; + int count() const Q_DECL_OVERRIDE; StackingMode stackingMode() const; void setStackingMode(StackingMode stackingMode); // abstract virtual functions: - void addItem(QLayoutItem *item); - QSize sizeHint() const; - QSize minimumSize() const; - QLayoutItem *itemAt(int) const; - QLayoutItem *takeAt(int); - void setGeometry(const QRect &rect); - bool hasHeightForWidth() const; - int heightForWidth(int width) const; + void addItem(QLayoutItem *item) Q_DECL_OVERRIDE; + QSize sizeHint() const Q_DECL_OVERRIDE; + QSize minimumSize() const Q_DECL_OVERRIDE; + QLayoutItem *itemAt(int) const Q_DECL_OVERRIDE; + QLayoutItem *takeAt(int) Q_DECL_OVERRIDE; + void setGeometry(const QRect &rect) Q_DECL_OVERRIDE; + bool hasHeightForWidth() const Q_DECL_OVERRIDE; + int heightForWidth(int width) const Q_DECL_OVERRIDE; Q_SIGNALS: void widgetRemoved(int index); diff --git a/src/widgets/kernel/qstandardgestures.cpp b/src/widgets/kernel/qstandardgestures.cpp index 6656903e70..cf9ac52de3 100644 --- a/src/widgets/kernel/qstandardgestures.cpp +++ b/src/widgets/kernel/qstandardgestures.cpp @@ -1,7 +1,7 @@ /**************************************************************************** ** -** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ ** ** This file is part of the QtWidgets module of the Qt Toolkit. ** @@ -10,9 +10,9 @@ ** 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 Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. +** 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 @@ -23,8 +23,8 @@ ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ** $QT_END_LICENSE$ diff --git a/src/widgets/kernel/qstandardgestures_p.h b/src/widgets/kernel/qstandardgestures_p.h index 15ba31f26a..e4e3f1f47f 100644 --- a/src/widgets/kernel/qstandardgestures_p.h +++ b/src/widgets/kernel/qstandardgestures_p.h @@ -1,7 +1,7 @@ /**************************************************************************** ** -** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ ** ** This file is part of the QtWidgets module of the Qt Toolkit. ** @@ -10,9 +10,9 @@ ** 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 Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. +** 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 @@ -23,8 +23,8 @@ ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ** $QT_END_LICENSE$ @@ -57,9 +57,9 @@ class QPanGestureRecognizer : public QGestureRecognizer public: explicit QPanGestureRecognizer(int pointCount = 2) : m_pointCount(pointCount) {} - QGesture *create(QObject *target); - QGestureRecognizer::Result recognize(QGesture *state, QObject *watched, QEvent *event); - void reset(QGesture *state); + QGesture *create(QObject *target) Q_DECL_OVERRIDE; + QGestureRecognizer::Result recognize(QGesture *state, QObject *watched, QEvent *event) Q_DECL_OVERRIDE; + void reset(QGesture *state) Q_DECL_OVERRIDE; private: const int m_pointCount; @@ -70,9 +70,9 @@ class QPinchGestureRecognizer : public QGestureRecognizer public: QPinchGestureRecognizer(); - QGesture *create(QObject *target); - QGestureRecognizer::Result recognize(QGesture *state, QObject *watched, QEvent *event); - void reset(QGesture *state); + QGesture *create(QObject *target) Q_DECL_OVERRIDE; + QGestureRecognizer::Result recognize(QGesture *state, QObject *watched, QEvent *event) Q_DECL_OVERRIDE; + void reset(QGesture *state) Q_DECL_OVERRIDE; }; class QSwipeGestureRecognizer : public QGestureRecognizer @@ -80,9 +80,9 @@ class QSwipeGestureRecognizer : public QGestureRecognizer public: QSwipeGestureRecognizer(); - QGesture *create(QObject *target); - QGestureRecognizer::Result recognize(QGesture *state, QObject *watched, QEvent *event); - void reset(QGesture *state); + QGesture *create(QObject *target) Q_DECL_OVERRIDE; + QGestureRecognizer::Result recognize(QGesture *state, QObject *watched, QEvent *event) Q_DECL_OVERRIDE; + void reset(QGesture *state) Q_DECL_OVERRIDE; }; class QTapGestureRecognizer : public QGestureRecognizer @@ -90,9 +90,9 @@ class QTapGestureRecognizer : public QGestureRecognizer public: QTapGestureRecognizer(); - QGesture *create(QObject *target); - QGestureRecognizer::Result recognize(QGesture *state, QObject *watched, QEvent *event); - void reset(QGesture *state); + QGesture *create(QObject *target) Q_DECL_OVERRIDE; + QGestureRecognizer::Result recognize(QGesture *state, QObject *watched, QEvent *event) Q_DECL_OVERRIDE; + void reset(QGesture *state) Q_DECL_OVERRIDE; }; class QTapAndHoldGestureRecognizer : public QGestureRecognizer @@ -100,9 +100,9 @@ class QTapAndHoldGestureRecognizer : public QGestureRecognizer public: QTapAndHoldGestureRecognizer(); - QGesture *create(QObject *target); - QGestureRecognizer::Result recognize(QGesture *state, QObject *watched, QEvent *event); - void reset(QGesture *state); + QGesture *create(QObject *target) Q_DECL_OVERRIDE; + QGestureRecognizer::Result recognize(QGesture *state, QObject *watched, QEvent *event) Q_DECL_OVERRIDE; + void reset(QGesture *state) Q_DECL_OVERRIDE; }; QT_END_NAMESPACE diff --git a/src/widgets/kernel/qt_widgets_pch.h b/src/widgets/kernel/qt_widgets_pch.h index 08a49005de..324d21baab 100644 --- a/src/widgets/kernel/qt_widgets_pch.h +++ b/src/widgets/kernel/qt_widgets_pch.h @@ -1,7 +1,7 @@ /**************************************************************************** ** -** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ ** ** This file is part of the QtWidgets module of the Qt Toolkit. ** @@ -10,9 +10,9 @@ ** 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 Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. +** 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 @@ -23,8 +23,8 @@ ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ** $QT_END_LICENSE$ @@ -44,7 +44,7 @@ #include <qglobal.h> -#ifdef Q_WS_WIN +#ifdef Q_DEAD_CODE_FROM_QT4_WIN # define _POSIX_ # include <limits.h> # undef _POSIX_ diff --git a/src/widgets/kernel/qtooltip.cpp b/src/widgets/kernel/qtooltip.cpp index 7fcc5d3bc6..8a800ab9d0 100644 --- a/src/widgets/kernel/qtooltip.cpp +++ b/src/widgets/kernel/qtooltip.cpp @@ -1,7 +1,7 @@ /**************************************************************************** ** -** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ ** ** This file is part of the QtWidgets module of the Qt Toolkit. ** @@ -10,9 +10,9 @@ ** 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 Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. +** 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 @@ -23,14 +23,14 @@ ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ** $QT_END_LICENSE$ ** ****************************************************************************/ -#ifdef Q_WS_MAC +#ifdef Q_DEAD_CODE_FROM_QT4_MAC # include <private/qcore_mac_p.h> #endif @@ -51,7 +51,7 @@ #include <private/qstylesheetstyle_p.h> #ifndef QT_NO_TOOLTIP -#ifdef Q_WS_MAC +#ifdef Q_DEAD_CODE_FROM_QT4_MAC # include <private/qcore_mac_p.h> #include <private/qt_cocoa_helpers_mac_p.h> #endif @@ -116,7 +116,7 @@ public: ~QTipLabel(); static QTipLabel *instance; - bool eventFilter(QObject *, QEvent *); + bool eventFilter(QObject *, QEvent *) Q_DECL_OVERRIDE; QBasicTimer hideTimer, expireTimer; @@ -132,10 +132,10 @@ public: static int getTipScreen(const QPoint &pos, QWidget *w); protected: - void timerEvent(QTimerEvent *e); - void paintEvent(QPaintEvent *e); - void mouseMoveEvent(QMouseEvent *e); - void resizeEvent(QResizeEvent *e); + void timerEvent(QTimerEvent *e) Q_DECL_OVERRIDE; + void paintEvent(QPaintEvent *e) Q_DECL_OVERRIDE; + void mouseMoveEvent(QMouseEvent *e) Q_DECL_OVERRIDE; + void resizeEvent(QResizeEvent *e) Q_DECL_OVERRIDE; #ifndef QT_NO_STYLE_STYLESHEET public slots: @@ -279,7 +279,7 @@ void QTipLabel::timerEvent(QTimerEvent *e) || e->timerId() == expireTimer.timerId()){ hideTimer.stop(); expireTimer.stop(); -#if defined(Q_WS_MAC) && !defined(QT_NO_EFFECTS) +#if defined(Q_DEAD_CODE_FROM_QT4_MAC) && !defined(QT_NO_EFFECTS) if (QApplication::isEffectEnabled(Qt::UI_FadeTooltip)){ // Fade out tip on mac (makes it invisible). // The tip will not be deleted until a new tip is shown. @@ -299,7 +299,7 @@ void QTipLabel::timerEvent(QTimerEvent *e) bool QTipLabel::eventFilter(QObject *o, QEvent *e) { switch (e->type()) { -#ifdef Q_WS_MAC +#ifdef Q_DEAD_CODE_FROM_QT4_MAC case QEvent::KeyPress: case QEvent::KeyRelease: { int key = static_cast<QKeyEvent *>(e)->key(); @@ -380,7 +380,7 @@ void QTipLabel::placeTip(const QPoint &pos, QWidget *w) #endif //QT_NO_STYLE_STYLESHEET -#ifdef Q_WS_MAC +#ifdef Q_DEAD_CODE_FROM_QT4_MAC // When in full screen mode, there is no Dock nor Menu so we can use // the whole screen for displaying the tooltip. However when not in // full screen mode we need to save space for the dock, so we use @@ -397,7 +397,7 @@ void QTipLabel::placeTip(const QPoint &pos, QWidget *w) QPoint p = pos; p += QPoint(2, -#ifdef Q_WS_WIN +#ifdef Q_DEAD_CODE_FROM_QT4_WIN 21 #else 16 @@ -486,7 +486,7 @@ void QToolTip::showText(const QPoint &pos, const QString &text, QWidget *w, cons } if (!text.isEmpty()){ // no tip can be reused, create new tip: -#ifndef Q_WS_WIN +#ifndef Q_DEAD_CODE_FROM_QT4_WIN new QTipLabel(text, w, msecDisplayTime); // sets QTipLabel::instance to itself #else // On windows, we can't use the widget as parent otherwise the window will be @@ -498,7 +498,7 @@ void QToolTip::showText(const QPoint &pos, const QString &text, QWidget *w, cons QTipLabel::instance->setObjectName(QLatin1String("qtooltip_label")); -#if !defined(QT_NO_EFFECTS) && !defined(Q_WS_MAC) +#if !defined(QT_NO_EFFECTS) && !defined(Q_DEAD_CODE_FROM_QT4_MAC) if (QApplication::isEffectEnabled(Qt::UI_FadeTooltip)) qFadeEffect(QTipLabel::instance); else if (QApplication::isEffectEnabled(Qt::UI_AnimateTooltip)) diff --git a/src/widgets/kernel/qtooltip.h b/src/widgets/kernel/qtooltip.h index dd3bce9ddf..286d8fb327 100644 --- a/src/widgets/kernel/qtooltip.h +++ b/src/widgets/kernel/qtooltip.h @@ -1,7 +1,7 @@ /**************************************************************************** ** -** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ ** ** This file is part of the QtWidgets module of the Qt Toolkit. ** @@ -10,9 +10,9 @@ ** 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 Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. +** 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 @@ -23,8 +23,8 @@ ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ** $QT_END_LICENSE$ diff --git a/src/widgets/kernel/qwhatsthis.cpp b/src/widgets/kernel/qwhatsthis.cpp index 632cb242dc..db9e09c8c2 100644 --- a/src/widgets/kernel/qwhatsthis.cpp +++ b/src/widgets/kernel/qwhatsthis.cpp @@ -1,7 +1,7 @@ /**************************************************************************** ** -** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ ** ** This file is part of the QtWidgets module of the Qt Toolkit. ** @@ -10,9 +10,9 @@ ** 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 Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. +** 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 @@ -23,8 +23,8 @@ ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ** $QT_END_LICENSE$ @@ -141,12 +141,12 @@ public: static QWhatsThat *instance; protected: - void showEvent(QShowEvent *e); - void mousePressEvent(QMouseEvent*); - void mouseReleaseEvent(QMouseEvent*); - void mouseMoveEvent(QMouseEvent*); - void keyPressEvent(QKeyEvent*); - void paintEvent(QPaintEvent*); + void showEvent(QShowEvent *e) Q_DECL_OVERRIDE; + void mousePressEvent(QMouseEvent*) Q_DECL_OVERRIDE; + void mouseReleaseEvent(QMouseEvent*) Q_DECL_OVERRIDE; + void mouseMoveEvent(QMouseEvent*) Q_DECL_OVERRIDE; + void keyPressEvent(QKeyEvent*) Q_DECL_OVERRIDE; + void paintEvent(QPaintEvent*) Q_DECL_OVERRIDE; private: QPointer<QWidget>widget; @@ -361,7 +361,7 @@ class QWhatsThisPrivate : public QObject QWhatsThisPrivate(); ~QWhatsThisPrivate(); static QWhatsThisPrivate *instance; - bool eventFilter(QObject *, QEvent *); + bool eventFilter(QObject *, QEvent *) Q_DECL_OVERRIDE; QPointer<QAction> action; static void say(QWidget *, const QString &, int x = 0, int y = 0); static void notifyToplevels(QEvent *e); @@ -567,7 +567,7 @@ void QWhatsThisPrivate::say(QWidget * widget, const QString &text, int x, int y) // make a fresh widget, and set it up QWhatsThat *whatsThat = new QWhatsThat( text, -#if defined(Q_WS_X11) && !defined(QT_NO_CURSOR) +#if defined(Q_DEAD_CODE_FROM_QT4_X11) && !defined(QT_NO_CURSOR) QApplication::desktop()->screen(widget ? widget->x11Info().screen() : QCursor::x11Screen()), #else 0, @@ -580,11 +580,11 @@ void QWhatsThisPrivate::say(QWidget * widget, const QString &text, int x, int y) int scr = (widget ? QApplication::desktop()->screenNumber(widget) : -#if defined(Q_WS_X11) && !defined(QT_NO_CURSOR) +#if defined(Q_DEAD_CODE_FROM_QT4_X11) && !defined(QT_NO_CURSOR) QCursor::x11Screen() #else QApplication::desktop()->screenNumber(QPoint(x,y)) -#endif // Q_WS_X11 +#endif // Q_DEAD_CODE_FROM_QT4_X11 ); QRect screen = QApplication::desktop()->screenGeometry(scr); diff --git a/src/widgets/kernel/qwhatsthis.h b/src/widgets/kernel/qwhatsthis.h index ea0450060f..999c66486c 100644 --- a/src/widgets/kernel/qwhatsthis.h +++ b/src/widgets/kernel/qwhatsthis.h @@ -1,7 +1,7 @@ /**************************************************************************** ** -** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ ** ** This file is part of the QtWidgets module of the Qt Toolkit. ** @@ -10,9 +10,9 @@ ** 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 Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. +** 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 @@ -23,8 +23,8 @@ ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ** $QT_END_LICENSE$ diff --git a/src/widgets/kernel/qwidget.cpp b/src/widgets/kernel/qwidget.cpp index cb2e9e0bec..65b861bc68 100644 --- a/src/widgets/kernel/qwidget.cpp +++ b/src/widgets/kernel/qwidget.cpp @@ -1,7 +1,7 @@ /**************************************************************************** ** -** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ ** ** This file is part of the QtWidgets module of the Qt Toolkit. ** @@ -10,9 +10,9 @@ ** 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 Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. +** 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 @@ -23,8 +23,8 @@ ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ** $QT_END_LICENSE$ @@ -53,7 +53,7 @@ #ifndef QT_NO_ACCESSIBILITY # include "qaccessible.h" #endif -#ifdef Q_WS_MAC +#ifdef Q_DEAD_CODE_FROM_QT4_MAC # include "qt_mac_p.h" # include "qt_cocoa_helpers_mac_p.h" # include "qmainwindow.h" @@ -76,7 +76,7 @@ #include <private/qgraphicseffect_p.h> #include <qbackingstore.h> #include <private/qwidgetbackingstore_p.h> -#ifdef Q_WS_MAC +#ifdef Q_DEAD_CODE_FROM_QT4_MAC # include <private/qpaintengine_mac_p.h> #endif #include <private/qpaintengine_raster_p.h> @@ -108,7 +108,7 @@ QT_BEGIN_NAMESPACE static bool qt_enable_backingstore = true; -#ifdef Q_WS_X11 +#ifdef Q_DEAD_CODE_FROM_QT4_X11 // for compatibility with Qt 4.0 Q_WIDGETS_EXPORT void qt_x11_set_global_double_buffer(bool enable) { @@ -116,7 +116,7 @@ Q_WIDGETS_EXPORT void qt_x11_set_global_double_buffer(bool enable) } #endif -#ifdef Q_WS_MAC +#ifdef Q_DEAD_CODE_FROM_QT4_MAC bool qt_mac_clearDirtyOnWidgetInsideDrawWidget = false; #endif @@ -131,7 +131,7 @@ static inline bool hasBackingStoreSupport() return true; } -#ifdef Q_WS_MAC +#ifdef Q_DEAD_CODE_FROM_QT4_MAC # define QT_NO_PAINT_DEBUG #endif @@ -272,13 +272,13 @@ QWidgetPrivate::QWidgetPrivate(int version) #if defined(Q_OS_WIN) , noPaintOnScreen(0) #endif -#if defined(Q_WS_X11) +#if defined(Q_DEAD_CODE_FROM_QT4_X11) , picture(0) -#elif defined(Q_WS_WIN) +#elif defined(Q_DEAD_CODE_FROM_QT4_WIN) #ifndef QT_NO_GESTURES , nativeGesturePanEnabled(0) #endif -#elif defined(Q_WS_MAC) +#elif defined(Q_DEAD_CODE_FROM_QT4_MAC) , needWindowChange(0) , window_event(0) , qd_hd(0) @@ -294,7 +294,7 @@ QWidgetPrivate::QWidgetPrivate(int version) isWidget = true; memset(high_attributes, 0, sizeof(high_attributes)); -#ifdef Q_WS_MAC +#ifdef Q_DEAD_CODE_FROM_QT4_MAC drawRectOriginalAdded = false; originalDrawMethod = true; changeMethods = false; @@ -303,7 +303,7 @@ QWidgetPrivate::QWidgetPrivate(int version) toolbar_ancestor = 0; flushRequested = false; touchEventsEnabled = false; -#endif // Q_WS_MAC +#endif // Q_DEAD_CODE_FROM_QT4_MAC #ifdef QWIDGET_EXTRA_DEBUG static int count = 0; qDebug() << "widgets" << ++count; @@ -359,12 +359,12 @@ void QWidgetPrivate::setWSGeometry() void QWidgetPrivate::updateWidgetTransform(QEvent *event) { Q_Q(QWidget); - if (q == qGuiApp->focusObject() || event->type() == QEvent::FocusIn) { + if (q == QGuiApplication::focusObject() || event->type() == QEvent::FocusIn) { QTransform t; QPoint p = q->mapTo(q->topLevelWidget(), QPoint(0,0)); t.translate(p.x(), p.y()); - qApp->inputMethod()->setInputItemTransform(t); - qApp->inputMethod()->setInputItemRectangle(q->rect()); + QGuiApplication::inputMethod()->setInputItemTransform(t); + QGuiApplication::inputMethod()->setInputItemRectangle(q->rect()); } } @@ -1063,7 +1063,7 @@ void QWidgetPrivate::adjustFlags(Qt::WindowFlags &flags, QWidget *w) // Only enable this on non-Mac platforms. Since the old way of doing this would // interpret WindowSystemMenuHint as a close button and we can't change that behavior // we can't just add this in. -#ifndef Q_WS_MAC +#ifndef Q_DEAD_CODE_FROM_QT4_MAC if ((flags & (Qt::WindowMinMaxButtonsHint | Qt::WindowCloseButtonHint | Qt::WindowContextHelpButtonHint)) # ifdef Q_OS_WIN && type != Qt::Dialog // QTBUG-2027, allow for menu-less dialogs. @@ -1127,7 +1127,7 @@ void QWidgetPrivate::init(QWidget *parentWidget, Qt::WindowFlags f) } #endif -#if defined(Q_WS_X11) +#if defined(Q_DEAD_CODE_FROM_QT4_X11) if (desktopWidget) { // make sure the widget is created on the same screen as the // programmer specified desktop widget @@ -1161,7 +1161,7 @@ void QWidgetPrivate::init(QWidget *parentWidget, Qt::WindowFlags f) mustHaveWindowHandle = 1; q->setAttribute(Qt::WA_NativeWindow); } -//#ifdef Q_WS_MAC +//#ifdef Q_DEAD_CODE_FROM_QT4_MAC // q->setAttribute(Qt::WA_NativeWindow); //#endif @@ -1186,9 +1186,9 @@ void QWidgetPrivate::init(QWidget *parentWidget, Qt::WindowFlags f) setOpaque(q->isWindow() && background.style() != Qt::NoBrush && background.isOpaque()); } data.fnt = QFont(data.fnt, q); -#if defined(Q_WS_X11) +#if defined(Q_DEAD_CODE_FROM_QT4_X11) data.fnt.x11SetScreen(xinfo.screen()); -#endif // Q_WS_X11 +#endif // Q_DEAD_CODE_FROM_QT4_X11 q->setAttribute(Qt::WA_PendingMoveEvent); q->setAttribute(Qt::WA_PendingResizeEvent); @@ -1205,7 +1205,7 @@ void QWidgetPrivate::init(QWidget *parentWidget, Qt::WindowFlags f) extraPaintEngine = 0; -#ifdef Q_WS_MAC +#ifdef Q_DEAD_CODE_FROM_QT4_MAC // If we add a child to the unified toolbar, we have to redirect the painting. if (parentWidget && parentWidget->d_func() && parentWidget->d_func()->isInUnifiedToolbar) { if (parentWidget->d_func()->unifiedSurface) { @@ -1213,7 +1213,7 @@ void QWidgetPrivate::init(QWidget *parentWidget, Qt::WindowFlags f) parentWidget->d_func()->unifiedSurface->recursiveRedirect(toolbar, toolbar, toolbar->d_func()->toolbar_offset); } } -#endif // Q_WS_MAC +#endif // Q_DEAD_CODE_FROM_QT4_MAC } @@ -1284,10 +1284,8 @@ void QWidget::create(WId window, bool initializeWindow, bool destroyOldWindow) } - static int paintOnScreenEnv = -1; - if (paintOnScreenEnv == -1) - paintOnScreenEnv = qgetenv("QT_ONSCREEN_PAINT").toInt() > 0 ? 1 : 0; - if (paintOnScreenEnv == 1) + static const bool paintOnScreenEnv = qEnvironmentVariableIntValue("QT_ONSCREEN_PAINT") > 0; + if (paintOnScreenEnv) setAttribute(Qt::WA_PaintOnScreen); if (QApplicationPrivate::testAttribute(Qt::AA_NativeWindows)) @@ -1298,14 +1296,14 @@ void QWidget::create(WId window, bool initializeWindow, bool destroyOldWindow) << "Alien?" << !testAttribute(Qt::WA_NativeWindow); #endif -#if defined (Q_WS_WIN) && !defined(QT_NO_DRAGANDDROP) +#if defined (Q_DEAD_CODE_FROM_QT4_WIN) && !defined(QT_NO_DRAGANDDROP) // Unregister the dropsite (if already registered) before we // re-create the widget with a native window. if (testAttribute(Qt::WA_WState_Created) && !internalWinId() && testAttribute(Qt::WA_NativeWindow) && d->extra && d->extra->dropTarget) { d->registerDropSite(false); } -#endif // defined (Q_WS_WIN) && !defined(QT_NO_DRAGANDDROP) +#endif // defined (Q_DEAD_CODE_FROM_QT4_WIN) && !defined(QT_NO_DRAGANDDROP) d->updateIsOpaque(); @@ -1593,7 +1591,7 @@ QWidget::~QWidget() } } -#if defined(Q_WS_WIN) || defined(Q_WS_X11)|| defined(Q_WS_MAC) +#if defined(Q_DEAD_CODE_FROM_QT4_WIN) || defined(Q_DEAD_CODE_FROM_QT4_X11)|| defined(Q_DEAD_CODE_FROM_QT4_MAC) else if (!internalWinId() && isVisible()) { qApp->d_func()->sendSyntheticEnterLeave(this); } @@ -1637,7 +1635,7 @@ QWidget::~QWidget() d->blockSig = blocked; -#ifdef Q_WS_MAC +#ifdef Q_DEAD_CODE_FROM_QT4_MAC // QCocoaView holds a pointer back to this widget. Clear it now // to make sure it's not followed later on. The lifetime of the // QCocoaView might exceed the lifetime of this widget in cases @@ -1688,7 +1686,7 @@ void QWidgetPrivate::setWinId(WId id) // set widget identifier const WId oldWinId = data.winid; data.winid = id; -#if defined(Q_WS_X11) +#if defined(Q_DEAD_CODE_FROM_QT4_X11) hd = id; // X11: hd == ident #endif if (mapper && id && !userDesktopWidget) { @@ -1724,9 +1722,9 @@ void QWidgetPrivate::createTLExtra() x->window = 0; x->shareContext = 0; x->initialScreenIndex = -1; -#ifdef Q_WS_MAC +#ifdef Q_DEAD_CODE_FROM_QT4_MAC x->wasMaximized = false; -#endif // Q_WS_MAC +#endif // Q_DEAD_CODE_FROM_QT4_MAC #ifdef QWIDGET_EXTRA_DEBUG static int count = 0; qDebug() << "tlextra" << ++count; @@ -2120,14 +2118,14 @@ void QWidgetPrivate::subtractOpaqueSiblings(QRegion &sourceRegion, bool *hasDirt bool alsoNonOpaque) const { Q_Q(const QWidget); - static int disableSubtractOpaqueSiblings = qgetenv("QT_NO_SUBTRACTOPAQUESIBLINGS").toInt(); + static int disableSubtractOpaqueSiblings = qEnvironmentVariableIntValue("QT_NO_SUBTRACTOPAQUESIBLINGS"); if (disableSubtractOpaqueSiblings || q->isWindow()) return; -#ifdef Q_WS_MAC +#ifdef Q_DEAD_CODE_FROM_QT4_MAC if (q->d_func()->isInUnifiedToolbar) return; -#endif // Q_WS_MAC +#endif // Q_DEAD_CODE_FROM_QT4_MAC QRect clipBoundingRect; bool dirtyClipBoundingRect = true; @@ -2261,7 +2259,7 @@ void QWidgetPrivate::updateIsOpaque() #endif //QT_NO_GRAPHICSEFFECT Q_Q(QWidget); -#ifdef Q_WS_X11 +#ifdef Q_DEAD_CODE_FROM_QT4_X11 if (q->testAttribute(Qt::WA_X11OpenGLOverlay)) { setOpaque(false); return; @@ -2320,7 +2318,7 @@ static inline void fillRegion(QPainter *painter, const QRegion &rgn, const QBrus Q_ASSERT(painter); if (brush.style() == Qt::TexturePattern) { -#ifdef Q_WS_MAC +#ifdef Q_DEAD_CODE_FROM_QT4_MAC // Optimize pattern filling on mac by using HITheme directly // when filling with the standard widget background. // Defined in qmacstyle_mac.cpp @@ -2332,7 +2330,7 @@ static inline void fillRegion(QPainter *painter, const QRegion &rgn, const QBrus painter->setClipRegion(rgn); painter->drawTiledPixmap(rect, brush.texture(), rect.topLeft()); } -#endif // Q_WS_MAC +#endif // Q_DEAD_CODE_FROM_QT4_MAC } else if (brush.gradient() && brush.gradient()->coordinateMode() == QGradient::ObjectBoundingMode) { @@ -2404,7 +2402,7 @@ void QWidgetPrivate::paintBackground(QPainter *painter, const QRegion &rgn, int visible widgets. */ -#ifdef Q_WS_MAC +#ifdef Q_DEAD_CODE_FROM_QT4_MAC extern QPointer<QWidget> qt_button_down; #else extern QWidget *qt_button_down; @@ -2691,7 +2689,7 @@ void QWidget::setStyle(QStyle *style) } void QWidgetPrivate::setStyle_helper(QStyle *newStyle, bool propagate, bool -#ifdef Q_WS_MAC +#ifdef Q_DEAD_CODE_FROM_QT4_MAC metalHack #endif ) @@ -2702,7 +2700,7 @@ void QWidgetPrivate::setStyle_helper(QStyle *newStyle, bool propagate, bool QPointer<QStyle> origStyle; #endif -#ifdef Q_WS_MAC +#ifdef Q_DEAD_CODE_FROM_QT4_MAC // the metalhack boolean allows Qt/Mac to do a proper re-polish depending // on how the Qt::WA_MacBrushedMetal attribute is set. It is only ever // set when changing that attribute and passes the widget's CURRENT style. @@ -2722,12 +2720,12 @@ void QWidgetPrivate::setStyle_helper(QStyle *newStyle, bool propagate, bool if (q->windowType() != Qt::Desktop) { if (polished) { oldStyle->unpolish(q); -#ifdef Q_WS_MAC +#ifdef Q_DEAD_CODE_FROM_QT4_MAC if (metalHack) macUpdateMetalAttribute(); #endif q->style()->polish(q); -#ifdef Q_WS_MAC +#ifdef Q_DEAD_CODE_FROM_QT4_MAC } else if (metalHack) { macUpdateMetalAttribute(); #endif @@ -3092,7 +3090,7 @@ bool QWidget::isFullScreen() const */ void QWidget::showFullScreen() { -#ifdef Q_WS_MAC +#ifdef Q_DEAD_CODE_FROM_QT4_MAC // If the unified toolbar is enabled, we have to disable it before going fullscreen. QMainWindow *mainWindow = qobject_cast<QMainWindow*>(this); if (mainWindow && mainWindow->unifiedTitleAndToolBarOnMac()) { @@ -3100,7 +3098,7 @@ void QWidget::showFullScreen() QMainWindowLayout *mainLayout = qobject_cast<QMainWindowLayout*>(mainWindow->layout()); mainLayout->activateUnifiedToolbarAfterFullScreen = true; } -#endif // Q_WS_MAC +#endif // Q_DEAD_CODE_FROM_QT4_MAC ensurePolished(); setWindowState((windowState() & ~(Qt::WindowMinimized | Qt::WindowMaximized)) @@ -3128,7 +3126,7 @@ void QWidget::showMaximized() setWindowState((windowState() & ~(Qt::WindowMinimized | Qt::WindowFullScreen)) | Qt::WindowMaximized); -#ifdef Q_WS_MAC +#ifdef Q_DEAD_CODE_FROM_QT4_MAC // If the unified toolbar was enabled before going fullscreen, we have to enable it back. QMainWindow *mainWindow = qobject_cast<QMainWindow*>(this); if (mainWindow) @@ -3139,7 +3137,7 @@ void QWidget::showMaximized() mainLayout->activateUnifiedToolbarAfterFullScreen = false; } } -#endif // Q_WS_MAC +#endif // Q_DEAD_CODE_FROM_QT4_MAC setVisible(true); } @@ -3157,7 +3155,7 @@ void QWidget::showNormal() setWindowState(windowState() & ~(Qt::WindowMinimized | Qt::WindowMaximized | Qt::WindowFullScreen)); -#ifdef Q_WS_MAC +#ifdef Q_DEAD_CODE_FROM_QT4_MAC // If the unified toolbar was enabled before going fullscreen, we have to enable it back. QMainWindow *mainWindow = qobject_cast<QMainWindow*>(this); if (mainWindow) @@ -3168,7 +3166,7 @@ void QWidget::showNormal() mainLayout->activateUnifiedToolbarAfterFullScreen = false; } } -#endif // Q_WS_MAC +#endif // Q_DEAD_CODE_FROM_QT4_MAC setVisible(true); } @@ -3229,7 +3227,11 @@ void QWidget::addAction(QAction *action) \sa removeAction(), QMenu, addAction() */ +#if QT_VERSION >= QT_VERSION_CHECK(6,0,0) +void QWidget::addActions(const QList<QAction *> &actions) +#else void QWidget::addActions(QList<QAction*> actions) +#endif { for(int i = 0; i < actions.count(); i++) insertAction(0, actions.at(i)); @@ -3376,7 +3378,7 @@ void QWidgetPrivate::setEnabled_helper(bool enable) if (w && !w->testAttribute(attribute)) w->d_func()->setEnabled_helper(enable); } -#if defined(Q_WS_X11) +#if defined(Q_DEAD_CODE_FROM_QT4_X11) if (q->testAttribute(Qt::WA_SetCursor) || q->isWindow()) { // enforce the windows behavior of clearing the cursor on // disabled widgets @@ -3390,7 +3392,7 @@ void QWidgetPrivate::setEnabled_helper(bool enable) qt_qpa_set_cursor(q, false); } #endif -#if defined(Q_WS_MAC) +#if defined(Q_DEAD_CODE_FROM_QT4_MAC) setEnabled_helper_sys(enable); #endif #ifndef QT_NO_IM @@ -3399,10 +3401,10 @@ void QWidgetPrivate::setEnabled_helper(bool enable) if (enable) { if (focusWidget->testAttribute(Qt::WA_InputMethodEnabled)) - qApp->inputMethod()->update(Qt::ImEnabled); + QGuiApplication::inputMethod()->update(Qt::ImEnabled); } else { - qApp->inputMethod()->commit(); - qApp->inputMethod()->update(Qt::ImEnabled); + QGuiApplication::inputMethod()->commit(); + QGuiApplication::inputMethod()->update(Qt::ImEnabled); } } #endif //QT_NO_IM @@ -4494,7 +4496,7 @@ const QPalette &QWidget::palette() const ) { data->pal.setCurrentColorGroup(QPalette::Active); } else { -#ifdef Q_WS_MAC +#ifdef Q_DEAD_CODE_FROM_QT4_MAC extern bool qt_mac_can_clickThrough(const QWidget *); //qwidget_mac.cpp if (qt_mac_can_clickThrough(this)) data->pal.setCurrentColorGroup(QPalette::Active); @@ -4738,7 +4740,7 @@ void QWidgetPrivate::updateFont(const QFont &font) #endif data.fnt = QFont(font, q); -#if defined(Q_WS_X11) +#if defined(Q_DEAD_CODE_FROM_QT4_X11) // make sure the font set on this widget is associated with the correct screen data.fnt.x11SetScreen(xinfo.screen()); #endif @@ -4911,7 +4913,7 @@ void QWidget::setCursor(const QCursor &cursor) { Q_D(QWidget); // On Mac we must set the cursor even if it is the ArrowCursor. -#if !defined(Q_WS_MAC) +#if !defined(Q_DEAD_CODE_FROM_QT4_MAC) if (cursor.shape() != Qt::ArrowCursor || (d->extra && d->extra->curs)) #endif @@ -5339,7 +5341,7 @@ void QWidgetPrivate::render_helper(QPainter *painter, const QPoint &targetOffset Q_ASSERT(!toBePainted.isEmpty()); Q_Q(QWidget); -#ifndef Q_WS_MAC +#ifndef Q_DEAD_CODE_FROM_QT4_MAC const QTransform originalTransform = painter->worldTransform(); const bool useDeviceCoordinates = originalTransform.isScaling(); if (!useDeviceCoordinates) { @@ -5363,7 +5365,7 @@ void QWidgetPrivate::render_helper(QPainter *painter, const QPoint &targetOffset if (restore) painter->setRenderHints(QPainter::SmoothPixmapTransform, false); -#ifndef Q_WS_MAC +#ifndef Q_DEAD_CODE_FROM_QT4_MAC } else { // Render via a pixmap in device coordinates (to avoid pixmap scaling). QTransform transform = originalTransform; @@ -5472,7 +5474,7 @@ void QWidgetPrivate::drawWidget(QPaintDevice *pdev, const QRegion &rgn, const QP if (paintEngine) { setRedirected(pdev, -offset); -#ifdef Q_WS_MAC +#ifdef Q_DEAD_CODE_FROM_QT4_MAC // (Alien support) Special case for Mac when redirecting: If the paint device // is of the Widget type we need to set WA_WState_InPaintEvent since painting // outside the paint event is not supported on QWidgets. The attributeis @@ -5549,12 +5551,12 @@ void QWidgetPrivate::drawWidget(QPaintDevice *pdev, const QRegion &rgn, const QP } // Native widgets need to be marked dirty on screen so painting will be done in correct context - if (backingStore && !onScreen && !asRoot && (q->internalWinId() || !q->nativeParentWidget()->isWindow())) + if (backingStore && !onScreen && !asRoot && (q->internalWinId() || (q->nativeParentWidget() && !q->nativeParentWidget()->isWindow()))) backingStore->markDirtyOnScreen(toBePainted, q, offset); //restore if (paintEngine) { -#ifdef Q_WS_MAC +#ifdef Q_DEAD_CODE_FROM_QT4_MAC if (pdev->devType() == QInternal::Widget) static_cast<QWidget *>(pdev)->setAttribute(Qt::WA_WState_InPaintEvent, false); #endif @@ -5628,7 +5630,7 @@ void QWidgetPrivate::render(QPaintDevice *target, const QPoint &targetOffset, if (paintRegion.isEmpty()) return; -#ifndef Q_WS_MAC +#ifndef Q_DEAD_CODE_FROM_QT4_MAC QPainter *oldSharedPainter = inRenderWithPainter ? sharedPainter() : 0; // Use the target's shared painter if set (typically set when doing @@ -6247,7 +6249,7 @@ QString QWidget::windowRole() const */ void QWidget::setWindowRole(const QString &role) { -#if defined(Q_WS_X11) +#if defined(Q_DEAD_CODE_FROM_QT4_X11) Q_D(QWidget); d->topData()->role = role; d->setWindowRole(); @@ -6389,7 +6391,7 @@ void QWidget::setFocus(Qt::FocusReason reason) f = f->d_func()->extra->focus_proxy; if (QApplication::focusWidget() == f -#if defined(Q_WS_WIN) +#if defined(Q_DEAD_CODE_FROM_QT4_WIN) && GetFocus() == f->internalWinId() #endif ) @@ -6425,7 +6427,7 @@ void QWidget::setFocus(Qt::FocusReason reason) if (prev) { if (reason != Qt::PopupFocusReason && reason != Qt::MenuBarFocusReason && prev->testAttribute(Qt::WA_InputMethodEnabled)) { - qApp->inputMethod()->commit(); + QGuiApplication::inputMethod()->commit(); } if (reason != Qt::NoFocusReason) { @@ -6548,7 +6550,7 @@ void QWidget::clearFocus() { if (hasFocus()) { if (testAttribute(Qt::WA_InputMethodEnabled)) - qApp->inputMethod()->commit(); + QGuiApplication::inputMethod()->commit(); QFocusEvent focusAboutToChange(QEvent::FocusAboutToChange); QApplication::sendEvent(this, &focusAboutToChange); @@ -6574,7 +6576,7 @@ void QWidget::clearFocus() if (hasFocus()) { // Update proxy state QApplicationPrivate::setFocusWidget(0, Qt::OtherFocusReason); -#if defined(Q_WS_WIN) +#if defined(Q_DEAD_CODE_FROM_QT4_WIN) if (!(windowType() == Qt::Popup) && GetFocus() == internalWinId()) SetFocus(0); else @@ -7204,7 +7206,7 @@ void QWidgetPrivate::setGeometry_sys(int x, int y, int w, int h, bool isMove) */ QByteArray QWidget::saveGeometry() const { -#ifdef Q_WS_MAC +#ifdef Q_DEAD_CODE_FROM_QT4_MAC // We check if the window was maximized during this invocation. If so, we need to record the // starting position as 0,0. Q_D(const QWidget); @@ -7215,7 +7217,7 @@ QByteArray QWidget::saveGeometry() const newFramePosition.moveTo(0, 0); newNormalPosition.moveTo(0, 0); } -#endif // Q_WS_MAC +#endif // Q_DEAD_CODE_FROM_QT4_MAC QByteArray array; QDataStream stream(&array, QIODevice::WriteOnly); stream.setVersion(QDataStream::Qt_4_0); @@ -7229,13 +7231,13 @@ QByteArray QWidget::saveGeometry() const stream << magicNumber << majorVersion << minorVersion -#ifdef Q_WS_MAC +#ifdef Q_DEAD_CODE_FROM_QT4_MAC << newFramePosition << newNormalPosition #else << frameGeometry() << normalGeometry() -#endif // Q_WS_MAC +#endif // Q_DEAD_CODE_FROM_QT4_MAC << qint32(screenNumber) << quint8(windowState() & Qt::WindowMaximized) << quint8(windowState() & Qt::WindowFullScreen) @@ -7344,7 +7346,7 @@ bool QWidget::restoreGeometry(const QByteArray &geometry) // - The title bar is outside the available geometry. // - (Mac only) The window is higher than the available geometry. It must // be possible to bring the size grip on screen by moving the window. -#ifdef Q_WS_MAC +#ifdef Q_DEAD_CODE_FROM_QT4_MAC restoredFrameGeometry.setHeight(qMin(restoredFrameGeometry.height(), availableGeometry.height())); restoredNormalGeometry.setHeight(qMin(restoredNormalGeometry.height(), availableGeometry.height() - frameHeight)); #endif @@ -7393,7 +7395,7 @@ bool QWidget::restoreGeometry(const QByteArray &geometry) d_func()->topData()->normalGeometry = restoredNormalGeometry; } else { QPoint offset; -#ifdef Q_WS_X11 +#ifdef Q_DEAD_CODE_FROM_QT4_X11 if (isFullScreen()) offset = d_func()->topData()->fullScreenOffset; #endif @@ -7791,7 +7793,7 @@ void QWidgetPrivate::show_helper() // On Windows, show the popup now so that our own focus handling // stores the correct old focus widget even if it's stolen in the // showevent -#if defined(Q_WS_WIN) || defined(Q_WS_MAC) +#if defined(Q_DEAD_CODE_FROM_QT4_WIN) || defined(Q_DEAD_CODE_FROM_QT4_MAC) if (!isEmbedded && q->windowType() == Qt::Popup) qApp->d_func()->openPopup(q); #endif @@ -7914,7 +7916,7 @@ void QWidgetPrivate::hide_helper() if (!isEmbedded && (q->windowType() == Qt::Popup)) qApp->d_func()->closePopup(q); -#if defined(Q_WS_WIN) +#if defined(Q_DEAD_CODE_FROM_QT4_WIN) if (q->isWindow() && !(q->windowType() == Qt::Popup) && q->parentWidget() && !q->parentWidget()->isHidden() && q->isActiveWindow()) q->parentWidget()->activateWindow(); // Activate parent @@ -8109,7 +8111,7 @@ void QWidget::setVisible(bool visible) } else { // hide if (testAttribute(Qt::WA_WState_ExplicitShowHide) && testAttribute(Qt::WA_WState_Hidden)) return; -#if defined(Q_WS_WIN) +#if defined(Q_DEAD_CODE_FROM_QT4_WIN) // reset WS_DISABLED style in a Blocked window if(isWindow() && testAttribute(Qt::WA_WState_Created) && QApplicationPrivate::isBlockedByModal(this)) @@ -8194,7 +8196,7 @@ void QWidgetPrivate::hideChildren(bool spontaneous) QWidget *widget = qobject_cast<QWidget*>(childList.at(i)); if (!widget || widget->isWindow() || widget->testAttribute(Qt::WA_WState_Hidden)) continue; -#ifdef Q_WS_MAC +#ifdef Q_DEAD_CODE_FROM_QT4_MAC // Before doing anything we need to make sure that we don't leave anything in a non-consistent state. // When hiding a widget we need to make sure that no mouse_down events are active, because // the mouse_up event will never be received by a hidden widget or one of its descendants. @@ -8210,7 +8212,7 @@ void QWidgetPrivate::hideChildren(bool spontaneous) // supposed to trigger because it is not visible. if(widget == qt_button_down) qt_button_down = 0; -#endif // Q_WS_MAC +#endif // Q_DEAD_CODE_FROM_QT4_MAC if (spontaneous) widget->setAttribute(Qt::WA_Mapped, false); else @@ -8445,7 +8447,7 @@ QSize QWidgetPrivate::adjustedSize() const s.setWidth(qMax(s.width(), 200)); if (exp & Qt::Vertical) s.setHeight(qMax(s.height(), 100)); -#if defined(Q_WS_X11) +#if defined(Q_DEAD_CODE_FROM_QT4_X11) QRect screen = QApplication::desktop()->screenGeometry(q->x11Info().screen()); #else // all others QRect screen = QApplication::desktop()->screenGeometry(q->pos()); @@ -8578,7 +8580,7 @@ bool QWidget::isAncestorOf(const QWidget *child) const return false; } -#if defined(Q_WS_WIN) +#if defined(Q_DEAD_CODE_FROM_QT4_WIN) inline void setDisabledStyle(QWidget *w, bool setStyle) { // set/reset WS_DISABLED style. @@ -9000,7 +9002,7 @@ bool QWidget::event(QEvent *event) } } } -#if defined(Q_WS_WIN) +#if defined(Q_DEAD_CODE_FROM_QT4_WIN) setDisabledStyle(this, (event->type() == QEvent::WindowBlocked)); #endif break; @@ -9027,7 +9029,7 @@ bool QWidget::event(QEvent *event) case QEvent::EmbeddingControl: d->topData()->frameStrut.setCoords(0 ,0, 0, 0); data->fstrut_dirty = false; -#if defined(Q_WS_WIN) || defined(Q_WS_X11) +#if defined(Q_DEAD_CODE_FROM_QT4_WIN) || defined(Q_DEAD_CODE_FROM_QT4_X11) d->topData()->embedded = 1; #endif break; @@ -9052,7 +9054,7 @@ bool QWidget::event(QEvent *event) } break; } -#ifdef Q_WS_MAC +#ifdef Q_DEAD_CODE_FROM_QT4_MAC case QEvent::MacGLWindowChange: d->needWindowChange = false; break; @@ -9163,7 +9165,7 @@ void QWidget::changeEvent(QEvent * event) case QEvent::MacSizeChange: updateGeometry(); break; -#elif defined Q_WS_MAC +#elif defined Q_DEAD_CODE_FROM_QT4_MAC case QEvent::ToolTipChange: case QEvent::MouseTrackingChange: qt_mac_update_mouseTracking(this); @@ -9427,7 +9429,7 @@ void QWidget::focusOutEvent(QFocusEvent *) #ifndef Q_OS_IOS // FIXME: revisit autoSIP logic, QTBUG-42906 if (qApp->autoSipEnabled() && testAttribute(Qt::WA_InputMethodEnabled)) - qApp->inputMethod()->hide(); + QGuiApplication::inputMethod()->hide(); #endif } @@ -9716,8 +9718,8 @@ void QWidget::setInputMethodHints(Qt::InputMethodHints hints) if (d->imHints == hints) return; d->imHints = hints; - if (this == qApp->focusObject()) - qApp->inputMethod()->update(Qt::ImHints); + if (this == QGuiApplication::focusObject()) + QGuiApplication::inputMethod()->update(Qt::ImHints); #endif //QT_NO_IM } @@ -10433,7 +10435,7 @@ void QWidget::setParent(QWidget *parent, Qt::WindowFlags f) // (f & Qt::MSWindowsOwnDC) clause (which is set on QGLWidgets on all // platforms). if (newParent -#if defined(Q_WS_WIN) || defined(QT_OPENGL_ES) +#if defined(Q_DEAD_CODE_FROM_QT4_WIN) || defined(QT_OPENGL_ES) || (f & Qt::MSWindowsOwnDC) #endif ) { @@ -10453,7 +10455,7 @@ void QWidget::setParent(QWidget *parent, Qt::WindowFlags f) } //### already hidden above ---> must probably do something smart on the mac -// #ifdef Q_WS_MAC +// #ifdef Q_DEAD_CODE_FROM_QT4_MAC // extern bool qt_mac_is_macdrawer(const QWidget *); //qwidget_mac.cpp // if(!qt_mac_is_macdrawer(q)) //special case // q->setAttribute(Qt::WA_WState_Hidden); @@ -10931,9 +10933,9 @@ void QWidget::setAttribute(Qt::WidgetAttribute attribute, bool on) return; Q_D(QWidget); - Q_ASSERT_X(sizeof(d->high_attributes)*8 >= (Qt::WA_AttributeCount - sizeof(uint)*8), - "QWidget::setAttribute(WidgetAttribute, bool)", - "QWidgetPrivate::high_attributes[] too small to contain all attributes in WidgetAttribute"); + Q_STATIC_ASSERT_X(sizeof(d->high_attributes)*8 >= (Qt::WA_AttributeCount - sizeof(uint)*8), + "QWidget::setAttribute(WidgetAttribute, bool): " + "QWidgetPrivate::high_attributes[] too small to contain all attributes in WidgetAttribute"); #ifdef Q_OS_WIN // ### Don't use PaintOnScreen+paintEngine() to do native painting in some future release if (attribute == Qt::WA_PaintOnScreen && on && windowType() != Qt::Desktop && !inherits("QGLWidget")) { @@ -10983,7 +10985,7 @@ void QWidget::setAttribute(Qt::WidgetAttribute attribute, bool on) d->receiveChildEvents = !on; break; case Qt::WA_MacBrushedMetal: -#ifdef Q_WS_MAC +#ifdef Q_DEAD_CODE_FROM_QT4_MAC d->setStyle_helper(style(), false, true); // Make sure things get unpolished/polished correctly. // fall through since changing the metal attribute affects the opaque size grip. case Qt::WA_MacOpaqueSizeGrip: @@ -11000,7 +11002,7 @@ void QWidget::setAttribute(Qt::WidgetAttribute attribute, bool on) break; #endif case Qt::WA_MacAlwaysShowToolWindow: -#ifdef Q_WS_MAC +#ifdef Q_DEAD_CODE_FROM_QT4_MAC d->macUpdateHideOnSuspend(); #endif break; @@ -11059,25 +11061,25 @@ void QWidget::setAttribute(Qt::WidgetAttribute attribute, bool on) d->createTLSysExtra(); #ifndef QT_NO_IM QWidget *focusWidget = d->effectiveFocusWidget(); - if (on && !internalWinId() && this == qApp->focusObject() + if (on && !internalWinId() && this == QGuiApplication::focusObject() && focusWidget->testAttribute(Qt::WA_InputMethodEnabled)) { - qApp->inputMethod()->commit(); - qApp->inputMethod()->update(Qt::ImEnabled); + QGuiApplication::inputMethod()->commit(); + QGuiApplication::inputMethod()->update(Qt::ImEnabled); } if (!qApp->testAttribute(Qt::AA_DontCreateNativeWidgetSiblings) && parentWidget()) parentWidget()->d_func()->enforceNativeChildren(); if (on && !internalWinId() && testAttribute(Qt::WA_WState_Created)) d->createWinId(); - if (isEnabled() && focusWidget->isEnabled() && this == qApp->focusObject() + if (isEnabled() && focusWidget->isEnabled() && this == QGuiApplication::focusObject() && focusWidget->testAttribute(Qt::WA_InputMethodEnabled)) { - qApp->inputMethod()->update(Qt::ImEnabled); + QGuiApplication::inputMethod()->update(Qt::ImEnabled); } #endif //QT_NO_IM break; } case Qt::WA_PaintOnScreen: d->updateIsOpaque(); -#if defined(Q_WS_WIN) || defined(Q_WS_X11) || defined(Q_WS_MAC) +#if defined(Q_DEAD_CODE_FROM_QT4_WIN) || defined(Q_DEAD_CODE_FROM_QT4_X11) || defined(Q_DEAD_CODE_FROM_QT4_MAC) // Recreate the widget if it's already created as an alien widget and // WA_PaintOnScreen is enabled. Paint on screen widgets must have win id. // So must their children. @@ -11097,16 +11099,16 @@ void QWidget::setAttribute(Qt::WidgetAttribute attribute, bool on) d->updateSystemBackground(); break; case Qt::WA_TransparentForMouseEvents: -#ifdef Q_WS_MAC +#ifdef Q_DEAD_CODE_FROM_QT4_MAC d->macUpdateIgnoreMouseEvents(); #endif break; case Qt::WA_InputMethodEnabled: { #ifndef QT_NO_IM - if (qApp->focusObject() == this) { + if (QGuiApplication::focusObject() == this) { if (!on) - qApp->inputMethod()->commit(); - qApp->inputMethod()->update(Qt::ImEnabled); + QGuiApplication::inputMethod()->commit(); + QGuiApplication::inputMethod()->update(Qt::ImEnabled); } #endif //QT_NO_IM break; @@ -11116,7 +11118,7 @@ void QWidget::setAttribute(Qt::WidgetAttribute attribute, bool on) d->resolveFont(); d->resolveLocale(); break; -#ifdef Q_WS_X11 +#ifdef Q_DEAD_CODE_FROM_QT4_X11 case Qt::WA_NoX11EventCompression: if (!d->extra) d->createExtra(); @@ -11141,7 +11143,7 @@ void QWidget::setAttribute(Qt::WidgetAttribute attribute, bool on) break; } -#ifdef Q_WS_X11 +#ifdef Q_DEAD_CODE_FROM_QT4_X11 case Qt::WA_X11NetWmWindowTypeDesktop: case Qt::WA_X11NetWmWindowTypeDock: case Qt::WA_X11NetWmWindowTypeToolBar: @@ -11176,7 +11178,7 @@ void QWidget::setAttribute(Qt::WidgetAttribute attribute, bool on) break; case Qt::WA_AcceptTouchEvents: -#if defined(Q_WS_WIN) || defined(Q_WS_MAC) +#if defined(Q_DEAD_CODE_FROM_QT4_WIN) || defined(Q_DEAD_CODE_FROM_QT4_MAC) if (on) d->registerTouchWindow(); #endif @@ -11594,8 +11596,8 @@ void QWidget::setShortcutAutoRepeat(int id, bool enable) void QWidget::updateMicroFocus() { // updating everything since this is currently called for any kind of state change - if (this == qApp->focusObject()) - qApp->inputMethod()->update(Qt::ImQueryAll); + if (this == QGuiApplication::focusObject()) + QGuiApplication::inputMethod()->update(Qt::ImQueryAll); } /*! @@ -11797,7 +11799,7 @@ QRect QWidgetPrivate::frameStrut() const } if (data.fstrut_dirty -#ifndef Q_WS_WIN +#ifndef Q_DEAD_CODE_FROM_QT4_WIN // ### Fix properly for 4.3 && q->isVisible() #endif @@ -12592,13 +12594,10 @@ int QWidget::metric(PaintDeviceMetric m) const QWindow *topLevelWindow = 0; QScreen *screen = 0; - if (QWidget *topLevel = window()) + if (QWidget *topLevel = window()) { topLevelWindow = topLevel->windowHandle(); - - if (topLevelWindow) { - QPlatformScreen *platformScreen = QPlatformScreen::platformScreenForWindow(topLevelWindow); - if (platformScreen) - screen = platformScreen->screen(); + if (topLevelWindow) + screen = topLevelWindow->screen(); } if (!screen && QGuiApplication::primaryScreen()) screen = QGuiApplication::primaryScreen(); @@ -12708,7 +12707,7 @@ void QWidget::setMask(const QRegion &newMask) d->extra->mask = newMask; d->extra->hasMask = !newMask.isEmpty(); -#ifndef Q_WS_MAC +#ifndef Q_DEAD_CODE_FROM_QT4_MAC if (!testAttribute(Qt::WA_WState_Created)) return; #endif @@ -12797,6 +12796,14 @@ void QWidget::clearMask() setMask(QRegion()); } +void QWidgetPrivate::setWidgetParentHelper(QObject *widgetAsObject, QObject *newParent) +{ + Q_ASSERT(widgetAsObject->isWidgetType()); + Q_ASSERT(!newParent || newParent->isWidgetType()); + QWidget *widget = static_cast<QWidget*>(widgetAsObject); + widget->setParent(static_cast<QWidget*>(newParent)); +} + QT_END_NAMESPACE #include "moc_qwidget.cpp" diff --git a/src/widgets/kernel/qwidget.h b/src/widgets/kernel/qwidget.h index ad1e276567..c3913e9d45 100644 --- a/src/widgets/kernel/qwidget.h +++ b/src/widgets/kernel/qwidget.h @@ -1,7 +1,7 @@ /**************************************************************************** ** -** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ ** ** This file is part of the QtWidgets module of the Qt Toolkit. ** @@ -10,9 +10,9 @@ ** 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 Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. +** 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 @@ -23,8 +23,8 @@ ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ** $QT_END_LICENSE$ @@ -203,7 +203,7 @@ public: explicit QWidget(QWidget* parent = 0, Qt::WindowFlags f = 0); ~QWidget(); - int devType() const; + int devType() const Q_DECL_OVERRIDE; WId winId() const; void createWinId(); // internal, going away @@ -536,7 +536,11 @@ public: #ifndef QT_NO_ACTION //actions void addAction(QAction *action); +#if QT_VERSION >= QT_VERSION_CHECK(6,0,0) + void addActions(const QList<QAction*> &actions); +#else void addActions(QList<QAction*> actions); +#endif void insertAction(QAction *before, QAction *action); void insertActions(QAction *before, QList<QAction*> actions); void removeAction(QAction *action); @@ -555,12 +559,12 @@ public: inline QWidget *childAt(int x, int y) const; QWidget *childAt(const QPoint &p) const; -#if defined(Q_WS_X11) +#if defined(Q_DEAD_CODE_FROM_QT4_X11) const QX11Info &x11Info() const; Qt::HANDLE x11PictureHandle() const; #endif -#if defined(Q_WS_MAC) +#if defined(Q_DEAD_CODE_FROM_QT4_MAC) Qt::HANDLE macQDHandle() const; Qt::HANDLE macCGHandle() const; #endif @@ -568,7 +572,7 @@ public: void setAttribute(Qt::WidgetAttribute, bool on = true); inline bool testAttribute(Qt::WidgetAttribute) const; - QPaintEngine *paintEngine() const; + QPaintEngine *paintEngine() const Q_DECL_OVERRIDE; void ensurePolished() const; @@ -598,7 +602,7 @@ Q_SIGNALS: protected: // Event handlers - bool event(QEvent *); + bool event(QEvent *) Q_DECL_OVERRIDE; virtual void mousePressEvent(QMouseEvent *); virtual void mouseReleaseEvent(QMouseEvent *); virtual void mouseDoubleClickEvent(QMouseEvent *); @@ -640,10 +644,10 @@ protected: // Misc. protected functions virtual void changeEvent(QEvent *); - int metric(PaintDeviceMetric) const; - void initPainter(QPainter *painter) const; - QPaintDevice *redirected(QPoint *offset) const; - QPainter *sharedPainter() const; + int metric(PaintDeviceMetric) const Q_DECL_OVERRIDE; + void initPainter(QPainter *painter) const Q_DECL_OVERRIDE; + QPaintDevice *redirected(QPoint *offset) const Q_DECL_OVERRIDE; + QPainter *sharedPainter() const Q_DECL_OVERRIDE; virtual void inputMethodEvent(QInputMethodEvent *); public: diff --git a/src/widgets/kernel/qwidget_p.h b/src/widgets/kernel/qwidget_p.h index 85e1cf93d6..9425426215 100644 --- a/src/widgets/kernel/qwidget_p.h +++ b/src/widgets/kernel/qwidget_p.h @@ -1,7 +1,7 @@ /**************************************************************************** ** -** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ ** ** This file is part of the QtWidgets module of the Qt Toolkit. ** @@ -10,9 +10,9 @@ ** 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 Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. +** 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 @@ -23,8 +23,8 @@ ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ** $QT_END_LICENSE$ @@ -177,7 +177,7 @@ struct QTLWExtra { uint embedded : 1; // *************************** Platform specific values (bit fields first) ********** -#if defined(Q_WS_X11) // <----------------------------------------------------------- X11 +#if defined(Q_DEAD_CODE_FROM_QT4_X11) // <----------------------------------------------------------- X11 uint spont_unmapped: 1; // window was spontaneously unmapped uint dnd : 1; // DND properties installed uint validWMState : 1; // is WM_STATE valid? @@ -191,11 +191,11 @@ struct QTLWExtra { qint32 newCounterValueHi; quint32 newCounterValueLo; #endif -#elif defined(Q_WS_WIN) // <--------------------------------------------------------- WIN +#elif defined(Q_DEAD_CODE_FROM_QT4_WIN) // <--------------------------------------------------------- WIN uint hotkeyRegistered: 1; // Hot key from the STARTUPINFO has been registered. HICON winIconBig; // internal big Windows icon HICON winIconSmall; // internal small Windows icon -#elif defined(Q_WS_MAC) // <--------------------------------------------------------- MAC +#elif defined(Q_DEAD_CODE_FROM_QT4_MAC) // <--------------------------------------------------------- MAC uint resizer : 4; uint isSetGeometry : 1; uint isMove : 1; @@ -253,15 +253,15 @@ struct QWExtra { uint hasWindowContainer : 1; // *************************** Platform specific values (bit fields first) ********** -#if defined(Q_WS_WIN) // <----------------------------------------------------------- WIN +#if defined(Q_DEAD_CODE_FROM_QT4_WIN) // <----------------------------------------------------------- WIN #ifndef QT_NO_DRAGANDDROP QOleDropTarget *dropTarget; // drop target QList<QPointer<QWidget> > oleDropWidgets; #endif -#elif defined(Q_WS_X11) // <--------------------------------------------------------- X11 +#elif defined(Q_DEAD_CODE_FROM_QT4_X11) // <--------------------------------------------------------- X11 uint compress_events : 1; WId xDndProxy; // XDND forwarding to embedded windows -#elif defined(Q_WS_MAC) // <------------------------------------------------------ MAC +#elif defined(Q_DEAD_CODE_FROM_QT4_MAC) // <------------------------------------------------------ MAC // Cocoa Mask stuff QImage maskBits; CGImageRef imageMask; @@ -598,7 +598,7 @@ public: QStyle::RequestSoftwareInputPanel behavior = QStyle::RequestSoftwareInputPanel( q->style()->styleHint(QStyle::SH_RequestSoftwareInputPanel)); if (!clickCausedFocus || behavior == QStyle::RSIP_OnMouseClick) { - qApp->inputMethod()->show(); + QGuiApplication::inputMethod()->show(); } } } @@ -612,10 +612,10 @@ public: { return p + data.wrect.topLeft(); } inline QRect mapToWS(const QRect &r) const - { QRect rr(r); rr.translate(-data.wrect.topLeft()); return rr; } + { return r.translated(-data.wrect.topLeft()); } inline QRect mapFromWS(const QRect &r) const - { QRect rr(r); rr.translate(data.wrect.topLeft()); return rr; } + { return r.translated(data.wrect.topLeft()); } QOpenGLContext *shareContext() const; @@ -653,6 +653,8 @@ public: virtual void resolveSamples() { } #endif + static void setWidgetParentHelper(QObject *widgetAsObject, QObject *newParent); + // Variables. // Regular pointers (keep them together to avoid gaps on 64 bit architectures). QWExtra *extra; @@ -743,7 +745,7 @@ public: #if defined(Q_OS_WIN) uint noPaintOnScreen : 1; // see qwidget.cpp ::paintEngine() #endif -#if defined(Q_WS_X11) // <----------------------------------------------------------- X11 +#if defined(Q_DEAD_CODE_FROM_QT4_X11) // <----------------------------------------------------------- X11 Qt::HANDLE picture; static QWidget *mouseGrabber; static QWidget *keyboardGrabber; @@ -756,7 +758,7 @@ public: void updateX11AcceptFocus(); QPoint mapToGlobal(const QPoint &pos) const; QPoint mapFromGlobal(const QPoint &pos) const; -#elif defined(Q_WS_WIN) // <--------------------------------------------------------- WIN +#elif defined(Q_DEAD_CODE_FROM_QT4_WIN) // <--------------------------------------------------------- WIN #ifndef QT_NO_GESTURES uint nativeGesturePanEnabled : 1; #endif @@ -772,7 +774,7 @@ public: void winSetupGestures(); #elif defined(Q_OS_MAC) // <--------------------------------------------------------- MAC void macUpdateSizeAttribute(); -#elif defined(Q_WS_MAC) // <--------------------------------------------------------- MAC (old stuff) +#elif defined(Q_DEAD_CODE_FROM_QT4_MAC) // <--------------------------------------------------------- MAC (old stuff) // This is new stuff uint needWindowChange : 1; @@ -874,26 +876,26 @@ public: : QGraphicsEffectSourcePrivate(), m_widget(widget), context(0), updateDueToGraphicsEffect(false) {} - inline void detach() + void detach() Q_DECL_OVERRIDE { m_widget->d_func()->graphicsEffect = 0; } - inline const QGraphicsItem *graphicsItem() const + const QGraphicsItem *graphicsItem() const Q_DECL_OVERRIDE { return 0; } - inline const QWidget *widget() const + const QWidget *widget() const Q_DECL_OVERRIDE { return m_widget; } - inline void update() + void update() Q_DECL_OVERRIDE { updateDueToGraphicsEffect = true; m_widget->update(); updateDueToGraphicsEffect = false; } - inline bool isPixmap() const + bool isPixmap() const Q_DECL_OVERRIDE { return false; } - inline void effectBoundingRectChanged() + void effectBoundingRectChanged() Q_DECL_OVERRIDE { // ### This function should take a rect parameter; then we can avoid // updating too much on the parent widget. @@ -903,16 +905,16 @@ public: update(); } - inline const QStyleOption *styleOption() const + const QStyleOption *styleOption() const Q_DECL_OVERRIDE { return 0; } - inline QRect deviceRect() const + QRect deviceRect() const Q_DECL_OVERRIDE { return m_widget->window()->rect(); } - QRectF boundingRect(Qt::CoordinateSystem system) const; - void draw(QPainter *p); + QRectF boundingRect(Qt::CoordinateSystem system) const Q_DECL_OVERRIDE; + void draw(QPainter *p) Q_DECL_OVERRIDE; QPixmap pixmap(Qt::CoordinateSystem system, QPoint *offset, - QGraphicsEffect::PixmapPadMode mode) const; + QGraphicsEffect::PixmapPadMode mode) const Q_DECL_OVERRIDE; QWidget *m_widget; QWidgetPaintContext *context; diff --git a/src/widgets/kernel/qwidgetaction.cpp b/src/widgets/kernel/qwidgetaction.cpp index 34370ac286..27d4a650b4 100644 --- a/src/widgets/kernel/qwidgetaction.cpp +++ b/src/widgets/kernel/qwidgetaction.cpp @@ -1,7 +1,7 @@ /**************************************************************************** ** -** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ ** ** This file is part of the QtWidgets module of the Qt Toolkit. ** @@ -10,9 +10,9 @@ ** 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 Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. +** 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 @@ -23,8 +23,8 @@ ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ** $QT_END_LICENSE$ diff --git a/src/widgets/kernel/qwidgetaction.h b/src/widgets/kernel/qwidgetaction.h index afea8454d9..ec6a00f544 100644 --- a/src/widgets/kernel/qwidgetaction.h +++ b/src/widgets/kernel/qwidgetaction.h @@ -1,7 +1,7 @@ /**************************************************************************** ** -** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ ** ** This file is part of the QtWidgets module of the Qt Toolkit. ** @@ -10,9 +10,9 @@ ** 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 Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. +** 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 @@ -23,8 +23,8 @@ ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ** $QT_END_LICENSE$ @@ -59,8 +59,8 @@ public: void releaseWidget(QWidget *widget); protected: - virtual bool event(QEvent *); - virtual bool eventFilter(QObject *, QEvent *); + virtual bool event(QEvent *) Q_DECL_OVERRIDE; + virtual bool eventFilter(QObject *, QEvent *) Q_DECL_OVERRIDE; virtual QWidget *createWidget(QWidget *parent); virtual void deleteWidget(QWidget *widget); QList<QWidget *> createdWidgets() const; diff --git a/src/widgets/kernel/qwidgetaction_p.h b/src/widgets/kernel/qwidgetaction_p.h index 3aece0d8d3..5bebcfd6f8 100644 --- a/src/widgets/kernel/qwidgetaction_p.h +++ b/src/widgets/kernel/qwidgetaction_p.h @@ -1,7 +1,7 @@ /**************************************************************************** ** -** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ ** ** This file is part of the QtWidgets module of the Qt Toolkit. ** @@ -10,9 +10,9 @@ ** 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 Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. +** 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 @@ -23,8 +23,8 @@ ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ** $QT_END_LICENSE$ diff --git a/src/widgets/kernel/qwidgetbackingstore.cpp b/src/widgets/kernel/qwidgetbackingstore.cpp index cd01869af2..f8b8ec5ea3 100644 --- a/src/widgets/kernel/qwidgetbackingstore.cpp +++ b/src/widgets/kernel/qwidgetbackingstore.cpp @@ -1,7 +1,7 @@ /**************************************************************************** ** -** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ ** ** This file is part of the QtWidgets module of the Qt Toolkit. ** @@ -10,9 +10,9 @@ ** 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 Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. +** 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 @@ -23,8 +23,8 @@ ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ** $QT_END_LICENSE$ @@ -81,14 +81,14 @@ void QWidgetBackingStore::qt_flush(QWidget *widget, const QRegion ®ion, QBack Q_ASSERT(tlw); #if !defined(QT_NO_PAINT_DEBUG) - static int flushUpdate = qgetenv("QT_FLUSH_UPDATE").toInt(); + static int flushUpdate = qEnvironmentVariableIntValue("QT_FLUSH_UPDATE"); if (flushUpdate > 0) QWidgetBackingStore::showYellowThing(widget, region, flushUpdate * 10, false); #endif if (tlw->testAttribute(Qt::WA_DontShowOnScreen) || widget->testAttribute(Qt::WA_DontShowOnScreen)) return; - static bool fpsDebug = qgetenv("QT_DEBUG_FPS").toInt(); + static bool fpsDebug = qEnvironmentVariableIntValue("QT_DEBUG_FPS"); if (fpsDebug) { if (!widgetBackingStore->perfFrames++) widgetBackingStore->perfTime.start(); @@ -239,12 +239,12 @@ bool QWidgetBackingStore::flushPaint(QWidget *widget, const QRegion &rgn) int delay = 0; if (widget->testAttribute(Qt::WA_WState_InPaintEvent)) { - static int flushPaintEvent = qgetenv("QT_FLUSH_PAINT_EVENT").toInt(); + static int flushPaintEvent = qEnvironmentVariableIntValue("QT_FLUSH_PAINT_EVENT"); if (!flushPaintEvent) return false; delay = flushPaintEvent; } else { - static int flushPaint = qgetenv("QT_FLUSH_PAINT").toInt(); + static int flushPaint = qEnvironmentVariableIntValue("QT_FLUSH_PAINT"); if (!flushPaint) return false; delay = flushPaint; @@ -662,7 +662,7 @@ void QWidgetBackingStore::markDirtyOnScreen(const QRegion ®ion, QWidget *widg if (!widget || widget->d_func()->paintOnScreen() || region.isEmpty()) return; -#if defined(Q_WS_MAC) +#if defined(Q_DEAD_CODE_FROM_QT4_MAC) if (!widget->testAttribute(Qt::WA_WState_InPaintEvent)) dirtyOnScreen += region.translated(topLevelOffset); return; @@ -780,10 +780,7 @@ void QWidgetPrivate::moveRect(const QRect &rect, int dx, int dy) if (x->inTopLevelResize) return; - static int accelEnv = -1; - if (accelEnv == -1) { - accelEnv = qgetenv("QT_NO_FAST_MOVE").toInt() == 0; - } + static const bool accelEnv = qEnvironmentVariableIntValue("QT_NO_FAST_MOVE") == 0; QWidget *pw = q->parentWidget(); QPoint toplevelOffset = pw->mapTo(tlw, QPoint()); @@ -862,10 +859,7 @@ void QWidgetPrivate::scrollRect(const QRect &rect, int dx, int dy) if (!wbs) return; - static int accelEnv = -1; - if (accelEnv == -1) { - accelEnv = qgetenv("QT_NO_FAST_SCROLL").toInt() == 0; - } + static const bool accelEnv = qEnvironmentVariableIntValue("QT_NO_FAST_SCROLL") == 0; QRect scrollRect = rect & clipRect(); bool overlapped = false; @@ -1463,7 +1457,7 @@ void QWidgetPrivate::repaint_sys(const QRegion &rgn) && (usesDoubleBufferedGLContext || q->autoFillBackground()); QRegion toBePainted(noPartialUpdateSupport ? q->rect() : rgn); -#ifdef Q_WS_MAC +#ifdef Q_DEAD_CODE_FROM_QT4_MAC // No difference between update() and repaint() on the Mac. update_sys(toBePainted); return; diff --git a/src/widgets/kernel/qwidgetbackingstore_p.h b/src/widgets/kernel/qwidgetbackingstore_p.h index e208a6d752..bcffa3be79 100644 --- a/src/widgets/kernel/qwidgetbackingstore_p.h +++ b/src/widgets/kernel/qwidgetbackingstore_p.h @@ -1,7 +1,7 @@ /**************************************************************************** ** -** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ ** ** This file is part of the QtWidgets module of the Qt Toolkit. ** @@ -10,9 +10,9 @@ ** 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 Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. +** 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 @@ -23,8 +23,8 @@ ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ** $QT_END_LICENSE$ diff --git a/src/widgets/kernel/qwidgetsfunctions_wince.cpp b/src/widgets/kernel/qwidgetsfunctions_wince.cpp index 2593cfc7e4..f06514dbe4 100644 --- a/src/widgets/kernel/qwidgetsfunctions_wince.cpp +++ b/src/widgets/kernel/qwidgetsfunctions_wince.cpp @@ -1,7 +1,7 @@ /**************************************************************************** ** -** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ ** ** This file is part of the QtWidgets module of the Qt Toolkit. ** @@ -10,9 +10,9 @@ ** 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 Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. +** 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 @@ -23,8 +23,8 @@ ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ** $QT_END_LICENSE$ diff --git a/src/widgets/kernel/qwidgetsfunctions_wince.h b/src/widgets/kernel/qwidgetsfunctions_wince.h index 520fb892b3..ebf0232758 100644 --- a/src/widgets/kernel/qwidgetsfunctions_wince.h +++ b/src/widgets/kernel/qwidgetsfunctions_wince.h @@ -1,7 +1,7 @@ /**************************************************************************** ** -** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ ** ** This file is part of the QtWidgets module of the Qt Toolkit. ** @@ -10,9 +10,9 @@ ** 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 Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. +** 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 @@ -23,8 +23,8 @@ ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ** $QT_END_LICENSE$ diff --git a/src/widgets/kernel/qwidgetsvariant.cpp b/src/widgets/kernel/qwidgetsvariant.cpp index 03c60d71fe..b0dcc4aa1b 100644 --- a/src/widgets/kernel/qwidgetsvariant.cpp +++ b/src/widgets/kernel/qwidgetsvariant.cpp @@ -1,7 +1,7 @@ /**************************************************************************** ** -** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ ** ** This file is part of the QtWidgets module of the Qt Toolkit. ** @@ -10,9 +10,9 @@ ** 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 Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. +** 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 @@ -23,8 +23,8 @@ ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ** $QT_END_LICENSE$ diff --git a/src/widgets/kernel/qwidgetwindow.cpp b/src/widgets/kernel/qwidgetwindow.cpp index 87baaa13de..b7ffc20c8e 100644 --- a/src/widgets/kernel/qwidgetwindow.cpp +++ b/src/widgets/kernel/qwidgetwindow.cpp @@ -1,7 +1,7 @@ /**************************************************************************** ** -** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ ** ** This file is part of the QtWidgets module of the Qt Toolkit. ** @@ -10,9 +10,9 @@ ** 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 Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. +** 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 @@ -23,8 +23,8 @@ ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ** $QT_END_LICENSE$ @@ -63,7 +63,7 @@ class QWidgetWindowPrivate : public QWindowPrivate { Q_DECLARE_PUBLIC(QWidgetWindow) public: - QWindow *eventReceiver() { + QWindow *eventReceiver() Q_DECL_OVERRIDE { Q_Q(QWidgetWindow); QWindow *w = q; while (w->parent() && qobject_cast<QWidgetWindow *>(w) && qobject_cast<QWidgetWindow *>(w->parent())) { @@ -72,7 +72,7 @@ public: return w; } - void clearFocusObject() + void clearFocusObject() Q_DECL_OVERRIDE { Q_Q(QWidgetWindow); QWidget *widget = q->widget(); @@ -191,7 +191,7 @@ bool QWidgetWindow::event(QEvent *event) case QEvent::FocusAboutToChange: if (QApplicationPrivate::focus_widget) { if (QApplicationPrivate::focus_widget->testAttribute(Qt::WA_InputMethodEnabled)) - qApp->inputMethod()->commit(); + QGuiApplication::inputMethod()->commit(); QGuiApplication::sendSpontaneousEvent(QApplicationPrivate::focus_widget, event); } @@ -292,11 +292,21 @@ bool QWidgetWindow::event(QEvent *event) case QEvent::WindowBlocked: qt_button_down = 0; break; + + case QEvent::UpdateRequest: + // This is not the same as an UpdateRequest for a QWidget. That just + // syncs the backing store while here we also must mark as dirty. + m_widget->repaint(); + return true; + default: break; } - return m_widget->event(event) || QWindow::event(event); + if (m_widget->event(event) && event->type() != QEvent::Timer) + return true; + + return QWindow::event(event); } QPointer<QWidget> qt_last_mouse_receiver = 0; @@ -440,6 +450,7 @@ void QWidgetWindow::handleMouseEvent(QMouseEvent *event) QGuiApplicationPrivate::setMouseEventSource(&e, QGuiApplicationPrivate::mouseEventSource(event)); e.setTimestamp(event->timestamp()); QApplicationPrivate::sendMouseEvent(receiver, &e, alien, m_widget, &qt_button_down, qt_last_mouse_receiver); + qt_last_mouse_receiver = receiver; } else { // close disabled popups when a mouse button is pressed or released switch (event->type()) { @@ -634,7 +645,8 @@ void QWidgetWindow::handleScreenChange() sendScreenChangeRecursively(m_widget); // Invalidate the backing store buffer and repaint immediately. - repaintWindow(); + if (screen()) + repaintWindow(); } void QWidgetWindow::repaintWindow() @@ -711,7 +723,7 @@ void QWidgetWindow::handleWheelEvent(QWheelEvent *event) QPoint mapped = widget->mapFrom(m_widget, event->pos()); - QWheelEvent translated(mapped, event->globalPos(), event->pixelDelta(), event->angleDelta(), event->delta(), event->orientation(), event->buttons(), event->modifiers(), event->phase()); + QWheelEvent translated(mapped, event->globalPos(), event->pixelDelta(), event->angleDelta(), event->delta(), event->orientation(), event->buttons(), event->modifiers(), event->phase(), event->source()); QGuiApplication::sendSpontaneousEvent(widget, &translated); } diff --git a/src/widgets/kernel/qwidgetwindow_p.h b/src/widgets/kernel/qwidgetwindow_p.h index 0632a5c364..ca4bac8d86 100644 --- a/src/widgets/kernel/qwidgetwindow_p.h +++ b/src/widgets/kernel/qwidgetwindow_p.h @@ -1,7 +1,7 @@ /**************************************************************************** ** -** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ ** ** This file is part of the QtWidgets module of the Qt Toolkit. ** @@ -10,9 +10,9 @@ ** 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 Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. +** 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 @@ -23,8 +23,8 @@ ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ** $QT_END_LICENSE$ @@ -65,12 +65,12 @@ public: QWidget *widget() const { return m_widget; } #ifndef QT_NO_ACCESSIBILITY - QAccessibleInterface *accessibleRoot() const; + QAccessibleInterface *accessibleRoot() const Q_DECL_OVERRIDE; #endif - QObject *focusObject() const; + QObject *focusObject() const Q_DECL_OVERRIDE; protected: - bool event(QEvent *); + bool event(QEvent *) Q_DECL_OVERRIDE; void handleCloseEvent(QCloseEvent *); void handleEnterLeaveEvent(QEvent *); @@ -91,7 +91,7 @@ protected: #endif void handleExposeEvent(QExposeEvent *); void handleWindowStateChangedEvent(QWindowStateChangeEvent *event); - bool nativeEvent(const QByteArray &eventType, void *message, long *result); + bool nativeEvent(const QByteArray &eventType, void *message, long *result) Q_DECL_OVERRIDE; #ifndef QT_NO_TABLETEVENT void handleTabletEvent(QTabletEvent *); #endif diff --git a/src/widgets/kernel/qwindowcontainer.cpp b/src/widgets/kernel/qwindowcontainer.cpp index 5460a43ef4..9d3a4ef0b2 100644 --- a/src/widgets/kernel/qwindowcontainer.cpp +++ b/src/widgets/kernel/qwindowcontainer.cpp @@ -1,7 +1,7 @@ /**************************************************************************** ** -** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ ** ** This file is part of the QtWidgets module of the Qt Toolkit. ** @@ -10,9 +10,9 @@ ** 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 Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. +** 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 @@ -23,8 +23,8 @@ ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ** $QT_END_LICENSE$ diff --git a/src/widgets/kernel/qwindowcontainer_p.h b/src/widgets/kernel/qwindowcontainer_p.h index 6ba1ab544e..51ddfb2619 100644 --- a/src/widgets/kernel/qwindowcontainer_p.h +++ b/src/widgets/kernel/qwindowcontainer_p.h @@ -1,7 +1,7 @@ /**************************************************************************** ** -** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ ** ** This file is part of the QtWidgets module of the Qt Toolkit. ** @@ -10,9 +10,9 @@ ** 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 Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. +** 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 @@ -23,8 +23,8 @@ ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ** $QT_END_LICENSE$ @@ -68,7 +68,7 @@ public: static void parentWasLowered(QWidget *parent); protected: - bool event(QEvent *ev); + bool event(QEvent *ev) Q_DECL_OVERRIDE; private slots: void focusWindowChanged(QWindow *focusWindow); |