summaryrefslogtreecommitdiffstats
path: root/src/gui/kernel
diff options
context:
space:
mode:
Diffstat (limited to 'src/gui/kernel')
-rw-r--r--src/gui/kernel/kernel.pri11
-rw-r--r--src/gui/kernel/qclipboard.cpp14
-rw-r--r--src/gui/kernel/qclipboard.h14
-rw-r--r--src/gui/kernel/qcursor.cpp31
-rw-r--r--src/gui/kernel/qcursor.h15
-rw-r--r--src/gui/kernel/qcursor_p.h14
-rw-r--r--src/gui/kernel/qdnd.cpp14
-rw-r--r--src/gui/kernel/qdnd_p.h20
-rw-r--r--src/gui/kernel/qdrag.cpp14
-rw-r--r--src/gui/kernel/qdrag.h14
-rw-r--r--src/gui/kernel/qevent.cpp344
-rw-r--r--src/gui/kernel/qevent.h46
-rw-r--r--src/gui/kernel/qevent_p.h14
-rw-r--r--src/gui/kernel/qgenericplugin.cpp14
-rw-r--r--src/gui/kernel/qgenericplugin.h14
-rw-r--r--src/gui/kernel/qgenericpluginfactory.cpp14
-rw-r--r--src/gui/kernel/qgenericpluginfactory.h14
-rw-r--r--src/gui/kernel/qguiapplication.cpp170
-rw-r--r--src/gui/kernel/qguiapplication.h20
-rw-r--r--src/gui/kernel/qguiapplication_p.h26
-rw-r--r--src/gui/kernel/qguivariant.cpp14
-rw-r--r--src/gui/kernel/qinputdevicemanager.cpp88
-rw-r--r--src/gui/kernel/qinputdevicemanager_p.h80
-rw-r--r--src/gui/kernel/qinputdevicemanager_p_p.h69
-rw-r--r--src/gui/kernel/qinputmethod.cpp14
-rw-r--r--src/gui/kernel/qinputmethod.h16
-rw-r--r--src/gui/kernel/qinputmethod_p.h14
-rw-r--r--src/gui/kernel/qkeymapper.cpp14
-rw-r--r--src/gui/kernel/qkeymapper_p.h14
-rw-r--r--src/gui/kernel/qkeysequence.cpp22
-rw-r--r--src/gui/kernel/qkeysequence.h19
-rw-r--r--src/gui/kernel/qkeysequence_p.h14
-rw-r--r--src/gui/kernel/qoffscreensurface.cpp28
-rw-r--r--src/gui/kernel/qoffscreensurface.h22
-rw-r--r--src/gui/kernel/qopenglcontext.cpp144
-rw-r--r--src/gui/kernel/qopenglcontext.h19
-rw-r--r--src/gui/kernel/qopenglcontext_p.h21
-rw-r--r--src/gui/kernel/qopenglwindow.cpp68
-rw-r--r--src/gui/kernel/qopenglwindow.h17
-rw-r--r--src/gui/kernel/qpaintdevicewindow.cpp37
-rw-r--r--src/gui/kernel/qpaintdevicewindow.h14
-rw-r--r--src/gui/kernel/qpaintdevicewindow_p.h26
-rw-r--r--src/gui/kernel/qpalette.cpp17
-rw-r--r--src/gui/kernel/qpalette.h17
-rw-r--r--src/gui/kernel/qpixelformat.cpp32
-rw-r--r--src/gui/kernel/qpixelformat.h33
-rw-r--r--src/gui/kernel/qplatformclipboard.cpp14
-rw-r--r--src/gui/kernel/qplatformclipboard.h14
-rw-r--r--src/gui/kernel/qplatformcursor.cpp14
-rw-r--r--src/gui/kernel/qplatformcursor.h14
-rw-r--r--src/gui/kernel/qplatformdialoghelper.cpp14
-rw-r--r--src/gui/kernel/qplatformdialoghelper.h14
-rw-r--r--src/gui/kernel/qplatformdrag.cpp73
-rw-r--r--src/gui/kernel/qplatformdrag.h14
-rw-r--r--src/gui/kernel/qplatformgraphicsbuffer.cpp269
-rw-r--r--src/gui/kernel/qplatformgraphicsbuffer.h109
-rw-r--r--src/gui/kernel/qplatformgraphicsbufferhelper.cpp184
-rw-r--r--src/gui/kernel/qplatformgraphicsbufferhelper.h48
-rw-r--r--src/gui/kernel/qplatforminputcontext.cpp24
-rw-r--r--src/gui/kernel/qplatforminputcontext.h14
-rw-r--r--src/gui/kernel/qplatforminputcontext_p.h14
-rw-r--r--src/gui/kernel/qplatforminputcontextfactory.cpp14
-rw-r--r--src/gui/kernel/qplatforminputcontextfactory_p.h14
-rw-r--r--src/gui/kernel/qplatforminputcontextplugin.cpp14
-rw-r--r--src/gui/kernel/qplatforminputcontextplugin_p.h14
-rw-r--r--src/gui/kernel/qplatformintegration.cpp71
-rw-r--r--src/gui/kernel/qplatformintegration.h29
-rw-r--r--src/gui/kernel/qplatformintegrationfactory.cpp14
-rw-r--r--src/gui/kernel/qplatformintegrationfactory_p.h14
-rw-r--r--src/gui/kernel/qplatformintegrationplugin.cpp14
-rw-r--r--src/gui/kernel/qplatformintegrationplugin.h14
-rw-r--r--src/gui/kernel/qplatformmenu.cpp14
-rw-r--r--src/gui/kernel/qplatformmenu.h15
-rw-r--r--src/gui/kernel/qplatformnativeinterface.cpp14
-rw-r--r--src/gui/kernel/qplatformnativeinterface.h14
-rw-r--r--src/gui/kernel/qplatformoffscreensurface.cpp14
-rw-r--r--src/gui/kernel/qplatformoffscreensurface.h16
-rw-r--r--src/gui/kernel/qplatformopenglcontext.cpp24
-rw-r--r--src/gui/kernel/qplatformopenglcontext.h16
-rw-r--r--src/gui/kernel/qplatformscreen.cpp136
-rw-r--r--src/gui/kernel/qplatformscreen.h27
-rw-r--r--src/gui/kernel/qplatformscreen_p.h16
-rw-r--r--src/gui/kernel/qplatformservices.cpp14
-rw-r--r--src/gui/kernel/qplatformservices.h14
-rw-r--r--src/gui/kernel/qplatformsessionmanager.cpp14
-rw-r--r--src/gui/kernel/qplatformsessionmanager.h14
-rw-r--r--src/gui/kernel/qplatformsharedgraphicscache.cpp14
-rw-r--r--src/gui/kernel/qplatformsharedgraphicscache.h14
-rw-r--r--src/gui/kernel/qplatformsurface.cpp14
-rw-r--r--src/gui/kernel/qplatformsurface.h14
-rw-r--r--src/gui/kernel/qplatformsystemtrayicon.cpp16
-rw-r--r--src/gui/kernel/qplatformsystemtrayicon.h16
-rw-r--r--src/gui/kernel/qplatformtheme.cpp117
-rw-r--r--src/gui/kernel/qplatformtheme.h22
-rw-r--r--src/gui/kernel/qplatformtheme_p.h14
-rw-r--r--src/gui/kernel/qplatformthemefactory.cpp14
-rw-r--r--src/gui/kernel/qplatformthemefactory_p.h14
-rw-r--r--src/gui/kernel/qplatformthemeplugin.cpp14
-rw-r--r--src/gui/kernel/qplatformthemeplugin.h14
-rw-r--r--src/gui/kernel/qplatformwindow.cpp54
-rw-r--r--src/gui/kernel/qplatformwindow.h17
-rw-r--r--src/gui/kernel/qplatformwindow_p.h14
-rw-r--r--src/gui/kernel/qrasterwindow.cpp14
-rw-r--r--src/gui/kernel/qrasterwindow.h14
-rw-r--r--src/gui/kernel/qscreen.cpp114
-rw-r--r--src/gui/kernel/qscreen.h15
-rw-r--r--src/gui/kernel/qscreen_p.h14
-rw-r--r--src/gui/kernel/qsessionmanager.cpp14
-rw-r--r--src/gui/kernel/qsessionmanager.h14
-rw-r--r--src/gui/kernel/qsessionmanager_p.h14
-rw-r--r--src/gui/kernel/qshapedpixmapdndwindow.cpp14
-rw-r--r--src/gui/kernel/qshapedpixmapdndwindow_p.h16
-rw-r--r--src/gui/kernel/qshortcutmap.cpp24
-rw-r--r--src/gui/kernel/qshortcutmap_p.h14
-rw-r--r--src/gui/kernel/qsimpledrag.cpp22
-rw-r--r--src/gui/kernel/qsimpledrag_p.h28
-rw-r--r--src/gui/kernel/qstylehints.cpp110
-rw-r--r--src/gui/kernel/qstylehints.h40
-rw-r--r--src/gui/kernel/qsurface.cpp14
-rw-r--r--src/gui/kernel/qsurface.h18
-rw-r--r--src/gui/kernel/qsurfaceformat.cpp29
-rw-r--r--src/gui/kernel/qsurfaceformat.h17
-rw-r--r--src/gui/kernel/qt_gui_pch.h14
-rw-r--r--src/gui/kernel/qtouchdevice.cpp17
-rw-r--r--src/gui/kernel/qtouchdevice.h17
-rw-r--r--src/gui/kernel/qtouchdevice_p.h14
-rw-r--r--src/gui/kernel/qwindow.cpp157
-rw-r--r--src/gui/kernel/qwindow.h32
-rw-r--r--src/gui/kernel/qwindow_p.h30
-rw-r--r--src/gui/kernel/qwindowdefs.h14
-rw-r--r--src/gui/kernel/qwindowdefs_win.h14
-rw-r--r--src/gui/kernel/qwindowsysteminterface.cpp80
-rw-r--r--src/gui/kernel/qwindowsysteminterface.h23
-rw-r--r--src/gui/kernel/qwindowsysteminterface_p.h39
134 files changed, 3056 insertions, 1453 deletions
diff --git a/src/gui/kernel/kernel.pri b/src/gui/kernel/kernel.pri
index 1169985ea8..af6a417608 100644
--- a/src/gui/kernel/kernel.pri
+++ b/src/gui/kernel/kernel.pri
@@ -71,7 +71,11 @@ HEADERS += \
kernel/qpixelformat.h \
kernel/qpaintdevicewindow.h \
kernel/qpaintdevicewindow_p.h \
- kernel/qrasterwindow.h
+ kernel/qrasterwindow.h \
+ kernel/qplatformgraphicsbuffer.h \
+ kernel/qplatformgraphicsbufferhelper.h \
+ kernel/qinputdevicemanager_p.h \
+ kernel/qinputdevicemanager_p_p.h
SOURCES += \
kernel/qgenericpluginfactory.cpp \
@@ -124,7 +128,10 @@ SOURCES += \
kernel/qplatformmenu.cpp \
kernel/qpixelformat.cpp \
kernel/qpaintdevicewindow.cpp \
- kernel/qrasterwindow.cpp
+ kernel/qrasterwindow.cpp \
+ kernel/qplatformgraphicsbuffer.cpp \
+ kernel/qplatformgraphicsbufferhelper.cpp \
+ kernel/qinputdevicemanager.cpp
contains(QT_CONFIG, opengl)|contains(QT_CONFIG, opengles2) {
HEADERS += \
diff --git a/src/gui/kernel/qclipboard.cpp b/src/gui/kernel/qclipboard.cpp
index ec7a98571d..402f5005fd 100644
--- a/src/gui/kernel/qclipboard.cpp
+++ b/src/gui/kernel/qclipboard.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 QtGui 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/gui/kernel/qclipboard.h b/src/gui/kernel/qclipboard.h
index 3a5700518d..a285e188a6 100644
--- a/src/gui/kernel/qclipboard.h
+++ b/src/gui/kernel/qclipboard.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 QtGui 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/gui/kernel/qcursor.cpp b/src/gui/kernel/qcursor.cpp
index 235d2b3053..6ed750eda1 100644
--- a/src/gui/kernel/qcursor.cpp
+++ b/src/gui/kernel/qcursor.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 QtGui 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$
@@ -33,8 +33,6 @@
#include "qcursor.h"
-#ifndef QT_NO_CURSOR
-
#include <qcoreapplication.h>
#include <qbitmap.h>
#include <qimage.h>
@@ -149,6 +147,16 @@ QT_BEGIN_NAMESPACE
*/
/*!
+ \fn QCursor::QCursor(QCursor &&other)
+ \since 5.5
+
+ Move-constructs a cursor from \a other. After being moved from,
+ the only valid operations on \a other are destruction and
+ (move and copy) assignment. The effects of calling any other
+ member function on a moved-from instance are undefined.
+*/
+
+/*!
\fn QCursor &QCursor::operator=(QCursor &&other)
Move-assigns \a other to this QCursor instance.
@@ -249,6 +257,8 @@ void QCursor::setPos(int x, int y)
QCursor::setPos(QGuiApplication::primaryScreen(), x, y);
}
+#ifndef QT_NO_CURSOR
+
/*!
\fn void QCursor::setPos (const QPoint &p)
@@ -591,8 +601,9 @@ QCursor::operator QVariant() const
#ifndef QT_NO_DEBUG_STREAM
QDebug operator<<(QDebug dbg, const QCursor &c)
{
+ QDebugStateSaver saver(dbg);
dbg.nospace() << "QCursor(Qt::CursorShape(" << c.shape() << "))";
- return dbg.space();
+ return dbg;
}
#endif
diff --git a/src/gui/kernel/qcursor.h b/src/gui/kernel/qcursor.h
index 72c6a6504f..5f32192b8d 100644
--- a/src/gui/kernel/qcursor.h
+++ b/src/gui/kernel/qcursor.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 QtGui 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$
@@ -80,6 +80,7 @@ public:
~QCursor();
QCursor &operator=(const QCursor &cursor);
#ifdef Q_COMPILER_RVALUE_REFS
+ QCursor(QCursor &&other) Q_DECL_NOTHROW : d(other.d) { other.d = Q_NULLPTR; }
inline QCursor &operator=(QCursor &&other)
{ qSwap(d, other.d); return *this; }
#endif
diff --git a/src/gui/kernel/qcursor_p.h b/src/gui/kernel/qcursor_p.h
index fe4c26b081..0aaa62b891 100644
--- a/src/gui/kernel/qcursor_p.h
+++ b/src/gui/kernel/qcursor_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 QtGui 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/gui/kernel/qdnd.cpp b/src/gui/kernel/qdnd.cpp
index 2a6cc4fc99..3ce8ab95ec 100644
--- a/src/gui/kernel/qdnd.cpp
+++ b/src/gui/kernel/qdnd.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 QtGui 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/gui/kernel/qdnd_p.h b/src/gui/kernel/qdnd_p.h
index 573035ce24..537984f9df 100644
--- a/src/gui/kernel/qdnd_p.h
+++ b/src/gui/kernel/qdnd_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 QtGui 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$
@@ -70,8 +70,8 @@ public:
QInternalMimeData();
~QInternalMimeData();
- bool hasFormat(const QString &mimeType) const;
- QStringList formats() const;
+ bool hasFormat(const QString &mimeType) const Q_DECL_OVERRIDE;
+ QStringList formats() const Q_DECL_OVERRIDE;
static bool canReadData(const QString &mimeType);
@@ -80,7 +80,7 @@ public:
static QByteArray renderDataHelper(const QString &mimeType, const QMimeData *data);
protected:
- QVariant retrieveData(const QString &mimeType, QVariant::Type type) const;
+ QVariant retrieveData(const QString &mimeType, QVariant::Type type) const Q_DECL_OVERRIDE;
virtual bool hasFormat_sys(const QString &mimeType) const = 0;
virtual QStringList formats_sys() const = 0;
diff --git a/src/gui/kernel/qdrag.cpp b/src/gui/kernel/qdrag.cpp
index 97913e0ddd..723b83d338 100644
--- a/src/gui/kernel/qdrag.cpp
+++ b/src/gui/kernel/qdrag.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 QtGui 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/gui/kernel/qdrag.h b/src/gui/kernel/qdrag.h
index 57d2519464..0672cb00f9 100644
--- a/src/gui/kernel/qdrag.h
+++ b/src/gui/kernel/qdrag.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 QtGui 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/gui/kernel/qevent.cpp b/src/gui/kernel/qevent.cpp
index 60e7b97f12..11f7f13552 100644
--- a/src/gui/kernel/qevent.cpp
+++ b/src/gui/kernel/qevent.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 QtGui 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,13 +37,13 @@
#include "qpa/qplatformintegration.h"
#include "qpa/qplatformdrag.h"
#include "private/qevent_p.h"
-#include "qdebug.h"
#include "qmetaobject.h"
#include "qmimedata.h"
#include "private/qdnd_p.h"
#include "qevent_p.h"
#include "qmath.h"
+#include <private/qdebug_p.h>
QT_BEGIN_NAMESPACE
@@ -575,7 +575,8 @@ QHoverEvent::~QHoverEvent()
wheel event delta: angleDelta() returns the delta in wheel
degrees. This value is always provided. pixelDelta() returns
the delta in screen pixels and is available on platforms that
- have high-resolution trackpads, such as Mac OS X.
+ have high-resolution trackpads, such as Mac OS X. If that is the
+ case, source() will return Qt::MouseEventSynthesizedBySystem.
The functions pos() and globalPos() return the mouse cursor's
location at the time of the event.
@@ -600,6 +601,22 @@ QHoverEvent::~QHoverEvent()
*/
/*!
+ \fn Qt::MouseEventSource QWheelEvent::source() const
+ \since 5.5
+
+ Returns information about the wheel event source.
+
+ The source can be used to distinguish between events that come from a mouse
+ with a physical wheel and events that are generated by some other means,
+ such as a flick gesture on a touchpad.
+
+ \note Many platforms provide no such information. On such platforms
+ \l Qt::MouseEventNotSynthesized is returned always.
+
+ \sa Qt::MouseEventSource
+*/
+
+/*!
\fn Qt::Orientation QWheelEvent::orientation() const
\obsolete
@@ -731,7 +748,44 @@ QWheelEvent::QWheelEvent(const QPointF &pos, const QPointF& globalPos,
QPoint pixelDelta, QPoint angleDelta, int qt4Delta, Qt::Orientation qt4Orientation,
Qt::MouseButtons buttons, Qt::KeyboardModifiers modifiers, Qt::ScrollPhase phase)
: QInputEvent(Wheel, modifiers), p(pos), g(globalPos), pixelD(pixelDelta),
- angleD(angleDelta), qt4D(qt4Delta), qt4O(qt4Orientation), mouseState(buttons), ph(phase)
+ angleD(angleDelta), qt4D(qt4Delta), qt4O(qt4Orientation), mouseState(buttons), ph(phase),
+ src(Qt::MouseEventNotSynthesized)
+{}
+
+/*!
+ Constructs a wheel event object.
+
+ The \a pos provides the location of the mouse cursor
+ within the window. The position in global coordinates is specified
+ by \a globalPos.
+
+ \a pixelDelta contains the scrolling distance in pixels on screen, while
+ \a angleDelta contains the wheel rotation distance. \a pixelDelta is
+ optional and can be null.
+
+ The mouse and keyboard states at the time of the event are specified by
+ \a buttons and \a modifiers.
+
+ For backwards compatibility, the event can also hold monodirectional wheel
+ event data: \a qt4Delta specifies the rotation, and \a qt4Orientation the
+ direction.
+
+ The scrolling phase of the event is specified by \a phase.
+
+ If the wheel event comes from a physical mouse wheel, \a source is set to
+ Qt::MouseEventNotSynthesized. If it comes from a gesture detected by the
+ operating system, or from a non-mouse hardware device, such that \a pixelDelta is
+ directly related to finger movement, \a source is set to Qt::MouseEventSynthesizedBySystem.
+ If it comes from Qt, source would be set to Qt::MouseEventSynthesizedByQt.
+
+ \sa posF(), globalPosF(), angleDelta(), pixelDelta(), phase()
+*/
+
+QWheelEvent::QWheelEvent(const QPointF &pos, const QPointF& globalPos,
+ QPoint pixelDelta, QPoint angleDelta, int qt4Delta, Qt::Orientation qt4Orientation,
+ Qt::MouseButtons buttons, Qt::KeyboardModifiers modifiers, Qt::ScrollPhase phase, Qt::MouseEventSource source)
+ : QInputEvent(Wheel, modifiers), p(pos), g(globalPos), pixelD(pixelDelta),
+ angleD(angleDelta), qt4D(qt4Delta), qt4O(qt4Orientation), mouseState(buttons), ph(phase), src(source)
{}
#endif // QT_NO_WHEELEVENT
@@ -1324,6 +1378,55 @@ QExposeEvent::~QExposeEvent()
}
/*!
+ \class QPlatformSurfaceEvent
+ \since 5.5
+ \brief The QPlatformSurfaceEvent class is used to notify about native platform surface events.
+ \inmodule QtGui
+
+ \ingroup events
+
+ Platform window events are synchronously sent to windows and offscreen surfaces when their
+ underlying native surfaces are created or are about to be destroyed.
+
+ Applications can respond to these events to know when the underlying platform
+ surface exists.
+*/
+
+/*!
+ \enum QPlatformSurfaceEvent::SurfaceEventType
+
+ This enum describes the type of platform surface event. The possible types are:
+
+ \value SurfaceCreated The underlying native surface has been created
+ \value SurfaceAboutToBeDestroyed The underlying native surface will be destroyed immediately after this event
+
+ The \c SurfaceAboutToBeDestroyed event type is useful as a means of stopping rendering to
+ a platform window before it is destroyed.
+*/
+
+/*!
+ \fn QPlatformSurfaceEvent::SurfaceEventType QPlatformSurfaceEvent::surfaceEventType() const
+
+ Returns the specific type of platform surface event.
+*/
+
+/*!
+ Constructs a platform surface event for the given \a surfaceEventType.
+*/
+QPlatformSurfaceEvent::QPlatformSurfaceEvent(SurfaceEventType surfaceEventType)
+ : QEvent(PlatformSurface)
+ , m_surfaceEventType(surfaceEventType)
+{
+}
+
+/*!
+ \internal
+*/
+QPlatformSurfaceEvent::~QPlatformSurfaceEvent()
+{
+}
+
+/*!
\fn const QRegion &QExposeEvent::region() const
Returns the window area that has been exposed. The region is given in local coordinates.
@@ -3358,29 +3461,12 @@ QShortcutEvent::~QShortcutEvent()
#ifndef QT_NO_DEBUG_STREAM
-static inline void formatTouchPoint(QDebug d, const QTouchEvent::TouchPoint &tp)
+static inline void formatTouchEvent(QDebug d, const QTouchEvent &t)
{
- d << "TouchPoint(" << tp.id() << ' ' << tp.rect();
- switch (tp.state()) {
- case Qt::TouchPointPressed:
- d << " pressed";
- break;
- case Qt::TouchPointReleased:
- d << " released";
- break;
- case Qt::TouchPointMoved:
- d << " moved";
- break;
- case Qt::TouchPointStationary:
- d << " stationary";
- break;
- }
- d << ')';
-}
-
-static inline void formatTouchEvent(QDebug d, const char *name, const QTouchEvent &t)
-{
- d << "QTouchEvent(" << name << " states: " << t.touchPointStates();
+ d << "QTouchEvent(";
+ QtDebugUtils::formatQEnum(d, t.type());
+ d << " states: ";
+ QtDebugUtils::formatQFlags(d, t.touchPointStates());
d << ", " << t.touchPoints().size() << " points: " << t.touchPoints() << ')';
}
@@ -3439,14 +3525,6 @@ static inline void formatInputMethodQueryEvent(QDebug d, const QInputMethodQuery
d << "})";
}
-static const char *eventTypeName(QEvent::Type t)
-{
- static const int enumIdx = QEvent::staticMetaObject.indexOfEnumerator("Type");
- return t <= QEvent::User
- ? QEvent::staticMetaObject.enumerator(enumIdx).valueToKey(t)
- : "User";
-}
-
static const char *eventClassName(QEvent::Type t)
{
switch (t) {
@@ -3556,74 +3634,33 @@ static const char *eventClassName(QEvent::Type t)
return "QGraphicsSceneEvent";
case QEvent::Timer:
return "QTimerEvent";
+ case QEvent::PlatformSurface:
+ return "QPlatformSurfaceEvent";
default:
break;
}
return "QEvent";
}
-namespace {
-// Make protected QObject::staticQtMetaObject accessible for formatting enums.
-class DebugHelper : public QObject {
-public:
- static const char *mouseButtonToString(Qt::MouseButton button)
- {
- static const int enumIdx = QObject::staticQtMetaObject.indexOfEnumerator("MouseButtons");
- return QObject::staticQtMetaObject.enumerator(enumIdx).valueToKey(button);
- }
-
- static QByteArray mouseButtonsToString(Qt::MouseButtons buttons)
- {
- QByteArray result;
- for (int i = 0; (uint)(1 << i) <= Qt::MaxMouseButton; ++i) {
- const Qt::MouseButton button = static_cast<Qt::MouseButton>(1 << i);
- if (buttons.testFlag(button)) {
- if (!result.isEmpty())
- result.append('|');
- result.append(mouseButtonToString(button));
- }
- }
- if (result.isEmpty())
- result.append("NoButton");
- return result;
- }
-
- static const char *mouseEventSourceToString(Qt::MouseEventSource source)
- {
- static const int enumIdx = QObject::staticQtMetaObject.indexOfEnumerator("MouseEventSource");
- return QObject::staticQtMetaObject.enumerator(enumIdx).valueToKey(source);
- }
-
- static const char *focusReasonToString(Qt::FocusReason reason)
- {
- static const int enumIdx = QObject::staticQtMetaObject.indexOfEnumerator("FocusReason");
- return QObject::staticQtMetaObject.enumerator(enumIdx).valueToKey(reason);
- }
-
-# ifndef QT_NO_GESTURES
- static const char *nativeGestureTypeToString(Qt::NativeGestureType type)
- {
- static const int enumIdx = QObject::staticQtMetaObject.indexOfEnumerator("NativeGestureType");
- return QObject::staticQtMetaObject.enumerator(enumIdx).valueToKey(type);
- }
-# endif // !QT_NO_GESTURES
-};
-} // namespace
-
# ifndef QT_NO_DRAGANDDROP
static void formatDropEvent(QDebug d, const QDropEvent *e)
{
const QEvent::Type type = e->type();
- d << eventClassName(type) << "(dropAction=" << e->dropAction() << ", proposedAction="
- << e->proposedAction() << ", possibleActions=" << e->possibleActions()
- << ", posF=" << e->posF();
+ d << eventClassName(type) << "(dropAction=";
+ QtDebugUtils::formatQEnum(d, e->dropAction());
+ d << ", proposedAction=";
+ QtDebugUtils::formatQEnum(d, e->proposedAction());
+ d << ", possibleActions=";
+ QtDebugUtils::formatQFlags(d, e->possibleActions());
+ d << ", posF=";
+ QtDebugUtils::formatQPoint(d, e->posF());
if (type == QEvent::DragMove || type == QEvent::DragEnter)
d << ", answerRect=" << static_cast<const QDragMoveEvent *>(e)->answerRect();
d << ", formats=" << e->mimeData()->formats();
- if (const Qt::KeyboardModifiers mods = e->keyboardModifiers())
- d << ", keyboardModifiers=" << mods;
- d << ", " << DebugHelper::mouseButtonsToString(e->mouseButtons()).constData();
+ QtDebugUtils::formatNonNullQFlags(d, ", keyboardModifiers=", e->keyboardModifiers());
+ d << ", ";
+ QtDebugUtils::formatQFlags(d, e->mouseButtons());
}
# endif // !QT_NO_DRAGANDDROP
@@ -3634,20 +3671,19 @@ static void formatTabletEvent(QDebug d, const QTabletEvent *e)
{
const QEvent::Type type = e->type();
- static const int deviceEnumIdx = QTabletEvent::staticMetaObject.indexOfEnumerator("TabletDevice");
- static const int pointerTypeEnumIdx = QTabletEvent::staticMetaObject.indexOfEnumerator("PointerType");
- const char* device = QTabletEvent::staticMetaObject.enumerator(deviceEnumIdx).valueToKey(e->device());
- const char* pointerType = QTabletEvent::staticMetaObject.enumerator(pointerTypeEnumIdx).valueToKey(e->pointerType());
-
- d << eventClassName(type) << '(' << eventTypeName(type)
- << ", device=" << device
- << ", pointerType=" << pointerType
- << ", uniqueId=" << e->uniqueId()
+ d << eventClassName(type) << '(';
+ QtDebugUtils::formatQEnum(d, type);
+ d << ", device=";
+ QtDebugUtils::formatQEnum(d, e->device());
+ d << ", pointerType=";
+ QtDebugUtils::formatQEnum(d, e->pointerType());
+ d << ", uniqueId=" << e->uniqueId()
<< ", pos=" << e->posF()
<< ", z=" << e->z()
<< ", xTilt=" << e->xTilt()
<< ", yTilt=" << e->yTilt()
- << ", " << DebugHelper::mouseButtonsToString(e->buttons()).constData();
+ << ", ";
+ QtDebugUtils::formatQFlags(d, e->buttons());
if (type == QEvent::TabletPress || type == QEvent::TabletMove)
d << ", pressure=" << e->pressure();
if (e->device() == QTabletEvent::RotationStylus || e->device() == QTabletEvent::FourDMouse)
@@ -3662,7 +3698,18 @@ QDebug operator<<(QDebug dbg, const QTouchEvent::TouchPoint &tp)
{
QDebugStateSaver saver(dbg);
dbg.nospace();
- formatTouchPoint(dbg, tp);
+ dbg << "TouchPoint(" << tp.id() << " (";
+ QtDebugUtils::formatQRect(dbg, tp.rect());
+ dbg << ") ";
+ QtDebugUtils::formatQEnum(dbg, tp.state());
+ dbg << " press " << tp.pressure() << " vel " << tp.velocity()
+ << " start (";
+ QtDebugUtils::formatQPoint(dbg, tp.startPos());
+ dbg << ") last (";
+ QtDebugUtils::formatQPoint(dbg, tp.lastPos());
+ dbg << ") delta (";
+ QtDebugUtils::formatQPoint(dbg, tp.pos() - tp.lastPos());
+ dbg << ')';
return dbg;
}
@@ -3692,18 +3739,23 @@ QDebug operator<<(QDebug dbg, const QEvent *e)
const QMouseEvent *me = static_cast<const QMouseEvent*>(e);
const Qt::MouseButton button = me->button();
const Qt::MouseButtons buttons = me->buttons();
- dbg << "QMouseEvent(" << eventTypeName(type);
- if (type != QEvent::MouseMove && type != QEvent::NonClientAreaMouseMove)
- dbg << ", " << DebugHelper::mouseButtonToString(button);
- if (buttons && button != buttons)
- dbg << ", buttons=" << DebugHelper::mouseButtonsToString(buttons).constData();
- if (const int mods = int(me->modifiers()))
- dbg << ", modifiers=0x" << hex << mods << dec;
- dbg << ", localPos=" << me->localPos() << ", screenPos=" << me->screenPos();
- if (me->source())
- dbg << ", " << DebugHelper::mouseEventSourceToString(me->source());
- if (const Qt::MouseEventFlags flags = me->flags())
- dbg << ", flags = " << hex << int(flags) << dec;
+ dbg << "QMouseEvent(";
+ QtDebugUtils::formatQEnum(dbg, type);
+ if (type != QEvent::MouseMove && type != QEvent::NonClientAreaMouseMove) {
+ dbg << ", ";
+ QtDebugUtils::formatQEnum(dbg, button);
+ }
+ if (buttons && button != buttons) {
+ dbg << ", buttons=";
+ QtDebugUtils::formatQFlags(dbg, buttons);
+ }
+ QtDebugUtils::formatNonNullQFlags(dbg, ", ", me->modifiers());
+ dbg << ", localPos=";
+ QtDebugUtils::formatQPoint(dbg, me->localPos());
+ dbg << ", screenPos=";
+ QtDebugUtils::formatQPoint(dbg, me->screenPos());
+ QtDebugUtils::formatNonNullQEnum(dbg, ", ", me->source());
+ QtDebugUtils::formatNonNullQFlags(dbg, ", flags=", me->flags());
dbg << ')';
}
break;
@@ -3719,10 +3771,11 @@ QDebug operator<<(QDebug dbg, const QEvent *e)
case QEvent::ShortcutOverride:
{
const QKeyEvent *ke = static_cast<const QKeyEvent *>(e);
- dbg << "QKeyEvent(" << eventTypeName(type)
- << ", key=0x" << hex << ke->key() << dec;
- if (const int mods = ke->modifiers())
- dbg << ", modifiers=0x" << hex << mods << dec;
+ dbg << "QKeyEvent(";
+ QtDebugUtils::formatQEnum(dbg, type);
+ dbg << ", ";
+ QtDebugUtils::formatQEnum(dbg, static_cast<Qt::Key>(ke->key()));
+ QtDebugUtils::formatNonNullQFlags(dbg, ", ", ke->modifiers());
if (!ke->text().isEmpty())
dbg << ", text=" << ke->text();
if (ke->isAutoRepeat())
@@ -3741,13 +3794,16 @@ QDebug operator<<(QDebug dbg, const QEvent *e)
case QEvent::FocusAboutToChange:
case QEvent::FocusIn:
case QEvent::FocusOut:
- dbg << "QFocusEvent(" << eventTypeName(type) << ", "
- << DebugHelper::focusReasonToString(static_cast<const QFocusEvent *>(e)->reason())
- << ')';
+ dbg << "QFocusEvent(";
+ QtDebugUtils::formatQEnum(dbg, type);
+ dbg << ", ";
+ QtDebugUtils::formatQEnum(dbg, static_cast<const QFocusEvent *>(e)->reason());
+ dbg << ')';
break;
case QEvent::Move: {
const QMoveEvent *me = static_cast<const QMoveEvent *>(e);
- dbg << "QMoveEvent(" << me->pos();
+ dbg << "QMoveEvent(";
+ QtDebugUtils::formatQPoint(dbg, me->pos());
if (!me->spontaneous())
dbg << ", non-spontaneous";
dbg << ')';
@@ -3755,7 +3811,8 @@ QDebug operator<<(QDebug dbg, const QEvent *e)
break;
case QEvent::Resize: {
const QResizeEvent *re = static_cast<const QResizeEvent *>(e);
- dbg << "QResizeEvent(" << re->size();
+ dbg << "QResizeEvent(";
+ QtDebugUtils::formatQSize(dbg, re->size());
if (!re->spontaneous())
dbg << ", non-spontaneous";
dbg << ')';
@@ -3777,24 +3834,30 @@ QDebug operator<<(QDebug dbg, const QEvent *e)
case QEvent::TouchBegin:
case QEvent::TouchUpdate:
case QEvent::TouchEnd:
- formatTouchEvent(dbg, eventTypeName(type), *static_cast<const QTouchEvent*>(e));
+ formatTouchEvent(dbg, *static_cast<const QTouchEvent*>(e));
break;
case QEvent::ChildAdded:
case QEvent::ChildPolished:
case QEvent::ChildRemoved:
- dbg << "QChildEvent(" << eventTypeName(type) << ", " << (static_cast<const QChildEvent*>(e))->child() << ')';
+ dbg << "QChildEvent(";
+ QtDebugUtils::formatQEnum(dbg, type);
+ dbg << ", " << (static_cast<const QChildEvent*>(e))->child() << ')';
break;
# ifndef QT_NO_GESTURES
case QEvent::NativeGesture: {
const QNativeGestureEvent *ne = static_cast<const QNativeGestureEvent *>(e);
- dbg << "QNativeGestureEvent(" << DebugHelper::nativeGestureTypeToString(ne->gestureType())
- << "localPos=" << ne->localPos() << ", value=" << ne->value() << ')';
+ dbg << "QNativeGestureEvent(";
+ QtDebugUtils::formatQEnum(dbg, ne->gestureType());
+ dbg << "localPos=";
+ QtDebugUtils::formatQPoint(dbg, ne->localPos());
+ dbg << ", value=" << ne->value() << ')';
}
break;
# endif // !QT_NO_GESTURES
case QEvent::ApplicationStateChange:
- dbg << "QApplicationStateChangeEvent("
- << static_cast<const QApplicationStateChangeEvent *>(e)->applicationState() << ')';
+ dbg << "QApplicationStateChangeEvent(";
+ QtDebugUtils::formatQEnum(dbg, static_cast<const QApplicationStateChangeEvent *>(e)->applicationState());
+ dbg << ')';
break;
case QEvent::ContextMenu:
dbg << "QContextMenuEvent(" << static_cast<const QContextMenuEvent *>(e)->pos() << ')';
@@ -3814,9 +3877,22 @@ QDebug operator<<(QDebug dbg, const QEvent *e)
case QEvent::Timer:
dbg << "QTimerEvent(id=" << static_cast<const QTimerEvent *>(e)->timerId() << ')';
break;
+ case QEvent::PlatformSurface:
+ dbg << "QPlatformSurfaceEvent(surfaceEventType=";
+ switch (static_cast<const QPlatformSurfaceEvent *>(e)->surfaceEventType()) {
+ case QPlatformSurfaceEvent::SurfaceCreated:
+ dbg << "SurfaceCreated";
+ break;
+ case QPlatformSurfaceEvent::SurfaceAboutToBeDestroyed:
+ dbg << "SurfaceAboutToBeDestroyed";
+ break;
+ }
+ dbg << ')';
+ break;
default:
- dbg << eventClassName(type) << '(' << eventTypeName(type) << ", "
- << (const void *)e << ", type = " << e->type() << ')';
+ dbg << eventClassName(type) << '(';
+ QtDebugUtils::formatQEnum(dbg, type);
+ dbg << ", " << (const void *)e << ')';
break;
}
return dbg;
diff --git a/src/gui/kernel/qevent.h b/src/gui/kernel/qevent.h
index 6fca54e2b6..e931e28a2e 100644
--- a/src/gui/kernel/qevent.h
+++ b/src/gui/kernel/qevent.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 QtGui 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$
@@ -162,6 +162,8 @@ protected:
class Q_GUI_EXPORT QWheelEvent : public QInputEvent
{
public:
+ enum { DefaultDeltasPerStep = 120 };
+
QWheelEvent(const QPointF &pos, int delta,
Qt::MouseButtons buttons, Qt::KeyboardModifiers modifiers,
Qt::Orientation orient = Qt::Vertical);
@@ -174,7 +176,9 @@ public:
QWheelEvent(const QPointF &pos, const QPointF& globalPos,
QPoint pixelDelta, QPoint angleDelta, int qt4Delta, Qt::Orientation qt4Orientation,
Qt::MouseButtons buttons, Qt::KeyboardModifiers modifiers, Qt::ScrollPhase phase);
-
+ QWheelEvent(const QPointF &pos, const QPointF &globalPos, QPoint pixelDelta, QPoint angleDelta,
+ int qt4Delta, Qt::Orientation qt4Orientation, Qt::MouseButtons buttons,
+ Qt::KeyboardModifiers modifiers, Qt::ScrollPhase phase, Qt::MouseEventSource source);
~QWheelEvent();
@@ -199,6 +203,8 @@ public:
inline Qt::ScrollPhase phase() const { return Qt::ScrollPhase(ph); }
+ Qt::MouseEventSource source() const { return Qt::MouseEventSource(src); }
+
protected:
QPointF p;
QPointF g;
@@ -208,7 +214,8 @@ protected:
Qt::Orientation qt4O;
Qt::MouseButtons mouseState;
uint ph : 2;
- int reserved : 30;
+ uint src: 2;
+ int reserved : 28;
};
#endif
@@ -216,12 +223,12 @@ protected:
class Q_GUI_EXPORT QTabletEvent : public QInputEvent
{
Q_GADGET
- Q_ENUMS(TabletDevice)
- Q_ENUMS(PointerType)
public:
enum TabletDevice { NoDevice, Puck, Stylus, Airbrush, FourDMouse,
XFreeEraser /*internal*/, RotationStylus };
+ Q_ENUM(TabletDevice)
enum PointerType { UnknownPointer, Pen, Cursor, Eraser };
+ Q_ENUM(PointerType)
QTabletEvent(Type t, const QPointF &pos, const QPointF &globalPos,
int device, int pointerType, qreal pressure, int xTilt, int yTilt,
qreal tangentialPressure, qreal rotation, int z,
@@ -408,6 +415,23 @@ protected:
QRegion rgn;
};
+class Q_GUI_EXPORT QPlatformSurfaceEvent : public QEvent
+{
+public:
+ enum SurfaceEventType {
+ SurfaceCreated,
+ SurfaceAboutToBeDestroyed
+ };
+
+ explicit QPlatformSurfaceEvent(SurfaceEventType surfaceEventType);
+ ~QPlatformSurfaceEvent();
+
+ inline SurfaceEventType surfaceEventType() const { return m_surfaceEventType; }
+
+protected:
+ SurfaceEventType m_surfaceEventType;
+};
+
class Q_GUI_EXPORT QResizeEvent : public QEvent
{
public:
diff --git a/src/gui/kernel/qevent_p.h b/src/gui/kernel/qevent_p.h
index 01c5be3b82..685b948e12 100644
--- a/src/gui/kernel/qevent_p.h
+++ b/src/gui/kernel/qevent_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 QtGui 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/gui/kernel/qgenericplugin.cpp b/src/gui/kernel/qgenericplugin.cpp
index db1984c3a2..47f3ea5811 100644
--- a/src/gui/kernel/qgenericplugin.cpp
+++ b/src/gui/kernel/qgenericplugin.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 QtGui 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/gui/kernel/qgenericplugin.h b/src/gui/kernel/qgenericplugin.h
index bcf6943a90..cfab34d081 100644
--- a/src/gui/kernel/qgenericplugin.h
+++ b/src/gui/kernel/qgenericplugin.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 QtGui 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/gui/kernel/qgenericpluginfactory.cpp b/src/gui/kernel/qgenericpluginfactory.cpp
index 599f7f345a..7e4727df8c 100644
--- a/src/gui/kernel/qgenericpluginfactory.cpp
+++ b/src/gui/kernel/qgenericpluginfactory.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 QtGui 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/gui/kernel/qgenericpluginfactory.h b/src/gui/kernel/qgenericpluginfactory.h
index c2faa881f7..f5bfe22042 100644
--- a/src/gui/kernel/qgenericpluginfactory.h
+++ b/src/gui/kernel/qgenericpluginfactory.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 QtGui 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/gui/kernel/qguiapplication.cpp b/src/gui/kernel/qguiapplication.cpp
index a3ac0ff189..3e2b692cd0 100644
--- a/src/gui/kernel/qguiapplication.cpp
+++ b/src/gui/kernel/qguiapplication.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 QtGui 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$
@@ -75,6 +75,7 @@
#include "private/qwindow_p.h"
#include "private/qcursor_p.h"
#include "private/qopenglcontext_p.h"
+#include "private/qinputdevicemanager_p.h"
#include "private/qdnd_p.h"
#include <qpa/qplatformthemefactory_p.h>
@@ -104,6 +105,14 @@
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 QGuiApplication first."); \
+ return __VA_ARGS__; \
+ }
+
Q_GUI_EXPORT bool qt_is_gui_used = true;
Qt::MouseButtons QGuiApplicationPrivate::mouse_buttons = Qt::NoButton;
@@ -138,12 +147,15 @@ QString *QGuiApplicationPrivate::displayName = 0;
QPalette *QGuiApplicationPrivate::app_pal = 0; // default application palette
Qt::MouseButtons QGuiApplicationPrivate::buttons = Qt::NoButton;
+
ulong QGuiApplicationPrivate::mousePressTime = 0;
Qt::MouseButton QGuiApplicationPrivate::mousePressButton = Qt::NoButton;
int QGuiApplicationPrivate::mousePressX = 0;
int QGuiApplicationPrivate::mousePressY = 0;
int QGuiApplicationPrivate::mouse_double_click_distance = -1;
+QWindow *QGuiApplicationPrivate::currentMousePressWindow = 0;
+
static Qt::LayoutDirection layout_direction = Qt::LeftToRight;
static bool force_reverse = false;
@@ -162,21 +174,25 @@ QWindow *QGuiApplicationPrivate::focus_window = 0;
static QBasicMutex applicationFontMutex;
QFont *QGuiApplicationPrivate::app_font = 0;
+QStyleHints *QGuiApplicationPrivate::styleHints = Q_NULLPTR;
bool QGuiApplicationPrivate::obey_desktop_settings = true;
+QInputDeviceManager *QGuiApplicationPrivate::m_inputDeviceManager = 0;
+
static qreal fontSmoothingGamma = 1.7;
extern void qRegisterGuiVariant();
#ifndef QT_NO_ANIMATION
extern void qRegisterGuiGetInterpolator();
#endif
+extern void qInitBlendFunctions();
extern void qInitDrawhelperAsm();
extern void qInitImageConversions();
static bool qt_detectRTLLanguage()
{
return force_reverse ^
- (QCoreApplication::tr("QT_LAYOUT_DIRECTION",
+ (QGuiApplication::tr("QT_LAYOUT_DIRECTION",
"Translate this string to the string 'LTR' in left-to-right"
" languages or to 'RTL' in right-to-left languages (such as Hebrew"
" and Arabic) to get proper widget layout.") == QLatin1String("RTL"));
@@ -215,11 +231,6 @@ static inline void clearFontUnlocked()
QGuiApplicationPrivate::app_font = 0;
}
-static inline bool isPopupWindow(const QWindow *w)
-{
- return (w->flags() & Qt::WindowType_Mask) == Qt::Popup;
-}
-
// Geometry specification for top level windows following the convention of the
// -geometry command line arguments in X11 (see XParseGeometry).
struct QWindowGeometrySpecification
@@ -597,7 +608,6 @@ QGuiApplication::~QGuiApplication()
QGuiApplicationPrivate::QGuiApplicationPrivate(int &argc, char **argv, int flags)
: QCoreApplicationPrivate(argc, argv, flags),
- styleHints(0),
inputMethod(0),
lastTouchType(QEvent::TouchEnd),
ownGlobalShareContext(false)
@@ -650,6 +660,7 @@ QString QGuiApplication::applicationDisplayName()
*/
QWindow *QGuiApplication::modalWindow()
{
+ CHECK_QAPP_INSTANCE(Q_NULLPTR)
if (QGuiApplicationPrivate::self->modalWindowList.isEmpty())
return 0;
return QGuiApplicationPrivate::self->modalWindowList.first();
@@ -671,7 +682,7 @@ static void updateBlockedStatusRecursion(QWindow *window, bool shouldBeBlocked)
void QGuiApplicationPrivate::updateBlockedStatus(QWindow *window)
{
bool shouldBeBlocked = false;
- if (!isPopupWindow(window) && !self->modalWindowList.isEmpty())
+ if (!QWindowPrivate::get(window)->isPopup() && !self->modalWindowList.isEmpty())
shouldBeBlocked = self->isWindowBlocked(window);
updateBlockedStatusRecursion(window, shouldBeBlocked);
}
@@ -681,7 +692,7 @@ void QGuiApplicationPrivate::showModalWindow(QWindow *modal)
self->modalWindowList.prepend(modal);
// Send leave for currently entered window if it should be blocked
- if (currentMouseWindow && !isPopupWindow(currentMouseWindow)) {
+ if (currentMouseWindow && !QWindowPrivate::get(currentMouseWindow)->isPopup()) {
bool shouldBeBlocked = self->isWindowBlocked(currentMouseWindow);
if (shouldBeBlocked) {
// Remove the new window from modalWindowList temporarily so leave can go through
@@ -790,12 +801,6 @@ bool QGuiApplicationPrivate::isWindowBlocked(QWindow *window, QWindow **blocking
return false;
}
-bool QGuiApplicationPrivate::synthesizeMouseFromTouchEventsEnabled()
-{
- return QCoreApplication::testAttribute(Qt::AA_SynthesizeMouseForUnhandledTouchEvents)
- && QGuiApplicationPrivate::platformIntegration()->styleHint(QPlatformIntegration::SynthesizeMouseFromTouchEvents).toBool();
-}
-
/*!
Returns the QWindow that receives events tied to focus,
such as key events.
@@ -872,9 +877,14 @@ QWindowList QGuiApplication::topLevelWindows()
}
/*!
- Returns the primary (or default) screen of the application.
+ Returns the primary (or default) screen of the application, or null if there is none
This will be the screen where QWindows are initially shown, unless otherwise specified.
+
+ On some platforms, it may be null when there are actually no screens connected.
+ It is not possible to start a new QGuiApplication while there are no screens.
+ Applications which were running at the time the primary screen was removed
+ will stop rendering graphics until one or more screens are restored.
*/
QScreen *QGuiApplication::primaryScreen()
{
@@ -1094,6 +1104,8 @@ static void init_plugins(const QList<QByteArray> &pluginList)
QLatin1String(pluginSpec.mid(colonPos+1)));
if (plugin)
QGuiApplicationPrivate::generic_plugin_list.append(plugin);
+ else
+ qWarning() << "No such plugin for spec " << pluginSpec;
}
}
@@ -1259,12 +1271,17 @@ void QGuiApplicationPrivate::init()
}
// Load environment exported generic plugins
- foreach (const QByteArray &plugin, qgetenv("QT_QPA_GENERIC_PLUGINS").split(','))
- pluginList << plugin;
+ QByteArray envPlugins = qgetenv("QT_QPA_GENERIC_PLUGINS");
+ if (!envPlugins.isEmpty()) {
+ foreach (const QByteArray &plugin, envPlugins.split(','))
+ pluginList << plugin;
+ }
if (platform_integration == 0)
createPlatformIntegration();
+ // Set up blend function tables.
+ qInitBlendFunctions();
// Set up which span functions should be used in raster engine...
qInitDrawhelperAsm();
// and QImage conversion functions
@@ -1352,7 +1369,8 @@ QGuiApplicationPrivate::~QGuiApplicationPrivate()
cleanupThreadData();
- delete styleHints;
+ delete QGuiApplicationPrivate::styleHints;
+ QGuiApplicationPrivate::styleHints = Q_NULLPTR;
delete inputMethod;
qt_cleanupFontDatabase();
@@ -1366,6 +1384,8 @@ QGuiApplicationPrivate::~QGuiApplicationPrivate()
}
#endif
+ platform_integration->destroy();
+
delete platform_theme;
platform_theme = 0;
delete platform_integration;
@@ -1430,6 +1450,7 @@ Qt::KeyboardModifiers QGuiApplication::keyboardModifiers()
*/
Qt::KeyboardModifiers QGuiApplication::queryKeyboardModifiers()
{
+ CHECK_QAPP_INSTANCE(Qt::KeyboardModifiers(0))
QPlatformIntegration *pi = QGuiApplicationPrivate::platformIntegration();
return pi->queryKeyboardModifiers();
}
@@ -1511,18 +1532,6 @@ int QGuiApplication::exec()
*/
bool QGuiApplication::notify(QObject *object, QEvent *event)
{
-#ifndef QT_NO_SHORTCUT
- if (event->type() == QEvent::KeyPress) {
- // Try looking for a Shortcut before sending key events
- QWindow *w = qobject_cast<QWindow *>(object);
- QObject *focus = w ? w->focusObject() : 0;
- if (!focus)
- focus = object;
- if (QGuiApplicationPrivate::instance()->shortcutMap.tryShortcutEvent(focus, static_cast<QKeyEvent *>(event)))
- return true;
- }
-#endif
-
if (object->isWindowType())
QGuiApplicationPrivate::sendQWindowEventToQPlatformWindow(static_cast<QWindow *>(object), event);
return QCoreApplication::notify(object, event);
@@ -1685,7 +1694,8 @@ void QGuiApplicationPrivate::processMouseEvent(QWindowSystemInterfacePrivate::Mo
// with the current event, we split it in two.
QWindowSystemInterfacePrivate::MouseEvent *mouseButtonEvent = new QWindowSystemInterfacePrivate::MouseEvent(
e->window.data(), e->timestamp, e->type, e->localPos, e->globalPos, e->buttons, e->modifiers);
- mouseButtonEvent->synthetic = e->synthetic;
+ if (e->flags & QWindowSystemInterfacePrivate::WindowSystemEvent::Synthetic)
+ mouseButtonEvent->flags |= QWindowSystemInterfacePrivate::WindowSystemEvent::Synthetic;
QWindowSystemInterfacePrivate::windowSystemEventQueue.prepend(mouseButtonEvent);
stateChange = Qt::NoButton;
}
@@ -1696,9 +1706,20 @@ void QGuiApplicationPrivate::processMouseEvent(QWindowSystemInterfacePrivate::Mo
QPointF localPoint = e->localPos;
QPointF globalPoint = e->globalPos;
- if (e->nullWindow) {
+ if (e->nullWindow()) {
window = QGuiApplication::topLevelAt(globalPoint.toPoint());
if (window) {
+ // Moves and the release following a press must go to the same
+ // window, even if the cursor has moved on over another window.
+ if (e->buttons != Qt::NoButton) {
+ if (!currentMousePressWindow)
+ currentMousePressWindow = window;
+ else
+ window = currentMousePressWindow;
+ } else if (currentMousePressWindow) {
+ window = currentMousePressWindow;
+ currentMousePressWindow = 0;
+ }
QPointF delta = globalPoint - globalPoint.toPoint();
localPoint = window->mapFromGlobal(globalPoint.toPoint()) + delta;
}
@@ -1729,7 +1750,7 @@ void QGuiApplicationPrivate::processMouseEvent(QWindowSystemInterfacePrivate::Mo
}
mouse_buttons = buttons = e->buttons;
if (button & e->buttons) {
- ulong doubleClickInterval = static_cast<ulong>(qApp->styleHints()->mouseDoubleClickInterval());
+ ulong doubleClickInterval = static_cast<ulong>(QGuiApplication::styleHints()->mouseDoubleClickInterval());
doubleClick = e->timestamp - mousePressTime < doubleClickInterval && button == mousePressButton;
type = frameStrut ? QEvent::NonClientAreaMouseButtonPress : QEvent::MouseButtonPress;
mousePressTime = e->timestamp;
@@ -1749,7 +1770,7 @@ void QGuiApplicationPrivate::processMouseEvent(QWindowSystemInterfacePrivate::Mo
ev.setTimestamp(e->timestamp);
setMouseEventSource(&ev, e->source);
#ifndef QT_NO_CURSOR
- if (!e->synthetic) {
+ if (!e->synthetic()) {
if (const QScreen *screen = window->screen())
if (QPlatformCursor *cursor = screen->handle()->cursor())
cursor->pointerEvent(ev);
@@ -1767,7 +1788,7 @@ void QGuiApplicationPrivate::processMouseEvent(QWindowSystemInterfacePrivate::Mo
}
QGuiApplication::sendSpontaneousEvent(window, &ev);
- if (!e->synthetic && !ev.isAccepted()
+ if (!e->synthetic() && !ev.isAccepted()
&& !frameStrut
&& qApp->testAttribute(Qt::AA_SynthesizeTouchForUnhandledMouseEvents)) {
if (!m_fakeTouchDevice) {
@@ -1798,12 +1819,12 @@ void QGuiApplicationPrivate::processMouseEvent(QWindowSystemInterfacePrivate::Mo
QList<QTouchEvent::TouchPoint> touchPoints = QWindowSystemInterfacePrivate::convertTouchPoints(points, &type);
QWindowSystemInterfacePrivate::TouchEvent fake(window, e->timestamp, type, m_fakeTouchDevice, touchPoints, e->modifiers);
- fake.synthetic = true;
+ fake.flags |= QWindowSystemInterfacePrivate::WindowSystemEvent::Synthetic;
processTouchEvent(&fake);
}
if (doubleClick) {
mousePressButton = Qt::NoButton;
- if (!e->window.isNull() || e->nullWindow) { // QTBUG-36364, check if window closed in response to press
+ if (!e->window.isNull() || e->nullWindow()) { // QTBUG-36364, check if window closed in response to press
const QEvent::Type doubleClickType = frameStrut ? QEvent::NonClientAreaMouseButtonDblClick : QEvent::MouseButtonDblClick;
QMouseEvent dblClickEvent(doubleClickType, localPoint, localPoint, globalPoint,
button, buttons, e->modifiers);
@@ -1821,7 +1842,7 @@ void QGuiApplicationPrivate::processWheelEvent(QWindowSystemInterfacePrivate::Wh
QPointF globalPoint = e->globalPos;
QPointF localPoint = e->localPos;
- if (e->nullWindow) {
+ if (e->nullWindow()) {
window = QGuiApplication::topLevelAt(globalPoint.toPoint());
if (window) {
QPointF delta = globalPoint - globalPoint.toPoint();
@@ -1840,7 +1861,7 @@ void QGuiApplicationPrivate::processWheelEvent(QWindowSystemInterfacePrivate::Wh
return;
}
- QWheelEvent ev(localPoint, globalPoint, e->pixelDelta, e->angleDelta, e->qt4Delta, e->qt4Orientation, buttons, e->modifiers, e->phase);
+ QWheelEvent ev(localPoint, globalPoint, e->pixelDelta, e->angleDelta, e->qt4Delta, e->qt4Orientation, buttons, e->modifiers, e->phase, e->source);
ev.setTimestamp(e->timestamp);
QGuiApplication::sendSpontaneousEvent(window, &ev);
#endif /* ifndef QT_NO_WHEELEVENT */
@@ -1852,7 +1873,7 @@ void QGuiApplicationPrivate::processKeyEvent(QWindowSystemInterfacePrivate::KeyE
{
QWindow *window = e->window.data();
modifier_buttons = e->modifiers;
- if (e->nullWindow
+ if (e->nullWindow()
#if defined(Q_OS_ANDROID) && !defined(Q_OS_ANDROID_NO_SDK)
|| e->key == Qt::Key_Back || e->key == Qt::Key_Menu
#endif
@@ -1860,6 +1881,13 @@ void QGuiApplicationPrivate::processKeyEvent(QWindowSystemInterfacePrivate::KeyE
window = QGuiApplication::focusWindow();
}
+#if !defined(Q_OS_OSX)
+ // On OS X the shortcut override is checked earlier, see: QWindowSystemInterface::handleKeyEvent()
+ const bool checkShortcut = e->keyType == QEvent::KeyPress && window != 0;
+ if (checkShortcut && QWindowSystemInterface::tryHandleShortcutEvent(window, e->timestamp, e->key, e->modifiers, e->unicode))
+ return;
+#endif // Q_OS_OSX
+
QKeyEvent ev(e->keyType, e->key, e->modifiers,
e->nativeScanCode, e->nativeVirtualKey, e->nativeModifiers,
e->unicode, e->repeat, e->repeatCount);
@@ -2093,7 +2121,7 @@ void QGuiApplicationPrivate::processTabletEvent(QWindowSystemInterfacePrivate::T
// subsequent events up to the release are delivered to that same window.
// If window is given, just send to that.
if (type == QEvent::TabletPress) {
- if (e->nullWindow) {
+ if (e->nullWindow()) {
window = QGuiApplication::topLevelAt(e->global.toPoint());
localValid = false;
}
@@ -2101,7 +2129,7 @@ void QGuiApplicationPrivate::processTabletEvent(QWindowSystemInterfacePrivate::T
return;
tabletPressTarget = window;
} else {
- if (e->nullWindow) {
+ if (e->nullWindow()) {
window = tabletPressTarget;
localValid = false;
}
@@ -2238,7 +2266,7 @@ void QGuiApplicationPrivate::processTouchEvent(QWindowSystemInterfacePrivate::To
touchEvent.setWindow(*winIt);
QGuiApplication::sendSpontaneousEvent(*winIt, &touchEvent);
}
- if (!self->synthesizedMousePoints.isEmpty() && !e->synthetic) {
+ if (!self->synthesizedMousePoints.isEmpty() && !e->synthetic()) {
for (QHash<QWindow *, SynthesizedMouseData>::const_iterator synthIt = self->synthesizedMousePoints.constBegin(),
synthItEnd = self->synthesizedMousePoints.constEnd(); synthIt != synthItEnd; ++synthIt) {
if (!synthIt->window)
@@ -2250,7 +2278,7 @@ void QGuiApplicationPrivate::processTouchEvent(QWindowSystemInterfacePrivate::To
buttons & ~Qt::LeftButton,
e->modifiers,
Qt::MouseEventSynthesizedByQt);
- fake.synthetic = true;
+ fake.flags |= QWindowSystemInterfacePrivate::WindowSystemEvent::Synthetic;
processMouseEvent(&fake);
}
self->synthesizedMousePoints.clear();
@@ -2429,9 +2457,9 @@ void QGuiApplicationPrivate::processTouchEvent(QWindowSystemInterfacePrivate::To
}
QGuiApplication::sendSpontaneousEvent(w, &touchEvent);
- if (!e->synthetic && !touchEvent.isAccepted() && synthesizeMouseFromTouchEventsEnabled()) {
- // exclude touchpads as those generate their own mouse events
- if (touchEvent.device()->type() != QTouchDevice::TouchPad) {
+ if (!e->synthetic() && !touchEvent.isAccepted() && qApp->testAttribute(Qt::AA_SynthesizeMouseForUnhandledTouchEvents)) {
+ // exclude devices which generate their own mouse events
+ if (!(touchEvent.device()->capabilities() & QTouchDevice::MouseEmulation)) {
Qt::MouseButtons b = eventType == QEvent::TouchEnd ? Qt::NoButton : Qt::LeftButton;
if (b == Qt::NoButton)
self->synthesizedMousePoints.clear();
@@ -2452,7 +2480,7 @@ void QGuiApplicationPrivate::processTouchEvent(QWindowSystemInterfacePrivate::To
b | (buttons & ~Qt::LeftButton),
e->modifiers,
Qt::MouseEventSynthesizedByQt);
- fake.synthetic = true;
+ fake.flags |= QWindowSystemInterfacePrivate::WindowSystemEvent::Synthetic;
processMouseEvent(&fake);
break;
}
@@ -2543,7 +2571,7 @@ void QGuiApplicationPrivate::reportGeometryChange(QWindowSystemInterfacePrivate:
}
if (availableGeometryChanged)
- emit s->availableGeometryChanged(s->geometry());
+ emit s->availableGeometryChanged(s->availableGeometry());
if (geometryChanged || availableGeometryChanged) {
foreach (QScreen* sibling, s->virtualSiblings())
@@ -2592,6 +2620,8 @@ void QGuiApplicationPrivate::processExposeEvent(QWindowSystemInterfacePrivate::E
return;
QWindow *window = e->exposed.data();
+ if (!window)
+ return;
QWindowPrivate *p = qt_window_private(window);
if (!p->receivedExpose) {
@@ -2607,7 +2637,7 @@ void QGuiApplicationPrivate::processExposeEvent(QWindowSystemInterfacePrivate::E
p->receivedExpose = true;
}
- p->exposed = e->isExposed;
+ p->exposed = e->isExposed && window->screen();
QExposeEvent exposeEvent(e->region);
QCoreApplication::sendSpontaneousEvent(window, &exposeEvent);
@@ -2810,6 +2840,9 @@ void QGuiApplication::setWindowIcon(const QIcon &icon)
if (!QGuiApplicationPrivate::app_icon)
QGuiApplicationPrivate::app_icon = new QIcon();
*QGuiApplicationPrivate::app_icon = icon;
+ if (QGuiApplicationPrivate::platform_integration
+ && QGuiApplicationPrivate::platform_integration->hasCapability(QPlatformIntegration::ApplicationIcon))
+ QGuiApplicationPrivate::platform_integration->setApplicationIcon(icon);
if (QGuiApplicationPrivate::is_app_running && !QGuiApplicationPrivate::is_app_closing)
QGuiApplicationPrivate::self->notifyWindowIconChanged();
}
@@ -3176,6 +3209,7 @@ Qt::LayoutDirection QGuiApplication::layoutDirection()
#ifndef QT_NO_CURSOR
QCursor *QGuiApplication::overrideCursor()
{
+ CHECK_QAPP_INSTANCE(Q_NULLPTR)
return qGuiApp->d_func()->cursor_list.isEmpty() ? 0 : &qGuiApp->d_func()->cursor_list.first();
}
@@ -3189,6 +3223,7 @@ QCursor *QGuiApplication::overrideCursor()
*/
void QGuiApplication::changeOverrideCursor(const QCursor &cursor)
{
+ CHECK_QAPP_INSTANCE()
if (qGuiApp->d_func()->cursor_list.isEmpty())
return;
qGuiApp->d_func()->cursor_list.removeFirst();
@@ -3263,6 +3298,7 @@ static inline void applyWindowCursor(const QList<QWindow *> &l)
*/
void QGuiApplication::setOverrideCursor(const QCursor &cursor)
{
+ CHECK_QAPP_INSTANCE()
qGuiApp->d_func()->cursor_list.prepend(cursor);
applyCursor(QGuiApplicationPrivate::window_list, cursor);
}
@@ -3280,6 +3316,7 @@ void QGuiApplication::setOverrideCursor(const QCursor &cursor)
*/
void QGuiApplication::restoreOverrideCursor()
{
+ CHECK_QAPP_INSTANCE()
if (qGuiApp->d_func()->cursor_list.isEmpty())
return;
qGuiApp->d_func()->cursor_list.removeFirst();
@@ -3304,9 +3341,9 @@ void QGuiApplication::restoreOverrideCursor()
*/
QStyleHints *QGuiApplication::styleHints()
{
- if (!qGuiApp->d_func()->styleHints)
- qGuiApp->d_func()->styleHints = new QStyleHints();
- return qGuiApp->d_func()->styleHints;
+ if (!QGuiApplicationPrivate::styleHints)
+ QGuiApplicationPrivate::styleHints = new QStyleHints();
+ return QGuiApplicationPrivate::styleHints;
}
/*!
@@ -3347,6 +3384,7 @@ bool QGuiApplication::desktopSettingsAware()
*/
QInputMethod *QGuiApplication::inputMethod()
{
+ CHECK_QAPP_INSTANCE(Q_NULLPTR)
if (!qGuiApp->d_func()->inputMethod)
qGuiApp->d_func()->inputMethod = new QInputMethod();
return qGuiApp->d_func()->inputMethod;
@@ -3482,6 +3520,16 @@ void QGuiApplicationPrivate::setMouseEventFlags(QMouseEvent *event, Qt::MouseEve
event->caps |= (value & Qt::MouseEventFlagMask) << MouseFlagsShift;
}
+QInputDeviceManager *QGuiApplicationPrivate::inputDeviceManager()
+{
+ Q_ASSERT(QGuiApplication::instance());
+
+ if (!m_inputDeviceManager)
+ m_inputDeviceManager = new QInputDeviceManager(QGuiApplication::instance());
+
+ return m_inputDeviceManager;
+}
+
#include "moc_qguiapplication.cpp"
QT_END_NAMESPACE
diff --git a/src/gui/kernel/qguiapplication.h b/src/gui/kernel/qguiapplication.h
index 713f2f2669..c89268d8d4 100644
--- a/src/gui/kernel/qguiapplication.h
+++ b/src/gui/kernel/qguiapplication.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 QtGui 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$
@@ -143,7 +143,7 @@ public:
static Qt::ApplicationState applicationState();
static int exec();
- bool notify(QObject *, QEvent *);
+ bool notify(QObject *, QEvent *) Q_DECL_OVERRIDE;
#ifndef QT_NO_SESSIONMANAGER
// session management
@@ -170,8 +170,8 @@ Q_SIGNALS:
void paletteChanged(const QPalette &pal);
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;
QGuiApplication(QGuiApplicationPrivate &p);
diff --git a/src/gui/kernel/qguiapplication_p.h b/src/gui/kernel/qguiapplication_p.h
index c57d1d8080..0559442049 100644
--- a/src/gui/kernel/qguiapplication_p.h
+++ b/src/gui/kernel/qguiapplication_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 QtGui 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$
@@ -66,6 +66,7 @@ struct QDrawHelperGammaTables;
#ifndef QT_NO_DRAGANDDROP
class QDrag;
#endif // QT_NO_DRAGANDDROP
+class QInputDeviceManager;
class Q_GUI_EXPORT QGuiApplicationPrivate : public QCoreApplicationPrivate
{
@@ -81,7 +82,7 @@ public:
virtual void notifyLayoutDirectionChange();
virtual void notifyActiveWindowChange(QWindow *previous);
- virtual bool shouldQuit();
+ virtual bool shouldQuit() Q_DECL_OVERRIDE;
bool shouldQuitInternal(const QWindowList &processedWindows);
virtual bool tryCloseAllWindows();
@@ -189,8 +190,6 @@ public:
static void updateBlockedStatus(QWindow *window);
virtual bool isWindowBlocked(QWindow *window, QWindow **blockingWindow = 0) const;
- static bool synthesizeMouseFromTouchEventsEnabled();
-
static Qt::MouseButtons buttons;
static ulong mousePressTime;
static Qt::MouseButton mousePressButton;
@@ -201,6 +200,7 @@ public:
static Qt::MouseButtons tabletState;
static QWindow *tabletPressTarget;
static QWindow *currentMouseWindow;
+ static QWindow *currentMousePressWindow;
static Qt::ApplicationState applicationState;
#ifndef QT_NO_CLIPBOARD
@@ -219,7 +219,7 @@ public:
static QFont *app_font;
- QStyleHints *styleHints;
+ static QStyleHints *styleHints;
static bool obey_desktop_settings;
QInputMethod *inputMethod;
@@ -270,6 +270,8 @@ public:
static Qt::MouseEventFlags mouseEventFlags(const QMouseEvent *event);
static void setMouseEventFlags(QMouseEvent *event, Qt::MouseEventFlags flags);
+ static QInputDeviceManager *inputDeviceManager();
+
const QDrawHelperGammaTables *gammaTables();
// hook reimplemented in QApplication to apply the QStyle function on the QIcon
@@ -299,6 +301,8 @@ private:
QAtomicPointer<QDrawHelperGammaTables> m_gammaTables;
bool ownGlobalShareContext;
+
+ static QInputDeviceManager *m_inputDeviceManager;
};
Q_GUI_EXPORT uint qHash(const QGuiApplicationPrivate::ActiveTouchPointsKey &k);
diff --git a/src/gui/kernel/qguivariant.cpp b/src/gui/kernel/qguivariant.cpp
index 07d72ac499..ce4a0ec09e 100644
--- a/src/gui/kernel/qguivariant.cpp
+++ b/src/gui/kernel/qguivariant.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 QtGui 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/gui/kernel/qinputdevicemanager.cpp b/src/gui/kernel/qinputdevicemanager.cpp
new file mode 100644
index 0000000000..d0dd8a4e7c
--- /dev/null
+++ b/src/gui/kernel/qinputdevicemanager.cpp
@@ -0,0 +1,88 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the QtGui module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL21$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 or version 3 as published by the Free
+** Software Foundation and appearing in the file LICENSE.LGPLv21 and
+** LICENSE.LGPLv3 included in the packaging of this file. Please review the
+** following information to ensure the GNU Lesser General Public License
+** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** 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$
+**
+****************************************************************************/
+
+#include "qinputdevicemanager_p.h"
+#include "qinputdevicemanager_p_p.h"
+
+QT_BEGIN_NAMESPACE
+
+/*!
+ \class QInputDeviceManager
+ \internal
+
+ \brief QInputDeviceManager acts as a communication hub between QtGui and the input handlers.
+
+ On embedded platforms the input handling code is either compiled into the platform
+ plugin or is loaded dynamically as a generic plugin without any interface. The input
+ handler in use may also change between each run (e.g. evdevmouse/keyboard/touch
+ vs. libinput). QWindowSystemInterface is too limiting when Qt (the platform plugin) is
+ acting as a windowing system, and is one way only.
+
+ QInputDeviceManager solves this by providing a global object that is used to communicate
+ from the input handlers to the rest of Qt (e.g. the number of connected mice, which may
+ be important information for the cursor drawing code), and vice-versa (e.g. to indicate
+ to the input handler that a manual cursor position change was requested by the
+ application via QCursor::setPos and thus any internal state has to be updated accordingly).
+*/
+
+QInputDeviceManager::QInputDeviceManager(QObject *parent)
+ : QObject(*new QInputDeviceManagerPrivate, parent)
+{
+}
+
+int QInputDeviceManager::deviceCount(DeviceType type) const
+{
+ Q_D(const QInputDeviceManager);
+ return d->deviceCount(type);
+}
+
+int QInputDeviceManagerPrivate::deviceCount(QInputDeviceManager::DeviceType type) const
+{
+ return m_deviceCount.value(type);
+}
+
+void QInputDeviceManagerPrivate::setDeviceCount(QInputDeviceManager::DeviceType type, int count)
+{
+ Q_Q(QInputDeviceManager);
+ if (m_deviceCount.value(type) != count) {
+ m_deviceCount[type] = count;
+ emit q->deviceListChanged(type);
+ }
+}
+
+void QInputDeviceManager::setCursorPos(const QPoint &pos)
+{
+ emit cursorPositionChangeRequested(pos);
+}
+
+QT_END_NAMESPACE
diff --git a/src/gui/kernel/qinputdevicemanager_p.h b/src/gui/kernel/qinputdevicemanager_p.h
new file mode 100644
index 0000000000..15c84d1a82
--- /dev/null
+++ b/src/gui/kernel/qinputdevicemanager_p.h
@@ -0,0 +1,80 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the QtGui module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL21$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 or version 3 as published by the Free
+** Software Foundation and appearing in the file LICENSE.LGPLv21 and
+** LICENSE.LGPLv3 included in the packaging of this file. Please review the
+** following information to ensure the GNU Lesser General Public License
+** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** 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$
+**
+****************************************************************************/
+
+#ifndef QINPUTDEVICEMANAGER_P_H
+#define QINPUTDEVICEMANAGER_P_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include <QtCore/qobject.h>
+
+QT_BEGIN_NAMESPACE
+
+class QInputDeviceManagerPrivate;
+
+class Q_GUI_EXPORT QInputDeviceManager : public QObject
+{
+ Q_OBJECT
+ Q_DECLARE_PRIVATE(QInputDeviceManager)
+
+public:
+ enum DeviceType {
+ DeviceTypeUnknown,
+ DeviceTypePointer,
+ DeviceTypeKeyboard,
+ DeviceTypeTouch
+ };
+
+ QInputDeviceManager(QObject *parent = 0);
+
+ int deviceCount(DeviceType type) const;
+
+ void setCursorPos(const QPoint &pos);
+
+signals:
+ void deviceListChanged(DeviceType type);
+ void cursorPositionChangeRequested(const QPoint &pos);
+};
+
+QT_END_NAMESPACE
+
+#endif // QINPUTDEVICEMANAGER_P_H
diff --git a/src/gui/kernel/qinputdevicemanager_p_p.h b/src/gui/kernel/qinputdevicemanager_p_p.h
new file mode 100644
index 0000000000..d6cb817d88
--- /dev/null
+++ b/src/gui/kernel/qinputdevicemanager_p_p.h
@@ -0,0 +1,69 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the QtGui module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL21$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 or version 3 as published by the Free
+** Software Foundation and appearing in the file LICENSE.LGPLv21 and
+** LICENSE.LGPLv3 included in the packaging of this file. Please review the
+** following information to ensure the GNU Lesser General Public License
+** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** 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$
+**
+****************************************************************************/
+
+#ifndef QINPUTDEVICEMANAGER_P_P_H
+#define QINPUTDEVICEMANAGER_P_P_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include <QtCore/qmap.h>
+#include <private/qobject_p.h>
+#include "qinputdevicemanager_p.h"
+
+QT_BEGIN_NAMESPACE
+
+class Q_GUI_EXPORT QInputDeviceManagerPrivate : public QObjectPrivate
+{
+ Q_DECLARE_PUBLIC(QInputDeviceManager)
+
+public:
+ static QInputDeviceManagerPrivate *get(QInputDeviceManager *mgr) { return mgr->d_func(); }
+
+ int deviceCount(QInputDeviceManager::DeviceType type) const;
+ void setDeviceCount(QInputDeviceManager::DeviceType type, int count);
+
+ QMap<QInputDeviceManager::DeviceType, int> m_deviceCount;
+};
+
+QT_END_NAMESPACE
+
+#endif // QINPUTDEVICEMANAGER_P_P_H
diff --git a/src/gui/kernel/qinputmethod.cpp b/src/gui/kernel/qinputmethod.cpp
index 77c1f65545..8d51be853a 100644
--- a/src/gui/kernel/qinputmethod.cpp
+++ b/src/gui/kernel/qinputmethod.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 QtGui 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/gui/kernel/qinputmethod.h b/src/gui/kernel/qinputmethod.h
index 7be25c415c..3e801bff3c 100644
--- a/src/gui/kernel/qinputmethod.h
+++ b/src/gui/kernel/qinputmethod.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 QtGui 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,7 +55,6 @@ class Q_GUI_EXPORT QInputMethod : public QObject
Q_PROPERTY(QLocale locale READ locale NOTIFY localeChanged)
Q_PROPERTY(Qt::LayoutDirection inputDirection READ inputDirection NOTIFY inputDirectionChanged)
- Q_ENUMS(Action)
public:
QTransform inputItemTransform() const;
void setInputItemTransform(const QTransform &transform);
@@ -73,6 +72,7 @@ public:
Click,
ContextMenu
};
+ Q_ENUM(Action)
bool isVisible() const;
void setVisible(bool visible);
diff --git a/src/gui/kernel/qinputmethod_p.h b/src/gui/kernel/qinputmethod_p.h
index c6bd289dcf..0111162e84 100644
--- a/src/gui/kernel/qinputmethod_p.h
+++ b/src/gui/kernel/qinputmethod_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 QtGui 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/gui/kernel/qkeymapper.cpp b/src/gui/kernel/qkeymapper.cpp
index b5189fb526..d5da76bdfe 100644
--- a/src/gui/kernel/qkeymapper.cpp
+++ b/src/gui/kernel/qkeymapper.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 QtGui 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/gui/kernel/qkeymapper_p.h b/src/gui/kernel/qkeymapper_p.h
index 24b83b7670..20dcbbc139 100644
--- a/src/gui/kernel/qkeymapper_p.h
+++ b/src/gui/kernel/qkeymapper_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 QtGui 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/gui/kernel/qkeysequence.cpp b/src/gui/kernel/qkeysequence.cpp
index 209d1dd499..23d5f06aa2 100644
--- a/src/gui/kernel/qkeysequence.cpp
+++ b/src/gui/kernel/qkeysequence.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 QtGui 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$
@@ -289,6 +289,7 @@ void Q_GUI_EXPORT qt_set_sequence_auto_mnemonic(bool b) { qt_sequence_no_mnemoni
\row \li DeleteCompleteLine \li (none) \li (none) \li Ctrl+U \li Ctrl+U
\row \li InsertParagraphSeparator \li Enter \li Enter \li Enter \li Enter
\row \li InsertLineSeparator \li Shift+Enter \li Meta+Enter, Meta+O \li Shift+Enter \li Shift+Enter
+ \row \li Backspace \li (none) \li Meta+H \li (none) \li (none)
\endtable
Note that, since the key sequences used for the standard shortcuts differ
@@ -663,6 +664,9 @@ static const struct {
{ Qt::Key_Play, QT_TRANSLATE_NOOP("QShortcut", "Play") },
{ Qt::Key_Zoom, QT_TRANSLATE_NOOP("QShortcut", "Zoom") },
{ Qt::Key_Exit, QT_TRANSLATE_NOOP("QShortcut", "Exit") },
+ { Qt::Key_TouchpadToggle, QT_TRANSLATE_NOOP("QShortcut", "Touchpad Toggle") },
+ { Qt::Key_TouchpadOn, QT_TRANSLATE_NOOP("QShortcut", "Touchpad On") },
+ { Qt::Key_TouchpadOff, QT_TRANSLATE_NOOP("QShortcut", "Touchpad Off") },
{ 0, 0 }
};
@@ -679,6 +683,7 @@ static const struct {
\value AddTab Add new tab.
\value Back Navigate back.
+ \value Backspace Delete previous character.
\value Bold Bold text.
\value Close Close document/tab.
\value Copy Copy.
@@ -1596,8 +1601,9 @@ QDataStream &operator>>(QDataStream &s, QKeySequence &keysequence)
#ifndef QT_NO_DEBUG_STREAM
QDebug operator<<(QDebug dbg, const QKeySequence &p)
{
+ QDebugStateSaver saver(dbg);
dbg.nospace() << "QKeySequence(" << p.toString() << ')';
- return dbg.space();
+ return dbg;
}
#endif
diff --git a/src/gui/kernel/qkeysequence.h b/src/gui/kernel/qkeysequence.h
index 5a2ce5a8b9..cd7af5718f 100644
--- a/src/gui/kernel/qkeysequence.h
+++ b/src/gui/kernel/qkeysequence.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 QtGui 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$
@@ -62,7 +62,6 @@ class QKeySequencePrivate;
class Q_GUI_EXPORT QKeySequence
{
Q_GADGET
- Q_ENUMS(StandardKey)
public:
enum StandardKey {
@@ -134,8 +133,10 @@ public:
Quit,
FullScreen,
Deselect,
- DeleteCompleteLine
+ DeleteCompleteLine,
+ Backspace
};
+ Q_ENUM(StandardKey)
enum SequenceFormat {
NativeText,
diff --git a/src/gui/kernel/qkeysequence_p.h b/src/gui/kernel/qkeysequence_p.h
index 2eed275e32..97416943d0 100644
--- a/src/gui/kernel/qkeysequence_p.h
+++ b/src/gui/kernel/qkeysequence_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 QtGui 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/gui/kernel/qoffscreensurface.cpp b/src/gui/kernel/qoffscreensurface.cpp
index 5cf77de5d8..1a12ea4d32 100644
--- a/src/gui/kernel/qoffscreensurface.cpp
+++ b/src/gui/kernel/qoffscreensurface.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 QtGui 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$
@@ -51,7 +51,7 @@ QT_BEGIN_NAMESPACE
QOffscreenSurface is intended to be used with QOpenGLContext to allow rendering with OpenGL in
an arbitrary thread without the need to create a QWindow.
- Even though the surface is renderable, the surface's pixels are not accessible.
+ Even though the surface is typically renderable, the surface's pixels are not accessible.
QOffscreenSurface should only be used to create OpenGL resources such as textures
or framebuffer objects.
@@ -77,6 +77,11 @@ QT_BEGIN_NAMESPACE
created}. Passing the format returned from QWindow::requestedFormat() to setFormat()
may result in an incompatible offscreen surface since the underlying windowing system
interface may offer a different set of configurations for window and pbuffer surfaces.
+
+ \note Some platforms may utilize a surfaceless context extension (for example
+ EGL_KHR_surfaceless_context) when available. In this case there will be no underlying
+ native surface. For the use cases of QOffscreenSurface (rendering to FBOs, texture
+ upload) this is not a problem.
*/
class Q_GUI_EXPORT QOffscreenSurfacePrivate : public QObjectPrivate
{
@@ -180,6 +185,9 @@ void QOffscreenSurface::create()
d->offscreenWindow->setGeometry(0, 0, d->size.width(), d->size.height());
d->offscreenWindow->create();
}
+
+ QPlatformSurfaceEvent e(QPlatformSurfaceEvent::SurfaceCreated);
+ QGuiApplication::sendEvent(this, &e);
}
}
@@ -191,6 +199,10 @@ void QOffscreenSurface::create()
void QOffscreenSurface::destroy()
{
Q_D(QOffscreenSurface);
+
+ QPlatformSurfaceEvent e(QPlatformSurfaceEvent::SurfaceAboutToBeDestroyed);
+ QGuiApplication::sendEvent(this, &e);
+
delete d->platformOffscreenSurface;
d->platformOffscreenSurface = 0;
if (d->offscreenWindow) {
diff --git a/src/gui/kernel/qoffscreensurface.h b/src/gui/kernel/qoffscreensurface.h
index a4ba51320b..909a1ef256 100644
--- a/src/gui/kernel/qoffscreensurface.h
+++ b/src/gui/kernel/qoffscreensurface.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 QtGui 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$
@@ -54,7 +54,7 @@ public:
explicit QOffscreenSurface(QScreen *screen = 0);
virtual ~QOffscreenSurface();
- SurfaceType surfaceType() const;
+ SurfaceType surfaceType() const Q_DECL_OVERRIDE;
void create();
void destroy();
@@ -62,10 +62,10 @@ public:
bool isValid() const;
void setFormat(const QSurfaceFormat &format);
- QSurfaceFormat format() const;
+ QSurfaceFormat format() const Q_DECL_OVERRIDE;
QSurfaceFormat requestedFormat() const;
- QSize size() const;
+ QSize size() const Q_DECL_OVERRIDE;
QScreen *screen() const;
void setScreen(QScreen *screen);
@@ -80,7 +80,7 @@ private Q_SLOTS:
private:
- QPlatformSurface *surfaceHandle() const;
+ QPlatformSurface *surfaceHandle() const Q_DECL_OVERRIDE;
Q_DISABLE_COPY(QOffscreenSurface)
};
diff --git a/src/gui/kernel/qopenglcontext.cpp b/src/gui/kernel/qopenglcontext.cpp
index b663afabbc..56a3729a4a 100644
--- a/src/gui/kernel/qopenglcontext.cpp
+++ b/src/gui/kernel/qopenglcontext.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 QtGui 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$
@@ -370,13 +370,10 @@ int QOpenGLContextPrivate::maxTextureSize()
QOpenGLFunctions_1_0 *gl1funcs = 0;
QOpenGLFunctions_3_2_Core *gl3funcs = 0;
- if (q->format().profile() == QSurfaceFormat::CoreProfile) {
+ if (q->format().profile() == QSurfaceFormat::CoreProfile)
gl3funcs = q->versionFunctions<QOpenGLFunctions_3_2_Core>();
- gl3funcs->initializeOpenGLFunctions();
- } else {
+ else
gl1funcs = q->versionFunctions<QOpenGLFunctions_1_0>();
- gl1funcs->initializeOpenGLFunctions();
- }
Q_ASSERT(gl1funcs || gl3funcs);
@@ -590,13 +587,14 @@ QVariant QOpenGLContext::nativeHandle() const
*/
bool QOpenGLContext::create()
{
- if (isValid())
+ Q_D(QOpenGLContext);
+ if (d->platformGLContext)
destroy();
- Q_D(QOpenGLContext);
d->platformGLContext = QGuiApplicationPrivate::platformIntegration()->createPlatformOpenGLContext(this);
if (!d->platformGLContext)
return false;
+ d->platformGLContext->initialize();
d->platformGLContext->setContext(this);
if (!d->platformGLContext->isSharing())
d->shareContext = 0;
@@ -638,12 +636,21 @@ void QOpenGLContext::destroy()
d->platformGLContext = 0;
delete d->functions;
d->functions = 0;
+
+ foreach (QAbstractOpenGLFunctions *func, d->externalVersionFunctions) {
+ QAbstractOpenGLFunctionsPrivate *func_d = QAbstractOpenGLFunctionsPrivate::get(func);
+ func_d->owningContext = 0;
+ func_d->initialized = false;
+ }
+ d->externalVersionFunctions.clear();
qDeleteAll(d->versionFunctions);
d->versionFunctions.clear();
qDeleteAll(d->versionFunctionsBackend);
d->versionFunctionsBackend.clear();
+
delete d->textureFunctions;
d->textureFunctions = 0;
+
d->nativeHandle = QVariant();
}
@@ -675,6 +682,15 @@ QOpenGLContext::~QOpenGLContext()
/*!
Returns if this context is valid, i.e. has been successfully created.
+ On some platforms the return value of \c false for a context that was
+ successfully created previously indicates that the OpenGL context was lost.
+
+ The typical way to handle context loss scenarios in applications is to
+ check via this function whenever makeCurrent() fails and returns \c false.
+ If this function then returns \c false, recreate the underlying native
+ OpenGL context by calling create(), call makeCurrent() again and then
+ reinitialize all OpenGL resources.
+
\sa create()
*/
bool QOpenGLContext::isValid() const
@@ -708,9 +724,12 @@ QOpenGLFunctions *QOpenGLContext::functions() const
\overload versionFunctions()
Returns a pointer to an object that provides access to all functions for
- the version and profile of this context. Before using any of the functions
- they must be initialized by calling QAbstractOpenGLFunctions::initializeOpenGLFunctions()
- with this context being the current context.
+ the version and profile of this context. There is no need to call
+ QAbstractOpenGLFunctions::initializeOpenGLFunctions() as long as this context
+ is current. It is also possible to call this function when the context is not
+ current, but in that case it is the caller's responsibility to ensure proper
+ initialization by calling QAbstractOpenGLFunctions::initializeOpenGLFunctions()
+ afterwards.
Usually one would use the template version of this function to automatically
have the result cast to the correct type.
@@ -722,7 +741,6 @@ QOpenGLFunctions *QOpenGLContext::functions() const
qWarning() << "Could not obtain required OpenGL context version";
exit(1);
}
- funcs->initializeOpenGLFunctions();
\endcode
It is possible to request a functions object for a different version and profile
@@ -752,9 +770,12 @@ QOpenGLFunctions *QOpenGLContext::functions() const
/*!
Returns a pointer to an object that provides access to all functions for the
- \a versionProfile of this context. Before using any of the functions they must
- be initialized by calling QAbstractOpenGLFunctions::initializeOpenGLFunctions()
- with this context being the current context.
+ \a versionProfile of this context. There is no need to call
+ QAbstractOpenGLFunctions::initializeOpenGLFunctions() as long as this context
+ is current. It is also possible to call this function when the context is not
+ current, but in that case it is the caller's responsibility to ensure proper
+ initialization by calling QAbstractOpenGLFunctions::initializeOpenGLFunctions()
+ afterwards.
Usually one would use the template version of this function to automatically
have the result cast to the correct type.
@@ -799,6 +820,9 @@ QAbstractOpenGLFunctions *QOpenGLContext::versionFunctions(const QOpenGLVersionP
funcs = d->versionFunctions.value(vp);
}
+ if (funcs && QOpenGLContext::currentContext() == this)
+ funcs->initializeOpenGLFunctions();
+
return funcs;
}
@@ -836,15 +860,26 @@ bool QOpenGLContext::hasExtension(const QByteArray &extension) const
/*!
Call this to get the default framebuffer object for the current surface.
- On some platforms the default framebuffer object depends on the surface
- being rendered to, and might be different from 0. Thus, instead of calling
- glBindFramebuffer(0), you should call
+ On some platforms (for instance, iOS) the default framebuffer object depends
+ on the surface being rendered to, and might be different from 0. Thus,
+ instead of calling glBindFramebuffer(0), you should call
glBindFramebuffer(ctx->defaultFramebufferObject()) if you want your
application to work across different Qt platforms.
If you use the glBindFramebuffer() in QOpenGLFunctions you do not have to
worry about this, as it automatically binds the current context's
defaultFramebufferObject() when 0 is passed.
+
+ \note Widgets that render via framebuffer objects, like QOpenGLWidget and
+ QQuickWidget, will override the value returned from this function when
+ painting is active, because at that time the correct "default" framebuffer
+ is the widget's associated backing framebuffer, not the platform-specific
+ one belonging to the top-level window's surface. This ensures the expected
+ behavior for this function and other classes relying on it (for example,
+ QOpenGLFramebufferObject::bindDefault() or
+ QOpenGLFramebufferObject::release()).
+
+ \sa QOpenGLFramebufferObject
*/
GLuint QOpenGLContext::defaultFramebufferObject() const
{
@@ -855,6 +890,9 @@ GLuint QOpenGLContext::defaultFramebufferObject() const
if (!d->surface || !d->surface->surfaceHandle())
return 0;
+ if (d->defaultFboRedirect)
+ return d->defaultFboRedirect;
+
return d->platformGLContext->defaultFramebufferObject(d->surface->surfaceHandle());
}
@@ -1175,6 +1213,46 @@ bool QOpenGLContext::isOpenGLES() const
}
/*!
+ Returns \c true if the platform supports OpenGL rendering outside the main (gui)
+ thread.
+
+ The value is controlled by the platform plugin in use and may also depend on the
+ graphics drivers.
+
+ \since 5.5
+ */
+bool QOpenGLContext::supportsThreadedOpenGL()
+{
+ Q_ASSERT(qGuiApp);
+ return QGuiApplicationPrivate::instance()->platformIntegration()->hasCapability(QPlatformIntegration::ThreadedOpenGL);
+}
+
+/*!
+ \since 5.5
+
+ Returns the application-wide shared OpenGL context, if present.
+ Otherwise, returns a null pointer.
+
+ This is useful if you need to upload OpenGL objects (buffers, textures,
+ etc.) before creating or showing a QOpenGLWidget or QQuickWidget.
+
+ \note You must set the Qt::AA_ShareOpenGLContexts flag on QGuiApplication
+ before creating the QGuiApplication object, otherwise Qt may not create a
+ global shared context.
+
+ \warning Do not attempt to make the context returned by this function
+ current on any surface. Instead, you can create a new context which shares
+ with the global one, and then make the new context current.
+
+ \sa Qt::AA_ShareOpenGLContexts, setShareContext(), makeCurrent()
+*/
+QOpenGLContext *QOpenGLContext::globalShareContext()
+{
+ Q_ASSERT(qGuiApp);
+ return qt_gl_global_share_context();
+}
+
+/*!
\internal
*/
QOpenGLVersionFunctionsBackend *QOpenGLContext::functionsBackend(const QOpenGLVersionStatus &v) const
@@ -1204,6 +1282,24 @@ void QOpenGLContext::removeFunctionsBackend(const QOpenGLVersionStatus &v)
/*!
\internal
+ */
+void QOpenGLContext::insertExternalFunctions(QAbstractOpenGLFunctions *f)
+{
+ Q_D(QOpenGLContext);
+ d->externalVersionFunctions.insert(f);
+}
+
+/*!
+ \internal
+ */
+void QOpenGLContext::removeExternalFunctions(QAbstractOpenGLFunctions *f)
+{
+ Q_D(QOpenGLContext);
+ d->externalVersionFunctions.remove(f);
+}
+
+/*!
+ \internal
*/
QOpenGLTextureHelper* QOpenGLContext::textureFunctions() const
{
diff --git a/src/gui/kernel/qopenglcontext.h b/src/gui/kernel/qopenglcontext.h
index b31cc693b7..a529957ad6 100644
--- a/src/gui/kernel/qopenglcontext.h
+++ b/src/gui/kernel/qopenglcontext.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 QtGui 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$
@@ -198,6 +198,9 @@ public:
bool isOpenGLES() const;
+ static bool supportsThreadedOpenGL();
+ static QOpenGLContext *globalShareContext();
+
Q_SIGNALS:
void aboutToBeDestroyed();
@@ -226,6 +229,8 @@ private:
void insertFunctionsBackend(const QOpenGLVersionStatus &v,
QOpenGLVersionFunctionsBackend *backend);
void removeFunctionsBackend(const QOpenGLVersionStatus &v);
+ void insertExternalFunctions(QAbstractOpenGLFunctions *f);
+ void removeExternalFunctions(QAbstractOpenGLFunctions *f);
QOpenGLTextureHelper* textureFunctions() const;
void setTextureFunctions(QOpenGLTextureHelper* textureFuncs);
diff --git a/src/gui/kernel/qopenglcontext_p.h b/src/gui/kernel/qopenglcontext_p.h
index 975553e7cd..f9f3ce2c5f 100644
--- a/src/gui/kernel/qopenglcontext_p.h
+++ b/src/gui/kernel/qopenglcontext_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 QtGui 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$
@@ -105,12 +105,12 @@ public:
GLuint id() const { return m_id; }
protected:
- void invalidateResource()
+ void invalidateResource() Q_DECL_OVERRIDE
{
m_id = 0;
}
- void freeResource(QOpenGLContext *context);
+ void freeResource(QOpenGLContext *context) Q_DECL_OVERRIDE;
private:
GLuint m_id;
@@ -204,6 +204,7 @@ public:
, workaround_missingPrecisionQualifiers(false)
, active_engine(0)
, qgl_current_fbo_invalid(false)
+ , defaultFboRedirect(0)
{
requestedFormat = QSurfaceFormat::defaultFormat();
}
@@ -216,6 +217,7 @@ public:
mutable QHash<QOpenGLVersionProfile, QAbstractOpenGLFunctions *> versionFunctions;
mutable QHash<QOpenGLVersionStatus, QOpenGLVersionFunctionsBackend *> versionFunctionsBackend;
+ mutable QSet<QAbstractOpenGLFunctions *> externalVersionFunctions;
void *qGLContextHandle;
void (*qGLContextDeleteFunction)(void *handle);
@@ -241,6 +243,7 @@ public:
bool qgl_current_fbo_invalid;
QVariant nativeHandle;
+ GLuint defaultFboRedirect;
static QOpenGLContext *setCurrentContext(QOpenGLContext *context);
diff --git a/src/gui/kernel/qopenglwindow.cpp b/src/gui/kernel/qopenglwindow.cpp
index c37974c429..a7ba57e85e 100644
--- a/src/gui/kernel/qopenglwindow.cpp
+++ b/src/gui/kernel/qopenglwindow.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 QtGui 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$
@@ -166,10 +166,13 @@ class QOpenGLWindowPrivate : public QPaintDeviceWindowPrivate
{
Q_DECLARE_PUBLIC(QOpenGLWindow)
public:
- QOpenGLWindowPrivate(QOpenGLWindow::UpdateBehavior updateBehavior)
+ QOpenGLWindowPrivate(QOpenGLContext *shareContext, QOpenGLWindow::UpdateBehavior updateBehavior)
: updateBehavior(updateBehavior)
, hasFboBlit(false)
+ , shareContext(shareContext)
{
+ if (!shareContext)
+ this->shareContext = qt_gl_global_share_context();
}
~QOpenGLWindowPrivate()
@@ -201,7 +204,7 @@ public:
if (!context) {
context.reset(new QOpenGLContext);
- context->setShareContext(qt_gl_global_share_context());
+ context->setShareContext(shareContext);
context->setFormat(q->requestedFormat());
if (!context->create())
qWarning("QOpenGLWindow::beginPaint: Failed to create context");
@@ -299,6 +302,7 @@ public:
QOpenGLWindow::UpdateBehavior updateBehavior;
bool hasFboBlit;
QScopedPointer<QOpenGLContext> context;
+ QOpenGLContext *shareContext;
QScopedPointer<QOpenGLFramebufferObject> fbo;
QScopedPointer<QOpenGLWindowPaintDevice> paintDevice;
QOpenGLTextureBlitter blitter;
@@ -317,12 +321,47 @@ void QOpenGLWindowPaintDevice::ensureActiveTarget()
\sa QOpenGLWindow::UpdateBehavior
*/
QOpenGLWindow::QOpenGLWindow(QOpenGLWindow::UpdateBehavior updateBehavior, QWindow *parent)
- : QPaintDeviceWindow(*(new QOpenGLWindowPrivate(updateBehavior)), parent)
+ : QPaintDeviceWindow(*(new QOpenGLWindowPrivate(Q_NULLPTR, updateBehavior)), parent)
{
setSurfaceType(QSurface::OpenGLSurface);
}
/*!
+ Constructs a new QOpenGLWindow with the given \a parent and \a updateBehavior. The QOpenGLWindow's context will share with \a shareContext.
+
+ \sa QOpenGLWindow::UpdateBehavior shareContext
+*/
+QOpenGLWindow::QOpenGLWindow(QOpenGLContext *shareContext, UpdateBehavior updateBehavior, QWindow *parent)
+ : QPaintDeviceWindow(*(new QOpenGLWindowPrivate(shareContext, updateBehavior)), parent)
+{
+ setSurfaceType(QSurface::OpenGLSurface);
+}
+
+/*!
+ Destroys the QOpenGLWindow instance, freeing its resources.
+
+ The OpenGLWindow'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 window.
+
+ \warning if you have objects wrapping OpenGL resources (such as
+ QOpenGLBuffer, QOpenGLShaderProgram, etc.) as members of a QOpenGLWindow
+ 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
+
+ \since 5.5
+*/
+QOpenGLWindow::~QOpenGLWindow()
+{
+ makeCurrent();
+}
+
+/*!
\return the update behavior for this QOpenGLWindow.
*/
QOpenGLWindow::UpdateBehavior QOpenGLWindow::updateBehavior() const
@@ -414,6 +453,15 @@ QOpenGLContext *QOpenGLWindow::context() const
}
/*!
+ \return The QOpenGLContext requested to be shared with this window's QOpenGLContext.
+*/
+QOpenGLContext *QOpenGLWindow::shareContext() const
+{
+ Q_D(const QOpenGLWindow);
+ return d->shareContext;
+}
+
+/*!
The framebuffer object handle used by this window.
When the update behavior is set to \c NoPartialUpdate, there is no separate
diff --git a/src/gui/kernel/qopenglwindow.h b/src/gui/kernel/qopenglwindow.h
index 3b0b399b0a..f274275c3f 100644
--- a/src/gui/kernel/qopenglwindow.h
+++ b/src/gui/kernel/qopenglwindow.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 QtGui 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,6 +59,8 @@ public:
};
explicit QOpenGLWindow(UpdateBehavior updateBehavior = NoPartialUpdate, QWindow *parent = 0);
+ explicit QOpenGLWindow(QOpenGLContext *shareContext, UpdateBehavior updateBehavior = NoPartialUpdate, QWindow *parent = 0);
+ ~QOpenGLWindow();
UpdateBehavior updateBehavior() const;
bool isValid() const;
@@ -67,6 +69,7 @@ public:
void doneCurrent();
QOpenGLContext *context() const;
+ QOpenGLContext *shareContext() const;
GLuint defaultFramebufferObject() const;
diff --git a/src/gui/kernel/qpaintdevicewindow.cpp b/src/gui/kernel/qpaintdevicewindow.cpp
index cf8653426f..ff661d017d 100644
--- a/src/gui/kernel/qpaintdevicewindow.cpp
+++ b/src/gui/kernel/qpaintdevicewindow.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 QtGui 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$
@@ -60,6 +60,9 @@ QT_BEGIN_NAMESPACE
\note Subsequent calls to this function before the next paint
event will get ignored.
+
+ \note For non-exposed windows the update is deferred until the
+ window becomes exposed again.
*/
void QPaintDeviceWindow::update()
{
@@ -70,26 +73,34 @@ void QPaintDeviceWindow::update()
Marks the \a rect of the window as dirty and schedules a repaint.
\note Subsequent calls to this function before the next paint
- event will get ignored.
+ event will get ignored, but \a rect is added to the region to update.
+
+ \note For non-exposed windows the update is deferred until the
+ window becomes exposed again.
*/
void QPaintDeviceWindow::update(const QRect &rect)
{
Q_D(QPaintDeviceWindow);
d->dirtyRegion += rect;
- d->triggerUpdate();
+ if (isExposed())
+ requestUpdate();
}
/*!
Marks the \a region of the window as dirty and schedules a repaint.
\note Subsequent calls to this function before the next paint
- event will get ignored.
+ event will get ignored, but \a region is added to the region to update.
+
+ \note For non-exposed windows the update is deferred until the
+ window becomes exposed again.
*/
void QPaintDeviceWindow::update(const QRegion &region)
{
Q_D(QPaintDeviceWindow);
d->dirtyRegion += region;
- d->triggerUpdate();
+ if (isExposed())
+ requestUpdate();
}
/*!
@@ -168,6 +179,9 @@ void QPaintDeviceWindow::exposeEvent(QExposeEvent *exposeEvent)
// sometimes relative to the parent, depending on the platform plugin.
// We require local coords here.
d->doFlush(QRect(QPoint(0, 0), size()));
+ } else if (!d->dirtyRegion.isEmpty()) {
+ // Updates while non-exposed were ignored. Schedule an update now.
+ requestUpdate();
}
}
@@ -179,7 +193,6 @@ bool QPaintDeviceWindow::event(QEvent *event)
Q_D(QPaintDeviceWindow);
if (event->type() == QEvent::UpdateRequest) {
- d->paintEventSent = false;
if (handle()) // platform window may be gone when the window is closed during app exit
d->handleUpdateEvent();
return true;
diff --git a/src/gui/kernel/qpaintdevicewindow.h b/src/gui/kernel/qpaintdevicewindow.h
index 79047e47f4..4d7e5dd518 100644
--- a/src/gui/kernel/qpaintdevicewindow.h
+++ b/src/gui/kernel/qpaintdevicewindow.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 QtGui 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/gui/kernel/qpaintdevicewindow_p.h b/src/gui/kernel/qpaintdevicewindow_p.h
index 1935bb6db5..e234906fe0 100644
--- a/src/gui/kernel/qpaintdevicewindow_p.h
+++ b/src/gui/kernel/qpaintdevicewindow_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 QtGui 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,8 +46,6 @@ class Q_GUI_EXPORT QPaintDeviceWindowPrivate : public QWindowPrivate
Q_DECLARE_PUBLIC(QPaintDeviceWindow)
public:
- QPaintDeviceWindowPrivate() : paintEventSent(false) { }
-
virtual void beginPaint(const QRegion &region)
{
Q_UNUSED(region);
@@ -82,15 +80,6 @@ public:
return true;
}
- void triggerUpdate()
- {
- Q_Q(QPaintDeviceWindow);
- if (!paintEventSent) {
- QCoreApplication::postEvent(q, new QEvent(QEvent::UpdateRequest));
- paintEventSent = true;
- }
- }
-
void doFlush(const QRegion &region)
{
QRegion toFlush = region;
@@ -113,7 +102,6 @@ public:
private:
QRegion dirtyRegion;
- bool paintEventSent;
};
diff --git a/src/gui/kernel/qpalette.cpp b/src/gui/kernel/qpalette.cpp
index e3862c1865..cf17e1b5aa 100644
--- a/src/gui/kernel/qpalette.cpp
+++ b/src/gui/kernel/qpalette.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 QtGui 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$
@@ -1152,6 +1152,7 @@ QDebug operator<<(QDebug dbg, const QPalette &p)
"BrightText", "ButtonText", "Base", "Window", "Shadow", "Highlight",
"HighlightedText", "Link", "LinkVisited", "AlternateBase", "NoRole",
"ToolTipBase","ToolTipText" };
+ QDebugStateSaver saver(dbg);
QDebug nospace = dbg.nospace();
const uint mask = p.resolve();
nospace << "QPalette(resolve=" << hex << showbase << mask << ',';
@@ -1171,7 +1172,7 @@ QDebug operator<<(QDebug dbg, const QPalette &p)
}
}
nospace << ')' << noshowbase << dec;
- return dbg.space();
+ return dbg;
}
#endif
diff --git a/src/gui/kernel/qpalette.h b/src/gui/kernel/qpalette.h
index c877084c09..e8b35aa82a 100644
--- a/src/gui/kernel/qpalette.h
+++ b/src/gui/kernel/qpalette.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 QtGui 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$
@@ -47,7 +47,6 @@ class QVariant;
class Q_GUI_EXPORT QPalette
{
Q_GADGET
- Q_ENUMS(ColorGroup ColorRole)
public:
QPalette();
QPalette(const QColor &button);
@@ -80,6 +79,7 @@ public:
// Do not change the order, the serialization format depends on it
enum ColorGroup { Active, Disabled, Inactive, NColorGroups, Current, All, Normal = Active };
+ Q_ENUM(ColorGroup)
enum ColorRole { WindowText, Button, Light, Midlight, Dark, Mid,
Text, BrightText, ButtonText, Base, Window, Shadow,
Highlight, HighlightedText,
@@ -90,6 +90,7 @@ public:
NColorRoles = ToolTipText + 1,
Foreground = WindowText, Background = Window
};
+ Q_ENUM(ColorRole)
inline ColorGroup currentColorGroup() const { return static_cast<ColorGroup>(data.current_group); }
inline void setCurrentColorGroup(ColorGroup cg) { data.current_group = cg; }
diff --git a/src/gui/kernel/qpixelformat.cpp b/src/gui/kernel/qpixelformat.cpp
index cfa8a96d69..d0fed88dbb 100644
--- a/src/gui/kernel/qpixelformat.cpp
+++ b/src/gui/kernel/qpixelformat.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 QtGui 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$
@@ -69,6 +69,7 @@ QT_BEGIN_NAMESPACE
\enum QPixelFormat::ColorModel
This enum type is used to describe the color model of the pixelformat.
+ Alpha was added in 5.5.
\value RGB The color model is RGB.
@@ -86,6 +87,8 @@ QT_BEGIN_NAMESPACE
\value HSV The color model is HSV.
\value YUV The color model is YUV.
+
+ \value Alpha There is no color model, only alpha is used.
*/
/*!
@@ -282,6 +285,21 @@ QT_BEGIN_NAMESPACE
*/
/*!
+ \fn QPixelFormat qPixelFormatAlpha(uchar channelSize,
+ QPixelFormat::TypeInterpretation typeInterpretation = QPixelFormat::UnsignedInteger)
+ \relates QPixelFormat
+ \since 5.5
+
+ Constructor function for creating an Alpha format. A mask format can be
+ described by passing 1 to \a channelSize. Its also possible to define very
+ accurate alpha formats using doubles to describe each pixel by passing 8
+ as \a channelSize and FloatingPoint as \a typeInterpretation.
+
+ \sa QPixelFormat::TypeInterpretation
+*/
+
+
+/*!
\fn QPixelFormat qPixelFormatCmyk(uchar channelSize,
uchar alphaSize = 0,
QPixelFormat::AlphaUsage alphaUsage = QPixelFormat::IgnoresAlpha,
diff --git a/src/gui/kernel/qpixelformat.h b/src/gui/kernel/qpixelformat.h
index f55c97c7c0..9ccfa39e95 100644
--- a/src/gui/kernel/qpixelformat.h
+++ b/src/gui/kernel/qpixelformat.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 QtGui 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$
@@ -103,7 +103,8 @@ public:
CMYK,
HSL,
HSV,
- YUV
+ YUV,
+ Alpha
};
enum AlphaUsage {
@@ -304,6 +305,22 @@ Q_DECL_CONSTEXPR inline QPixelFormat qPixelFormatGrayscale(uchar channelSize,
typeInt);
}
+Q_DECL_CONSTEXPR inline QPixelFormat qPixelFormatAlpha(uchar channelSize,
+ QPixelFormat::TypeInterpretation typeInt=QPixelFormat::UnsignedInteger) Q_DECL_NOTHROW
+{
+ return QPixelFormat(QPixelFormat::Alpha,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ channelSize,
+ QPixelFormat::UsesAlpha,
+ QPixelFormat::AtBeginning,
+ QPixelFormat::NotPremultiplied,
+ typeInt);
+}
+
Q_DECL_CONSTEXPR inline QPixelFormat qPixelFormatCmyk(uchar channelSize,
uchar alfa=0,
QPixelFormat::AlphaUsage usage=QPixelFormat::IgnoresAlpha,
diff --git a/src/gui/kernel/qplatformclipboard.cpp b/src/gui/kernel/qplatformclipboard.cpp
index 3774a6be11..1cb223fef6 100644
--- a/src/gui/kernel/qplatformclipboard.cpp
+++ b/src/gui/kernel/qplatformclipboard.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 QtGui 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/gui/kernel/qplatformclipboard.h b/src/gui/kernel/qplatformclipboard.h
index f70ece8a13..f52e3e2fa2 100644
--- a/src/gui/kernel/qplatformclipboard.h
+++ b/src/gui/kernel/qplatformclipboard.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 QtGui 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/gui/kernel/qplatformcursor.cpp b/src/gui/kernel/qplatformcursor.cpp
index 2426cc5872..7239ac7ba4 100644
--- a/src/gui/kernel/qplatformcursor.cpp
+++ b/src/gui/kernel/qplatformcursor.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 QtOpenVG 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/gui/kernel/qplatformcursor.h b/src/gui/kernel/qplatformcursor.h
index 6e9983ecc6..4f4f9cc6ae 100644
--- a/src/gui/kernel/qplatformcursor.h
+++ b/src/gui/kernel/qplatformcursor.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 QtOpenVG 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/gui/kernel/qplatformdialoghelper.cpp b/src/gui/kernel/qplatformdialoghelper.cpp
index 5172801e78..3d37088182 100644
--- a/src/gui/kernel/qplatformdialoghelper.cpp
+++ b/src/gui/kernel/qplatformdialoghelper.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 QtGui 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/gui/kernel/qplatformdialoghelper.h b/src/gui/kernel/qplatformdialoghelper.h
index e0730cd3fa..8b2b9881b7 100644
--- a/src/gui/kernel/qplatformdialoghelper.h
+++ b/src/gui/kernel/qplatformdialoghelper.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 QtGui 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/gui/kernel/qplatformdrag.cpp b/src/gui/kernel/qplatformdrag.cpp
index 326f092ead..d789c75d1d 100644
--- a/src/gui/kernel/qplatformdrag.cpp
+++ b/src/gui/kernel/qplatformdrag.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 QtGui 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,57 +42,7 @@ QT_BEGIN_NAMESPACE
#ifndef QT_NO_DRAGANDDROP
#ifdef QDND_DEBUG
-QString dragActionsToString(Qt::DropActions actions)
-{
- QString str;
- if (actions == Qt::IgnoreAction) {
- if (!str.isEmpty())
- str += QLatin1String(" | ");
- str += QLatin1String("IgnoreAction");
- }
- if (actions & Qt::LinkAction) {
- if (!str.isEmpty())
- str += QLatin1String(" | ");
- str += QLatin1String("LinkAction");
- }
- if (actions & Qt::CopyAction) {
- if (!str.isEmpty())
- str += QLatin1String(" | ");
- str += QLatin1String("CopyAction");
- }
- if (actions & Qt::MoveAction) {
- if (!str.isEmpty())
- str += QLatin1String(" | ");
- str += QLatin1String("MoveAction");
- }
- if ((actions & Qt::TargetMoveAction) == Qt::TargetMoveAction ) {
- if (!str.isEmpty())
- str += QLatin1String(" | ");
- str += QLatin1String("TargetMoveAction");
- }
- return str;
-}
-
-QString KeyboardModifiersToString(Qt::KeyboardModifiers modifiers)
-{
- QString str;
- if (modifiers & Qt::ControlModifier) {
- if (!str.isEmpty())
- str += QLatin1String(" | ");
- str += QLatin1String("ControlModifier");
- }
- if (modifiers & Qt::AltModifier) {
- if (!str.isEmpty())
- str += QLatin1String(" | ");
- str += QLatin1String("AltModifier");
- }
- if (modifiers & Qt::ShiftModifier) {
- if (!str.isEmpty())
- str += QLatin1String(" | ");
- str += QLatin1String("ShiftModifier");
- }
- return str;
-}
+# include <QtCore/QDebug>
#endif
QPlatformDropQtResponse::QPlatformDropQtResponse(bool accepted, Qt::DropAction acceptedAction)
@@ -156,8 +106,7 @@ Qt::DropAction QPlatformDrag::defaultAction(Qt::DropActions possibleActions,
Qt::KeyboardModifiers modifiers) const
{
#ifdef QDND_DEBUG
- qDebug("QDragManager::defaultAction(Qt::DropActions possibleActions)");
- qDebug("keyboard modifiers : %s", qPrintable(KeyboardModifiersToString(modifiers)));
+ qDebug() << "QDragManager::defaultAction(Qt::DropActions possibleActions)\nkeyboard modifiers : " << modifiers;
#endif
Qt::DropAction default_action = Qt::IgnoreAction;
@@ -183,7 +132,7 @@ Qt::DropAction QPlatformDrag::defaultAction(Qt::DropActions possibleActions,
default_action = Qt::LinkAction;
#ifdef QDND_DEBUG
- qDebug("possible actions : %s", qPrintable(dragActionsToString(possibleActions)));
+ qDebug() << "possible actions : " << possibleActions;
#endif
// Check if the action determined is allowed
@@ -199,7 +148,7 @@ Qt::DropAction QPlatformDrag::defaultAction(Qt::DropActions possibleActions,
}
#ifdef QDND_DEBUG
- qDebug("default action : %s", qPrintable(dragActionsToString(default_action)));
+ qDebug() << "default action : " << default_action;
#endif
return default_action;
diff --git a/src/gui/kernel/qplatformdrag.h b/src/gui/kernel/qplatformdrag.h
index ce7a9aa1f2..10ee88477f 100644
--- a/src/gui/kernel/qplatformdrag.h
+++ b/src/gui/kernel/qplatformdrag.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 QtGui 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/gui/kernel/qplatformgraphicsbuffer.cpp b/src/gui/kernel/qplatformgraphicsbuffer.cpp
new file mode 100644
index 0000000000..84fe673bcf
--- /dev/null
+++ b/src/gui/kernel/qplatformgraphicsbuffer.cpp
@@ -0,0 +1,269 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the QtGui module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL21$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 or version 3 as published by the Free
+** Software Foundation and appearing in the file LICENSE.LGPLv21 and
+** LICENSE.LGPLv3 included in the packaging of this file. Please review the
+** following information to ensure the GNU Lesser General Public License
+** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** 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$
+**
+****************************************************************************/
+
+#include "qplatformgraphicsbuffer.h"
+#include <QtGui/QOpenGLContext>
+#include <QtGui/QOpenGLFunctions>
+#include <QtGui/qopengl.h>
+#include <QtCore/QDebug>
+
+QT_BEGIN_NAMESPACE
+/*!
+ \class QPlatformGraphicsBuffer
+ \inmodule QtGui
+ \since 5.5
+ \brief The QPlatformGraphicsBuffer is a windowsystem abstraction for native graphics buffers
+
+ Different platforms have different ways of representing graphics buffers. On
+ some platforms, it is possible to create one graphics buffer that you can bind
+ to a texture and also get main memory access to the image bits. On the
+ other hand, on some platforms all graphics buffer abstraction is completely
+ hidden.
+
+ QPlatformGraphicsBuffer is an abstraction of a single Graphics Buffer.
+
+ There is no public constructor nor any public factory function.
+
+ QPlatformGraphicsBuffer is intended to be created by using platform specific
+ APIs available from QtPlatformHeaders, or there might be accessor functions
+ similar to the accessor function that QPlatformBackingstore has.
+*/
+
+/*!
+ \enum QPlatformGraphicsBuffer::AccessType
+
+ This enum describes the access that is desired or granted for the graphics
+ buffer.
+
+ \value None
+ \value SWReadAccess
+ \value SWWriteAccess
+ \value TextureAccess
+ \value HWCompositor
+*/
+
+/*!
+ \enum QPlatformGraphicsBuffer::Origin
+
+ This enum describes the origin of the content of the buffer.
+
+ \value OriginTopLeft
+ \value OriginBottomLeft
+*/
+
+/*!
+ Protected constructor to initialize the private members.
+
+ \a size is the size of the buffer.
+ \a format is the format of the buffer.
+
+ \sa size() format()
+*/
+QPlatformGraphicsBuffer::QPlatformGraphicsBuffer(const QSize &size, const QPixelFormat &format)
+ : m_size(size)
+ , m_format(format)
+{
+}
+
+
+/*!
+ Virtual destructor.
+*/
+QPlatformGraphicsBuffer::~QPlatformGraphicsBuffer()
+{
+}
+
+/*!
+ Binds the content of this graphics buffer into the currently bound texture.
+
+ This function should fail for buffers not capable of locking to TextureAccess.
+
+ \a rect is the subrect which is desired to be bounded to the texture. This
+ argument has a no less than semantic, meaning more (if not all) of the buffer
+ can be bounded to the texture. An empty QRect is interpreted as entire buffer
+ should be bound.
+
+ This function only supports binding buffers to the GL_TEXTURE_2D texture
+ target.
+
+ Returns true on success, otherwise false.
+*/
+bool QPlatformGraphicsBuffer::bindToTexture(const QRect &rect) const
+{
+ Q_UNUSED(rect);
+ return false;
+}
+
+/*!
+ \fn QPlatformGraphicsBuffer::AccessTypes QPlatformGraphicsBuffer::isLocked() const
+ Function to check if the buffer is locked.
+
+ \sa lock()
+*/
+
+/*!
+ Before the data can be retrieved or before a buffer can be bound to a
+ texture it needs to be locked. This is a separate function call since this
+ operation might be time consuming, and it would not be satisfactory to do
+ it per function call.
+
+ \a access is the access type wanted.
+
+ \a rect is the subrect which is desired to be locked. This
+ argument has a no less than semantic, meaning more (if not all) of the buffer
+ can be locked. An empty QRect is interpreted as entire buffer should be locked.
+
+ Return true on successfully locking all AccessTypes specified \a access
+ otherwise returns false and no locks have been granted.
+*/
+bool QPlatformGraphicsBuffer::lock(AccessTypes access, const QRect &rect)
+{
+ bool locked = doLock(access, rect);
+ if (locked)
+ m_lock_access |= access;
+
+ return locked;
+}
+
+/*!
+ Unlocks the current buffer lock.
+
+ This function calls doUnlock, and then emits the unlocked signal with the
+ AccessTypes from before doUnlock was called.
+*/
+void QPlatformGraphicsBuffer::unlock()
+{
+ if (m_lock_access == None)
+ return;
+ AccessTypes previous = m_lock_access;
+ doUnlock();
+ m_lock_access = None;
+ emit unlocked(previous);
+}
+
+
+/*!
+ \fn QPlatformGraphicsBuffer::doLock(AccessTypes access, const QRect &rect = QRect())
+
+ This function should be reimplemented by subclasses. If one of the \a
+ access types specified can not be locked, then all should fail and this
+ function should return false.
+
+ \a rect is the subrect which is desired to be locked. This
+ argument has a no less than semantic, meaning more (if not all) of the
+ buffer can be locked. An empty QRect should be interpreted as the entire buffer
+ should be locked.
+
+ It is safe to call isLocked() to verify the current lock state.
+*/
+
+/*!
+ \fn QPlatformGraphicsBuffer::doUnlock()
+
+ This function should remove all locks set on the buffer.
+
+ It is safe to call isLocked() to verify the current lock state.
+*/
+
+/*!
+ \fn QPlatformGraphicsBuffer::unlocked(AccessTypes previousAccessTypes)
+
+ Signal that is emitted after unlocked has been called.
+
+ \a previousAccessTypes is the access types locked before unlock was called.
+*/
+
+/*!
+ Accessor for the bytes of the buffer. This function needs to be called on a
+ buffer with SWReadAccess access lock. Behavior is undefined for modifying
+ the memory returned when not having a SWWriteAccess.
+*/
+const uchar *QPlatformGraphicsBuffer::data() const
+{ return Q_NULLPTR; }
+
+/*!
+ Accessor for the bytes of the buffer. This function needs to be called on a
+ buffer with SWReadAccess access lock. Behavior is undefined for modifying
+ the memory returned when not having a SWWriteAccess.
+*/
+uchar *QPlatformGraphicsBuffer::data()
+{
+ return Q_NULLPTR;
+}
+
+/*!
+ Accessor for the length of the data buffer. This function is a convenience
+ function multiplying height of buffer with bytesPerLine().
+
+ \sa data() bytesPerLine() size()
+*/
+int QPlatformGraphicsBuffer::byteCount() const
+{
+ Q_ASSERT(isLocked() & SWReadAccess);
+ return size().height() * bytesPerLine();
+}
+
+/*!
+ Accessor for bytes per line in the graphics buffer.
+*/
+int QPlatformGraphicsBuffer::bytesPerLine() const
+{
+ return 0;
+}
+
+
+/*!
+ In origin of the content of the graphics buffer.
+
+ Default implementation is OriginTopLeft, as this is the coordinate
+ system default for Qt. However, for most regular OpenGL textures
+ this will be OriginBottomLeft.
+*/
+QPlatformGraphicsBuffer::Origin QPlatformGraphicsBuffer::origin() const
+{
+ return OriginTopLeft;
+}
+
+/*!
+ \fn QPlatformGraphicsBuffer::size() const
+
+ Accessor for content size.
+*/
+
+/*!
+ \fn QPlatformGraphicsBuffer::format() const
+
+ Accessor for the pixel format of the buffer.
+*/
+
+QT_END_NAMESPACE
diff --git a/src/gui/kernel/qplatformgraphicsbuffer.h b/src/gui/kernel/qplatformgraphicsbuffer.h
new file mode 100644
index 0000000000..e13ab783c2
--- /dev/null
+++ b/src/gui/kernel/qplatformgraphicsbuffer.h
@@ -0,0 +1,109 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the QtGui module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL21$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 or version 3 as published by the Free
+** Software Foundation and appearing in the file LICENSE.LGPLv21 and
+** LICENSE.LGPLv3 included in the packaging of this file. Please review the
+** following information to ensure the GNU Lesser General Public License
+** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** 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$
+**
+****************************************************************************/
+
+#ifndef QPLATFORMGRAPHICSBUFFER_H
+#define QPLATFORMGRAPHICSBUFFER_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is part of the QPA API and is not meant to be used
+// in applications. Usage of this API may make your code
+// source and binary incompatible with future versions of Qt.
+//
+
+
+#include <QtCore/QSize>
+#include <QtCore/QRect>
+#include <QtGui/QPixelFormat>
+#include <QtCore/qflags.h>
+#include <QtCore/QObject>
+
+QT_BEGIN_NAMESPACE
+
+class Q_GUI_EXPORT QPlatformGraphicsBuffer : public QObject
+{
+Q_OBJECT
+public:
+ enum AccessType
+ {
+ None = 0x00,
+ SWReadAccess = 0x01,
+ SWWriteAccess = 0x02,
+ TextureAccess = 0x04,
+ HWCompositor = 0x08
+ };
+ Q_DECLARE_FLAGS(AccessTypes, AccessType);
+
+ enum Origin {
+ OriginBottomLeft,
+ OriginTopLeft
+ };
+
+ virtual ~QPlatformGraphicsBuffer();
+
+ AccessTypes isLocked() const { return m_lock_access; }
+ bool lock(AccessTypes access, const QRect &rect = QRect());
+ void unlock();
+
+ virtual bool bindToTexture(const QRect &rect = QRect()) const;
+
+ virtual const uchar *data() const;
+ virtual uchar *data();
+ virtual int bytesPerLine() const;
+ int byteCount() const;
+
+ virtual Origin origin() const;
+
+ QSize size() const { return m_size; }
+ QPixelFormat format() const { return m_format; }
+
+Q_SIGNALS:
+ void unlocked(AccessTypes previousAccessTypes);
+
+protected:
+ QPlatformGraphicsBuffer(const QSize &size, const QPixelFormat &format);
+
+ virtual bool doLock(AccessTypes access, const QRect &rect = QRect()) = 0;
+ virtual void doUnlock() = 0;
+
+private:
+ QSize m_size;
+ QPixelFormat m_format;
+ AccessTypes m_lock_access;
+};
+
+QT_END_NAMESPACE
+
+#endif //QPLATFORMGRAPHICSBUFFER_H
diff --git a/src/gui/kernel/qplatformgraphicsbufferhelper.cpp b/src/gui/kernel/qplatformgraphicsbufferhelper.cpp
new file mode 100644
index 0000000000..2749b05691
--- /dev/null
+++ b/src/gui/kernel/qplatformgraphicsbufferhelper.cpp
@@ -0,0 +1,184 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the QtPlatformSupport module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL21$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 or version 3 as published by the Free
+** Software Foundation and appearing in the file LICENSE.LGPLv21 and
+** LICENSE.LGPLv3 included in the packaging of this file. Please review the
+** following information to ensure the GNU Lesser General Public License
+** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** 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$
+**
+****************************************************************************/
+
+#include <QtGui/qpa/qplatformgraphicsbuffer.h>
+
+#include "qplatformgraphicsbufferhelper.h"
+#include <QtCore/QDebug>
+#include <QtGui/qopengl.h>
+#include <QtGui/QImage>
+#include <QtGui/QOpenGLContext>
+#include <QtGui/QOpenGLFunctions>
+
+QT_BEGIN_NAMESPACE
+
+/*!
+ Convenience function to both lock and bind the buffer to a texture. This
+ function will first try and lock with texture read and texture write
+ access. If this succeeds it will use the bindToTexture function to bind the
+ content to the currently bound texture. If this fail it will try and lock
+ with SWReadAccess and then use the bindSWToTexture convenience function.
+
+ \a swizzle is suppose to be used by the caller to figure out if the Red and
+ Blue color channels need to be swizzled when rendering.
+
+ \a rect is the subrect which is desired to be bounded to the texture. This
+ argument has a no less than semantic, meaning more (if not all) of the buffer
+ can be bounded to the texture. An empty QRect is interpreted as entire buffer
+ should be bound.
+
+ The user should use the AccessTypes returned by isLocked to figure out what
+ lock has been obtained.
+
+ returns true if the buffer has successfully been bound to the currently
+ bound texture, otherwise returns false.
+*/
+bool QPlatformGraphicsBufferHelper::lockAndBindToTexture(QPlatformGraphicsBuffer *graphicsBuffer,
+ bool *swizzle,
+ const QRect &rect)
+{
+ if (graphicsBuffer->lock(QPlatformGraphicsBuffer::TextureAccess)) {
+ if (!graphicsBuffer->bindToTexture(rect)) {
+ qWarning() << Q_FUNC_INFO << "Failed to bind graphicsbuffer to texture";
+ return false;
+ }
+ if (swizzle)
+ *swizzle = false;
+ } else if (graphicsBuffer->lock(QPlatformGraphicsBuffer::SWReadAccess)) {
+ if (!bindSWToTexture(graphicsBuffer, swizzle, rect)) {
+ qWarning() << Q_FUNC_INFO << "Failed to bind SW graphcisbuffer to texture";
+ return false;
+ }
+ } else {
+ qWarning() << Q_FUNC_INFO << "Failed to lock";
+ return false;
+ }
+ return true;
+}
+
+/*!
+ Convenience function that uploads the current raster content to the currently bound texture.
+
+ \a swizzleRandB is suppose to be used by the caller to figure out if the Red and
+ Blue color channels need to be swizzled when rendering. This is an
+ optimization. Qt often renders to software buffers interpreting pixels as
+ unsigned ints. When these buffers are uploaded to textures and each color
+ channel per pixel is interpreted as a byte (read sequentially), then the
+ Red and Blue channels are swapped. Conveniently the Alpha buffer will be
+ correct since Qt historically has had the alpha channel as the first
+ channel, while OpenGL typically expects the alpha channel to be the last
+ channel.
+
+ \a subRect is the subrect which is desired to be bounded to the texture. This
+ argument has a no less than semantic, meaning more (if not all) of the buffer
+ can be bounded to the texture. An empty QRect is interpreted as entire buffer
+ should be bound.
+
+ This function fails for buffers not capable of locking to SWAccess.
+
+ Returns true on success, otherwise false.
+*/
+bool QPlatformGraphicsBufferHelper::bindSWToTexture(const QPlatformGraphicsBuffer *graphicsBuffer,
+ bool *swizzleRandB,
+ const QRect &subRect)
+{
+#ifndef QT_NO_OPENGL
+ if (!QOpenGLContext::currentContext())
+ return false;
+
+ if (!(graphicsBuffer->isLocked() & QPlatformGraphicsBuffer::SWReadAccess))
+ return false;
+
+ QSize size = graphicsBuffer->size();
+
+ Q_ASSERT(subRect.isEmpty() || QRect(QPoint(0,0), size).contains(subRect));
+
+ bool swizzle = false;
+ QImage::Format imageformat = QImage::toImageFormat(graphicsBuffer->format());
+ QImage image(graphicsBuffer->data(), size.width(), size.height(), graphicsBuffer->bytesPerLine(), imageformat);
+ if (graphicsBuffer->bytesPerLine() != (size.width() * 4)) {
+ image = image.convertToFormat(QImage::Format_RGBA8888);
+ } else if (imageformat == QImage::Format_RGB32) {
+ swizzle = true;
+ } else if (imageformat != QImage::Format_RGBA8888) {
+ image = image.convertToFormat(QImage::Format_RGBA8888);
+ }
+
+ QOpenGLFunctions *funcs = QOpenGLContext::currentContext()->functions();
+
+ QRect rect = subRect;
+ if (rect.isNull() || rect == QRect(QPoint(0,0),size)) {
+ funcs->glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, size.width(), size.height(), 0, GL_RGBA, GL_UNSIGNED_BYTE, image.constBits());
+ } else {
+#ifndef QT_OPENGL_ES_2
+ if (!QOpenGLContext::currentContext()->isOpenGLES()) {
+ funcs->glPixelStorei(GL_UNPACK_ROW_LENGTH, image.width());
+ funcs->glTexSubImage2D(GL_TEXTURE_2D, 0, rect.x(), rect.y(), rect.width(), rect.height(), GL_RGBA, GL_UNSIGNED_BYTE,
+ image.constScanLine(rect.y()) + rect.x() * 4);
+ funcs->glPixelStorei(GL_UNPACK_ROW_LENGTH, 0);
+ } else
+#endif
+ {
+ // if the rect is wide enough it's cheaper to just
+ // extend it instead of doing an image copy
+ if (rect.width() >= size.width() / 2) {
+ rect.setX(0);
+ rect.setWidth(size.width());
+ }
+
+ // if the sub-rect is full-width we can pass the image data directly to
+ // OpenGL instead of copying, since there's no gap between scanlines
+
+ if (rect.width() == size.width()) {
+ funcs->glTexSubImage2D(GL_TEXTURE_2D, 0, 0, rect.y(), rect.width(), rect.height(), GL_RGBA, GL_UNSIGNED_BYTE,
+ image.constScanLine(rect.y()));
+ } else {
+ funcs->glTexSubImage2D(GL_TEXTURE_2D, 0, rect.x(), rect.y(), rect.width(), rect.height(), GL_RGBA, GL_UNSIGNED_BYTE,
+ image.copy(rect).constBits());
+ }
+ }
+ }
+ if (swizzleRandB)
+ *swizzleRandB = swizzle;
+
+ return true;
+
+#else
+ Q_UNUSED(graphicsBuffer)
+ Q_UNUSED(swizzleRandB)
+ Q_UNUSED(subRect)
+ return false;
+#endif // QT_NO_OPENGL
+}
+
+QT_END_NAMESPACE
diff --git a/src/gui/kernel/qplatformgraphicsbufferhelper.h b/src/gui/kernel/qplatformgraphicsbufferhelper.h
new file mode 100644
index 0000000000..ded7810608
--- /dev/null
+++ b/src/gui/kernel/qplatformgraphicsbufferhelper.h
@@ -0,0 +1,48 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the QtPlatformSupport module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL21$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 or version 3 as published by the Free
+** Software Foundation and appearing in the file LICENSE.LGPLv21 and
+** LICENSE.LGPLv3 included in the packaging of this file. Please review the
+** following information to ensure the GNU Lesser General Public License
+** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** 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$
+**
+****************************************************************************/
+
+#ifndef QPLATFORMGRAPHICSBUFFERHELPER_H
+#define QPLATFORMGRAPHICSBUFFERHELPER_H
+
+#include <QtGui/qpa/qplatformgraphicsbuffer.h>
+
+QT_BEGIN_NAMESPACE
+
+namespace QPlatformGraphicsBufferHelper {
+ bool lockAndBindToTexture(QPlatformGraphicsBuffer *graphicsBuffer, bool *swizzleRandB, const QRect &rect = QRect());
+ bool bindSWToTexture(const QPlatformGraphicsBuffer *graphicsBuffer, bool *swizzleRandB = Q_NULLPTR, const QRect &rect = QRect());
+}
+
+QT_END_NAMESPACE
+
+#endif
diff --git a/src/gui/kernel/qplatforminputcontext.cpp b/src/gui/kernel/qplatforminputcontext.cpp
index 5937c65cc7..f9ff1d36d9 100644
--- a/src/gui/kernel/qplatforminputcontext.cpp
+++ b/src/gui/kernel/qplatforminputcontext.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 QtGui 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$
@@ -163,7 +163,7 @@ QRectF QPlatformInputContext::keyboardRect() const
*/
void QPlatformInputContext::emitKeyboardRectChanged()
{
- emit qApp->inputMethod()->keyboardRectangleChanged();
+ emit QGuiApplication::inputMethod()->keyboardRectangleChanged();
}
/*!
@@ -182,7 +182,7 @@ bool QPlatformInputContext::isAnimating() const
*/
void QPlatformInputContext::emitAnimatingChanged()
{
- emit qApp->inputMethod()->animatingChanged();
+ emit QGuiApplication::inputMethod()->animatingChanged();
}
/*!
@@ -214,7 +214,7 @@ bool QPlatformInputContext::isInputPanelVisible() const
*/
void QPlatformInputContext::emitInputPanelVisibleChanged()
{
- emit qApp->inputMethod()->visibleChanged();
+ emit QGuiApplication::inputMethod()->visibleChanged();
}
QLocale QPlatformInputContext::locale() const
@@ -224,7 +224,7 @@ QLocale QPlatformInputContext::locale() const
void QPlatformInputContext::emitLocaleChanged()
{
- emit qApp->inputMethod()->localeChanged();
+ emit QGuiApplication::inputMethod()->localeChanged();
}
Qt::LayoutDirection QPlatformInputContext::inputDirection() const
@@ -234,7 +234,7 @@ Qt::LayoutDirection QPlatformInputContext::inputDirection() const
void QPlatformInputContext::emitInputDirectionChanged(Qt::LayoutDirection newDirection)
{
- emit qApp->inputMethod()->inputDirectionChanged(newDirection);
+ emit QGuiApplication::inputMethod()->inputDirectionChanged(newDirection);
}
/*!
diff --git a/src/gui/kernel/qplatforminputcontext.h b/src/gui/kernel/qplatforminputcontext.h
index 0c8953f89c..280556e12a 100644
--- a/src/gui/kernel/qplatforminputcontext.h
+++ b/src/gui/kernel/qplatforminputcontext.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 QtGui 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/gui/kernel/qplatforminputcontext_p.h b/src/gui/kernel/qplatforminputcontext_p.h
index fcf34c036d..7cb06d6625 100644
--- a/src/gui/kernel/qplatforminputcontext_p.h
+++ b/src/gui/kernel/qplatforminputcontext_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 QtGui 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/gui/kernel/qplatforminputcontextfactory.cpp b/src/gui/kernel/qplatforminputcontextfactory.cpp
index 321550f427..a7660e76ae 100644
--- a/src/gui/kernel/qplatforminputcontextfactory.cpp
+++ b/src/gui/kernel/qplatforminputcontextfactory.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 QtGui 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/gui/kernel/qplatforminputcontextfactory_p.h b/src/gui/kernel/qplatforminputcontextfactory_p.h
index 64b610a603..a74c4f5f80 100644
--- a/src/gui/kernel/qplatforminputcontextfactory_p.h
+++ b/src/gui/kernel/qplatforminputcontextfactory_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 QtGui 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/gui/kernel/qplatforminputcontextplugin.cpp b/src/gui/kernel/qplatforminputcontextplugin.cpp
index 64e8c916c4..87985104d3 100644
--- a/src/gui/kernel/qplatforminputcontextplugin.cpp
+++ b/src/gui/kernel/qplatforminputcontextplugin.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 QtGui 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/gui/kernel/qplatforminputcontextplugin_p.h b/src/gui/kernel/qplatforminputcontextplugin_p.h
index df302097c3..732eba3e06 100644
--- a/src/gui/kernel/qplatforminputcontextplugin_p.h
+++ b/src/gui/kernel/qplatforminputcontextplugin_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 QtGui 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/gui/kernel/qplatformintegration.cpp b/src/gui/kernel/qplatformintegration.cpp
index 39b031ef6d..4d973d47a5 100644
--- a/src/gui/kernel/qplatformintegration.cpp
+++ b/src/gui/kernel/qplatformintegration.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 QtGui 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$
@@ -231,6 +231,8 @@ QPlatformServices *QPlatformIntegration::services() const
implementation for QOpenGLContext::getProcAddress() and support returning a function
pointer also for the standard, non-extension functions. This capability is a
prerequisite for dynamic OpenGL loading.
+
+ \value ApplicationIcon The platform supports setting the application icon. (since 5.5)
*/
/*!
@@ -324,6 +326,16 @@ void QPlatformIntegration::initialize()
}
/*!
+ Called before the platform integration is deleted. Useful when cleanup relies on virtual
+ functions.
+
+ \since 5.5
+*/
+void QPlatformIntegration::destroy()
+{
+}
+
+/*!
Returns the platforms input context.
The default implementation returns 0, implying no input method support.
@@ -376,12 +388,16 @@ QVariant QPlatformIntegration::styleHint(StyleHint hint) const
return QPlatformTheme::defaultThemeHint(QPlatformTheme::StartDragVelocity);
case UseRtlExtensions:
return QVariant(false);
- case SynthesizeMouseFromTouchEvents:
- return true;
case SetFocusOnTouchRelease:
return QVariant(false);
case MousePressAndHoldInterval:
return QPlatformTheme::defaultThemeHint(QPlatformTheme::MousePressAndHoldInterval);
+ case TabFocusBehavior:
+ return QPlatformTheme::defaultThemeHint(QPlatformTheme::TabFocusBehavior);
+ case ReplayMousePressOutsidePopup:
+ return true;
+ case ItemViewActivateItemOnSingleClick:
+ return QPlatformTheme::defaultThemeHint(QPlatformTheme::ItemViewActivateItemOnSingleClick);
}
return 0;
@@ -429,16 +445,35 @@ QList<int> QPlatformIntegration::possibleKeys(const QKeyEvent *) const
This adds the screen to QGuiApplication::screens(), and emits the
QGuiApplication::screenAdded() signal.
- The screen is automatically removed when the QPlatformScreen is destroyed.
+ The screen should be deleted by calling QPlatformIntegration::destroyScreen().
*/
-void QPlatformIntegration::screenAdded(QPlatformScreen *ps)
+void QPlatformIntegration::screenAdded(QPlatformScreen *ps, bool isPrimary)
{
QScreen *screen = new QScreen(ps);
ps->d_func()->screen = screen;
- QGuiApplicationPrivate::screen_list << screen;
+ if (isPrimary) {
+ QGuiApplicationPrivate::screen_list.prepend(screen);
+ } else {
+ QGuiApplicationPrivate::screen_list.append(screen);
+ }
emit qGuiApp->screenAdded(screen);
}
+/*!
+ Should be called by the implementation whenever a screen is removed.
+
+ This removes the screen from QGuiApplication::screens(), and deletes it.
+
+ Failing to call this and manually deleting the QPlatformScreen instead may
+ lead to a crash due to a pure virtual call.
+*/
+void QPlatformIntegration::destroyScreen(QPlatformScreen *screen)
+{
+ QGuiApplicationPrivate::screen_list.removeOne(screen->d_func()->screen);
+ delete screen->d_func()->screen;
+ delete screen;
+}
+
QStringList QPlatformIntegration::themeNames() const
{
return QStringList();
@@ -513,4 +548,16 @@ QOpenGLContext::OpenGLModuleType QPlatformIntegration::openGLModuleType()
}
#endif
+/*!
+ \since 5.5
+
+ Platform integration function for setting the application icon.
+
+ \sa QGuiApplication::setWindowIcon()
+*/
+void QPlatformIntegration::setApplicationIcon(const QIcon &icon) const
+{
+ Q_UNUSED(icon);
+}
+
QT_END_NAMESPACE
diff --git a/src/gui/kernel/qplatformintegration.h b/src/gui/kernel/qplatformintegration.h
index d510240fa4..2aa502b3d2 100644
--- a/src/gui/kernel/qplatformintegration.h
+++ b/src/gui/kernel/qplatformintegration.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 QtGui 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$
@@ -90,7 +90,8 @@ public:
WindowManagement,
SyncState,
RasterGLSurface,
- AllGLFunctionsQueryable
+ AllGLFunctionsQueryable,
+ ApplicationIcon
};
virtual ~QPlatformIntegration() { }
@@ -109,6 +110,7 @@ public:
// Event dispatcher:
virtual QAbstractEventDispatcher *createEventDispatcher() const = 0;
virtual void initialize();
+ virtual void destroy();
//Deeper window system integrations
virtual QPlatformFontDatabase *fontDatabase() const;
@@ -140,11 +142,13 @@ public:
FontSmoothingGamma,
StartDragVelocity,
UseRtlExtensions,
- SynthesizeMouseFromTouchEvents,
PasswordMaskCharacter,
SetFocusOnTouchRelease,
ShowIsMaximized,
- MousePressAndHoldInterval
+ MousePressAndHoldInterval,
+ TabFocusBehavior,
+ ReplayMousePressOutsidePopup,
+ ItemViewActivateItemOnSingleClick
};
virtual QVariant styleHint(StyleHint hint) const;
@@ -167,9 +171,10 @@ public:
#ifndef QT_NO_OPENGL
virtual QOpenGLContext::OpenGLModuleType openGLModuleType();
#endif
-
+ virtual void setApplicationIcon(const QIcon &icon) const;
protected:
- void screenAdded(QPlatformScreen *screen);
+ void screenAdded(QPlatformScreen *screen, bool isPrimary = false);
+ void destroyScreen(QPlatformScreen *screen);
};
QT_END_NAMESPACE
diff --git a/src/gui/kernel/qplatformintegrationfactory.cpp b/src/gui/kernel/qplatformintegrationfactory.cpp
index 1d08faa0ab..d58ac3a33f 100644
--- a/src/gui/kernel/qplatformintegrationfactory.cpp
+++ b/src/gui/kernel/qplatformintegrationfactory.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 QtGui 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/gui/kernel/qplatformintegrationfactory_p.h b/src/gui/kernel/qplatformintegrationfactory_p.h
index fdad8bd71c..2ac0954cc1 100644
--- a/src/gui/kernel/qplatformintegrationfactory_p.h
+++ b/src/gui/kernel/qplatformintegrationfactory_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 QtGui 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/gui/kernel/qplatformintegrationplugin.cpp b/src/gui/kernel/qplatformintegrationplugin.cpp
index e08cc4c339..04d0c2a8e3 100644
--- a/src/gui/kernel/qplatformintegrationplugin.cpp
+++ b/src/gui/kernel/qplatformintegrationplugin.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 QtGui 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/gui/kernel/qplatformintegrationplugin.h b/src/gui/kernel/qplatformintegrationplugin.h
index 915a09a701..b5e0b1874c 100644
--- a/src/gui/kernel/qplatformintegrationplugin.h
+++ b/src/gui/kernel/qplatformintegrationplugin.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 QtGui 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/gui/kernel/qplatformmenu.cpp b/src/gui/kernel/qplatformmenu.cpp
index 7bfd211f4b..cb311b8d13 100644
--- a/src/gui/kernel/qplatformmenu.cpp
+++ b/src/gui/kernel/qplatformmenu.cpp
@@ -1,8 +1,8 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
+** Copyright (C) 2015 The Qt Company Ltd.
** Copyright (C) 2014 Martin Graesslin <mgraesslin@kde.org>
-** Contact: http://www.qt-project.org/legal
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -11,9 +11,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
@@ -24,8 +24,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/gui/kernel/qplatformmenu.h b/src/gui/kernel/qplatformmenu.h
index 0093ef1538..baa1e460d7 100644
--- a/src/gui/kernel/qplatformmenu.h
+++ b/src/gui/kernel/qplatformmenu.h
@@ -1,8 +1,8 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
+** Copyright (C) 2015 The Qt Company Ltd.
** Copyright (C) 2012 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com, author James Turner <james.turner@kdab.com>
-** Contact: http://www.qt-project.org/legal
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -11,9 +11,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
@@ -24,8 +24,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$
@@ -103,6 +103,7 @@ public:
virtual void setText(const QString &text) = 0;
virtual void setIcon(const QIcon &icon) = 0;
virtual void setEnabled(bool enabled) = 0;
+ virtual bool isEnabled() const { return true; }
virtual void setVisible(bool visible) = 0;
virtual void setMinimumWidth(int width) { Q_UNUSED(width); }
virtual void setFont(const QFont &font) { Q_UNUSED(font); }
diff --git a/src/gui/kernel/qplatformnativeinterface.cpp b/src/gui/kernel/qplatformnativeinterface.cpp
index f412b3c420..8fa8debcb9 100644
--- a/src/gui/kernel/qplatformnativeinterface.cpp
+++ b/src/gui/kernel/qplatformnativeinterface.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 QtGui 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/gui/kernel/qplatformnativeinterface.h b/src/gui/kernel/qplatformnativeinterface.h
index 53b046913d..71a4e9c768 100644
--- a/src/gui/kernel/qplatformnativeinterface.h
+++ b/src/gui/kernel/qplatformnativeinterface.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 QtGui 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/gui/kernel/qplatformoffscreensurface.cpp b/src/gui/kernel/qplatformoffscreensurface.cpp
index 7d1b031b21..bfde0a0ffc 100644
--- a/src/gui/kernel/qplatformoffscreensurface.cpp
+++ b/src/gui/kernel/qplatformoffscreensurface.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 QtGui 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/gui/kernel/qplatformoffscreensurface.h b/src/gui/kernel/qplatformoffscreensurface.h
index 07bb710eb8..87513f882c 100644
--- a/src/gui/kernel/qplatformoffscreensurface.h
+++ b/src/gui/kernel/qplatformoffscreensurface.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 QtGui 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 @@ public:
QPlatformScreen *screen() const;
- virtual QSurfaceFormat format() const;
+ virtual QSurfaceFormat format() const Q_DECL_OVERRIDE;
virtual bool isValid() const;
protected:
diff --git a/src/gui/kernel/qplatformopenglcontext.cpp b/src/gui/kernel/qplatformopenglcontext.cpp
index 527bfdd983..b9cf81b30e 100644
--- a/src/gui/kernel/qplatformopenglcontext.cpp
+++ b/src/gui/kernel/qplatformopenglcontext.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 QtGui 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$
@@ -89,6 +89,16 @@ QPlatformOpenGLContext::~QPlatformOpenGLContext()
}
/*!
+ Called after a new instance is constructed. The default implementation does nothing.
+
+ Subclasses can use this function to perform additional initialization that relies on
+ virtual functions.
+ */
+void QPlatformOpenGLContext::initialize()
+{
+}
+
+/*!
Reimplement in subclass if your platform uses framebuffer objects for surfaces.
The default implementation returns 0.
diff --git a/src/gui/kernel/qplatformopenglcontext.h b/src/gui/kernel/qplatformopenglcontext.h
index 261b6921a4..a1b781f4e0 100644
--- a/src/gui/kernel/qplatformopenglcontext.h
+++ b/src/gui/kernel/qplatformopenglcontext.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 QtGui 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,6 +63,8 @@ public:
QPlatformOpenGLContext();
virtual ~QPlatformOpenGLContext();
+ virtual void initialize();
+
virtual QSurfaceFormat format() const = 0;
virtual void swapBuffers(QPlatformSurface *surface) = 0;
diff --git a/src/gui/kernel/qplatformscreen.cpp b/src/gui/kernel/qplatformscreen.cpp
index 71710d1cb1..edf546799f 100644
--- a/src/gui/kernel/qplatformscreen.cpp
+++ b/src/gui/kernel/qplatformscreen.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 QtGui 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$
@@ -32,6 +32,7 @@
****************************************************************************/
#include "qplatformscreen.h"
+#include <QtCore/qdebug.h>
#include <QtGui/qguiapplication.h>
#include <qpa/qplatformcursor.h>
#include <QtGui/private/qguiapplication_p.h>
@@ -52,9 +53,11 @@ QPlatformScreen::QPlatformScreen()
QPlatformScreen::~QPlatformScreen()
{
Q_D(QPlatformScreen);
-
- QGuiApplicationPrivate::screen_list.removeOne(d->screen);
- delete d->screen;
+ if (d->screen) {
+ qWarning("Manually deleting a QPlatformScreen. Call QPlatformIntegration::destroyScreen instead.");
+ QGuiApplicationPrivate::screen_list.removeOne(d->screen);
+ delete d->screen;
+ }
}
/*!
@@ -304,4 +307,117 @@ void QPlatformScreen::resizeMaximizedWindows()
}
}
+// i must be power of two
+static int log2(uint i)
+{
+ if (i == 0)
+ return -1;
+
+ int result = 0;
+ while (!(i & 1)) {
+ ++result;
+ i >>= 1;
+ }
+ return result;
+}
+
+int QPlatformScreen::angleBetween(Qt::ScreenOrientation a, Qt::ScreenOrientation b)
+{
+ if (a == Qt::PrimaryOrientation || b == Qt::PrimaryOrientation) {
+ qWarning() << "Use QScreen version of" << __FUNCTION__ << "when passing Qt::PrimaryOrientation";
+ return 0;
+ }
+
+ if (a == b)
+ return 0;
+
+ int ia = log2(uint(a));
+ int ib = log2(uint(b));
+
+ int delta = ia - ib;
+
+ if (delta < 0)
+ delta = delta + 4;
+
+ int angles[] = { 0, 90, 180, 270 };
+ return angles[delta];
+}
+
+QTransform QPlatformScreen::transformBetween(Qt::ScreenOrientation a, Qt::ScreenOrientation b, const QRect &target)
+{
+ if (a == Qt::PrimaryOrientation || b == Qt::PrimaryOrientation) {
+ qWarning() << "Use QScreen version of" << __FUNCTION__ << "when passing Qt::PrimaryOrientation";
+ return QTransform();
+ }
+
+ if (a == b)
+ return QTransform();
+
+ int angle = angleBetween(a, b);
+
+ QTransform result;
+ switch (angle) {
+ case 90:
+ result.translate(target.width(), 0);
+ break;
+ case 180:
+ result.translate(target.width(), target.height());
+ break;
+ case 270:
+ result.translate(0, target.height());
+ break;
+ default:
+ Q_ASSERT(false);
+ }
+ result.rotate(angle);
+
+ return result;
+}
+
+QRect QPlatformScreen::mapBetween(Qt::ScreenOrientation a, Qt::ScreenOrientation b, const QRect &rect)
+{
+ if (a == Qt::PrimaryOrientation || b == Qt::PrimaryOrientation) {
+ qWarning() << "Use QScreen version of" << __FUNCTION__ << "when passing Qt::PrimaryOrientation";
+ return rect;
+ }
+
+ if (a == b)
+ return rect;
+
+ if ((a == Qt::PortraitOrientation || a == Qt::InvertedPortraitOrientation)
+ != (b == Qt::PortraitOrientation || b == Qt::InvertedPortraitOrientation))
+ {
+ return QRect(rect.y(), rect.x(), rect.height(), rect.width());
+ }
+
+ return rect;
+}
+
+/*!
+ Returns a hint about this screen's subpixel layout structure.
+
+ The default implementation queries the \b{QT_SUBPIXEL_AA_TYPE} env variable.
+ This is just a hint because most platforms don't have a way to retrieve the correct value from hardware
+ and instead rely on font configurations.
+*/
+QPlatformScreen::SubpixelAntialiasingType QPlatformScreen::subpixelAntialiasingTypeHint() const
+{
+ static int type = -1;
+ if (type == -1) {
+ QByteArray env = qgetenv("QT_SUBPIXEL_AA_TYPE");
+ if (env == "RGB")
+ type = QPlatformScreen::Subpixel_RGB;
+ else if (env == "BGR")
+ type = QPlatformScreen::Subpixel_BGR;
+ else if (env == "VRGB")
+ type = QPlatformScreen::Subpixel_VRGB;
+ else if (env == "VBGR")
+ type = QPlatformScreen::Subpixel_VBGR;
+ else
+ type = QPlatformScreen::Subpixel_None;
+ }
+
+ return static_cast<QPlatformScreen::SubpixelAntialiasingType>(type);
+}
+
QT_END_NAMESPACE
diff --git a/src/gui/kernel/qplatformscreen.h b/src/gui/kernel/qplatformscreen.h
index 2ca12616b4..551cb788c9 100644
--- a/src/gui/kernel/qplatformscreen.h
+++ b/src/gui/kernel/qplatformscreen.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 QtGui 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$
@@ -74,6 +74,14 @@ class Q_GUI_EXPORT QPlatformScreen
Q_DECLARE_PRIVATE(QPlatformScreen)
public:
+ enum SubpixelAntialiasingType { // copied from qfontengine_p.h since we can't include private headers
+ Subpixel_None,
+ Subpixel_RGB,
+ Subpixel_BGR,
+ Subpixel_VRGB,
+ Subpixel_VBGR
+ };
+
QPlatformScreen();
virtual ~QPlatformScreen();
@@ -107,6 +115,11 @@ public:
virtual QString name() const { return QString(); }
virtual QPlatformCursor *cursor() const;
+ virtual SubpixelAntialiasingType subpixelAntialiasingTypeHint() const;
+
+ static int angleBetween(Qt::ScreenOrientation a, Qt::ScreenOrientation b);
+ static QTransform transformBetween(Qt::ScreenOrientation a, Qt::ScreenOrientation b, const QRect &target);
+ static QRect mapBetween(Qt::ScreenOrientation a, Qt::ScreenOrientation b, const QRect &rect);
protected:
void resizeMaximizedWindows();
diff --git a/src/gui/kernel/qplatformscreen_p.h b/src/gui/kernel/qplatformscreen_p.h
index 42a5503461..04c7e4d67f 100644
--- a/src/gui/kernel/qplatformscreen_p.h
+++ b/src/gui/kernel/qplatformscreen_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 QtGui 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,7 +52,7 @@ class QScreen;
class QPlatformScreenPrivate
{
public:
- QScreen *screen;
+ QPointer<QScreen> screen;
};
QT_END_NAMESPACE
diff --git a/src/gui/kernel/qplatformservices.cpp b/src/gui/kernel/qplatformservices.cpp
index 2188920c86..a37f9d056c 100644
--- a/src/gui/kernel/qplatformservices.cpp
+++ b/src/gui/kernel/qplatformservices.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 QtGui 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/gui/kernel/qplatformservices.h b/src/gui/kernel/qplatformservices.h
index 005748d18c..c4e3797593 100644
--- a/src/gui/kernel/qplatformservices.h
+++ b/src/gui/kernel/qplatformservices.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 QtGui 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/gui/kernel/qplatformsessionmanager.cpp b/src/gui/kernel/qplatformsessionmanager.cpp
index 123073d167..b48819bab9 100644
--- a/src/gui/kernel/qplatformsessionmanager.cpp
+++ b/src/gui/kernel/qplatformsessionmanager.cpp
@@ -2,8 +2,8 @@
**
** Copyright (C) 2013 Samuel Gaist <samuel.gaist@edeltech.ch>
** Copyright (C) 2013 Teo Mrnjavac <teo@kde.org>
-** 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 QtGui module of the Qt Toolkit.
**
@@ -12,9 +12,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
@@ -25,8 +25,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/gui/kernel/qplatformsessionmanager.h b/src/gui/kernel/qplatformsessionmanager.h
index 6fdc681ce4..70e2c065eb 100644
--- a/src/gui/kernel/qplatformsessionmanager.h
+++ b/src/gui/kernel/qplatformsessionmanager.h
@@ -2,8 +2,8 @@
**
** Copyright (C) 2013 Samuel Gaist <samuel.gaist@edeltech.ch>
** Copyright (C) 2013 Teo Mrnjavac <teo@kde.org>
-** 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 QtGui module of the Qt Toolkit.
**
@@ -12,9 +12,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
@@ -25,8 +25,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/gui/kernel/qplatformsharedgraphicscache.cpp b/src/gui/kernel/qplatformsharedgraphicscache.cpp
index 932775e93d..c364b6207d 100644
--- a/src/gui/kernel/qplatformsharedgraphicscache.cpp
+++ b/src/gui/kernel/qplatformsharedgraphicscache.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 QtGui 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/gui/kernel/qplatformsharedgraphicscache.h b/src/gui/kernel/qplatformsharedgraphicscache.h
index 258054fbd5..93650fdf8c 100644
--- a/src/gui/kernel/qplatformsharedgraphicscache.h
+++ b/src/gui/kernel/qplatformsharedgraphicscache.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 QtGui 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/gui/kernel/qplatformsurface.cpp b/src/gui/kernel/qplatformsurface.cpp
index fa2f3505ba..5a733afb6d 100644
--- a/src/gui/kernel/qplatformsurface.cpp
+++ b/src/gui/kernel/qplatformsurface.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 QtGui 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/gui/kernel/qplatformsurface.h b/src/gui/kernel/qplatformsurface.h
index 915e91bbf1..5e83179bc6 100644
--- a/src/gui/kernel/qplatformsurface.h
+++ b/src/gui/kernel/qplatformsurface.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 QtGui 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/gui/kernel/qplatformsystemtrayicon.cpp b/src/gui/kernel/qplatformsystemtrayicon.cpp
index ba1ccc379d..fe2cef1231 100644
--- a/src/gui/kernel/qplatformsystemtrayicon.cpp
+++ b/src/gui/kernel/qplatformsystemtrayicon.cpp
@@ -1,8 +1,8 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
+** Copyright (C) 2015 The Qt Company Ltd.
** Copyright (C) 2012 Klaralvdalens Datakonsult AB, a KDAB Group company, info@kdab.com, author Christoph Schleifenbaum <christoph.schleifenbaum@kdab.com>
-** Contact: http://www.qt-project.org/legal
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -11,9 +11,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
@@ -24,8 +24,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$
@@ -118,7 +118,7 @@ QPlatformSystemTrayIcon::~QPlatformSystemTrayIcon()
*/
/*!
- \fn void QPlatformSystemTrayIcon::showMessage(const QString &msg, const QString &title,
+ \fn void QPlatformSystemTrayIcon::showMessage(const QString &title, const QString &msg,
const QIcon &icon, MessageIcon iconType, int msecs)
Shows a balloon message for the entry with the given \a title, message \a msg and \a icon for
the time specified in \a msecs. \a iconType is used as a hint for the implementing platform.
diff --git a/src/gui/kernel/qplatformsystemtrayicon.h b/src/gui/kernel/qplatformsystemtrayicon.h
index 1317708cd1..437f5e02b1 100644
--- a/src/gui/kernel/qplatformsystemtrayicon.h
+++ b/src/gui/kernel/qplatformsystemtrayicon.h
@@ -1,8 +1,8 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
+** Copyright (C) 2015 The Qt Company Ltd.
** Copyright (C) 2012 Klaralvdalens Datakonsult AB, a KDAB Group company, info@kdab.com, author Christoph Schleifenbaum <christoph.schleifenbaum@kdab.com>
-** Contact: http://www.qt-project.org/legal
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -11,9 +11,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
@@ -24,8 +24,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$
@@ -69,7 +69,7 @@ public:
virtual void updateToolTip(const QString &tooltip) = 0;
virtual void updateMenu(QPlatformMenu *menu) = 0;
virtual QRect geometry() const = 0;
- virtual void showMessage(const QString &msg, const QString &title,
+ virtual void showMessage(const QString &title, const QString &msg,
const QIcon &icon, MessageIcon iconType, int msecs) = 0;
virtual bool isSystemTrayAvailable() const = 0;
diff --git a/src/gui/kernel/qplatformtheme.cpp b/src/gui/kernel/qplatformtheme.cpp
index 646bd90e56..36a71fe2da 100644
--- a/src/gui/kernel/qplatformtheme.cpp
+++ b/src/gui/kernel/qplatformtheme.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 QtGui 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,6 +45,7 @@
#include <qpa/qplatformintegration.h>
#include <qpa/qplatformdialoghelper.h>
+#include <algorithm>
QT_BEGIN_NAMESPACE
@@ -132,8 +133,9 @@ QT_BEGIN_NAMESPACE
\value SpellCheckUnderlineStyle (int) A QTextCharFormat::UnderlineStyle specifying
the underline style used misspelled words when spell checking.
- \value TabAllWidgets (bool) Whether tab navigation should go through all the widgets or components,
- or just through text boxes and list views. This is mostly a Mac feature.
+ \value TabFocusBehavior (int) A Qt::TabFocusBehavior specifying
+ the behavior of focus change when tab key was pressed.
+ This enum value was added in Qt 5.5.
\value DialogSnapToDefaultButton (bool) Whether the mouse should snap to the default button when a dialog
becomes visible.
@@ -313,14 +315,15 @@ const QKeyBinding QPlatformThemePrivate::keyBindings[] = {
{QKeySequence::InsertLineSeparator, 0, Qt::META | Qt::Key_O, KB_Mac},
{QKeySequence::SaveAs, 0, Qt::CTRL | Qt::SHIFT | Qt::Key_S, KB_Gnome | KB_Mac},
{QKeySequence::Preferences, 0, Qt::CTRL | Qt::Key_Comma, KB_Mac},
- {QKeySequence::Quit, 0, Qt::CTRL | Qt::Key_Q, KB_Gnome | KB_KDE | KB_Mac},
+ {QKeySequence::Quit, 0, Qt::CTRL | Qt::Key_Q, KB_X11 | KB_Gnome | KB_KDE | KB_Mac},
{QKeySequence::FullScreen, 1, Qt::META | Qt::CTRL | Qt::Key_F, KB_Mac},
{QKeySequence::FullScreen, 0, Qt::ALT | Qt::Key_Enter, KB_Win},
{QKeySequence::FullScreen, 0, Qt::CTRL | Qt::SHIFT | Qt::Key_F, KB_KDE},
{QKeySequence::FullScreen, 1, Qt::CTRL | Qt::Key_F11, KB_Gnome},
{QKeySequence::FullScreen, 1, Qt::Key_F11, KB_Win | KB_KDE},
{QKeySequence::Deselect, 0, Qt::CTRL | Qt::SHIFT | Qt::Key_A, KB_X11},
- {QKeySequence::DeleteCompleteLine, 0, Qt::CTRL | Qt::Key_U, KB_X11}
+ {QKeySequence::DeleteCompleteLine, 0, Qt::CTRL | Qt::Key_U, KB_X11},
+ {QKeySequence::Backspace, 0, Qt::META | Qt::Key_H, KB_Mac}
};
const uint QPlatformThemePrivate::numberOfKeyBindings = sizeof(QPlatformThemePrivate::keyBindings)/(sizeof(QKeyBinding));
@@ -431,6 +434,8 @@ QVariant QPlatformTheme::themeHint(ThemeHint hint) const
return QGuiApplicationPrivate::platformIntegration()->styleHint(QPlatformIntegration::PasswordMaskCharacter);
case QPlatformTheme::MousePressAndHoldInterval:
return QGuiApplicationPrivate::platformIntegration()->styleHint(QPlatformIntegration::MousePressAndHoldInterval);
+ case QPlatformTheme::ItemViewActivateItemOnSingleClick:
+ return QGuiApplicationPrivate::platformIntegration()->styleHint(QPlatformIntegration::ItemViewActivateItemOnSingleClick);
default:
return QPlatformTheme::defaultThemeHint(hint);
}
@@ -490,8 +495,8 @@ QVariant QPlatformTheme::defaultThemeHint(ThemeHint hint)
return QVariant(int(0));
case SpellCheckUnderlineStyle:
return QVariant(int(QTextCharFormat::SpellCheckUnderline));
- case TabAllWidgets:
- return QVariant(true);
+ case TabFocusBehavior:
+ return QVariant(int(Qt::TabFocusAllControls));
case IconPixmapSizes:
return QVariant::fromValue(QList<int>());
case DialogSnapToDefaultButton:
@@ -502,9 +507,11 @@ QVariant QPlatformTheme::defaultThemeHint(ThemeHint hint)
case MouseDoubleClickDistance:
{
bool ok = false;
- int dist = qgetenv("QT_DBL_CLICK_DIST").toInt(&ok);
+ const int dist = qEnvironmentVariableIntValue("QT_DBL_CLICK_DIST", &ok);
return QVariant(ok ? dist : 5);
}
+ case WheelScrollLines:
+ return QVariant(3);
}
return QVariant();
}
@@ -565,6 +572,23 @@ static inline int maybeSwapShortcut(int shortcut)
}
#endif
+// mixed-mode predicate: all of these overloads are actually needed (but not all for every compiler)
+struct ByStandardKey {
+ typedef bool result_type;
+
+ bool operator()(QKeySequence::StandardKey lhs, QKeySequence::StandardKey rhs) const
+ { return lhs < rhs; }
+
+ bool operator()(const QKeyBinding& lhs, const QKeyBinding& rhs) const
+ { return operator()(lhs.standardKey, rhs.standardKey); }
+
+ bool operator()(QKeySequence::StandardKey lhs, const QKeyBinding& rhs) const
+ { return operator()(lhs, rhs.standardKey); }
+
+ bool operator()(const QKeyBinding& lhs, QKeySequence::StandardKey rhs) const
+ { return operator()(lhs.standardKey, rhs); }
+};
+
/*!
Returns the key sequence that should be used for a standard action.
@@ -575,62 +599,27 @@ QList<QKeySequence> QPlatformTheme::keyBindings(QKeySequence::StandardKey key) c
const uint platform = QPlatformThemePrivate::currentKeyPlatforms();
QList <QKeySequence> list;
- uint N = QPlatformThemePrivate::numberOfKeyBindings;
- int first = 0;
- int last = N - 1;
+ std::pair<const QKeyBinding *, const QKeyBinding *> range =
+ std::equal_range(QPlatformThemePrivate::keyBindings,
+ QPlatformThemePrivate::keyBindings + QPlatformThemePrivate::numberOfKeyBindings,
+ key, ByStandardKey());
- while (first <= last) {
- int mid = (first + last) / 2;
- const QKeyBinding &midVal = QPlatformThemePrivate::keyBindings[mid];
+ for (const QKeyBinding *it = range.first; it < range.second; ++it) {
+ if (!(it->platform & platform))
+ continue;
- if (key > midVal.standardKey){
- first = mid + 1; // Search in top half
- }
- else if (key < midVal.standardKey){
- last = mid - 1; // Search in bottom half
- }
- else {
- //We may have several equal values for different platforms, so we must search in both directions
- //search forward including current location
- for (unsigned int i = mid; i < N ; ++i) {
- QKeyBinding current = QPlatformThemePrivate::keyBindings[i];
- if (current.standardKey != key)
- break;
- else if (current.platform & platform && current.standardKey == key) {
- uint shortcut =
+ uint shortcut =
#if defined(Q_OS_MACX)
- maybeSwapShortcut(current.shortcut);
+ maybeSwapShortcut(it->shortcut);
#else
- current.shortcut;
+ it->shortcut;
#endif
- if (current.priority > 0)
- list.prepend(QKeySequence(shortcut));
- else
- list.append(QKeySequence(shortcut));
- }
- }
-
- //search back
- for (int i = mid - 1 ; i >= 0 ; --i) {
- QKeyBinding current = QPlatformThemePrivate::keyBindings[i];
- if (current.standardKey != key)
- break;
- else if (current.platform & platform && current.standardKey == key) {
- uint shortcut =
-#if defined(Q_OS_MACX)
- maybeSwapShortcut(current.shortcut);
-#else
- current.shortcut;
-#endif
- if (current.priority > 0)
- list.prepend(QKeySequence(shortcut));
- else
- list.append(QKeySequence(shortcut));
- }
- }
- break;
- }
+ if (it->priority > 0)
+ list.prepend(QKeySequence(shortcut));
+ else
+ list.append(QKeySequence(shortcut));
}
+
return list;
}
diff --git a/src/gui/kernel/qplatformtheme.h b/src/gui/kernel/qplatformtheme.h
index a41dd8f257..69cc2f90af 100644
--- a/src/gui/kernel/qplatformtheme.h
+++ b/src/gui/kernel/qplatformtheme.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 QtGui 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$
@@ -95,13 +95,19 @@ public:
KeyboardScheme,
UiEffects,
SpellCheckUnderlineStyle,
+#if QT_VERSION >= QT_VERSION_CHECK(6,0,0)
+ TabFocusBehavior,
+#else
TabAllWidgets,
+ TabFocusBehavior = TabAllWidgets,
+#endif
IconPixmapSizes,
PasswordMaskCharacter,
DialogSnapToDefaultButton,
ContextMenuOnMouseRelease,
MousePressAndHoldInterval,
- MouseDoubleClickDistance
+ MouseDoubleClickDistance,
+ WheelScrollLines
};
enum DialogType {
diff --git a/src/gui/kernel/qplatformtheme_p.h b/src/gui/kernel/qplatformtheme_p.h
index e8b118d7b3..3ca17a63f7 100644
--- a/src/gui/kernel/qplatformtheme_p.h
+++ b/src/gui/kernel/qplatformtheme_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 QtGui 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/gui/kernel/qplatformthemefactory.cpp b/src/gui/kernel/qplatformthemefactory.cpp
index 4ac73394b5..d4902ac163 100644
--- a/src/gui/kernel/qplatformthemefactory.cpp
+++ b/src/gui/kernel/qplatformthemefactory.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 QtGui 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/gui/kernel/qplatformthemefactory_p.h b/src/gui/kernel/qplatformthemefactory_p.h
index fc07080307..1df4fd0d27 100644
--- a/src/gui/kernel/qplatformthemefactory_p.h
+++ b/src/gui/kernel/qplatformthemefactory_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 QtGui 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/gui/kernel/qplatformthemeplugin.cpp b/src/gui/kernel/qplatformthemeplugin.cpp
index 37406cebdc..4bc325b04f 100644
--- a/src/gui/kernel/qplatformthemeplugin.cpp
+++ b/src/gui/kernel/qplatformthemeplugin.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 QtGui 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/gui/kernel/qplatformthemeplugin.h b/src/gui/kernel/qplatformthemeplugin.h
index 2b444f5ff6..48e1d9b50e 100644
--- a/src/gui/kernel/qplatformthemeplugin.h
+++ b/src/gui/kernel/qplatformthemeplugin.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 QtGui 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/gui/kernel/qplatformwindow.cpp b/src/gui/kernel/qplatformwindow.cpp
index 754395592c..114fcf8062 100644
--- a/src/gui/kernel/qplatformwindow.cpp
+++ b/src/gui/kernel/qplatformwindow.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 QtGui 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,11 +79,13 @@ QPlatformWindow *QPlatformWindow::parent() const
}
/*!
- Returns the platform screen handle corresponding to this platform window.
+ Returns the platform screen handle corresponding to this platform window,
+ or null if the window is not associated with a screen.
*/
QPlatformScreen *QPlatformWindow::screen() const
{
- return window()->screen()->handle();
+ QScreen *scr = window()->screen();
+ return scr ? scr->handle() : Q_NULLPTR;
}
/*!
@@ -453,7 +455,7 @@ bool QPlatformWindow::frameStrutEventsEnabled() const
QString QPlatformWindow::formatWindowTitle(const QString &title, const QString &separator)
{
QString fullTitle = title;
- if (QGuiApplicationPrivate::displayName) {
+ if (QGuiApplicationPrivate::displayName && !title.endsWith(*QGuiApplicationPrivate::displayName)) {
// Append display name, if set.
if (!fullTitle.isEmpty())
fullTitle += separator;
@@ -479,7 +481,7 @@ QString QPlatformWindow::formatWindowTitle(const QString &title, const QString &
QPlatformScreen *QPlatformWindow::screenForGeometry(const QRect &newGeometry) const
{
QPlatformScreen *currentScreen = screen();
- if (!parent() && !currentScreen->geometry().intersects(newGeometry)) {
+ if (!parent() && currentScreen && !currentScreen->geometry().intersects(newGeometry)) {
Q_FOREACH (QPlatformScreen* screen, currentScreen->virtualSiblings()) {
if (screen->geometry().intersects(newGeometry))
return screen;
@@ -595,6 +597,36 @@ QRect QPlatformWindow::initialGeometry(const QWindow *w,
}
/*!
+ Requests an QEvent::UpdateRequest event. The event will be
+ delivered to the QWindow.
+
+ QPlatformWindow subclasses can re-implement this function to
+ provide display refresh synchronized updates. The event
+ should be delivered using QWindowPrivate::deliverUpdateRequest()
+ to not get out of sync with the the internal state of QWindow.
+
+ The default implementation posts an UpdateRequest event to the
+ window after 5 ms. The additional time is there to give the event
+ loop a bit of idle time to gather system events.
+
+*/
+void QPlatformWindow::requestUpdate()
+{
+ static int timeout = -1;
+ if (timeout == -1) {
+ bool ok = false;
+ timeout = qEnvironmentVariableIntValue("QT_QPA_UPDATE_IDLE_TIME", &ok);
+ if (!ok)
+ timeout = 5;
+ }
+
+ QWindow *w = window();
+ QWindowPrivate *wp = (QWindowPrivate *) QObjectPrivate::get(w);
+ Q_ASSERT(wp->updateTimer == 0);
+ wp->updateTimer = w->startTimer(timeout, Qt::PreciseTimer);
+}
+
+/*!
\class QPlatformWindow
\since 4.8
\internal
diff --git a/src/gui/kernel/qplatformwindow.h b/src/gui/kernel/qplatformwindow.h
index 5c351a69d2..c7c1efdc58 100644
--- a/src/gui/kernel/qplatformwindow.h
+++ b/src/gui/kernel/qplatformwindow.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 QtGui 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$
@@ -72,7 +72,7 @@ public:
QPlatformScreen *screen() const;
- virtual QSurfaceFormat format() const;
+ virtual QSurfaceFormat format() const Q_DECL_OVERRIDE;
virtual void setGeometry(const QRect &rect);
virtual QRect geometry() const;
@@ -129,6 +129,7 @@ public:
static QRect initialGeometry(const QWindow *w,
const QRect &initialGeometry, int defaultWidth, int defaultHeight);
+ virtual void requestUpdate();
protected:
static QString formatWindowTitle(const QString &title, const QString &separator);
QPlatformScreen *screenForGeometry(const QRect &newGeometry) const;
diff --git a/src/gui/kernel/qplatformwindow_p.h b/src/gui/kernel/qplatformwindow_p.h
index 32c09c24ca..2205085cf4 100644
--- a/src/gui/kernel/qplatformwindow_p.h
+++ b/src/gui/kernel/qplatformwindow_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 QtGui 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/gui/kernel/qrasterwindow.cpp b/src/gui/kernel/qrasterwindow.cpp
index f89f38a32d..c04eb71420 100644
--- a/src/gui/kernel/qrasterwindow.cpp
+++ b/src/gui/kernel/qrasterwindow.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 QtGui 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/gui/kernel/qrasterwindow.h b/src/gui/kernel/qrasterwindow.h
index aa86d991a9..4912efad37 100644
--- a/src/gui/kernel/qrasterwindow.h
+++ b/src/gui/kernel/qrasterwindow.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 QtGui 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/gui/kernel/qscreen.cpp b/src/gui/kernel/qscreen.cpp
index ed6e8ddccc..038be09dc7 100644
--- a/src/gui/kernel/qscreen.cpp
+++ b/src/gui/kernel/qscreen.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 QtGui 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$
@@ -72,8 +72,35 @@ QScreen::QScreen(QPlatformScreen *screen)
*/
QScreen::~QScreen()
{
- if (qApp)
- Q_EMIT qApp->screenRemoved(this);
+ if (!qApp)
+ return;
+
+ // Allow clients to manage windows that are affected by the screen going
+ // away, before we fall back to moving them to the primary screen.
+ emit qApp->screenRemoved(this);
+
+ if (QGuiApplication::closingDown())
+ return;
+
+ QScreen *primaryScreen = QGuiApplication::primaryScreen();
+ if (this == primaryScreen)
+ return;
+
+ bool movingFromVirtualSibling = primaryScreen && primaryScreen->handle()->virtualSiblings().contains(handle());
+
+ // Move any leftover windows to the primary screen
+ foreach (QWindow *window, QGuiApplication::topLevelWindows()) {
+ if (window->screen() != this)
+ continue;
+
+ const bool wasVisible = window->isVisible();
+ window->setScreen(primaryScreen);
+
+ // Re-show window if moved from a virtual sibling screen. Otherwise
+ // leave it up to the application developer to show the window.
+ if (movingFromVirtualSibling)
+ window->setVisible(wasVisible);
+ }
}
/*!
@@ -217,9 +244,14 @@ qreal QScreen::logicalDotsPerInch() const
}
/*!
+ \property QScreen::devicePixelRatio
+ \brief the screen's ratio between physical pixels and device-independent pixels
+ \since 5.5
+
Returns the ratio between physical pixels and device-independent pixels for the screen.
- Common values are 1.0 on normal displays and 2.0 on Apple "retina" displays.
+ Common values are 1.0 on normal displays and 2.0 on "retina" displays.
+ Higher values are also possible.
\sa QWindow::devicePixelRatio(), QGuiApplication::devicePixelRatio()
*/
@@ -467,20 +499,6 @@ Qt::ScreenOrientation QScreen::nativeOrientation() const
return d->platformScreen->nativeOrientation();
}
-// i must be power of two
-static int log2(uint i)
-{
- if (i == 0)
- return -1;
-
- int result = 0;
- while (!(i & 1)) {
- ++result;
- i >>= 1;
- }
- return result;
-}
-
/*!
Convenience function to compute the angle of rotation to get from
rotation \a a to rotation \a b.
@@ -497,19 +515,7 @@ int QScreen::angleBetween(Qt::ScreenOrientation a, Qt::ScreenOrientation b) cons
if (b == Qt::PrimaryOrientation)
b = primaryOrientation();
- if (a == b)
- return 0;
-
- int ia = log2(uint(a));
- int ib = log2(uint(b));
-
- int delta = ia - ib;
-
- if (delta < 0)
- delta = delta + 4;
-
- int angles[] = { 0, 90, 180, 270 };
- return angles[delta];
+ return QPlatformScreen::angleBetween(a, b);
}
/*!
@@ -532,28 +538,7 @@ QTransform QScreen::transformBetween(Qt::ScreenOrientation a, Qt::ScreenOrientat
if (b == Qt::PrimaryOrientation)
b = primaryOrientation();
- if (a == b)
- return QTransform();
-
- int angle = angleBetween(a, b);
-
- QTransform result;
- switch (angle) {
- case 90:
- result.translate(target.width(), 0);
- break;
- case 180:
- result.translate(target.width(), target.height());
- break;
- case 270:
- result.translate(0, target.height());
- break;
- default:
- Q_ASSERT(false);
- }
- result.rotate(angle);
-
- return result;
+ return QPlatformScreen::transformBetween(a, b, target);
}
/*!
@@ -573,16 +558,7 @@ QRect QScreen::mapBetween(Qt::ScreenOrientation a, Qt::ScreenOrientation b, cons
if (b == Qt::PrimaryOrientation)
b = primaryOrientation();
- if (a == b)
- return rect;
-
- if ((a == Qt::PortraitOrientation || a == Qt::InvertedPortraitOrientation)
- != (b == Qt::PortraitOrientation || b == Qt::InvertedPortraitOrientation))
- {
- return QRect(rect.y(), rect.x(), rect.height(), rect.width());
- }
-
- return rect;
+ return QPlatformScreen::mapBetween(a, b, rect);
}
/*!
diff --git a/src/gui/kernel/qscreen.h b/src/gui/kernel/qscreen.h
index 766b3d8f6b..255e735baf 100644
--- a/src/gui/kernel/qscreen.h
+++ b/src/gui/kernel/qscreen.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 QtGui 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$
@@ -75,6 +75,7 @@ class Q_GUI_EXPORT QScreen : public QObject
Q_PROPERTY(qreal logicalDotsPerInchX READ logicalDotsPerInchX NOTIFY logicalDotsPerInchChanged)
Q_PROPERTY(qreal logicalDotsPerInchY READ logicalDotsPerInchY NOTIFY logicalDotsPerInchChanged)
Q_PROPERTY(qreal logicalDotsPerInch READ logicalDotsPerInch NOTIFY logicalDotsPerInchChanged)
+ Q_PROPERTY(qreal devicePixelRatio READ devicePixelRatio NOTIFY physicalDotsPerInchChanged)
Q_PROPERTY(Qt::ScreenOrientation primaryOrientation READ primaryOrientation NOTIFY primaryOrientationChanged)
Q_PROPERTY(Qt::ScreenOrientation orientation READ orientation NOTIFY orientationChanged)
Q_PROPERTY(Qt::ScreenOrientation nativeOrientation READ nativeOrientation)
diff --git a/src/gui/kernel/qscreen_p.h b/src/gui/kernel/qscreen_p.h
index 53d4f3404a..d341b71932 100644
--- a/src/gui/kernel/qscreen_p.h
+++ b/src/gui/kernel/qscreen_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 QtGui 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/gui/kernel/qsessionmanager.cpp b/src/gui/kernel/qsessionmanager.cpp
index b67ba4a5a6..b54b7b468c 100644
--- a/src/gui/kernel/qsessionmanager.cpp
+++ b/src/gui/kernel/qsessionmanager.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 QtGui 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/gui/kernel/qsessionmanager.h b/src/gui/kernel/qsessionmanager.h
index 5df7d80948..36aa391252 100644
--- a/src/gui/kernel/qsessionmanager.h
+++ b/src/gui/kernel/qsessionmanager.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 QtGui 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/gui/kernel/qsessionmanager_p.h b/src/gui/kernel/qsessionmanager_p.h
index 9038325dba..894996242b 100644
--- a/src/gui/kernel/qsessionmanager_p.h
+++ b/src/gui/kernel/qsessionmanager_p.h
@@ -1,8 +1,8 @@
/****************************************************************************
**
** Copyright (C) 2013 Samuel Gaist <samuel.gaist@edeltech.ch>
-** 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 QtGui module of the Qt Toolkit.
**
@@ -11,9 +11,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
@@ -24,8 +24,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/gui/kernel/qshapedpixmapdndwindow.cpp b/src/gui/kernel/qshapedpixmapdndwindow.cpp
index c8e9c2544d..253a09e407 100644
--- a/src/gui/kernel/qshapedpixmapdndwindow.cpp
+++ b/src/gui/kernel/qshapedpixmapdndwindow.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 plugins 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/gui/kernel/qshapedpixmapdndwindow_p.h b/src/gui/kernel/qshapedpixmapdndwindow_p.h
index 04198c83cb..ec56573195 100644
--- a/src/gui/kernel/qshapedpixmapdndwindow_p.h
+++ b/src/gui/kernel/qshapedpixmapdndwindow_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 plugins 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$
@@ -66,7 +66,7 @@ public:
void updateGeometry();
protected:
- void exposeEvent(QExposeEvent *);
+ void exposeEvent(QExposeEvent *) Q_DECL_OVERRIDE;
private:
QBackingStore *m_backingStore;
diff --git a/src/gui/kernel/qshortcutmap.cpp b/src/gui/kernel/qshortcutmap.cpp
index cad707ab70..0ff5c36119 100644
--- a/src/gui/kernel/qshortcutmap.cpp
+++ b/src/gui/kernel/qshortcutmap.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 QtGui 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$
@@ -88,14 +88,16 @@ struct QShortcutEntry
/*! \internal
QDebug operator<< for easy debug output of the shortcut entries.
*/
-static QDebug &operator<<(QDebug &dbg, const QShortcutEntry *se) {
+static QDebug &operator<<(QDebug &dbg, const QShortcutEntry *se)
+{
+ QDebugStateSaver saver(dbg);
if (!se)
return dbg << "QShortcutEntry(0x0)";
dbg.nospace()
<< "QShortcutEntry(" << se->keyseq
<< "), id(" << se->id << "), enabled(" << se->enabled << "), autorepeat(" << se->autorepeat
<< "), owner(" << se->owner << ')';
- return dbg.space();
+ return dbg;
}
#endif // QT_NO_DEBUGSTREAM
@@ -310,6 +312,10 @@ QKeySequence::SequenceMatch QShortcutMap::state()
Uses ShortcutOverride event to see if any widgets want to override
the event. If not, uses nextState(QKeyEvent) to check for a grabbed
Shortcut, and dispatchEvent() is found and identical.
+
+ \note that this function should only be called from QWindowSystemInterface,
+ otherwise it will result in duplicate events.
+
\sa nextState, dispatchEvent
*/
bool QShortcutMap::tryShortcutEvent(QObject *o, QKeyEvent *e)
diff --git a/src/gui/kernel/qshortcutmap_p.h b/src/gui/kernel/qshortcutmap_p.h
index b2e0945d4b..242c021ca4 100644
--- a/src/gui/kernel/qshortcutmap_p.h
+++ b/src/gui/kernel/qshortcutmap_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 QtGui 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/gui/kernel/qsimpledrag.cpp b/src/gui/kernel/qsimpledrag.cpp
index a2412008f8..090e88c118 100644
--- a/src/gui/kernel/qsimpledrag.cpp
+++ b/src/gui/kernel/qsimpledrag.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 QtGui 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$
@@ -255,18 +255,18 @@ void QBasicDrag::updateCursor(Qt::DropAction action)
}
}
- QCursor *cursor = qApp->overrideCursor();
+ QCursor *cursor = QGuiApplication::overrideCursor();
QPixmap pixmap = m_drag->dragCursor(action);
if (!cursor) {
- qApp->changeOverrideCursor((pixmap.isNull()) ? QCursor(cursorShape) : QCursor(pixmap));
+ QGuiApplication::changeOverrideCursor((pixmap.isNull()) ? QCursor(cursorShape) : QCursor(pixmap));
} else {
if (!pixmap.isNull()) {
if ((cursor->pixmap().cacheKey() != pixmap.cacheKey())) {
- qApp->changeOverrideCursor(QCursor(pixmap));
+ QGuiApplication::changeOverrideCursor(QCursor(pixmap));
}
} else {
if (cursorShape != cursor->shape()) {
- qApp->changeOverrideCursor(QCursor(cursorShape));
+ QGuiApplication::changeOverrideCursor(QCursor(cursorShape));
}
}
}
diff --git a/src/gui/kernel/qsimpledrag_p.h b/src/gui/kernel/qsimpledrag_p.h
index 8ef8f99616..7812f8b863 100644
--- a/src/gui/kernel/qsimpledrag_p.h
+++ b/src/gui/kernel/qsimpledrag_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 QtGui 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,9 +64,9 @@ class Q_GUI_EXPORT QBasicDrag : public QPlatformDrag, public QObject
public:
virtual ~QBasicDrag();
- virtual Qt::DropAction drag(QDrag *drag);
+ virtual Qt::DropAction drag(QDrag *drag) Q_DECL_OVERRIDE;
- virtual bool eventFilter(QObject *o, QEvent *e);
+ virtual bool eventFilter(QObject *o, QEvent *e) Q_DECL_OVERRIDE;
protected:
QBasicDrag();
@@ -106,13 +106,13 @@ class Q_GUI_EXPORT QSimpleDrag : public QBasicDrag
{
public:
QSimpleDrag();
- virtual QMimeData *platformDropData();
+ virtual QMimeData *platformDropData() Q_DECL_OVERRIDE;
protected:
- virtual void startDrag();
- virtual void cancel();
- virtual void move(const QMouseEvent *me);
- virtual void drop(const QMouseEvent *me);
+ virtual void startDrag() Q_DECL_OVERRIDE;
+ virtual void cancel() Q_DECL_OVERRIDE;
+ virtual void move(const QMouseEvent *me) Q_DECL_OVERRIDE;
+ virtual void drop(const QMouseEvent *me) Q_DECL_OVERRIDE;
private:
QWindow *m_current_window;
diff --git a/src/gui/kernel/qstylehints.cpp b/src/gui/kernel/qstylehints.cpp
index 125e59aa5f..7ff0f9f860 100644
--- a/src/gui/kernel/qstylehints.cpp
+++ b/src/gui/kernel/qstylehints.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 QtGui 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$
@@ -35,6 +35,7 @@
#include <qpa/qplatformintegration.h>
#include <qpa/qplatformtheme.h>
#include <private/qguiapplication_p.h>
+#include <qdebug.h>
QT_BEGIN_NAMESPACE
@@ -46,6 +47,10 @@ static inline QVariant hint(QPlatformIntegration::StyleHint h)
static inline QVariant themeableHint(QPlatformTheme::ThemeHint th,
QPlatformIntegration::StyleHint ih)
{
+ if (!QCoreApplication::instance()) {
+ qWarning() << "Must construct a QGuiApplication before accessing a platform theme hint.";
+ return QVariant();
+ }
if (const QPlatformTheme *theme = QGuiApplicationPrivate::platformTheme()) {
const QVariant themeHint = theme->themeHint(th);
if (themeHint.isValid())
@@ -104,11 +109,15 @@ QStyleHints::QStyleHints()
void QStyleHints::setMouseDoubleClickInterval(int mouseDoubleClickInterval)
{
Q_D(QStyleHints);
+ if (d->m_mouseDoubleClickInterval == mouseDoubleClickInterval)
+ return;
d->m_mouseDoubleClickInterval = mouseDoubleClickInterval;
+ emit mouseDoubleClickIntervalChanged(mouseDoubleClickInterval);
}
/*!
- Returns the time limit in milliseconds that distinguishes a double click
+ \property QStyleHints::mouseDoubleClickInterval
+ \brief the time limit in milliseconds that distinguishes a double click
from two consecutive mouse clicks.
*/
int QStyleHints::mouseDoubleClickInterval() const
@@ -120,7 +129,8 @@ int QStyleHints::mouseDoubleClickInterval() const
}
/*!
- Returns the time limit in milliseconds that activates
+ \property QStyleHints::mousePressAndHoldInterval
+ \brief the time limit in milliseconds that activates
a press and hold.
\since 5.3
@@ -139,11 +149,15 @@ int QStyleHints::mousePressAndHoldInterval() const
void QStyleHints::setStartDragDistance(int startDragDistance)
{
Q_D(QStyleHints);
+ if (d->m_startDragDistance == startDragDistance)
+ return;
d->m_startDragDistance = startDragDistance;
+ emit startDragDistanceChanged(startDragDistance);
}
/*!
- Returns the distance, in pixels, that the mouse must be moved with a button
+ \property QStyleHints::startDragDistance
+ \brief the distance, in pixels, that the mouse must be moved with a button
held down before a drag and drop operation will begin.
If you support drag and drop in your application, and want to start a drag
@@ -157,7 +171,7 @@ void QStyleHints::setStartDragDistance(int startDragDistance)
\snippet code/src_gui_kernel_qapplication.cpp 6
- \sa startDragTime(), QPoint::manhattanLength(), {Drag and Drop}
+ \sa startDragTime, QPoint::manhattanLength(), {Drag and Drop}
*/
int QStyleHints::startDragDistance() const
{
@@ -176,18 +190,22 @@ int QStyleHints::startDragDistance() const
void QStyleHints::setStartDragTime(int startDragTime)
{
Q_D(QStyleHints);
+ if (d->m_startDragTime == startDragTime)
+ return;
d->m_startDragTime = startDragTime;
+ emit startDragTimeChanged(startDragTime);
}
/*!
- Returns the time, in milliseconds, that a mouse button must be held down
+ \property QStyleHints::startDragTime
+ \brief the time, in milliseconds, that a mouse button must be held down
before a drag and drop operation will begin.
If you support drag and drop in your application, and want to start a drag
and drop operation after the user has held down a mouse button for a
certain amount of time, you should use this property's value as the delay.
- \sa startDragDistance(), {Drag and Drop}
+ \sa startDragDistance, {Drag and Drop}
*/
int QStyleHints::startDragTime() const
{
@@ -198,11 +216,12 @@ int QStyleHints::startDragTime() const
}
/*!
- Returns the limit for the velocity, in pixels per second, that the mouse may
+ \property QStyleHints::startDragVelocity
+ \brief the limit for the velocity, in pixels per second, that the mouse may
be moved, with a button held down, for a drag and drop operation to begin.
A value of 0 means there is no such limit.
- \sa startDragDistance(), {Drag and Drop}
+ \sa startDragDistance, {Drag and Drop}
*/
int QStyleHints::startDragVelocity() const
{
@@ -218,11 +237,15 @@ int QStyleHints::startDragVelocity() const
void QStyleHints::setKeyboardInputInterval(int keyboardInputInterval)
{
Q_D(QStyleHints);
+ if (d->m_keyboardInputInterval == keyboardInputInterval)
+ return;
d->m_keyboardInputInterval = keyboardInputInterval;
+ emit keyboardInputIntervalChanged(keyboardInputInterval);
}
/*!
- Returns the time limit, in milliseconds, that distinguishes a key press
+ \property QStyleHints::keyboardInputInterval
+ \brief the time limit, in milliseconds, that distinguishes a key press
from two consecutive key presses.
*/
int QStyleHints::keyboardInputInterval() const
@@ -234,7 +257,8 @@ int QStyleHints::keyboardInputInterval() const
}
/*!
- Returns the rate, in events per second, in which additional repeated key
+ \property QStyleHints::keyboardAutoRepeatRate
+ \brief the rate, in events per second, in which additional repeated key
presses will automatically be generated if a key is being held down.
*/
int QStyleHints::keyboardAutoRepeatRate() const
@@ -251,11 +275,15 @@ int QStyleHints::keyboardAutoRepeatRate() const
void QStyleHints::setCursorFlashTime(int cursorFlashTime)
{
Q_D(QStyleHints);
+ if (d->m_cursorFlashTime == cursorFlashTime)
+ return;
d->m_cursorFlashTime = cursorFlashTime;
+ emit cursorFlashTimeChanged(cursorFlashTime);
}
/*!
- Returns the text cursor's flash (blink) time in milliseconds.
+ \property QStyleHints::cursorFlashTime
+ \brief the text cursor's flash (blink) time in milliseconds.
The flash time is the time used to display, invert and restore the
caret display. Usually the text cursor is displayed for half the cursor
@@ -270,11 +298,12 @@ int QStyleHints::cursorFlashTime() const
}
/*!
- Returns \c true if the platform defaults to windows being fullscreen,
+ \property QStyleHints::showIsFullScreen
+ \brief \c true if the platform defaults to windows being fullscreen,
otherwise \c false.
\note The platform may still choose to show certain windows non-fullscreen,
- such as popups or dialogs. This method only returns the default behavior.
+ such as popups or dialogs. This property only reports the default behavior.
\sa QWindow::show()
*/
@@ -284,7 +313,8 @@ bool QStyleHints::showIsFullScreen() const
}
/*!
- Returns the time, in milliseconds, a typed letter is displayed unshrouded
+ \property QStyleHints::passwordMaskDelay
+ \brief the time, in milliseconds, a typed letter is displayed unshrouded
in a text input field in password mode.
*/
int QStyleHints::passwordMaskDelay() const
@@ -293,7 +323,8 @@ int QStyleHints::passwordMaskDelay() const
}
/*!
- Returns the character used to mask the characters typed into text input
+ \property QStyleHints::passwordMaskCharacter
+ \brief the character used to mask the characters typed into text input
fields in password mode.
*/
QChar QStyleHints::passwordMaskCharacter() const
@@ -302,7 +333,8 @@ QChar QStyleHints::passwordMaskCharacter() const
}
/*!
- Returns the gamma value used in font smoothing.
+ \property QStyleHints::fontSmoothingGamma
+ \brief the gamma value used in font smoothing.
*/
qreal QStyleHints::fontSmoothingGamma() const
{
@@ -310,7 +342,8 @@ qreal QStyleHints::fontSmoothingGamma() const
}
/*!
- Returns \c true if right-to-left writing direction is enabled,
+ \property QStyleHints::useRtlExtensions
+ \brief \c true if right-to-left writing direction is enabled,
otherwise \c false.
*/
bool QStyleHints::useRtlExtensions() const
@@ -319,7 +352,8 @@ bool QStyleHints::useRtlExtensions() const
}
/*!
- Returns \c true if focus objects (line edits etc) should receive
+ \property QStyleHints::setFocusOnTouchRelease
+ \brief \c true if focus objects (line edits etc) should receive
input focus after a touch/mouse release. This is normal behavior on
touch platforms. On desktop platforms, the standard is to set
focus already on touch/mouse press.
@@ -329,4 +363,30 @@ bool QStyleHints::setFocusOnTouchRelease() const
return hint(QPlatformIntegration::SetFocusOnTouchRelease).toBool();
}
+/*!
+ \property QStyleHints::tabFocusBehavior
+ \since 5.5
+ \brief The focus behavior on press of the tab key.
+
+ \note Do not bind this value in QML because the change notifier
+ signal is not implemented yet.
+*/
+
+Qt::TabFocusBehavior QStyleHints::tabFocusBehavior() const
+{
+ return Qt::TabFocusBehavior(themeableHint(QPlatformTheme::TabFocusBehavior, QPlatformIntegration::TabFocusBehavior).toInt());
+}
+
+/*!
+ \property QStyleHints::singleClickActivation
+ \brief \c true if items should be activated by single click, \b false
+ if they should be activated by double click instead.
+
+ \since 5.5
+*/
+bool QStyleHints::singleClickActivation() const
+{
+ return themeableHint(QPlatformTheme::ItemViewActivateItemOnSingleClick, QPlatformIntegration::ItemViewActivateItemOnSingleClick).toBool();
+}
+
QT_END_NAMESPACE
diff --git a/src/gui/kernel/qstylehints.h b/src/gui/kernel/qstylehints.h
index 09807ecb24..82eb8a6f7d 100644
--- a/src/gui/kernel/qstylehints.h
+++ b/src/gui/kernel/qstylehints.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 QtGui 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,6 +46,23 @@ class Q_GUI_EXPORT QStyleHints : public QObject
{
Q_OBJECT
Q_DECLARE_PRIVATE(QStyleHints)
+ Q_PROPERTY(int cursorFlashTime READ cursorFlashTime NOTIFY cursorFlashTimeChanged FINAL)
+ Q_PROPERTY(qreal fontSmoothingGamma READ fontSmoothingGamma STORED false CONSTANT FINAL)
+ Q_PROPERTY(int keyboardAutoRepeatRate READ keyboardAutoRepeatRate STORED false CONSTANT FINAL)
+ Q_PROPERTY(int keyboardInputInterval READ keyboardInputInterval NOTIFY keyboardInputIntervalChanged FINAL)
+ Q_PROPERTY(int mouseDoubleClickInterval READ mouseDoubleClickInterval NOTIFY mouseDoubleClickIntervalChanged FINAL)
+ Q_PROPERTY(int mousePressAndHoldInterval READ mousePressAndHoldInterval STORED false CONSTANT FINAL)
+ Q_PROPERTY(QChar passwordMaskCharacter READ passwordMaskCharacter STORED false CONSTANT FINAL)
+ Q_PROPERTY(int passwordMaskDelay READ passwordMaskDelay STORED false CONSTANT FINAL)
+ Q_PROPERTY(bool setFocusOnTouchRelease READ setFocusOnTouchRelease STORED false CONSTANT FINAL)
+ Q_PROPERTY(bool showIsFullScreen READ showIsFullScreen STORED false CONSTANT FINAL)
+ Q_PROPERTY(int startDragDistance READ startDragDistance NOTIFY startDragDistanceChanged FINAL)
+ Q_PROPERTY(int startDragTime READ startDragTime NOTIFY startDragTimeChanged FINAL)
+ Q_PROPERTY(int startDragVelocity READ startDragVelocity STORED false CONSTANT FINAL)
+ Q_PROPERTY(bool useRtlExtensions READ useRtlExtensions STORED false CONSTANT FINAL)
+ Q_PROPERTY(Qt::TabFocusBehavior tabFocusBehavior READ tabFocusBehavior STORED false CONSTANT FINAL)
+ Q_PROPERTY(bool singleClickActivation READ singleClickActivation STORED false CONSTANT FINAL)
+
public:
void setMouseDoubleClickInterval(int mouseDoubleClickInterval);
int mouseDoubleClickInterval() const;
@@ -66,6 +83,15 @@ public:
qreal fontSmoothingGamma() const;
bool useRtlExtensions() const;
bool setFocusOnTouchRelease() const;
+ Qt::TabFocusBehavior tabFocusBehavior() const;
+ bool singleClickActivation() const;
+
+Q_SIGNALS:
+ void cursorFlashTimeChanged(int cursorFlashTime);
+ void keyboardInputIntervalChanged(int keyboardInputInterval);
+ void mouseDoubleClickIntervalChanged(int mouseDoubleClickInterval);
+ void startDragDistanceChanged(int startDragDistance);
+ void startDragTimeChanged(int startDragTime);
private:
friend class QGuiApplication;
diff --git a/src/gui/kernel/qsurface.cpp b/src/gui/kernel/qsurface.cpp
index b16191e65a..70cefd2cde 100644
--- a/src/gui/kernel/qsurface.cpp
+++ b/src/gui/kernel/qsurface.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 QtGui 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/gui/kernel/qsurface.h b/src/gui/kernel/qsurface.h
index 58b7ce018e..53ede202a2 100644
--- a/src/gui/kernel/qsurface.h
+++ b/src/gui/kernel/qsurface.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 QtGui 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,7 +36,7 @@
#include <QtCore/qnamespace.h>
#include <QtGui/qsurfaceformat.h>
-
+#include <QtCore/qmetatype.h>
#include <QtCore/qsize.h>
QT_BEGIN_NAMESPACE
@@ -82,4 +82,6 @@ protected:
QT_END_NAMESPACE
+Q_DECLARE_METATYPE(QSurface*)
+
#endif //QSURFACE_H
diff --git a/src/gui/kernel/qsurfaceformat.cpp b/src/gui/kernel/qsurfaceformat.cpp
index b7f8e375a4..d078336d73 100644
--- a/src/gui/kernel/qsurfaceformat.cpp
+++ b/src/gui/kernel/qsurfaceformat.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 QtGui 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$
@@ -128,6 +128,10 @@ public:
\value DeprecatedFunctions Used to request that deprecated functions be included
in the OpenGL context profile. If not specified, you should get a forward compatible context
without support functionality marked as deprecated. This requires OpenGL version 3.0 or higher.
+ \value ResetNotification Enables notifications about resets of the OpenGL context. The status is then
+ queryable via the context's \l{QOpenGLContext::isValid()}{isValid()} function. Note that not setting
+ this flag does not guarantee that context state loss never occurs. Additionally, some implementations
+ may choose to report context loss regardless of this flag.
*/
/*!
@@ -181,7 +185,7 @@ public:
in the set OpenGL version you can use the QSurfaceFormat format option
QSurfaceFormat::DeprecatedFunctions.
- \value NoProfile OpenGL version is lower than 3.2.
+ \value NoProfile OpenGL version is lower than 3.2. For 3.2 and newer this is same as CoreProfile.
\value CoreProfile Functionality deprecated in OpenGL version 3.0 is not available.
\value CompatibilityProfile Functionality from earlier OpenGL versions is available.
*/
@@ -743,6 +747,12 @@ Q_GLOBAL_STATIC(QSurfaceFormat, qt_default_surface_format)
and surfaces, even the ones created internally by Qt, will use the same
format.
+ \note When setting Qt::AA_ShareOpenGLContexts, it is strongly recommended to
+ place the call to this function before the construction of the
+ QGuiApplication or QApplication. Otherwise \a format will not be applied to
+ the global share context and therefore issues may arise with context sharing
+ afterwards.
+
\since 5.4
\sa defaultFormat()
*/
@@ -802,6 +812,7 @@ bool operator!=(const QSurfaceFormat& a, const QSurfaceFormat& b)
QDebug operator<<(QDebug dbg, const QSurfaceFormat &f)
{
const QSurfaceFormatPrivate * const d = f.d;
+ QDebugStateSaver saver(dbg);
dbg.nospace() << "QSurfaceFormat("
<< "version " << d->major << '.' << d->minor
@@ -818,7 +829,7 @@ QDebug operator<<(QDebug dbg, const QSurfaceFormat &f)
<< ", profile " << d->profile
<< ')';
- return dbg.space();
+ return dbg;
}
#endif
diff --git a/src/gui/kernel/qsurfaceformat.h b/src/gui/kernel/qsurfaceformat.h
index b33f4d1f6b..c68e585371 100644
--- a/src/gui/kernel/qsurfaceformat.h
+++ b/src/gui/kernel/qsurfaceformat.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 QtGui 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,7 +48,8 @@ public:
enum FormatOption {
StereoBuffers = 0x0001,
DebugContext = 0x0002,
- DeprecatedFunctions = 0x0004
+ DeprecatedFunctions = 0x0004,
+ ResetNotification = 0x0008
};
Q_DECLARE_FLAGS(FormatOptions, FormatOption)
diff --git a/src/gui/kernel/qt_gui_pch.h b/src/gui/kernel/qt_gui_pch.h
index 38ded60818..02a9649b9a 100644
--- a/src/gui/kernel/qt_gui_pch.h
+++ b/src/gui/kernel/qt_gui_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 QtGui 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/gui/kernel/qtouchdevice.cpp b/src/gui/kernel/qtouchdevice.cpp
index 8641af149e..8737825de0 100644
--- a/src/gui/kernel/qtouchdevice.cpp
+++ b/src/gui/kernel/qtouchdevice.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 QtGui 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$
@@ -96,6 +96,9 @@ QT_BEGIN_NAMESPACE
\value NormalizedPosition Indicates that the normalized position is available, meaning that normalizedPos()
returns a valid value.
+
+ \value MouseEmulation Indicates that the device synthesizes mouse events.
+ This enum value has been introduced in Qt 5.5.
*/
/*!
diff --git a/src/gui/kernel/qtouchdevice.h b/src/gui/kernel/qtouchdevice.h
index f6ab12d65b..f2157ce2d6 100644
--- a/src/gui/kernel/qtouchdevice.h
+++ b/src/gui/kernel/qtouchdevice.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 QtGui 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,7 +55,8 @@ public:
Pressure = 0x0004,
Velocity = 0x0008,
RawPositions = 0x0010,
- NormalizedPosition = 0x0020
+ NormalizedPosition = 0x0020,
+ MouseEmulation = 0x0040
};
Q_DECLARE_FLAGS(Capabilities, CapabilityFlag)
diff --git a/src/gui/kernel/qtouchdevice_p.h b/src/gui/kernel/qtouchdevice_p.h
index 18a2291147..9c0bcf3414 100644
--- a/src/gui/kernel/qtouchdevice_p.h
+++ b/src/gui/kernel/qtouchdevice_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 QtGui 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/gui/kernel/qwindow.cpp b/src/gui/kernel/qwindow.cpp
index 6561e0f502..c0f953bcef 100644
--- a/src/gui/kernel/qwindow.cpp
+++ b/src/gui/kernel/qwindow.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 QtGui 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$
@@ -338,26 +338,20 @@ inline bool QWindowPrivate::windowRecreationRequired(QScreen *newScreen) const
{
Q_Q(const QWindow);
const QScreen *oldScreen = q->screen();
- return oldScreen != newScreen && platformWindow
+ return oldScreen != newScreen && (platformWindow || !oldScreen)
&& !(oldScreen && oldScreen->virtualSiblings().contains(newScreen));
}
inline void QWindowPrivate::disconnectFromScreen()
{
- if (topLevelScreen) {
- Q_Q(QWindow);
- QObject::disconnect(topLevelScreen, &QObject::destroyed, q, &QWindow::screenDestroyed);
+ if (topLevelScreen)
topLevelScreen = 0;
- }
}
void QWindowPrivate::connectToScreen(QScreen *screen)
{
- Q_Q(QWindow);
disconnectFromScreen();
topLevelScreen = screen;
- if (topLevelScreen)
- QObject::connect(topLevelScreen, &QObject::destroyed, q, &QWindow::screenDestroyed);
}
void QWindowPrivate::emitScreenChangedRecursion(QScreen *newScreen)
@@ -379,10 +373,13 @@ void QWindowPrivate::setTopLevelScreen(QScreen *newScreen, bool recreate)
}
if (newScreen != topLevelScreen) {
const bool shouldRecreate = recreate && windowRecreationRequired(newScreen);
- if (shouldRecreate)
+ const bool shouldShow = visibilityOnDestroy && !topLevelScreen;
+ if (shouldRecreate && platformWindow)
q->destroy();
connectToScreen(newScreen);
- if (newScreen && shouldRecreate)
+ if (shouldShow)
+ q->setVisible(true);
+ else if (newScreen && shouldRecreate)
create(true);
emitScreenChangedRecursion(newScreen);
}
@@ -404,6 +401,11 @@ void QWindowPrivate::create(bool recursive)
window->d_func()->platformWindow->setParent(platformWindow);
}
}
+
+ if (platformWindow) {
+ QPlatformSurfaceEvent e(QPlatformSurfaceEvent::SurfaceCreated);
+ QGuiApplication::sendEvent(q, &e);
+ }
}
}
@@ -1604,12 +1606,19 @@ void QWindow::destroy()
QGuiApplicationPrivate::focus_window = parent();
if (QGuiApplicationPrivate::currentMouseWindow == this)
QGuiApplicationPrivate::currentMouseWindow = parent();
+ if (QGuiApplicationPrivate::currentMousePressWindow == this)
+ QGuiApplicationPrivate::currentMousePressWindow = parent();
if (QGuiApplicationPrivate::tabletPressTarget == this)
QGuiApplicationPrivate::tabletPressTarget = parent();
bool wasVisible = isVisible();
+ d->visibilityOnDestroy = wasVisible && d->platformWindow;
setVisible(false);
+
+ QPlatformSurfaceEvent e(QPlatformSurfaceEvent::SurfaceAboutToBeDestroyed);
+ QGuiApplication::sendEvent(this, &e);
+
delete d->platformWindow;
d->resizeEventPending = true;
d->receivedExpose = false;
@@ -1678,7 +1687,7 @@ bool QWindow::setMouseGrabEnabled(bool grab)
}
/*!
- Returns the screen on which the window is shown.
+ Returns the screen on which the window is shown, or null if there is none.
For child windows, this returns the screen of the corresponding top level window.
@@ -1687,7 +1696,7 @@ bool QWindow::setMouseGrabEnabled(bool grab)
QScreen *QWindow::screen() const
{
Q_D(const QWindow);
- return d->parentWindow ? d->parentWindow->screen() : d->topLevelScreen;
+ return d->parentWindow ? d->parentWindow->screen() : d->topLevelScreen.data();
}
/*!
@@ -1707,24 +1716,7 @@ void QWindow::setScreen(QScreen *newScreen)
Q_D(QWindow);
if (!newScreen)
newScreen = QGuiApplication::primaryScreen();
- d->setTopLevelScreen(newScreen, true /* recreate */);
-}
-
-void QWindow::screenDestroyed(QObject *object)
-{
- Q_D(QWindow);
- if (d->parentWindow || QGuiApplication::closingDown())
- return;
- if (object == static_cast<QObject *>(d->topLevelScreen)) {
- const bool wasVisible = isVisible();
- setScreen(0);
- // destroy() might have hidden our window, show it again.
- // This might not be the best behavior if the new screen isn't a virtual sibling
- // of the old one. This can be removed once platform plugins have the power to
- // update the QScreen of its QWindows itself.
- if (wasVisible && d->platformWindow)
- setVisible(true);
- }
+ d->setTopLevelScreen(newScreen, newScreen != 0);
}
/*!
@@ -2059,12 +2051,61 @@ bool QWindow::event(QEvent *ev)
break;
#endif
+ case QEvent::Timer: {
+ Q_D(QWindow);
+ if (static_cast<QTimerEvent *>(ev)->timerId() == d->updateTimer) {
+ killTimer(d->updateTimer);
+ d->updateTimer = 0;
+ d->deliverUpdateRequest();
+ } else {
+ QObject::event(ev);
+ }
+ break;
+ }
+
default:
return QObject::event(ev);
}
return true;
}
+void QWindowPrivate::deliverUpdateRequest()
+{
+ Q_Q(QWindow);
+ updateRequestPending = false;
+ QEvent request(QEvent::UpdateRequest);
+ QCoreApplication::sendEvent(q, &request);
+}
+
+/*!
+ Schedules a QEvent::UpdateRequest event to be delivered to this window.
+
+ The event is delivered in sync with the display vsync on platforms
+ where this is possible. When driving animations, this function should
+ be called once after drawing has completed.
+
+ Calling this function multiple times will result in a single event
+ being delivered to the window.
+
+ Subclasses of QWindow should reimplement event(), intercept the event and
+ call the application's rendering code, then call the base class
+ implementation.
+
+ \note The subclass' reimplementation of event() must invoke the base class
+ implementation, unless it is absolutely sure that the event does not need to
+ be handled by the base class. For example, the default implementation of
+ this function relies on QEvent::Timer events. Filtering them away would
+ therefore break the delivery of the update events.
+*/
+void QWindow::requestUpdate()
+{
+ Q_D(QWindow);
+ if (d->updateRequestPending || !d->platformWindow)
+ return;
+ d->updateRequestPending = true;
+ d->platformWindow->requestUpdate();
+}
+
/*!
Override this to handle key press events (\a ev).
@@ -2206,10 +2247,12 @@ bool QWindow::nativeEvent(const QByteArray &eventType, void *message, long *resu
QPoint QWindow::mapToGlobal(const QPoint &pos) const
{
Q_D(const QWindow);
- if (d->platformWindow && d->platformWindow->isEmbedded(0))
+ // QTBUG-43252, prefer platform implementation for foreign windows.
+ if (d->platformWindow
+ && (type() == Qt::ForeignWindow || d->platformWindow->isEmbedded(0))) {
return d->platformWindow->mapToGlobal(pos);
- else
- return pos + d_func()->globalPosition();
+ }
+ return pos + d_func()->globalPosition();
}
@@ -2224,10 +2267,12 @@ QPoint QWindow::mapToGlobal(const QPoint &pos) const
QPoint QWindow::mapFromGlobal(const QPoint &pos) const
{
Q_D(const QWindow);
- if (d->platformWindow && d->platformWindow->isEmbedded(0))
+ // QTBUG-43252, prefer platform implementation for foreign windows.
+ if (d->platformWindow
+ && (type() == Qt::ForeignWindow || d->platformWindow->isEmbedded(0))) {
return d->platformWindow->mapFromGlobal(pos);
- else
- return pos - d_func()->globalPosition();
+ }
+ return pos - d_func()->globalPosition();
}
@@ -2244,24 +2289,22 @@ void QWindowPrivate::maybeQuitOnLastWindowClosed()
Q_Q(QWindow);
// Attempt to close the application only if this has WA_QuitOnClose set and a non-visible parent
bool quitOnClose = QGuiApplication::quitOnLastWindowClosed() && !q->parent();
-
- if (quitOnClose) {
- QWindowList list = QGuiApplication::topLevelWindows();
- bool lastWindowClosed = true;
- for (int i = 0; i < list.size(); ++i) {
- QWindow *w = list.at(i);
- if (!w->isVisible() || w->transientParent())
- continue;
- lastWindowClosed = false;
- break;
- }
- if (lastWindowClosed) {
- QGuiApplicationPrivate::emitLastWindowClosed();
+ QWindowList list = QGuiApplication::topLevelWindows();
+ bool lastWindowClosed = true;
+ for (int i = 0; i < list.size(); ++i) {
+ QWindow *w = list.at(i);
+ if (!w->isVisible() || w->transientParent())
+ continue;
+ lastWindowClosed = false;
+ break;
+ }
+ if (lastWindowClosed) {
+ QGuiApplicationPrivate::emitLastWindowClosed();
+ if (quitOnClose) {
QCoreApplicationPrivate *applicationPrivate = static_cast<QCoreApplicationPrivate*>(QObjectPrivate::get(QCoreApplication::instance()));
applicationPrivate->maybeQuit();
}
}
-
}
QWindow *QWindowPrivate::topLevelWindow() const
diff --git a/src/gui/kernel/qwindow.h b/src/gui/kernel/qwindow.h
index 473d275b56..f9fe37718c 100644
--- a/src/gui/kernel/qwindow.h
+++ b/src/gui/kernel/qwindow.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 QtGui 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,8 +84,6 @@ class Q_GUI_EXPORT QWindow : public QObject, public QSurface
Q_OBJECT
Q_DECLARE_PRIVATE(QWindow)
- Q_ENUMS(Visibility)
-
// All properties which are declared here are inherited by QQuickWindow and therefore available in QML.
// So please think carefully about what it does to the QML namespace if you add any new ones,
// particularly the possible meanings these names might have in any specializations of Window.
@@ -122,13 +120,14 @@ public:
Maximized,
FullScreen
};
+ Q_ENUM(Visibility)
explicit QWindow(QScreen *screen = 0);
explicit QWindow(QWindow *parent);
virtual ~QWindow();
void setSurfaceType(SurfaceType surfaceType);
- SurfaceType surfaceType() const;
+ SurfaceType surfaceType() const Q_DECL_OVERRIDE;
bool isVisible() const;
@@ -149,7 +148,7 @@ public:
void setModality(Qt::WindowModality modality);
void setFormat(const QSurfaceFormat &format);
- QSurfaceFormat format() const;
+ QSurfaceFormat format() const Q_DECL_OVERRIDE;
QSurfaceFormat requestedFormat() const;
void setFlags(Qt::WindowFlags flags);
@@ -216,7 +215,7 @@ public:
inline int x() const { return geometry().x(); }
inline int y() const { return geometry().y(); }
- inline QSize size() const { return geometry().size(); }
+ QSize size() const Q_DECL_OVERRIDE { return geometry().size(); }
inline QPoint position() const { return geometry().topLeft(); }
void setPosition(const QPoint &pt);
@@ -286,6 +285,8 @@ public Q_SLOTS:
Q_REVISION(1) void alert(int msec);
+ Q_REVISION(3) void requestUpdate();
+
Q_SIGNALS:
void screenChanged(QScreen *screen);
void modalityChanged(Qt::WindowModality modality);
@@ -312,9 +313,6 @@ Q_SIGNALS:
Q_REVISION(1) void opacityChanged(qreal opacity);
-private Q_SLOTS:
- void screenDestroyed(QObject *screen);
-
protected:
virtual void exposeEvent(QExposeEvent *);
virtual void resizeEvent(QResizeEvent *);
@@ -326,7 +324,7 @@ protected:
virtual void hideEvent(QHideEvent *);
// TODO Qt 6 - add closeEvent virtual handler
- virtual bool event(QEvent *);
+ virtual bool event(QEvent *) Q_DECL_OVERRIDE;
virtual void keyPressEvent(QKeyEvent *);
virtual void keyReleaseEvent(QKeyEvent *);
virtual void mousePressEvent(QMouseEvent *);
@@ -346,7 +344,7 @@ protected:
private:
Q_PRIVATE_SLOT(d_func(), void _q_clearAlert())
- QPlatformSurface *surfaceHandle() const;
+ QPlatformSurface *surfaceHandle() const Q_DECL_OVERRIDE;
Q_DISABLE_COPY(QWindow)
diff --git a/src/gui/kernel/qwindow_p.h b/src/gui/kernel/qwindow_p.h
index bc5dfa4876..4fc63acf28 100644
--- a/src/gui/kernel/qwindow_p.h
+++ b/src/gui/kernel/qwindow_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 QtGui 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,6 +45,7 @@
// We mean it.
//
+#include <QtGui/qscreen.h>
#include <QtGui/qwindow.h>
#include <qpa/qplatformwindow.h>
@@ -73,6 +74,7 @@ public:
, parentWindow(0)
, platformWindow(0)
, visible(false)
+ , visibilityOnDestroy(false)
, exposed(false)
, windowState(Qt::WindowNoState)
, visibility(QWindow::Hidden)
@@ -86,6 +88,8 @@ public:
, maximumSize(QWINDOWSIZE_MAX, QWINDOWSIZE_MAX)
, modality(Qt::NonModal)
, blockedByModalWindow(false)
+ , updateRequestPending(false)
+ , updateTimer(0)
, transientParent(0)
, topLevelScreen(0)
#ifndef QT_NO_CURSOR
@@ -109,6 +113,8 @@ public:
void applyCursor();
#endif
+ void deliverUpdateRequest();
+
QPoint globalPosition() const {
Q_Q(const QWindow);
QPoint offset = q->position();
@@ -134,11 +140,16 @@ public:
virtual void clearFocusObject();
virtual QRectF closestAcceptableGeometry(const QRectF &rect) const;
+ bool isPopup() const { return (windowFlags & Qt::WindowType_Mask) == Qt::Popup; }
+
+ static QWindowPrivate *get(QWindow *window) { return window->d_func(); }
+
QWindow::SurfaceType surfaceType;
Qt::WindowFlags windowFlags;
QWindow *parentWindow;
QPlatformWindow *platformWindow;
bool visible;
+ bool visibilityOnDestroy;
bool exposed;
QSurfaceFormat requestedFormat;
QString windowTitle;
@@ -163,8 +174,11 @@ public:
Qt::WindowModality modality;
bool blockedByModalWindow;
+ bool updateRequestPending;
+ int updateTimer;
+
QPointer<QWindow> transientParent;
- QScreen *topLevelScreen;
+ QPointer<QScreen> topLevelScreen;
#ifndef QT_NO_CURSOR
QCursor cursor;
diff --git a/src/gui/kernel/qwindowdefs.h b/src/gui/kernel/qwindowdefs.h
index 28bb665988..f9df68edb9 100644
--- a/src/gui/kernel/qwindowdefs.h
+++ b/src/gui/kernel/qwindowdefs.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 QtGui 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/gui/kernel/qwindowdefs_win.h b/src/gui/kernel/qwindowdefs_win.h
index 21bcbf9463..6308977802 100644
--- a/src/gui/kernel/qwindowdefs_win.h
+++ b/src/gui/kernel/qwindowdefs_win.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 QtGui 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/gui/kernel/qwindowsysteminterface.cpp b/src/gui/kernel/qwindowsysteminterface.cpp
index 722a695481..b17978cb7d 100644
--- a/src/gui/kernel/qwindowsysteminterface.cpp
+++ b/src/gui/kernel/qwindowsysteminterface.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 QtGui 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$
@@ -201,6 +201,11 @@ bool QWindowSystemInterface::tryHandleShortcutEvent(QWindow *w, ulong timestamp,
#ifndef QT_NO_SHORTCUT
QGuiApplicationPrivate::modifier_buttons = mods;
+ if (!w)
+ w = QGuiApplication::focusWindow();
+ if (!w)
+ return false;
+
QObject *focus = w->focusObject();
if (!focus)
focus = w;
@@ -220,6 +225,28 @@ bool QWindowSystemInterface::tryHandleShortcutEvent(QWindow *w, ulong timestamp,
#endif
}
+// used by QTestLib to directly send shortcuts to objects
+bool QWindowSystemInterface::tryHandleShortcutEventToObject(QObject *o, ulong timestamp, int k, Qt::KeyboardModifiers mods,
+ const QString &text, bool autorep, ushort count)
+{
+#ifndef QT_NO_SHORTCUT
+ QGuiApplicationPrivate::modifier_buttons = mods;
+
+ QKeyEvent qevent(QEvent::ShortcutOverride, k, mods, text, autorep, count);
+ qevent.setTimestamp(timestamp);
+ return QGuiApplicationPrivate::instance()->shortcutMap.tryShortcutEvent(o, &qevent);
+#else
+ Q_UNUSED(w)
+ Q_UNUSED(timestamp)
+ Q_UNUSED(k)
+ Q_UNUSED(mods)
+ Q_UNUSED(text)
+ Q_UNUSED(autorep)
+ Q_UNUSED(count)
+ return false;
+#endif
+}
+
bool QWindowSystemInterface::tryHandleExtendedShortcutEvent(QWindow *w, int k, Qt::KeyboardModifiers mods,
quint32 nativeScanCode, quint32 nativeVirtualKey, quint32 nativeModifiers,
const QString &text, bool autorep, ushort count)
@@ -265,6 +292,14 @@ void QWindowSystemInterface::handleKeyEvent(QWindow *w, QEvent::Type t, int k, Q
void QWindowSystemInterface::handleKeyEvent(QWindow *tlw, ulong timestamp, QEvent::Type t, int k, Qt::KeyboardModifiers mods, const QString & text, bool autorep, ushort count)
{
+ // This is special handling needed for OS X which eventually will call sendEvent(), on other platforms
+ // this might not be safe, e.g., on Android. See: QGuiApplicationPrivate::processKeyEvent() for
+ // shortcut overriding on other platforms.
+#if defined(Q_OS_OSX)
+ if (t == QEvent::KeyPress && QWindowSystemInterface::tryHandleShortcutEvent(tlw, timestamp, k, mods, text))
+ return;
+#endif // Q_OS_OSX
+
QWindowSystemInterfacePrivate::KeyEvent * e =
new QWindowSystemInterfacePrivate::KeyEvent(tlw, timestamp, t, k, mods, text, autorep, count);
QWindowSystemInterfacePrivate::handleWindowSystemEvent(e);
@@ -286,8 +321,9 @@ void QWindowSystemInterface::handleExtendedKeyEvent(QWindow *tlw, ulong timestam
quint32 nativeScanCode, quint32 nativeVirtualKey,
quint32 nativeModifiers,
const QString& text, bool autorep,
- ushort count)
+ ushort count, bool tryShortcutOverride)
{
+ Q_UNUSED(tryShortcutOverride)
QWindowSystemInterfacePrivate::KeyEvent * e =
new QWindowSystemInterfacePrivate::KeyEvent(tlw, timestamp, type, key, modifiers,
nativeScanCode, nativeVirtualKey, nativeModifiers, text, autorep, count);
@@ -305,13 +341,13 @@ void QWindowSystemInterface::handleWheelEvent(QWindow *tlw, ulong timestamp, con
handleWheelEvent(tlw, timestamp, local, global, QPoint(), point, mods);
}
-void QWindowSystemInterface::handleWheelEvent(QWindow *w, const QPointF & local, const QPointF & global, QPoint pixelDelta, QPoint angleDelta, Qt::KeyboardModifiers mods, Qt::ScrollPhase phase)
+void QWindowSystemInterface::handleWheelEvent(QWindow *w, const QPointF & local, const QPointF & global, QPoint pixelDelta, QPoint angleDelta, Qt::KeyboardModifiers mods, Qt::ScrollPhase phase, Qt::MouseEventSource source)
{
unsigned long time = QWindowSystemInterfacePrivate::eventTime.elapsed();
- handleWheelEvent(w, time, local, global, pixelDelta, angleDelta, mods, phase);
+ handleWheelEvent(w, time, local, global, pixelDelta, angleDelta, mods, phase, source);
}
-void QWindowSystemInterface::handleWheelEvent(QWindow *tlw, ulong timestamp, const QPointF & local, const QPointF & global, QPoint pixelDelta, QPoint angleDelta, Qt::KeyboardModifiers mods, Qt::ScrollPhase phase)
+void QWindowSystemInterface::handleWheelEvent(QWindow *tlw, ulong timestamp, const QPointF & local, const QPointF & global, QPoint pixelDelta, QPoint angleDelta, Qt::KeyboardModifiers mods, Qt::ScrollPhase phase, Qt::MouseEventSource source)
{
// Qt 4 sends two separate wheel events for horizontal and vertical
// deltas. For Qt 5 we want to send the deltas in one event, but at the
@@ -329,14 +365,14 @@ void QWindowSystemInterface::handleWheelEvent(QWindow *tlw, ulong timestamp, con
// Simple case: vertical deltas only:
if (angleDelta.y() != 0 && angleDelta.x() == 0) {
- e = new QWindowSystemInterfacePrivate::WheelEvent(tlw, timestamp, local, global, pixelDelta, angleDelta, angleDelta.y(), Qt::Vertical, mods, phase);
+ e = new QWindowSystemInterfacePrivate::WheelEvent(tlw, timestamp, local, global, pixelDelta, angleDelta, angleDelta.y(), Qt::Vertical, mods, phase, source);
QWindowSystemInterfacePrivate::handleWindowSystemEvent(e);
return;
}
// Simple case: horizontal deltas only:
if (angleDelta.y() == 0 && angleDelta.x() != 0) {
- e = new QWindowSystemInterfacePrivate::WheelEvent(tlw, timestamp, local, global, pixelDelta, angleDelta, angleDelta.x(), Qt::Horizontal, mods, phase);
+ e = new QWindowSystemInterfacePrivate::WheelEvent(tlw, timestamp, local, global, pixelDelta, angleDelta, angleDelta.x(), Qt::Horizontal, mods, phase, source);
QWindowSystemInterfacePrivate::handleWindowSystemEvent(e);
return;
}
@@ -344,12 +380,12 @@ void QWindowSystemInterface::handleWheelEvent(QWindow *tlw, ulong timestamp, con
// Both horizontal and vertical deltas: Send two wheel events.
// The first event contains the Qt 5 pixel and angle delta as points,
// and in addition the Qt 4 compatibility vertical angle delta.
- e = new QWindowSystemInterfacePrivate::WheelEvent(tlw, timestamp, local, global, pixelDelta, angleDelta, angleDelta.y(), Qt::Vertical, mods, phase);
+ e = new QWindowSystemInterfacePrivate::WheelEvent(tlw, timestamp, local, global, pixelDelta, angleDelta, angleDelta.y(), Qt::Vertical, mods, phase, source);
QWindowSystemInterfacePrivate::handleWindowSystemEvent(e);
// The second event contains null pixel and angle points and the
// Qt 4 compatibility horizontal angle delta.
- e = new QWindowSystemInterfacePrivate::WheelEvent(tlw, timestamp, local, global, QPoint(), QPoint(), angleDelta.x(), Qt::Horizontal, mods, phase);
+ e = new QWindowSystemInterfacePrivate::WheelEvent(tlw, timestamp, local, global, QPoint(), QPoint(), angleDelta.x(), Qt::Horizontal, mods, phase, source);
QWindowSystemInterfacePrivate::handleWindowSystemEvent(e);
}
@@ -745,9 +781,12 @@ void QWindowSystemInterface::handleEnterWhatsThisEvent()
#endif
#ifndef QT_NO_DEBUG_STREAM
-Q_GUI_EXPORT QDebug operator<<(QDebug dbg, const QWindowSystemInterface::TouchPoint &p) {
- dbg.nospace() << "TouchPoint(" << p.id << " @" << p.normalPosition << " press " << p.pressure << " vel " << p.velocity << " state " << (int)p.state;
- return dbg.space();
+Q_GUI_EXPORT QDebug operator<<(QDebug dbg, const QWindowSystemInterface::TouchPoint &p)
+{
+ QDebugStateSaver saver(dbg);
+ dbg.nospace() << "TouchPoint(" << p.id << " @" << p.area << " normalized " << p.normalPosition
+ << " press " << p.pressure << " vel " << p.velocity << " state " << (int)p.state;
+ return dbg;
}
#endif
@@ -760,6 +799,11 @@ Q_GUI_EXPORT void qt_handleKeyEvent(QWindow *w, QEvent::Type t, int k, Qt::Keybo
QWindowSystemInterface::handleKeyEvent(w, t, k, mods, text, autorep, count);
}
+Q_GUI_EXPORT bool qt_sendShortcutOverrideEvent(QObject *o, ulong timestamp, int k, Qt::KeyboardModifiers mods, const QString &text = QString(), bool autorep = false, ushort count = 1)
+{
+ return QWindowSystemInterface::tryHandleShortcutEventToObject(o, timestamp, k, mods, text, autorep, count);
+}
+
static QWindowSystemInterface::TouchPoint touchPoint(const QTouchEvent::TouchPoint& pt)
{
QWindowSystemInterface::TouchPoint p;
diff --git a/src/gui/kernel/qwindowsysteminterface.h b/src/gui/kernel/qwindowsysteminterface.h
index 30c236b51f..c004fc6ef2 100644
--- a/src/gui/kernel/qwindowsysteminterface.h
+++ b/src/gui/kernel/qwindowsysteminterface.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 QtGui 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$
@@ -83,6 +83,9 @@ public:
static bool tryHandleShortcutEvent(QWindow *w, ulong timestamp, int k, Qt::KeyboardModifiers mods,
const QString & text = QString(), bool autorep = false, ushort count = 1);
+ static bool tryHandleShortcutEventToObject(QObject *o, ulong timestamp, int k, Qt::KeyboardModifiers mods,
+ const QString & text = QString(), bool autorep = false, ushort count = 1);
+
static bool tryHandleExtendedShortcutEvent(QWindow *w, int k, Qt::KeyboardModifiers mods,
quint32 nativeScanCode, quint32 nativeVirtualKey, quint32 nativeModifiers,
const QString & text = QString(), bool autorep = false, ushort count = 1);
@@ -102,9 +105,9 @@ public:
quint32 nativeScanCode, quint32 nativeVirtualKey,
quint32 nativeModifiers,
const QString& text = QString(), bool autorep = false,
- ushort count = 1);
- static void handleWheelEvent(QWindow *w, const QPointF & local, const QPointF & global, QPoint pixelDelta, QPoint angleDelta, Qt::KeyboardModifiers mods = Qt::NoModifier, Qt::ScrollPhase phase = Qt::ScrollUpdate);
- static void handleWheelEvent(QWindow *w, ulong timestamp, const QPointF & local, const QPointF & global, QPoint pixelDelta, QPoint angleDelta, Qt::KeyboardModifiers mods = Qt::NoModifier, Qt::ScrollPhase phase = Qt::ScrollUpdate);
+ ushort count = 1, bool tryShortcutOverride = true);
+ static void handleWheelEvent(QWindow *w, const QPointF & local, const QPointF & global, QPoint pixelDelta, QPoint angleDelta, Qt::KeyboardModifiers mods = Qt::NoModifier, Qt::ScrollPhase phase = Qt::ScrollUpdate, Qt::MouseEventSource source = Qt::MouseEventNotSynthesized);
+ static void handleWheelEvent(QWindow *w, ulong timestamp, const QPointF & local, const QPointF & global, QPoint pixelDelta, QPoint angleDelta, Qt::KeyboardModifiers mods = Qt::NoModifier, Qt::ScrollPhase phase = Qt::ScrollUpdate, Qt::MouseEventSource source = Qt::MouseEventNotSynthesized);
// Wheel event compatibility functions. Will be removed: do not use.
static void handleWheelEvent(QWindow *w, const QPointF & local, const QPointF & global, int d, Qt::Orientation o, Qt::KeyboardModifiers mods = Qt::NoModifier);
diff --git a/src/gui/kernel/qwindowsysteminterface_p.h b/src/gui/kernel/qwindowsysteminterface_p.h
index c3f41da835..2ec402a1e9 100644
--- a/src/gui/kernel/qwindowsysteminterface_p.h
+++ b/src/gui/kernel/qwindowsysteminterface_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 QtGui 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$
@@ -93,11 +93,20 @@ public:
class WindowSystemEvent {
public:
+ enum {
+ Synthetic = 0x1,
+ NullWindow = 0x2
+ };
+
explicit WindowSystemEvent(EventType t)
- : type(t), synthetic(false) { }
+ : type(t), flags(0) { }
virtual ~WindowSystemEvent() { }
+
+ bool synthetic() const { return flags & Synthetic; }
+ bool nullWindow() const { return flags & NullWindow; }
+
EventType type;
- bool synthetic;
+ int flags;
};
class CloseEvent : public WindowSystemEvent {
@@ -188,9 +197,12 @@ public:
class UserEvent : public WindowSystemEvent {
public:
UserEvent(QWindow * w, ulong time, EventType t)
- : WindowSystemEvent(t), window(w), nullWindow(w == 0), timestamp(time) { }
+ : WindowSystemEvent(t), window(w), timestamp(time)
+ {
+ if (!w)
+ flags |= NullWindow;
+ }
QPointer<QWindow> window;
- bool nullWindow;
unsigned long timestamp;
};
@@ -220,8 +232,8 @@ public:
class WheelEvent : public InputEvent {
public:
WheelEvent(QWindow *w, ulong time, const QPointF & local, const QPointF & global, QPoint pixelD, QPoint angleD, int qt4D, Qt::Orientation qt4O,
- Qt::KeyboardModifiers mods, Qt::ScrollPhase phase = Qt::ScrollUpdate)
- : InputEvent(w, time, Wheel, mods), pixelDelta(pixelD), angleDelta(angleD), qt4Delta(qt4D), qt4Orientation(qt4O), localPos(local), globalPos(global), phase(phase) { }
+ Qt::KeyboardModifiers mods, Qt::ScrollPhase phase = Qt::ScrollUpdate, Qt::MouseEventSource src = Qt::MouseEventNotSynthesized)
+ : InputEvent(w, time, Wheel, mods), pixelDelta(pixelD), angleDelta(angleD), qt4Delta(qt4D), qt4Orientation(qt4O), localPos(local), globalPos(global), phase(phase), source(src) { }
QPoint pixelDelta;
QPoint angleDelta;
int qt4Delta;
@@ -229,6 +241,7 @@ public:
QPointF localPos;
QPointF globalPos;
Qt::ScrollPhase phase;
+ Qt::MouseEventSource source;
};
class KeyEvent : public InputEvent {