summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorLiang Qi <liang.qi@qt.io>2017-03-14 10:49:20 +0100
committerLiang Qi <liang.qi@qt.io>2017-03-14 10:52:24 +0100
commit0c034a649f61019c16aba479fe79d20dde41f2f2 (patch)
tree54545862591044b65e618989805945bceb0b3ea5 /src
parent2162f01111d21d0ce66ceb8be290b0a13653e691 (diff)
parentdf40b1115db600e8de1c4774476fa30956a34fd9 (diff)
Merge remote-tracking branch 'origin/5.9' into dev
Conflicts: src/widgets/widgets/qpushbutton.cpp Change-Id: I615de00e6e64540c50f658d4d8ab3e002d701a81
Diffstat (limited to 'src')
-rw-r--r--src/concurrent/doc/snippets/code/src_concurrent_qtconcurrentfilter.cpp14
-rw-r--r--src/concurrent/doc/snippets/code/src_concurrent_qtconcurrentmap.cpp14
-rw-r--r--src/concurrent/doc/snippets/code/src_concurrent_qtconcurrentrun.cpp5
-rw-r--r--src/concurrent/qtconcurrentfilter.cpp18
-rw-r--r--src/concurrent/qtconcurrentmap.cpp18
-rw-r--r--src/concurrent/qtconcurrentrun.cpp20
-rw-r--r--src/corelib/doc/snippets/code/src_corelib_kernel_qabstractnativeeventfilter.h12
-rw-r--r--src/corelib/doc/snippets/code/src_corelib_kernel_qabstractnativeeventfilter.mm12
-rw-r--r--src/corelib/doc/src/objectmodel/signalsandslots.qdoc3
-rw-r--r--src/corelib/global/qglobal.cpp13
-rw-r--r--src/corelib/kernel/qmetatype.cpp106
-rw-r--r--src/corelib/kernel/qobject.cpp15
-rw-r--r--src/corelib/kernel/qtcore_eval.cpp2
-rw-r--r--src/corelib/tools/qbytearraymatcher.h4
-rw-r--r--src/corelib/tools/qregularexpression.cpp2
-rw-r--r--src/dbus/qdbusconnection_p.h3
-rw-r--r--src/gui/configure.json14
-rw-r--r--src/gui/image/qicon.cpp4
-rw-r--r--src/gui/image/qimage_darwin.mm34
-rw-r--r--src/gui/image/qppmhandler.cpp59
-rw-r--r--src/gui/opengl/qopengltexture.cpp2
-rw-r--r--src/gui/painting/qcoregraphics.mm34
-rw-r--r--src/gui/painting/qcoregraphics_p.h34
-rw-r--r--src/gui/painting/qdrawhelper.cpp27
-rw-r--r--src/gui/painting/qdrawhelper_avx2.cpp414
-rw-r--r--src/network/access/qhsts.cpp6
-rw-r--r--src/network/access/qhstspolicy.cpp14
-rw-r--r--src/network/access/qhstspolicy.h11
-rw-r--r--src/network/doc/snippets/code/src_network_socket_qsctpsocket.cpp12
-rw-r--r--src/plugins/generic/bsdkeyboard/main.cpp32
-rw-r--r--src/plugins/generic/bsdkeyboard/qbsdkeyboard.cpp32
-rw-r--r--src/plugins/generic/bsdkeyboard/qbsdkeyboard.h32
-rw-r--r--src/plugins/generic/bsdkeyboard/qbsdkeyboard_defaultmap.h36
-rw-r--r--src/plugins/generic/bsdmouse/main.cpp34
-rw-r--r--src/plugins/generic/bsdmouse/qbsdmouse.cpp34
-rw-r--r--src/plugins/generic/bsdmouse/qbsdmouse.h34
-rw-r--r--src/plugins/generic/generic.pro4
-rw-r--r--src/plugins/platforms/eglfs/api/qeglfscursor_p.h6
-rw-r--r--src/plugins/platforms/eglfs/deviceintegration/deviceintegration.pro2
-rw-r--r--src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/qeglfskmsgbmintegration.cpp7
-rw-r--r--src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_egldevice/qeglfskmsegldevice.cpp4
-rw-r--r--src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_egldevice/qeglfskmsegldeviceintegration.cpp6
-rw-r--r--src/plugins/platforms/platforms.pro2
-rw-r--r--src/plugins/platforms/vnc/qvnc.cpp8
-rw-r--r--src/plugins/platforms/vnc/qvnc_p.h3
-rw-r--r--src/plugins/platforms/vnc/qvncclient.cpp4
-rw-r--r--src/plugins/platforms/vnc/qvncscreen.cpp11
-rw-r--r--src/plugins/platforms/vnc/qvncscreen.h2
-rw-r--r--src/plugins/platforms/windows/qwindowswindow.cpp14
-rw-r--r--src/plugins/platforms/winrt/qwinrtdrag.cpp2
-rw-r--r--src/plugins/platforms/winrt/qwinrtscreen.cpp2
-rw-r--r--src/plugins/platforms/xcb/qxcbconnection_xi2.cpp24
-rw-r--r--src/plugins/platformthemes/gtk3/qgtk3menu.cpp36
-rw-r--r--src/plugins/platformthemes/gtk3/qgtk3menu.h34
-rw-r--r--src/printsupport/configure.json26
-rw-r--r--src/printsupport/dialogs/qprintpreviewdialog.cpp5
-rw-r--r--src/sql/configure.json6
-rw-r--r--src/testlib/qtestutil_macos.mm34
-rw-r--r--src/testlib/qtestutil_macos_p.h34
-rw-r--r--src/tools/moc/moc.cpp22
-rw-r--r--src/tools/moc/mwerks_mac.cpp227
-rw-r--r--src/tools/moc/mwerks_mac.h54
-rw-r--r--src/tools/moc/preprocessor.cpp16
-rw-r--r--src/tools/uic/cpp/cppwriteinitialization.cpp2
-rw-r--r--src/tools/uic/uic.pro2
-rw-r--r--src/widgets/accessible/qaccessiblewidget.cpp6
-rw-r--r--src/widgets/accessible/qaccessiblewidgetfactory.cpp3
-rw-r--r--src/widgets/accessible/qaccessiblewidgets.cpp6
-rw-r--r--src/widgets/accessible/qaccessiblewidgets_p.h2
-rw-r--r--src/widgets/accessible/simplewidgets.cpp42
-rw-r--r--src/widgets/configure.json139
-rw-r--r--src/widgets/dialogs/qcolordialog.cpp5
-rw-r--r--src/widgets/dialogs/qdialog.cpp9
-rw-r--r--src/widgets/dialogs/qdialog_p.h12
-rw-r--r--src/widgets/dialogs/qfiledialog.cpp6
-rw-r--r--src/widgets/dialogs/qmessagebox.cpp4
-rw-r--r--src/widgets/dialogs/qwizard.cpp2
-rw-r--r--src/widgets/graphicsview/qgraphicsview.cpp19
-rw-r--r--src/widgets/graphicsview/qgraphicsview.h2
-rw-r--r--src/widgets/itemviews/qabstractitemdelegate.cpp2
-rw-r--r--src/widgets/itemviews/qabstractitemview.cpp6
-rw-r--r--src/widgets/itemviews/qabstractitemview.h2
-rw-r--r--src/widgets/itemviews/qheaderview.cpp19
-rw-r--r--src/widgets/itemviews/qheaderview_p.h6
-rw-r--r--src/widgets/itemviews/qitemeditorfactory.cpp4
-rw-r--r--src/widgets/itemviews/qlistview.cpp46
-rw-r--r--src/widgets/itemviews/qlistview.h4
-rw-r--r--src/widgets/itemviews/qlistview_p.h2
-rw-r--r--src/widgets/itemviews/qlistwidget.h3
-rw-r--r--src/widgets/itemviews/qtablewidget.h3
-rw-r--r--src/widgets/itemviews/qtreewidget.h3
-rw-r--r--src/widgets/kernel/kernel.pri7
-rw-r--r--src/widgets/kernel/qformlayout.h2
-rw-r--r--src/widgets/kernel/qlayout.cpp6
-rw-r--r--src/widgets/kernel/qsizepolicy.h2
-rw-r--r--src/widgets/kernel/qtooltip.cpp5
-rw-r--r--src/widgets/kernel/qwhatsthis.cpp6
-rw-r--r--src/widgets/kernel/qwidget.cpp18
-rw-r--r--src/widgets/kernel/qwidgetwindow.cpp1
-rw-r--r--src/widgets/styles/qcommonstyle.cpp14
-rw-r--r--src/widgets/styles/qfusionstyle.cpp18
-rw-r--r--src/widgets/styles/qmacstyle_mac.mm479
-rw-r--r--src/widgets/styles/qmacstyle_mac_p.h2
-rw-r--r--src/widgets/styles/qmacstyle_mac_p_p.h12
-rw-r--r--src/widgets/styles/qpixmapstyle.cpp6
-rw-r--r--src/widgets/styles/qstylesheetstyle.cpp49
-rw-r--r--src/widgets/styles/qstylesheetstyle_p.h29
-rw-r--r--src/widgets/styles/qwindowsvistastyle.cpp10
-rw-r--r--src/widgets/styles/qwindowsvistastyle_p_p.h5
-rw-r--r--src/widgets/styles/qwindowsxpstyle.cpp2
-rw-r--r--src/widgets/util/qcompleter.cpp3
-rw-r--r--src/widgets/util/qscroller.h2
-rw-r--r--src/widgets/util/qscrollerproperties.h2
-rw-r--r--src/widgets/util/qsystemtrayicon.cpp19
-rw-r--r--src/widgets/util/qsystemtrayicon_x11.cpp3
-rw-r--r--src/widgets/util/util.pri22
-rw-r--r--src/widgets/widgets/qabstractslider.h2
-rw-r--r--src/widgets/widgets/qabstractslider_p.h2
-rw-r--r--src/widgets/widgets/qcalendarwidget.cpp4
-rw-r--r--src/widgets/widgets/qcheckbox.h2
-rw-r--r--src/widgets/widgets/qcombobox.cpp2
-rw-r--r--src/widgets/widgets/qcommandlinkbutton.h2
-rw-r--r--src/widgets/widgets/qdatetimeedit.cpp2
-rw-r--r--src/widgets/widgets/qdatetimeedit_p.h1
-rw-r--r--src/widgets/widgets/qdial.h9
-rw-r--r--src/widgets/widgets/qdialogbuttonbox.cpp4
-rw-r--r--src/widgets/widgets/qdialogbuttonbox.h2
-rw-r--r--src/widgets/widgets/qdockarealayout.cpp4
-rw-r--r--src/widgets/widgets/qgroupbox.cpp4
-rw-r--r--src/widgets/widgets/qlabel.h2
-rw-r--r--src/widgets/widgets/qlineedit.cpp11
-rw-r--r--src/widgets/widgets/qlineedit.h2
-rw-r--r--src/widgets/widgets/qlineedit_p.cpp37
-rw-r--r--src/widgets/widgets/qlineedit_p.h11
-rw-r--r--src/widgets/widgets/qpushbutton.cpp5
-rw-r--r--src/widgets/widgets/qpushbutton.h2
-rw-r--r--src/widgets/widgets/qpushbutton_p.h2
-rw-r--r--src/widgets/widgets/qradiobutton.h2
-rw-r--r--src/widgets/widgets/qscrollbar.h10
-rw-r--r--src/widgets/widgets/qslider.h9
-rw-r--r--src/widgets/widgets/qtabbar.cpp44
-rw-r--r--src/widgets/widgets/qtabbar_p.h4
-rw-r--r--src/widgets/widgets/qtabwidget.cpp1
-rw-r--r--src/widgets/widgets/widgets.pri77
-rw-r--r--src/xml/sax/qxml.h2
-rw-r--r--src/xml/sax/qxml_p.h6
146 files changed, 2023 insertions, 1084 deletions
diff --git a/src/concurrent/doc/snippets/code/src_concurrent_qtconcurrentfilter.cpp b/src/concurrent/doc/snippets/code/src_concurrent_qtconcurrentfilter.cpp
index d0deed4cc8..9b15eeaa99 100644
--- a/src/concurrent/doc/snippets/code/src_concurrent_qtconcurrentfilter.cpp
+++ b/src/concurrent/doc/snippets/code/src_concurrent_qtconcurrentfilter.cpp
@@ -145,19 +145,11 @@ bool QString::contains(const QRegularExpression &regexp) const;
//! [9]
-//! [10]
-std::bind(&QString::contains, QRegularExpression("^\\S+$")); // matches strings without whitespace
-//! [10]
-
-
-//! [11]
-bool contains(const QString &string)
-//! [11]
-
-
//! [12]
QStringList strings = ...;
-std::bind(static_cast<bool(QString::*)(const QRegularExpression&)>( &QString::contains ), QRegularExpression("..."));
+QFuture<QString> future = QtConcurrent::filtered(list, [](const QString &str) {
+ return str.contains(QRegularExpression("^\\S+$")); // matches strings without whitespace
+});
//! [12]
//! [13]
diff --git a/src/concurrent/doc/snippets/code/src_concurrent_qtconcurrentmap.cpp b/src/concurrent/doc/snippets/code/src_concurrent_qtconcurrentmap.cpp
index 91e76be0db..183b82bb9a 100644
--- a/src/concurrent/doc/snippets/code/src_concurrent_qtconcurrentmap.cpp
+++ b/src/concurrent/doc/snippets/code/src_concurrent_qtconcurrentmap.cpp
@@ -158,19 +158,11 @@ QImage QImage::scaledToWidth(int width, Qt::TransformationMode) const;
//! [10]
-//! [11]
-std::bind(&QImage::scaledToWidth, 100, Qt::SmoothTransformation)
-//! [11]
-
-
-//! [12]
-QImage scaledToWith(const QImage &image)
-//! [12]
-
-
//! [13]
QList<QImage> images = ...;
-QFuture<QImage> thumbnails = QtConcurrent::mapped(images, std::bind(&QImage::scaledToWidth, 100, Qt::SmoothTransformation));
+QFuture<QImage> thumbnails = QtConcurrent::mapped(images, [](const QImage &img) {
+ return img.scaledToWidth(100, Qt::SmoothTransformation);
+});
//! [13]
//! [14]
diff --git a/src/concurrent/doc/snippets/code/src_concurrent_qtconcurrentrun.cpp b/src/concurrent/doc/snippets/code/src_concurrent_qtconcurrentrun.cpp
index 78e4591b0a..5437822842 100644
--- a/src/concurrent/doc/snippets/code/src_concurrent_qtconcurrentrun.cpp
+++ b/src/concurrent/doc/snippets/code/src_concurrent_qtconcurrentrun.cpp
@@ -109,7 +109,8 @@ future.waitForFinished();
//! [6]
-void someFunction(int arg1, double arg2);
-QFuture<void> future = QtConcurrent::run(std::bind(someFunction, 1, 2.0));
+QFuture<void> future = QtConcurrent::run([=]() {
+ // Code in this block will run in another thread
+});
...
//! [6]
diff --git a/src/concurrent/qtconcurrentfilter.cpp b/src/concurrent/qtconcurrentfilter.cpp
index a660815daf..3e3ed7cf68 100644
--- a/src/concurrent/qtconcurrentfilter.cpp
+++ b/src/concurrent/qtconcurrentfilter.cpp
@@ -148,13 +148,11 @@
\snippet code/src_concurrent_qtconcurrentfilter.cpp 13
- \section2 Using Bound Function Arguments
+ \section2 Wrapping Functions that Take Multiple Arguments
If you want to use a filter function takes more than one argument, you can
- use std::bind() to transform it onto a function that takes one argument. If
- C++11 support is not available, \l{http://www.boost.org/libs/bind/bind.html}
- {boost::bind()} or \l{http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2005/n1836.pdf}
- {std::tr1::bind()} are suitable replacements.
+ use a lambda function or \c std::bind() to transform it onto a function that
+ takes one argument.
As an example, we use QString::contains():
@@ -166,16 +164,6 @@
use QString::contains() with QtConcurrent::filtered() we have to provide a
value for the \e regexp argument:
- \snippet code/src_concurrent_qtconcurrentfilter.cpp 10
-
- The return value from std::bind() is a function object (functor) with
- the following signature:
-
- \snippet code/src_concurrent_qtconcurrentfilter.cpp 11
-
- This matches what QtConcurrent::filtered() expects, and the complete
- example becomes:
-
\snippet code/src_concurrent_qtconcurrentfilter.cpp 12
*/
diff --git a/src/concurrent/qtconcurrentmap.cpp b/src/concurrent/qtconcurrentmap.cpp
index e6c347b511..884bf4b4f9 100644
--- a/src/concurrent/qtconcurrentmap.cpp
+++ b/src/concurrent/qtconcurrentmap.cpp
@@ -198,13 +198,11 @@
\snippet code/src_concurrent_qtconcurrentmap.cpp 14
- \section2 Using Bound Function Arguments
+ \section2 Wrapping Functions that Take Multiple Arguments
If you want to use a map function that takes more than one argument you can
- use std::bind() to transform it onto a function that takes one argument. If
- C++11 support is not available, \l{http://www.boost.org/libs/bind/bind.html}
- {boost::bind()} or \l{http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2005/n1836.pdf}
- {std::tr1::bind()} are suitable replacements.
+ use a lambda function or \c std::bind() to transform it onto a function that
+ takes one argument.
As an example, we'll use QImage::scaledToWidth():
@@ -216,16 +214,6 @@
QImage::scaledToWidth() with QtConcurrent::mapped() we have to provide a
value for the \e{width} and the \e{transformation mode}:
- \snippet code/src_concurrent_qtconcurrentmap.cpp 11
-
- The return value from std::bind() is a function object (functor) with
- the following signature:
-
- \snippet code/src_concurrent_qtconcurrentmap.cpp 12
-
- This matches what QtConcurrent::mapped() expects, and the complete example
- becomes:
-
\snippet code/src_concurrent_qtconcurrentmap.cpp 13
*/
diff --git a/src/concurrent/qtconcurrentrun.cpp b/src/concurrent/qtconcurrentrun.cpp
index d1208e0ffb..1d8f7afe85 100644
--- a/src/concurrent/qtconcurrentrun.cpp
+++ b/src/concurrent/qtconcurrentrun.cpp
@@ -107,25 +107,9 @@
\snippet code/src_concurrent_qtconcurrentrun.cpp 5
- \section2 Using Bound Function Arguments
+ \section2 Using Lambda Functions
- You can use std::bind() to \e bind a number of arguments to a function when
- called. If C++11 support is not available, \l{http://www.boost.org/libs/bind/bind.html}
- {boost::bind()} or \l{http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2005/n1836.pdf}
- {std::tr1::bind()} are suitable replacements.
-
- There are number of reasons for binding:
-
- \list
- \li To call a function that takes more than 5 arguments.
- \li To simplify calling a function with constant arguments.
- \li Changing the order of arguments.
- \endlist
-
- See the documentation for the relevant functions for details on how to use
- the bind API.
-
- Calling a bound function is done like this:
+ Calling a lambda function is done like this:
\snippet code/src_concurrent_qtconcurrentrun.cpp 6
*/
diff --git a/src/corelib/doc/snippets/code/src_corelib_kernel_qabstractnativeeventfilter.h b/src/corelib/doc/snippets/code/src_corelib_kernel_qabstractnativeeventfilter.h
index 8818e23ffa..bb44782ac5 100644
--- a/src/corelib/doc/snippets/code/src_corelib_kernel_qabstractnativeeventfilter.h
+++ b/src/corelib/doc/snippets/code/src_corelib_kernel_qabstractnativeeventfilter.h
@@ -6,7 +6,17 @@
** This file is part of the documentation of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:BSD$
-** You may use this file under the terms of the BSD license as follows:
+** 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 https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
**
** "Redistribution and use in source and binary forms, with or without
** modification, are permitted provided that the following conditions are
diff --git a/src/corelib/doc/snippets/code/src_corelib_kernel_qabstractnativeeventfilter.mm b/src/corelib/doc/snippets/code/src_corelib_kernel_qabstractnativeeventfilter.mm
index 2c94178e13..7c40330de0 100644
--- a/src/corelib/doc/snippets/code/src_corelib_kernel_qabstractnativeeventfilter.mm
+++ b/src/corelib/doc/snippets/code/src_corelib_kernel_qabstractnativeeventfilter.mm
@@ -6,7 +6,17 @@
** This file is part of the documentation of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:BSD$
-** You may use this file under the terms of the BSD license as follows:
+** 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 https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
**
** "Redistribution and use in source and binary forms, with or without
** modification, are permitted provided that the following conditions are
diff --git a/src/corelib/doc/src/objectmodel/signalsandslots.qdoc b/src/corelib/doc/src/objectmodel/signalsandslots.qdoc
index 6366350cde..ed61511c62 100644
--- a/src/corelib/doc/src/objectmodel/signalsandslots.qdoc
+++ b/src/corelib/doc/src/objectmodel/signalsandslots.qdoc
@@ -364,9 +364,6 @@
connect(sender, &QObject::destroyed, [=](){ this->m_objects.remove(sender); });
\endcode
- Note that if your compiler does not support C++11 variadic templates,
- this syntax only works if the signal and slot have 6 arguments or less.
-
The other way to connect a signal to a slot is to use QObject::connect()
and the \c{SIGNAL} and \c{SLOT} macros.
The rule about whether to
diff --git a/src/corelib/global/qglobal.cpp b/src/corelib/global/qglobal.cpp
index f8c58c6b3e..7ca22e4a93 100644
--- a/src/corelib/global/qglobal.cpp
+++ b/src/corelib/global/qglobal.cpp
@@ -1938,6 +1938,19 @@ bool qSharedBuild() Q_DECL_NOTHROW
disable functions deprecated in Qt 5.1 and earlier. In any release, set
QT_DISABLE_DEPRECATED_BEFORE=0x000000 to enable any functions, including the ones
deprecated in Qt 5.0
+
+ \sa QT_DEPRECATED_WARNINGS
+ */
+
+
+/*!
+ \macro QT_DEPRECATED_WARNINGS
+ \relates <QtGlobal>
+
+ If this macro is defined, the compiler will generate warnings if API declared as
+ deprecated by Qt is used.
+
+ \sa QT_DISABLE_DEPRECATED_BEFORE
*/
#if defined(QT_BUILD_QMAKE)
diff --git a/src/corelib/kernel/qmetatype.cpp b/src/corelib/kernel/qmetatype.cpp
index 1764c8116e..38e0d6055c 100644
--- a/src/corelib/kernel/qmetatype.cpp
+++ b/src/corelib/kernel/qmetatype.cpp
@@ -825,9 +825,91 @@ void QMetaType::registerStreamOperators(int idx, SaveOperator saveOp,
}
#endif // QT_NO_DATASTREAM
+#if defined(Q_COMPILER_CONSTEXPR) || (defined(Q_CC_MSVC) && Q_CC_MSVC >= 1900)
+// We don't officially support constexpr in MSVC 2015, but the limited support it
+// has is enough for the code below.
+
+# define STRINGIFY_TYPE_NAME(MetaTypeName, TypeId, RealName) \
+ #RealName "\0"
+# define CALCULATE_TYPE_LEN(MetaTypeName, TypeId, RealName) \
+ short(sizeof(#RealName)),
+# define MAP_TYPE_ID_TO_IDX(MetaTypeName, TypeId, RealName) \
+ TypeId,
+
+namespace {
+// All type names in one long string.
+constexpr char metaTypeStrings[] = QT_FOR_EACH_STATIC_TYPE(STRINGIFY_TYPE_NAME);
+
+// The sizes of the strings in the metaTypeStrings string (including terminating null)
+constexpr short metaTypeNameSizes[] = {
+ QT_FOR_EACH_STATIC_TYPE(CALCULATE_TYPE_LEN)
+};
+
+// The type IDs, in the order of the metaTypeStrings data
+constexpr short metaTypeIds[] = {
+ QT_FOR_EACH_STATIC_TYPE(MAP_TYPE_ID_TO_IDX)
+};
+
+constexpr int MetaTypeNameCount = sizeof(metaTypeNameSizes) / sizeof(metaTypeNameSizes[0]);
+
+template <typename IntegerSequence> struct MetaTypeOffsets;
+template <int... TypeIds> struct MetaTypeOffsets<QtPrivate::IndexesList<TypeIds...>>
+{
+ // This would have been a lot easier if the meta types that the macro
+ // QT_FOR_EACH_STATIC_TYPE declared were in sorted, ascending order, but
+ // they're not (i.e., the first one declared is QMetaType::Void == 43,
+ // followed by QMetaType::Bool == 1)... As a consequence, we need to use
+ // the C++11 constexpr function calculateOffsetForTypeId below in order to
+ // create the offset array.
+
+ static constexpr int findTypeId(int typeId, int i = 0)
+ {
+ return i >= MetaTypeNameCount ? -1 :
+ metaTypeIds[i] == typeId ? i : findTypeId(typeId, i + 1);
+ }
+
+ static constexpr short calculateOffsetForIdx(int i)
+ {
+ return i < 0 ? -1 :
+ i == 0 ? 0 : metaTypeNameSizes[i - 1] + calculateOffsetForIdx(i - 1);
+ }
+
+ static constexpr short calculateOffsetForTypeId(int typeId)
+ {
+ return calculateOffsetForIdx(findTypeId(typeId));
+#if 0
+ // same as, but this is only valid in C++14:
+ short offset = 0;
+ for (int i = 0; i < MetaTypeNameCount; ++i) {
+ if (metaTypeIds[i] == typeId)
+ return offset;
+ offset += metaTypeNameSizes[i];
+ }
+ return -1;
+#endif
+ }
+
+ short offsets[sizeof...(TypeIds)];
+ constexpr MetaTypeOffsets() : offsets{calculateOffsetForTypeId(TypeIds)...} {}
+
+ const char *operator[](int typeId) const Q_DECL_NOTHROW
+ {
+ short o = offsets[typeId];
+ return o < 0 ? nullptr : metaTypeStrings + o;
+ }
+};
+} // anonymous namespace
+
+constexpr MetaTypeOffsets<QtPrivate::Indexes<QMetaType::HighestInternalId + 1>::Value> metaTypeNames {};
+# undef STRINGIFY_TYPE_NAME
+# undef CALCULATE_TYPE_LEN
+# undef MAP_TYPE_ID_TO_IDX
+#endif
+
/*!
- Returns the type name associated with the given \a typeId, or 0 if no
- matching type was found. The returned pointer must not be deleted.
+ Returns the type name associated with the given \a typeId, or a null
+ pointer if no matching type was found. The returned pointer must not be
+ deleted.
\sa type(), isRegistered(), Type
*/
@@ -837,14 +919,18 @@ const char *QMetaType::typeName(int typeId)
#define QT_METATYPE_TYPEID_TYPENAME_CONVERTER(MetaTypeName, TypeId, RealName) \
case QMetaType::MetaTypeName: return #RealName; break;
- switch (QMetaType::Type(type)) {
- QT_FOR_EACH_STATIC_TYPE(QT_METATYPE_TYPEID_TYPENAME_CONVERTER)
- case QMetaType::UnknownType:
- case QMetaType::User:
- break;
- }
-
- if (Q_UNLIKELY(type < QMetaType::User)) {
+ if (Q_LIKELY(type <= QMetaType::HighestInternalId)) {
+#if defined(Q_COMPILER_CONSTEXPR) || (defined(Q_CC_MSVC) && Q_CC_MSVC >= 1900)
+ return metaTypeNames[typeId];
+#else
+ switch (QMetaType::Type(type)) {
+ QT_FOR_EACH_STATIC_TYPE(QT_METATYPE_TYPEID_TYPENAME_CONVERTER)
+ case QMetaType::UnknownType:
+ case QMetaType::User:
+ break;
+ }
+#endif
+ } else if (Q_UNLIKELY(type < QMetaType::User)) {
return nullptr; // It can happen when someone cast int to QVariant::Type, we should not crash...
}
diff --git a/src/corelib/kernel/qobject.cpp b/src/corelib/kernel/qobject.cpp
index 8e906b278d..2f4f76856f 100644
--- a/src/corelib/kernel/qobject.cpp
+++ b/src/corelib/kernel/qobject.cpp
@@ -4655,12 +4655,8 @@ void qDeleteInEventHandler(QObject *o)
make sure to declare the argument type with Q_DECLARE_METATYPE
Overloaded functions can be resolved with help of \l qOverload.
-
- \note The number of arguments in the signal or slot are limited to 6 if
- the compiler does not support C++11 variadic templates.
*/
-
/*!
\fn QMetaObject::Connection QObject::connect(const QObject *sender, PointerToMemberFunction signal, Functor functor)
@@ -4683,7 +4679,7 @@ void qDeleteInEventHandler(QObject *o)
\snippet code/src_corelib_kernel_qobject.cpp 45
- If your compiler support C++11 lambda expressions, you can use them:
+ Lambda expressions can also be used:
\snippet code/src_corelib_kernel_qobject.cpp 46
@@ -4693,9 +4689,6 @@ void qDeleteInEventHandler(QObject *o)
Overloaded functions can be resolved with help of \l qOverload.
- \note If the compiler does not support C++11 variadic templates, the number
- of arguments in the signal or slot are limited to 6, and the functor object
- must not have an overloaded or templated operator().
*/
/*!
@@ -4726,7 +4719,7 @@ void qDeleteInEventHandler(QObject *o)
\snippet code/src_corelib_kernel_qobject.cpp 50
- If your compiler support C++11 lambda expressions, you can use them:
+ Lambda expressions can also be used:
\snippet code/src_corelib_kernel_qobject.cpp 51
@@ -4736,10 +4729,6 @@ void qDeleteInEventHandler(QObject *o)
are still alive when the signal is emitted.
Overloaded functions can be resolved with help of \l qOverload.
-
- \note If the compiler does not support C++11 variadic templates, the number
- of arguments in the signal or slot are limited to 6, and the functor object
- must not have an overloaded or templated operator().
*/
/*!
diff --git a/src/corelib/kernel/qtcore_eval.cpp b/src/corelib/kernel/qtcore_eval.cpp
index 787db8a8a6..86992ce10b 100644
--- a/src/corelib/kernel/qtcore_eval.cpp
+++ b/src/corelib/kernel/qtcore_eval.cpp
@@ -207,7 +207,9 @@ QT_BEGIN_INCLUDE_NAMESPACE
#include <qlabel.h>
#include <qlayout.h>
#include <qmessagebox.h>
+#if QT_CONFIG(pushbutton)
#include <qpushbutton.h>
+#endif
#include <qtimer.h>
#include <qapplication.h>
QT_END_INCLUDE_NAMESPACE
diff --git a/src/corelib/tools/qbytearraymatcher.h b/src/corelib/tools/qbytearraymatcher.h
index 476bc3c049..c1c0c3a660 100644
--- a/src/corelib/tools/qbytearraymatcher.h
+++ b/src/corelib/tools/qbytearraymatcher.h
@@ -83,7 +83,9 @@ private:
};
};
-class QStaticByteArrayMatcherBase {
+class QStaticByteArrayMatcherBase
+{
+ Q_DECL_ALIGN(16)
struct Skiptable {
uchar data[256];
} m_skiptable;
diff --git a/src/corelib/tools/qregularexpression.cpp b/src/corelib/tools/qregularexpression.cpp
index 791a4970f0..8366e01ee8 100644
--- a/src/corelib/tools/qregularexpression.cpp
+++ b/src/corelib/tools/qregularexpression.cpp
@@ -54,6 +54,8 @@
#include <QtCore/qatomic.h>
#include <QtCore/qdatastream.h>
+#define PCRE2_CODE_UNIT_WIDTH 16
+
#include <pcre2.h>
QT_BEGIN_NAMESPACE
diff --git a/src/dbus/qdbusconnection_p.h b/src/dbus/qdbusconnection_p.h
index 875bcd1421..d323088779 100644
--- a/src/dbus/qdbusconnection_p.h
+++ b/src/dbus/qdbusconnection_p.h
@@ -348,9 +348,6 @@ public:
QObject *receiver, const char *signal, int minMIdx,
bool buildSignature);
static DBusHandlerResult messageFilter(DBusConnection *, DBusMessage *, void *);
- static bool checkReplyForDelivery(QDBusConnectionPrivate *target, QObject *object,
- int idx, const QList<int> &metaTypes,
- const QDBusMessage &msg);
static QDBusCallDeliveryEvent *prepareReply(QDBusConnectionPrivate *target, QObject *object,
int idx, const QVector<int> &metaTypes,
const QDBusMessage &msg);
diff --git a/src/gui/configure.json b/src/gui/configure.json
index e627d6286f..a8ae656bcb 100644
--- a/src/gui/configure.json
+++ b/src/gui/configure.json
@@ -170,7 +170,7 @@
"label": "Mir client libraries",
"test": "qpa/mirclient",
"sources": [
- { "type": "pkgConfig", "args": "egl mirclient ubuntu-platform-api libcontent-hub" }
+ { "type": "pkgConfig", "args": "egl mirclient ubuntu-platform-api libcontent-hub >= 0.2.0" }
]
},
"mtdev": {
@@ -534,12 +534,19 @@
"linuxfb": {
"label": "LinuxFB",
"section": "Platform plugins",
- "condition": "tests.linuxfb",
+ "condition": "tests.linuxfb && features.regularexpression",
+ "output": [ "privateFeature" ]
+ },
+ "vnc": {
+ "label": "VNC",
+ "section": "Platform plugins",
+ "condition": "config.unix && !config.android && !config.darwin && features.regularexpression",
"output": [ "privateFeature" ]
},
"mirclient": {
"label": "Mir client",
"section": "Platform plugins",
+ "autoDetect": false,
"condition": "libs.mirclient",
"output": [ "privateFeature" ]
},
@@ -889,7 +896,6 @@
"label": "QImageIOPlugin",
"purpose": "Provides a base for writing a image format plugins.",
"section": "Images",
- "condition": "features.library",
"output": [ "publicFeature", "feature" ]
},
"movie": {
@@ -1114,7 +1120,7 @@ QMAKE_LIBDIR_OPENGL[_ES2] and QMAKE_LIBS_OPENGL[_ES2] in the mkspec for your pla
"eglfs_viv", "eglfs_viv_wl", "eglfs_egldevice", "eglfs_gbm", "eglfs_mali", "eglfs_brcm", "egl_x11"
]
},
- "linuxfb", "mirclient",
+ "linuxfb", "vnc", "mirclient",
{
"type": "feature",
"message": "INTEGRITY framebuffer",
diff --git a/src/gui/image/qicon.cpp b/src/gui/image/qicon.cpp
index 7d6cd50bac..07dcf8b726 100644
--- a/src/gui/image/qicon.cpp
+++ b/src/gui/image/qicon.cpp
@@ -700,7 +700,7 @@ QIcon::QIcon(const QIcon &other)
the relevant file must be found relative to the runtime working
directory.
- The file name can be either refer to an actual file on disk or to
+ The file name can refer to an actual file on disk or to
one of the application's embedded resources. See the
\l{resources.html}{Resource System} overview for details on how to
embed images and other resource files in the application's
@@ -1049,7 +1049,7 @@ static QIconEngine *iconEngineFromSuffix(const QString &fileName, const QString
the relevant file must be found relative to the runtime working
directory.
- The file name can be either refer to an actual file on disk or to
+ The file name can refer to an actual file on disk or to
one of the application's embedded resources. See the
\l{resources.html}{Resource System} overview for details on how to
embed images and other resource files in the application's
diff --git a/src/gui/image/qimage_darwin.mm b/src/gui/image/qimage_darwin.mm
index 2d38468cc5..3764bef06b 100644
--- a/src/gui/image/qimage_darwin.mm
+++ b/src/gui/image/qimage_darwin.mm
@@ -1,31 +1,37 @@
/****************************************************************************
**
-** Copyright (C) 2015 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
+** Copyright (C) 2017 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL21$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 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.
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.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.
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
diff --git a/src/gui/image/qppmhandler.cpp b/src/gui/image/qppmhandler.cpp
index 42d3684aea..e9f5a905f0 100644
--- a/src/gui/image/qppmhandler.cpp
+++ b/src/gui/image/qppmhandler.cpp
@@ -45,6 +45,7 @@
#include <qvariant.h>
#include <qvector.h>
#include <ctype.h>
+#include <qrgba64.h>
QT_BEGIN_NAMESPACE
@@ -120,6 +121,11 @@ static bool read_pbm_header(QIODevice *device, char& type, int& w, int& h, int&
return true;
}
+static inline QRgb scale_pbm_color(quint16 mx, quint16 rv, quint16 gv, quint16 bv)
+{
+ return QRgba64::fromRgba64((rv * 0xffff) / mx, (gv * 0xffff) / mx, (bv * 0xffff) / mx, 0xffff).toArgb32();
+}
+
static bool read_pbm_body(QIODevice *device, char type, int w, int h, int mcc, QImage *outImage)
{
int nbits, y;
@@ -148,9 +154,6 @@ static bool read_pbm_body(QIODevice *device, char type, int w, int h, int mcc, Q
}
raw = type >= '4';
- int maxc = mcc;
- if (maxc > 255)
- maxc = 255;
if (outImage->size() != QSize(w, h) || outImage->format() != format) {
*outImage = QImage(w, h, format);
if (outImage->isNull())
@@ -175,22 +178,50 @@ static bool read_pbm_body(QIODevice *device, char type, int w, int h, int mcc, Q
b = buf24;
while (p < end) {
if (mcc < 256) {
- *p++ = qRgb(b[0],b[1],b[2]);
+ if (mcc == 255)
+ *p++ = qRgb(b[0],b[1],b[2]);
+ else
+ *p++ = scale_pbm_color(mcc, b[0], b[1], b[2]);
b += 3;
} else {
- *p++ = qRgb(((int(b[0]) * 256 + int(b[1]) + 1) * 256) / (mcc + 1) - 1,
- ((int(b[2]) * 256 + int(b[3]) + 1) * 256) / (mcc + 1) - 1,
- ((int(b[4]) * 256 + int(b[5]) + 1) * 256) / (mcc + 1) - 1);
+ quint16 rv = b[0] << 8 | b[1];
+ quint16 gv = b[2] << 8 | b[3];
+ quint16 bv = b[4] << 8 | b[5];
+ if (mcc == 0xffff)
+ *p++ = QRgba64::fromRgba64(rv, gv, bv, 0xffff).toArgb32();
+ else
+ *p++ = scale_pbm_color(mcc, rv, gv, bv);
b += 6;
}
}
}
delete[] buf24;
+ } else if (nbits == 8 && mcc > 255) { // type 5 16bit
+ pbm_bpl = 2*w;
+ uchar *buf16 = new uchar[pbm_bpl];
+ for (y=0; y<h; y++) {
+ if (device->read((char *)buf16, pbm_bpl) != pbm_bpl) {
+ delete[] buf16;
+ return false;
+ }
+ uchar *p = outImage->scanLine(y);
+ uchar *end = p + w;
+ uchar *b = buf16;
+ while (p < end) {
+ *p++ = (b[0] << 8 | b[1]) * 255 / mcc;
+ b += 2;
+ }
+ }
+ delete[] buf16;
} else { // type 4,5
for (y=0; y<h; y++) {
- if (device->read((char *)outImage->scanLine(y), pbm_bpl)
- != pbm_bpl)
+ uchar *p = outImage->scanLine(y);
+ if (device->read((char *)p, pbm_bpl) != pbm_bpl)
return false;
+ if (nbits == 8 && mcc < 255) {
+ for (int i = 0; i < pbm_bpl; i++)
+ p[i] = (p[i] * 255) / mcc;
+ }
}
}
} else { // read ascii data
@@ -227,7 +258,7 @@ static bool read_pbm_body(QIODevice *device, char type, int w, int h, int mcc, Q
} else { // 32 bits
n /= 4;
int r, g, b;
- if (mcc == maxc) {
+ if (mcc == 255) {
while (n--) {
r = read_pbm_int(device);
g = read_pbm_int(device);
@@ -237,10 +268,10 @@ static bool read_pbm_body(QIODevice *device, char type, int w, int h, int mcc, Q
}
} else {
while (n--) {
- r = read_pbm_int(device) * maxc / mcc;
- g = read_pbm_int(device) * maxc / mcc;
- b = read_pbm_int(device) * maxc / mcc;
- *((QRgb*)p) = qRgb(r, g, b);
+ r = read_pbm_int(device);
+ g = read_pbm_int(device);
+ b = read_pbm_int(device);
+ *((QRgb*)p) = scale_pbm_color(mcc, r, g, b);
p += 4;
}
}
diff --git a/src/gui/opengl/qopengltexture.cpp b/src/gui/opengl/qopengltexture.cpp
index 3696378bd1..0831bfe706 100644
--- a/src/gui/opengl/qopengltexture.cpp
+++ b/src/gui/opengl/qopengltexture.cpp
@@ -3685,7 +3685,7 @@ bool QOpenGLTexture::hasFeature(Feature feature)
const char *renderer = reinterpret_cast<const char *>(ctx->functions()->glGetString(GL_RENDERER));
switch (feature) {
case ImmutableStorage:
- supported = (f.version() >= qMakePair(3, 0) || ctx->hasExtension(QByteArrayLiteral("EXT_texture_storage")))
+ supported = (f.version() >= qMakePair(3, 0) || ctx->hasExtension(QByteArrayLiteral("GL_EXT_texture_storage")))
&& !(renderer && strstr(renderer, "Mali")); // do not use on Mali: QTBUG-45106
break;
diff --git a/src/gui/painting/qcoregraphics.mm b/src/gui/painting/qcoregraphics.mm
index 768d3e7148..98fdd7f35e 100644
--- a/src/gui/painting/qcoregraphics.mm
+++ b/src/gui/painting/qcoregraphics.mm
@@ -1,31 +1,37 @@
/****************************************************************************
**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
+** Copyright (C) 2017 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL21$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 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.
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.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.
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
diff --git a/src/gui/painting/qcoregraphics_p.h b/src/gui/painting/qcoregraphics_p.h
index 065910222d..54de3f332e 100644
--- a/src/gui/painting/qcoregraphics_p.h
+++ b/src/gui/painting/qcoregraphics_p.h
@@ -1,31 +1,37 @@
/****************************************************************************
**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
+** Copyright (C) 2017 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL21$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 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.
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.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.
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
diff --git a/src/gui/painting/qdrawhelper.cpp b/src/gui/painting/qdrawhelper.cpp
index 9233bff68c..5c38648fe7 100644
--- a/src/gui/painting/qdrawhelper.cpp
+++ b/src/gui/painting/qdrawhelper.cpp
@@ -5588,7 +5588,7 @@ static void qt_alphamapblit_generic(QRasterBuffer *rasterBuffer,
srcColor = colorProfile->toLinear(srcColor.unpremultiplied()).premultiplied();
}
- QRgba64 buffer[buffer_size];
+ quint64 buffer[buffer_size];
const DestFetchProc64 destFetch64 = destFetchProc64[rasterBuffer->format];
const DestStoreProc64 destStore64 = destStoreProc64[rasterBuffer->format];
@@ -5598,12 +5598,12 @@ static void qt_alphamapblit_generic(QRasterBuffer *rasterBuffer,
int length = mapWidth;
while (length > 0) {
int l = qMin(buffer_size, length);
- QRgba64 *dest = destFetch64(buffer, rasterBuffer, i, y + ly, l);
+ QRgba64 *dest = destFetch64((QRgba64*)buffer, rasterBuffer, i, y + ly, l);
for (int j=0; j < l; ++j) {
const int coverage = map[j + (i - x)];
alphamapblend_generic(coverage, dest, j, srcColor, color, colorProfile);
}
- destStore64(rasterBuffer, i, y + ly, buffer, l);
+ destStore64(rasterBuffer, i, y + ly, dest, l);
length -= l;
i += l;
}
@@ -5625,7 +5625,7 @@ static void qt_alphamapblit_generic(QRasterBuffer *rasterBuffer,
int start = qMax<int>(x, clip.x);
int end = qMin<int>(x + mapWidth, clip.x + clip.len);
Q_ASSERT(clip.len <= buffer_size);
- QRgba64 *dest = destFetch64(buffer, rasterBuffer, start, clip.y, clip.len);
+ QRgba64 *dest = destFetch64((QRgba64*)buffer, rasterBuffer, start, clip.y, clip.len);
for (int xp=start; xp<end; ++xp) {
const int coverage = map[xp - x];
@@ -5873,7 +5873,7 @@ static void qt_alphargbblit_generic(QRasterBuffer *rasterBuffer,
srcColor = colorProfile->toLinear(srcColor.unpremultiplied()).premultiplied();
}
- QRgba64 buffer[buffer_size];
+ quint64 buffer[buffer_size];
const DestFetchProc64 destFetch64 = destFetchProc64[rasterBuffer->format];
const DestStoreProc64 destStore64 = destStoreProc64[rasterBuffer->format];
@@ -5883,12 +5883,12 @@ static void qt_alphargbblit_generic(QRasterBuffer *rasterBuffer,
int length = mapWidth;
while (length > 0) {
int l = qMin(buffer_size, length);
- QRgba64 *dest = destFetch64(buffer, rasterBuffer, i, y + ly, l);
+ QRgba64 *dest = destFetch64((QRgba64*)buffer, rasterBuffer, i, y + ly, l);
for (int j=0; j < l; ++j) {
const uint coverage = src[j + (i - x)];
alphargbblend_generic(coverage, dest, j, srcColor, color, colorProfile);
}
- destStore64(rasterBuffer, i, y + ly, buffer, l);
+ destStore64(rasterBuffer, i, y + ly, dest, l);
length -= l;
i += l;
}
@@ -5910,7 +5910,7 @@ static void qt_alphargbblit_generic(QRasterBuffer *rasterBuffer,
int start = qMax<int>(x, clip.x);
int end = qMin<int>(x + mapWidth, clip.x + clip.len);
Q_ASSERT(clip.len <= buffer_size);
- QRgba64 *dest = destFetch64(buffer, rasterBuffer, start, clip.y, clip.len);
+ QRgba64 *dest = destFetch64((QRgba64*)buffer, rasterBuffer, start, clip.y, clip.len);
for (int xp=start; xp<end; ++xp) {
const uint coverage = src[xp - x];
@@ -6495,6 +6495,17 @@ static void qInitDrawhelperFunctions()
qt_functionForMode_C[QPainter::CompositionMode_SourceOver] = comp_func_SourceOver_avx2;
qt_functionForModeSolid_C[QPainter::CompositionMode_SourceOver] = comp_func_solid_SourceOver_avx2;
qt_functionForMode_C[QPainter::CompositionMode_Source] = comp_func_Source_avx2;
+
+ extern void QT_FASTCALL fetchTransformedBilinearARGB32PM_simple_upscale_helper_avx2(uint *b, uint *end, const QTextureData &image,
+ int &fx, int &fy, int fdx, int /*fdy*/);
+ extern void QT_FASTCALL fetchTransformedBilinearARGB32PM_downscale_helper_avx2(uint *b, uint *end, const QTextureData &image,
+ int &fx, int &fy, int fdx, int /*fdy*/);
+ extern void QT_FASTCALL fetchTransformedBilinearARGB32PM_fast_rotate_helper_avx2(uint *b, uint *end, const QTextureData &image,
+ int &fx, int &fy, int fdx, int fdy);
+
+ bilinearFastTransformHelperARGB32PM[0][SimpleUpscaleTransform] = fetchTransformedBilinearARGB32PM_simple_upscale_helper_avx2;
+ bilinearFastTransformHelperARGB32PM[0][DownscaleTransform] = fetchTransformedBilinearARGB32PM_downscale_helper_avx2;
+ bilinearFastTransformHelperARGB32PM[0][FastRotateTransform] = fetchTransformedBilinearARGB32PM_fast_rotate_helper_avx2;
}
#endif
diff --git a/src/gui/painting/qdrawhelper_avx2.cpp b/src/gui/painting/qdrawhelper_avx2.cpp
index 5e17e8abec..a7e03a7bb3 100644
--- a/src/gui/painting/qdrawhelper_avx2.cpp
+++ b/src/gui/painting/qdrawhelper_avx2.cpp
@@ -44,6 +44,13 @@
QT_BEGIN_NAMESPACE
+static Q_CONSTEXPR int BufferSize = 2048;
+
+enum {
+ FixedScale = 1 << 16,
+ HalfPoint = 1 << 15
+};
+
// Vectorized blend functions:
// See BYTE_MUL_SSE2 for details.
@@ -343,6 +350,413 @@ void QT_FASTCALL comp_func_solid_SourceOver_avx2(uint *destPixels, int length, u
}
}
+#define interpolate_4_pixels_16_avx2(tlr1, tlr2, blr1, blr2, distx, disty, colorMask, v_256, b) \
+{ \
+ /* Correct for later unpack */ \
+ const __m256i vdistx = _mm256_permute4x64_epi64(distx, _MM_SHUFFLE(3, 1, 2, 0)); \
+ const __m256i vdisty = _mm256_permute4x64_epi64(disty, _MM_SHUFFLE(3, 1, 2, 0)); \
+ \
+ __m256i dxdy = _mm256_mullo_epi16 (vdistx, vdisty); \
+ const __m256i distx_ = _mm256_slli_epi16(vdistx, 4); \
+ const __m256i disty_ = _mm256_slli_epi16(vdisty, 4); \
+ __m256i idxidy = _mm256_add_epi16(dxdy, _mm256_sub_epi16(v_256, _mm256_add_epi16(distx_, disty_))); \
+ __m256i dxidy = _mm256_sub_epi16(distx_, dxdy); \
+ __m256i idxdy = _mm256_sub_epi16(disty_, dxdy); \
+ \
+ __m256i tlr1AG = _mm256_srli_epi16(tlr1, 8); \
+ __m256i tlr1RB = _mm256_and_si256(tlr1, colorMask); \
+ __m256i tlr2AG = _mm256_srli_epi16(tlr2, 8); \
+ __m256i tlr2RB = _mm256_and_si256(tlr2, colorMask); \
+ __m256i blr1AG = _mm256_srli_epi16(blr1, 8); \
+ __m256i blr1RB = _mm256_and_si256(blr1, colorMask); \
+ __m256i blr2AG = _mm256_srli_epi16(blr2, 8); \
+ __m256i blr2RB = _mm256_and_si256(blr2, colorMask); \
+ \
+ __m256i odxidy1 = _mm256_unpacklo_epi32(idxidy, dxidy); \
+ __m256i odxidy2 = _mm256_unpackhi_epi32(idxidy, dxidy); \
+ tlr1AG = _mm256_mullo_epi16(tlr1AG, odxidy1); \
+ tlr1RB = _mm256_mullo_epi16(tlr1RB, odxidy1); \
+ tlr2AG = _mm256_mullo_epi16(tlr2AG, odxidy2); \
+ tlr2RB = _mm256_mullo_epi16(tlr2RB, odxidy2); \
+ __m256i odxdy1 = _mm256_unpacklo_epi32(idxdy, dxdy); \
+ __m256i odxdy2 = _mm256_unpackhi_epi32(idxdy, dxdy); \
+ blr1AG = _mm256_mullo_epi16(blr1AG, odxdy1); \
+ blr1RB = _mm256_mullo_epi16(blr1RB, odxdy1); \
+ blr2AG = _mm256_mullo_epi16(blr2AG, odxdy2); \
+ blr2RB = _mm256_mullo_epi16(blr2RB, odxdy2); \
+ \
+ /* Add the values, and shift to only keep 8 significant bits per colors */ \
+ __m256i topAG = _mm256_hadd_epi32(tlr1AG, tlr2AG); \
+ __m256i topRB = _mm256_hadd_epi32(tlr1RB, tlr2RB); \
+ __m256i botAG = _mm256_hadd_epi32(blr1AG, blr2AG); \
+ __m256i botRB = _mm256_hadd_epi32(blr1RB, blr2RB); \
+ __m256i rAG = _mm256_add_epi16(topAG, botAG); \
+ __m256i rRB = _mm256_add_epi16(topRB, botRB); \
+ rRB = _mm256_srli_epi16(rRB, 8); \
+ /* Correct for hadd */ \
+ rAG = _mm256_permute4x64_epi64(rAG, _MM_SHUFFLE(3, 1, 2, 0)); \
+ rRB = _mm256_permute4x64_epi64(rRB, _MM_SHUFFLE(3, 1, 2, 0)); \
+ _mm256_storeu_si256((__m256i*)(b), _mm256_blendv_epi8(rAG, rRB, colorMask)); \
+}
+
+inline void fetchTransformedBilinear_pixelBounds(int, int l1, int l2, int &v1, int &v2)
+{
+ if (v1 < l1)
+ v2 = v1 = l1;
+ else if (v1 >= l2)
+ v2 = v1 = l2;
+ else
+ v2 = v1 + 1;
+ Q_ASSERT(v1 >= l1 && v1 <= l2);
+ Q_ASSERT(v2 >= l1 && v2 <= l2);
+}
+
+void QT_FASTCALL fetchTransformedBilinearARGB32PM_simple_upscale_helper_avx2(uint *b, uint *end, const QTextureData &image,
+ int &fx, int &fy, int fdx, int /*fdy*/)
+{
+ int y1 = (fy >> 16);
+ int y2;
+ fetchTransformedBilinear_pixelBounds(image.height, image.y1, image.y2 - 1, y1, y2);
+ const uint *s1 = (const uint *)image.scanLine(y1);
+ const uint *s2 = (const uint *)image.scanLine(y2);
+
+ int disty = (fy & 0x0000ffff) >> 8;
+ int idisty = 256 - disty;
+ int x = fx >> 16;
+ int length = end - b;
+
+ // The idea is first to do the interpolation between the row s1 and the row s2
+ // into an intermediate buffer, then we interpolate between two pixel of this buffer.
+
+ // intermediate_buffer[0] is a buffer of red-blue component of the pixel, in the form 0x00RR00BB
+ // intermediate_buffer[1] is the alpha-green component of the pixel, in the form 0x00AA00GG
+ // +1 for the last pixel to interpolate with, and +1 for rounding errors.
+ quint32 intermediate_buffer[2][BufferSize + 2];
+ // count is the size used in the intermediate_buffer.
+ int count = (qint64(length) * fdx + FixedScale - 1) / FixedScale + 2;
+ Q_ASSERT(count <= BufferSize + 2); //length is supposed to be <= buffer_size and data->m11 < 1 in this case
+ int f = 0;
+ int lim = qMin(count, image.x2 - x);
+ if (x < image.x1) {
+ Q_ASSERT(x < image.x2);
+ uint t = s1[image.x1];
+ uint b = s2[image.x1];
+ quint32 rb = (((t & 0xff00ff) * idisty + (b & 0xff00ff) * disty) >> 8) & 0xff00ff;
+ quint32 ag = ((((t>>8) & 0xff00ff) * idisty + ((b>>8) & 0xff00ff) * disty) >> 8) & 0xff00ff;
+ do {
+ intermediate_buffer[0][f] = rb;
+ intermediate_buffer[1][f] = ag;
+ f++;
+ x++;
+ } while (x < image.x1 && f < lim);
+ }
+
+ const __m256i disty_ = _mm256_set1_epi16(disty);
+ const __m256i idisty_ = _mm256_set1_epi16(idisty);
+ const __m256i colorMask = _mm256_set1_epi32(0x00ff00ff);
+
+ lim -= 7;
+ for (; f < lim; x += 8, f += 8) {
+ // Load 8 pixels from s1, and split the alpha-green and red-blue component
+ __m256i top = _mm256_loadu_si256((const __m256i*)((const uint *)(s1)+x));
+ __m256i topAG = _mm256_srli_epi16(top, 8);
+ __m256i topRB = _mm256_and_si256(top, colorMask);
+ // Multiplies each color component by idisty
+ topAG = _mm256_mullo_epi16 (topAG, idisty_);
+ topRB = _mm256_mullo_epi16 (topRB, idisty_);
+
+ // Same for the s2 vector
+ __m256i bottom = _mm256_loadu_si256((const __m256i*)((const uint *)(s2)+x));
+ __m256i bottomAG = _mm256_srli_epi16(bottom, 8);
+ __m256i bottomRB = _mm256_and_si256(bottom, colorMask);
+ bottomAG = _mm256_mullo_epi16 (bottomAG, disty_);
+ bottomRB = _mm256_mullo_epi16 (bottomRB, disty_);
+
+ // Add the values, and shift to only keep 8 significant bits per colors
+ __m256i rAG =_mm256_add_epi16(topAG, bottomAG);
+ rAG = _mm256_srli_epi16(rAG, 8);
+ _mm256_storeu_si256((__m256i*)(&intermediate_buffer[1][f]), rAG);
+ __m256i rRB =_mm256_add_epi16(topRB, bottomRB);
+ rRB = _mm256_srli_epi16(rRB, 8);
+ _mm256_storeu_si256((__m256i*)(&intermediate_buffer[0][f]), rRB);
+ }
+
+ for (; f < count; f++) { // Same as above but without simd
+ x = qMin(x, image.x2 - 1);
+
+ uint t = s1[x];
+ uint b = s2[x];
+
+ intermediate_buffer[0][f] = (((t & 0xff00ff) * idisty + (b & 0xff00ff) * disty) >> 8) & 0xff00ff;
+ intermediate_buffer[1][f] = ((((t>>8) & 0xff00ff) * idisty + ((b>>8) & 0xff00ff) * disty) >> 8) & 0xff00ff;
+ x++;
+ }
+ // Now interpolate the values from the intermediate_buffer to get the final result.
+ fx &= FixedScale - 1;
+ Q_ASSERT((fx >> 16) == 0);
+
+ const __m128i v_fdx = _mm_set1_epi32(fdx * 4);
+ const __m128i v_blend = _mm_set1_epi32(0x00800080);
+ __m128i v_fx = _mm_setr_epi32(fx, fx + fdx, fx + fdx + fdx, fx + fdx + fdx + fdx);
+
+ while (b < end - 3) {
+ const __m128i offset = _mm_srli_epi32(v_fx, 16);
+ __m256i vrb = _mm256_i32gather_epi64((const long long *)intermediate_buffer[0], offset, 4);
+ __m256i vag = _mm256_i32gather_epi64((const long long *)intermediate_buffer[1], offset, 4);
+
+ __m128i vdx = _mm_and_si128(v_fx, _mm_set1_epi32(0x0000ffff));
+ vdx = _mm_srli_epi16(vdx, 8);
+ __m128i vidx = _mm_sub_epi32(_mm_set1_epi32(256), vdx);
+ __m256i vmulx = _mm256_castsi128_si256(_mm_unpacklo_epi32(vidx, vdx));
+ vmulx = _mm256_inserti128_si256(vmulx, _mm_unpackhi_epi32(vidx, vdx), 1);
+
+ vrb = _mm256_mullo_epi32(vrb, vmulx);
+ vag = _mm256_mullo_epi32(vag, vmulx);
+
+ __m256i vrbag = _mm256_hadd_epi32(vrb, vag);
+ vrbag = _mm256_permute4x64_epi64(vrbag, _MM_SHUFFLE(3, 1, 2, 0));
+
+ __m128i rb = _mm256_castsi256_si128(vrbag);
+ __m128i ag = _mm256_extracti128_si256(vrbag, 1);
+ rb = _mm_srli_epi16(rb, 8);
+
+ _mm_storeu_si128((__m128i*)b, _mm_blendv_epi8(ag, rb, v_blend));
+
+ b += 4;
+ fx += 4 * fdx;
+ v_fx = _mm_add_epi32(v_fx, v_fdx);
+ }
+ while (b < end) {
+ int x = (fx >> 16);
+
+ uint distx = (fx & 0x0000ffff) >> 8;
+ uint idistx = 256 - distx;
+
+ uint rb = ((intermediate_buffer[0][x] * idistx + intermediate_buffer[0][x + 1] * distx) >> 8) & 0xff00ff;
+ uint ag = (intermediate_buffer[1][x] * idistx + intermediate_buffer[1][x + 1] * distx) & 0xff00ff00;
+ *b = rb | ag;
+ b++;
+ fx += fdx;
+ }
+}
+
+void QT_FASTCALL fetchTransformedBilinearARGB32PM_downscale_helper_avx2(uint *b, uint *end, const QTextureData &image,
+ int &fx, int &fy, int fdx, int /*fdy*/)
+{
+ int y1 = (fy >> 16);
+ int y2;
+ fetchTransformedBilinear_pixelBounds(image.height, image.y1, image.y2 - 1, y1, y2);
+ const uint *s1 = (const uint *)image.scanLine(y1);
+ const uint *s2 = (const uint *)image.scanLine(y2);
+ const int disty8 = (fy & 0x0000ffff) >> 8;
+ const int disty4 = (disty8 + 0x08) >> 4;
+
+ const qint64 min_fx = qint64(image.x1) * FixedScale;
+ const qint64 max_fx = qint64(image.x2 - 1) * FixedScale;
+ while (b < end) {
+ int x1 = (fx >> 16);
+ int x2;
+ fetchTransformedBilinear_pixelBounds(image.width, image.x1, image.x2 - 1, x1, x2);
+ if (x1 != x2)
+ break;
+ uint top = s1[x1];
+ uint bot = s2[x1];
+ *b = INTERPOLATE_PIXEL_256(top, 256 - disty8, bot, disty8);
+ fx += fdx;
+ ++b;
+ }
+ uint *boundedEnd = end;
+ if (fdx > 0)
+ boundedEnd = qMin(boundedEnd, b + (max_fx - fx) / fdx);
+ else if (fdx < 0)
+ boundedEnd = qMin(boundedEnd, b + (min_fx - fx) / fdx);
+
+ // A fast middle part without boundary checks
+ const __m256i vdistShuffle =
+ _mm256_setr_epi8(0, char(0x80), 0, char(0x80), 4, char(0x80), 4, char(0x80), 8, char(0x80), 8, char(0x80), 12, char(0x80), 12, char(0x80),
+ 0, char(0x80), 0, char(0x80), 4, char(0x80), 4, char(0x80), 8, char(0x80), 8, char(0x80), 12, char(0x80), 12, char(0x80));
+ const __m256i colorMask = _mm256_set1_epi32(0x00ff00ff);
+ const __m256i v_256 = _mm256_set1_epi16(256);
+ const __m256i v_disty = _mm256_set1_epi16(disty4);
+ const __m256i v_fdx = _mm256_set1_epi32(fdx * 8);
+ const __m256i v_fx_r = _mm256_set1_epi32(0x08);
+ const __m256i v_index = _mm256_setr_epi32(0, 1, 2, 3, 4, 5, 6, 7);
+ __m256i v_fx = _mm256_set1_epi32(fx);
+ v_fx = _mm256_add_epi32(v_fx, _mm256_mullo_epi32(_mm256_set1_epi32(fdx), v_index));
+
+ while (b < boundedEnd - 7) {
+ const __m256i offset = _mm256_srli_epi32(v_fx, 16);
+ const __m128i offsetLo = _mm256_castsi256_si128(offset);
+ const __m128i offsetHi = _mm256_extracti128_si256(offset, 1);
+ const __m256i toplo = _mm256_i32gather_epi64((const long long *)s1, offsetLo, 4);
+ const __m256i tophi = _mm256_i32gather_epi64((const long long *)s1, offsetHi, 4);
+ const __m256i botlo = _mm256_i32gather_epi64((const long long *)s2, offsetLo, 4);
+ const __m256i bothi = _mm256_i32gather_epi64((const long long *)s2, offsetHi, 4);
+
+ __m256i v_distx = _mm256_srli_epi16(v_fx, 8);
+ v_distx = _mm256_srli_epi16(_mm256_add_epi32(v_distx, v_fx_r), 4);
+ v_distx = _mm256_shuffle_epi8(v_distx, vdistShuffle);
+
+ interpolate_4_pixels_16_avx2(toplo, tophi, botlo, bothi, v_distx, v_disty, colorMask, v_256, b);
+ b += 8;
+ v_fx = _mm256_add_epi32(v_fx, v_fdx);
+ }
+ fx = _mm_extract_epi32(_mm256_castsi256_si128(v_fx) , 0);
+
+ while (b < boundedEnd) {
+ int x = (fx >> 16);
+ int distx8 = (fx & 0x0000ffff) >> 8;
+ *b = interpolate_4_pixels(s1 + x, s2 + x, distx8, disty8);
+ fx += fdx;
+ ++b;
+ }
+
+ while (b < end) {
+ int x1 = (fx >> 16);
+ int x2;
+ fetchTransformedBilinear_pixelBounds(image.width, image.x1, image.x2 - 1, x1, x2);
+ uint tl = s1[x1];
+ uint tr = s1[x2];
+ uint bl = s2[x1];
+ uint br = s2[x2];
+ int distx8 = (fx & 0x0000ffff) >> 8;
+ *b = interpolate_4_pixels(tl, tr, bl, br, distx8, disty8);
+ fx += fdx;
+ ++b;
+ }
+}
+
+void QT_FASTCALL fetchTransformedBilinearARGB32PM_fast_rotate_helper_avx2(uint *b, uint *end, const QTextureData &image,
+ int &fx, int &fy, int fdx, int fdy)
+{
+ const qint64 min_fx = qint64(image.x1) * FixedScale;
+ const qint64 max_fx = qint64(image.x2 - 1) * FixedScale;
+ const qint64 min_fy = qint64(image.y1) * FixedScale;
+ const qint64 max_fy = qint64(image.y2 - 1) * FixedScale;
+ // first handle the possibly bounded part in the beginning
+ while (b < end) {
+ int x1 = (fx >> 16);
+ int x2;
+ int y1 = (fy >> 16);
+ int y2;
+ fetchTransformedBilinear_pixelBounds(image.width, image.x1, image.x2 - 1, x1, x2);
+ fetchTransformedBilinear_pixelBounds(image.height, image.y1, image.y2 - 1, y1, y2);
+ if (x1 != x2 && y1 != y2)
+ break;
+ const uint *s1 = (const uint *)image.scanLine(y1);
+ const uint *s2 = (const uint *)image.scanLine(y2);
+ uint tl = s1[x1];
+ uint tr = s1[x2];
+ uint bl = s2[x1];
+ uint br = s2[x2];
+ int distx = (fx & 0x0000ffff) >> 8;
+ int disty = (fy & 0x0000ffff) >> 8;
+ *b = interpolate_4_pixels(tl, tr, bl, br, distx, disty);
+ fx += fdx;
+ fy += fdy;
+ ++b;
+ }
+ uint *boundedEnd = end;
+ if (fdx > 0)
+ boundedEnd = qMin(boundedEnd, b + (max_fx - fx) / fdx);
+ else if (fdx < 0)
+ boundedEnd = qMin(boundedEnd, b + (min_fx - fx) / fdx);
+ if (fdy > 0)
+ boundedEnd = qMin(boundedEnd, b + (max_fy - fy) / fdy);
+ else if (fdy < 0)
+ boundedEnd = qMin(boundedEnd, b + (min_fy - fy) / fdy);
+
+ // until boundedEnd we can now have a fast middle part without boundary checks
+ const __m256i vdistShuffle =
+ _mm256_setr_epi8(0, char(0x80), 0, char(0x80), 4, char(0x80), 4, char(0x80), 8, char(0x80), 8, char(0x80), 12, char(0x80), 12, char(0x80),
+ 0, char(0x80), 0, char(0x80), 4, char(0x80), 4, char(0x80), 8, char(0x80), 8, char(0x80), 12, char(0x80), 12, char(0x80));
+ const __m256i colorMask = _mm256_set1_epi32(0x00ff00ff);
+ const __m256i v_256 = _mm256_set1_epi16(256);
+ const __m256i v_fdx = _mm256_set1_epi32(fdx * 8);
+ const __m256i v_fdy = _mm256_set1_epi32(fdy * 8);
+ const __m256i v_fxy_r = _mm256_set1_epi32(0x08);
+ const __m256i v_index = _mm256_setr_epi32(0, 1, 2, 3, 4, 5, 6, 7);
+ __m256i v_fx = _mm256_set1_epi32(fx);
+ __m256i v_fy = _mm256_set1_epi32(fy);
+ v_fx = _mm256_add_epi32(v_fx, _mm256_mullo_epi32(_mm256_set1_epi32(fdx), v_index));
+ v_fy = _mm256_add_epi32(v_fy, _mm256_mullo_epi32(_mm256_set1_epi32(fdy), v_index));
+
+ const uchar *textureData = image.imageData;
+ const int bytesPerLine = image.bytesPerLine;
+ const __m256i vbpl = _mm256_set1_epi16(bytesPerLine/4);
+
+ while (b < boundedEnd - 7) {
+ const __m256i vy = _mm256_packs_epi32(_mm256_srli_epi32(v_fy, 16), _mm256_setzero_si256());
+ // 8x16bit * 8x16bit -> 8x32bit
+ __m256i offset = _mm256_unpacklo_epi16(_mm256_mullo_epi16(vy, vbpl), _mm256_mulhi_epi16(vy, vbpl));
+ offset = _mm256_add_epi32(offset, _mm256_srli_epi32(v_fx, 16));
+ const __m128i offsetLo = _mm256_castsi256_si128(offset);
+ const __m128i offsetHi = _mm256_extracti128_si256(offset, 1);
+ const uint *topData = (const uint *)(textureData);
+ const uint *botData = (const uint *)(textureData + bytesPerLine);
+ const __m256i toplo = _mm256_i32gather_epi64((const long long *)topData, offsetLo, 4);
+ const __m256i tophi = _mm256_i32gather_epi64((const long long *)topData, offsetHi, 4);
+ const __m256i botlo = _mm256_i32gather_epi64((const long long *)botData, offsetLo, 4);
+ const __m256i bothi = _mm256_i32gather_epi64((const long long *)botData, offsetHi, 4);
+
+ __m256i v_distx = _mm256_srli_epi16(v_fx, 8);
+ __m256i v_disty = _mm256_srli_epi16(v_fy, 8);
+ v_distx = _mm256_srli_epi16(_mm256_add_epi32(v_distx, v_fxy_r), 4);
+ v_disty = _mm256_srli_epi16(_mm256_add_epi32(v_disty, v_fxy_r), 4);
+ v_distx = _mm256_shuffle_epi8(v_distx, vdistShuffle);
+ v_disty = _mm256_shuffle_epi8(v_disty, vdistShuffle);
+
+ interpolate_4_pixels_16_avx2(toplo, tophi, botlo, bothi, v_distx, v_disty, colorMask, v_256, b);
+ b += 8;
+ v_fx = _mm256_add_epi32(v_fx, v_fdx);
+ v_fy = _mm256_add_epi32(v_fy, v_fdy);
+ }
+ fx = _mm_extract_epi32(_mm256_castsi256_si128(v_fx) , 0);
+ fy = _mm_extract_epi32(_mm256_castsi256_si128(v_fy) , 0);
+
+ while (b < boundedEnd) {
+ int x = (fx >> 16);
+ int y = (fy >> 16);
+
+ const uint *s1 = (const uint *)image.scanLine(y);
+ const uint *s2 = (const uint *)image.scanLine(y + 1);
+
+ int distx = (fx & 0x0000ffff) >> 8;
+ int disty = (fy & 0x0000ffff) >> 8;
+ *b = interpolate_4_pixels(s1 + x, s2 + x, distx, disty);
+
+ fx += fdx;
+ fy += fdy;
+ ++b;
+ }
+
+ while (b < end) {
+ int x1 = (fx >> 16);
+ int x2;
+ int y1 = (fy >> 16);
+ int y2;
+
+ fetchTransformedBilinear_pixelBounds(image.width, image.x1, image.x2 - 1, x1, x2);
+ fetchTransformedBilinear_pixelBounds(image.height, image.y1, image.y2 - 1, y1, y2);
+
+ const uint *s1 = (const uint *)image.scanLine(y1);
+ const uint *s2 = (const uint *)image.scanLine(y2);
+
+ uint tl = s1[x1];
+ uint tr = s1[x2];
+ uint bl = s2[x1];
+ uint br = s2[x2];
+
+ int distx = (fx & 0x0000ffff) >> 8;
+ int disty = (fy & 0x0000ffff) >> 8;
+ *b = interpolate_4_pixels(tl, tr, bl, br, distx, disty);
+
+ fx += fdx;
+ fy += fdy;
+ ++b;
+ }
+}
+
QT_END_NAMESPACE
#endif
diff --git a/src/network/access/qhsts.cpp b/src/network/access/qhsts.cpp
index 3581fbc796..ca9f3b977b 100644
--- a/src/network/access/qhsts.cpp
+++ b/src/network/access/qhsts.cpp
@@ -110,7 +110,11 @@ void QHstsCache::updateKnownHost(const QString &host, const QDateTime &expires,
// IDNA 2003 (RFC3490) for us, as required by HSTS (RFC6797, section 10).
const HostName hostName(host);
const auto pos = knownHosts.find(hostName);
- const QHstsPolicy newPolicy(expires, includeSubDomains, hostName.name);
+ QHstsPolicy::PolicyFlags flags;
+ if (includeSubDomains)
+ flags = QHstsPolicy::IncludeSubDomains;
+
+ const QHstsPolicy newPolicy(expires, flags, hostName.name);
if (pos == knownHosts.end()) {
// A new, previously unknown host.
if (newPolicy.isExpired()) {
diff --git a/src/network/access/qhstspolicy.cpp b/src/network/access/qhstspolicy.cpp
index 634bf4784b..0ea9f3f046 100644
--- a/src/network/access/qhstspolicy.cpp
+++ b/src/network/access/qhstspolicy.cpp
@@ -63,6 +63,14 @@ QT_BEGIN_NAMESPACE
\sa QNetworkAccessManager::setStrictTransportSecurityEnabled()
*/
+/*
+ \enum QHstsPolicy::PolicyFlag
+
+ Specifies attributes that a policy can have.
+
+ \value IncludeSubDomains HSTS policy also applies to subdomains.
+*/
+
class QHstsPolicyPrivate : public QSharedData
{
public:
@@ -101,13 +109,13 @@ QHstsPolicy::QHstsPolicy() : d(new QHstsPolicyPrivate)
\sa QUrl::setHost(), QUrl::ParsingMode
*/
-QHstsPolicy::QHstsPolicy(const QDateTime &expiry, bool includeSubDomains, const QString &host,
- QUrl::ParsingMode mode)
+QHstsPolicy::QHstsPolicy(const QDateTime &expiry, PolicyFlags flags,
+ const QString &host, QUrl::ParsingMode mode)
: d(new QHstsPolicyPrivate)
{
d->url.setHost(host, mode);
d->expiry = expiry;
- d->includeSubDomains = includeSubDomains;
+ d->includeSubDomains = flags.testFlag(IncludeSubDomains);
}
/*!
diff --git a/src/network/access/qhstspolicy.h b/src/network/access/qhstspolicy.h
index 45fa40dfe8..176a8fa635 100644
--- a/src/network/access/qhstspolicy.h
+++ b/src/network/access/qhstspolicy.h
@@ -43,6 +43,7 @@
#include <QtNetwork/qtnetworkglobal.h>
#include <QtCore/qshareddata.h>
+#include <QtCore/qflags.h>
#include <QtCore/qurl.h>
QT_BEGIN_NAMESPACE
@@ -53,10 +54,15 @@ class QString;
class Q_NETWORK_EXPORT QHstsPolicy
{
public:
+ enum PolicyFlag
+ {
+ IncludeSubDomains = 1
+ };
+ Q_DECLARE_FLAGS(PolicyFlags, PolicyFlag)
QHstsPolicy();
- explicit QHstsPolicy(const QDateTime &expiry, bool includeSubDomains, const QString &host,
- QUrl::ParsingMode mode = QUrl::DecodedMode);
+ QHstsPolicy(const QDateTime &expiry, PolicyFlags flags, const QString &host,
+ QUrl::ParsingMode mode = QUrl::DecodedMode);
QHstsPolicy(const QHstsPolicy &rhs);
QHstsPolicy &operator=(const QHstsPolicy &rhs);
QHstsPolicy &operator=(QHstsPolicy &&other) Q_DECL_NOTHROW { swap(other); return *this; }
@@ -81,6 +87,7 @@ private:
};
Q_DECLARE_SHARED(QHstsPolicy)
+Q_DECLARE_OPERATORS_FOR_FLAGS(QHstsPolicy::PolicyFlags)
Q_NETWORK_EXPORT bool operator==(const QHstsPolicy &lhs, const QHstsPolicy &rhs);
diff --git a/src/network/doc/snippets/code/src_network_socket_qsctpsocket.cpp b/src/network/doc/snippets/code/src_network_socket_qsctpsocket.cpp
index 378022d655..ac181f950c 100644
--- a/src/network/doc/snippets/code/src_network_socket_qsctpsocket.cpp
+++ b/src/network/doc/snippets/code/src_network_socket_qsctpsocket.cpp
@@ -6,7 +6,17 @@
** This file is part of the documentation of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:BSD$
-** You may use this file under the terms of the BSD license as follows:
+** 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 https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
**
** "Redistribution and use in source and binary forms, with or without
** modification, are permitted provided that the following conditions are
diff --git a/src/plugins/generic/bsdkeyboard/main.cpp b/src/plugins/generic/bsdkeyboard/main.cpp
index f48af0ae28..b65d500230 100644
--- a/src/plugins/generic/bsdkeyboard/main.cpp
+++ b/src/plugins/generic/bsdkeyboard/main.cpp
@@ -3,29 +3,35 @@
** Copyright (C) 2015-2016 Oleksandr Tymoshenko <gonzo@bluezbox.com>
** Contact: https://www.qt.io/licensing/
**
-** This file is part of the QtGui module of the Qt Toolkit.
+** This file is part of the plugins of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL21$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 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.
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.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.
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
diff --git a/src/plugins/generic/bsdkeyboard/qbsdkeyboard.cpp b/src/plugins/generic/bsdkeyboard/qbsdkeyboard.cpp
index 6f34d066c6..784ec54542 100644
--- a/src/plugins/generic/bsdkeyboard/qbsdkeyboard.cpp
+++ b/src/plugins/generic/bsdkeyboard/qbsdkeyboard.cpp
@@ -3,29 +3,35 @@
** Copyright (C) 2015-2016 Oleksandr Tymoshenko <gonzo@bluezbox.com>
** Contact: https://www.qt.io/licensing/
**
-** This file is part of the QtGui module of the Qt Toolkit.
+** This file is part of the plugins of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL21$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 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.
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.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.
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
diff --git a/src/plugins/generic/bsdkeyboard/qbsdkeyboard.h b/src/plugins/generic/bsdkeyboard/qbsdkeyboard.h
index 1a7cbc1f9a..46d8988d3a 100644
--- a/src/plugins/generic/bsdkeyboard/qbsdkeyboard.h
+++ b/src/plugins/generic/bsdkeyboard/qbsdkeyboard.h
@@ -3,29 +3,35 @@
** Copyright (C) 2015-2016 Oleksandr Tymoshenko <gonzo@bluezbox.com>
** Contact: https://www.qt.io/licensing/
**
-** This file is part of the QtGui module of the Qt Toolkit.
+** This file is part of the plugins of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL21$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 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.
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.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.
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
diff --git a/src/plugins/generic/bsdkeyboard/qbsdkeyboard_defaultmap.h b/src/plugins/generic/bsdkeyboard/qbsdkeyboard_defaultmap.h
index 45cf5944bc..69c03b3daf 100644
--- a/src/plugins/generic/bsdkeyboard/qbsdkeyboard_defaultmap.h
+++ b/src/plugins/generic/bsdkeyboard/qbsdkeyboard_defaultmap.h
@@ -1,32 +1,38 @@
/****************************************************************************
**
-** Copyright (C) 2015 The Qt Company Ltd.
+** Copyright (C) 2017 The Qt Company Ltd.
** Copyright (C) 2015-2016 Oleksandr Tymoshenko <gonzo@bluezbox.com>
-** Contact: http://www.qt.io/licensing/
+** Contact: https://www.qt.io/licensing/
**
-** This file is part of the QtGui module of the Qt Toolkit.
+** This file is part of the plugins of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL21$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 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.
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.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.
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
diff --git a/src/plugins/generic/bsdmouse/main.cpp b/src/plugins/generic/bsdmouse/main.cpp
index 4abc7609c1..d676d5a1bb 100644
--- a/src/plugins/generic/bsdmouse/main.cpp
+++ b/src/plugins/generic/bsdmouse/main.cpp
@@ -1,31 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2015-2016 Oleksandr Tymoshenko <gonzo@bluezbox.com>
-** Contact: http://www.qt.io/licensing/
+** Contact: https://www.qt.io/licensing/
**
-** This file is part of the QtGui module of the Qt Toolkit.
+** This file is part of the plugins of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL21$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 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.
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.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.
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
diff --git a/src/plugins/generic/bsdmouse/qbsdmouse.cpp b/src/plugins/generic/bsdmouse/qbsdmouse.cpp
index 4875fd96bd..55905199b8 100644
--- a/src/plugins/generic/bsdmouse/qbsdmouse.cpp
+++ b/src/plugins/generic/bsdmouse/qbsdmouse.cpp
@@ -1,31 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2015-2016 Oleksandr Tymoshenko <gonzo@bluezbox.com>
-** Contact: http://www.qt.io/licensing/
+** Contact: https://www.qt.io/licensing/
**
-** This file is part of the QtGui module of the Qt Toolkit.
+** This file is part of the plugins of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL21$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 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.
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.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.
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
diff --git a/src/plugins/generic/bsdmouse/qbsdmouse.h b/src/plugins/generic/bsdmouse/qbsdmouse.h
index 9a4cb8dd82..724b9c8484 100644
--- a/src/plugins/generic/bsdmouse/qbsdmouse.h
+++ b/src/plugins/generic/bsdmouse/qbsdmouse.h
@@ -1,31 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2015-2016 Oleksandr Tymoshenko <gonzo@bluezbox.com>
-** Contact: http://www.qt.io/licensing/
+** Contact: https://www.qt.io/licensing/
**
-** This file is part of the QtGui module of the Qt Toolkit.
+** This file is part of the plugins of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL21$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 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.
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.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.
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
diff --git a/src/plugins/generic/generic.pro b/src/plugins/generic/generic.pro
index 996e57d015..e323f32d2c 100644
--- a/src/plugins/generic/generic.pro
+++ b/src/plugins/generic/generic.pro
@@ -2,7 +2,9 @@ TEMPLATE = subdirs
QT_FOR_CONFIG += gui-private network-private
qtConfig(evdev) {
- SUBDIRS += evdevmouse evdevtouch evdevkeyboard evdevtablet
+ SUBDIRS += evdevmouse evdevtouch evdevkeyboard
+ qtConfig(tabletevent): \
+ SUBDIRS += evdevtablet
}
qtConfig(tslib) {
diff --git a/src/plugins/platforms/eglfs/api/qeglfscursor_p.h b/src/plugins/platforms/eglfs/api/qeglfscursor_p.h
index 942fb09aac..aaeb83cb99 100644
--- a/src/plugins/platforms/eglfs/api/qeglfscursor_p.h
+++ b/src/plugins/platforms/eglfs/api/qeglfscursor_p.h
@@ -79,7 +79,10 @@ private:
QEglFSCursor *m_cursor;
};
-class Q_EGLFS_EXPORT QEglFSCursor : public QPlatformCursor, protected QOpenGLFunctions
+#if QT_CONFIG(opengl)
+
+class Q_EGLFS_EXPORT QEglFSCursor : public QPlatformCursor
+ , protected QOpenGLFunctions
{
Q_OBJECT
public:
@@ -153,6 +156,7 @@ private:
};
QHash<QOpenGLContext *, GraphicsContextData> m_gfx;
};
+#endif // QT_CONFIG(opengl)
QT_END_NAMESPACE
diff --git a/src/plugins/platforms/eglfs/deviceintegration/deviceintegration.pro b/src/plugins/platforms/eglfs/deviceintegration/deviceintegration.pro
index aca0078bfb..6d759938b5 100644
--- a/src/plugins/platforms/eglfs/deviceintegration/deviceintegration.pro
+++ b/src/plugins/platforms/eglfs/deviceintegration/deviceintegration.pro
@@ -9,7 +9,7 @@ qtConfig(eglfs_mali): SUBDIRS += eglfs_mali
qtConfig(eglfs_viv): SUBDIRS += eglfs_viv
qtConfig(eglfs_viv_wl): SUBDIRS += eglfs_viv_wl
-SUBDIRS += eglfs_emu
+qtConfig(opengl): SUBDIRS += eglfs_emu
eglfs_kms_egldevice.depends = eglfs_kms_support
eglfs_kms.depends = eglfs_kms_support
diff --git a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/qeglfskmsgbmintegration.cpp b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/qeglfskmsgbmintegration.cpp
index 16767114ab..b6cdcf92b6 100644
--- a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/qeglfskmsgbmintegration.cpp
+++ b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/qeglfskmsgbmintegration.cpp
@@ -105,12 +105,13 @@ void QEglFSKmsGbmIntegration::destroyNativeWindow(EGLNativeWindowType window)
QPlatformCursor *QEglFSKmsGbmIntegration::createCursor(QPlatformScreen *screen) const
{
- if (screenConfig()->hwCursor()) {
- return nullptr;
- } else {
+#if QT_CONFIG(opengl)
+ if (!screenConfig()->hwCursor()) {
qCDebug(qLcEglfsKmsDebug, "Using plain OpenGL mouse cursor");
return new QEglFSCursor(screen);
}
+#endif
+ return nullptr;
}
void QEglFSKmsGbmIntegration::presentBuffer(QPlatformSurface *surface)
diff --git a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_egldevice/qeglfskmsegldevice.cpp b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_egldevice/qeglfskmsegldevice.cpp
index f0bf59466e..0a66a897a1 100644
--- a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_egldevice/qeglfskmsegldevice.cpp
+++ b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_egldevice/qeglfskmsegldevice.cpp
@@ -85,12 +85,12 @@ EGLNativeDisplayType QEglFSKmsEglDevice::nativeDisplay() const
QPlatformScreen *QEglFSKmsEglDevice::createScreen(const QKmsOutput &output)
{
QEglFSKmsScreen *screen = new QEglFSKmsEglDeviceScreen(this, output);
-
+#if QT_CONFIG(opengl)
if (!m_globalCursor && !screenConfig()->separateScreens()) {
qCDebug(qLcEglfsKmsDebug, "Creating new global mouse cursor");
m_globalCursor = new QEglFSCursor(screen);
}
-
+#endif
return screen;
}
diff --git a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_egldevice/qeglfskmsegldeviceintegration.cpp b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_egldevice/qeglfskmsegldeviceintegration.cpp
index 3e333fc25a..43bdb77a18 100644
--- a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_egldevice/qeglfskmsegldeviceintegration.cpp
+++ b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_egldevice/qeglfskmsegldeviceintegration.cpp
@@ -280,7 +280,11 @@ bool QEglFSKmsEglDeviceIntegration::query_egl_device()
QPlatformCursor *QEglFSKmsEglDeviceIntegration::createCursor(QPlatformScreen *screen) const
{
- return screenConfig()->separateScreens() ? new QEglFSCursor(screen) : nullptr;
+#if QT_CONFIG(opengl)
+ if (screenConfig()->separateScreens())
+ return new QEglFSCursor(screen);
+#endif
+ return nullptr;
}
QT_END_NAMESPACE
diff --git a/src/plugins/platforms/platforms.pro b/src/plugins/platforms/platforms.pro
index 2a6e059243..9ccc2b54b9 100644
--- a/src/plugins/platforms/platforms.pro
+++ b/src/plugins/platforms/platforms.pro
@@ -36,7 +36,7 @@ qtConfig(directfb) {
qtConfig(linuxfb): SUBDIRS += linuxfb
-unix:!android:!darwin: SUBDIRS += vnc
+qtConfig(vnc): SUBDIRS += vnc
freebsd {
SUBDIRS += bsdfb
diff --git a/src/plugins/platforms/vnc/qvnc.cpp b/src/plugins/platforms/vnc/qvnc.cpp
index a45bb1c19c..fa65e8c9a4 100644
--- a/src/plugins/platforms/vnc/qvnc.cpp
+++ b/src/plugins/platforms/vnc/qvnc.cpp
@@ -531,13 +531,12 @@ void QRfbRawEncoder::write()
socket->flush();
}
+#if QT_CONFIG(cursor)
QVncClientCursor::QVncClientCursor()
{
-#ifndef QT_NO_CURSOR
QWindow *w = QGuiApplication::focusWindow();
QCursor c = w ? w->cursor() : QCursor(Qt::ArrowCursor);
changeCursor(&c, 0);
-#endif
}
QVncClientCursor::~QVncClientCursor()
@@ -587,7 +586,6 @@ void QVncClientCursor::write(QVncClient *client) const
void QVncClientCursor::changeCursor(QCursor *widgetCursor, QWindow *window)
{
Q_UNUSED(window);
-#ifndef QT_NO_CURSOR
const Qt::CursorShape shape = widgetCursor ? widgetCursor->shape() : Qt::ArrowCursor;
if (shape == Qt::BitmapCursor) {
@@ -601,9 +599,6 @@ void QVncClientCursor::changeCursor(QCursor *widgetCursor, QWindow *window)
cursor = *platformImage.image();
hotspot = platformImage.hotspot();
}
-#else // !QT_NO_CURSOR
- Q_UNUSED(widgetCursor);
-#endif
for (auto client : clients)
client->setDirtyCursor();
}
@@ -619,6 +614,7 @@ uint QVncClientCursor::removeClient(QVncClient *client)
clients.removeOne(client);
return clients.count();
}
+#endif // QT_CONFIG(cursor)
QVncServer::QVncServer(QVncScreen *screen, quint16 port)
: qvnc_screen(screen)
diff --git a/src/plugins/platforms/vnc/qvnc_p.h b/src/plugins/platforms/vnc/qvnc_p.h
index e58b6ae056..338fae9f87 100644
--- a/src/plugins/platforms/vnc/qvnc_p.h
+++ b/src/plugins/platforms/vnc/qvnc_p.h
@@ -364,6 +364,7 @@ private:
friend class QRfbMultiColorHextile<SRC>;
};
+#if QT_CONFIG(cursor)
class QVncClientCursor : public QPlatformCursor
{
public:
@@ -381,7 +382,7 @@ public:
QPoint hotspot;
QVector<QVncClient *> clients;
};
-
+#endif // QT_CONFIG(cursor)
class QVncServer : public QObject
{
diff --git a/src/plugins/platforms/vnc/qvncclient.cpp b/src/plugins/platforms/vnc/qvncclient.cpp
index 58dcfc9b51..9dfe873927 100644
--- a/src/plugins/platforms/vnc/qvncclient.cpp
+++ b/src/plugins/platforms/vnc/qvncclient.cpp
@@ -425,14 +425,14 @@ void QVncClient::checkUpdate()
{
if (!m_wantUpdate)
return;
-
+#if QT_CONFIG(cursor)
if (m_dirtyCursor) {
m_server->screen()->clientCursor->write(this);
m_dirtyCursor = false;
m_wantUpdate = false;
return;
}
-
+#endif
if (!m_dirtyRegion.isEmpty()) {
if (m_encoder)
m_encoder->write();
diff --git a/src/plugins/platforms/vnc/qvncscreen.cpp b/src/plugins/platforms/vnc/qvncscreen.cpp
index 75c8bedff7..cd43ce4e69 100644
--- a/src/plugins/platforms/vnc/qvncscreen.cpp
+++ b/src/plugins/platforms/vnc/qvncscreen.cpp
@@ -58,8 +58,10 @@ QVncScreen::QVncScreen(const QStringList &args)
QVncScreen::~QVncScreen()
{
+#if QT_CONFIG(cursor)
if (clientCursor)
delete clientCursor;
+#endif
}
bool QVncScreen::initialize()
@@ -120,17 +122,21 @@ QRegion QVncScreen::doRedraw()
return touched;
}
+
void QVncScreen::enableClientCursor(QVncClient *client)
{
+#if QT_CONFIG(cursor)
delete mCursor;
mCursor = nullptr;
if (!clientCursor)
clientCursor = new QVncClientCursor();
clientCursor->addClient(client);
+#endif
}
void QVncScreen::disableClientCursor(QVncClient *client)
{
+#if QT_CONFIG(cursor)
uint clientCount = clientCursor->removeClient(client);
if (clientCount == 0) {
delete clientCursor;
@@ -138,11 +144,16 @@ void QVncScreen::disableClientCursor(QVncClient *client)
}
mCursor = new QFbCursor(this);
+#endif
}
QPlatformCursor *QVncScreen::cursor() const
{
+#if QT_CONFIG(cursor)
return mCursor ? static_cast<QPlatformCursor *>(mCursor) : static_cast<QPlatformCursor *>(clientCursor);
+#else
+ return nullptr;
+#endif
}
// grabWindow() grabs "from the screen" not from the backingstores.
diff --git a/src/plugins/platforms/vnc/qvncscreen.h b/src/plugins/platforms/vnc/qvncscreen.h
index b2dd89a2ed..e69aa90d41 100644
--- a/src/plugins/platforms/vnc/qvncscreen.h
+++ b/src/plugins/platforms/vnc/qvncscreen.h
@@ -86,7 +86,9 @@ public:
QRegion dirtyRegion;
int refreshRate = 30;
QVncServer *vncServer = 0;
+#if QT_CONFIG(cursor)
QVncClientCursor *clientCursor = 0;
+#endif
};
QT_END_NAMESPACE
diff --git a/src/plugins/platforms/windows/qwindowswindow.cpp b/src/plugins/platforms/windows/qwindowswindow.cpp
index 121fdaeabd..ea0ee52669 100644
--- a/src/plugins/platforms/windows/qwindowswindow.cpp
+++ b/src/plugins/platforms/windows/qwindowswindow.cpp
@@ -1767,10 +1767,9 @@ bool QWindowsWindow::isFullScreen_sys() const
const QWindow *w = window();
if (!w->isTopLevel())
return false;
- const QScreen *screen = w->screen();
- if (!screen)
- screen = QGuiApplication::primaryScreen();
- return screen && geometry_sys() == QHighDpi::toNativePixels(screen->geometry(), w);
+ QRect geometry = geometry_sys();
+ QPlatformScreen *screen = screenForGeometry(geometry);
+ return screen && geometry == QHighDpi::toNativePixels(screen->geometry(), screen);
}
/*!
@@ -1842,6 +1841,13 @@ void QWindowsWindow::setWindowState_sys(Qt::WindowState newState)
newStyle |= WS_VISIBLE;
setStyle(newStyle);
+ const QScreen *screen = window()->screen();
+ if (!screen)
+ screen = QGuiApplication::primaryScreen();
+ // That area of the virtual desktop might not be covered by a screen anymore.
+ if (!screen->geometry().intersects(m_savedFrameGeometry))
+ m_savedFrameGeometry.moveTo(screen->geometry().topLeft());
+
UINT swpf = SWP_FRAMECHANGED | SWP_NOZORDER | SWP_NOACTIVATE;
if (!m_savedFrameGeometry.isValid())
swpf |= SWP_NOSIZE | SWP_NOMOVE;
diff --git a/src/plugins/platforms/winrt/qwinrtdrag.cpp b/src/plugins/platforms/winrt/qwinrtdrag.cpp
index f23075f5ed..49a0f2c35b 100644
--- a/src/plugins/platforms/winrt/qwinrtdrag.cpp
+++ b/src/plugins/platforms/winrt/qwinrtdrag.cpp
@@ -504,6 +504,8 @@ static HRESULT qt_drop(IInspectable *sender, ABI::Windows::UI::Xaml::IDragEventA
class QtDragEventHandler##name : public IDragEventHandler \
{ \
public: \
+ virtual ~QtDragEventHandler##name() {\
+ }\
STDMETHODIMP Invoke(IInspectable *sender, \
ABI::Windows::UI::Xaml::IDragEventArgs *e) \
{ \
diff --git a/src/plugins/platforms/winrt/qwinrtscreen.cpp b/src/plugins/platforms/winrt/qwinrtscreen.cpp
index d9a9d3b20f..150fc8a25e 100644
--- a/src/plugins/platforms/winrt/qwinrtscreen.cpp
+++ b/src/plugins/platforms/winrt/qwinrtscreen.cpp
@@ -58,7 +58,7 @@
#include <functional>
#include <wrl.h>
#include <windows.system.h>
-#include <Windows.Applicationmodel.h>
+#include <Windows.ApplicationModel.h>
#include <Windows.ApplicationModel.core.h>
#include <windows.devices.input.h>
#include <windows.ui.h>
diff --git a/src/plugins/platforms/xcb/qxcbconnection_xi2.cpp b/src/plugins/platforms/xcb/qxcbconnection_xi2.cpp
index 4f976986bb..4b6642efee 100644
--- a/src/plugins/platforms/xcb/qxcbconnection_xi2.cpp
+++ b/src/plugins/platforms/xcb/qxcbconnection_xi2.cpp
@@ -42,6 +42,7 @@
#include "qxcbscreen.h"
#include "qxcbwindow.h"
#include "qtouchdevice.h"
+#include "QtCore/qmetaobject.h"
#include <qpa/qwindowsysteminterface_p.h>
#include <QDebug>
#include <cmath>
@@ -208,6 +209,8 @@ void QXcbConnection::xi2SetupDevices()
isTablet = true;
tabletData.pointerType = QTabletEvent::Cursor;
dbgType = QLatin1String("cursor");
+ } else if (name.contains("wacom") && name.contains("finger touch")) {
+ isTablet = false;
} else if ((name.contains("pen") || name.contains("stylus")) && isTablet) {
tabletData.pointerType = QTabletEvent::Pen;
dbgType = QLatin1String("pen");
@@ -1107,6 +1110,18 @@ static QTabletEvent::TabletDevice toolIdToTabletDevice(quint32 toolId) {
return QTabletEvent::Stylus; // Safe default assumption if nonzero
}
+static const char *toolName(QTabletEvent::TabletDevice tool) {
+ static const QMetaObject *metaObject = qt_getEnumMetaObject(tool);
+ static const QMetaEnum me = metaObject->enumerator(metaObject->indexOfEnumerator(qt_getEnumName(tool)));
+ return me.valueToKey(tool);
+}
+
+static const char *pointerTypeName(QTabletEvent::PointerType ptype) {
+ static const QMetaObject *metaObject = qt_getEnumMetaObject(ptype);
+ static const QMetaEnum me = metaObject->enumerator(metaObject->indexOfEnumerator(qt_getEnumName(ptype)));
+ return me.valueToKey(ptype);
+}
+
bool QXcbConnection::xi2HandleTabletEvent(const void *event, TabletData *tabletData)
{
bool handled = true;
@@ -1180,9 +1195,9 @@ bool QXcbConnection::xi2HandleTabletEvent(const void *event, TabletData *tabletD
// TODO maybe have a hash of tabletData->deviceId to device data so we can
// look up the tablet name here, and distinguish multiple tablets
if (Q_UNLIKELY(lcQpaXInputEvents().isDebugEnabled()))
- qCDebug(lcQpaXInputEvents, "XI2 proximity change on tablet %d (USB %x): last tool: %x id %x current tool: %x id %x TabletDevice %d",
+ qCDebug(lcQpaXInputEvents, "XI2 proximity change on tablet %d (USB %x): last tool: %x id %x current tool: %x id %x %s",
tabletData->deviceId, ptr[_WACSER_USB_ID], ptr[_WACSER_LAST_TOOL_SERIAL], ptr[_WACSER_LAST_TOOL_ID],
- ptr[_WACSER_TOOL_SERIAL], ptr[_WACSER_TOOL_ID], tabletData->tool);
+ ptr[_WACSER_TOOL_SERIAL], ptr[_WACSER_TOOL_ID], toolName(tabletData->tool));
}
XFree(data);
}
@@ -1245,9 +1260,10 @@ void QXcbConnection::xi2ReportTabletEvent(const void *event, TabletData *tabletD
}
if (Q_UNLIKELY(lcQpaXInputEvents().isDebugEnabled()))
- qCDebug(lcQpaXInputEvents, "XI2 event on tablet %d with tool %d type %d seq %d detail %d time %d "
+ qCDebug(lcQpaXInputEvents, "XI2 event on tablet %d with tool %s type %s seq %d detail %d time %d "
"pos %6.1f, %6.1f root pos %6.1f, %6.1f buttons 0x%x pressure %4.2lf tilt %d, %d rotation %6.2lf",
- tabletData->deviceId, tabletData->tool, ev->evtype, ev->sequenceNumber, ev->detail, ev->time,
+ tabletData->deviceId, toolName(tabletData->tool), pointerTypeName(tabletData->pointerType),
+ ev->sequenceNumber, ev->detail, ev->time,
fixed1616ToReal(ev->event_x), fixed1616ToReal(ev->event_y),
fixed1616ToReal(ev->root_x), fixed1616ToReal(ev->root_y),
(int)tabletData->buttons, pressure, xTilt, yTilt, rotation);
diff --git a/src/plugins/platformthemes/gtk3/qgtk3menu.cpp b/src/plugins/platformthemes/gtk3/qgtk3menu.cpp
index 52757587b4..38c2d251b4 100644
--- a/src/plugins/platformthemes/gtk3/qgtk3menu.cpp
+++ b/src/plugins/platformthemes/gtk3/qgtk3menu.cpp
@@ -1,31 +1,37 @@
/****************************************************************************
**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
+** Copyright (C) 2017 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
**
-** This file is part of the plugins of the Qt Toolkit.
+** This file is part of the QtGui module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL21$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 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.
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.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.
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
diff --git a/src/plugins/platformthemes/gtk3/qgtk3menu.h b/src/plugins/platformthemes/gtk3/qgtk3menu.h
index 21e6178ec4..b43f363fa4 100644
--- a/src/plugins/platformthemes/gtk3/qgtk3menu.h
+++ b/src/plugins/platformthemes/gtk3/qgtk3menu.h
@@ -1,31 +1,37 @@
/****************************************************************************
**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
+** Copyright (C) 2017 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the plugins of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL21$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 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.
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.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.
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
diff --git a/src/printsupport/configure.json b/src/printsupport/configure.json
index dfef0bcd6c..93d345840f 100644
--- a/src/printsupport/configure.json
+++ b/src/printsupport/configure.json
@@ -28,13 +28,20 @@
"label": "CUPS",
"purpose": "Provides support for the Common Unix Printing System.",
"section": "Painting",
- "condition": "libs.cups && features.printer",
+ "condition": "libs.cups && features.printer && features.datestring",
"output": [ "privateFeature", "feature" ]
},
"cupsjobwidget": {
"label": "CUPS job control widget",
"section": "Widgets",
- "condition": "features.cups && features.calendarwidget && features.datetimeedit && features.groupbox && features.combobox",
+ "condition": [
+ "features.calendarwidget",
+ "features.checkbox",
+ "features.combobox",
+ "features.cups",
+ "features.datetimeedit",
+ "features.groupbox"
+ ],
"output": [ "privateFeature", "feature" ]
},
"printer": {
@@ -55,14 +62,25 @@
"label": "QPrintDialog",
"purpose": "Provides a dialog widget for specifying printer configuration.",
"section": "Dialogs",
- "condition": "features.printer && features.combobox && features.buttongroup && features.spinbox && features.treeview && features.tabwidget && features.datetimeedit",
+ "condition": [
+ "features.buttongroup",
+ "features.checkbox",
+ "features.combobox",
+ "features.datetimeedit",
+ "features.dialogbuttonbox",
+ "features.printer",
+ "features.radiobutton",
+ "features.spinbox",
+ "features.tabwidget",
+ "features.treeview"
+ ],
"output": [ "publicFeature", "feature" ]
},
"printpreviewdialog": {
"label": "QPrintPreviewDialog",
"purpose": "Provides a dialog for previewing and configuring page layouts for printer output.",
"section": "Dialogs",
- "condition": "features.printpreviewwidget && features.printdialog && features.toolbar",
+ "condition": "features.printpreviewwidget && features.printdialog && features.toolbar && features.formlayout",
"output": [ "publicFeature", "feature" ]
}
},
diff --git a/src/printsupport/dialogs/qprintpreviewdialog.cpp b/src/printsupport/dialogs/qprintpreviewdialog.cpp
index c996e0d556..4bed0b6454 100644
--- a/src/printsupport/dialogs/qprintpreviewdialog.cpp
+++ b/src/printsupport/dialogs/qprintpreviewdialog.cpp
@@ -46,7 +46,6 @@
#include <QtWidgets/qaction.h>
#include <QtWidgets/qboxlayout.h>
#include <QtWidgets/qcombobox.h>
-#include <QtWidgets/qlabel.h>
#include <QtWidgets/qlineedit.h>
#include <QtPrintSupport/qpagesetupdialog.h>
#include <QtPrintSupport/qprinter.h>
@@ -56,11 +55,13 @@
#include <QtWidgets/qfiledialog.h>
#include <QtWidgets/qmainwindow.h>
#include <QtWidgets/qtoolbar.h>
-#include <QtWidgets/qformlayout.h>
#include <QtCore/QCoreApplication>
#ifndef QT_NO_PRINTPREVIEWDIALOG
+#include <QtWidgets/qformlayout.h>
+#include <QtWidgets/qlabel.h>
+
static void initResources()
{
static bool resourcesInitialized = false;
diff --git a/src/sql/configure.json b/src/sql/configure.json
index ff2409415b..e8d1fb6ce3 100644
--- a/src/sql/configure.json
+++ b/src/sql/configure.json
@@ -153,7 +153,7 @@
},
"sql-odbc": {
"label": "ODBC",
- "condition": "libs.odbc && features.textdate",
+ "condition": "libs.odbc && features.datestring",
"output": [ "publicFeature" ]
},
"sql-psql": {
@@ -168,7 +168,7 @@
},
"sql-sqlite": {
"label": "SQLite",
- "condition": "features.textdate",
+ "condition": "features.datestring",
"output": [ "publicFeature" ]
},
"system-sqlite": {
@@ -179,7 +179,7 @@
},
"sql-tds": {
"label": "TDS (Sybase)",
- "condition": "libs.tds && features.textdate",
+ "condition": "libs.tds && features.datestring",
"output": [ "publicFeature" ]
}
},
diff --git a/src/testlib/qtestutil_macos.mm b/src/testlib/qtestutil_macos.mm
index 852c9f75f2..70a7fb9f85 100644
--- a/src/testlib/qtestutil_macos.mm
+++ b/src/testlib/qtestutil_macos.mm
@@ -1,31 +1,37 @@
/****************************************************************************
**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
+** Copyright (C) 2017 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the QtTest module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL21$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 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.
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.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.
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
diff --git a/src/testlib/qtestutil_macos_p.h b/src/testlib/qtestutil_macos_p.h
index 85f9ace82f..d7cc5bc251 100644
--- a/src/testlib/qtestutil_macos_p.h
+++ b/src/testlib/qtestutil_macos_p.h
@@ -1,31 +1,37 @@
/****************************************************************************
**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
+** Copyright (C) 2017 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the QtTest module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL21$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 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.
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.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.
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
diff --git a/src/tools/moc/moc.cpp b/src/tools/moc/moc.cpp
index e2987f1be4..36d84a61d8 100644
--- a/src/tools/moc/moc.cpp
+++ b/src/tools/moc/moc.cpp
@@ -549,12 +549,20 @@ void Moc::parse()
case NAMESPACE: {
int rewind = index;
if (test(IDENTIFIER)) {
+ QByteArray nsName = lexem();
+ QByteArrayList nested;
+ while (test(SCOPE)) {
+ next(IDENTIFIER);
+ nested.append(nsName);
+ nsName = lexem();
+ }
if (test(EQ)) {
// namespace Foo = Bar::Baz;
until(SEMIC);
} else if (!test(SEMIC)) {
NamespaceDef def;
- def.classname = lexem();
+ def.classname = nsName;
+
next(LBRACE);
def.begin = index - 1;
until(RBRACE);
@@ -568,11 +576,23 @@ void Moc::parse()
def.qualified.prepend(namespaceList.at(i).classname + "::");
}
}
+ for (const QByteArray &ns : nested) {
+ NamespaceDef parentNs;
+ parentNs.classname = ns;
+ parentNs.qualified = def.qualified;
+ def.qualified += ns + "::";
+ parentNs.begin = def.begin;
+ parentNs.end = def.end;
+ namespaceList += parentNs;
+ }
}
+
while (parseNamespace && inNamespace(&def) && hasNext()) {
switch (next()) {
case NAMESPACE:
if (test(IDENTIFIER)) {
+ while (test(SCOPE))
+ next(IDENTIFIER);
if (test(EQ)) {
// namespace Foo = Bar::Baz;
until(SEMIC);
diff --git a/src/tools/moc/mwerks_mac.cpp b/src/tools/moc/mwerks_mac.cpp
deleted file mode 100644
index fe8bf680fb..0000000000
--- a/src/tools/moc/mwerks_mac.cpp
+++ /dev/null
@@ -1,227 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the tools applications of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL-EXCEPT$
-** 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 https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 as published by the Free Software
-** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifdef MOC_MWERKS_PLUGIN
-
-#include "mwerks_mac.h"
-#include "qt_mac.h"
-
-/* compiler headers */
-#include "DropInCompilerLinker.h"
-#include "CompilerMapping.h"
-#include "CWPluginErrors.h"
-
-/* standard headers */
-#include <stdio.h>
-#include <string.h>
-
-QT_BEGIN_NAMESPACE
-
-//qglobal.cpp
-const unsigned char * p_str(const char * c);
-QCString pstring2qstring(const unsigned char *c);
-
-#if CW_USE_PRAGMA_EXPORT
-#pragma export on
-#endif
-
-CWPLUGIN_ENTRY(CWPlugin_GetDropInFlags)(const DropInFlags** flags, long* flagsSize)
-{
- static const DropInFlags sFlags = {
- kCurrentDropInFlagsVersion,
- CWDROPINCOMPILERTYPE,
- DROPINCOMPILERLINKERAPIVERSION_7,
- kCompAlwaysReload|kCompRequiresProjectBuildStartedMsg,
- Lang_C_CPP,
- DROPINCOMPILERLINKERAPIVERSION
- };
- *flags = &sFlags;
- *flagsSize = sizeof(sFlags);
- return cwNoErr;
-}
-
-
-
-CWPLUGIN_ENTRY(CWPlugin_GetDropInName)(const char** dropinName)
-{
- static const char sDropInName[] = "McMoc";
- *dropinName = sDropInName;
- return cwNoErr;
-}
-
-CWPLUGIN_ENTRY(CWPlugin_GetDisplayName)(const char** displayName)
-{
- static const char sDisplayName[] = "McMoc";
- *displayName = sDisplayName;
- return cwNoErr;
-}
-
-CWPLUGIN_ENTRY(CWPlugin_GetTargetList)(const CWTargetList** targetList)
-{
- static CWDataType sCPU = targetCPUAny;
- static CWDataType sOS = targetOSMacintosh;
- static CWTargetList sTargetList = {kCurrentCWTargetListVersion, 1, &sCPU, 1, &sOS};
- *targetList = &sTargetList;
- return cwNoErr;
-}
-
-CWPLUGIN_ENTRY(CWPlugin_GetDefaultMappingList)(const CWExtMapList** defaultMappingList)
-{
- static CWExtensionMapping sExtension[] = { {'TEXT', ".mocs", kPrecompile } };
- static CWExtMapList sExtensionMapList = {kCurrentCWExtMapListVersion, 3, sExtension};
- *defaultMappingList = &sExtensionMapList;
- return cwNoErr;
-}
-
-#if CW_USE_PRAGMA_EXPORT
-#pragma export off
-#endif
-typedef short CWFileRef;
-
-static int line_count = 0;
-moc_status do_moc(CWPluginContext, const QCString &, const QCString &, CWFileSpec *, bool);
-
-static CWResult mocify(CWPluginContext context, const QCString &source)
-{
- CWDisplayLines(context, line_count++);
-
- source.stripWhiteSpace();
-
- CWResult err;
- bool dotmoc=false;
- QCString stem = source, ext;
- int dotpos = stem.findRev('.');
- if(dotpos != -1) {
- ext = stem.right(stem.length() - (dotpos+1));
- stem = stem.left(dotpos);
- if(ext == "cpp")
- dotmoc = true;
- } else {
- //whoa!
- }
- QCString dest;
- if(dotmoc)
- dest = stem + ".moc";
- else
- dest = "moc_" + stem + ".cpp";
-
- //moc it
- CWFileSpec destSpec;
- moc_status mocd = do_moc(context, source, dest, &destSpec, dotmoc);
-
-#if 0
- QCString derr = "Weird";
- switch(mocd) {
- case moc_success: derr = "Success"; break;
- case moc_parse_error: derr = "Parser Error"; break;
- case moc_no_qobject:derr = "No QOBJECT"; break;
- case moc_not_time: derr = "Not Time"; break;
- case moc_no_source: derr = "No Source"; break;
- case moc_general_error: derr = "General Error"; break;
- }
- char dmsg[200];
- sprintf(dmsg, "\"%s\" %s", source.data(), derr.data());
- CWReportMessage(context, NULL, dmsg, NULL, messagetypeError, 0);
-#endif
-
- //handle project
- if(mocd == moc_no_qobject) {
- char msg[400];
- sprintf(msg, "\"%s\" No relevant classes found. No output generated.", source.data());
- CWReportMessage(context, NULL, msg, NULL, messagetypeWarning, 0);
- } else if ((mocd == moc_success || mocd == moc_not_time) && !dotmoc)
- {
- long whichFile;
- CWNewProjectEntryInfo ei;
- memset(&ei, '\0', sizeof(ei));
- ei.groupPath = "QtGenerated";
- err = CWAddProjectEntry(context, &destSpec, true, &ei, &whichFile);
- if (!CWSUCCESS(err))
- {
- char msg[200];
- sprintf(msg, "\"%s\" not added", dest.data());
- CWReportMessage(context, NULL, msg, NULL, messagetypeWarning, 0);
- }
- if(mocd == moc_success)
- CWSetModDate(context, &destSpec, NULL, true);
- }
- return cwNoErr;
-}
-
-pascal short main(CWPluginContext context)
-{
- short result;
- long request;
-
- if (CWGetPluginRequest(context, &request) != cwNoErr)
- return cwErrRequestFailed;
- result = cwErrInvalidParameter;
-
- /* dispatch on compiler request */
- switch (request)
- {
- case reqInitCompiler:
- case reqTermCompiler:
- result = cwNoErr;
- break;
-
- case reqCompile:
- {
- line_count = 0;
- const char *files = NULL;
- long filelen;
- CWGetMainFileText(context, &files, &filelen);
- const char *beg = files;
- for(int x = 0; x < filelen; x++) {
- if(*(files++) == '\r') {
- char file[1024];
- memcpy(file, beg, files - beg);
- file[(files-beg)-1] = '\0';
- mocify(context, file);
- beg = files;
- }
- }
- if(beg != files) {
- char file[1024];
- memcpy(file, beg, files - beg);
- file[(files-beg)] = '\0';
- mocify(context, file);
- }
-
- result = cwNoErr;
- break;
- }
- }
-
- /* return result code */
- return result;
-}
-
-#endif
-
-QT_END_NAMESPACE
diff --git a/src/tools/moc/mwerks_mac.h b/src/tools/moc/mwerks_mac.h
deleted file mode 100644
index 9f6f074036..0000000000
--- a/src/tools/moc/mwerks_mac.h
+++ /dev/null
@@ -1,54 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the tools applications of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL-EXCEPT$
-** 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 https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 as published by the Free Software
-** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef MWERKS_MAC_H
-#define MWERKS_MAC_H
-
-#include <qglobal.h>
-
-QT_BEGIN_NAMESPACE
-
-#ifdef Q_OS_MAC
-
-#define macintosh
-
-/*make moc a plugin*/
-enum moc_status {
- moc_success = 1,
- moc_parse_error = 2,
- moc_no_qobject = 3,
- moc_not_time = 4,
- moc_no_source = 5,
- moc_general_error = 6
-};
-
-#endif
-
-QT_END_NAMESPACE
-
-#endif // MWERKS_MAC_H
diff --git a/src/tools/moc/preprocessor.cpp b/src/tools/moc/preprocessor.cpp
index f5639ffe31..32c94639ab 100644
--- a/src/tools/moc/preprocessor.cpp
+++ b/src/tools/moc/preprocessor.cpp
@@ -236,7 +236,7 @@ Symbols Preprocessor::tokenize(const QByteArray& input, int lineNum, Preprocesso
data -= 2;
break;
case DIGIT:
- while (is_digit_char(*data))
+ while (is_digit_char(*data) || *data == '\'')
++data;
if (!*data || *data != '.') {
token = INTEGER_LITERAL;
@@ -244,7 +244,7 @@ Symbols Preprocessor::tokenize(const QByteArray& input, int lineNum, Preprocesso
(*data == 'x' || *data == 'X')
&& *lexem == '0') {
++data;
- while (is_hex_char(*data))
+ while (is_hex_char(*data) || *data == '\'')
++data;
}
break;
@@ -253,13 +253,13 @@ Symbols Preprocessor::tokenize(const QByteArray& input, int lineNum, Preprocesso
++data;
Q_FALLTHROUGH();
case FLOATING_LITERAL:
- while (is_digit_char(*data))
+ while (is_digit_char(*data) || *data == '\'')
++data;
if (*data == '+' || *data == '-')
++data;
if (*data == 'e' || *data == 'E') {
++data;
- while (is_digit_char(*data))
+ while (is_digit_char(*data) || *data == '\'')
++data;
}
if (*data == 'f' || *data == 'F'
@@ -413,7 +413,7 @@ Symbols Preprocessor::tokenize(const QByteArray& input, int lineNum, Preprocesso
token = PP_CHARACTER_LITERAL;
break;
case PP_DIGIT:
- while (is_digit_char(*data))
+ while (is_digit_char(*data) || *data == '\'')
++data;
if (!*data || *data != '.') {
token = PP_INTEGER_LITERAL;
@@ -421,7 +421,7 @@ Symbols Preprocessor::tokenize(const QByteArray& input, int lineNum, Preprocesso
(*data == 'x' || *data == 'X')
&& *lexem == '0') {
++data;
- while (is_hex_char(*data))
+ while (is_hex_char(*data) || *data == '\'')
++data;
}
break;
@@ -430,13 +430,13 @@ Symbols Preprocessor::tokenize(const QByteArray& input, int lineNum, Preprocesso
++data;
Q_FALLTHROUGH();
case PP_FLOATING_LITERAL:
- while (is_digit_char(*data))
+ while (is_digit_char(*data) || *data == '\'')
++data;
if (*data == '+' || *data == '-')
++data;
if (*data == 'e' || *data == 'E') {
++data;
- while (is_digit_char(*data))
+ while (is_digit_char(*data) || *data == '\'')
++data;
}
if (*data == 'f' || *data == 'F'
diff --git a/src/tools/uic/cpp/cppwriteinitialization.cpp b/src/tools/uic/cpp/cppwriteinitialization.cpp
index 2b0d70eac6..301d6fdabb 100644
--- a/src/tools/uic/cpp/cppwriteinitialization.cpp
+++ b/src/tools/uic/cpp/cppwriteinitialization.cpp
@@ -1484,6 +1484,8 @@ void WriteInitialization::writeProperties(const QString &varName,
defineC = whatsThisDefineC;
else if (propertyName == QLatin1String("statusTip"))
defineC = statusTipDefineC;
+ else if (propertyName == QLatin1String("shortcut"))
+ defineC = shortcutDefineC;
else if (propertyName == QLatin1String("accessibleName") || propertyName == QLatin1String("accessibleDescription"))
defineC = accessibilityDefineC;
diff --git a/src/tools/uic/uic.pro b/src/tools/uic/uic.pro
index 9afb2d847f..02469cdd1b 100644
--- a/src/tools/uic/uic.pro
+++ b/src/tools/uic/uic.pro
@@ -1,5 +1,5 @@
option(host_build)
-!force_bootstrap:if(!qtConfig(commandlineparser)|!qtConfig(textcodec)): \
+!force_bootstrap:if(!qtConfig(commandlineparser)|!qtConfig(textcodec)|!qtConfig(xmlstreamreader)|!qtConfig(xmlstreamwriter)): \
CONFIG += force_bootstrap
DEFINES += QT_UIC QT_NO_CAST_FROM_ASCII QT_NO_FOREACH
diff --git a/src/widgets/accessible/qaccessiblewidget.cpp b/src/widgets/accessible/qaccessiblewidget.cpp
index 840a990799..94cf58ae3b 100644
--- a/src/widgets/accessible/qaccessiblewidget.cpp
+++ b/src/widgets/accessible/qaccessiblewidget.cpp
@@ -44,7 +44,9 @@
#include "qaction.h"
#include "qapplication.h"
#include "qgroupbox.h"
+#if QT_CONFIG(label)
#include "qlabel.h"
+#endif
#include "qtooltip.h"
#include "qwhatsthis.h"
#include "qwidget.h"
@@ -81,7 +83,7 @@ static QString buddyString(const QWidget *widget)
QWidget *parent = widget->parentWidget();
if (!parent)
return QString();
-#ifndef QT_NO_SHORTCUT
+#if QT_CONFIG(shortcut) && QT_CONFIG(label)
for (QObject *o : parent->children()) {
QLabel *label = qobject_cast<QLabel*>(o);
if (label && label->buddy() == widget)
@@ -309,7 +311,7 @@ QAccessibleWidget::relations(QAccessible::Relation match /*= QAccessible::AllRel
if (match & QAccessible::Label) {
const QAccessible::Relation rel = QAccessible::Label;
if (QWidget *parent = widget()->parentWidget()) {
-#ifndef QT_NO_SHORTCUT
+#if QT_CONFIG(shortcut) && QT_CONFIG(label)
// first check for all siblings that are labels to us
// ideally we would go through all objects and check, but that
// will be too expensive
diff --git a/src/widgets/accessible/qaccessiblewidgetfactory.cpp b/src/widgets/accessible/qaccessiblewidgetfactory.cpp
index da184fd90d..c95b5b1097 100644
--- a/src/widgets/accessible/qaccessiblewidgetfactory.cpp
+++ b/src/widgets/accessible/qaccessiblewidgetfactory.cpp
@@ -45,7 +45,6 @@
#include "complexwidgets_p.h"
#include "itemviews_p.h"
-#include <qpushbutton.h>
#include <qtoolbutton.h>
#include <qtreeview.h>
#include <qvariant.h>
@@ -184,8 +183,10 @@ QAccessibleInterface *qAccessibleFactory(const QString &classname, QObject *obje
} else if (classname == QLatin1String("QMdiSubWindow")) {
iface = new QAccessibleMdiSubWindow(widget);
#endif
+#if QT_CONFIG(dialogbuttonbox)
} else if (classname == QLatin1String("QDialogButtonBox")) {
iface = new QAccessibleDialogButtonBox(widget);
+#endif
#ifndef QT_NO_DIAL
} else if (classname == QLatin1String("QDial")) {
iface = new QAccessibleDial(widget);
diff --git a/src/widgets/accessible/qaccessiblewidgets.cpp b/src/widgets/accessible/qaccessiblewidgets.cpp
index 4c48ecb465..40aca37f11 100644
--- a/src/widgets/accessible/qaccessiblewidgets.cpp
+++ b/src/widgets/accessible/qaccessiblewidgets.cpp
@@ -54,7 +54,9 @@
#include <QToolBox>
#include <QMdiArea>
#include <QMdiSubWindow>
+#if QT_CONFIG(dialogbuttonbox)
#include <QDialogButtonBox>
+#endif
#include <limits.h>
#include <QRubberBand>
#include <QTextBrowser>
@@ -480,7 +482,7 @@ QMdiSubWindow *QAccessibleMdiSubWindow::mdiSubWindow() const
}
#endif // QT_NO_MDIAREA
-#ifndef QT_NO_DIALOGBUTTONBOX
+#if QT_CONFIG(dialogbuttonbox)
// ======================= QAccessibleDialogButtonBox ======================
QAccessibleDialogButtonBox::QAccessibleDialogButtonBox(QWidget *widget)
: QAccessibleWidget(widget, QAccessible::Grouping)
@@ -488,7 +490,7 @@ QAccessibleDialogButtonBox::QAccessibleDialogButtonBox(QWidget *widget)
Q_ASSERT(qobject_cast<QDialogButtonBox*>(widget));
}
-#endif // QT_NO_DIALOGBUTTONBOX
+#endif // QT_CONFIG(dialogbuttonbox)
#if !defined(QT_NO_TEXTBROWSER) && !defined(QT_NO_CURSOR)
QAccessibleTextBrowser::QAccessibleTextBrowser(QWidget *widget)
diff --git a/src/widgets/accessible/qaccessiblewidgets_p.h b/src/widgets/accessible/qaccessiblewidgets_p.h
index 052958d4c7..4d945a2016 100644
--- a/src/widgets/accessible/qaccessiblewidgets_p.h
+++ b/src/widgets/accessible/qaccessiblewidgets_p.h
@@ -248,11 +248,13 @@ protected:
};
#endif // QT_NO_MDIAREA
+#if QT_CONFIG(dialogbuttonbox)
class QAccessibleDialogButtonBox : public QAccessibleWidget
{
public:
explicit QAccessibleDialogButtonBox(QWidget *widget);
};
+#endif
#if !defined(QT_NO_TEXTBROWSER) && !defined(QT_NO_CURSOR)
class QAccessibleTextBrowser : public QAccessibleTextEdit
diff --git a/src/widgets/accessible/simplewidgets.cpp b/src/widgets/accessible/simplewidgets.cpp
index a2805a2458..113172ff5a 100644
--- a/src/widgets/accessible/simplewidgets.cpp
+++ b/src/widgets/accessible/simplewidgets.cpp
@@ -40,14 +40,22 @@
#include "simplewidgets_p.h"
#include <qabstractbutton.h>
+#if QT_CONFIG(checkbox)
#include <qcheckbox.h>
+#endif
+#if QT_CONFIG(pushbutton)
#include <qpushbutton.h>
+#endif
#include <qprogressbar.h>
#include <qstatusbar.h>
+#if QT_CONFIG(radiobutton)
#include <qradiobutton.h>
+#endif
#include <qtoolbutton.h>
#include <qmenu.h>
+#if QT_CONFIG(label)
#include <qlabel.h>
+#endif
#include <qgroupbox.h>
#include <qlcdnumber.h>
#include <qlineedit.h>
@@ -109,7 +117,7 @@ QString QAccessibleButton::text(QAccessible::Text t) const
switch (t) {
case QAccessible::Accelerator:
{
-#ifndef QT_NO_SHORTCUT
+#if QT_CONFIG(shortcut) && QT_CONFIG(pushbutton)
QPushButton *pb = qobject_cast<QPushButton*>(object());
if (pb && pb->isDefault())
str = QKeySequence(Qt::Key_Enter).toString(QKeySequence::NativeText);
@@ -136,15 +144,20 @@ QAccessible::State QAccessibleButton::state() const
QAccessible::State state = QAccessibleWidget::state();
QAbstractButton *b = button();
+#if QT_CONFIG(checkbox)
QCheckBox *cb = qobject_cast<QCheckBox *>(b);
+#endif
if (b->isCheckable())
state.checkable = true;
if (b->isChecked())
state.checked = true;
+#if QT_CONFIG(checkbox)
else if (cb && cb->checkState() == Qt::PartiallyChecked)
state.checkStateMixed = true;
+#endif
if (b->isDown())
state.pressed = true;
+#if QT_CONFIG(pushbutton)
QPushButton *pb = qobject_cast<QPushButton*>(b);
if (pb) {
if (pb->isDefault())
@@ -154,6 +167,7 @@ QAccessible::State QAccessibleButton::state() const
state.hasPopup = true;
#endif
}
+#endif
return state;
}
@@ -164,17 +178,22 @@ QRect QAccessibleButton::rect() const
if (!ab->isVisible())
return QRect();
+#if QT_CONFIG(checkbox)
if (QCheckBox *cb = qobject_cast<QCheckBox *>(ab)) {
QPoint wpos = cb->mapToGlobal(QPoint(0, 0));
QStyleOptionButton opt;
cb->initStyleOption(&opt);
return cb->style()->subElementRect(QStyle::SE_CheckBoxClickRect, &opt, cb).translated(wpos);
- } else if (QRadioButton *rb = qobject_cast<QRadioButton *>(ab)) {
+ }
+#endif
+#if QT_CONFIG(radiobutton)
+ else if (QRadioButton *rb = qobject_cast<QRadioButton *>(ab)) {
QPoint wpos = rb->mapToGlobal(QPoint(0, 0));
QStyleOptionButton opt;
rb->initStyleOption(&opt);
return rb->style()->subElementRect(QStyle::SE_RadioButtonClickRect, &opt, rb).translated(wpos);
}
+#endif
return QAccessibleWidget::rect();
}
@@ -390,6 +409,7 @@ QAccessibleDisplay::QAccessibleDisplay(QWidget *w, QAccessible::Role role)
QAccessible::Role QAccessibleDisplay::role() const
{
+#if QT_CONFIG(label)
QLabel *l = qobject_cast<QLabel*>(object());
if (l) {
if (l->pixmap())
@@ -411,6 +431,7 @@ QAccessible::Role QAccessibleDisplay::role() const
return QAccessible::StatusBar;
#endif
}
+#endif
return QAccessibleWidget::role();
}
@@ -421,7 +442,9 @@ QString QAccessibleDisplay::text(QAccessible::Text t) const
case QAccessible::Name:
str = widget()->accessibleName();
if (str.isEmpty()) {
- if (qobject_cast<QLabel*>(object())) {
+ if (false) {
+#if QT_CONFIG(label)
+ } else if (qobject_cast<QLabel*>(object())) {
QLabel *label = qobject_cast<QLabel*>(object());
str = label->text();
#ifndef QT_NO_TEXTHTMLPARSER
@@ -436,6 +459,7 @@ QString QAccessibleDisplay::text(QAccessible::Text t) const
if (label->buddy())
str = qt_accStripAmp(str);
#endif
+#endif // QT_CONFIG(label)
#ifndef QT_NO_LCDNUMBER
} else if (qobject_cast<QLCDNumber*>(object())) {
QLCDNumber *l = qobject_cast<QLCDNumber*>(object());
@@ -470,7 +494,7 @@ QVector<QPair<QAccessibleInterface*, QAccessible::Relation> >
QAccessibleDisplay::relations(QAccessible::Relation match /* = QAccessible::AllRelations */) const
{
QVector<QPair<QAccessibleInterface*, QAccessible::Relation> > rels = QAccessibleWidget::relations(match);
-#ifndef QT_NO_SHORTCUT
+#if QT_CONFIG(shortcut) && QT_CONFIG(label)
if (match & QAccessible::Labelled) {
if (QLabel *label = qobject_cast<QLabel*>(object())) {
const QAccessible::Relation rel = QAccessible::Labelled;
@@ -502,26 +526,34 @@ QString QAccessibleDisplay::imageDescription() const
/*! \internal */
QSize QAccessibleDisplay::imageSize() const
{
+#if QT_CONFIG(label)
QLabel *label = qobject_cast<QLabel *>(widget());
if (!label)
+#endif
return QSize();
+#if QT_CONFIG(label)
const QPixmap *pixmap = label->pixmap();
if (!pixmap)
return QSize();
return pixmap->size();
+#endif
}
/*! \internal */
QPoint QAccessibleDisplay::imagePosition() const
{
+#if QT_CONFIG(label)
QLabel *label = qobject_cast<QLabel *>(widget());
if (!label)
+#endif
return QPoint();
+#if QT_CONFIG(label)
const QPixmap *pixmap = label->pixmap();
if (!pixmap)
return QPoint();
return QPoint(label->mapToGlobal(label->pos()));
+#endif
}
#ifndef QT_NO_GROUPBOX
@@ -664,11 +696,13 @@ void QAccessibleLineEdit::setText(QAccessible::Text t, const QString &text)
}
QString newText = text;
+#if QT_CONFIG(validator)
if (lineEdit()->validator()) {
int pos = 0;
if (lineEdit()->validator()->validate(newText, pos) != QValidator::Acceptable)
return;
}
+#endif
lineEdit()->setText(newText);
}
diff --git a/src/widgets/configure.json b/src/widgets/configure.json
index 7bc2e06a32..99e1bd6940 100644
--- a/src/widgets/configure.json
+++ b/src/widgets/configure.json
@@ -117,6 +117,13 @@
"condition": "features.tableview",
"output": [ "publicFeature", "feature" ]
},
+ "commandlinkbutton": {
+ "label": "QCommandLinkButton",
+ "purpose": "Provides a Vista style command link button.",
+ "section": "Widgets",
+ "condition": "features.pushbutton",
+ "output": [ "publicFeature" ]
+ },
"datetimeedit": {
"label": "QDateTimeEdit",
"purpose": "Supports editing dates and times.",
@@ -150,6 +157,19 @@
"condition": "features.rubberband",
"output": [ "publicFeature", "feature" ]
},
+ "label": {
+ "label": "QLabel",
+ "purpose": "Provides a text or image display.",
+ "section": "Widgets",
+ "output": [ "publicFeature" ]
+ },
+ "formlayout": {
+ "label": "QFormLayout",
+ "purpose": "Manages forms of input widgets and their associated labels.",
+ "section": "Widgets",
+ "condition": "features.label",
+ "output": [ "publicFeature" ]
+ },
"lcdnumber": {
"label": "QLCDNumber",
"purpose": "Provides LCD-like digits.",
@@ -160,7 +180,7 @@
"label": "QMenu",
"purpose": "Provides popup-menus.",
"section": "Widgets",
- "condition": "features.action",
+ "condition": "features.action && features.pushbutton",
"output": [ "publicFeature", "feature" ]
},
"lineedit": {
@@ -169,6 +189,12 @@
"section": "Widgets",
"output": [ "publicFeature", "feature" ]
},
+ "radiobutton": {
+ "label": "QRadioButton",
+ "purpose": "Provides a radio button with a text label.",
+ "section": "Widgets",
+ "output": [ "publicFeature" ]
+ },
"spinbox": {
"label": "QSpinBox",
"purpose": "Provides spin boxes handling integers and discrete sets of values.",
@@ -204,6 +230,19 @@
"condition": "features.combobox && features.stringlistmodel",
"output": [ "publicFeature", "feature" ]
},
+ "checkbox": {
+ "label": "QCheckBox(",
+ "purpose": "Provides a checkbox with a text label.",
+ "section": "Widgets",
+ "output": [ "publicFeature" ]
+ },
+ "pushbutton": {
+ "label": "QPushButton",
+ "purpose": "Provides a command button.",
+ "section": "Widgets",
+ "condition": "features.action",
+ "output": [ "publicFeature" ]
+ },
"toolbutton": {
"label": "QToolButton",
"purpose": "Provides quick-access buttons to commands and options.",
@@ -291,10 +330,17 @@
"section": "Widgets",
"output": [ "publicFeature", "feature" ]
},
+ "abstractslider": {
+ "label": "QAbstractSlider",
+ "purpose": "Common super class for widgets like QScrollBar, QSlider and QDial.",
+ "section": "Widgets",
+ "output": [ "publicFeature" ]
+ },
"slider": {
"label": "QSlider",
"purpose": "Provides sliders controlling a bounded value.",
"section": "Widgets",
+ "condition": "features.abstractslider",
"output": [ "publicFeature", "feature" ]
},
"scrollbar": {
@@ -318,6 +364,12 @@
"condition": "features.scrollbar",
"output": [ "publicFeature", "feature" ]
},
+ "scroller": {
+ "label": "QScroller",
+ "purpose": "Enables kinetic scrolling for any scrolling widget or graphics item.",
+ "section": "Widgets",
+ "output": [ "publicFeature" ]
+ },
"graphicsview": {
"label": "QGraphicsView",
"purpose": "Provides a canvas/sprite framework.",
@@ -356,6 +408,7 @@
"label": "QToolTip",
"purpose": "Supports presentation of tooltips.",
"section": "Widgets",
+ "condition": "features.label",
"output": [ "publicFeature", "feature" ]
},
"statustip": {
@@ -381,7 +434,15 @@
"label": "QCalendarWidget",
"purpose": "Provides a monthly based calendar widget allowing the user to select a date.",
"section": "Widgets",
- "condition": "features.tableview && features.menu && features.textdate && features.spinbox && features.toolbutton",
+ "condition": [
+ "features.label",
+ "features.menu",
+ "features.pushbutton",
+ "features.spinbox",
+ "features.tableview",
+ "features.textdate",
+ "features.toolbutton"
+ ],
"output": [ "publicFeature", "feature" ]
},
"keysequenceedit": {
@@ -391,59 +452,119 @@
"condition": "features.lineedit && features.shortcut",
"output": [ "publicFeature", "feature" ]
},
+ "dialogbuttonbox": {
+ "label": "QDialogButtonBox",
+ "purpose": "Presents buttons in a layout that is appropriate for the current widget style.",
+ "section": "Dialogs",
+ "condition": "features.pushbutton",
+ "output": [ "publicFeature" ]
+ },
"messagebox": {
"label": "QMessageBox",
"purpose": "Provides message boxes displaying informative messages and simple questions.",
"section": "Dialogs",
+ "condition" : [
+ "features.checkbox",
+ "features.dialogbuttonbox",
+ "features.label",
+ "features.pushbutton"
+ ],
"output": [ "publicFeature", "feature" ]
},
"colordialog": {
"label": "QColorDialog",
"purpose": "Provides a dialog widget for specifying colors.",
"section": "Dialogs",
- "condition": "features.spinbox",
+ "condition": [
+ "features.dialogbuttonbox",
+ "features.label",
+ "features.pushbutton",
+ "features.spinbox"
+ ],
"output": [ "publicFeature", "feature" ]
},
"filedialog": {
"label": "QFileDialog",
"purpose": "Provides a dialog widget for selecting files or directories.",
"section": "Dialogs",
- "condition": "features.dirmodel && features.treeview && features.combobox && features.toolbutton && features.buttongroup && features.tooltip && features.splitter && features.stackedwidget && features.proxymodel",
+ "condition": [
+ "features.buttongroup",
+ "features.combobox",
+ "features.dialogbuttonbox",
+ "features.dirmodel",
+ "features.label",
+ "features.proxymodel",
+ "features.splitter",
+ "features.stackedwidget",
+ "features.treeview",
+ "features.toolbutton"
+ ],
"output": [ "publicFeature", "feature" ]
},
"fontdialog": {
"label": "QFontDialog",
"purpose": "Provides a dialog widget for selecting fonts.",
"section": "Dialogs",
- "condition": "features.stringlistmodel && features.combobox && features.validator && features.groupbox",
+ "condition": [
+ "features.checkbox",
+ "features.combobox",
+ "features.dialogbuttonbox",
+ "features.groupbox",
+ "features.label",
+ "features.pushbutton",
+ "features.stringlistmodel",
+ "features.validator"
+ ],
"output": [ "publicFeature", "feature" ]
},
"progressdialog": {
"label": "QProgressDialog",
"purpose": "Provides feedback on the progress of a slow operation.",
"section": "Dialogs",
- "condition": "features.progressbar",
+ "condition": [
+ "features.label",
+ "features.pushbutton",
+ "features.progressbar"
+ ],
"output": [ "publicFeature", "feature" ]
},
"inputdialog": {
"label": "QInputDialog",
"purpose": "Provides a simple convenience dialog to get a single value from the user.",
"section": "Dialogs",
- "condition": "features.combobox && features.spinbox && features.stackedwidget && features.textedit",
+ "condition": [
+ "features.combobox",
+ "features.dialogbuttonbox",
+ "features.label",
+ "features.pushbutton",
+ "features.spinbox",
+ "features.stackedwidget",
+ "features.textedit"
+ ],
"output": [ "publicFeature", "feature" ]
},
"errormessage": {
"label": "QErrorMessage",
"purpose": "Provides an error message display dialog.",
"section": "Dialogs",
- "condition": "features.textedit",
+ "condition": [
+ "features.checkbox",
+ "features.textedit",
+ "features.label",
+ "features.pushbutton",
+ "features.textedit"
+ ],
"output": [ "publicFeature", "feature" ]
},
"wizard": {
"label": "QWizard",
"purpose": "Provides a framework for multi-page click-through dialogs.",
"section": "Dialogs",
- "condition": "features.properties",
+ "condition": [
+ "features.pushbutton",
+ "features.properties",
+ "features.label"
+ ],
"output": [ "publicFeature", "feature" ]
},
"dirmodel": {
diff --git a/src/widgets/dialogs/qcolordialog.cpp b/src/widgets/dialogs/qcolordialog.cpp
index ab3099dfe8..dbcd2d7fe2 100644
--- a/src/widgets/dialogs/qcolordialog.cpp
+++ b/src/widgets/dialogs/qcolordialog.cpp
@@ -2246,10 +2246,13 @@ bool QColorDialogPrivate::handleColorPickingMouseButtonRelease(QMouseEvent *e)
bool QColorDialogPrivate::handleColorPickingKeyPress(QKeyEvent *e)
{
Q_Q(QColorDialog);
+#if QT_CONFIG(shortcut)
if (e->matches(QKeySequence::Cancel)) {
releaseColorPicking();
q->setCurrentColor(beforeScreenColorPicking);
- } else if (e->key() == Qt::Key_Return || e->key() == Qt::Key_Enter) {
+ } else
+#endif
+ if (e->key() == Qt::Key_Return || e->key() == Qt::Key_Enter) {
q->setCurrentColor(grabScreenColor(QCursor::pos()));
releaseColorPicking();
}
diff --git a/src/widgets/dialogs/qdialog.cpp b/src/widgets/dialogs/qdialog.cpp
index e5715ecd57..8e74c659fa 100644
--- a/src/widgets/dialogs/qdialog.cpp
+++ b/src/widgets/dialogs/qdialog.cpp
@@ -43,7 +43,6 @@
#include "qevent.h"
#include "qdesktopwidget.h"
-#include "qpushbutton.h"
#include "qapplication.h"
#include "qlayout.h"
#include "qsizegrip.h"
@@ -367,6 +366,7 @@ QDialog::~QDialog()
default default button becomes the default button. This is what a
push button calls when it loses focus.
*/
+#if QT_CONFIG(pushbutton)
void QDialogPrivate::setDefault(QPushButton *pushButton)
{
Q_Q(QDialog);
@@ -411,6 +411,7 @@ void QDialogPrivate::hideDefault()
list.at(i)->setDefault(false);
}
}
+#endif
void QDialogPrivate::resetModalitySetByOpen()
{
@@ -644,6 +645,7 @@ void QDialog::keyPressEvent(QKeyEvent *e)
#endif
if (!e->modifiers() || (e->modifiers() & Qt::KeypadModifier && e->key() == Qt::Key_Enter)) {
switch (e->key()) {
+#if QT_CONFIG(pushbutton)
case Qt::Key_Enter:
case Qt::Key_Return: {
QList<QPushButton*> list = findChildren<QPushButton*>();
@@ -657,6 +659,7 @@ void QDialog::keyPressEvent(QKeyEvent *e)
}
}
break;
+#endif
default:
e->ignore();
return;
@@ -716,6 +719,7 @@ void QDialog::setVisible(bool visible)
and actually catches most cases... If not, then they simply
have to use [widget*]->setFocus() themselves...
*/
+#if QT_CONFIG(pushbutton)
if (d->mainDef && fw->focusPolicy() == Qt::NoFocus) {
QWidget *first = fw;
while ((first = first->nextInFocusChain()) != fw && first->focusPolicy() == Qt::NoFocus)
@@ -733,6 +737,7 @@ void QDialog::setVisible(bool visible)
}
}
}
+#endif
if (fw && !fw->hasFocus()) {
QFocusEvent e(QEvent::FocusIn, Qt::TabFocusReason);
QApplication::sendEvent(fw, &e);
@@ -760,10 +765,12 @@ void QDialog::setVisible(bool visible)
d->eventLoop->exit();
}
+#if QT_CONFIG(pushbutton)
const QPlatformTheme *theme = QGuiApplicationPrivate::platformTheme();
if (d->mainDef && isActiveWindow()
&& theme->themeHint(QPlatformTheme::DialogSnapToDefaultButton).toBool())
QCursor::setPos(d->mainDef->mapToGlobal(d->mainDef->rect().center()));
+#endif
}
/*!\reimp */
diff --git a/src/widgets/dialogs/qdialog_p.h b/src/widgets/dialogs/qdialog_p.h
index ae9e3bcc93..6723edae38 100644
--- a/src/widgets/dialogs/qdialog_p.h
+++ b/src/widgets/dialogs/qdialog_p.h
@@ -56,7 +56,9 @@
#include "QtCore/qeventloop.h"
#include "QtCore/qpointer.h"
#include "QtWidgets/qdialog.h"
+#if QT_CONFIG(pushbutton)
#include "QtWidgets/qpushbutton.h"
+#endif
#include <qpa/qplatformdialoghelper.h>
QT_BEGIN_NAMESPACE
@@ -69,7 +71,11 @@ class Q_WIDGETS_EXPORT QDialogPrivate : public QWidgetPrivate
public:
QDialogPrivate()
- : mainDef(0), orientation(Qt::Horizontal),extension(0), doShowExtension(false),
+ :
+#if QT_CONFIG(pushbutton)
+ mainDef(0),
+#endif
+ orientation(Qt::Horizontal),extension(0), doShowExtension(false),
#ifndef QT_NO_SIZEGRIP
resizer(0),
sizeGripEnabled(false),
@@ -84,7 +90,9 @@ public:
QVariant styleHint(QPlatformDialogHelper::StyleHint hint) const;
void deletePlatformHelper();
+#if QT_CONFIG(pushbutton)
QPointer<QPushButton> mainDef;
+#endif
Qt::Orientation orientation;
QWidget *extension;
bool doShowExtension;
@@ -95,9 +103,11 @@ public:
#endif
QPoint lastRMBPress;
+#if QT_CONFIG(pushbutton)
void setDefault(QPushButton *);
void setMainDefault(QPushButton *);
void hideDefault();
+#endif
void resetModalitySetByOpen();
int rescode;
diff --git a/src/widgets/dialogs/qfiledialog.cpp b/src/widgets/dialogs/qfiledialog.cpp
index a552746385..78e304950a 100644
--- a/src/widgets/dialogs/qfiledialog.cpp
+++ b/src/widgets/dialogs/qfiledialog.cpp
@@ -3813,12 +3813,12 @@ void QFileDialogPrivate::_q_nativeEnterDirectory(const QUrl &directory)
bool QFileDialogPrivate::itemViewKeyboardEvent(QKeyEvent *event) {
Q_Q(QFileDialog);
-
+#if QT_CONFIG(shortcut)
if (event->matches(QKeySequence::Cancel)) {
q->reject();
return true;
}
-
+#endif
switch (event->key()) {
case Qt::Key_Backspace:
_q_navigateToParent();
@@ -4020,7 +4020,9 @@ void QFileDialogLineEdit::keyPressEvent(QKeyEvent *e)
int key = e->key();
QLineEdit::keyPressEvent(e);
+#if QT_CONFIG(shortcut)
if (!e->matches(QKeySequence::Cancel) && key != Qt::Key_Back)
+#endif
e->accept();
}
diff --git a/src/widgets/dialogs/qmessagebox.cpp b/src/widgets/dialogs/qmessagebox.cpp
index 98d070e493..3b0a71518d 100644
--- a/src/widgets/dialogs/qmessagebox.cpp
+++ b/src/widgets/dialogs/qmessagebox.cpp
@@ -1405,7 +1405,7 @@ void QMessageBox::changeEvent(QEvent *ev)
void QMessageBox::keyPressEvent(QKeyEvent *e)
{
Q_D(QMessageBox);
-
+#if QT_CONFIG(shortcut)
if (e->matches(QKeySequence::Cancel)) {
if (d->detectedEscapeButton) {
#ifdef Q_OS_MAC
@@ -1416,7 +1416,7 @@ void QMessageBox::keyPressEvent(QKeyEvent *e)
}
return;
}
-
+#endif // QT_CONFIG(shortcut)
#if !defined(QT_NO_CLIPBOARD) && !defined(QT_NO_SHORTCUT)
diff --git a/src/widgets/dialogs/qwizard.cpp b/src/widgets/dialogs/qwizard.cpp
index 532ee4700f..5e598ba990 100644
--- a/src/widgets/dialogs/qwizard.cpp
+++ b/src/widgets/dialogs/qwizard.cpp
@@ -1465,8 +1465,10 @@ void QWizardPrivate::updateButtonTexts()
// Vista: Add shortcut for 'next'. Note: native dialogs use ALT-Right
// even in RTL mode, so do the same, even if it might be counter-intuitive.
// The shortcut for 'back' is set in class QVistaBackButton.
+#if QT_CONFIG(shortcut)
if (btns[QWizard::NextButton])
btns[QWizard::NextButton]->setShortcut(isVistaThemeEnabled() ? QKeySequence(Qt::ALT | Qt::Key_Right) : QKeySequence());
+#endif
}
void QWizardPrivate::updateButtonLayout()
diff --git a/src/widgets/graphicsview/qgraphicsview.cpp b/src/widgets/graphicsview/qgraphicsview.cpp
index 41f5eddd99..9d7412340f 100644
--- a/src/widgets/graphicsview/qgraphicsview.cpp
+++ b/src/widgets/graphicsview/qgraphicsview.cpp
@@ -2996,12 +2996,12 @@ void QGraphicsView::contextMenuEvent(QContextMenuEvent *event)
}
#endif // QT_NO_CONTEXTMENU
+#if QT_CONFIG(draganddrop)
/*!
\reimp
*/
void QGraphicsView::dropEvent(QDropEvent *event)
{
-#ifndef QT_NO_DRAGANDDROP
Q_D(QGraphicsView);
if (!d->scene || !d->sceneInteractionAllowed)
return;
@@ -3020,10 +3020,6 @@ void QGraphicsView::dropEvent(QDropEvent *event)
delete d->lastDragDropEvent;
d->lastDragDropEvent = 0;
-
-#else
- Q_UNUSED(event)
-#endif
}
/*!
@@ -3031,7 +3027,6 @@ void QGraphicsView::dropEvent(QDropEvent *event)
*/
void QGraphicsView::dragEnterEvent(QDragEnterEvent *event)
{
-#ifndef QT_NO_DRAGANDDROP
Q_D(QGraphicsView);
if (!d->scene || !d->sceneInteractionAllowed)
return;
@@ -3054,9 +3049,6 @@ void QGraphicsView::dragEnterEvent(QDragEnterEvent *event)
event->setAccepted(true);
event->setDropAction(sceneEvent.dropAction());
}
-#else
- Q_UNUSED(event)
-#endif
}
/*!
@@ -3064,7 +3056,6 @@ void QGraphicsView::dragEnterEvent(QDragEnterEvent *event)
*/
void QGraphicsView::dragLeaveEvent(QDragLeaveEvent *event)
{
-#ifndef QT_NO_DRAGANDDROP
Q_D(QGraphicsView);
if (!d->scene || !d->sceneInteractionAllowed)
return;
@@ -3094,9 +3085,6 @@ void QGraphicsView::dragLeaveEvent(QDragLeaveEvent *event)
// Accept the originating event if the scene accepted the scene event.
if (sceneEvent.isAccepted())
event->setAccepted(true);
-#else
- Q_UNUSED(event)
-#endif
}
/*!
@@ -3104,7 +3092,6 @@ void QGraphicsView::dragLeaveEvent(QDragLeaveEvent *event)
*/
void QGraphicsView::dragMoveEvent(QDragMoveEvent *event)
{
-#ifndef QT_NO_DRAGANDDROP
Q_D(QGraphicsView);
if (!d->scene || !d->sceneInteractionAllowed)
return;
@@ -3123,10 +3110,8 @@ void QGraphicsView::dragMoveEvent(QDragMoveEvent *event)
event->setAccepted(sceneEvent.isAccepted());
if (sceneEvent.isAccepted())
event->setDropAction(sceneEvent.dropAction());
-#else
- Q_UNUSED(event)
-#endif
}
+#endif // QT_CONFIG(draganddrop)
/*!
\reimp
diff --git a/src/widgets/graphicsview/qgraphicsview.h b/src/widgets/graphicsview/qgraphicsview.h
index 327a75c374..64d5f5b430 100644
--- a/src/widgets/graphicsview/qgraphicsview.h
+++ b/src/widgets/graphicsview/qgraphicsview.h
@@ -244,10 +244,12 @@ protected:
#ifndef QT_NO_CONTEXTMENU
void contextMenuEvent(QContextMenuEvent *event) Q_DECL_OVERRIDE;
#endif
+#if QT_CONFIG(draganddrop)
void dragEnterEvent(QDragEnterEvent *event) Q_DECL_OVERRIDE;
void dragLeaveEvent(QDragLeaveEvent *event) Q_DECL_OVERRIDE;
void dragMoveEvent(QDragMoveEvent *event) Q_DECL_OVERRIDE;
void dropEvent(QDropEvent *event) Q_DECL_OVERRIDE;
+#endif
void focusInEvent(QFocusEvent *event) Q_DECL_OVERRIDE;
bool focusNextPrevChild(bool next) Q_DECL_OVERRIDE;
void focusOutEvent(QFocusEvent *event) Q_DECL_OVERRIDE;
diff --git a/src/widgets/itemviews/qabstractitemdelegate.cpp b/src/widgets/itemviews/qabstractitemdelegate.cpp
index 8cd2a957be..f63e258e8e 100644
--- a/src/widgets/itemviews/qabstractitemdelegate.cpp
+++ b/src/widgets/itemviews/qabstractitemdelegate.cpp
@@ -537,11 +537,13 @@ bool QAbstractItemDelegatePrivate::tryFixup(QWidget *editor)
#ifndef QT_NO_LINEEDIT
if (QLineEdit *e = qobject_cast<QLineEdit*>(editor)) {
if (!e->hasAcceptableInput()) {
+#if QT_CONFIG(validator)
if (const QValidator *validator = e->validator()) {
QString text = e->text();
validator->fixup(text);
e->setText(text);
}
+#endif
return e->hasAcceptableInput();
}
}
diff --git a/src/widgets/itemviews/qabstractitemview.cpp b/src/widgets/itemviews/qabstractitemview.cpp
index 6ecf5a664f..939e2a3d79 100644
--- a/src/widgets/itemviews/qabstractitemview.cpp
+++ b/src/widgets/itemviews/qabstractitemview.cpp
@@ -64,7 +64,7 @@
#ifndef QT_NO_ACCESSIBILITY
#include <qaccessible.h>
#endif
-#ifndef QT_NO_GESTURES
+#if QT_CONFIG(gestures) && QT_CONFIG(scroller)
# include <qscroller.h>
#endif
@@ -196,7 +196,7 @@ void QAbstractItemViewPrivate::checkMouseMove(const QPersistentModelIndex &index
}
}
-#ifndef QT_NO_GESTURES
+#if QT_CONFIG(gestures) && QT_CONFIG(scroller)
// stores and restores the selection and current item when flicking
void QAbstractItemViewPrivate::_q_scrollerStateChanged()
@@ -1736,7 +1736,7 @@ bool QAbstractItemView::viewportEvent(QEvent *event)
break;
case QEvent::ScrollPrepare:
executeDelayedItemsLayout();
-#ifndef QT_NO_GESTURES
+#if QT_CONFIG(gestures) && QT_CONFIG(scroller)
connect(QScroller::scroller(d->viewport), SIGNAL(stateChanged(QScroller::State)), this, SLOT(_q_scrollerStateChanged()), Qt::UniqueConnection);
#endif
break;
diff --git a/src/widgets/itemviews/qabstractitemview.h b/src/widgets/itemviews/qabstractitemview.h
index 309b8c4d59..f315ea6e4c 100644
--- a/src/widgets/itemviews/qabstractitemview.h
+++ b/src/widgets/itemviews/qabstractitemview.h
@@ -367,7 +367,7 @@ private:
Q_PRIVATE_SLOT(d_func(), void _q_modelDestroyed())
Q_PRIVATE_SLOT(d_func(), void _q_layoutChanged())
Q_PRIVATE_SLOT(d_func(), void _q_headerDataChanged())
-#ifndef QT_NO_GESTURES
+#if QT_CONFIG(gestures) && QT_CONFIG(scroller)
Q_PRIVATE_SLOT(d_func(), void _q_scrollerStateChanged())
#endif
diff --git a/src/widgets/itemviews/qheaderview.cpp b/src/widgets/itemviews/qheaderview.cpp
index 1310a060ea..d2f9618c29 100644
--- a/src/widgets/itemviews/qheaderview.cpp
+++ b/src/widgets/itemviews/qheaderview.cpp
@@ -2479,7 +2479,10 @@ void QHeaderView::mouseMoveEvent(QMouseEvent *e)
if (d->shouldAutoScroll(e->pos()))
d->startAutoScroll();
if (qAbs(pos - d->firstPos) >= QApplication::startDragDistance()
- || !d->sectionIndicator->isHidden()) {
+#if QT_CONFIG(label)
+ || !d->sectionIndicator->isHidden()
+#endif
+ ) {
int visual = visualIndexAt(pos);
if (visual == -1)
return;
@@ -2548,7 +2551,11 @@ void QHeaderView::mouseReleaseEvent(QMouseEvent *e)
int pos = d->orientation == Qt::Horizontal ? e->x() : e->y();
switch (d->state) {
case QHeaderViewPrivate::MoveSection:
- if (!d->sectionIndicator->isHidden()) { // moving
+ if (true
+#if QT_CONFIG(label)
+ && !d->sectionIndicator->isHidden()
+#endif
+ ) { // moving
int from = visualIndex(d->section);
Q_ASSERT(from != -1);
int to = visualIndex(d->target);
@@ -3138,9 +3145,11 @@ int QHeaderViewPrivate::sectionHandleAt(int position)
void QHeaderViewPrivate::setupSectionIndicator(int section, int position)
{
Q_Q(QHeaderView);
+#if QT_CONFIG(label)
if (!sectionIndicator) {
sectionIndicator = new QLabel(viewport);
}
+#endif
int w, h;
int p = q->sectionViewportPosition(section);
@@ -3151,7 +3160,9 @@ void QHeaderViewPrivate::setupSectionIndicator(int section, int position)
w = viewport->width();
h = q->sectionSize(section);
}
+#if QT_CONFIG(label)
sectionIndicator->resize(w, h);
+#endif
QPixmap pm(w, h);
pm.fill(QColor(0, 0, 0, 45));
@@ -3162,12 +3173,15 @@ void QHeaderViewPrivate::setupSectionIndicator(int section, int position)
q->paintSection(&painter, rect, section);
painter.end();
+#if QT_CONFIG(label)
sectionIndicator->setPixmap(pm);
+#endif
sectionIndicatorOffset = position - qMax(p, 0);
}
void QHeaderViewPrivate::updateSectionIndicator(int section, int position)
{
+#if QT_CONFIG(label)
if (!sectionIndicator)
return;
@@ -3182,6 +3196,7 @@ void QHeaderViewPrivate::updateSectionIndicator(int section, int position)
sectionIndicator->move(0, position - sectionIndicatorOffset);
sectionIndicator->show();
+#endif
}
/*!
diff --git a/src/widgets/itemviews/qheaderview_p.h b/src/widgets/itemviews/qheaderview_p.h
index 6affe7af95..d6b119512c 100644
--- a/src/widgets/itemviews/qheaderview_p.h
+++ b/src/widgets/itemviews/qheaderview_p.h
@@ -58,7 +58,9 @@
#include "QtCore/qbitarray.h"
#include "QtWidgets/qapplication.h"
+#if QT_CONFIG(label)
#include "QtWidgets/qlabel.h"
+#endif
QT_BEGIN_NAMESPACE
@@ -99,7 +101,9 @@ public:
lastSectionSize(0),
lastSectionLogicalIdx(-1), // Only trust when we stretch last section
sectionIndicatorOffset(0),
+#if QT_CONFIG(label)
sectionIndicator(0),
+#endif
globalResizeMode(QHeaderView::Interactive),
sectionStartposRecalc(true),
resizeContentsPrecision(1000)
@@ -296,7 +300,9 @@ public:
int lastSectionLogicalIdx; // Only trust if we stretch LastSection
int sectionIndicatorOffset;
Qt::Alignment defaultAlignment;
+#if QT_CONFIG(label)
QLabel *sectionIndicator;
+#endif
QHeaderView::ResizeMode globalResizeMode;
QList<QPersistentModelIndex> persistentHiddenSections;
mutable bool sectionStartposRecalc;
diff --git a/src/widgets/itemviews/qitemeditorfactory.cpp b/src/widgets/itemviews/qitemeditorfactory.cpp
index 5356ce3ad0..c044d37575 100644
--- a/src/widgets/itemviews/qitemeditorfactory.cpp
+++ b/src/widgets/itemviews/qitemeditorfactory.cpp
@@ -45,7 +45,9 @@
#include <qcombobox.h>
#include <qdatetimeedit.h>
+#if QT_CONFIG(label)
#include <qlabel.h>
+#endif
#include <qlineedit.h>
#include <qspinbox.h>
#include <limits.h>
@@ -261,8 +263,10 @@ QWidget *QDefaultItemEditorFactory::createEditor(int userType, QWidget *parent)
ed->setFrame(false);
return ed; }
#endif
+#if QT_CONFIG(label)
case QVariant::Pixmap:
return new QLabel(parent);
+#endif
#ifndef QT_NO_SPINBOX
case QVariant::Double: {
QDoubleSpinBox *sb = new QDoubleSpinBox(parent);
diff --git a/src/widgets/itemviews/qlistview.cpp b/src/widgets/itemviews/qlistview.cpp
index 45c547d313..653b03ef0d 100644
--- a/src/widgets/itemviews/qlistview.cpp
+++ b/src/widgets/itemviews/qlistview.cpp
@@ -1625,33 +1625,6 @@ bool QListView::isSelectionRectVisible() const
}
/*!
- \property QListView::expandingListItems
- \brief if items occupy the entire width of the column
- \since 5.9
-
- If this property is \c true then all items in the column
- will have the width of the column; otherwise the width of
- each item will be determined by it's size hint.
-
- By default, this property is \c true.
-*/
-void QListView::setExpandingListItems(bool enable)
-{
- Q_D(QListView);
- if (d->expandingListItems == enable)
- return;
- d->expandingListItems = enable;
- if (viewMode() == ListMode && flow() == QListView::TopToBottom && isWrapping())
- d->doDelayedItemsLayout();
-}
-
-bool QListView::isExpandingListItems() const
-{
- Q_D(const QListView);
- return d->expandingListItems;
-}
-
-/*!
\reimp
*/
bool QListView::event(QEvent *e)
@@ -1677,8 +1650,7 @@ QListViewPrivate::QListViewPrivate()
column(0),
uniformItemSizes(false),
batchSize(100),
- showElasticBand(false),
- expandingListItems(true)
+ showElasticBand(false)
{
}
@@ -2020,7 +1992,9 @@ int QCommonListViewBase::horizontalScrollToValue(const int /*index*/, QListView:
QListModeViewBase::QListModeViewBase(QListView *q, QListViewPrivate *d)
: QCommonListViewBase(q, d)
{
+#if QT_CONFIG(draganddrop)
dd->defaultDropAction = Qt::CopyAction;
+#endif
}
#ifndef QT_NO_DRAGANDDROP
@@ -2393,8 +2367,7 @@ QListViewItem QListModeViewBase::indexToListViewItem(const QModelIndex &index) c
int right = (segment + 1 >= segmentPositions.count()
? contentsSize.width()
: segmentPositions.at(segment + 1));
- size.setWidth(dd->expandingListItems ? right - pos.x()
- : qMin(size.width(), right - pos.x()));
+ size.setWidth(right - pos.x());
} else { // make the items as wide as the viewport
size.setWidth(qMax(size.width(), viewport()->width() - 2 * spacing()));
}
@@ -2578,15 +2551,8 @@ QVector<QModelIndex> QListModeViewBase::intersectingSet(const QRect &area) const
if (isHidden(row))
continue;
QModelIndex index = modelIndex(row);
- if (index.isValid()) {
- if (flow() == QListView::LeftToRight || dd->expandingListItems) {
- ret += index;
- } else {
- const int iw = indexToListViewItem(index).width(); // item width
- if (iw > 0 && segStartPosition - segmentPositions.at(seg) < iw)
- ret += index;
- }
- }
+ if (index.isValid())
+ ret += index;
#if 0 // for debugging
else
qWarning("intersectingSet: row %d was invalid", row);
diff --git a/src/widgets/itemviews/qlistview.h b/src/widgets/itemviews/qlistview.h
index 4cf53f9bab..e918e66d38 100644
--- a/src/widgets/itemviews/qlistview.h
+++ b/src/widgets/itemviews/qlistview.h
@@ -66,7 +66,6 @@ class Q_WIDGETS_EXPORT QListView : public QAbstractItemView
Q_PROPERTY(int batchSize READ batchSize WRITE setBatchSize)
Q_PROPERTY(bool wordWrap READ wordWrap WRITE setWordWrap)
Q_PROPERTY(bool selectionRectVisible READ isSelectionRectVisible WRITE setSelectionRectVisible)
- Q_PROPERTY(bool expandingListItems READ isExpandingListItems WRITE setExpandingListItems)
public:
enum Movement { Static, Free, Snap };
@@ -127,9 +126,6 @@ public:
void setSelectionRectVisible(bool show);
bool isSelectionRectVisible() const;
- void setExpandingListItems(bool enable);
- bool isExpandingListItems() const;
-
QRect visualRect(const QModelIndex &index) const Q_DECL_OVERRIDE;
void scrollTo(const QModelIndex &index, ScrollHint hint = EnsureVisible) Q_DECL_OVERRIDE;
QModelIndex indexAt(const QPoint &p) const Q_DECL_OVERRIDE;
diff --git a/src/widgets/itemviews/qlistview_p.h b/src/widgets/itemviews/qlistview_p.h
index a66e007195..47effcdfd9 100644
--- a/src/widgets/itemviews/qlistview_p.h
+++ b/src/widgets/itemviews/qlistview_p.h
@@ -431,8 +431,6 @@ public:
QRect elasticBand;
bool showElasticBand;
-
- bool expandingListItems;
};
// inline implementations
diff --git a/src/widgets/itemviews/qlistwidget.h b/src/widgets/itemviews/qlistwidget.h
index c70e0522b7..85ca639e50 100644
--- a/src/widgets/itemviews/qlistwidget.h
+++ b/src/widgets/itemviews/qlistwidget.h
@@ -252,8 +252,9 @@ public:
bool isItemHidden(const QListWidgetItem *item) const;
void setItemHidden(const QListWidgetItem *item, bool hide);
+#if QT_CONFIG(draganddrop)
void dropEvent(QDropEvent *event) Q_DECL_OVERRIDE;
-
+#endif
public Q_SLOTS:
void scrollToItem(const QListWidgetItem *item, QAbstractItemView::ScrollHint hint = EnsureVisible);
void clear();
diff --git a/src/widgets/itemviews/qtablewidget.h b/src/widgets/itemviews/qtablewidget.h
index 5dde93f628..b91bcf7ce4 100644
--- a/src/widgets/itemviews/qtablewidget.h
+++ b/src/widgets/itemviews/qtablewidget.h
@@ -331,8 +331,9 @@ protected:
QModelIndex indexFromItem(QTableWidgetItem *item) const;
QTableWidgetItem *itemFromIndex(const QModelIndex &index) const;
+#if QT_CONFIG(draganddrop)
void dropEvent(QDropEvent *event) Q_DECL_OVERRIDE;
-
+#endif
private:
void setModel(QAbstractItemModel *model) Q_DECL_OVERRIDE;
diff --git a/src/widgets/itemviews/qtreewidget.h b/src/widgets/itemviews/qtreewidget.h
index 36ba9985bd..fc0bccf2fe 100644
--- a/src/widgets/itemviews/qtreewidget.h
+++ b/src/widgets/itemviews/qtreewidget.h
@@ -360,8 +360,9 @@ protected:
QModelIndex indexFromItem(const QTreeWidgetItem *item, int column = 0) const;
QModelIndex indexFromItem(QTreeWidgetItem *item, int column = 0) const; // ### Qt 6: remove
QTreeWidgetItem *itemFromIndex(const QModelIndex &index) const;
+#if QT_CONFIG(draganddrop)
void dropEvent(QDropEvent *event) Q_DECL_OVERRIDE;
-
+#endif
private:
void setModel(QAbstractItemModel *model) Q_DECL_OVERRIDE;
diff --git a/src/widgets/kernel/kernel.pri b/src/widgets/kernel/kernel.pri
index ad2180bbfd..c91be918b6 100644
--- a/src/widgets/kernel/kernel.pri
+++ b/src/widgets/kernel/kernel.pri
@@ -15,7 +15,6 @@ HEADERS += \
kernel/qwidgetbackingstore_p.h \
kernel/qboxlayout.h \
kernel/qdesktopwidget.h \
- kernel/qformlayout.h \
kernel/qgridlayout.h \
kernel/qlayout.h \
kernel/qlayout_p.h \
@@ -45,7 +44,6 @@ SOURCES += \
kernel/qapplication.cpp \
kernel/qwidgetbackingstore.cpp \
kernel/qboxlayout.cpp \
- kernel/qformlayout.cpp \
kernel/qgridlayout.cpp \
kernel/qlayout.cpp \
kernel/qlayoutengine.cpp \
@@ -84,3 +82,8 @@ qtConfig(opengl) {
HEADERS += kernel/qopenglwidget.h
SOURCES += kernel/qopenglwidget.cpp
}
+
+qtConfig(formlayout) {
+ HEADERS += kernel/qformlayout.h
+ SOURCES += kernel/qformlayout.cpp
+}
diff --git a/src/widgets/kernel/qformlayout.h b/src/widgets/kernel/qformlayout.h
index b4185374fd..5ec27433d3 100644
--- a/src/widgets/kernel/qformlayout.h
+++ b/src/widgets/kernel/qformlayout.h
@@ -43,6 +43,8 @@
#include <QtWidgets/qtwidgetsglobal.h>
#include <QtWidgets/QLayout>
+QT_REQUIRE_CONFIG(formlayout);
+
QT_BEGIN_NAMESPACE
diff --git a/src/widgets/kernel/qlayout.cpp b/src/widgets/kernel/qlayout.cpp
index 1a341d155b..b90be2b4f1 100644
--- a/src/widgets/kernel/qlayout.cpp
+++ b/src/widgets/kernel/qlayout.cpp
@@ -49,7 +49,9 @@
#include "qvariant.h"
#include "qwidget_p.h"
#include "qlayout_p.h"
+#if QT_CONFIG(formlayout)
#include "qformlayout.h"
+#endif
QT_BEGIN_NAMESPACE
@@ -320,8 +322,10 @@ int QLayout::spacing() const
return boxlayout->spacing();
} else if (const QGridLayout* gridlayout = qobject_cast<const QGridLayout*>(this)) {
return gridlayout->spacing();
+#if QT_CONFIG(formlayout)
} else if (const QFormLayout* formlayout = qobject_cast<const QFormLayout*>(this)) {
return formlayout->spacing();
+#endif
} else {
Q_D(const QLayout);
if (d->insideSpacing >=0) {
@@ -347,8 +351,10 @@ void QLayout::setSpacing(int spacing)
boxlayout->setSpacing(spacing);
} else if (QGridLayout* gridlayout = qobject_cast<QGridLayout*>(this)) {
gridlayout->setSpacing(spacing);
+#if QT_CONFIG(formlayout)
} else if (QFormLayout* formlayout = qobject_cast<QFormLayout*>(this)) {
formlayout->setSpacing(spacing);
+#endif
} else {
Q_D(QLayout);
d->insideSpacing = spacing;
diff --git a/src/widgets/kernel/qsizepolicy.h b/src/widgets/kernel/qsizepolicy.h
index 07d8393c6f..6cb4e147e9 100644
--- a/src/widgets/kernel/qsizepolicy.h
+++ b/src/widgets/kernel/qsizepolicy.h
@@ -112,7 +112,7 @@ public:
QT_SIZEPOLICY_CONSTEXPR QSizePolicy() Q_DECL_NOTHROW : data(0) { }
-#ifdef Q_COMPILER_UNIFORM_INIT
+#if defined(Q_COMPILER_UNIFORM_INIT) && !defined(Q_QDOC)
QT_SIZEPOLICY_CONSTEXPR QSizePolicy(Policy horizontal, Policy vertical, ControlType type = DefaultType) Q_DECL_NOTHROW
: bits{0, 0, quint32(horizontal), quint32(vertical),
type == DefaultType ? 0 : toControlTypeFieldValue(type), 0, 0, 0}
diff --git a/src/widgets/kernel/qtooltip.cpp b/src/widgets/kernel/qtooltip.cpp
index a92dc2cbf7..48afeb1dcc 100644
--- a/src/widgets/kernel/qtooltip.cpp
+++ b/src/widgets/kernel/qtooltip.cpp
@@ -43,18 +43,19 @@
#include <qapplication.h>
#include <qdesktopwidget.h>
#include <qevent.h>
-#include <qlabel.h>
#include <qpointer.h>
#include <qstyle.h>
#include <qstyleoption.h>
#include <qstylepainter.h>
#include <qtimer.h>
-#include <qtooltip.h>
#include <private/qeffects_p.h>
#include <qtextdocument.h>
#include <qdebug.h>
#include <private/qstylesheetstyle_p.h>
+
#ifndef QT_NO_TOOLTIP
+#include <qlabel.h>
+#include <qtooltip.h>
#if 0 // Used to be included in Qt4 for Q_WS_MAC
# include <private/qcore_mac_p.h>
diff --git a/src/widgets/kernel/qwhatsthis.cpp b/src/widgets/kernel/qwhatsthis.cpp
index 6061af5f38..4286019717 100644
--- a/src/widgets/kernel/qwhatsthis.cpp
+++ b/src/widgets/kernel/qwhatsthis.cpp
@@ -462,11 +462,13 @@ bool QWhatsThisPrivate::eventFilter(QObject *o, QEvent *e)
case QEvent::KeyPress:
{
QKeyEvent* kev = (QKeyEvent*)e;
-
+#if QT_CONFIG(shortcut)
if (kev->matches(QKeySequence::Cancel)) {
QWhatsThis::leaveWhatsThisMode();
return true;
- } else if (customWhatsThis) {
+ } else
+#endif
+ if (customWhatsThis) {
return false;
} else if (kev->key() == Qt::Key_Menu ||
(kev->key() == Qt::Key_F10 &&
diff --git a/src/widgets/kernel/qwidget.cpp b/src/widgets/kernel/qwidget.cpp
index 8a642940cd..8d5c3e415a 100644
--- a/src/widgets/kernel/qwidget.cpp
+++ b/src/widgets/kernel/qwidget.cpp
@@ -12769,8 +12769,6 @@ void QWidget::activateWindow()
*/
int QWidget::metric(PaintDeviceMetric m) const
{
- Q_D(const QWidget);
-
QWindow *topLevelWindow = 0;
QScreen *screen = 0;
if (QWidget *topLevel = window()) {
@@ -12798,16 +12796,16 @@ int QWidget::metric(PaintDeviceMetric m) const
} else if (m == PdmDepth) {
return screen->depth();
} else if (m == PdmDpiX) {
- if (d->extra && d->extra->customDpiX)
- return d->extra->customDpiX;
- else if (d->parent)
- return static_cast<QWidget *>(d->parent)->metric(m);
+ for (const QWidget *p = this; p; p = p->parentWidget()) {
+ if (p->d_func()->extra && p->d_func()->extra->customDpiX)
+ return p->d_func()->extra->customDpiX;
+ }
return qRound(screen->logicalDotsPerInchX());
} else if (m == PdmDpiY) {
- if (d->extra && d->extra->customDpiY)
- return d->extra->customDpiY;
- else if (d->parent)
- return static_cast<QWidget *>(d->parent)->metric(m);
+ for (const QWidget *p = this; p; p = p->parentWidget()) {
+ if (p->d_func()->extra && p->d_func()->extra->customDpiY)
+ return p->d_func()->extra->customDpiY;
+ }
return qRound(screen->logicalDotsPerInchY());
} else if (m == PdmPhysicalDpiX) {
return qRound(screen->physicalDotsPerInchX());
diff --git a/src/widgets/kernel/qwidgetwindow.cpp b/src/widgets/kernel/qwidgetwindow.cpp
index 5abce140ce..31f2d672bb 100644
--- a/src/widgets/kernel/qwidgetwindow.cpp
+++ b/src/widgets/kernel/qwidgetwindow.cpp
@@ -285,6 +285,7 @@ bool QWidgetWindow::event(QEvent *event)
return true;
case QEvent::WindowStateChange:
+ QWindow::event(event); // Update QWindow::Visibility and emit signals.
handleWindowStateChangedEvent(static_cast<QWindowStateChangeEvent *>(event));
return true;
diff --git a/src/widgets/styles/qcommonstyle.cpp b/src/widgets/styles/qcommonstyle.cpp
index 095cda1949..92cd5cc0f1 100644
--- a/src/widgets/styles/qcommonstyle.cpp
+++ b/src/widgets/styles/qcommonstyle.cpp
@@ -48,8 +48,14 @@
#include <qcache.h>
#include <qdockwidget.h>
#include <qdrawutil.h>
+#if QT_CONFIG(dialogbuttonbox)
#include <qdialogbuttonbox.h>
+#endif
+#if QT_CONFIG(formlayout)
#include <qformlayout.h>
+#else
+#include <qlayout.h>
+#endif
#include <qgroupbox.h>
#include <qmath.h>
#include <qmenu.h>
@@ -4922,9 +4928,11 @@ int QCommonStyle::styleHint(StyleHint sh, const QStyleOption *opt, const QWidget
case SH_ScrollBar_ContextMenu:
ret = true;
break;
+#if QT_CONFIG(dialogbuttonbox)
case SH_DialogButtons_DefaultButton: // This value not used anywhere.
ret = QDialogButtonBox::AcceptRole;
break;
+#endif
#ifndef QT_NO_GROUPBOX
case SH_GroupBox_TextLabelVerticalAlignment:
ret = Qt::AlignVCenter;
@@ -5112,11 +5120,13 @@ int QCommonStyle::styleHint(StyleHint sh, const QStyleOption *opt, const QWidget
case SH_TabBar_ElideMode:
ret = Qt::ElideNone;
break;
+#if QT_CONFIG(dialogbuttonbox)
case SH_DialogButtonLayout:
ret = QDialogButtonBox::WinLayout;
if (const QPlatformTheme *theme = QGuiApplicationPrivate::platformTheme())
ret = theme->themeHint(QPlatformTheme::DialogButtonBoxLayout).toInt();
break;
+#endif
case SH_ComboBox_PopupFrameStyle:
ret = QFrame::StyledPanel | QFrame::Plain;
break;
@@ -5162,12 +5172,14 @@ int QCommonStyle::styleHint(StyleHint sh, const QStyleOption *opt, const QWidget
ret = QWizard::ClassicStyle;
break;
#endif
+#if QT_CONFIG(formlayout)
case SH_FormLayoutWrapPolicy:
ret = QFormLayout::DontWrapRows;
break;
case SH_FormLayoutFieldGrowthPolicy:
ret = QFormLayout::AllNonFixedFieldsGrow;
break;
+#endif
case SH_FormLayoutFormAlignment:
ret = Qt::AlignLeft | Qt::AlignTop;
break;
@@ -5242,6 +5254,7 @@ int QCommonStyle::styleHint(StyleHint sh, const QStyleOption *opt, const QWidget
return ret;
}
+#if QT_CONFIG(imageformat_xpm)
static QPixmap cachedPixmapFromXPM(const char * const *xpm)
{
QPixmap result;
@@ -5254,6 +5267,7 @@ static QPixmap cachedPixmapFromXPM(const char * const *xpm)
}
static inline QPixmap titleBarMenuCachedPixmapFromXPM() { return cachedPixmapFromXPM(qt_menu_xpm); }
+#endif // QT_CONFIG(imageformat_xpm)
#ifndef QT_NO_IMAGEFORMAT_PNG
static inline QString clearText16IconPath()
diff --git a/src/widgets/styles/qfusionstyle.cpp b/src/widgets/styles/qfusionstyle.cpp
index 75c50bb146..1267907303 100644
--- a/src/widgets/styles/qfusionstyle.cpp
+++ b/src/widgets/styles/qfusionstyle.cpp
@@ -43,7 +43,11 @@
#if QT_CONFIG(style_fusion) || defined(QT_PLUGIN)
#include "qcommonstyle_p.h"
#include <qcombobox.h>
+#if QT_CONFIG(pushbutton)
#include <qpushbutton.h>
+#else
+#include <qabstractbutton.h>
+#endif
#include <qpainter.h>
#include <qdir.h>
#include <qstyleoption.h>
@@ -53,9 +57,11 @@
#include <qgroupbox.h>
#include <qprocess.h>
#include <qpixmapcache.h>
-#include <qdialogbuttonbox.h>
#include <qscrollbar.h>
#include <qspinbox.h>
+#if QT_CONFIG(abstractslider)
+#include <qabstractslider.h>
+#endif
#include <qslider.h>
#include <qsplitter.h>
#include <qprogressbar.h>
@@ -86,7 +92,7 @@ static const int windowsRightBorder = 15; // right border on windows
static const int groupBoxBottomMargin = 0; // space below the groupbox
static const int groupBoxTopMargin = 3;
-
+#if QT_CONFIG(imageformat_xpm)
/* XPM */
static const char * const dock_widget_close_xpm[] = {
"11 13 7 1",
@@ -173,7 +179,7 @@ static const char * const qt_titlebar_context_help[] = {
" ",
" ## ",
" ## "};
-
+#endif // QT_CONFIG(imageformat_xpm)
static QColor mergedColors(const QColor &colorA, const QColor &colorB, int factor = 50)
{
@@ -2368,6 +2374,7 @@ void QFusionStyle::drawComplexControl(ComplexControl control, const QStyleOption
bool hover = (titleBar->activeSubControls & SC_TitleBarContextHelpButton) && (titleBar->state & State_MouseOver);
bool sunken = (titleBar->activeSubControls & SC_TitleBarContextHelpButton) && (titleBar->state & State_Sunken);
qt_fusion_draw_mdibutton(painter, titleBar, contextHelpButtonRect, hover, sunken);
+#if QT_CONFIG(imageformat_xpm)
QImage image(qt_titlebar_context_help);
QColor alpha = textColor;
alpha.setAlpha(128);
@@ -2375,6 +2382,7 @@ void QFusionStyle::drawComplexControl(ComplexControl control, const QStyleOption
image.setColor(2, alpha.rgba());
painter->setRenderHint(QPainter::SmoothPixmapTransform);
painter->drawImage(contextHelpButtonRect.adjusted(4, 4, -4, -4), image);
+#endif
}
}
@@ -3289,7 +3297,9 @@ void QFusionStyle::polish(QWidget *widget)
#if QT_CONFIG(splitter)
|| qobject_cast<QSplitterHandle *>(widget)
#endif
+#if QT_CONFIG(abstractslider)
|| qobject_cast<QAbstractSlider *>(widget)
+#endif
#if QT_CONFIG(spinbox)
|| qobject_cast<QAbstractSpinBox *>(widget)
#endif
@@ -3328,7 +3338,9 @@ void QFusionStyle::unpolish(QWidget *widget)
#if QT_CONFIG(splitter)
|| qobject_cast<QSplitterHandle *>(widget)
#endif
+#if QT_CONFIG(abstractslider)
|| qobject_cast<QAbstractSlider *>(widget)
+#endif
#if QT_CONFIG(spinbox)
|| qobject_cast<QAbstractSpinBox *>(widget)
#endif
diff --git a/src/widgets/styles/qmacstyle_mac.mm b/src/widgets/styles/qmacstyle_mac.mm
index 241f647b26..d9d30efc8b 100644
--- a/src/widgets/styles/qmacstyle_mac.mm
+++ b/src/widgets/styles/qmacstyle_mac.mm
@@ -52,12 +52,14 @@
#include <private/qcore_mac_p.h>
#include <private/qcombobox_p.h>
+#include <private/qtabbar_p.h>
#include <private/qpainter_p.h>
#include <qapplication.h>
#include <qbitmap.h>
-#include <qcheckbox.h>
#include <qcombobox.h>
+#if QT_CONFIG(dialogbuttonbox)
#include <qdialogbuttonbox.h>
+#endif
#include <qdockwidget.h>
#include <qevent.h>
#include <qfocusframe.h>
@@ -74,7 +76,9 @@
#include <qpixmapcache.h>
#include <qpointer.h>
#include <qprogressbar.h>
+#if QT_CONFIG(pushbutton)
#include <qpushbutton.h>
+#endif
#include <qradiobutton.h>
#include <qrubberband.h>
#include <qscrollbar.h>
@@ -187,11 +191,33 @@ static const QColor mainWindowGradientEnd(200, 200, 200);
static const int DisclosureOffset = 4;
+// Tab bar colors
+// active: window is active
+// selected: tab is selected
+// hovered: tab is hovered
+static const QColor tabBarTabBackgroundActive(190, 190, 190);
+static const QColor tabBarTabBackgroundActiveHovered(178, 178, 178);
+static const QColor tabBarTabBackgroundActiveSelected(211, 211, 211);
+static const QColor tabBarTabBackground(227, 227, 227);
+static const QColor tabBarTabBackgroundSelected(246, 246, 246);
+static const QColor tabBarTabLineActive(160, 160, 160);
+static const QColor tabBarTabLineActiveHovered(150, 150, 150);
+static const QColor tabBarTabLine(210, 210, 210);
+static const QColor tabBarTabLineSelected(189, 189, 189);
+static const QColor tabBarCloseButtonBackgroundHovered(162, 162, 162);
+static const QColor tabBarCloseButtonBackgroundPressed(153, 153, 153);
+static const QColor tabBarCloseButtonBackgroundSelectedHovered(192, 192, 192);
+static const QColor tabBarCloseButtonBackgroundSelectedPressed(181, 181, 181);
+static const QColor tabBarCloseButtonCross(100, 100, 100);
+static const QColor tabBarCloseButtonCrossSelected(115, 115, 115);
+
+static const int closeButtonSize = 14;
+static const qreal closeButtonCornerRadius = 2.0;
+
// Resolve these at run-time, since the functions was moved in Leopard.
typedef HIRect * (*PtrHIShapeGetBounds)(HIShapeRef, HIRect *);
static PtrHIShapeGetBounds ptrHIShapeGetBounds = 0;
-static int closeButtonSize = 12;
#ifndef QT_NO_TABBAR
static bool isVerticalTabs(const QTabBar::Shape shape) {
return (shape == QTabBar::RoundedEast
@@ -214,41 +240,35 @@ static bool isInMacUnifiedToolbarArea(QWindow *window, int windowY)
}
-void drawTabCloseButton(QPainter *p, bool hover, bool active, bool selected)
+void drawTabCloseButton(QPainter *p, bool hover, bool selected, bool pressed)
{
- // draw background circle
p->setRenderHints(QPainter::Antialiasing);
QRect rect(0, 0, closeButtonSize, closeButtonSize);
- QColor background;
+ const int width = rect.width();
+ const int height = rect.height();
+
if (hover) {
- background = QColor(124, 124, 124);
- } else {
- if (active) {
- if (selected)
- background = QColor(104, 104, 104);
- else
- background = QColor(83, 83, 83);
+ // draw background circle
+ QColor background;
+ if (selected) {
+ background = pressed ? tabBarCloseButtonBackgroundSelectedPressed : tabBarCloseButtonBackgroundSelectedHovered;
} else {
- if (selected)
- background = QColor(144, 144, 144);
- else
- background = QColor(114, 114, 114);
+ background = pressed ? tabBarCloseButtonBackgroundPressed : tabBarCloseButtonBackgroundHovered;
}
+ p->setPen(Qt::transparent);
+ p->setBrush(background);
+ p->drawRoundedRect(rect, closeButtonCornerRadius, closeButtonCornerRadius);
}
- p->setPen(Qt::transparent);
- p->setBrush(background);
- p->drawEllipse(rect);
// draw cross
- int min = 3;
- int max = 9;
+ const int margin = 3;
QPen crossPen;
- crossPen.setColor(QColor(194, 194, 194));
- crossPen.setWidthF(1.3);
+ crossPen.setColor(selected ? tabBarCloseButtonCrossSelected : tabBarCloseButtonCross);
+ crossPen.setWidthF(1.1);
crossPen.setCapStyle(Qt::FlatCap);
p->setPen(crossPen);
- p->drawLine(min, min, max, max);
- p->drawLine(min, max, max, min);
+ p->drawLine(margin, margin, width - margin, height - margin);
+ p->drawLine(margin, height - margin, width - margin, margin);
}
#ifndef QT_NO_TABBAR
@@ -275,108 +295,71 @@ QRect rotateTabPainter(QPainter *p, QTabBar::Shape shape, QRect tabRect)
return tabRect;
}
-void drawTabShape(QPainter *p, const QStyleOptionTab *tabOpt, bool isUnified)
+void drawTabShape(QPainter *p, const QStyleOptionTab *tabOpt, bool isUnified, int tabOverlap)
{
- QRect r = tabOpt->rect;
- p->translate(tabOpt->rect.x(), tabOpt->rect.y());
- r.moveLeft(0);
- r.moveTop(0);
- QRect tabRect = rotateTabPainter(p, tabOpt->shape, r);
+ QRect rect = tabOpt->rect;
- int width = tabRect.width();
- int height = 20;
- bool active = (tabOpt->state & QStyle::State_Active);
- bool selected = (tabOpt->state & QStyle::State_Selected);
+ switch (tabOpt->shape) {
+ case QTabBar::RoundedNorth:
+ case QTabBar::TriangularNorth:
+ case QTabBar::RoundedSouth:
+ case QTabBar::TriangularSouth:
+ rect.adjust(-tabOverlap, 0, 0, 0);
+ break;
+ case QTabBar::RoundedEast:
+ case QTabBar::TriangularEast:
+ case QTabBar::RoundedWest:
+ case QTabBar::TriangularWest:
+ rect.adjust(0, -tabOverlap, 0, 0);
+ break;
+ default:
+ break;
+ }
- if (selected) {
- QRect rect(1, 0, width - 2, height);
+ p->translate(rect.x(), rect.y());
+ rect.moveLeft(0);
+ rect.moveTop(0);
+ const QRect tabRect = rotateTabPainter(p, tabOpt->shape, rect);
+
+ const int width = tabRect.width();
+ const int height = tabRect.height();
+ const bool active = (tabOpt->state & QStyle::State_Active);
+ const bool selected = (tabOpt->state & QStyle::State_Selected);
+ const QRect bodyRect(1, 1, width - 2, height - 2);
+ const QRect topLineRect(1, 0, width - 2, 1);
+ const QRect bottomLineRect(1, height - 1, width - 2, 1);
+ if (selected) {
// fill body
if (tabOpt->documentMode && isUnified) {
p->save();
p->setCompositionMode(QPainter::CompositionMode_Source);
- p->fillRect(rect, QColor(Qt::transparent));
+ p->fillRect(tabRect, QColor(Qt::transparent));
p->restore();
} else if (active) {
- p->fillRect(rect, QColor(167, 167, 167));
- } else {
- QLinearGradient gradient(rect.topLeft(), rect.bottomLeft());
- gradient.setColorAt(0, QColor(216, 216, 216));
- gradient.setColorAt(0.5, QColor(215, 215, 215));
- gradient.setColorAt(1, QColor(210, 210, 210));
- p->fillRect(rect, gradient);
- }
-
- // draw border
- QColor borderSides;
- QColor borderBottom;
- if (active) {
- borderSides = QColor(88, 88, 88);
- borderBottom = QColor(88, 88, 88);
+ p->fillRect(bodyRect, tabBarTabBackgroundActiveSelected);
+ // top line
+ p->fillRect(topLineRect, tabBarTabLineSelected);
} else {
- borderSides = QColor(121, 121, 121);
- borderBottom = QColor(116, 116, 116);
+ p->fillRect(bodyRect, tabBarTabBackgroundSelected);
}
-
- p->setPen(borderSides);
-
- int bottom = height;
- // left line
- p->drawLine(0, 1, 0, bottom-2);
- // right line
- p->drawLine(width-1, 1, width-1, bottom-2);
-
- // bottom line
- if (active) {
- p->setPen(QColor(168, 168, 168));
- p->drawLine(3, bottom-1, width-3, bottom-1);
- }
- p->setPen(borderBottom);
- p->drawLine(2, bottom, width-2, bottom);
-
- int w = 3;
- QRectF rectangleLeft(1, height - w, w, w);
- QRectF rectangleRight(width - 2, height - 1, w, w);
- int startAngle = 180 * 16;
- int spanAngle = 90 * 16;
- p->setRenderHint(QPainter::Antialiasing);
- p->drawArc(rectangleLeft, startAngle, spanAngle);
- p->drawArc(rectangleRight, startAngle, -spanAngle);
} else {
// when the mouse is over non selected tabs they get a new color
- bool hover = (tabOpt->state & QStyle::State_MouseOver);
+ const bool hover = (tabOpt->state & QStyle::State_MouseOver);
if (hover) {
- QRect rect(1, 2, width - 1, height - 1);
- p->fillRect(rect, QColor(110, 110, 110));
- }
-
- // seperator lines between tabs
- bool west = (tabOpt->shape == QTabBar::RoundedWest || tabOpt->shape == QTabBar::TriangularWest);
- bool drawOnRight = !west;
- if ((!drawOnRight && tabOpt->selectedPosition != QStyleOptionTab::NextIsSelected)
- || (drawOnRight && tabOpt->selectedPosition != QStyleOptionTab::NextIsSelected)) {
- QColor borderColor;
- QColor borderHighlightColor;
- if (active) {
- borderColor = QColor(64, 64, 64);
- borderHighlightColor = QColor(140, 140, 140);
- } else {
- borderColor = QColor(135, 135, 135);
- borderHighlightColor = QColor(178, 178, 178);
- }
-
- int x = drawOnRight ? width : 0;
-
- // tab seperator line
- p->setPen(borderColor);
- p->drawLine(x, 2, x, height + 1);
-
- // tab seperator highlight
- p->setPen(borderHighlightColor);
- p->drawLine(x-1, 2, x-1, height + 1);
- p->drawLine(x+1, 2, x+1, height + 1);
+ // fill body
+ p->fillRect(bodyRect, tabBarTabBackgroundActiveHovered);
+ // bottom line
+ p->fillRect(bottomLineRect, tabBarTabLineActiveHovered);
}
}
+
+ // separator lines between tabs
+ const QRect leftLineRect(0, 1, 1, height - 2);
+ const QRect rightLineRect(width - 1, 1, 1, height - 2);
+ const QColor separatorLineColor = active ? tabBarTabLineActive : tabBarTabLine;
+ p->fillRect(leftLineRect, separatorLineColor);
+ p->fillRect(rightLineRect, separatorLineColor);
}
void drawTabBase(QPainter *p, const QStyleOptionTabBarBase *tbb, const QWidget *w)
@@ -387,53 +370,25 @@ void drawTabBase(QPainter *p, const QStyleOptionTabBarBase *tbb, const QWidget *
} else {
r.setHeight(w->height());
}
- QRect tabRect = rotateTabPainter(p, tbb->shape, r);
- int width = tabRect.width();
- int height = tabRect.height();
- bool active = (tbb->state & QStyle::State_Active);
-
- // top border lines
- QColor borderHighlightTop;
- QColor borderTop;
- if (active) {
- borderTop = QColor(64, 64, 64);
- borderHighlightTop = QColor(174, 174, 174);
- } else {
- borderTop = QColor(135, 135, 135);
- borderHighlightTop = QColor(207, 207, 207);
- }
- p->setPen(borderHighlightTop);
- p->drawLine(tabRect.x(), 0, width, 0);
- p->setPen(borderTop);
- p->drawLine(tabRect.x(), 1, width, 1);
-
- // center block
- QRect centralRect(tabRect.x(), 2, width, height - 2);
- if (active) {
- QColor mainColor = QColor(120, 120, 120);
- p->fillRect(centralRect, mainColor);
- } else {
- QLinearGradient gradient(centralRect.topLeft(), centralRect.bottomLeft());
- gradient.setColorAt(0, QColor(165, 165, 165));
- gradient.setColorAt(0.5, QColor(164, 164, 164));
- gradient.setColorAt(1, QColor(158, 158, 158));
- p->fillRect(centralRect, gradient);
- }
-
- // bottom border lines
- QColor borderHighlightBottom;
- QColor borderBottom;
- if (active) {
- borderHighlightBottom = QColor(153, 153, 153);
- borderBottom = QColor(64, 64, 64);
- } else {
- borderHighlightBottom = QColor(177, 177, 177);
- borderBottom = QColor(127, 127, 127);
- }
- p->setPen(borderHighlightBottom);
- p->drawLine(tabRect.x(), height - 2, width, height - 2);
- p->setPen(borderBottom);
- p->drawLine(tabRect.x(), height - 1, width, height - 1);
+ const QRect tabRect = rotateTabPainter(p, tbb->shape, r);
+ const int width = tabRect.width();
+ const int height = tabRect.height();
+ const bool active = (tbb->state & QStyle::State_Active);
+
+ // fill body
+ const QRect bodyRect(0, 1, width, height - 1);
+ const QColor bodyColor = active ? tabBarTabBackgroundActive : tabBarTabBackground;
+ p->fillRect(bodyRect, bodyColor);
+
+ // top line
+ const QRect topLineRect(0, 0, width, 1);
+ const QColor topLineColor = active ? tabBarTabLineActive : tabBarTabLine;
+ p->fillRect(topLineRect, topLineColor);
+
+ // bottom line
+ const QRect bottomLineRect(0, height - 1, width, 1);
+ const QColor bottomLineColor = active ? tabBarTabLineActive : tabBarTabLine;
+ p->fillRect(bottomLineRect, bottomLineColor);
}
#endif
@@ -662,12 +617,16 @@ static QSize qt_aqua_get_known_size(QStyle::ContentsType ct, const QWidget *widg
}
if (ct == QStyle::CT_CustomBase && widg) {
+#if QT_CONFIG(pushbutton)
if (qobject_cast<const QPushButton *>(widg))
ct = QStyle::CT_PushButton;
+#endif
else if (qobject_cast<const QRadioButton *>(widg))
ct = QStyle::CT_RadioButton;
+#if QT_CONFIG(checkbox)
else if (qobject_cast<const QCheckBox *>(widg))
ct = QStyle::CT_CheckBox;
+#endif
#ifndef QT_NO_COMBOBOX
else if (qobject_cast<const QComboBox *>(widg))
ct = QStyle::CT_ComboBox;
@@ -701,6 +660,7 @@ static QSize qt_aqua_get_known_size(QStyle::ContentsType ct, const QWidget *widg
}
switch (ct) {
+#if QT_CONFIG(pushbutton)
case QStyle::CT_PushButton: {
const QPushButton *psh = qobject_cast<const QPushButton *>(widg);
// If this comparison is false, then the widget was not a push button.
@@ -743,6 +703,7 @@ static QSize qt_aqua_get_known_size(QStyle::ContentsType ct, const QWidget *widg
// Since there's no default size we return the large size...
ret = QSize(-1, qt_mac_aqua_get_metric(kThemeMetricPushButtonHeight));
}
+#endif
#if 0 //Not sure we are applying the rules correctly for RadioButtons/CheckBoxes --Sam
} else if (ct == QStyle::CT_RadioButton) {
QRadioButton *rdo = static_cast<QRadioButton *>(widg);
@@ -1096,6 +1057,55 @@ void QMacStylePrivate::drawFocusRing(QPainter *p, const QRect &targetRect, int h
QRect(focusRingPixmap.width() - shCornerSize, svCornerSize, shCornerSize, focusRingPixmap.width() - 2 * svCornerSize));
}
+#ifndef QT_NO_TABBAR
+void QMacStylePrivate::tabLayout(const QStyleOptionTab *opt, const QWidget *widget, QRect *textRect) const
+{
+ Q_ASSERT(textRect);
+ QRect tr = opt->rect;
+ const bool verticalTabs = opt->shape == QTabBar::RoundedEast
+ || opt->shape == QTabBar::RoundedWest
+ || opt->shape == QTabBar::TriangularEast
+ || opt->shape == QTabBar::TriangularWest;
+ if (verticalTabs)
+ tr.setRect(0, 0, tr.height(), tr.width()); // 0, 0 as we will have a translate transform
+
+ int verticalShift = proxyStyle->pixelMetric(QStyle::PM_TabBarTabShiftVertical, opt, widget);
+ int horizontalShift = proxyStyle->pixelMetric(QStyle::PM_TabBarTabShiftHorizontal, opt, widget);
+ const int hpadding = 4;
+ const int vpadding = proxyStyle->pixelMetric(QStyle::PM_TabBarTabVSpace, opt, widget) / 2;
+ if (opt->shape == QTabBar::RoundedSouth || opt->shape == QTabBar::TriangularSouth)
+ verticalShift = -verticalShift;
+ tr.adjust(hpadding, verticalShift - vpadding, horizontalShift - hpadding, vpadding);
+ const bool selected = opt->state & QStyle::State_Selected;
+ if (selected) {
+ tr.setTop(tr.top() - verticalShift);
+ tr.setRight(tr.right() - horizontalShift);
+ }
+
+ // left widget
+ if (!opt->leftButtonSize.isEmpty()) {
+ const int buttonSize = verticalTabs ? opt->leftButtonSize.height() : opt->leftButtonSize.width();
+ tr.setLeft(tr.left() + 4 + buttonSize);
+ // make text aligned to center
+ if (opt->rightButtonSize.isEmpty())
+ tr.setRight(tr.right() - 4 - buttonSize);
+ }
+ // right widget
+ if (!opt->rightButtonSize.isEmpty()) {
+ const int buttonSize = verticalTabs ? opt->rightButtonSize.height() : opt->rightButtonSize.width();
+ tr.setRight(tr.right() - 4 - buttonSize);
+ // make text aligned to center
+ if (opt->leftButtonSize.isEmpty())
+ tr.setLeft(tr.left() + 4 + buttonSize);
+ }
+
+ if (!verticalTabs)
+ tr = proxyStyle->visualRect(opt->direction, opt->rect, tr);
+
+ *textRect = tr;
+}
+#endif //QT_NO_TABBAR
+
QAquaWidgetSize QMacStylePrivate::effectiveAquaSizeConstrain(const QStyleOption *option,
const QWidget *widg,
QStyle::ContentsType ct,
@@ -1304,6 +1314,7 @@ void QMacStylePrivate::initHIThemePushButton(const QStyleOptionButton *btn,
}
}
+#if QT_CONFIG(pushbutton)
bool qt_mac_buttonIsRenderedFlat(const QPushButton *pushButton, const QStyleOptionButton *option)
{
QMacStyle *macStyle = qobject_cast<QMacStyle *>(pushButton->style());
@@ -1313,6 +1324,7 @@ bool qt_mac_buttonIsRenderedFlat(const QPushButton *pushButton, const QStyleOpti
macStyle->d_func()->initHIThemePushButton(option, pushButton, kThemeStateActive, &bdi);
return bdi.kind == kThemeBevelButton;
}
+#endif
/**
Creates a HIThemeButtonDrawInfo structure that specifies the correct button
@@ -2461,6 +2473,26 @@ int QMacStyle::pixelMetric(PixelMetric metric, const QStyleOption *opt, const QW
ret = int([NSWindow frameRectForContentRect:NSZeroRect
styleMask:NSTitledWindowMask].size.height);
break;
+ case QStyle::PM_TabBarTabHSpace:
+ switch (d->aquaSizeConstrain(opt, widget)) {
+ case QAquaSizeLarge:
+ ret = QCommonStyle::pixelMetric(metric, opt, widget);
+ break;
+ case QAquaSizeSmall:
+ ret = 20;
+ break;
+ case QAquaSizeMini:
+ ret = 16;
+ break;
+ case QAquaSizeUnknown:
+ const QStyleOptionTab *tb = qstyleoption_cast<const QStyleOptionTab *>(opt);
+ if (tb && tb->documentMode)
+ ret = 24;
+ else
+ ret = QCommonStyle::pixelMetric(metric, opt, widget);
+ break;
+ }
+ break;
case PM_TabBarTabVSpace:
ret = 4;
break;
@@ -2469,10 +2501,10 @@ int QMacStyle::pixelMetric(PixelMetric metric, const QStyleOption *opt, const QW
ret = 0;
break;
case PM_TabBarBaseHeight:
- ret = 0;
+ ret = 21;
break;
case PM_TabBarTabOverlap:
- ret = 0;
+ ret = 1;
break;
case PM_TabBarBaseOverlap:
switch (d->aquaSizeConstrain(opt, widget)) {
@@ -2649,20 +2681,6 @@ int QMacStyle::pixelMetric(PixelMetric metric, const QStyleOption *opt, const QW
case PM_LayoutHorizontalSpacing:
case PM_LayoutVerticalSpacing:
return -1;
- case QStyle::PM_TabBarTabHSpace:
- switch (d->aquaSizeConstrain(opt, widget)) {
- case QAquaSizeLarge:
- case QAquaSizeUnknown:
- ret = QCommonStyle::pixelMetric(metric, opt, widget);
- break;
- case QAquaSizeSmall:
- ret = 20;
- break;
- case QAquaSizeMini:
- ret = 16;
- break;
- }
- break;
case PM_MenuHMargin:
ret = 0;
break;
@@ -2930,9 +2948,11 @@ int QMacStyle::styleHint(StyleHint sh, const QStyleOption *opt, const QWidget *w
case SH_TabBar_ElideMode:
ret = Qt::ElideRight;
break;
+#if QT_CONFIG(dialogbuttonbox)
case SH_DialogButtonLayout:
ret = QDialogButtonBox::MacLayout;
break;
+#endif
case SH_FormLayoutWrapPolicy:
ret = QFormLayout::DontWrapRows;
break;
@@ -3487,10 +3507,18 @@ void QMacStyle::drawPrimitive(PrimitiveElement pe, const QStyleOption *opt, QPai
case PE_FrameStatusBarItem:
break;
case PE_IndicatorTabClose: {
- bool hover = (opt->state & State_MouseOver);
- bool selected = (opt->state & State_Selected);
- bool active = (opt->state & State_Active);
- drawTabCloseButton(p, hover, active, selected);
+ // Make close button visible only on the hovered tab.
+ if (QTabBar *tabBar = qobject_cast<QTabBar*>(w->parentWidget())) {
+ const QTabBarPrivate *tabBarPrivate = static_cast<QTabBarPrivate *>(QObjectPrivate::get(tabBar));
+ const int hoveredTabIndex = tabBarPrivate->hoveredTabIndex();
+ if (hoveredTabIndex != -1 && ((w == tabBar->tabButton(hoveredTabIndex, QTabBar::LeftSide)) ||
+ (w == tabBar->tabButton(hoveredTabIndex, QTabBar::RightSide)))) {
+ const bool hover = (opt->state & State_MouseOver);
+ const bool selected = (opt->state & State_Selected);
+ const bool pressed = (opt->state & State_Sunken);
+ drawTabCloseButton(p, hover, selected, pressed);
+ }
+ }
} break;
case PE_PanelStatusBar: {
// Fill the status bar with the titlebar gradient.
@@ -4027,7 +4055,6 @@ void QMacStyle::drawControl(ControlElement ce, const QStyleOption *opt, QPainter
#ifndef QT_NO_TABBAR
case CE_TabBarTabShape:
if (const QStyleOptionTab *tabOpt = qstyleoption_cast<const QStyleOptionTab *>(opt)) {
-
if (tabOpt->documentMode) {
p->save();
bool isUnified = false;
@@ -4037,7 +4064,9 @@ void QMacStyle::drawControl(ControlElement ce, const QStyleOption *opt, QPainter
isUnified = isInMacUnifiedToolbarArea(w->window()->windowHandle(), windowTabStart.y());
}
- drawTabShape(p, tabOpt, isUnified);
+ const int tabOverlap = proxy()->pixelMetric(PM_TabBarTabOverlap, opt, w);
+ drawTabShape(p, tabOpt, isUnified, tabOverlap);
+
p->restore();
return;
}
@@ -4163,23 +4192,6 @@ void QMacStyle::drawControl(ControlElement ce, const QStyleOption *opt, QPainter
}
myTab.rect.setHeight(myTab.rect.height() + heightOffset);
- if (myTab.documentMode) {
- p->save();
- rotateTabPainter(p, myTab.shape, myTab.rect);
-
- QColor shadowColor = QColor(myTab.documentMode ? Qt::white : Qt::black);
- shadowColor.setAlpha(75);
- QPalette np = tab->palette;
- np.setColor(QPalette::WindowText, shadowColor);
-
- QRect nr = proxy()->subElementRect(SE_TabBarTabText, opt, w);
- nr.moveTop(-1);
- int alignment = Qt::AlignCenter | Qt::TextShowMnemonic | Qt::TextHideMnemonic;
- proxy()->drawItemText(p, nr, alignment, np, tab->state & State_Enabled,
- tab->text, QPalette::WindowText);
- p->restore();
- }
-
QCommonStyle::drawControl(ce, &myTab, p, w);
} else {
p->save();
@@ -4897,6 +4909,73 @@ QRect QMacStyle::subElementRect(SubElement sr, const QStyleOption *opt,
}
}
break;
+ case SE_TabBarTabText:
+ if (const QStyleOptionTab *tab = qstyleoption_cast<const QStyleOptionTab *>(opt)) {
+ d->tabLayout(tab, widget, &rect);
+ }
+ break;
+ case SE_TabBarTabLeftButton:
+ case SE_TabBarTabRightButton:
+ if (const QStyleOptionTab *tab = qstyleoption_cast<const QStyleOptionTab *>(opt)) {
+ bool selected = tab->state & State_Selected;
+ int verticalShift = proxy()->pixelMetric(QStyle::PM_TabBarTabShiftVertical, tab, widget);
+ int horizontalShift = proxy()->pixelMetric(QStyle::PM_TabBarTabShiftHorizontal, tab, widget);
+ int hpadding = 5;
+
+ bool verticalTabs = tab->shape == QTabBar::RoundedEast
+ || tab->shape == QTabBar::RoundedWest
+ || tab->shape == QTabBar::TriangularEast
+ || tab->shape == QTabBar::TriangularWest;
+
+ QRect tr = tab->rect;
+ if (tab->shape == QTabBar::RoundedSouth || tab->shape == QTabBar::TriangularSouth)
+ verticalShift = -verticalShift;
+ if (verticalTabs) {
+ qSwap(horizontalShift, verticalShift);
+ horizontalShift *= -1;
+ verticalShift *= -1;
+ }
+ if (tab->shape == QTabBar::RoundedWest || tab->shape == QTabBar::TriangularWest)
+ horizontalShift = -horizontalShift;
+
+ tr.adjust(0, 0, horizontalShift, verticalShift);
+ if (selected)
+ {
+ tr.setBottom(tr.bottom() - verticalShift);
+ tr.setRight(tr.right() - horizontalShift);
+ }
+
+ QSize size = (sr == SE_TabBarTabLeftButton) ? tab->leftButtonSize : tab->rightButtonSize;
+ int w = size.width();
+ int h = size.height();
+ int midHeight = static_cast<int>(qCeil(float(tr.height() - h) / 2));
+ int midWidth = ((tr.width() - w) / 2);
+
+ bool atTheTop = true;
+ switch (tab->shape) {
+ case QTabBar::RoundedWest:
+ case QTabBar::TriangularWest:
+ atTheTop = (sr == SE_TabBarTabLeftButton);
+ break;
+ case QTabBar::RoundedEast:
+ case QTabBar::TriangularEast:
+ atTheTop = (sr == SE_TabBarTabRightButton);
+ break;
+ default:
+ if (sr == SE_TabBarTabLeftButton)
+ rect = QRect(tab->rect.x() + hpadding, midHeight, w, h);
+ else
+ rect = QRect(tab->rect.right() - w - hpadding, midHeight, w, h);
+ rect = visualRect(tab->direction, tab->rect, rect);
+ }
+ if (verticalTabs) {
+ if (atTheTop)
+ rect = QRect(midWidth, tr.y() + tab->rect.height() - hpadding - h, w, h);
+ else
+ rect = QRect(midWidth, tr.y() + hpadding, w, h);
+ }
+ }
+ break;
#endif
case SE_LineEditContents:
rect = QCommonStyle::subElementRect(sr, opt, widget);
@@ -6504,13 +6583,14 @@ QSize QMacStyle::sizeFromContents(ContentsType ct, const QStyleOption *opt,
if (vertTabs)
sz = sz.transposed();
int defaultTabHeight;
- int defaultExtraSpace = proxy()->pixelMetric(PM_TabBarTabHSpace, tab, widget); // Remove spurious gcc warning (AFAIK)
+ int extraHSpace = proxy()->pixelMetric(PM_TabBarTabHSpace, tab, widget);
+ int extraVSpace = proxy()->pixelMetric(PM_TabBarTabVSpace, tab, widget);
QFontMetrics fm = opt->fontMetrics;
switch (AquaSize) {
case QAquaSizeUnknown:
case QAquaSizeLarge:
if (tab->documentMode)
- defaultTabHeight = 23;
+ defaultTabHeight = 24;
else
defaultTabHeight = 21;
break;
@@ -6524,10 +6604,11 @@ QSize QMacStyle::sizeFromContents(ContentsType ct, const QStyleOption *opt,
bool setWidth = false;
if (differentFont || !tab->icon.isNull()) {
sz.rheight() = qMax(defaultTabHeight, sz.height());
+ sz.rwidth() += extraHSpace;
} else {
QSize textSize = fm.size(Qt::TextShowMnemonic, tab->text);
sz.rheight() = qMax(defaultTabHeight, textSize.height());
- sz.rwidth() = textSize.width() + defaultExtraSpace;
+ sz.rwidth() = textSize.width() + extraVSpace;
setWidth = true;
}
diff --git a/src/widgets/styles/qmacstyle_mac_p.h b/src/widgets/styles/qmacstyle_mac_p.h
index 2fb6265d75..03f5d7280f 100644
--- a/src/widgets/styles/qmacstyle_mac_p.h
+++ b/src/widgets/styles/qmacstyle_mac_p.h
@@ -121,7 +121,9 @@ private:
Q_DISABLE_COPY(QMacStyle)
Q_DECLARE_PRIVATE(QMacStyle)
+#if QT_CONFIG(pushbutton)
friend bool qt_mac_buttonIsRenderedFlat(const QPushButton *pushButton, const QStyleOptionButton *option);
+#endif
};
#endif
diff --git a/src/widgets/styles/qmacstyle_mac_p_p.h b/src/widgets/styles/qmacstyle_mac_p_p.h
index 798f6ed90b..59f6e893b1 100644
--- a/src/widgets/styles/qmacstyle_mac_p_p.h
+++ b/src/widgets/styles/qmacstyle_mac_p_p.h
@@ -53,9 +53,13 @@
#include <private/qstylehelper_p.h>
#include <qapplication.h>
#include <qbitmap.h>
+#if QT_CONFIG(checkbox)
#include <qcheckbox.h>
+#endif
#include <qcombobox.h>
+#if QT_CONFIG(dialogbuttonbox)
#include <qdialogbuttonbox.h>
+#endif
#include <qdockwidget.h>
#include <qevent.h>
#include <qfocusframe.h>
@@ -74,7 +78,9 @@
#include <qpixmapcache.h>
#include <qpointer.h>
#include <qprogressbar.h>
+#if QT_CONFIG(pushbutton)
#include <qpushbutton.h>
+#endif
#include <qradiobutton.h>
#include <qrubberband.h>
#include <qsizegrip.h>
@@ -154,7 +160,9 @@ typedef void (^QCocoaDrawRectBlock)(NSRect, CGContextRef);
return sizes[controlSize]; \
} while (0)
+#if QT_CONFIG(pushbutton)
bool qt_mac_buttonIsRenderedFlat(const QPushButton *pushButton, const QStyleOptionButton *option);
+#endif
class QMacStylePrivate : public QCommonStylePrivate
{
@@ -221,6 +229,10 @@ public:
void drawFocusRing(QPainter *p, const QRect &targetRect, int hMargin, int vMargin, qreal radius = 0) const;
+#ifndef QT_NO_TABBAR
+ void tabLayout(const QStyleOptionTab *opt, const QWidget *widget, QRect *textRect) const;
+#endif
+
public:
mutable QPointer<QObject> pressedButton;
mutable QPointer<QObject> defaultButton;
diff --git a/src/widgets/styles/qpixmapstyle.cpp b/src/widgets/styles/qpixmapstyle.cpp
index a947f5d079..3aec3cf991 100644
--- a/src/widgets/styles/qpixmapstyle.cpp
+++ b/src/widgets/styles/qpixmapstyle.cpp
@@ -60,7 +60,9 @@
#include <QAbstractScrollArea>
#include <QScrollBar>
+#if QT_CONFIG(scroller)
#include <qscroller.h>
+#endif
QT_BEGIN_NAMESPACE
@@ -194,7 +196,7 @@ void QPixmapStyle::polish(QWidget *widget)
view->setVerticalScrollMode(QAbstractItemView::ScrollPerPixel);
}
#endif
-#if QT_CONFIG(gestures)
+#if QT_CONFIG(gestures) && QT_CONFIG(scroller)
QScroller::grabGesture(scrollArea->viewport(), QScroller::LeftMouseButtonGesture);
#endif
}
@@ -235,7 +237,7 @@ void QPixmapStyle::unpolish(QWidget *widget)
if (qstrcmp(widget->metaObject()->className(),"QComboBoxPrivateContainer") == 0)
widget->removeEventFilter(this);
-#if QT_CONFIG(gestures) && QT_CONFIG(scrollarea)
+#if QT_CONFIG(gestures) && QT_CONFIG(scrollarea) && QT_CONFIG(scroller)
if (QAbstractScrollArea *scrollArea = qobject_cast<QAbstractScrollArea*>(widget))
QScroller::ungrabGesture(scrollArea->viewport());
#endif
diff --git a/src/widgets/styles/qstylesheetstyle.cpp b/src/widgets/styles/qstylesheetstyle.cpp
index 085c743437..7dc1c35333 100644
--- a/src/widgets/styles/qstylesheetstyle.cpp
+++ b/src/widgets/styles/qstylesheetstyle.cpp
@@ -58,12 +58,16 @@
#include "private/qabstractscrollarea_p.h"
#include <qtooltip.h>
#include <qshareddata.h>
-#include <qradiobutton.h>
#include <qtoolbutton.h>
#include <qscrollbar.h>
+#if QT_CONFIG(abstractslider)
+#include <qabstractslider.h>
+#endif
#include <qstring.h>
#include <qfile.h>
+#if QT_CONFIG(checkbox)
#include <qcheckbox.h>
+#endif
#include <qstatusbar.h>
#include <qheaderview.h>
#include <private/qwindowsstyle_p_p.h>
@@ -76,7 +80,9 @@
#include <qdialog.h>
#include <private/qwidget_p.h>
#include <QAbstractSpinBox>
+#if QT_CONFIG(label)
#include <QLabel>
+#endif
#include "qdrawutil.h"
#include <limits.h>
@@ -1416,11 +1422,13 @@ void QRenderRule::configurePalette(QPalette *p, QPalette::ColorGroup cg, const Q
static inline QObject *parentObject(const QObject *obj)
{
+#if QT_CONFIG(tooltip)
if (qobject_cast<const QLabel *>(obj) && qstrcmp(obj->metaObject()->className(), "QTipLabel") == 0) {
QObject *p = qvariant_cast<QObject *>(obj->property("_q_stylesheet_parent"));
if (p)
return p;
}
+#endif
return obj->parent();
}
@@ -2422,9 +2430,11 @@ static bool unstylable(const QWidget *w)
static quint64 extendedPseudoClass(const QWidget *w)
{
quint64 pc = w->isWindow() ? quint64(PseudoClass_Window) : 0;
+#if QT_CONFIG(abstractslider)
if (const QAbstractSlider *slider = qobject_cast<const QAbstractSlider *>(w)) {
pc |= ((slider->orientation() == Qt::Vertical) ? PseudoClass_Vertical : PseudoClass_Horizontal);
} else
+#endif
#ifndef QT_NO_COMBOBOX
if (const QComboBox *combo = qobject_cast<const QComboBox *>(w)) {
if (combo->isEditable())
@@ -2590,7 +2600,7 @@ void QStyleSheetStyle::setPalette(QWidget *w)
if (!useStyleSheetPropagationInWidgetStyles || p.resolve() != 0) {
QPalette wp = w->palette();
- styleSheetCaches->customPaletteWidgets.insert(w, qMakePair(wp, p.resolve()));
+ styleSheetCaches->customPaletteWidgets.insert(w, {wp, p.resolve()});
if (useStyleSheetPropagationInWidgetStyles) {
p = p.resolve(wp);
@@ -2610,20 +2620,14 @@ void QStyleSheetStyle::unsetPalette(QWidget *w)
const auto it = styleSheetCaches->customPaletteWidgets.find(w);
if (it != styleSheetCaches->customPaletteWidgets.end()) {
- QPair<QPalette, uint> p = std::move(*it);
+ auto customizedPalette = std::move(*it);
styleSheetCaches->customPaletteWidgets.erase(it);
- QPalette original = p.first;
-
- if (useStyleSheetPropagationInWidgetStyles) {
- original.resolve(original.resolve() & p.second);
-
- QPalette wp = w->palette();
- wp.resolve(wp.resolve() & ~p.second);
- wp.resolve(original);
- wp.resolve(wp.resolve() | original.resolve());
- original = wp;
- }
+ QPalette original;
+ if (useStyleSheetPropagationInWidgetStyles)
+ original = std::move(customizedPalette).reverted(w->palette());
+ else
+ original = customizedPalette.oldWidgetValue;
w->setPalette(original);
QWidget *ew = embeddedWidget(w);
@@ -2653,18 +2657,9 @@ void QStyleSheetStyle::unsetStyleSheetFont(QWidget *w) const
{
const auto it = styleSheetCaches->customFontWidgets.find(w);
if (it != styleSheetCaches->customFontWidgets.end()) {
- QPair<QFont, uint> f = std::move(*it);
+ auto customizedFont = std::move(*it);
styleSheetCaches->customFontWidgets.erase(it);
-
- QFont original = f.first;
- original.resolve(original.resolve() & f.second);
-
- QFont font = w->font();
- font.resolve(font.resolve() & ~f.second);
- font.resolve(original);
- font.resolve(font.resolve() | original.resolve());
-
- w->setFont(font);
+ w->setFont(std::move(customizedFont).reverted(w->font()));
}
}
@@ -4738,10 +4733,12 @@ int QStyleSheetStyle::pixelMetric(PixelMetric m, const QStyleOption *opt, const
return rule.box()->spacing;
break;
case PM_CheckBoxLabelSpacing:
+#if QT_CONFIG(checkbox)
if (qobject_cast<const QCheckBox *>(w)) {
if (rule.hasBox() && rule.box()->spacing != -1)
return rule.box()->spacing;
}
+#endif
// assume group box
subRule = renderRule(w, opt, PseudoElement_GroupBoxTitle);
if (subRule.hasBox() && subRule.box()->spacing != -1)
@@ -5948,7 +5945,7 @@ void QStyleSheetStyle::updateStyleSheetFont(QWidget* w) const
if (rule.font.resolve()) {
QFont wf = w->font();
- styleSheetCaches->customFontWidgets.insert(w, qMakePair(wf, rule.font.resolve()));
+ styleSheetCaches->customFontWidgets.insert(w, {wf, rule.font.resolve()});
QFont font = rule.font.resolve(wf);
font.resolve(wf.resolve() | rule.font.resolve());
diff --git a/src/widgets/styles/qstylesheetstyle_p.h b/src/widgets/styles/qstylesheetstyle_p.h
index 55dd2df329..2d302305bd 100644
--- a/src/widgets/styles/qstylesheetstyle_p.h
+++ b/src/widgets/styles/qstylesheetstyle_p.h
@@ -189,12 +189,31 @@ public:
QHash<const QObject *, QRenderRules> renderRulesCache;
QHash<const void *, QCss::StyleSheet> styleSheetCache; // parsed style sheets
QSet<const QWidget *> autoFillDisabledWidgets;
- // widgets whose palettes and fonts we have tampered. stored value pair is
- // QPair<old widget value, resolve mask of stylesheet value>
- QHash<const QWidget *, QPair<QPalette, uint> > customPaletteWidgets;
- QHash<const QWidget *, QPair<QFont, uint> > customFontWidgets;
+ // widgets with whose palettes and fonts we have tampered:
+ template <typename T>
+ struct Tampered {
+ T oldWidgetValue;
+ uint resolveMask;
+
+ // only call this function on an rvalue *this (it mangles oldWidgetValue)
+ T reverted(T current)
+#ifdef Q_COMPILER_REF_QUALIFIERS
+ &&
+#endif
+ {
+ oldWidgetValue.resolve(oldWidgetValue.resolve() & resolveMask);
+ current.resolve(current.resolve() & ~resolveMask);
+ current.resolve(oldWidgetValue);
+ current.resolve(current.resolve() | oldWidgetValue.resolve());
+ return current;
+ }
+ };
+ QHash<const QWidget *, Tampered<QPalette>> customPaletteWidgets;
+ QHash<const QWidget *, Tampered<QFont>> customFontWidgets;
};
-
+template <typename T>
+class QTypeInfo<QStyleSheetStyleCaches::Tampered<T>>
+ : QTypeInfoMerger<QStyleSheetStyleCaches::Tampered<T>, T> {};
QT_END_NAMESPACE
#endif // QT_NO_STYLE_STYLESHEET
diff --git a/src/widgets/styles/qwindowsvistastyle.cpp b/src/widgets/styles/qwindowsvistastyle.cpp
index 1bdd8bf0c8..5a53627e95 100644
--- a/src/widgets/styles/qwindowsvistastyle.cpp
+++ b/src/widgets/styles/qwindowsvistastyle.cpp
@@ -775,6 +775,7 @@ void QWindowsVistaStyle::drawPrimitive(PrimitiveElement element, const QStyleOpt
}
case PE_Widget:
{
+#if QT_CONFIG(dialogbuttonbox)
const QDialogButtonBox *buttonBox = 0;
if (qobject_cast<const QMessageBox *> (widget))
@@ -801,6 +802,7 @@ void QWindowsVistaStyle::drawPrimitive(PrimitiveElement element, const QStyleOpt
theme.partId = TDLG_SECONDARYPANEL;
d->drawBackground(theme);
}
+#endif
}
break;
default:
@@ -2315,16 +2317,20 @@ void QWindowsVistaStyle::polish(QWidget *widget)
}
} else if (qobject_cast<QMessageBox *> (widget)) {
widget->setAttribute(Qt::WA_StyledBackground);
+#if QT_CONFIG(dialogbuttonbox)
QDialogButtonBox *buttonBox = widget->findChild<QDialogButtonBox *>(QLatin1String("qt_msgbox_buttonbox"));
if (buttonBox)
buttonBox->setContentsMargins(0, 9, 0, 0);
+#endif
}
#ifndef QT_NO_INPUTDIALOG
else if (qobject_cast<QInputDialog *> (widget)) {
widget->setAttribute(Qt::WA_StyledBackground);
+#if QT_CONFIG(dialogbuttonbox)
QDialogButtonBox *buttonBox = widget->findChild<QDialogButtonBox *>(QLatin1String("qt_inputdlg_buttonbox"));
if (buttonBox)
buttonBox->setContentsMargins(0, 9, 0, 0);
+#endif
}
#endif // QT_NO_INPUTDIALOG
else if (QTreeView *tree = qobject_cast<QTreeView *> (widget)) {
@@ -2355,16 +2361,20 @@ void QWindowsVistaStyle::unpolish(QWidget *widget)
widget->setAttribute(Qt::WA_Hover, false);
else if (qobject_cast<QMessageBox *> (widget)) {
widget->setAttribute(Qt::WA_StyledBackground, false);
+#if QT_CONFIG(dialogbuttonbox)
QDialogButtonBox *buttonBox = widget->findChild<QDialogButtonBox *>(QLatin1String("qt_msgbox_buttonbox"));
if (buttonBox)
buttonBox->setContentsMargins(0, 0, 0, 0);
+#endif
}
#ifndef QT_NO_INPUTDIALOG
else if (qobject_cast<QInputDialog *> (widget)) {
widget->setAttribute(Qt::WA_StyledBackground, false);
+#if QT_CONFIG(dialogbuttonbox)
QDialogButtonBox *buttonBox = widget->findChild<QDialogButtonBox *>(QLatin1String("qt_inputdlg_buttonbox"));
if (buttonBox)
buttonBox->setContentsMargins(0, 0, 0, 0);
+#endif
}
#endif // QT_NO_INPUTDIALOG
else if (QTreeView *tree = qobject_cast<QTreeView *> (widget)) {
diff --git a/src/widgets/styles/qwindowsvistastyle_p_p.h b/src/widgets/styles/qwindowsvistastyle_p_p.h
index 18b6f9c3f7..ec7c2caad3 100644
--- a/src/widgets/styles/qwindowsvistastyle_p_p.h
+++ b/src/widgets/styles/qwindowsvistastyle_p_p.h
@@ -64,9 +64,10 @@
#include <qapplication.h>
#include <qpixmapcache.h>
#include <qstyleoption.h>
+#if QT_CONFIG(pushbutton)
#include <qpushbutton.h>
+#endif
#include <qradiobutton.h>
-#include <qcheckbox.h>
#include <qlineedit.h>
#include <qgroupbox.h>
#include <qtoolbutton.h>
@@ -80,7 +81,9 @@
#include <qtreeview.h>
#include <qtextedit.h>
#include <qmessagebox.h>
+#if QT_CONFIG(dialogbuttonbox)
#include <qdialogbuttonbox.h>
+#endif
#include <qinputdialog.h>
#include <qtableview.h>
#include <qdatetime.h>
diff --git a/src/widgets/styles/qwindowsxpstyle.cpp b/src/widgets/styles/qwindowsxpstyle.cpp
index f50c143a4a..f3c6069f8a 100644
--- a/src/widgets/styles/qwindowsxpstyle.cpp
+++ b/src/widgets/styles/qwindowsxpstyle.cpp
@@ -65,7 +65,9 @@
#include <qspinbox.h>
#include <qlistview.h>
#include <qstackedwidget.h>
+#if QT_CONFIG(pushbutton)
#include <qpushbutton.h>
+#endif
#include <qtoolbar.h>
#include <qlabel.h>
#include <qvarlengtharray.h>
diff --git a/src/widgets/util/qcompleter.cpp b/src/widgets/util/qcompleter.cpp
index 3006f0c9ce..e8f23f08bc 100644
--- a/src/widgets/util/qcompleter.cpp
+++ b/src/widgets/util/qcompleter.cpp
@@ -1347,11 +1347,12 @@ bool QCompleter::eventFilter(QObject *o, QEvent *e)
}
// default implementation for keys not handled by the widget when popup is open
+#if QT_CONFIG(shortcut)
if (ke->matches(QKeySequence::Cancel)) {
d->popup->hide();
return true;
}
-
+#endif
switch (key) {
#ifdef QT_KEYPAD_NAVIGATION
case Qt::Key_Select:
diff --git a/src/widgets/util/qscroller.h b/src/widgets/util/qscroller.h
index 561dcfaefc..ca8d059f50 100644
--- a/src/widgets/util/qscroller.h
+++ b/src/widgets/util/qscroller.h
@@ -45,6 +45,8 @@
#include <QtCore/QPointF>
#include <QtWidgets/QScrollerProperties>
+QT_REQUIRE_CONFIG(scroller);
+
QT_BEGIN_NAMESPACE
diff --git a/src/widgets/util/qscrollerproperties.h b/src/widgets/util/qscrollerproperties.h
index 4fdc9bd32f..2fc1a5dc18 100644
--- a/src/widgets/util/qscrollerproperties.h
+++ b/src/widgets/util/qscrollerproperties.h
@@ -45,6 +45,8 @@
#include <QtCore/QMetaType>
#include <QtCore/QVariant>
+QT_REQUIRE_CONFIG(scroller);
+
QT_BEGIN_NAMESPACE
diff --git a/src/widgets/util/qsystemtrayicon.cpp b/src/widgets/util/qsystemtrayicon.cpp
index 83c1764f38..1e0d2ab857 100644
--- a/src/widgets/util/qsystemtrayicon.cpp
+++ b/src/widgets/util/qsystemtrayicon.cpp
@@ -46,8 +46,13 @@
#include "qlist.h"
#include "qevent.h"
#include "qpoint.h"
+#if QT_CONFIG(label)
#include "qlabel.h"
+#include "private/qlabel_p.h"
+#endif
+#if QT_CONFIG(pushbutton)
#include "qpushbutton.h"
+#endif
#include "qpainterpath.h"
#include "qpainter.h"
#include "qstyle.h"
@@ -55,7 +60,6 @@
#include "qapplication.h"
#include "qdesktopwidget.h"
#include "qbitmap.h"
-#include "private/qlabel_p.h"
QT_BEGIN_NAMESPACE
@@ -481,6 +485,7 @@ QBalloonTip::QBalloonTip(const QIcon &icon, const QString &title,
setAttribute(Qt::WA_DeleteOnClose);
QObject::connect(ti, SIGNAL(destroyed()), this, SLOT(close()));
+#if QT_CONFIG(label)
QLabel *titleLabel = new QLabel;
titleLabel->installEventFilter(this);
titleLabel->setText(title);
@@ -488,17 +493,21 @@ QBalloonTip::QBalloonTip(const QIcon &icon, const QString &title,
f.setBold(true);
titleLabel->setFont(f);
titleLabel->setTextFormat(Qt::PlainText); // to maintain compat with windows
+#endif
const int iconSize = 18;
const int closeButtonSize = 15;
+#if QT_CONFIG(pushbutton)
QPushButton *closeButton = new QPushButton;
closeButton->setIcon(style()->standardIcon(QStyle::SP_TitleBarCloseButton));
closeButton->setIconSize(QSize(closeButtonSize, closeButtonSize));
closeButton->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
closeButton->setFixedSize(closeButtonSize, closeButtonSize);
QObject::connect(closeButton, SIGNAL(clicked()), this, SLOT(close()));
+#endif
+#if QT_CONFIG(label)
QLabel *msgLabel = new QLabel;
msgLabel->installEventFilter(this);
msgLabel->setText(message);
@@ -521,8 +530,10 @@ QBalloonTip::QBalloonTip(const QIcon &icon, const QString &title,
// to emulate the weird standard windows behavior.
msgLabel->setFixedSize(limit, msgLabel->heightForWidth(limit));
}
+#endif
QGridLayout *layout = new QGridLayout;
+#if QT_CONFIG(label)
if (!icon.isNull()) {
QLabel *iconLabel = new QLabel;
iconLabel->setPixmap(icon.pixmap(iconSize, iconSize));
@@ -533,9 +544,15 @@ QBalloonTip::QBalloonTip(const QIcon &icon, const QString &title,
} else {
layout->addWidget(titleLabel, 0, 0, 1, 2);
}
+#endif
+#if QT_CONFIG(pushbutton)
layout->addWidget(closeButton, 0, 2);
+#endif
+
+#if QT_CONFIG(label)
layout->addWidget(msgLabel, 1, 0, 1, 3);
+#endif
layout->setSizeConstraint(QLayout::SetFixedSize);
layout->setMargin(3);
setLayout(layout);
diff --git a/src/widgets/util/qsystemtrayicon_x11.cpp b/src/widgets/util/qsystemtrayicon_x11.cpp
index ac6c14dc63..cbd5d9eb80 100644
--- a/src/widgets/util/qsystemtrayicon_x11.cpp
+++ b/src/widgets/util/qsystemtrayicon_x11.cpp
@@ -37,7 +37,10 @@
**
****************************************************************************/
+#include "qtwidgetsglobal.h"
+#if QT_CONFIG(label)
#include "qlabel.h"
+#endif
#include "qpainter.h"
#include "qpixmap.h"
#include "qbitmap.h"
diff --git a/src/widgets/util/util.pri b/src/widgets/util/util.pri
index cb19c1fc95..b9b62d9bb0 100644
--- a/src/widgets/util/util.pri
+++ b/src/widgets/util/util.pri
@@ -6,11 +6,6 @@ HEADERS += \
util/qcompleter.h \
util/qcompleter_p.h \
util/qsystemtrayicon_p.h \
- util/qscroller.h \
- util/qscroller_p.h \
- util/qscrollerproperties.h \
- util/qscrollerproperties_p.h \
- util/qflickgesture_p.h \
util/qundogroup.h \
util/qundostack.h \
util/qundostack_p.h \
@@ -20,13 +15,24 @@ SOURCES += \
util/qsystemtrayicon.cpp \
util/qcolormap.cpp \
util/qcompleter.cpp \
- util/qscroller.cpp \
- util/qscrollerproperties.cpp \
- util/qflickgesture.cpp \
util/qundogroup.cpp \
util/qundostack.cpp \
util/qundoview.cpp
+qtConfig(scroller) {
+ HEADERS += \
+ util/qscroller.h \
+ util/qscroller_p.h \
+ util/qscrollerproperties.h \
+ util/qscrollerproperties_p.h \
+ util/qflickgesture_p.h
+
+ SOURCES += \
+ util/qscroller.cpp \
+ util/qscrollerproperties.cpp \
+ util/qflickgesture.cpp \
+}
+
win32:!winrt {
SOURCES += util/qsystemtrayicon_win.cpp
} else: qtConfig(xcb) {
diff --git a/src/widgets/widgets/qabstractslider.h b/src/widgets/widgets/qabstractslider.h
index 86d6830f10..8979685724 100644
--- a/src/widgets/widgets/qabstractslider.h
+++ b/src/widgets/widgets/qabstractslider.h
@@ -43,6 +43,8 @@
#include <QtWidgets/qtwidgetsglobal.h>
#include <QtWidgets/qwidget.h>
+QT_REQUIRE_CONFIG(abstractslider);
+
QT_BEGIN_NAMESPACE
diff --git a/src/widgets/widgets/qabstractslider_p.h b/src/widgets/widgets/qabstractslider_p.h
index 600616061a..419ce2ba07 100644
--- a/src/widgets/widgets/qabstractslider_p.h
+++ b/src/widgets/widgets/qabstractslider_p.h
@@ -57,6 +57,8 @@
#include "private/qwidget_p.h"
#include "qstyle.h"
+QT_REQUIRE_CONFIG(abstractslider);
+
QT_BEGIN_NAMESPACE
class QAbstractSliderPrivate : public QWidgetPrivate
diff --git a/src/widgets/widgets/qcalendarwidget.cpp b/src/widgets/widgets/qcalendarwidget.cpp
index da4850a816..f81377a85c 100644
--- a/src/widgets/widgets/qcalendarwidget.cpp
+++ b/src/widgets/widgets/qcalendarwidget.cpp
@@ -770,8 +770,10 @@ bool QCalendarTextNavigator::eventFilter(QObject *o, QEvent *e)
applyDate();
emit editingFinished();
removeDateLabel();
+#if QT_CONFIG(shortcut)
} else if (ke->matches(QKeySequence::Cancel)) {
removeDateLabel();
+#endif
} else if (e->type() == QEvent::KeyPress) {
createDateLabel();
m_dateValidator->handleKeyEvent(ke);
@@ -3107,12 +3109,14 @@ void QCalendarWidget::resizeEvent(QResizeEvent * event)
*/
void QCalendarWidget::keyPressEvent(QKeyEvent * event)
{
+#if QT_CONFIG(shortcut)
Q_D(QCalendarWidget);
if (d->yearEdit->isVisible()&& event->matches(QKeySequence::Cancel)) {
d->yearEdit->setValue(yearShown());
d->_q_yearEditingFinished();
return;
}
+#endif
QWidget::keyPressEvent(event);
}
diff --git a/src/widgets/widgets/qcheckbox.h b/src/widgets/widgets/qcheckbox.h
index 22f26b6667..8543c4c86f 100644
--- a/src/widgets/widgets/qcheckbox.h
+++ b/src/widgets/widgets/qcheckbox.h
@@ -43,6 +43,8 @@
#include <QtWidgets/qtwidgetsglobal.h>
#include <QtWidgets/qabstractbutton.h>
+QT_REQUIRE_CONFIG(checkbox);
+
QT_BEGIN_NAMESPACE
diff --git a/src/widgets/widgets/qcombobox.cpp b/src/widgets/widgets/qcombobox.cpp
index 37d0e5c51e..272032d76f 100644
--- a/src/widgets/widgets/qcombobox.cpp
+++ b/src/widgets/widgets/qcombobox.cpp
@@ -677,10 +677,12 @@ bool QComboBoxPrivateContainer::eventFilter(QObject *o, QEvent *e)
combo->hidePopup();
return true;
default:
+#if QT_CONFIG(shortcut)
if (keyEvent->matches(QKeySequence::Cancel)) {
combo->hidePopup();
return true;
}
+#endif
break;
}
break;
diff --git a/src/widgets/widgets/qcommandlinkbutton.h b/src/widgets/widgets/qcommandlinkbutton.h
index 4f81651ce4..d8215a256e 100644
--- a/src/widgets/widgets/qcommandlinkbutton.h
+++ b/src/widgets/widgets/qcommandlinkbutton.h
@@ -43,6 +43,8 @@
#include <QtWidgets/qtwidgetsglobal.h>
#include <QtWidgets/qpushbutton.h>
+QT_REQUIRE_CONFIG(commandlinkbutton);
+
QT_BEGIN_NAMESPACE
diff --git a/src/widgets/widgets/qdatetimeedit.cpp b/src/widgets/widgets/qdatetimeedit.cpp
index c5eab55a53..cebfb9316a 100644
--- a/src/widgets/widgets/qdatetimeedit.cpp
+++ b/src/widgets/widgets/qdatetimeedit.cpp
@@ -2662,11 +2662,13 @@ void QCalendarPopup::mouseReleaseEvent(QMouseEvent*)
bool QCalendarPopup::event(QEvent *event)
{
+#if QT_CONFIG(shortcut)
if (event->type() == QEvent::KeyPress) {
QKeyEvent *keyEvent = static_cast<QKeyEvent*>(event);
if (keyEvent->matches(QKeySequence::Cancel))
dateChanged = false;
}
+#endif
return QWidget::event(event);
}
diff --git a/src/widgets/widgets/qdatetimeedit_p.h b/src/widgets/widgets/qdatetimeedit_p.h
index 730aa0f0b2..5302d6d9a7 100644
--- a/src/widgets/widgets/qdatetimeedit_p.h
+++ b/src/widgets/widgets/qdatetimeedit_p.h
@@ -57,7 +57,6 @@
#include "QtWidgets/qspinbox.h"
#include "QtWidgets/qtoolbutton.h"
#include "QtWidgets/qmenu.h"
-#include "QtWidgets/qlabel.h"
#include "QtWidgets/qdatetimeedit.h"
#include "private/qabstractspinbox_p.h"
#include "private/qdatetimeparser_p.h"
diff --git a/src/widgets/widgets/qdial.h b/src/widgets/widgets/qdial.h
index 3629ebf8f6..472b14fcdb 100644
--- a/src/widgets/widgets/qdial.h
+++ b/src/widgets/widgets/qdial.h
@@ -42,13 +42,14 @@
#define QDIAL_H
#include <QtWidgets/qtwidgetsglobal.h>
+
+#if QT_CONFIG(dial)
+
#include <QtWidgets/qabstractslider.h>
QT_BEGIN_NAMESPACE
-#ifndef QT_NO_DIAL
-
class QDialPrivate;
class QStyleOptionSlider;
@@ -98,8 +99,8 @@ private:
Q_DISABLE_COPY(QDial)
};
-#endif // QT_NO_DIAL
-
QT_END_NAMESPACE
+#endif // QT_CONFIG(dial)
+
#endif // QDIAL_H
diff --git a/src/widgets/widgets/qdialogbuttonbox.cpp b/src/widgets/widgets/qdialogbuttonbox.cpp
index 61ef8e8c93..5a789c2d66 100644
--- a/src/widgets/widgets/qdialogbuttonbox.cpp
+++ b/src/widgets/widgets/qdialogbuttonbox.cpp
@@ -410,9 +410,9 @@ QPushButton *QDialogButtonBoxPrivate::createButton(QDialogButtonBox::StandardBut
qWarning("QDialogButtonBox::createButton: Invalid ButtonRole, button not added");
else
addButton(button, static_cast<QDialogButtonBox::ButtonRole>(role), doLayout);
-
+#if QT_CONFIG(shortcut)
button->setShortcut(QGuiApplicationPrivate::platformTheme()->standardButtonShortcut(sbutton));
-
+#endif
return button;
}
diff --git a/src/widgets/widgets/qdialogbuttonbox.h b/src/widgets/widgets/qdialogbuttonbox.h
index 00ec315555..af9e705234 100644
--- a/src/widgets/widgets/qdialogbuttonbox.h
+++ b/src/widgets/widgets/qdialogbuttonbox.h
@@ -43,6 +43,8 @@
#include <QtWidgets/qtwidgetsglobal.h>
#include <QtWidgets/qwidget.h>
+QT_REQUIRE_CONFIG(dialogbuttonbox);
+
QT_BEGIN_NAMESPACE
diff --git a/src/widgets/widgets/qdockarealayout.cpp b/src/widgets/widgets/qdockarealayout.cpp
index e730eddd57..2863d8c054 100644
--- a/src/widgets/widgets/qdockarealayout.cpp
+++ b/src/widgets/widgets/qdockarealayout.cpp
@@ -2578,12 +2578,16 @@ bool QDockAreaLayout::insertGap(const QList<int> &path, QLayoutItem *dockWidgetI
QLayoutItem *QDockAreaLayout::plug(const QList<int> &path)
{
+#if QT_CONFIG(tabbar)
Q_ASSERT(!path.isEmpty());
const int index = path.first();
Q_ASSERT(index >= 0 && index < QInternal::DockCount);
QLayoutItem *item = docks[index].plug(path.mid(1));
docks[index].reparentWidgets(mainWindow);
return item;
+#else
+ return nullptr;
+#endif
}
QLayoutItem *QDockAreaLayout::unplug(const QList<int> &path)
diff --git a/src/widgets/widgets/qgroupbox.cpp b/src/widgets/widgets/qgroupbox.cpp
index a9b32ae065..fda68879d1 100644
--- a/src/widgets/widgets/qgroupbox.cpp
+++ b/src/widgets/widgets/qgroupbox.cpp
@@ -44,7 +44,9 @@
#include "qdrawutil.h"
#include "qevent.h"
#include "qlayout.h"
+#if QT_CONFIG(radiobutton)
#include "qradiobutton.h"
+#endif
#include "qstyle.h"
#include "qstyleoption.h"
#include "qstylepainter.h"
@@ -430,11 +432,13 @@ void QGroupBoxPrivate::_q_fixFocus(Qt::FocusReason reason)
QWidget * w = q;
while ((w = w->nextInFocusChain()) != q) {
if (q->isAncestorOf(w) && (w->focusPolicy() & Qt::TabFocus) == Qt::TabFocus && w->isVisibleTo(q)) {
+#if QT_CONFIG(radiobutton)
if (!best && qobject_cast<QRadioButton*>(w) && ((QRadioButton*)w)->isChecked())
// we prefer a checked radio button or a widget that
// already has focus, if there is one
best = w;
else
+#endif
if (!candidate)
// but we'll accept anything that takes focus
candidate = w;
diff --git a/src/widgets/widgets/qlabel.h b/src/widgets/widgets/qlabel.h
index 1f76937a63..3978e34d14 100644
--- a/src/widgets/widgets/qlabel.h
+++ b/src/widgets/widgets/qlabel.h
@@ -43,6 +43,8 @@
#include <QtWidgets/qtwidgetsglobal.h>
#include <QtWidgets/qframe.h>
+QT_REQUIRE_CONFIG(label);
+
QT_BEGIN_NAMESPACE
diff --git a/src/widgets/widgets/qlineedit.cpp b/src/widgets/widgets/qlineedit.cpp
index 419968db75..5926476470 100644
--- a/src/widgets/widgets/qlineedit.cpp
+++ b/src/widgets/widgets/qlineedit.cpp
@@ -440,6 +440,7 @@ bool QLineEdit::hasFrame() const
\since 5.2
*/
+#if QT_CONFIG(action)
/*!
\overload
@@ -469,7 +470,7 @@ QAction *QLineEdit::addAction(const QIcon &icon, ActionPosition position)
addAction(result, position);
return result;
}
-
+#endif // QT_CONFIG(action)
/*!
\property QLineEdit::clearButtonEnabled
\brief Whether the line edit displays a clear button when it is not empty.
@@ -486,6 +487,7 @@ static const char clearButtonActionNameC[] = "_q_qlineeditclearaction";
void QLineEdit::setClearButtonEnabled(bool enable)
{
+#if QT_CONFIG(action)
Q_D(QLineEdit);
if (enable == isClearButtonEnabled())
return;
@@ -500,11 +502,16 @@ void QLineEdit::setClearButtonEnabled(bool enable)
d->removeAction(clearAction);
delete clearAction;
}
+#endif // QT_CONFIG(action)
}
bool QLineEdit::isClearButtonEnabled() const
{
+#if QT_CONFIG(action)
return findChild<QAction *>(QLatin1String(clearButtonActionNameC));
+#else
+ return false;
+#endif
}
void QLineEdit::setFrame(bool enable)
@@ -1435,8 +1442,10 @@ bool QLineEdit::event(QEvent * e)
|| style()->styleHint(QStyle::SH_BlinkCursorWhenTextSelected, &opt, this))
d->setCursorVisible(true);
}
+#if QT_CONFIG(action)
} else if (e->type() == QEvent::ActionRemoved) {
d->removeAction(static_cast<QActionEvent *>(e)->action());
+#endif
} else if (e->type() == QEvent::Resize) {
d->positionSideWidgets();
}
diff --git a/src/widgets/widgets/qlineedit.h b/src/widgets/widgets/qlineedit.h
index 96dd64164f..4d32b11f06 100644
--- a/src/widgets/widgets/qlineedit.h
+++ b/src/widgets/widgets/qlineedit.h
@@ -174,9 +174,11 @@ public:
void getTextMargins(int *left, int *top, int *right, int *bottom) const;
QMargins textMargins() const;
+#if QT_CONFIG(action)
using QWidget::addAction;
void addAction(QAction *action, ActionPosition position);
QAction *addAction(const QIcon &icon, ActionPosition position);
+#endif
public Q_SLOTS:
void setText(const QString &);
diff --git a/src/widgets/widgets/qlineedit_p.cpp b/src/widgets/widgets/qlineedit_p.cpp
index 13f18f66d2..1d81d1fcb5 100644
--- a/src/widgets/widgets/qlineedit_p.cpp
+++ b/src/widgets/widgets/qlineedit_p.cpp
@@ -448,12 +448,14 @@ QIcon QLineEditPrivate::clearButtonIcon() const
void QLineEditPrivate::setClearButtonEnabled(bool enabled)
{
+#if QT_CONFIG(action)
for (const SideWidgetEntry &e : trailingSideWidgets) {
if (e.flags & SideWidgetClearButton) {
e.action->setEnabled(enabled);
break;
}
}
+#endif
}
void QLineEditPrivate::positionSideWidgets()
@@ -467,33 +469,37 @@ void QLineEditPrivate::positionSideWidgets()
QSize(p.widgetWidth, p.widgetHeight));
for (const SideWidgetEntry &e : leftSideWidgetList()) {
e.widget->setGeometry(widgetGeometry);
+#if QT_CONFIG(action)
if (e.action->isVisible())
widgetGeometry.moveLeft(widgetGeometry.left() + delta);
+#endif
}
widgetGeometry.moveLeft(contentRect.width() - p.widgetWidth - p.margin);
for (const SideWidgetEntry &e : rightSideWidgetList()) {
e.widget->setGeometry(widgetGeometry);
+#if QT_CONFIG(action)
if (e.action->isVisible())
widgetGeometry.moveLeft(widgetGeometry.left() - delta);
+#endif
}
}
}
-QLineEditPrivate::PositionIndexPair QLineEditPrivate::findSideWidget(const QAction *a) const
+QLineEditPrivate::SideWidgetLocation QLineEditPrivate::findSideWidget(const QAction *a) const
{
int i = 0;
for (const auto &e : leadingSideWidgets) {
if (a == e.action)
- return PositionIndexPair(QLineEdit::LeadingPosition, i);
+ return {QLineEdit::LeadingPosition, i};
++i;
}
i = 0;
for (const auto &e : trailingSideWidgets) {
if (a == e.action)
- return PositionIndexPair(QLineEdit::TrailingPosition, i);
+ return {QLineEdit::TrailingPosition, i};
++i;
}
- return PositionIndexPair(QLineEdit::LeadingPosition, -1);
+ return {QLineEdit::LeadingPosition, -1};
}
QWidget *QLineEditPrivate::addAction(QAction *newAction, QAction *before, QLineEdit::ActionPosition position, int flags)
@@ -508,10 +514,12 @@ QWidget *QLineEditPrivate::addAction(QAction *newAction, QAction *before, QLineE
QWidget *w = 0;
// Store flags about QWidgetAction here since removeAction() may be called from ~QAction,
// in which a qobject_cast<> no longer works.
+#if QT_CONFIG(action)
if (QWidgetAction *widgetAction = qobject_cast<QWidgetAction *>(newAction)) {
if ((w = widgetAction->requestWidget(q)))
flags |= SideWidgetCreatedByWidgetAction;
}
+#endif
if (!w) {
#if QT_CONFIG(toolbutton)
QLineEditIconButton *toolButton = new QLineEditIconButton(q);
@@ -526,11 +534,10 @@ QWidget *QLineEditPrivate::addAction(QAction *newAction, QAction *before, QLineE
#endif
}
// If there is a 'before' action, it takes preference
- PositionIndexPair positionIndex = before ? findSideWidget(before) : PositionIndexPair(position, -1);
- SideWidgetEntryList &list = positionIndex.first == QLineEdit::TrailingPosition ? trailingSideWidgets : leadingSideWidgets;
- if (positionIndex.second < 0)
- positionIndex.second = int(list.size());
- list.insert(list.begin() + positionIndex.second, SideWidgetEntry(w, newAction, flags));
+ const auto location = before ? findSideWidget(before) : SideWidgetLocation{position, -1};
+ SideWidgetEntryList &list = location.position == QLineEdit::TrailingPosition ? trailingSideWidgets : leadingSideWidgets;
+ list.insert(location.isValid() ? list.begin() + location.index : list.end(),
+ SideWidgetEntry(w, newAction, flags));
positionSideWidgets();
w->show();
return w;
@@ -538,13 +545,14 @@ QWidget *QLineEditPrivate::addAction(QAction *newAction, QAction *before, QLineE
void QLineEditPrivate::removeAction(QAction *action)
{
+#if QT_CONFIG(action)
Q_Q(QLineEdit);
- const PositionIndexPair positionIndex = findSideWidget(action);
- if (positionIndex.second == -1)
+ const auto location = findSideWidget(action);
+ if (!location.isValid())
return;
- SideWidgetEntryList &list = positionIndex.first == QLineEdit::TrailingPosition ? trailingSideWidgets : leadingSideWidgets;
- SideWidgetEntry entry = list[positionIndex.second];
- list.erase(list.begin() + positionIndex.second);
+ SideWidgetEntryList &list = location.position == QLineEdit::TrailingPosition ? trailingSideWidgets : leadingSideWidgets;
+ SideWidgetEntry entry = list[location.index];
+ list.erase(list.begin() + location.index);
if (entry.flags & SideWidgetCreatedByWidgetAction)
static_cast<QWidgetAction *>(entry.action)->releaseWidget(entry.widget);
else
@@ -553,6 +561,7 @@ void QLineEditPrivate::removeAction(QAction *action)
if (!hasSideWidgets()) // Last widget, remove connection
QObject::disconnect(q, SIGNAL(textChanged(QString)), q, SLOT(_q_textChanged(QString)));
q->update();
+#endif // QT_CONFIG(action)
}
static bool isSideWidgetVisible(const QLineEditPrivate::SideWidgetEntry &e)
diff --git a/src/widgets/widgets/qlineedit_p.h b/src/widgets/widgets/qlineedit_p.h
index a903c003e6..2d695f8411 100644
--- a/src/widgets/widgets/qlineedit_p.h
+++ b/src/widgets/widgets/qlineedit_p.h
@@ -235,15 +235,22 @@ public:
int effectiveRightTextMargin() const;
private:
- typedef QPair<QLineEdit::ActionPosition, int> PositionIndexPair;
+ struct SideWidgetLocation {
+ QLineEdit::ActionPosition position;
+ int index;
- PositionIndexPair findSideWidget(const QAction *a) const;
+ bool isValid() const { return index >= 0; }
+ };
+ friend class QTypeInfo<SideWidgetLocation>;
+
+ SideWidgetLocation findSideWidget(const QAction *a) const;
SideWidgetEntryList leadingSideWidgets;
SideWidgetEntryList trailingSideWidgets;
int lastTextSize;
};
Q_DECLARE_TYPEINFO(QLineEditPrivate::SideWidgetEntry, Q_PRIMITIVE_TYPE);
+Q_DECLARE_TYPEINFO(QLineEditPrivate::SideWidgetLocation, Q_PRIMITIVE_TYPE);
#endif // QT_NO_LINEEDIT
diff --git a/src/widgets/widgets/qpushbutton.cpp b/src/widgets/widgets/qpushbutton.cpp
index cae1f9d169..1beea7edc5 100644
--- a/src/widgets/widgets/qpushbutton.cpp
+++ b/src/widgets/widgets/qpushbutton.cpp
@@ -55,7 +55,9 @@
#include "qtoolbar.h"
#include "qdebug.h"
#include "qlayoutitem.h"
+#if QT_CONFIG(dialogbuttonbox)
#include "qdialogbuttonbox.h"
+#endif
#ifndef QT_NO_ACCESSIBILITY
#include "qaccessible.h"
@@ -396,8 +398,7 @@ QSize QPushButton::sizeHint() const
initStyleOption(&opt);
// calculate contents size...
-#ifndef QT_NO_ICON
-
+#if !defined(QT_NO_ICON) && QT_CONFIG(dialogbuttonbox)
bool showButtonBoxIcons = qobject_cast<QDialogButtonBox*>(parentWidget())
&& style()->styleHint(QStyle::SH_DialogButtonBox_ButtonsHaveIcons);
diff --git a/src/widgets/widgets/qpushbutton.h b/src/widgets/widgets/qpushbutton.h
index b0d1ccacdb..ea9baa8ccb 100644
--- a/src/widgets/widgets/qpushbutton.h
+++ b/src/widgets/widgets/qpushbutton.h
@@ -43,6 +43,8 @@
#include <QtWidgets/qtwidgetsglobal.h>
#include <QtWidgets/qabstractbutton.h>
+QT_REQUIRE_CONFIG(pushbutton);
+
QT_BEGIN_NAMESPACE
diff --git a/src/widgets/widgets/qpushbutton_p.h b/src/widgets/widgets/qpushbutton_p.h
index ee41c345c8..198091503a 100644
--- a/src/widgets/widgets/qpushbutton_p.h
+++ b/src/widgets/widgets/qpushbutton_p.h
@@ -43,6 +43,8 @@
#include <QtWidgets/private/qtwidgetsglobal_p.h>
#include "private/qabstractbutton_p.h"
+QT_REQUIRE_CONFIG(pushbutton);
+
//
// W A R N I N G
// -------------
diff --git a/src/widgets/widgets/qradiobutton.h b/src/widgets/widgets/qradiobutton.h
index 2dcb0d0fdf..137ae01380 100644
--- a/src/widgets/widgets/qradiobutton.h
+++ b/src/widgets/widgets/qradiobutton.h
@@ -43,6 +43,8 @@
#include <QtWidgets/qtwidgetsglobal.h>
#include <QtWidgets/qabstractbutton.h>
+QT_REQUIRE_CONFIG(radiobutton);
+
QT_BEGIN_NAMESPACE
diff --git a/src/widgets/widgets/qscrollbar.h b/src/widgets/widgets/qscrollbar.h
index 2b8a110c99..b99ad219eb 100644
--- a/src/widgets/widgets/qscrollbar.h
+++ b/src/widgets/widgets/qscrollbar.h
@@ -42,12 +42,12 @@
#include <QtWidgets/qtwidgetsglobal.h>
#include <QtWidgets/qwidget.h>
-#include <QtWidgets/qabstractslider.h>
-QT_BEGIN_NAMESPACE
+#if QT_CONFIG(scrollbar)
+#include <QtWidgets/qabstractslider.h>
-#ifndef QT_NO_SCROLLBAR
+QT_BEGIN_NAMESPACE
class QScrollBarPrivate;
class QStyleOptionSlider;
@@ -94,8 +94,8 @@ private:
#endif
};
-#endif // QT_NO_SCROLLBAR
-
QT_END_NAMESPACE
+#endif // QT_CONFIG(scrollbar)
+
#endif // QSCROLLBAR_H
diff --git a/src/widgets/widgets/qslider.h b/src/widgets/widgets/qslider.h
index 33b90ece06..001863c18d 100644
--- a/src/widgets/widgets/qslider.h
+++ b/src/widgets/widgets/qslider.h
@@ -41,13 +41,14 @@
#define QSLIDER_H
#include <QtWidgets/qtwidgetsglobal.h>
+
+#if QT_CONFIG(slider)
+
#include <QtWidgets/qabstractslider.h>
QT_BEGIN_NAMESPACE
-#ifndef QT_NO_SLIDER
-
class QSliderPrivate;
class QStyleOptionSlider;
class Q_WIDGETS_EXPORT QSlider : public QAbstractSlider
@@ -99,8 +100,8 @@ private:
Q_DECLARE_PRIVATE(QSlider)
};
-#endif // QT_NO_SLIDER
-
QT_END_NAMESPACE
+#endif // QT_CONFIG(slider)
+
#endif // QSLIDER_H
diff --git a/src/widgets/widgets/qtabbar.cpp b/src/widgets/widgets/qtabbar.cpp
index 9bf062b407..eeece1a42a 100644
--- a/src/widgets/widgets/qtabbar.cpp
+++ b/src/widgets/widgets/qtabbar.cpp
@@ -519,12 +519,14 @@ void QTabBarPrivate::layoutTabs()
maxExtent = maxWidth;
}
+ if (!expanding) {
+ // Mirror our front item.
+ tabChain[tabChainIndex].init();
+ tabChain[tabChainIndex].expansive = (tabAlignment != Qt::AlignRight)
+ && (tabAlignment != Qt::AlignJustify);
+ tabChain[tabChainIndex].empty = true;
+ }
Q_ASSERT(tabChainIndex == tabChain.count() - 1); // add an assert just to make sure.
- // Mirror our front item.
- tabChain[tabChainIndex].init();
- tabChain[tabChainIndex].expansive = (tabAlignment != Qt::AlignRight)
- && (tabAlignment != Qt::AlignJustify);
- tabChain[tabChainIndex].empty = true;
// Do the calculation
qGeomCalc(tabChain, 0, tabChain.count(), 0, qMax(available, last), 0);
@@ -664,6 +666,15 @@ QRect QTabBarPrivate::normalizedScrollRect(int index)
}
}
+int QTabBarPrivate::hoveredTabIndex() const
+{
+ if (dragInProgress)
+ return currentIndex;
+ if (hoverIndex >= 0)
+ return hoverIndex;
+ return -1;
+}
+
void QTabBarPrivate::makeVisible(int index)
{
Q_Q(QTabBar);
@@ -1053,6 +1064,17 @@ void QTabBar::removeTab(int index)
}
d->refresh();
d->autoHideTabs();
+ if (!d->hoverRect.isEmpty()) {
+ for (int i = 0; i < d->tabList.count(); ++i) {
+ const QRect area = tabRect(i);
+ if (area.contains(mapFromGlobal(QCursor::pos()))) {
+ d->hoverIndex = i;
+ d->hoverRect = area;
+ break;
+ }
+ }
+ update(d->hoverRect);
+ }
tabRemoved(index);
}
}
@@ -1577,20 +1599,28 @@ bool QTabBar::event(QEvent *event)
QHoverEvent *he = static_cast<QHoverEvent *>(event);
if (!d->hoverRect.contains(he->pos())) {
QRect oldHoverRect = d->hoverRect;
+ bool cursorOverTabs = false;
for (int i = 0; i < d->tabList.count(); ++i) {
QRect area = tabRect(i);
if (area.contains(he->pos())) {
+ d->hoverIndex = i;
d->hoverRect = area;
+ cursorOverTabs = true;
break;
}
}
+ if (!cursorOverTabs) {
+ d->hoverIndex = -1;
+ d->hoverRect = QRect();
+ }
if (he->oldPos() != QPoint(-1, -1))
update(oldHoverRect);
update(d->hoverRect);
}
return true;
- } else if (event->type() == QEvent::HoverLeave ) {
+ } else if (event->type() == QEvent::HoverLeave) {
QRect oldHoverRect = d->hoverRect;
+ d->hoverIndex = -1;
d->hoverRect = QRect();
update(oldHoverRect);
return true;
@@ -2435,7 +2465,7 @@ void QTabBar::setMovable(bool movable)
This property is used as a hint for styles to draw the tabs in a different
way then they would normally look in a tab widget. On \macos this will
- look similar to the tabs in Safari or Leopard's Terminal.app.
+ look similar to the tabs in Safari or Sierra's Terminal.app.
\sa QTabWidget::documentMode
*/
diff --git a/src/widgets/widgets/qtabbar_p.h b/src/widgets/widgets/qtabbar_p.h
index e8d5503fdf..7c653a95e9 100644
--- a/src/widgets/widgets/qtabbar_p.h
+++ b/src/widgets/widgets/qtabbar_p.h
@@ -87,7 +87,7 @@ class QTabBarPrivate : public QWidgetPrivate
public:
QTabBarPrivate()
:currentIndex(-1), pressedIndex(-1), shape(QTabBar::RoundedNorth), layoutDirty(false),
- drawBase(true), scrollOffset(0), elideModeSetByUser(false), useScrollButtonsSetByUser(false), expanding(true), closeButtonOnTabs(false),
+ drawBase(true), scrollOffset(0), hoverIndex(-1), elideModeSetByUser(false), useScrollButtonsSetByUser(false), expanding(true), closeButtonOnTabs(false),
selectionBehaviorOnRemove(QTabBar::SelectRightTab), paintWithOffsets(true), movable(false),
dragInProgress(false), documentMode(false), autoHide(false), changeCurrentOnDrag(false),
switchTabCurrentIndex(-1), switchTabTimerId(0), movingTab(0)
@@ -192,6 +192,7 @@ public:
void moveTab(int index, int offset);
void moveTabFinished(int index);
QRect hoverRect;
+ int hoverIndex;
void refresh();
void layoutTabs();
@@ -202,6 +203,7 @@ public:
void setupMovableTab();
void autoHideTabs();
QRect normalizedScrollRect(int index = -1);
+ int hoveredTabIndex() const;
void initBasicStyleOption(QStyleOptionTab *option, int tabIndex) const;
diff --git a/src/widgets/widgets/qtabwidget.cpp b/src/widgets/widgets/qtabwidget.cpp
index 1394c6b44c..be870133ee 100644
--- a/src/widgets/widgets/qtabwidget.cpp
+++ b/src/widgets/widgets/qtabwidget.cpp
@@ -209,7 +209,6 @@ public:
bool dirty;
QTabWidget::TabPosition pos;
QTabWidget::TabShape shape;
- int alignment;
QWidget *leftCornerWidget;
QWidget *rightCornerWidget;
};
diff --git a/src/widgets/widgets/widgets.pri b/src/widgets/widgets/widgets.pri
index abba3e0472..f67640e40f 100644
--- a/src/widgets/widgets/widgets.pri
+++ b/src/widgets/widgets/widgets.pri
@@ -5,19 +5,14 @@ HEADERS += \
widgets/qbuttongroup_p.h \
widgets/qabstractbutton.h \
widgets/qabstractbutton_p.h \
- widgets/qabstractslider.h \
- widgets/qabstractslider_p.h \
widgets/qabstractspinbox.h \
widgets/qabstractspinbox_p.h \
widgets/qcalendarwidget.h \
- widgets/qcheckbox.h \
widgets/qcombobox.h \
widgets/qcombobox_p.h \
- widgets/qcommandlinkbutton.h \
widgets/qdatetimeedit.h \
widgets/qdatetimeedit_p.h \
widgets/qdial.h \
- widgets/qdialogbuttonbox.h \
widgets/qdockwidget.h \
widgets/qdockwidget_p.h \
widgets/qdockarealayout_p.h \
@@ -27,8 +22,6 @@ HEADERS += \
widgets/qgroupbox.h \
widgets/qkeysequenceedit.h \
widgets/qkeysequenceedit_p.h \
- widgets/qlabel.h \
- widgets/qlabel_p.h \
widgets/qlcdnumber.h \
widgets/qlineedit.h \
widgets/qlineedit_p.h \
@@ -43,9 +36,6 @@ HEADERS += \
widgets/qmenubar.h \
widgets/qmenubar_p.h \
widgets/qprogressbar.h \
- widgets/qpushbutton.h \
- widgets/qpushbutton_p.h \
- widgets/qradiobutton.h \
widgets/qrubberband.h \
widgets/qscrollbar.h \
widgets/qscrollbar_p.h \
@@ -87,15 +77,11 @@ HEADERS += \
SOURCES += \
widgets/qbuttongroup.cpp \
widgets/qabstractbutton.cpp \
- widgets/qabstractslider.cpp \
widgets/qabstractspinbox.cpp \
widgets/qcalendarwidget.cpp \
- widgets/qcheckbox.cpp \
widgets/qcombobox.cpp \
- widgets/qcommandlinkbutton.cpp \
widgets/qdatetimeedit.cpp \
widgets/qdial.cpp \
- widgets/qdialogbuttonbox.cpp \
widgets/qdockwidget.cpp \
widgets/qdockarealayout.cpp \
widgets/qeffects.cpp \
@@ -103,7 +89,6 @@ SOURCES += \
widgets/qframe.cpp \
widgets/qgroupbox.cpp \
widgets/qkeysequenceedit.cpp \
- widgets/qlabel.cpp \
widgets/qlcdnumber.cpp \
widgets/qlineedit_p.cpp \
widgets/qlineedit.cpp \
@@ -114,8 +99,6 @@ SOURCES += \
widgets/qmenu.cpp \
widgets/qmenubar.cpp \
widgets/qprogressbar.cpp \
- widgets/qpushbutton.cpp \
- widgets/qradiobutton.cpp \
widgets/qrubberband.cpp \
widgets/qscrollbar.cpp \
widgets/qsizegrip.cpp \
@@ -145,6 +128,66 @@ SOURCES += \
widgets/qtoolbararealayout.cpp \
widgets/qplaintextedit.cpp
+qtConfig(abstractslider) {
+ HEADERS += \
+ widgets/qabstractslider.h \
+ widgets/qabstractslider_p.h
+
+ SOURCES += \
+ widgets/qabstractslider.cpp
+}
+
+qtConfig(checkbox) {
+ HEADERS += \
+ widgets/qcheckbox.h
+
+ SOURCES += \
+ widgets/qcheckbox.cpp
+}
+
+qtConfig(commandlinkbutton) {
+ HEADERS += \
+ widgets/qcommandlinkbutton.h
+
+ SOURCES += \
+ widgets/qcommandlinkbutton.cpp
+}
+
+qtConfig(label) {
+ HEADERS += \
+ widgets/qlabel.h \
+ widgets/qlabel_p.h
+
+ SOURCES += \
+ widgets/qlabel.cpp
+}
+
+
+qtConfig(pushbutton) {
+ HEADERS += \
+ widgets/qpushbutton.h \
+ widgets/qpushbutton_p.h
+
+ SOURCES += \
+ widgets/qpushbutton.cpp
+}
+
+qtConfig(radiobutton) {
+ HEADERS += \
+ widgets/qradiobutton.h
+
+ SOURCES += \
+ widgets/qradiobutton.cpp
+}
+
+qtConfig(dialogbuttonbox) {
+ HEADERS += \
+ widgets/qdialogbuttonbox.h
+
+ SOURCES += \
+ widgets/qdialogbuttonbox.cpp
+}
+
macx {
HEADERS += \
widgets/qmacnativewidget_mac.h \
diff --git a/src/xml/sax/qxml.h b/src/xml/sax/qxml.h
index 49c8184d4b..77a5a78650 100644
--- a/src/xml/sax/qxml.h
+++ b/src/xml/sax/qxml.h
@@ -156,11 +156,13 @@ private:
struct Attribute {
QString qname, uri, localname, value;
};
+ friend class QTypeInfo<Attribute>;
typedef QList<Attribute> AttributeList;
AttributeList attList;
QXmlAttributesPrivate *d;
};
+Q_DECLARE_TYPEINFO(QXmlAttributes::Attribute, Q_MOVABLE_TYPE);
Q_DECLARE_SHARED_NOT_MOVABLE_UNTIL_QT6(QXmlAttributes)
//
diff --git a/src/xml/sax/qxml_p.h b/src/xml/sax/qxml_p.h
index 5f3785a289..98dc2aea0c 100644
--- a/src/xml/sax/qxml_p.h
+++ b/src/xml/sax/qxml_p.h
@@ -85,6 +85,8 @@ private:
Q_DUMMY_COMPARISON_OPERATOR(ExternParameterEntity)
};
+ friend class QTypeInfo<ExternParameterEntity>;
+
struct ExternEntity
{
ExternEntity() {}
@@ -95,6 +97,8 @@ private:
QString notation;
Q_DUMMY_COMPARISON_OPERATOR(ExternEntity)
};
+ friend class QTypeInfo<ExternEntity>;
+
QMap<QString,ExternParameterEntity> externParameterEntities;
QMap<QString,QString> parameterEntities;
QMap<QString,ExternEntity> externEntities;
@@ -306,6 +310,8 @@ private:
};
Q_DECLARE_TYPEINFO(QXmlSimpleReaderPrivate::ParseState, Q_PRIMITIVE_TYPE);
Q_DECLARE_TYPEINFO(QXmlSimpleReaderPrivate::XmlRef, Q_MOVABLE_TYPE);
+Q_DECLARE_TYPEINFO(QXmlSimpleReaderPrivate::ExternParameterEntity, Q_MOVABLE_TYPE);
+Q_DECLARE_TYPEINFO(QXmlSimpleReaderPrivate::ExternEntity, Q_MOVABLE_TYPE);
QT_END_NAMESPACE