summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/3rdparty/iaccessible2/iaccessible2.pri6
-rw-r--r--src/corelib/Qt5ModuleLocationForInstall.cmake.in4
-rw-r--r--src/corelib/global/qcompilerdetection.h4
-rw-r--r--src/corelib/global/qglobal.h14
-rw-r--r--src/corelib/global/qversiontagging.h2
-rw-r--r--src/corelib/io/io.pri5
-rw-r--r--src/corelib/io/qfile.cpp8
-rw-r--r--src/corelib/io/qfilesystemengine_p.h2
-rw-r--r--src/corelib/io/qfilesystemengine_unix.cpp43
-rw-r--r--src/corelib/io/qfilesystemengine_win.cpp6
-rw-r--r--src/corelib/io/qfilesystemwatcher_win.cpp47
-rw-r--r--src/corelib/io/qfsfileengine_unix.cpp7
-rw-r--r--src/corelib/io/qstorageinfo_win.cpp52
-rw-r--r--src/corelib/kernel/qcoreapplication.cpp4
-rw-r--r--src/corelib/kernel/qdeadlinetimer.cpp2
-rw-r--r--src/corelib/kernel/qobjectdefs.h1
-rw-r--r--src/corelib/kernel/qvariant.cpp13
-rw-r--r--src/corelib/tools/qbytearray.cpp24
-rw-r--r--src/corelib/tools/qdatetime.cpp53
-rw-r--r--src/corelib/tools/qlocale.cpp17
-rw-r--r--src/dbus/Qt5DBusMacros.cmake2
-rw-r--r--src/dbus/qdbusthreaddebug_p.h4
-rw-r--r--src/gui/painting/qcosmeticstroker.cpp56
-rw-r--r--src/gui/painting/qdrawhelper.cpp8
-rw-r--r--src/gui/painting/qdrawhelper_p.h4
-rw-r--r--src/network/socket/qlocalserver.cpp4
-rw-r--r--src/network/socket/qlocalserver.h7
-rw-r--r--src/network/socket/qlocalserver_p.h6
-rw-r--r--src/network/socket/qlocalserver_unix.cpp4
-rw-r--r--src/network/socket/qlocalsocket.cpp4
-rw-r--r--src/network/socket/qlocalsocket.h7
-rw-r--r--src/network/socket/qlocalsocket_p.h6
-rw-r--r--src/network/socket/qlocalsocket_unix.cpp4
-rw-r--r--src/network/socket/socket.pri56
-rw-r--r--src/opengl/opengl.pro7
-rw-r--r--src/opengl/qgraphicsshadereffect.cpp4
-rw-r--r--src/opengl/qgraphicsshadereffect_p.h7
-rw-r--r--src/platformsupport/input/integrityhid/qintegrityhidmanager.h6
-rw-r--r--src/plugins/platforms/cocoa/cocoa.pro7
-rw-r--r--src/plugins/platforms/cocoa/qcocoafontdialoghelper.h3
-rw-r--r--src/plugins/platforms/cocoa/qcocoafontdialoghelper.mm4
-rw-r--r--src/plugins/platforms/cocoa/qcocoatheme.mm16
-rw-r--r--src/plugins/platforms/cocoa/qnswindowdelegate.mm16
-rw-r--r--src/plugins/platforms/windows/openglblacklists/default.json12
-rw-r--r--src/plugins/platforms/windows/qwindowscontext.cpp26
-rw-r--r--src/plugins/platforms/windows/qwindowsscreen.cpp10
-rw-r--r--src/plugins/platforms/windows/qwindowstheme.cpp18
-rw-r--r--src/plugins/platforms/windows/qwindowswindow.cpp6
-rw-r--r--src/plugins/platforms/winrt/qwinrtfileengine.cpp3
-rw-r--r--src/plugins/platforms/xcb/gl_integrations/gl_integrations_plugin_base.pri7
-rw-r--r--src/plugins/sqldrivers/ibase/qsql_ibase.cpp1
-rw-r--r--src/plugins/styles/mac/qmacstyle_mac.mm67
-rw-r--r--src/plugins/styles/mac/qmacstyle_mac_p_p.h10
-rw-r--r--src/plugins/styles/windowsvista/qwindowsvistastyle_p_p.h2
-rw-r--r--src/plugins/styles/windowsvista/qwindowsxpstyle.cpp12
-rw-r--r--src/testlib/qtestassert.h4
-rw-r--r--src/testlib/qtestblacklist.cpp4
-rw-r--r--src/testlib/qtestcase.h22
-rw-r--r--src/widgets/accessible/complexwidgets.cpp1
-rw-r--r--src/widgets/accessible/itemviews.cpp16
-rw-r--r--src/widgets/accessible/qaccessiblewidget.cpp2
-rw-r--r--src/widgets/accessible/qaccessiblewidgetfactory.cpp2
-rw-r--r--src/widgets/accessible/qaccessiblewidgets.cpp2
-rw-r--r--src/widgets/dialogs/dialogs.pri14
-rw-r--r--src/widgets/dialogs/qdialog.cpp4
-rw-r--r--src/widgets/dialogs/qfontdialog.cpp4
-rw-r--r--src/widgets/dialogs/qfontdialog.h7
-rw-r--r--src/widgets/dialogs/qfontdialog_p.h4
-rw-r--r--src/widgets/dialogs/qwizard.cpp2
-rw-r--r--src/widgets/effects/qgraphicseffect.cpp3
-rw-r--r--src/widgets/effects/qgraphicseffect.h6
-rw-r--r--src/widgets/effects/qgraphicseffect_p.h5
-rw-r--r--src/widgets/effects/qpixmapfilter.cpp3
-rw-r--r--src/widgets/effects/qpixmapfilter_p.h5
-rw-r--r--src/widgets/graphicsview/qgraphicsitem.cpp42
-rw-r--r--src/widgets/graphicsview/qgraphicsitem.h6
-rw-r--r--src/widgets/graphicsview/qgraphicsitem_p.h15
-rw-r--r--src/widgets/graphicsview/qgraphicsscene.cpp7
-rw-r--r--src/widgets/graphicsview/qgraphicsscene_p.h8
-rw-r--r--src/widgets/graphicsview/qgraphicsview.cpp18
-rw-r--r--src/widgets/graphicsview/qgraphicsview.h6
-rw-r--r--src/widgets/graphicsview/qgraphicsview_p.h2
-rw-r--r--src/widgets/itemviews/itemviews.pri11
-rw-r--r--src/widgets/itemviews/qabstractitemview.cpp1
-rw-r--r--src/widgets/itemviews/qitemeditorfactory.cpp6
-rw-r--r--src/widgets/itemviews/qlistview.cpp13
-rw-r--r--src/widgets/itemviews/qlistview_p.h2
-rw-r--r--src/widgets/itemviews/qstyleditemdelegate.cpp4
-rw-r--r--src/widgets/itemviews/qtableview.cpp3
-rw-r--r--src/widgets/itemviews/qtableview.h7
-rw-r--r--src/widgets/itemviews/qtableview_p.h4
-rw-r--r--src/widgets/kernel/qapplication.cpp1
-rw-r--r--src/widgets/kernel/qwidget.cpp36
-rw-r--r--src/widgets/kernel/qwidget.h4
-rw-r--r--src/widgets/kernel/qwidget_p.h14
-rw-r--r--src/widgets/kernel/qwidgetbackingstore.cpp18
-rw-r--r--src/widgets/kernel/qwidgetbackingstore_p.h4
-rw-r--r--src/widgets/styles/qcommonstyle.cpp10
-rw-r--r--src/widgets/styles/qdrawutil.cpp85
-rw-r--r--src/widgets/styles/qfusionstyle.cpp6
-rw-r--r--src/widgets/styles/qstyleoption.cpp4
-rw-r--r--src/widgets/styles/qstyleoption.h6
-rw-r--r--src/widgets/styles/qwindowsstyle.cpp10
-rw-r--r--src/widgets/widgets.pro4
-rw-r--r--src/widgets/widgets/qabstractspinbox.cpp2
-rw-r--r--src/widgets/widgets/qcombobox.cpp6
-rw-r--r--src/widgets/widgets/qdatetimeedit.cpp4
-rw-r--r--src/widgets/widgets/qdatetimeedit.h7
-rw-r--r--src/widgets/widgets/qdatetimeedit_p.h4
-rw-r--r--src/widgets/widgets/qmainwindowlayout.cpp6
-rw-r--r--src/widgets/widgets/qmainwindowlayout_p.h2
-rw-r--r--src/widgets/widgets/qmdiarea.cpp16
-rw-r--r--src/widgets/widgets/qmdiarea_p.h6
-rw-r--r--src/widgets/widgets/qmdisubwindow.cpp30
-rw-r--r--src/widgets/widgets/qmdisubwindow_p.h8
-rw-r--r--src/widgets/widgets/qrubberband.cpp4
-rw-r--r--src/widgets/widgets/qrubberband.h7
-rw-r--r--src/widgets/widgets/qsplitter.cpp2
-rw-r--r--src/widgets/widgets/qsplitter_p.h1
-rw-r--r--src/widgets/widgets/qtoolbar.cpp2
-rw-r--r--src/widgets/widgets/qwidgetlinecontrol.cpp14
-rw-r--r--src/widgets/widgets/widgets.pri19
122 files changed, 831 insertions, 506 deletions
diff --git a/src/3rdparty/iaccessible2/iaccessible2.pri b/src/3rdparty/iaccessible2/iaccessible2.pri
index 367980a0d2..f60e67681d 100644
--- a/src/3rdparty/iaccessible2/iaccessible2.pri
+++ b/src/3rdparty/iaccessible2/iaccessible2.pri
@@ -1,10 +1,6 @@
ARCH_SUBDIR=x86
-contains(QMAKE_TARGET.arch, x86_64): {
- ARCH_SUBDIR=amd64
-} else {
- !contains(QMAKE_TARGET.arch, x86): message("ERROR: Could not detect architecture from QMAKE_TARGET.arch")
-}
+contains(QT_ARCH, x86_64): ARCH_SUBDIR = amd64
MIDL_GENERATED = $$PWD/generated/$${ARCH_SUBDIR}
diff --git a/src/corelib/Qt5ModuleLocationForInstall.cmake.in b/src/corelib/Qt5ModuleLocationForInstall.cmake.in
index e401b1fe34..8751e4acbc 100644
--- a/src/corelib/Qt5ModuleLocationForInstall.cmake.in
+++ b/src/corelib/Qt5ModuleLocationForInstall.cmake.in
@@ -1,4 +1,6 @@
set(_qt5_root_dir ${_qt5_install_prefix})
set(_qt5_module_paths ${_qt5_install_prefix})
-set(_qt5_module_location_template ${_qt5_install_prefix}/Qt5@module@/Qt5@module@Config.cmake)
+set(_qt5_at "@")
+set(_qt5_module_location_template ${_qt5_install_prefix}/Qt5${_qt5_at}module${_qt5_at}/Qt5${_qt5_at}module${_qt5_at}Config.cmake)
+unset(_qt5_at)
diff --git a/src/corelib/global/qcompilerdetection.h b/src/corelib/global/qcompilerdetection.h
index 9ffd164b61..05e3f6c45a 100644
--- a/src/corelib/global/qcompilerdetection.h
+++ b/src/corelib/global/qcompilerdetection.h
@@ -1336,14 +1336,14 @@
do {\
Q_ASSERT_X(false, "Q_UNREACHABLE()", "Q_UNREACHABLE was reached");\
Q_UNREACHABLE_IMPL();\
- } while (0)
+ } while (false)
#define Q_ASSUME(Expr) \
do {\
const bool valueOfExpression = Expr;\
Q_ASSERT_X(valueOfExpression, "Q_ASSUME()", "Assumption in Q_ASSUME(\"" #Expr "\") was not correct");\
Q_ASSUME_IMPL(valueOfExpression);\
- } while (0)
+ } while (false)
#if defined(__cplusplus)
#if QT_HAS_CPP_ATTRIBUTE(fallthrough)
diff --git a/src/corelib/global/qglobal.h b/src/corelib/global/qglobal.h
index 429cd63ab6..d58e568447 100644
--- a/src/corelib/global/qglobal.h
+++ b/src/corelib/global/qglobal.h
@@ -341,10 +341,10 @@ typedef double qreal;
#define Q_INIT_RESOURCE(name) \
do { extern int QT_MANGLE_NAMESPACE(qInitResources_ ## name) (); \
- QT_MANGLE_NAMESPACE(qInitResources_ ## name) (); } while (0)
+ QT_MANGLE_NAMESPACE(qInitResources_ ## name) (); } while (false)
#define Q_CLEANUP_RESOURCE(name) \
do { extern int QT_MANGLE_NAMESPACE(qCleanupResources_ ## name) (); \
- QT_MANGLE_NAMESPACE(qCleanupResources_ ## name) (); } while (0)
+ QT_MANGLE_NAMESPACE(qCleanupResources_ ## name) (); } while (false)
/*
* If we're compiling C++ code:
@@ -664,7 +664,7 @@ inline void qt_noop(void) {}
# define QT_CATCH(A) else
# define QT_THROW(A) qt_noop()
# define QT_RETHROW qt_noop()
-# define QT_TERMINATE_ON_EXCEPTION(expr) do { expr; } while (0)
+# define QT_TERMINATE_ON_EXCEPTION(expr) do { expr; } while (false)
#else
# define QT_TRY try
# define QT_CATCH(A) catch (A)
@@ -672,9 +672,9 @@ inline void qt_noop(void) {}
# define QT_RETHROW throw
Q_NORETURN Q_CORE_EXPORT void qTerminate() Q_DECL_NOTHROW;
# ifdef Q_COMPILER_NOEXCEPT
-# define QT_TERMINATE_ON_EXCEPTION(expr) do { expr; } while (0)
+# define QT_TERMINATE_ON_EXCEPTION(expr) do { expr; } while (false)
# else
-# define QT_TERMINATE_ON_EXCEPTION(expr) do { try { expr; } catch (...) { qTerminate(); } } while (0)
+# define QT_TERMINATE_ON_EXCEPTION(expr) do { try { expr; } catch (...) { qTerminate(); } } while (false)
# endif
#endif
@@ -778,10 +778,10 @@ Q_CORE_EXPORT void qBadAlloc();
# if defined(QT_NO_DEBUG) && !defined(QT_FORCE_ASSERTS)
# define Q_CHECK_PTR(p) qt_noop()
# else
-# define Q_CHECK_PTR(p) do {if(!(p))qt_check_pointer(__FILE__,__LINE__);} while (0)
+# define Q_CHECK_PTR(p) do {if (!(p)) qt_check_pointer(__FILE__,__LINE__);} while (false)
# endif
#else
-# define Q_CHECK_PTR(p) do { if (!(p)) qBadAlloc(); } while (0)
+# define Q_CHECK_PTR(p) do { if (!(p)) qBadAlloc(); } while (false)
#endif
template <typename T>
diff --git a/src/corelib/global/qversiontagging.h b/src/corelib/global/qversiontagging.h
index 3ed02c7376..75c2e9df7e 100644
--- a/src/corelib/global/qversiontagging.h
+++ b/src/corelib/global/qversiontagging.h
@@ -71,7 +71,7 @@ QT_BEGIN_NAMESPACE
# endif
# define QT_VERSION_TAG(sym) \
asm ( \
- ".section .qtversion, \"aG\", @progbits, qt_version_tag, comdat\n" \
+ ".section .qtversion, \"aG\", @progbits, " QT_STRINGIFY(QT_MANGLE_NAMESPACE(sym)) ", comdat\n" \
".align 8\n" \
QT_VERSION_TAG_RELOC(sym) \
".long " QT_STRINGIFY(QT_VERSION) "\n" \
diff --git a/src/corelib/io/io.pri b/src/corelib/io/io.pri
index 38e5c23c05..cc43608d8c 100644
--- a/src/corelib/io/io.pri
+++ b/src/corelib/io/io.pri
@@ -113,7 +113,10 @@ win32 {
SOURCES += io/qfilesystemwatcher_win.cpp
HEADERS += io/qfilesystemwatcher_win_p.h
SOURCES += io/qfilesystemengine_win.cpp
- SOURCES += io/qfilesystemiterator_win.cpp
+
+ qtConfig(filesystemiterator) {
+ SOURCES += io/qfilesystemiterator_win.cpp
+ }
!winrt {
HEADERS += \
diff --git a/src/corelib/io/qfile.cpp b/src/corelib/io/qfile.cpp
index ddd343b515..c7a06e49d5 100644
--- a/src/corelib/io/qfile.cpp
+++ b/src/corelib/io/qfile.cpp
@@ -568,9 +568,11 @@ QFile::rename(const QString &newName)
}
// If the file exists and it is a case-changing rename ("foo" -> "Foo"),
// compare Ids to make sure it really is a different file.
- if (QFile::exists(newName)) {
- if (d->fileName.compare(newName, Qt::CaseInsensitive)
- || QFileSystemEngine::id(QFileSystemEntry(d->fileName)) != QFileSystemEngine::id(QFileSystemEntry(newName))) {
+ // Note: this does not take file engines into account.
+ QByteArray targetId = QFileSystemEngine::id(QFileSystemEntry(newName));
+ if (!targetId.isNull()) {
+ QByteArray fileId = QFileSystemEngine::id(QFileSystemEntry(d->fileName));
+ if (fileId != targetId || d->fileName.compare(newName, Qt::CaseInsensitive)) {
// ### Race condition. If a file is moved in after this, it /will/ be
// overwritten. On Unix, the proper solution is to use hardlinks:
// return ::link(old, new) && ::remove(old);
diff --git a/src/corelib/io/qfilesystemengine_p.h b/src/corelib/io/qfilesystemengine_p.h
index de18c997df..196ed8df69 100644
--- a/src/corelib/io/qfilesystemengine_p.h
+++ b/src/corelib/io/qfilesystemengine_p.h
@@ -92,6 +92,8 @@ public:
QFileSystemMetaData::MetaDataFlags what);
#if defined(Q_OS_UNIX)
static bool fillMetaData(int fd, QFileSystemMetaData &data); // what = PosixStatFlags
+ static bool setPermissions(int fd, QFile::Permissions permissions, QSystemError &error,
+ QFileSystemMetaData *data = nullptr);
#endif
#if defined(Q_OS_WIN)
diff --git a/src/corelib/io/qfilesystemengine_unix.cpp b/src/corelib/io/qfilesystemengine_unix.cpp
index 2c8c4e8f9e..940a0a2122 100644
--- a/src/corelib/io/qfilesystemengine_unix.cpp
+++ b/src/corelib/io/qfilesystemengine_unix.cpp
@@ -315,9 +315,10 @@ QFileSystemEntry QFileSystemEngine::absoluteName(const QFileSystemEntry &entry)
//static
QByteArray QFileSystemEngine::id(const QFileSystemEntry &entry)
{
- struct stat statResult;
- if (stat(entry.nativeFilePath().constData(), &statResult)) {
- qErrnoWarning("stat() failed for '%s'", entry.nativeFilePath().constData());
+ QT_STATBUF statResult;
+ if (QT_STAT(entry.nativeFilePath().constData(), &statResult)) {
+ if (errno != ENOENT)
+ qErrnoWarning("stat() failed for '%s'", entry.nativeFilePath().constData());
return QByteArray();
}
QByteArray result = QByteArray::number(quint64(statResult.st_dev), 16);
@@ -428,15 +429,7 @@ bool QFileSystemEngine::fillMetaData(const QFileSystemEntry &entry, QFileSystemM
data.entryFlags &= ~what;
- const char * nativeFilePath;
- int nativeFilePathLength;
- {
- const QByteArray &path = entry.nativeFilePath();
- nativeFilePath = path.constData();
- nativeFilePathLength = path.size();
- Q_UNUSED(nativeFilePathLength);
- }
-
+ const QByteArray nativeFilePath = entry.nativeFilePath();
bool entryExists = true; // innocent until proven otherwise
QT_STATBUF statBuffer;
@@ -660,8 +653,7 @@ bool QFileSystemEngine::removeFile(const QFileSystemEntry &entry, QSystemError &
}
-//static
-bool QFileSystemEngine::setPermissions(const QFileSystemEntry &entry, QFile::Permissions permissions, QSystemError &error, QFileSystemMetaData *data)
+static mode_t toMode_t(QFile::Permissions permissions)
{
mode_t mode = 0;
if (permissions & (QFile::ReadOwner | QFile::ReadUser))
@@ -682,6 +674,13 @@ bool QFileSystemEngine::setPermissions(const QFileSystemEntry &entry, QFile::Per
mode |= S_IWOTH;
if (permissions & QFile::ExeOther)
mode |= S_IXOTH;
+ return mode;
+}
+
+//static
+bool QFileSystemEngine::setPermissions(const QFileSystemEntry &entry, QFile::Permissions permissions, QSystemError &error, QFileSystemMetaData *data)
+{
+ mode_t mode = toMode_t(permissions);
bool success = ::chmod(entry.nativeFilePath().constData(), mode) == 0;
if (success && data) {
@@ -694,6 +693,22 @@ bool QFileSystemEngine::setPermissions(const QFileSystemEntry &entry, QFile::Per
return success;
}
+//static
+bool QFileSystemEngine::setPermissions(int fd, QFile::Permissions permissions, QSystemError &error, QFileSystemMetaData *data)
+{
+ mode_t mode = toMode_t(permissions);
+
+ bool success = ::fchmod(fd, mode) == 0;
+ if (success && data) {
+ data->entryFlags &= ~QFileSystemMetaData::Permissions;
+ data->entryFlags |= QFileSystemMetaData::MetaDataFlag(uint(permissions));
+ data->knownFlagsMask |= QFileSystemMetaData::Permissions;
+ }
+ if (!success)
+ error = QSystemError(errno, QSystemError::StandardLibraryError);
+ return success;
+}
+
QString QFileSystemEngine::homePath()
{
QString home = QFile::decodeName(qgetenv("HOME"));
diff --git a/src/corelib/io/qfilesystemengine_win.cpp b/src/corelib/io/qfilesystemengine_win.cpp
index d95a6de777..889fbfea7b 100644
--- a/src/corelib/io/qfilesystemengine_win.cpp
+++ b/src/corelib/io/qfilesystemengine_win.cpp
@@ -602,13 +602,13 @@ QByteArray QFileSystemEngine::id(const QFileSystemEntry &entry)
QByteArray result;
const HANDLE handle =
#ifndef Q_OS_WINRT
- CreateFile((wchar_t*)entry.nativeFilePath().utf16(), GENERIC_READ,
+ CreateFile((wchar_t*)entry.nativeFilePath().utf16(), 0,
FILE_SHARE_READ, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
#else // !Q_OS_WINRT
- CreateFile2((const wchar_t*)entry.nativeFilePath().utf16(), GENERIC_READ,
+ CreateFile2((const wchar_t*)entry.nativeFilePath().utf16(), 0,
FILE_SHARE_READ, OPEN_EXISTING, NULL);
#endif // Q_OS_WINRT
- if (handle) {
+ if (handle != INVALID_HANDLE_VALUE) {
result = QOperatingSystemVersion::current() >= QOperatingSystemVersion::Windows8 ?
fileIdWin8(handle) : fileId(handle);
CloseHandle(handle);
diff --git a/src/corelib/io/qfilesystemwatcher_win.cpp b/src/corelib/io/qfilesystemwatcher_win.cpp
index c385a82fc5..ff0d45935c 100644
--- a/src/corelib/io/qfilesystemwatcher_win.cpp
+++ b/src/corelib/io/qfilesystemwatcher_win.cpp
@@ -71,6 +71,19 @@ QT_BEGIN_NAMESPACE
# define DEBUG if (false) qDebug
#endif
+static Qt::HANDLE createChangeNotification(const QString &path, uint flags)
+{
+ // Volume and folder paths need a trailing slash for proper notification
+ // (e.g. "c:" -> "c:/").
+ QString nativePath = QDir::toNativeSeparators(path);
+ if ((flags & FILE_NOTIFY_CHANGE_ATTRIBUTES) == 0 && !nativePath.endsWith(QLatin1Char('\\')))
+ nativePath.append(QLatin1Char('\\'));
+ const HANDLE result = FindFirstChangeNotification(reinterpret_cast<const wchar_t *>(nativePath.utf16()),
+ FALSE, flags);
+ DEBUG() << __FUNCTION__ << nativePath << hex <<showbase << flags << "returns" << result;
+ return result;
+}
+
#ifndef Q_OS_WINRT
///////////
// QWindowsRemovableDriveListener
@@ -404,8 +417,29 @@ QStringList QWindowsFileSystemWatcherEngine::addPaths(const QStringList &paths,
thread = *jt;
QMutexLocker locker(&(thread->mutex));
- handle = thread->handleForDir.value(QFileSystemWatcherPathKey(absolutePath));
- if (handle.handle != INVALID_HANDLE_VALUE && handle.flags == flags) {
+ const auto hit = thread->handleForDir.find(QFileSystemWatcherPathKey(absolutePath));
+ if (hit != thread->handleForDir.end() && hit.value().flags < flags) {
+ // Requesting to add a file whose directory has been added previously.
+ // Recreate the notification handle to add the missing notification attributes
+ // for files (FILE_NOTIFY_CHANGE_ATTRIBUTES...)
+ DEBUG() << "recreating" << absolutePath << hex << showbase << hit.value().flags
+ << "->" << flags;
+ const Qt::HANDLE fileHandle = createChangeNotification(absolutePath, flags);
+ if (fileHandle != INVALID_HANDLE_VALUE) {
+ const int index = thread->handles.indexOf(hit.value().handle);
+ const auto pit = thread->pathInfoForHandle.find(hit.value().handle);
+ Q_ASSERT(index != -1);
+ Q_ASSERT(pit != thread->pathInfoForHandle.end());
+ FindCloseChangeNotification(hit.value().handle);
+ thread->handles[index] = hit.value().handle = fileHandle;
+ hit.value().flags = flags;
+ thread->pathInfoForHandle.insert(fileHandle, pit.value());
+ thread->pathInfoForHandle.erase(pit);
+ }
+ }
+ // In addition, check on flags for sufficient notification attributes
+ if (hit != thread->handleForDir.end() && hit.value().flags >= flags) {
+ handle = hit.value();
// found a thread now insert...
DEBUG() << "Found a thread" << thread;
@@ -426,14 +460,9 @@ QStringList QWindowsFileSystemWatcherEngine::addPaths(const QStringList &paths,
}
// no thread found, first create a handle
- if (handle.handle == INVALID_HANDLE_VALUE || handle.flags != flags) {
+ if (handle.handle == INVALID_HANDLE_VALUE) {
DEBUG() << "No thread found";
- // Volume and folder paths need a trailing slash for proper notification
- // (e.g. "c:" -> "c:/").
- const QString effectiveAbsolutePath =
- isDir ? (absolutePath + QLatin1Char('/')) : absolutePath;
-
- handle.handle = FindFirstChangeNotification((wchar_t*) QDir::toNativeSeparators(effectiveAbsolutePath).utf16(), false, flags);
+ handle.handle = createChangeNotification(absolutePath, flags);
handle.flags = flags;
if (handle.handle == INVALID_HANDLE_VALUE)
continue;
diff --git a/src/corelib/io/qfsfileengine_unix.cpp b/src/corelib/io/qfsfileengine_unix.cpp
index 62e613ed14..69961ff76a 100644
--- a/src/corelib/io/qfsfileengine_unix.cpp
+++ b/src/corelib/io/qfsfileengine_unix.cpp
@@ -600,7 +600,12 @@ bool QFSFileEngine::setPermissions(uint perms)
{
Q_D(QFSFileEngine);
QSystemError error;
- if (!QFileSystemEngine::setPermissions(d->fileEntry, QFile::Permissions(perms), error, 0)) {
+ bool ok;
+ if (d->fd != -1)
+ ok = QFileSystemEngine::setPermissions(d->fd, QFile::Permissions(perms), error, 0);
+ else
+ ok = QFileSystemEngine::setPermissions(d->fileEntry, QFile::Permissions(perms), error, 0);
+ if (!ok) {
setError(QFile::PermissionsError, error.toString());
return false;
}
diff --git a/src/corelib/io/qstorageinfo_win.cpp b/src/corelib/io/qstorageinfo_win.cpp
index f02e46f095..3830c5480c 100644
--- a/src/corelib/io/qstorageinfo_win.cpp
+++ b/src/corelib/io/qstorageinfo_win.cpp
@@ -43,36 +43,52 @@
#include <QtCore/qfileinfo.h>
#include <QtCore/qvarlengtharray.h>
+#include "qfilesystementry_p.h"
+
#include <qt_windows.h>
QT_BEGIN_NAMESPACE
static const int defaultBufferSize = MAX_PATH + 1;
-void QStorageInfoPrivate::initRootPath()
+static QString canonicalPath(const QString &rootPath)
{
- rootPath = QFileInfo(rootPath).canonicalFilePath();
-
- if (rootPath.isEmpty())
- return;
-
- QString path = QDir::toNativeSeparators(rootPath);
- rootPath.clear();
+ QString path = QDir::toNativeSeparators(QFileInfo(rootPath).canonicalFilePath());
+ if (path.isEmpty())
+ return path;
if (path.startsWith(QLatin1String("\\\\?\\")))
path.remove(0, 4);
if (path.length() < 2 || path.at(1) != QLatin1Char(':'))
- return;
+ return QString();
+
path[0] = path[0].toUpper();
if (!(path.at(0).unicode() >= 'A' && path.at(0).unicode() <= 'Z'))
- return;
+ return QString();
if (!path.endsWith(QLatin1Char('\\')))
path.append(QLatin1Char('\\'));
+ return path;
+}
+
+void QStorageInfoPrivate::initRootPath()
+{
+ // Do not unnecessarily call QFileInfo::canonicalFilePath() if the path is
+ // already a drive root since it may hang on network drives.
+ const QString path = QFileSystemEntry::isDriveRootPath(rootPath)
+ ? QDir::toNativeSeparators(rootPath)
+ : canonicalPath(rootPath);
+
+ if (path.isEmpty()) {
+ valid = ready = false;
+ return;
+ }
// ### test if disk mounted to folder on other disk
wchar_t buffer[defaultBufferSize];
if (::GetVolumePathName(reinterpret_cast<const wchar_t *>(path.utf16()), buffer, defaultBufferSize))
rootPath = QDir::fromNativeSeparators(QString::fromWCharArray(buffer));
+ else
+ valid = ready = false;
}
static inline QByteArray getDevice(const QString &rootPath)
@@ -108,11 +124,14 @@ static inline QByteArray getDevice(const QString &rootPath)
void QStorageInfoPrivate::doStat()
{
+ valid = ready = true;
initRootPath();
- if (rootPath.isEmpty())
+ if (!valid || !ready)
return;
retrieveVolumeInfo();
+ if (!valid || !ready)
+ return;
device = getDevice(rootPath);
retrieveDiskFreeSpace();
}
@@ -137,9 +156,6 @@ void QStorageInfoPrivate::retrieveVolumeInfo()
ready = false;
valid = ::GetLastError() == ERROR_NOT_READY;
} else {
- ready = true;
- valid = true;
-
fileSystemType = QString::fromWCharArray(fileSystemTypeBuffer).toLatin1();
name = QString::fromWCharArray(nameBuffer);
@@ -154,10 +170,10 @@ void QStorageInfoPrivate::retrieveDiskFreeSpace()
const UINT oldmode = ::SetErrorMode(SEM_FAILCRITICALERRORS | SEM_NOOPENFILEERRORBOX);
const QString path = QDir::toNativeSeparators(rootPath);
- ::GetDiskFreeSpaceEx(reinterpret_cast<const wchar_t *>(path.utf16()),
- PULARGE_INTEGER(&bytesAvailable),
- PULARGE_INTEGER(&bytesTotal),
- PULARGE_INTEGER(&bytesFree));
+ ready = ::GetDiskFreeSpaceEx(reinterpret_cast<const wchar_t *>(path.utf16()),
+ PULARGE_INTEGER(&bytesAvailable),
+ PULARGE_INTEGER(&bytesTotal),
+ PULARGE_INTEGER(&bytesFree));
::SetErrorMode(oldmode);
}
diff --git a/src/corelib/kernel/qcoreapplication.cpp b/src/corelib/kernel/qcoreapplication.cpp
index a08021be96..6141a73966 100644
--- a/src/corelib/kernel/qcoreapplication.cpp
+++ b/src/corelib/kernel/qcoreapplication.cpp
@@ -1911,8 +1911,8 @@ void QCoreApplication::quit()
Installing or removing a QTranslator, or changing an installed QTranslator
generates a \l{QEvent::LanguageChange}{LanguageChange} event for the
- QCoreApplication instance. A QGuiApplication instance will propagate the event
- to all toplevel windows, where a reimplementation of changeEvent can
+ QCoreApplication instance. A QApplication instance will propagate the event
+ to all toplevel widgets, where a reimplementation of changeEvent can
re-translate the user interface by passing user-visible strings via the
tr() function to the respective property setters. User-interface classes
generated by Qt Designer provide a \c retranslateUi() function that can be
diff --git a/src/corelib/kernel/qdeadlinetimer.cpp b/src/corelib/kernel/qdeadlinetimer.cpp
index a2ec813f11..ae4ffdcefc 100644
--- a/src/corelib/kernel/qdeadlinetimer.cpp
+++ b/src/corelib/kernel/qdeadlinetimer.cpp
@@ -420,7 +420,7 @@ void QDeadlineTimer::setTimerType(Qt::TimerType timerType)
qint64 QDeadlineTimer::remainingTime() const Q_DECL_NOTHROW
{
qint64 ns = remainingTimeNSecs();
- return ns <= 0 ? ns : ns / (1000 * 1000);
+ return ns <= 0 ? ns : (ns + 999999) / (1000 * 1000);
}
/*!
diff --git a/src/corelib/kernel/qobjectdefs.h b/src/corelib/kernel/qobjectdefs.h
index b6307fcfcf..5fc8937f23 100644
--- a/src/corelib/kernel/qobjectdefs.h
+++ b/src/corelib/kernel/qobjectdefs.h
@@ -205,6 +205,7 @@ private: \
QT_ANNOTATE_CLASS(qt_qgadget, "") \
/*end*/
+/* qmake ignore Q_NAMESPACE */
#define Q_NAMESPACE \
extern const QMetaObject staticMetaObject; \
QT_ANNOTATE_CLASS(qt_qnamespace, "") \
diff --git a/src/corelib/kernel/qvariant.cpp b/src/corelib/kernel/qvariant.cpp
index 17c94e4e9d..e6262124fb 100644
--- a/src/corelib/kernel/qvariant.cpp
+++ b/src/corelib/kernel/qvariant.cpp
@@ -855,6 +855,12 @@ static bool convert(const QVariant::Private *d, int t, void *result, bool *ok)
if (qstrcmp(QMetaType::typeName(d->type), "QMap<QString, QVariant>") == 0) {
*static_cast<QVariantMap *>(result) =
*static_cast<QMap<QString, QVariant> *>(d->data.shared->ptr);
+ } else if (d->type == QVariant::Hash) {
+ QVariantMap *map = static_cast<QVariantMap *>(result);
+ const QVariantHash *hash = v_cast<QVariantHash>(d);
+ const auto end = hash->end();
+ for (auto it = hash->begin(); it != end; ++it)
+ map->insertMulti(it.key(), it.value());
#ifndef QT_BOOTSTRAPPED
} else if (d->type == QMetaType::QJsonValue) {
if (!v_cast<QJsonValue>(d)->isObject())
@@ -871,6 +877,12 @@ static bool convert(const QVariant::Private *d, int t, void *result, bool *ok)
if (qstrcmp(QMetaType::typeName(d->type), "QHash<QString, QVariant>") == 0) {
*static_cast<QVariantHash *>(result) =
*static_cast<QHash<QString, QVariant> *>(d->data.shared->ptr);
+ } else if (d->type == QVariant::Map) {
+ QVariantHash *hash = static_cast<QVariantHash *>(result);
+ const QVariantMap *map = v_cast<QVariantMap>(d);
+ const auto end = map->end();
+ for (auto it = map->begin(); it != end; ++it)
+ hash->insertMulti(it.key(), it.value());
#ifndef QT_BOOTSTRAPPED
} else if (d->type == QMetaType::QJsonValue) {
if (!v_cast<QJsonValue>(d)->isObject())
@@ -2070,6 +2082,7 @@ void QVariant::load(QDataStream &s)
typeId = QMetaType::type(name.constData());
if (typeId == QMetaType::UnknownType) {
s.setStatus(QDataStream::ReadCorruptData);
+ qWarning("QVariant::load: unknown user type with name %s.", name.constData());
return;
}
}
diff --git a/src/corelib/tools/qbytearray.cpp b/src/corelib/tools/qbytearray.cpp
index bbac058f2f..3ecb2ac662 100644
--- a/src/corelib/tools/qbytearray.cpp
+++ b/src/corelib/tools/qbytearray.cpp
@@ -1583,13 +1583,13 @@ void QByteArray::chop(int n)
\snippet code/src_corelib_tools_qbytearray.cpp 12
Note: QByteArray is an \l{implicitly shared} class. Consequently,
- if \e this is an empty QByteArray, then \e this will just share
- the data held in \a ba. In this case, no copying of data is done,
+ if you append to an empty byte array, then the byte array will just
+ share the data held in \a ba. In this case, no copying of data is done,
taking \l{constant time}. If a shared instance is modified, it will
be copied (copy-on-write), taking \l{linear time}.
- If \e this is not an empty QByteArray, a deep copy of the data is
- performed, taking \l{linear time}.
+ If the byte array being appended to is not empty, a deep copy of the
+ data is performed, taking \l{linear time}.
This operation typically does not suffer from allocation overhead,
because QByteArray preallocates extra space at the end of the data
@@ -1848,13 +1848,13 @@ QByteArray QByteArray::nulTerminated() const
This is the same as insert(0, \a ba).
Note: QByteArray is an \l{implicitly shared} class. Consequently,
- if \e this is an empty QByteArray, then \e this will just share
- the data held in \a ba. In this case, no copying of data is done,
+ if you prepend to an empty byte array, then the byte array will just
+ share the data held in \a ba. In this case, no copying of data is done,
taking \l{constant time}. If a shared instance is modified, it will
be copied (copy-on-write), taking \l{linear time}.
- If \e this is not an empty QByteArray, a deep copy of the data is
- performed, taking \l{linear time}.
+ If the byte array being prepended to is not empty, a deep copy of the
+ data is performed, taking \l{linear time}.
\sa append(), insert()
*/
@@ -1936,13 +1936,13 @@ QByteArray &QByteArray::prepend(char ch)
This is the same as insert(size(), \a ba).
Note: QByteArray is an \l{implicitly shared} class. Consequently,
- if \e this is an empty QByteArray, then \e this will just share
- the data held in \a ba. In this case, no copying of data is done,
+ if you append to an empty byte array, then the byte array will just
+ share the data held in \a ba. In this case, no copying of data is done,
taking \l{constant time}. If a shared instance is modified, it will
be copied (copy-on-write), taking \l{linear time}.
- If \e this is not an empty QByteArray, a deep copy of the data is
- performed, taking \l{linear time}.
+ If the byte array being appended to is not empty, a deep copy of the
+ data is performed, taking \l{linear time}.
This operation typically does not suffer from allocation overhead,
because QByteArray preallocates extra space at the end of the data
diff --git a/src/corelib/tools/qdatetime.cpp b/src/corelib/tools/qdatetime.cpp
index 5b15ffad9d..88270643d9 100644
--- a/src/corelib/tools/qdatetime.cpp
+++ b/src/corelib/tools/qdatetime.cpp
@@ -1647,10 +1647,14 @@ QString QTime::toString(Qt::DateFormat format) const
\li the hour with a leading zero (00 to 23, even with AM/PM display)
\row \li m \li the minute without a leading zero (0 to 59)
\row \li mm \li the minute with a leading zero (00 to 59)
- \row \li s \li the second without a leading zero (0 to 59)
- \row \li ss \li the second with a leading zero (00 to 59)
- \row \li z \li the milliseconds without leading zeroes (0 to 999)
- \row \li zzz \li the milliseconds with leading zeroes (000 to 999)
+ \row \li s \li the whole second, without any leading zero (0 to 59)
+ \row \li ss \li the whole second, with a leading zero where applicable (00 to 59)
+ \row \li z \li the fractional part of the second, to go after a decimal
+ point, without trailing zeroes (0 to 999). Thus "\c{s.z}"
+ reports the seconds to full available (millisecond) precision
+ without trailing zeroes.
+ \row \li zzz \li the fractional part of the second, to millisecond
+ precision, including trailing zeroes where applicable (000 to 999).
\row \li AP or A
\li use AM/PM display. \e A/AP will be replaced by either
QLocale::amText() or QLocale::pmText().
@@ -2005,10 +2009,14 @@ QTime QTime::fromString(const QString& string, Qt::DateFormat format)
\li the hour with a leading zero (00 to 23 or 01 to 12 if AM/PM display)
\row \li m \li the minute without a leading zero (0 to 59)
\row \li mm \li the minute with a leading zero (00 to 59)
- \row \li s \li the second without a leading zero (0 to 59)
- \row \li ss \li the second with a leading zero (00 to 59)
- \row \li z \li the milliseconds without leading zeroes (0 to 999)
- \row \li zzz \li the milliseconds with leading zeroes (000 to 999)
+ \row \li s \li the whole second, without any leading zero (0 to 59)
+ \row \li ss \li the whole second, with a leading zero where applicable (00 to 59)
+ \row \li z \li the fractional part of the second, to go after a decimal
+ point, without trailing zeroes (0 to 999). Thus "\c{s.z}"
+ reports the seconds to full available (millisecond) precision
+ without trailing zeroes.
+ \row \li zzz \li the fractional part of the second, to millisecond
+ precision, including trailing zeroes where applicable (000 to 999).
\row \li AP
\li interpret as an AM/PM time. \e AP must be either "AM" or "PM".
\row \li ap
@@ -3932,10 +3940,14 @@ QString QDateTime::toString(Qt::DateFormat format) const
\li the hour with a leading zero (00 to 23, even with AM/PM display)
\row \li m \li the minute without a leading zero (0 to 59)
\row \li mm \li the minute with a leading zero (00 to 59)
- \row \li s \li the second without a leading zero (0 to 59)
- \row \li ss \li the second with a leading zero (00 to 59)
- \row \li z \li the milliseconds without leading zeroes (0 to 999)
- \row \li zzz \li the milliseconds with leading zeroes (000 to 999)
+ \row \li s \li the whole second without a leading zero (0 to 59)
+ \row \li ss \li the whole second with a leading zero where applicable (00 to 59)
+ \row \li z \li the fractional part of the second, to go after a decimal
+ point, without trailing zeroes (0 to 999). Thus "\c{s.z}"
+ reports the seconds to full available (millisecond) precision
+ without trailing zeroes.
+ \row \li zzz \li the fractional part of the second, to millisecond
+ precision, including trailing zeroes where applicable (000 to 999).
\row \li AP or A
\li use AM/PM display. \e A/AP will be replaced by either "AM" or "PM".
\row \li ap or a
@@ -3949,13 +3961,14 @@ QString QDateTime::toString(Qt::DateFormat format) const
in the output. Formats without separators (e.g. "HHmm") are currently not supported.
Example format strings (assumed that the QDateTime is 21 May 2001
- 14:13:09):
+ 14:13:09.120):
\table
\header \li Format \li Result
\row \li dd.MM.yyyy \li 21.05.2001
\row \li ddd MMMM d yy \li Tue May 21 01
- \row \li hh:mm:ss.zzz \li 14:13:09.042
+ \row \li hh:mm:ss.zzz \li 14:13:09.120
+ \row \li hh:mm:ss.z \li 14:13:09.12
\row \li h:m:s ap \li 2:13:9 pm
\endtable
@@ -4963,10 +4976,14 @@ QDateTime QDateTime::fromString(const QString& string, Qt::DateFormat format)
\li the hour with a leading zero (00 to 23, even with AM/PM display)
\row \li m \li the minute without a leading zero (0 to 59)
\row \li mm \li the minute with a leading zero (00 to 59)
- \row \li s \li the second without a leading zero (0 to 59)
- \row \li ss \li the second with a leading zero (00 to 59)
- \row \li z \li the milliseconds without leading zeroes (0 to 999)
- \row \li zzz \li the milliseconds with leading zeroes (000 to 999)
+ \row \li s \li the whole second without a leading zero (0 to 59)
+ \row \li ss \li the whole second with a leading zero where applicable (00 to 59)
+ \row \li z \li the fractional part of the second, to go after a decimal
+ point, without trailing zeroes (0 to 999). Thus "\c{s.z}"
+ reports the seconds to full available (millisecond) precision
+ without trailing zeroes.
+ \row \li zzz \li the fractional part of the second, to millisecond
+ precision, including trailing zeroes where applicable (000 to 999).
\row \li AP or A
\li interpret as an AM/PM time. \e AP must be either "AM" or "PM".
\row \li ap or a
diff --git a/src/corelib/tools/qlocale.cpp b/src/corelib/tools/qlocale.cpp
index 43d83db835..789a15dded 100644
--- a/src/corelib/tools/qlocale.cpp
+++ b/src/corelib/tools/qlocale.cpp
@@ -2964,14 +2964,17 @@ QString QLocalePrivate::dateTimeToString(QStringView format, const QDateTime &da
} else {
repeat = 1;
}
- switch (repeat) {
- case 1:
- result.append(m_data->longLongToString(time.msec()));
- break;
- case 3:
- result.append(m_data->longLongToString(time.msec(), -1, 10, 3, QLocaleData::ZeroPadded));
- break;
+
+ // note: the millisecond component is treated like the decimal part of the seconds
+ // so ms == 2 is always printed as "002", but ms == 200 can be either "2" or "200"
+ result.append(m_data->longLongToString(time.msec(), -1, 10, 3, QLocaleData::ZeroPadded));
+ if (repeat == 1) {
+ if (result.endsWith(zero()))
+ result.chop(1);
+ if (result.endsWith(zero()))
+ result.chop(1);
}
+
break;
case 't':
diff --git a/src/dbus/Qt5DBusMacros.cmake b/src/dbus/Qt5DBusMacros.cmake
index ef3eb73276..0bd7364637 100644
--- a/src/dbus/Qt5DBusMacros.cmake
+++ b/src/dbus/Qt5DBusMacros.cmake
@@ -62,6 +62,7 @@ function(QT5_ADD_DBUS_INTERFACE _sources _interface _basename)
DEPENDS ${_infile} VERBATIM)
set_source_files_properties("${_impl}" PROPERTIES SKIP_AUTOMOC TRUE)
+ set_source_files_properties("${_header}" PROPERTIES SKIP_AUTOMOC TRUE)
qt5_generate_moc("${_header}" "${_moc}")
@@ -147,6 +148,7 @@ function(QT5_ADD_DBUS_ADAPTOR _sources _xml_file _include _parentClass) # _optio
qt5_generate_moc("${_header}" "${_moc}")
set_source_files_properties("${_impl}" PROPERTIES SKIP_AUTOMOC TRUE)
+ set_source_files_properties("${_header}" PROPERTIES SKIP_AUTOMOC TRUE)
macro_add_file_dependencies("${_impl}" "${_moc}")
list(APPEND ${_sources} "${_impl}" "${_header}" "${_moc}")
diff --git a/src/dbus/qdbusthreaddebug_p.h b/src/dbus/qdbusthreaddebug_p.h
index 866e777be6..96f389fa49 100644
--- a/src/dbus/qdbusthreaddebug_p.h
+++ b/src/dbus/qdbusthreaddebug_p.h
@@ -211,14 +211,14 @@ struct QDBusDispatchLocker: QDBusMutexLocker
QDBusLockerBase::reportThreadAction(action, QDBusLockerBase::BeforeAcquire, this); \
sem.acquire(); \
QDBusLockerBase::reportThreadAction(action, QDBusLockerBase::AfterAcquire, this); \
- } while (0)
+ } while (false)
# define SEM_RELEASE(action, sem) \
do { \
QDBusLockerBase::reportThreadAction(action, QDBusLockerBase::BeforeRelease, that); \
sem.release(); \
QDBusLockerBase::reportThreadAction(action, QDBusLockerBase::AfterRelease, that); \
- } while (0)
+ } while (false)
#else
# define SEM_ACQUIRE(action, sem) sem.acquire()
diff --git a/src/gui/painting/qcosmeticstroker.cpp b/src/gui/painting/qcosmeticstroker.cpp
index a3689a81c1..436a62d486 100644
--- a/src/gui/painting/qcosmeticstroker.cpp
+++ b/src/gui/painting/qcosmeticstroker.cpp
@@ -304,8 +304,8 @@ void QCosmeticStroker::setup()
ymin = deviceRect.top() - 1;
ymax = deviceRect.bottom() + 2;
- lastPixel.x = -1;
- lastPixel.y = -1;
+ lastPixel.x = INT_MIN;
+ lastPixel.y = INT_MIN;
}
// returns true if the whole line gets clipped away
@@ -325,11 +325,11 @@ bool QCosmeticStroker::clipLine(qreal &x1, qreal &y1, qreal &x2, qreal &y2)
x1 = xmax;
}
if (x2 < xmin) {
- lastPixel.x = -1;
+ lastPixel.x = INT_MIN;
y2 += (y2 - y1)/(x2 - x1) * (xmin - x2);
x2 = xmin;
} else if (x2 > xmax) {
- lastPixel.x = -1;
+ lastPixel.x = INT_MIN;
y2 += (y2 - y1)/(x2 - x1) * (xmax - x2);
x2 = xmax;
}
@@ -346,11 +346,11 @@ bool QCosmeticStroker::clipLine(qreal &x1, qreal &y1, qreal &x2, qreal &y2)
y1 = ymax;
}
if (y2 < ymin) {
- lastPixel.x = -1;
+ lastPixel.x = INT_MIN;
x2 += (x2 - x1)/(y2 - y1) * (ymin - y2);
y2 = ymin;
} else if (y2 > ymax) {
- lastPixel.x = -1;
+ lastPixel.x = INT_MIN;
x2 += (x2 - x1)/(y2 - y1) * (ymax - y2);
y2 = ymax;
}
@@ -358,7 +358,7 @@ bool QCosmeticStroker::clipLine(qreal &x1, qreal &y1, qreal &x2, qreal &y2)
return false;
clipped:
- lastPixel.x = -1;
+ lastPixel.x = INT_MIN;
return true;
}
@@ -374,7 +374,7 @@ void QCosmeticStroker::drawLine(const QPointF &p1, const QPointF &p2)
QPointF end = p2 * state->matrix;
patternOffset = state->lastPen.dashOffset()*64;
- lastPixel.x = -1;
+ lastPixel.x = INT_MIN;
stroke(this, start.x(), start.y(), end.x(), end.y(), drawCaps ? CapBegin|CapEnd : 0);
@@ -417,8 +417,8 @@ void QCosmeticStroker::calculateLastPoint(qreal rx1, qreal ry1, qreal rx2, qreal
// by calculating the direction and last pixel of the last segment in the contour.
// the info is then used to perform dropout control when drawing the first line segment
// of the contour
- lastPixel.x = -1;
- lastPixel.y = -1;
+ lastPixel.x = INT_MIN;
+ lastPixel.y = INT_MIN;
if (clipLine(rx1, ry1, rx2, ry2))
return;
@@ -599,7 +599,11 @@ void QCosmeticStroker::drawPath(const QVectorPath &path)
bool closed = path.hasImplicitClose() || (points[0] == end[-2] && points[1] == end[-1]);
int caps = (!closed && drawCaps) ? CapBegin : NoCaps;
if (closed) {
- QPointF p2 = QPointF(end[-2], end[-1]) * state->matrix;
+ QPointF p2;
+ if (points[0] == end[-2] && points[1] == end[-1] && path.elementCount() > 2)
+ p2 = QPointF(end[-4], end[-3]) * state->matrix;
+ else
+ p2 = QPointF(end[-2], end[-1]) * state->matrix;
calculateLastPoint(p2.x(), p2.y(), p.x(), p.y());
}
@@ -770,6 +774,11 @@ static bool drawLine(QCosmeticStroker *stroker, qreal rx1, qreal ry1, qreal rx2,
int ys = (y2 + 32) >> 6;
int round = (xinc > 0) ? 32 : 0;
+ // If capAdjust made us round away from what calculateLastPoint gave us,
+ // round back the other way so we start and end on the right point.
+ if ((caps & QCosmeticStroker::CapBegin) && stroker->lastPixel.y == y + 1)
+ y++;
+
if (y != ys) {
x += ((y * (1<<6)) + round - y1) * xinc >> 6;
@@ -783,7 +792,7 @@ static bool drawLine(QCosmeticStroker *stroker, qreal rx1, qreal ry1, qreal rx2,
qSwap(first, last);
bool axisAligned = qAbs(xinc) < (1 << 14);
- if (stroker->lastPixel.x >= 0) {
+ if (stroker->lastPixel.x > INT_MIN) {
if (first.x == stroker->lastPixel.x &&
first.y == stroker->lastPixel.y) {
// remove duplicated pixel
@@ -805,6 +814,14 @@ static bool drawLine(QCosmeticStroker *stroker, qreal rx1, qreal ry1, qreal rx2,
--y;
x -= xinc;
}
+ } else if (stroker->lastDir == dir &&
+ ((qAbs(stroker->lastPixel.x - first.x) <= 1 &&
+ qAbs(stroker->lastPixel.y - first.y) > 1))) {
+ x += xinc >> 1;
+ if (swapped)
+ last.x = (x >> 16);
+ else
+ last.x = (x + (ys - y - 1)*xinc) >> 16;
}
}
stroker->lastDir = dir;
@@ -847,6 +864,11 @@ static bool drawLine(QCosmeticStroker *stroker, qreal rx1, qreal ry1, qreal rx2,
int xs = (x2 + 32) >> 6;
int round = (yinc > 0) ? 32 : 0;
+ // If capAdjust made us round away from what calculateLastPoint gave us,
+ // round back the other way so we start and end on the right point.
+ if ((caps & QCosmeticStroker::CapBegin) && stroker->lastPixel.x == x + 1)
+ x++;
+
if (x != xs) {
y += ((x * (1<<6)) + round - x1) * yinc >> 6;
@@ -860,7 +882,7 @@ static bool drawLine(QCosmeticStroker *stroker, qreal rx1, qreal ry1, qreal rx2,
qSwap(first, last);
bool axisAligned = qAbs(yinc) < (1 << 14);
- if (stroker->lastPixel.x >= 0) {
+ if (stroker->lastPixel.x > INT_MIN) {
if (first.x == stroker->lastPixel.x && first.y == stroker->lastPixel.y) {
// remove duplicated pixel
if (swapped) {
@@ -881,6 +903,14 @@ static bool drawLine(QCosmeticStroker *stroker, qreal rx1, qreal ry1, qreal rx2,
--x;
y -= yinc;
}
+ } else if (stroker->lastDir == dir &&
+ ((qAbs(stroker->lastPixel.x - first.x) <= 1 &&
+ qAbs(stroker->lastPixel.y - first.y) > 1))) {
+ y += yinc >> 1;
+ if (swapped)
+ last.y = (y >> 16);
+ else
+ last.y = (y + (xs - x - 1)*yinc) >> 16;
}
}
stroker->lastDir = dir;
diff --git a/src/gui/painting/qdrawhelper.cpp b/src/gui/painting/qdrawhelper.cpp
index 67925fc69f..fdd613f32b 100644
--- a/src/gui/painting/qdrawhelper.cpp
+++ b/src/gui/painting/qdrawhelper.cpp
@@ -5561,13 +5561,13 @@ 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((QRgba64*)buffer, rasterBuffer, start, clip.y, clip.len);
+ QRgba64 *dest = destFetch64((QRgba64*)buffer, rasterBuffer, start, clip.y, end - start);
for (int xp=start; xp<end; ++xp) {
const int coverage = map[xp - x];
alphamapblend_generic(coverage, dest, xp - start, srcColor, color, colorProfile);
}
- destStore64(rasterBuffer, start, clip.y, dest, clip.len);
+ destStore64(rasterBuffer, start, clip.y, dest, end - start);
} // for (i -> line.count)
map += mapStride;
} // for (yp -> bottom)
@@ -5834,13 +5834,13 @@ 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((QRgba64*)buffer, rasterBuffer, start, clip.y, clip.len);
+ QRgba64 *dest = destFetch64((QRgba64*)buffer, rasterBuffer, start, clip.y, end - start);
for (int xp=start; xp<end; ++xp) {
const uint coverage = src[xp - x];
alphargbblend_generic(coverage, dest, xp - start, srcColor, color, colorProfile);
}
- destStore64(rasterBuffer, start, clip.y, dest, clip.len);
+ destStore64(rasterBuffer, start, clip.y, dest, end - start);
} // for (i -> line.count)
src += srcStride;
} // for (yp -> bottom)
diff --git a/src/gui/painting/qdrawhelper_p.h b/src/gui/painting/qdrawhelper_p.h
index 91f3bc368d..2be10d2cfb 100644
--- a/src/gui/painting/qdrawhelper_p.h
+++ b/src/gui/painting/qdrawhelper_p.h
@@ -885,7 +885,7 @@ do { \
case 1: *--_d = *--_s; \
} while (--n > 0); \
} \
-} while (0)
+} while (false)
#define QT_MEMCPY_USHORT(dest, src, length) \
do { \
@@ -905,7 +905,7 @@ do { \
case 1: *_d++ = *_s++; \
} while (--n > 0); \
} \
-} while (0)
+} while (false)
inline ushort qConvertRgb32To16(uint c)
{
diff --git a/src/network/socket/qlocalserver.cpp b/src/network/socket/qlocalserver.cpp
index 219a19f8b1..a9789b7d04 100644
--- a/src/network/socket/qlocalserver.cpp
+++ b/src/network/socket/qlocalserver.cpp
@@ -47,8 +47,6 @@
QT_BEGIN_NAMESPACE
-#ifndef QT_NO_LOCALSERVER
-
/*!
\class QLocalServer
\since 4.4
@@ -536,8 +534,6 @@ bool QLocalServer::waitForNewConnection(int msec, bool *timedOut)
return !d->pendingConnections.isEmpty();
}
-#endif
-
QT_END_NAMESPACE
#include "moc_qlocalserver.cpp"
diff --git a/src/network/socket/qlocalserver.h b/src/network/socket/qlocalserver.h
index 2341fd40d4..454ac30c9b 100644
--- a/src/network/socket/qlocalserver.h
+++ b/src/network/socket/qlocalserver.h
@@ -43,10 +43,9 @@
#include <QtNetwork/qtnetworkglobal.h>
#include <QtNetwork/qabstractsocket.h>
-QT_BEGIN_NAMESPACE
-
+QT_REQUIRE_CONFIG(localserver);
-#ifndef QT_NO_LOCALSERVER
+QT_BEGIN_NAMESPACE
class QLocalSocket;
class QLocalServerPrivate;
@@ -105,8 +104,6 @@ private:
Q_DECLARE_OPERATORS_FOR_FLAGS(QLocalServer::SocketOptions)
-#endif // QT_NO_LOCALSERVER
-
QT_END_NAMESPACE
#endif // QLOCALSERVER_H
diff --git a/src/network/socket/qlocalserver_p.h b/src/network/socket/qlocalserver_p.h
index 988140c1a4..2c073908cb 100644
--- a/src/network/socket/qlocalserver_p.h
+++ b/src/network/socket/qlocalserver_p.h
@@ -53,12 +53,12 @@
#include <QtNetwork/private/qtnetworkglobal_p.h>
-#ifndef QT_NO_LOCALSERVER
-
#include "qlocalserver.h"
#include "private/qobject_p.h"
#include <qqueue.h>
+QT_REQUIRE_CONFIG(localserver);
+
#if defined(QT_LOCALSOCKET_TCP)
# include <qtcpserver.h>
#elif defined(Q_OS_WIN)
@@ -128,7 +128,5 @@ public:
QT_END_NAMESPACE
-#endif // QT_NO_LOCALSERVER
-
#endif // QLOCALSERVER_P_H
diff --git a/src/network/socket/qlocalserver_unix.cpp b/src/network/socket/qlocalserver_unix.cpp
index ba987007d3..516fac681c 100644
--- a/src/network/socket/qlocalserver_unix.cpp
+++ b/src/network/socket/qlocalserver_unix.cpp
@@ -44,8 +44,6 @@
#include "qnet_unix_p.h"
#include "qtemporarydir.h"
-#ifndef QT_NO_LOCALSERVER
-
#include <sys/socket.h>
#include <sys/un.h>
@@ -341,5 +339,3 @@ void QLocalServerPrivate::setError(const QString &function)
}
QT_END_NAMESPACE
-
-#endif // QT_NO_LOCALSERVER
diff --git a/src/network/socket/qlocalsocket.cpp b/src/network/socket/qlocalsocket.cpp
index 4dad5a6eba..6fec2fdbd2 100644
--- a/src/network/socket/qlocalsocket.cpp
+++ b/src/network/socket/qlocalsocket.cpp
@@ -40,8 +40,6 @@
#include "qlocalsocket.h"
#include "qlocalsocket_p.h"
-#ifndef QT_NO_LOCALSOCKET
-
QT_BEGIN_NAMESPACE
/*!
@@ -574,6 +572,4 @@ QDebug operator<<(QDebug debug, QLocalSocket::LocalSocketState state)
QT_END_NAMESPACE
-#endif
-
#include "moc_qlocalsocket.cpp"
diff --git a/src/network/socket/qlocalsocket.h b/src/network/socket/qlocalsocket.h
index ea074db90e..9905d3a86c 100644
--- a/src/network/socket/qlocalsocket.h
+++ b/src/network/socket/qlocalsocket.h
@@ -44,10 +44,9 @@
#include <QtCore/qiodevice.h>
#include <QtNetwork/qabstractsocket.h>
-QT_BEGIN_NAMESPACE
-
+QT_REQUIRE_CONFIG(localserver);
-#ifndef QT_NO_LOCALSOCKET
+QT_BEGIN_NAMESPACE
class QLocalSocketPrivate;
@@ -148,8 +147,6 @@ Q_NETWORK_EXPORT QDebug operator<<(QDebug, QLocalSocket::LocalSocketError);
Q_NETWORK_EXPORT QDebug operator<<(QDebug, QLocalSocket::LocalSocketState);
#endif
-#endif // QT_NO_LOCALSOCKET
-
QT_END_NAMESPACE
#endif // QLOCALSOCKET_H
diff --git a/src/network/socket/qlocalsocket_p.h b/src/network/socket/qlocalsocket_p.h
index 9da37d2af3..eb59af5577 100644
--- a/src/network/socket/qlocalsocket_p.h
+++ b/src/network/socket/qlocalsocket_p.h
@@ -53,13 +53,13 @@
#include <QtNetwork/private/qtnetworkglobal_p.h>
-#ifndef QT_NO_LOCALSOCKET
-
#include "qlocalsocket.h"
#include "private/qiodevice_p.h"
#include <qtimer.h>
+QT_REQUIRE_CONFIG(localserver);
+
#if defined(QT_LOCALSOCKET_TCP)
# include "qtcpsocket.h"
#elif defined(Q_OS_WIN)
@@ -161,7 +161,5 @@ public:
QT_END_NAMESPACE
-#endif // QT_NO_LOCALSOCKET
-
#endif // QLOCALSOCKET_P_H
diff --git a/src/network/socket/qlocalsocket_unix.cpp b/src/network/socket/qlocalsocket_unix.cpp
index c7997091a7..c1d79e8137 100644
--- a/src/network/socket/qlocalsocket_unix.cpp
+++ b/src/network/socket/qlocalsocket_unix.cpp
@@ -41,8 +41,6 @@
#include "qlocalsocket_p.h"
#include "qnet_unix_p.h"
-#ifndef QT_NO_LOCALSOCKET
-
#include <sys/types.h>
#include <sys/socket.h>
#include <sys/un.h>
@@ -555,5 +553,3 @@ bool QLocalSocket::waitForReadyRead(int msecs)
}
QT_END_NAMESPACE
-
-#endif
diff --git a/src/network/socket/socket.pri b/src/network/socket/socket.pri
index 18a8153f56..b2ee1a8054 100644
--- a/src/network/socket/socket.pri
+++ b/src/network/socket/socket.pri
@@ -8,10 +8,6 @@ HEADERS += socket/qabstractsocketengine_p.h \
socket/qudpsocket.h \
socket/qtcpserver.h \
socket/qtcpsocket_p.h \
- socket/qlocalserver.h \
- socket/qlocalserver_p.h \
- socket/qlocalsocket.h \
- socket/qlocalsocket_p.h \
socket/qtcpserver_p.h
SOURCES += socket/qabstractsocketengine.cpp \
@@ -19,9 +15,7 @@ SOURCES += socket/qabstractsocketengine.cpp \
socket/qabstractsocket.cpp \
socket/qtcpsocket.cpp \
socket/qudpsocket.cpp \
- socket/qtcpserver.cpp \
- socket/qlocalsocket.cpp \
- socket/qlocalserver.cpp
+ socket/qtcpserver.cpp
# SOCK5 support.
@@ -49,42 +43,42 @@ qtConfig(sctp) {
HEADERS += socket/qnativesocketengine_p.h
}
-unix: {
- SOURCES += socket/qnativesocketengine_unix.cpp \
- socket/qlocalsocket_unix.cpp \
- socket/qlocalserver_unix.cpp
+unix {
+ SOURCES += socket/qnativesocketengine_unix.cpp
+ HEADERS += socket/qnet_unix_p.h
}
-unix:HEADERS += \
- socket/qnet_unix_p.h
-
# Suppress deprecation warnings with moc because MS headers have
# invalid C/C++ code otherwise.
msvc: QMAKE_MOC_OPTIONS += -D_WINSOCK_DEPRECATED_NO_WARNINGS
-win32:!winrt:SOURCES += socket/qnativesocketengine_win.cpp \
- socket/qlocalsocket_win.cpp \
- socket/qlocalserver_win.cpp
-
+win32:!winrt:SOURCES += socket/qnativesocketengine_win.cpp
win32:!winrt:LIBS_PRIVATE += -ladvapi32
winrt {
- SOURCES += socket/qnativesocketengine_winrt.cpp \
- socket/qlocalsocket_tcp.cpp \
- socket/qlocalserver_tcp.cpp
+ SOURCES += socket/qnativesocketengine_winrt.cpp
HEADERS += socket/qnativesocketengine_winrt_p.h
-
- DEFINES += QT_LOCALSOCKET_TCP
}
-integrity: {
- SOURCES -= socket/qlocalsocket_unix.cpp \
- socket/qlocalserver_unix.cpp
- SOURCES += socket/qlocalsocket_tcp.cpp \
- socket/qlocalserver_tcp.cpp \
- socket/qnativesocketengine_unix.cpp
-
- DEFINES += QT_LOCALSOCKET_TCP
+qtConfig(localserver) {
+ HEADERS += socket/qlocalserver.h \
+ socket/qlocalserver_p.h \
+ socket/qlocalsocket.h \
+ socket/qlocalsocket_p.h
+ SOURCES += socket/qlocalsocket.cpp \
+ socket/qlocalserver.cpp
+
+ intergrity|winrt {
+ SOURCES += socket/qlocalsocket_tcp.cpp \
+ socket/qlocalserver_tcp.cpp
+ DEFINES += QT_LOCALSOCKET_TCP
+ } else: unix {
+ SOURCES += socket/qlocalsocket_unix.cpp \
+ socket/qlocalserver_unix.cpp
+ } else: win32 {
+ SOURCES += socket/qlocalsocket_win.cpp \
+ socket/qlocalserver_win.cpp
+ }
}
qtConfig(system-proxies) {
diff --git a/src/opengl/opengl.pro b/src/opengl/opengl.pro
index 718a886809..016db46405 100644
--- a/src/opengl/opengl.pro
+++ b/src/opengl/opengl.pro
@@ -33,7 +33,6 @@ SOURCES += qgl.cpp \
qglbuffer.cpp \
HEADERS += qglshaderprogram.h \
- qgraphicsshadereffect_p.h \
gl2paintengineex/qglgradientcache_p.h \
gl2paintengineex/qglengineshadermanager_p.h \
gl2paintengineex/qgl2pexvertexarray_p.h \
@@ -44,7 +43,6 @@ HEADERS += qglshaderprogram.h \
gl2paintengineex/qglshadercache_p.h
SOURCES += qglshaderprogram.cpp \
- qgraphicsshadereffect.cpp \
gl2paintengineex/qglgradientcache.cpp \
gl2paintengineex/qglengineshadermanager.cpp \
gl2paintengineex/qgl2pexvertexarray.cpp \
@@ -52,4 +50,9 @@ SOURCES += qglshaderprogram.cpp \
gl2paintengineex/qglcustomshaderstage.cpp \
gl2paintengineex/qtextureglyphcache_gl.cpp
+qtConfig(graphicseffect) {
+ HEADERS += qgraphicsshadereffect_p.h
+ SOURCES += qgraphicsshadereffect.cpp
+}
+
load(qt_module)
diff --git a/src/opengl/qgraphicsshadereffect.cpp b/src/opengl/qgraphicsshadereffect.cpp
index d5ee281c2f..218f4af866 100644
--- a/src/opengl/qgraphicsshadereffect.cpp
+++ b/src/opengl/qgraphicsshadereffect.cpp
@@ -39,8 +39,6 @@
#include "qgraphicsshadereffect_p.h"
-#ifndef QT_NO_GRAPHICSEFFECT
-
#include "qglshaderprogram.h"
#include "gl2paintengineex/qglcustomshaderstage_p.h"
#define QGL_HAVE_CUSTOM_SHADERS 1
@@ -312,5 +310,3 @@ void QGraphicsShaderEffect::setUniforms(QGLShaderProgram *program)
}
QT_END_NAMESPACE
-
-#endif // QT_NO_GRAPHICSEFFECT
diff --git a/src/opengl/qgraphicsshadereffect_p.h b/src/opengl/qgraphicsshadereffect_p.h
index 57326fdaf2..d7e0ec51d4 100644
--- a/src/opengl/qgraphicsshadereffect_p.h
+++ b/src/opengl/qgraphicsshadereffect_p.h
@@ -53,12 +53,11 @@
#include <QtWidgets/qgraphicseffect.h>
-#ifndef QT_NO_GRAPHICSEFFECT
-
#include <QtOpenGL/qtopenglglobal.h>
-QT_BEGIN_NAMESPACE
+QT_REQUIRE_CONFIG(graphicseffect);
+QT_BEGIN_NAMESPACE
class QGLShaderProgram;
class QGLCustomShaderEffectStage;
@@ -88,6 +87,4 @@ private:
QT_END_NAMESPACE
-#endif // QT_NO_GRAPHICSEFFECT
-
#endif // QGRAPHICSSHADEREFFECT_P_H
diff --git a/src/platformsupport/input/integrityhid/qintegrityhidmanager.h b/src/platformsupport/input/integrityhid/qintegrityhidmanager.h
index c8780b2dc2..36d7587457 100644
--- a/src/platformsupport/input/integrityhid/qintegrityhidmanager.h
+++ b/src/platformsupport/input/integrityhid/qintegrityhidmanager.h
@@ -40,9 +40,9 @@
#ifndef QINTEGRITYHIDMANAGER_P_H
#define QINTEGRITYHIDMANAGER_P_H
-#include <QObject>
-#include <QList>
-#include <QThread>
+#include <QtCore/QObject>
+#include <QtCore/QList>
+#include <QtCore/QThread>
QT_BEGIN_NAMESPACE
diff --git a/src/plugins/platforms/cocoa/cocoa.pro b/src/plugins/platforms/cocoa/cocoa.pro
index f48f9ccf30..1e6ea70161 100644
--- a/src/plugins/platforms/cocoa/cocoa.pro
+++ b/src/plugins/platforms/cocoa/cocoa.pro
@@ -21,7 +21,6 @@ OBJECTIVE_SOURCES += main.mm \
qmultitouch_mac.mm \
qcocoaaccessibilityelement.mm \
qcocoaaccessibility.mm \
- qcocoafontdialoghelper.mm \
qcocoacursor.mm \
qcocoaclipboard.mm \
qcocoadrag.mm \
@@ -55,7 +54,6 @@ HEADERS += qcocoaintegration.h \
qmultitouch_mac_p.h \
qcocoaaccessibilityelement.h \
qcocoaaccessibility.h \
- qcocoafontdialoghelper.h \
qcocoacursor.h \
qcocoaclipboard.h \
qcocoadrag.h \
@@ -111,6 +109,11 @@ qtHaveModule(widgets) {
HEADERS += qcocoafiledialoghelper.h
}
+ qtConfig(fontdialog) {
+ SOURCES += qcocoafontdialoghelper.mm
+ HEADERS += qcocoafontdialoghelper.h
+ }
+
QT += widgets-private printsupport-private
}
diff --git a/src/plugins/platforms/cocoa/qcocoafontdialoghelper.h b/src/plugins/platforms/cocoa/qcocoafontdialoghelper.h
index 8b05cb7933..c3fad7cfd6 100644
--- a/src/plugins/platforms/cocoa/qcocoafontdialoghelper.h
+++ b/src/plugins/platforms/cocoa/qcocoafontdialoghelper.h
@@ -41,8 +41,11 @@
#define QCOCOAFONTDIALOGHELPER_H
#include <QObject>
+#include <QtWidgets/qtwidgetsglobal.h>
#include <qpa/qplatformdialoghelper.h>
+QT_REQUIRE_CONFIG(fontdialog);
+
QT_BEGIN_NAMESPACE
class QCocoaFontDialogHelper : public QPlatformFontDialogHelper
diff --git a/src/plugins/platforms/cocoa/qcocoafontdialoghelper.mm b/src/plugins/platforms/cocoa/qcocoafontdialoghelper.mm
index e4b796dcde..dbd7e90dba 100644
--- a/src/plugins/platforms/cocoa/qcocoafontdialoghelper.mm
+++ b/src/plugins/platforms/cocoa/qcocoafontdialoghelper.mm
@@ -37,8 +37,6 @@
**
****************************************************************************/
-#ifndef QT_NO_FONTDIALOG
-
#include <QtCore/qtimer.h>
#include <QtGui/qfontdatabase.h>
#include <qpa/qplatformtheme.h>
@@ -402,5 +400,3 @@ QFont QCocoaFontDialogHelper::currentFont() const
}
QT_END_NAMESPACE
-
-#endif // QT_NO_FONTDIALOG
diff --git a/src/plugins/platforms/cocoa/qcocoatheme.mm b/src/plugins/platforms/cocoa/qcocoatheme.mm
index a6104d86cc..fd627e3796 100644
--- a/src/plugins/platforms/cocoa/qcocoatheme.mm
+++ b/src/plugins/platforms/cocoa/qcocoatheme.mm
@@ -44,8 +44,6 @@
#include <QtCore/QVariant>
-#include "qcocoacolordialoghelper.h"
-#include "qcocoafontdialoghelper.h"
#include "qcocoasystemsettings.h"
#include "qcocoasystemtrayicon.h"
#include "qcocoamenuitem.h"
@@ -64,9 +62,15 @@
#ifdef QT_WIDGETS_LIB
#include <QtWidgets/qtwidgetsglobal.h>
+#if QT_CONFIG(colordialog)
+#include "qcocoacolordialoghelper.h"
+#endif
#if QT_CONFIG(filedialog)
#include "qcocoafiledialoghelper.h"
#endif
+#if QT_CONFIG(fontdialog)
+#include "qcocoafontdialoghelper.h"
+#endif
#endif
#include <Carbon/Carbon.h>
@@ -130,11 +134,11 @@ bool QCocoaTheme::usePlatformNativeDialog(DialogType dialogType) const
{
if (dialogType == QPlatformTheme::FileDialog)
return true;
-#if QT_CONFIG(colordialog)
+#if defined(QT_WIDGETS_LIB) && QT_CONFIG(colordialog)
if (dialogType == QPlatformTheme::ColorDialog)
return true;
#endif
-#ifndef QT_NO_FONTDIALOG
+#if defined(QT_WIDGETS_LIB) && QT_CONFIG(fontdialog)
if (dialogType == QPlatformTheme::FontDialog)
return true;
#endif
@@ -148,11 +152,11 @@ QPlatformDialogHelper * QCocoaTheme::createPlatformDialogHelper(DialogType dialo
case QPlatformTheme::FileDialog:
return new QCocoaFileDialogHelper();
#endif
-#if QT_CONFIG(colordialog)
+#if defined(QT_WIDGETS_LIB) && QT_CONFIG(colordialog)
case QPlatformTheme::ColorDialog:
return new QCocoaColorDialogHelper();
#endif
-#ifndef QT_NO_FONTDIALOG
+#if defined(QT_WIDGETS_LIB) && QT_CONFIG(fontdialog)
case QPlatformTheme::FontDialog:
return new QCocoaFontDialogHelper();
#endif
diff --git a/src/plugins/platforms/cocoa/qnswindowdelegate.mm b/src/plugins/platforms/cocoa/qnswindowdelegate.mm
index ce74aa9973..e5041fb863 100644
--- a/src/plugins/platforms/cocoa/qnswindowdelegate.mm
+++ b/src/plugins/platforms/cocoa/qnswindowdelegate.mm
@@ -78,6 +78,22 @@
return m_cocoaWindow->screen()->availableGeometry().toCGRect();
}
+#if QT_MACOS_DEPLOYMENT_TARGET_BELOW(__MAC_10_11)
+/*
+ AppKit on OS X 10.10 wrongly calls windowWillUseStandardFrame:defaultFrame
+ from -[NSWindow _frameForFullScreenMode] when going into fullscreen, resulting
+ in black bars on top and bottom of the window. By implementing the following
+ method, AppKit will choose that instead, and resolve the right fullscreen
+ geometry.
+*/
+- (NSSize)window:(NSWindow *)window willUseFullScreenContentSize:(NSSize)proposedSize
+{
+ Q_UNUSED(window);
+ Q_ASSERT(NSEqualSizes(m_cocoaWindow->screen()->geometry().size().toCGSize(), proposedSize));
+ return proposedSize;
+}
+#endif
+
- (BOOL)window:(NSWindow *)window shouldPopUpDocumentPathMenu:(NSMenu *)menu
{
Q_UNUSED(window);
diff --git a/src/plugins/platforms/windows/openglblacklists/default.json b/src/plugins/platforms/windows/openglblacklists/default.json
index 69f4a54d05..6515f02830 100644
--- a/src/plugins/platforms/windows/openglblacklists/default.json
+++ b/src/plugins/platforms/windows/openglblacklists/default.json
@@ -126,6 +126,18 @@
"features": [
"disable_desktopgl"
]
+ },
+ {
+ "id": 11,
+ "description": "VMWare Workstation Player 12 has insufficient support for OpenGL",
+ "vendor_id": "0x15AD",
+ "device_id": [ "0x0405" ],
+ "os": {
+ "type": "win"
+ },
+ "features": [
+ "disable_desktopgl", "disable_d3d11"
+ ]
}
]
}
diff --git a/src/plugins/platforms/windows/qwindowscontext.cpp b/src/plugins/platforms/windows/qwindowscontext.cpp
index 49c11ba2b7..36481b8ed7 100644
--- a/src/plugins/platforms/windows/qwindowscontext.cpp
+++ b/src/plugins/platforms/windows/qwindowscontext.cpp
@@ -844,6 +844,27 @@ static inline QWindowsInputContext *windowsInputContext()
return qobject_cast<QWindowsInputContext *>(QWindowsIntegration::instance()->inputContext());
}
+
+// Child windows, fixed-size windows or pop-ups and similar should not be resized
+static inline bool resizeOnDpiChanged(const QWindow *w)
+{
+ bool result = false;
+ if (w->isTopLevel()) {
+ switch (w->type()) {
+ case Qt::Window:
+ case Qt::Dialog:
+ case Qt::Sheet:
+ case Qt::Drawer:
+ case Qt::Tool:
+ result = !w->flags().testFlag(Qt::MSWindowsFixedSizeDialogHint);
+ break;
+ default:
+ break;
+ }
+ }
+ return result;
+}
+
/*!
\brief Main windows procedure registered for windows.
@@ -1118,9 +1139,8 @@ bool QWindowsContext::windowsProc(HWND hwnd, UINT message,
#endif
} break;
case QtWindows::DpiChangedEvent: {
- if (platformWindow->window()->flags().testFlag(Qt::MSWindowsFixedSizeDialogHint))
- return false; // Fixed-size window should not be resized
-
+ if (!resizeOnDpiChanged(platformWindow->window()))
+ return false;
platformWindow->setFlag(QWindowsWindow::WithinDpiChanged);
const RECT *prcNewWindow = reinterpret_cast<RECT *>(lParam);
SetWindowPos(hwnd, NULL, prcNewWindow->left, prcNewWindow->top,
diff --git a/src/plugins/platforms/windows/qwindowsscreen.cpp b/src/plugins/platforms/windows/qwindowsscreen.cpp
index 24fb12d27a..3a4793efcd 100644
--- a/src/plugins/platforms/windows/qwindowsscreen.cpp
+++ b/src/plugins/platforms/windows/qwindowsscreen.cpp
@@ -153,7 +153,8 @@ static QDebug operator<<(QDebug dbg, const QWindowsScreenData &d)
<< d.availableGeometry.width() << 'x' << d.availableGeometry.height() << '+' << d.availableGeometry.x() << '+' << d.availableGeometry.y()
<< " physical: " << d.physicalSizeMM.width() << 'x' << d.physicalSizeMM.height()
<< " DPI: " << d.dpi.first << 'x' << d.dpi.second << " Depth: " << d.depth
- << " Format: " << d.format;
+ << " Format: " << d.format
+ << " hMonitor: " << d.hMonitor;
if (d.flags & QWindowsScreenData::PrimaryScreen)
dbg << " primary";
if (d.flags & QWindowsScreenData::VirtualDesktop)
@@ -290,6 +291,13 @@ void QWindowsScreen::handleChanges(const QWindowsScreenData &newData)
{
m_data.physicalSizeMM = newData.physicalSizeMM;
+ if (m_data.hMonitor != newData.hMonitor) {
+ qCDebug(lcQpaWindows) << "Monitor" << m_data.name
+ << "has had its hMonitor handle changed from"
+ << m_data.hMonitor << "to" << newData.hMonitor;
+ m_data.hMonitor = newData.hMonitor;
+ }
+
if (m_data.geometry != newData.geometry || m_data.availableGeometry != newData.availableGeometry) {
m_data.geometry = newData.geometry;
m_data.availableGeometry = newData.availableGeometry;
diff --git a/src/plugins/platforms/windows/qwindowstheme.cpp b/src/plugins/platforms/windows/qwindowstheme.cpp
index 3165835d2d..a1ccf1f83c 100644
--- a/src/plugins/platforms/windows/qwindowstheme.cpp
+++ b/src/plugins/platforms/windows/qwindowstheme.cpp
@@ -869,12 +869,18 @@ QPixmap QWindowsFileIconEngine::filePixmap(const QSize &size, QIcon::Mode, QIcon
}
SHFILEINFO info;
- const unsigned int flags =
- SHGFI_ICON|iconSize|SHGFI_SYSICONINDEX|SHGFI_ADDOVERLAYS|SHGFI_OVERLAYINDEX;
-
- const bool val = cacheableDirIcon && useDefaultFolderIcon
- ? shGetFileInfoBackground(QString::fromWCharArray(L"dummy"), FILE_ATTRIBUTE_DIRECTORY, &info, flags | SHGFI_USEFILEATTRIBUTES)
- : shGetFileInfoBackground(filePath, 0, &info, flags);
+ unsigned int flags = SHGFI_ICON | iconSize | SHGFI_SYSICONINDEX | SHGFI_ADDOVERLAYS | SHGFI_OVERLAYINDEX;
+ DWORD attributes = 0;
+ QString path = filePath;
+ if (cacheableDirIcon && useDefaultFolderIcon) {
+ flags |= SHGFI_USEFILEATTRIBUTES;
+ attributes |= FILE_ATTRIBUTE_DIRECTORY;
+ path = QStringLiteral("dummy");
+ } else if (!fileInfo().exists()) {
+ flags |= SHGFI_USEFILEATTRIBUTES;
+ attributes |= FILE_ATTRIBUTE_NORMAL;
+ }
+ const bool val = shGetFileInfoBackground(path, attributes, &info, flags);
// Even if GetFileInfo returns a valid result, hIcon can be empty in some cases
if (val && info.hIcon) {
diff --git a/src/plugins/platforms/windows/qwindowswindow.cpp b/src/plugins/platforms/windows/qwindowswindow.cpp
index 25d50e6466..9c8a3d4956 100644
--- a/src/plugins/platforms/windows/qwindowswindow.cpp
+++ b/src/plugins/platforms/windows/qwindowswindow.cpp
@@ -39,7 +39,9 @@
#include "qwindowswindow.h"
#include "qwindowscontext.h"
-#include "qwindowsdrag.h"
+#if QT_CONFIG(draganddrop)
+# include "qwindowsdrag.h"
+#endif
#include "qwindowsscreen.h"
#include "qwindowsintegration.h"
#include "qwindowsmenu.h"
@@ -1834,6 +1836,8 @@ bool QWindowsWindow::isFullScreen_sys() const
if (!w->isTopLevel())
return false;
QRect geometry = geometry_sys();
+ if (testFlag(HasBorderInFullScreen))
+ geometry += QMargins(1, 1, 1, 1);
QPlatformScreen *screen = screenForGeometry(geometry);
return screen && geometry == QHighDpi::toNativePixels(screen->geometry(), screen);
}
diff --git a/src/plugins/platforms/winrt/qwinrtfileengine.cpp b/src/plugins/platforms/winrt/qwinrtfileengine.cpp
index dab2482ab3..58375d331c 100644
--- a/src/plugins/platforms/winrt/qwinrtfileengine.cpp
+++ b/src/plugins/platforms/winrt/qwinrtfileengine.cpp
@@ -426,8 +426,7 @@ QDateTime QWinRTFileEngine::fileTime(FileTime type) const
ComPtr<FileProperties::IBasicProperties> properties;
hr = QWinRTFunctions::await(op, properties.GetAddressOf());
RETURN_IF_FAILED("Failed to get file properties", return QDateTime());
- hr = type == ModificationTime ? properties->get_DateModified(&dateTime)
- : properties->get_ItemDate(&dateTime);
+ hr = properties->get_DateModified(&dateTime);
RETURN_IF_FAILED("Failed to get file date", return QDateTime());
}
break;
diff --git a/src/plugins/platforms/xcb/gl_integrations/gl_integrations_plugin_base.pri b/src/plugins/platforms/xcb/gl_integrations/gl_integrations_plugin_base.pri
index df471f1105..98e48b706f 100644
--- a/src/plugins/platforms/xcb/gl_integrations/gl_integrations_plugin_base.pri
+++ b/src/plugins/platforms/xcb/gl_integrations/gl_integrations_plugin_base.pri
@@ -5,10 +5,3 @@ INCLUDEPATH += $$PWD/../
load(qt_build_paths)
-!qtConfig(system-xcb) {
- QMAKE_USE += xcb-static xcb
-} else {
- qtConfig(xkb): QMAKE_USE += xcb_xkb
- qtConfig(xcb-render): QMAKE_USE += xcb_render
- QMAKE_USE += xcb_syslibs
-}
diff --git a/src/plugins/sqldrivers/ibase/qsql_ibase.cpp b/src/plugins/sqldrivers/ibase/qsql_ibase.cpp
index 23a86e2266..c50fc7916a 100644
--- a/src/plugins/sqldrivers/ibase/qsql_ibase.cpp
+++ b/src/plugins/sqldrivers/ibase/qsql_ibase.cpp
@@ -544,6 +544,7 @@ static char* readArrayBuffer(QList<QVariant>& list, char *buffer, short curDim,
case blr_varying:
case blr_varying2:
strLen += 2; // for the two terminating null values
+ Q_FALLTHROUGH();
case blr_text:
case blr_text2: {
int o;
diff --git a/src/plugins/styles/mac/qmacstyle_mac.mm b/src/plugins/styles/mac/qmacstyle_mac.mm
index 1379295623..7e54025d6e 100644
--- a/src/plugins/styles/mac/qmacstyle_mac.mm
+++ b/src/plugins/styles/mac/qmacstyle_mac.mm
@@ -81,21 +81,27 @@
#include <qpushbutton.h>
#endif
#include <qradiobutton.h>
+#if QT_CONFIG(rubberband)
#include <qrubberband.h>
+#endif
#include <qscrollbar.h>
#include <qsizegrip.h>
#include <qstyleoption.h>
#include <qtoolbar.h>
#include <qtoolbutton.h>
#include <qtreeview.h>
+#if QT_CONFIG(tableview)
#include <qtableview.h>
+#endif
#include <qoperatingsystemversion.h>
#if QT_CONFIG(wizard)
#include <qwizard.h>
#endif
#include <qdebug.h>
#include <qlibrary.h>
+#if QT_CONFIG(datetimeedit)
#include <qdatetimeedit.h>
+#endif
#include <qmath.h>
#include <QtWidgets/qgraphicsproxywidget.h>
#include <QtWidgets/qgraphicsview.h>
@@ -317,7 +323,7 @@ static bool isInMacUnifiedToolbarArea(QWindow *window, int windowY)
}
-void drawTabCloseButton(QPainter *p, bool hover, bool selected, bool pressed)
+static void drawTabCloseButton(QPainter *p, bool hover, bool selected, bool pressed, bool documentMode)
{
p->setRenderHints(QPainter::Antialiasing);
QRect rect(0, 0, closeButtonSize, closeButtonSize);
@@ -328,10 +334,16 @@ void drawTabCloseButton(QPainter *p, bool hover, bool selected, bool pressed)
// draw background circle
QColor background;
if (selected) {
- background = pressed ? tabBarCloseButtonBackgroundSelectedPressed : tabBarCloseButtonBackgroundSelectedHovered;
+ if (documentMode)
+ background = pressed ? tabBarCloseButtonBackgroundSelectedPressed : tabBarCloseButtonBackgroundSelectedHovered;
+ else
+ background = QColor(255, 255, 255, pressed ? 150 : 100); // Translucent white
} else {
background = pressed ? tabBarCloseButtonBackgroundPressed : tabBarCloseButtonBackgroundHovered;
+ if (!documentMode)
+ background = background.lighter(pressed ? 135 : 140); // Lighter tab background, lighter color
}
+
p->setPen(Qt::transparent);
p->setBrush(background);
p->drawRoundedRect(rect, closeButtonCornerRadius, closeButtonCornerRadius);
@@ -340,7 +352,7 @@ void drawTabCloseButton(QPainter *p, bool hover, bool selected, bool pressed)
// draw cross
const int margin = 3;
QPen crossPen;
- crossPen.setColor(selected ? tabBarCloseButtonCrossSelected : tabBarCloseButtonCross);
+ crossPen.setColor(selected ? (documentMode ? tabBarCloseButtonCrossSelected : Qt::white) : tabBarCloseButtonCross);
crossPen.setWidthF(1.1);
crossPen.setCapStyle(Qt::FlatCap);
p->setPen(crossPen);
@@ -1186,9 +1198,10 @@ void QMacStylePrivate::drawFocusRing(QPainter *p, const QRect &targetRect, int h
}
#ifndef QT_NO_TABBAR
-void QMacStylePrivate::tabLayout(const QStyleOptionTab *opt, const QWidget *widget, QRect *textRect) const
+void QMacStylePrivate::tabLayout(const QStyleOptionTab *opt, const QWidget *widget, QRect *textRect, QRect *iconRect) const
{
Q_ASSERT(textRect);
+ Q_ASSERT(iconRect);
QRect tr = opt->rect;
const bool verticalTabs = opt->shape == QTabBar::RoundedEast
|| opt->shape == QTabBar::RoundedWest
@@ -1222,6 +1235,26 @@ void QMacStylePrivate::tabLayout(const QStyleOptionTab *opt, const QWidget *widg
tr.setLeft(tr.left() + 4 + buttonSize);
}
+ // icon
+ if (!opt->icon.isNull()) {
+ QSize iconSize = opt->iconSize;
+ if (!iconSize.isValid()) {
+ int iconExtent = proxyStyle->pixelMetric(QStyle::PM_SmallIconSize);
+ iconSize = QSize(iconExtent, iconExtent);
+ }
+ QSize tabIconSize = opt->icon.actualSize(iconSize,
+ (opt->state & QStyle::State_Enabled) ? QIcon::Normal : QIcon::Disabled,
+ (opt->state & QStyle::State_Selected) ? QIcon::On : QIcon::Off);
+ // High-dpi icons do not need adjustment; make sure tabIconSize is not larger than iconSize
+ tabIconSize = QSize(qMin(tabIconSize.width(), iconSize.width()), qMin(tabIconSize.height(), iconSize.height()));
+
+ *iconRect = QRect(tr.left(), tr.center().y() - tabIconSize.height() / 2,
+ tabIconSize.width(), tabIconSize.height());
+ if (!verticalTabs)
+ *iconRect = proxyStyle->visualRect(opt->direction, opt->rect, *iconRect);
+ tr.setLeft(tr.left() + tabIconSize.width() + 4);
+ }
+
if (!verticalTabs)
tr = proxyStyle->visualRect(opt->direction, opt->rect, tr);
@@ -1487,7 +1520,7 @@ void QMacStylePrivate::initComboboxBdi(const QStyleOptionComboBox *combo, HIThem
// an extra check here before using the mini and small buttons.
int h = combo->rect.size().height();
if (combo->editable){
-#ifndef QT_NO_DATETIMEEDIT
+#if QT_CONFIG(datetimeedit)
if (qobject_cast<const QDateTimeEdit *>(widget)) {
// Except when, you know, we get a QDateTimeEdit with calendarPopup
// enabled. And then things get weird, basically because it's a
@@ -2354,6 +2387,8 @@ void QMacStyle::polish(QWidget* w)
QPalette p = w->palette();
p.setColor(QPalette::WindowText, QColor(17, 17, 17));
w->setPalette(p);
+ w->setAttribute(Qt::WA_SetPalette, false);
+ w->setAttribute(Qt::WA_SetFont, false);
}
}
#endif
@@ -2395,6 +2430,15 @@ void QMacStyle::unpolish(QWidget* w)
}
#endif
+#ifndef QT_NO_TABBAR
+ if (qobject_cast<QTabBar*>(w)) {
+ if (!w->testAttribute(Qt::WA_SetFont))
+ w->setFont(qApp->font(w));
+ if (!w->testAttribute(Qt::WA_SetPalette))
+ w->setPalette(qApp->palette(w));
+ }
+#endif
+
if (QRubberBand *rubber = qobject_cast<QRubberBand*>(w)) {
rubber->setWindowOpacity(1.0);
rubber->setAttribute(Qt::WA_PaintOnScreen, true);
@@ -3579,14 +3623,16 @@ void QMacStyle::drawPrimitive(PrimitiveElement pe, const QStyleOption *opt, QPai
case PE_IndicatorTabClose: {
// Make close button visible only on the hovered tab.
if (QTabBar *tabBar = qobject_cast<QTabBar*>(w->parentWidget())) {
+ const bool documentMode = tabBar->documentMode();
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)))) {
+ if (!documentMode ||
+ (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);
+ drawTabCloseButton(p, hover, selected, pressed, documentMode);
}
}
} break;
@@ -3729,7 +3775,7 @@ void QMacStyle::drawControl(ControlElement ce, const QStyleOption *opt, QPainter
CGRect bounds = ir.toCGRect();
bool noVerticalHeader = true;
-#ifndef QT_NO_TABLEVIEW
+#if QT_CONFIG(tableview)
if (w)
if (const QTableView *table = qobject_cast<const QTableView *>(w->parentWidget()))
noVerticalHeader = !table->verticalHeader()->isVisible();
@@ -4831,7 +4877,8 @@ 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);
+ QRect dummyIconRect;
+ d->tabLayout(tab, widget, &rect, &dummyIconRect);
}
break;
case SE_TabBarTabLeftButton:
diff --git a/src/plugins/styles/mac/qmacstyle_mac_p_p.h b/src/plugins/styles/mac/qmacstyle_mac_p_p.h
index 7c9c0f8f3c..f1c355e621 100644
--- a/src/plugins/styles/mac/qmacstyle_mac_p_p.h
+++ b/src/plugins/styles/mac/qmacstyle_mac_p_p.h
@@ -82,7 +82,9 @@
#include <qpushbutton.h>
#endif
#include <qradiobutton.h>
+#if QT_CONFIG(rubberband)
#include <qrubberband.h>
+#endif
#include <qsizegrip.h>
#include <qspinbox.h>
#include <qsplitter.h>
@@ -92,9 +94,13 @@
#include <qtoolbar.h>
#include <qtoolbutton.h>
#include <qtreeview.h>
+#if QT_CONFIG(tableview)
#include <qtableview.h>
+#endif
#include <qdebug.h>
+#if QT_CONFIG(datetimeedit)
#include <qdatetimeedit.h>
+#endif
#include <qmath.h>
#include <qpair.h>
#include <qvector.h>
@@ -164,7 +170,7 @@ typedef void (^QCocoaDrawRectBlock)(CGContextRef, const CGRect &);
do { \
static const int sizes[] = { (large), (small), (mini) }; \
return sizes[controlSize]; \
- } while (0)
+ } while (false)
#if QT_CONFIG(pushbutton)
bool qt_mac_buttonIsRenderedFlat(const QPushButton *pushButton, const QStyleOptionButton *option);
@@ -242,7 +248,7 @@ 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;
+ void tabLayout(const QStyleOptionTab *opt, const QWidget *widget, QRect *textRect, QRect *iconRect) const;
#endif
public:
diff --git a/src/plugins/styles/windowsvista/qwindowsvistastyle_p_p.h b/src/plugins/styles/windowsvista/qwindowsvistastyle_p_p.h
index ee3a12c641..36c8f9d818 100644
--- a/src/plugins/styles/windowsvista/qwindowsvistastyle_p_p.h
+++ b/src/plugins/styles/windowsvista/qwindowsvistastyle_p_p.h
@@ -82,7 +82,9 @@
#include <qdialogbuttonbox.h>
#endif
#include <qinputdialog.h>
+#if QT_CONFIG(tableview)
#include <qtableview.h>
+#endif
#include <qdatetime.h>
#include <qcommandlinkbutton.h>
diff --git a/src/plugins/styles/windowsvista/qwindowsxpstyle.cpp b/src/plugins/styles/windowsvista/qwindowsxpstyle.cpp
index a21ce4b531..e670794cd3 100644
--- a/src/plugins/styles/windowsvista/qwindowsxpstyle.cpp
+++ b/src/plugins/styles/windowsvista/qwindowsxpstyle.cpp
@@ -1165,7 +1165,7 @@ void QWindowsXPStyle::polish(QWidget *widget)
widget->setAttribute(Qt::WA_Hover);
}
-#ifndef QT_NO_RUBBERBAND
+#if QT_CONFIG(rubberband)
if (qobject_cast<QRubberBand*>(widget)) {
widget->setWindowOpacity(0.6);
}
@@ -1200,7 +1200,7 @@ void QWindowsXPStyle::polish(QPalette &pal)
/*! \reimp */
void QWindowsXPStyle::unpolish(QWidget *widget)
{
-#ifndef QT_NO_RUBBERBAND
+#if QT_CONFIG(rubberband)
if (qobject_cast<QRubberBand*>(widget)) {
widget->setWindowOpacity(1.0);
}
@@ -2418,7 +2418,7 @@ void QWindowsXPStyle::drawControl(ControlElement element, const QStyleOption *op
}
break;
#endif // QT_NO_DOCKWIDGET
-#ifndef QT_NO_RUBBERBAND
+#if QT_CONFIG(rubberband)
case CE_RubberBand:
if (qstyleoption_cast<const QStyleOptionRubberBand *>(option)) {
QColor highlight = option->palette.color(QPalette::Active, QPalette::Highlight);
@@ -2434,7 +2434,7 @@ void QWindowsXPStyle::drawControl(ControlElement element, const QStyleOption *op
return;
}
break;
-#endif // QT_NO_RUBBERBAND
+#endif // QT_CONFIG(rubberband)
case CE_HeaderEmptyArea:
if (option->state & State_Horizontal)
{
@@ -3758,12 +3758,12 @@ int QWindowsXPStyle::styleHint(StyleHint hint, const QStyleOption *option, const
}
}
break;
-#ifndef QT_NO_RUBBERBAND
+#if QT_CONFIG(rubberband)
case SH_RubberBand_Mask:
if (qstyleoption_cast<const QStyleOptionRubberBand *>(option))
res = 0;
break;
-#endif // QT_NO_RUBBERBAND
+#endif // QT_CONFIG(rubberband)
case SH_ItemView_DrawDelegateFrame:
res = 1;
diff --git a/src/testlib/qtestassert.h b/src/testlib/qtestassert.h
index 21d3ffaef8..6498ea84ef 100644
--- a/src/testlib/qtestassert.h
+++ b/src/testlib/qtestassert.h
@@ -45,9 +45,9 @@
QT_BEGIN_NAMESPACE
-#define QTEST_ASSERT(cond) do { if (!(cond)) qt_assert(#cond,__FILE__,__LINE__); } while (0)
+#define QTEST_ASSERT(cond) do { if (!(cond)) qt_assert(#cond,__FILE__,__LINE__); } while (false)
-#define QTEST_ASSERT_X(cond, where, what) do { if (!(cond)) qt_assert_x(where, what,__FILE__,__LINE__); } while (0)
+#define QTEST_ASSERT_X(cond, where, what) do { if (!(cond)) qt_assert_x(where, what,__FILE__,__LINE__); } while (false)
QT_END_NAMESPACE
diff --git a/src/testlib/qtestblacklist.cpp b/src/testlib/qtestblacklist.cpp
index dbf79575a8..af57ea0ee7 100644
--- a/src/testlib/qtestblacklist.cpp
+++ b/src/testlib/qtestblacklist.cpp
@@ -142,7 +142,9 @@ static QSet<QByteArray> keywords()
#ifdef Q_CC_MSVC
<< "msvc"
#ifdef _MSC_VER
- #if _MSC_VER == 1900
+ #if _MSC_VER == 1910
+ << "msvc-2017"
+ #elif _MSC_VER == 1900
<< "msvc-2015"
#elif _MSC_VER == 1800
<< "msvc-2013"
diff --git a/src/testlib/qtestcase.h b/src/testlib/qtestcase.h
index b70bacbd17..fafc0eb7d6 100644
--- a/src/testlib/qtestcase.h
+++ b/src/testlib/qtestcase.h
@@ -63,13 +63,13 @@ class QRegularExpression;
do {\
if (!QTest::qVerify(static_cast<bool>(statement), #statement, "", __FILE__, __LINE__))\
return;\
-} while (0)
+} while (false)
#define QFAIL(message) \
do {\
QTest::qFail(message, __FILE__, __LINE__);\
return;\
-} while (0)
+} while (false)
#define QVERIFY2(statement, description) \
do {\
@@ -80,13 +80,13 @@ do {\
if (!QTest::qVerify(false, #statement, (description), __FILE__, __LINE__))\
return;\
}\
-} while (0)
+} while (false)
#define QCOMPARE(actual, expected) \
do {\
if (!QTest::qCompare(actual, expected, #actual, #expected, __FILE__, __LINE__))\
return;\
-} while (0)
+} while (false)
#ifndef QT_NO_EXCEPTIONS
@@ -111,7 +111,7 @@ do {\
" but unknown exception caught", __FILE__, __LINE__);\
return;\
}\
- } while (0)
+ } while (false)
#else // QT_NO_EXCEPTIONS
@@ -158,7 +158,7 @@ do {\
do { \
QTRY_IMPL((expr), timeout);\
QVERIFY(expr); \
-} while (0)
+} while (false)
#define QTRY_VERIFY(expr) QTRY_VERIFY_WITH_TIMEOUT((expr), 5000)
@@ -167,7 +167,7 @@ do { \
do { \
QTRY_IMPL((expr), timeout);\
QVERIFY2(expr, messageExpression); \
-} while (0)
+} while (false)
#define QTRY_VERIFY2(expr, messageExpression) QTRY_VERIFY2_WITH_TIMEOUT((expr), (messageExpression), 5000)
@@ -176,7 +176,7 @@ do { \
do { \
QTRY_IMPL(((expr) == (expected)), timeout);\
QCOMPARE((expr), expected); \
-} while (0)
+} while (false)
#define QTRY_COMPARE(expr, expected) QTRY_COMPARE_WITH_TIMEOUT((expr), expected, 5000)
@@ -184,7 +184,7 @@ do { \
do {\
QTest::qSkip(statement, __FILE__, __LINE__);\
return;\
-} while (0)
+} while (false)
#ifdef Q_COMPILER_VARIADIC_MACROS
@@ -200,7 +200,7 @@ do {\
do {\
if (!QTest::qExpectFail(dataIndex, comment, QTest::mode, __FILE__, __LINE__))\
return;\
-} while (0)
+} while (false)
#define QFETCH(Type, name)\
Type name = *static_cast<Type *>(QTest::qData(#name, ::qMetaTypeId<typename std::remove_cv<Type >::type>()))
@@ -212,7 +212,7 @@ do {\
do {\
if (!QTest::qTest(actual, testElement, #actual, #testElement, __FILE__, __LINE__))\
return;\
-} while (0)
+} while (false)
#define QWARN(msg)\
QTest::qWarn(msg, __FILE__, __LINE__)
diff --git a/src/widgets/accessible/complexwidgets.cpp b/src/widgets/accessible/complexwidgets.cpp
index 4770c513cf..dd9bea1aec 100644
--- a/src/widgets/accessible/complexwidgets.cpp
+++ b/src/widgets/accessible/complexwidgets.cpp
@@ -46,7 +46,6 @@
#include <qtabbar.h>
#include <qcombobox.h>
#include <qlistview.h>
-#include <qtableview.h>
#include <qlineedit.h>
#include <qstyle.h>
#include <qstyleoption.h>
diff --git a/src/widgets/accessible/itemviews.cpp b/src/widgets/accessible/itemviews.cpp
index 3cef564781..87c0a59563 100644
--- a/src/widgets/accessible/itemviews.cpp
+++ b/src/widgets/accessible/itemviews.cpp
@@ -40,7 +40,9 @@
#include "itemviews_p.h"
#include <qheaderview.h>
+#if QT_CONFIG(tableview)
#include <qtableview.h>
+#endif
#include <qlistview.h>
#include <qtreeview.h>
#include <private/qtreeview_p.h>
@@ -81,7 +83,7 @@ QAccessibleTable::QAccessibleTable(QWidget *w)
{
Q_ASSERT(view());
-#ifndef QT_NO_TABLEVIEW
+#if QT_CONFIG(tableview)
if (qobject_cast<const QTableView*>(view())) {
m_role = QAccessible::Table;
} else
@@ -117,7 +119,7 @@ QHeaderView *QAccessibleTable::horizontalHeader() const
{
QHeaderView *header = 0;
if (false) {
-#ifndef QT_NO_TABLEVIEW
+#if QT_CONFIG(tableview)
} else if (const QTableView *tv = qobject_cast<const QTableView*>(view())) {
header = tv->horizontalHeader();
#endif
@@ -133,7 +135,7 @@ QHeaderView *QAccessibleTable::verticalHeader() const
{
QHeaderView *header = 0;
if (false) {
-#ifndef QT_NO_TABLEVIEW
+#if QT_CONFIG(tableview)
} else if (const QTableView *tv = qobject_cast<const QTableView*>(view())) {
header = tv->verticalHeader();
#endif
@@ -866,7 +868,7 @@ QHeaderView *QAccessibleTableCell::horizontalHeader() const
QHeaderView *header = 0;
if (false) {
-#ifndef QT_NO_TABLEVIEW
+#if QT_CONFIG(tableview)
} else if (const QTableView *tv = qobject_cast<const QTableView*>(view)) {
header = tv->horizontalHeader();
#endif
@@ -882,7 +884,7 @@ QHeaderView *QAccessibleTableCell::horizontalHeader() const
QHeaderView *QAccessibleTableCell::verticalHeader() const
{
QHeaderView *header = 0;
-#ifndef QT_NO_TABLEVIEW
+#if QT_CONFIG(tableview)
if (const QTableView *tv = qobject_cast<const QTableView*>(view))
header = tv->verticalHeader();
#endif
@@ -1125,7 +1127,7 @@ QRect QAccessibleTableHeaderCell::rect() const
{
QHeaderView *header = 0;
if (false) {
-#ifndef QT_NO_TABLEVIEW
+#if QT_CONFIG(tableview)
} else if (const QTableView *tv = qobject_cast<const QTableView*>(view)) {
if (orientation == Qt::Horizontal) {
header = tv->horizontalHeader();
@@ -1192,7 +1194,7 @@ QHeaderView *QAccessibleTableHeaderCell::headerView() const
{
QHeaderView *header = 0;
if (false) {
-#ifndef QT_NO_TABLEVIEW
+#if QT_CONFIG(tableview)
} else if (const QTableView *tv = qobject_cast<const QTableView*>(view)) {
if (orientation == Qt::Horizontal) {
header = tv->horizontalHeader();
diff --git a/src/widgets/accessible/qaccessiblewidget.cpp b/src/widgets/accessible/qaccessiblewidget.cpp
index f18930f273..3bc0f7e77b 100644
--- a/src/widgets/accessible/qaccessiblewidget.cpp
+++ b/src/widgets/accessible/qaccessiblewidget.cpp
@@ -54,7 +54,9 @@
#include "qwidget.h"
#include "qdebug.h"
#include <qmath.h>
+#if QT_CONFIG(rubberband)
#include <QRubberBand>
+#endif
#include <QFocusFrame>
#include <QMenu>
#include <QtWidgets/private/qwidget_p.h>
diff --git a/src/widgets/accessible/qaccessiblewidgetfactory.cpp b/src/widgets/accessible/qaccessiblewidgetfactory.cpp
index e7db53c251..ccd176cd04 100644
--- a/src/widgets/accessible/qaccessiblewidgetfactory.cpp
+++ b/src/widgets/accessible/qaccessiblewidgetfactory.cpp
@@ -193,7 +193,7 @@ QAccessibleInterface *qAccessibleFactory(const QString &classname, QObject *obje
} else if (classname == QLatin1String("QDial")) {
iface = new QAccessibleDial(widget);
#endif
-#ifndef QT_NO_RUBBERBAND
+#if QT_CONFIG(rubberband)
} else if (classname == QLatin1String("QRubberBand")) {
iface = new QAccessibleWidget(widget, QAccessible::Border);
#endif
diff --git a/src/widgets/accessible/qaccessiblewidgets.cpp b/src/widgets/accessible/qaccessiblewidgets.cpp
index 7f77f7c524..60f489d487 100644
--- a/src/widgets/accessible/qaccessiblewidgets.cpp
+++ b/src/widgets/accessible/qaccessiblewidgets.cpp
@@ -58,7 +58,9 @@
#include <QDialogButtonBox>
#endif
#include <limits.h>
+#if QT_CONFIG(rubberband)
#include <QRubberBand>
+#endif
#include <QTextBrowser>
#include <QCalendarWidget>
#include <QAbstractItemView>
diff --git a/src/widgets/dialogs/dialogs.pri b/src/widgets/dialogs/dialogs.pri
index c2625ec1f4..a6a6b2d352 100644
--- a/src/widgets/dialogs/dialogs.pri
+++ b/src/widgets/dialogs/dialogs.pri
@@ -1,12 +1,6 @@
# Qt dialogs module
-HEADERS += \
- dialogs/qfontdialog.h \
- dialogs/qfontdialog_p.h
-
INCLUDEPATH += $$PWD
-SOURCES += \
- dialogs/qfontdialog.cpp
qtConfig(colordialog) {
HEADERS += dialogs/qcolordialog.h
@@ -51,6 +45,14 @@ qtConfig(filesystemmodel) {
dialogs/qfileinfogatherer.cpp
}
+qtConfig(fontdialog) {
+ HEADERS += \
+ dialogs/qfontdialog.h \
+ dialogs/qfontdialog_p.h
+
+ SOURCES += dialogs/qfontdialog.cpp
+}
+
qtConfig(fscompleter) {
HEADERS += dialogs/qfscompleter_p.h
}
diff --git a/src/widgets/dialogs/qdialog.cpp b/src/widgets/dialogs/qdialog.cpp
index 7cb24d65fc..1cd587b78d 100644
--- a/src/widgets/dialogs/qdialog.cpp
+++ b/src/widgets/dialogs/qdialog.cpp
@@ -41,7 +41,9 @@
#if QT_CONFIG(colordialog)
#include "qcolordialog.h"
#endif
+#if QT_CONFIG(fontdialog)
#include "qfontdialog.h"
+#endif
#if QT_CONFIG(filedialog)
#include "qfiledialog.h"
#endif
@@ -81,7 +83,7 @@ static inline int themeDialogType(const QDialog *dialog)
if (qobject_cast<const QColorDialog *>(dialog))
return QPlatformTheme::ColorDialog;
#endif
-#ifndef QT_NO_FONTDIALOG
+#if QT_CONFIG(fontdialog)
if (qobject_cast<const QFontDialog *>(dialog))
return QPlatformTheme::FontDialog;
#endif
diff --git a/src/widgets/dialogs/qfontdialog.cpp b/src/widgets/dialogs/qfontdialog.cpp
index b20a1449eb..587e31d8c5 100644
--- a/src/widgets/dialogs/qfontdialog.cpp
+++ b/src/widgets/dialogs/qfontdialog.cpp
@@ -40,8 +40,6 @@
#include "qwindowdefs.h"
#include "qfontdialog.h"
-#if QT_CONFIG(fontdialog)
-
#include "qfontdialog_p.h"
#include <qapplication.h>
@@ -1049,5 +1047,3 @@ QT_END_NAMESPACE
#include "qfontdialog.moc"
#include "moc_qfontdialog.cpp"
-
-#endif // QT_CONFIG(fontdialog)
diff --git a/src/widgets/dialogs/qfontdialog.h b/src/widgets/dialogs/qfontdialog.h
index da13a5ab99..3fb3997b85 100644
--- a/src/widgets/dialogs/qfontdialog.h
+++ b/src/widgets/dialogs/qfontdialog.h
@@ -44,12 +44,11 @@
#include <QtGui/qwindowdefs.h>
#include <QtGui/qfont.h>
-#ifndef QT_NO_FONTDIALOG
-
#include <QtWidgets/qdialog.h>
-QT_BEGIN_NAMESPACE
+QT_REQUIRE_CONFIG(fontdialog);
+QT_BEGIN_NAMESPACE
class QFontDialogPrivate;
@@ -120,6 +119,4 @@ Q_DECLARE_OPERATORS_FOR_FLAGS(QFontDialog::FontDialogOptions)
QT_END_NAMESPACE
-#endif // QT_NO_FONTDIALOG
-
#endif // QFONTDIALOG_H
diff --git a/src/widgets/dialogs/qfontdialog_p.h b/src/widgets/dialogs/qfontdialog_p.h
index 033f5a2be8..ae923d94ed 100644
--- a/src/widgets/dialogs/qfontdialog_p.h
+++ b/src/widgets/dialogs/qfontdialog_p.h
@@ -59,7 +59,7 @@
#include <qpa/qplatformdialoghelper.h>
#include "qsharedpointer.h"
-#ifndef QT_NO_FONTDIALOG
+QT_REQUIRE_CONFIG(fontdialog);
QT_BEGIN_NAMESPACE
@@ -149,8 +149,6 @@ private:
virtual void helperPrepareShow(QPlatformDialogHelper *) Q_DECL_OVERRIDE;
};
-#endif // QT_NO_FONTDIALOG
-
QT_END_NAMESPACE
#endif // QFONTDIALOG_P_H
diff --git a/src/widgets/dialogs/qwizard.cpp b/src/widgets/dialogs/qwizard.cpp
index 7bb72a00b7..431447734d 100644
--- a/src/widgets/dialogs/qwizard.cpp
+++ b/src/widgets/dialogs/qwizard.cpp
@@ -450,7 +450,7 @@ public:
}
QSize minimumSizeHint() const Q_DECL_OVERRIDE {
- if (!pixmap() && !pixmap()->isNull())
+ if (pixmap() && !pixmap()->isNull())
return pixmap()->size();
return QFrame::minimumSizeHint();
}
diff --git a/src/widgets/effects/qgraphicseffect.cpp b/src/widgets/effects/qgraphicseffect.cpp
index 4d1d1e9896..028010d3dd 100644
--- a/src/widgets/effects/qgraphicseffect.cpp
+++ b/src/widgets/effects/qgraphicseffect.cpp
@@ -114,7 +114,6 @@
#include <QtCore/qdebug.h>
#include <private/qdrawhelper_p.h>
-#ifndef QT_NO_GRAPHICSEFFECT
QT_BEGIN_NAMESPACE
QGraphicsEffectPrivate::~QGraphicsEffectPrivate()
@@ -1237,5 +1236,3 @@ QT_END_NAMESPACE
#include "moc_qgraphicseffect.cpp"
#include "moc_qgraphicseffect_p.cpp"
-
-#endif //QT_NO_GRAPHICSEFFECT
diff --git a/src/widgets/effects/qgraphicseffect.h b/src/widgets/effects/qgraphicseffect.h
index 8e07e51dca..78d025ded5 100644
--- a/src/widgets/effects/qgraphicseffect.h
+++ b/src/widgets/effects/qgraphicseffect.h
@@ -47,9 +47,9 @@
#include <QtGui/qcolor.h>
#include <QtGui/qbrush.h>
-#ifndef QT_NO_GRAPHICSEFFECT
-QT_BEGIN_NAMESPACE
+QT_REQUIRE_CONFIG(graphicseffect);
+QT_BEGIN_NAMESPACE
class QGraphicsItem;
class QStyleOption;
@@ -279,7 +279,5 @@ private:
QT_END_NAMESPACE
-#endif //QT_NO_GRAPHICSEFFECT
-
#endif // QGRAPHICSEFFECT_H
diff --git a/src/widgets/effects/qgraphicseffect_p.h b/src/widgets/effects/qgraphicseffect_p.h
index 12bdbfe6fc..c5c7ff5900 100644
--- a/src/widgets/effects/qgraphicseffect_p.h
+++ b/src/widgets/effects/qgraphicseffect_p.h
@@ -59,7 +59,8 @@
#include <private/qobject_p.h>
#include <private/qpixmapfilter_p.h>
-#ifndef QT_NO_GRAPHICSEFFECT
+QT_REQUIRE_CONFIG(graphicseffect);
+
QT_BEGIN_NAMESPACE
class QGraphicsEffectSourcePrivate;
@@ -226,6 +227,4 @@ public:
QT_END_NAMESPACE
-#endif //QT_NO_GRAPHICSEFFECT
#endif // QGRAPHICSEFFECT_P_H
-
diff --git a/src/widgets/effects/qpixmapfilter.cpp b/src/widgets/effects/qpixmapfilter.cpp
index 999e551af4..9d70825b0e 100644
--- a/src/widgets/effects/qpixmapfilter.cpp
+++ b/src/widgets/effects/qpixmapfilter.cpp
@@ -54,7 +54,6 @@
#include "private/qmemrotate_p.h"
#include "private/qdrawhelper_p.h"
-#ifndef QT_NO_GRAPHICSEFFECT
QT_BEGIN_NAMESPACE
class QPixmapFilterPrivate : public QObjectPrivate
@@ -1353,5 +1352,3 @@ void QPixmapDropShadowFilter::draw(QPainter *p,
QT_END_NAMESPACE
#include "moc_qpixmapfilter_p.cpp"
-
-#endif //QT_NO_GRAPHICSEFFECT
diff --git a/src/widgets/effects/qpixmapfilter_p.h b/src/widgets/effects/qpixmapfilter_p.h
index b9af3ae916..399a835142 100644
--- a/src/widgets/effects/qpixmapfilter_p.h
+++ b/src/widgets/effects/qpixmapfilter_p.h
@@ -56,9 +56,9 @@
#include <QtGui/qpixmap.h>
#include <QtWidgets/qgraphicseffect.h>
-#ifndef QT_NO_GRAPHICSEFFECT
-QT_BEGIN_NAMESPACE
+QT_REQUIRE_CONFIG(graphicseffect);
+QT_BEGIN_NAMESPACE
class QPainter;
class QPlatformPixmap;
@@ -187,5 +187,4 @@ public:
QT_END_NAMESPACE
-#endif //QT_NO_GRAPHICSEFFECT
#endif // QPIXMAPFILTER_H
diff --git a/src/widgets/graphicsview/qgraphicsitem.cpp b/src/widgets/graphicsview/qgraphicsitem.cpp
index 3ce9c835db..239a110119 100644
--- a/src/widgets/graphicsview/qgraphicsitem.cpp
+++ b/src/widgets/graphicsview/qgraphicsitem.cpp
@@ -756,7 +756,9 @@
#include <QtWidgets/qstyleoption.h>
#include <QtGui/qevent.h>
#include <QtGui/qinputmethod.h>
+#if QT_CONFIG(graphicseffect)
#include <QtWidgets/qgraphicseffect.h>
+#endif
#include <private/qgraphicsitem_p.h>
#include <private/qgraphicswidget_p.h>
@@ -1558,9 +1560,9 @@ QGraphicsItem::~QGraphicsItem()
setParentItem(0);
}
-#ifndef QT_NO_GRAPHICSEFFECT
+#if QT_CONFIG(graphicseffect)
delete d_ptr->graphicsEffect;
-#endif //QT_NO_GRAPHICSEFFECT
+#endif // QT_CONFIG(graphicseffect)
if (d_ptr->transformData) {
for(int i = 0; i < d_ptr->transformData->graphicsTransforms.size(); ++i) {
QGraphicsTransform *t = d_ptr->transformData->graphicsTransforms.at(i);
@@ -2383,9 +2385,9 @@ void QGraphicsItemPrivate::setVisibleHelper(bool newVisible, bool explicitly,
if (c)
c->purge();
if (scene) {
-#ifndef QT_NO_GRAPHICSEFFECT
+#if QT_CONFIG(graphicseffect)
invalidateParentGraphicsEffectsRecursively();
-#endif //QT_NO_GRAPHICSEFFECT
+#endif // QT_CONFIG(graphicseffect)
scene->d_func()->markDirty(q_ptr, QRectF(), /*invalidateChildren=*/false, /*force=*/true);
}
}
@@ -2832,11 +2834,11 @@ void QGraphicsItem::setOpacity(qreal opacity)
// Update.
if (d_ptr->scene) {
-#ifndef QT_NO_GRAPHICSEFFECT
+#if QT_CONFIG(graphicseffect)
d_ptr->invalidateParentGraphicsEffectsRecursively();
if (!(d_ptr->flags & ItemDoesntPropagateOpacityToChildren))
d_ptr->invalidateChildGraphicsEffectsRecursively(QGraphicsItemPrivate::OpacityChanged);
-#endif //QT_NO_GRAPHICSEFFECT
+#endif // QT_CONFIG(graphicseffect)
d_ptr->scene->d_func()->markDirty(this, QRectF(),
/*invalidateChildren=*/true,
/*force=*/false,
@@ -2854,7 +2856,7 @@ void QGraphicsItem::setOpacity(qreal opacity)
\since 4.6
*/
-#ifndef QT_NO_GRAPHICSEFFECT
+#if QT_CONFIG(graphicseffect)
QGraphicsEffect *QGraphicsItem::graphicsEffect() const
{
return d_ptr->graphicsEffect;
@@ -2896,11 +2898,11 @@ void QGraphicsItem::setGraphicsEffect(QGraphicsEffect *effect)
prepareGeometryChange();
}
}
-#endif //QT_NO_GRAPHICSEFFECT
+#endif // QT_CONFIG(graphicseffect)
void QGraphicsItemPrivate::updateChildWithGraphicsEffectFlagRecursively()
{
-#ifndef QT_NO_GRAPHICSEFFECT
+#if QT_CONFIG(graphicseffect)
QGraphicsItemPrivate *itemPrivate = this;
do {
// parent chain already notified?
@@ -2923,7 +2925,7 @@ void QGraphicsItemPrivate::updateChildWithGraphicsEffectFlagRecursively()
*/
QRectF QGraphicsItemPrivate::effectiveBoundingRect(const QRectF &rect) const
{
-#ifndef QT_NO_GRAPHICSEFFECT
+#if QT_CONFIG(graphicseffect)
Q_Q(const QGraphicsItem);
QGraphicsEffect *effect = graphicsEffect;
if (scene && effect && effect->isEnabled()) {
@@ -2939,7 +2941,7 @@ QRectF QGraphicsItemPrivate::effectiveBoundingRect(const QRectF &rect) const
}
return q->mapRectFromScene(sceneEffectRect);
}
-#endif //QT_NO_GRAPHICSEFFECT
+#endif // QT_CONFIG(graphicseffect)
return rect;
}
@@ -2955,7 +2957,7 @@ QRectF QGraphicsItemPrivate::effectiveBoundingRect(const QRectF &rect) const
*/
QRectF QGraphicsItemPrivate::effectiveBoundingRect(QGraphicsItem *topMostEffectItem) const
{
-#ifndef QT_NO_GRAPHICSEFFECT
+#if QT_CONFIG(graphicseffect)
Q_Q(const QGraphicsItem);
QRectF brect = effectiveBoundingRect(q_ptr->boundingRect());
if (ancestorFlags & QGraphicsItemPrivate::AncestorClipsChildren
@@ -2980,10 +2982,10 @@ QRectF QGraphicsItemPrivate::effectiveBoundingRect(QGraphicsItem *topMostEffectI
}
return brect;
-#else //QT_NO_GRAPHICSEFFECT
+#else //QT_CONFIG(graphicseffect)
Q_UNUSED(topMostEffectItem);
return q_ptr->boundingRect();
-#endif //QT_NO_GRAPHICSEFFECT
+#endif // QT_CONFIG(graphicseffect)
}
@@ -5485,7 +5487,7 @@ int QGraphicsItemPrivate::depth() const
/*!
\internal
*/
-#ifndef QT_NO_GRAPHICSEFFECT
+#if QT_CONFIG(graphicseffect)
void QGraphicsItemPrivate::invalidateParentGraphicsEffectsRecursively()
{
QGraphicsItemPrivate *itemPrivate = this;
@@ -5516,7 +5518,7 @@ void QGraphicsItemPrivate::invalidateChildGraphicsEffectsRecursively(QGraphicsIt
childPrivate->invalidateChildGraphicsEffectsRecursively(reason);
}
}
-#endif //QT_NO_GRAPHICSEFFECT
+#endif // QT_CONFIG(graphicseffect)
/*!
\internal
@@ -5798,9 +5800,9 @@ void QGraphicsItem::update(const QRectF &rect)
return;
// Make sure we notify effects about invalidated source.
-#ifndef QT_NO_GRAPHICSEFFECT
+#if QT_CONFIG(graphicseffect)
d_ptr->invalidateParentGraphicsEffectsRecursively();
-#endif //QT_NO_GRAPHICSEFFECT
+#endif // QT_CONFIG(graphicseffect)
if (CacheMode(d_ptr->cacheMode) != NoCache) {
// Invalidate cache.
@@ -11225,7 +11227,7 @@ int QGraphicsItemGroup::type() const
return Type;
}
-#ifndef QT_NO_GRAPHICSEFFECT
+#if QT_CONFIG(graphicseffect)
QRectF QGraphicsItemEffectSourcePrivate::boundingRect(Qt::CoordinateSystem system) const
{
const bool deviceCoordinates = (system == Qt::DeviceCoordinates);
@@ -11366,7 +11368,7 @@ QPixmap QGraphicsItemEffectSourcePrivate::pixmap(Qt::CoordinateSystem system, QP
return pixmap;
}
-#endif //QT_NO_GRAPHICSEFFECT
+#endif // QT_CONFIG(graphicseffect)
#ifndef QT_NO_DEBUG_STREAM
static void formatGraphicsItemHelper(QDebug debug, const QGraphicsItem *item)
diff --git a/src/widgets/graphicsview/qgraphicsitem.h b/src/widgets/graphicsview/qgraphicsitem.h
index 36f8aac124..35e3d544e9 100644
--- a/src/widgets/graphicsview/qgraphicsitem.h
+++ b/src/widgets/graphicsview/qgraphicsitem.h
@@ -228,11 +228,11 @@ public:
qreal effectiveOpacity() const;
void setOpacity(qreal opacity);
-#ifndef QT_NO_GRAPHICSEFFECT
+#if QT_CONFIG(graphicseffect)
// Effect
QGraphicsEffect *graphicsEffect() const;
void setGraphicsEffect(QGraphicsEffect *effect);
-#endif //QT_NO_GRAPHICSEFFECT
+#endif // QT_CONFIG(graphicseffect)
Qt::MouseButtons acceptedMouseButtons() const;
void setAcceptedMouseButtons(Qt::MouseButtons buttons);
@@ -550,7 +550,7 @@ class Q_WIDGETS_EXPORT QGraphicsObject : public QObject, public QGraphicsItem
Q_PROPERTY(qreal rotation READ rotation WRITE setRotation NOTIFY rotationChanged)
Q_PROPERTY(qreal scale READ scale WRITE setScale NOTIFY scaleChanged)
Q_PROPERTY(QPointF transformOriginPoint READ transformOriginPoint WRITE setTransformOriginPoint)
-#ifndef QT_NO_GRAPHICSEFFECT
+#if QT_CONFIG(graphicseffect)
Q_PROPERTY(QGraphicsEffect *effect READ graphicsEffect WRITE setGraphicsEffect)
#endif
Q_PRIVATE_PROPERTY(QGraphicsItem::d_func(), QDeclarativeListProperty<QGraphicsObject> children READ childrenList DESIGNABLE false NOTIFY childrenChanged)
diff --git a/src/widgets/graphicsview/qgraphicsitem_p.h b/src/widgets/graphicsview/qgraphicsitem_p.h
index c88236d6e8..5c4523f9ed 100644
--- a/src/widgets/graphicsview/qgraphicsitem_p.h
+++ b/src/widgets/graphicsview/qgraphicsitem_p.h
@@ -59,9 +59,6 @@
#include "qgraphicstransform.h"
#include <private/qgraphicstransform_p.h>
-#include <private/qgraphicseffect_p.h>
-#include <qgraphicseffect.h>
-
#include <QtCore/qpoint.h>
#if !defined(QT_NO_GRAPHICSVIEW)
@@ -217,13 +214,13 @@ public:
bool ignoreDirtyBit = false, bool ignoreOpacity = false) const;
virtual void transformChanged() {}
int depth() const;
-#ifndef QT_NO_GRAPHICSEFFECT
+#if QT_CONFIG(graphicseffect)
enum InvalidateReason {
OpacityChanged
};
void invalidateParentGraphicsEffectsRecursively();
void invalidateChildGraphicsEffectsRecursively(InvalidateReason reason);
-#endif //QT_NO_GRAPHICSEFFECT
+#endif // QT_CONFIG(graphicseffect)
void invalidateDepthRecursively();
void resolveDepth();
void addChild(QGraphicsItem *child);
@@ -590,7 +587,7 @@ struct QGraphicsItemPaintInfo
quint32 drawItem : 1;
};
-#ifndef QT_NO_GRAPHICSEFFECT
+#if QT_CONFIG(graphicseffect)
class QGraphicsItemEffectSourcePrivate : public QGraphicsEffectSourcePrivate
{
public:
@@ -650,7 +647,7 @@ public:
QGraphicsItemPaintInfo *info;
QTransform lastEffectTransform;
};
-#endif //QT_NO_GRAPHICSEFFECT
+#endif // QT_CONFIG(graphicseffect)
/*!
Returns \c true if \a item1 is on top of \a item2.
@@ -784,7 +781,7 @@ inline bool QGraphicsItemPrivate::insertionOrder(QGraphicsItem *a, QGraphicsItem
inline void QGraphicsItemPrivate::markParentDirty(bool updateBoundingRect)
{
QGraphicsItemPrivate *parentp = this;
-#ifndef QT_NO_GRAPHICSEFFECT
+#if QT_CONFIG(graphicseffect)
if (updateBoundingRect && parentp->graphicsEffect && !parentp->inSetPosHelper) {
parentp->notifyInvalidated = 1;
static_cast<QGraphicsItemEffectSourcePrivate *>(parentp->graphicsEffect->d_func()
@@ -800,7 +797,7 @@ inline void QGraphicsItemPrivate::markParentDirty(bool updateBoundingRect)
// ### Only do this if the parent's effect applies to the entire subtree.
parentp->notifyBoundingRectChanged = 1;
}
-#ifndef QT_NO_GRAPHICSEFFECT
+#if QT_CONFIG(graphicseffect)
if (parentp->graphicsEffect) {
if (updateBoundingRect) {
static_cast<QGraphicsItemEffectSourcePrivate *>(parentp->graphicsEffect->d_func()
diff --git a/src/widgets/graphicsview/qgraphicsscene.cpp b/src/widgets/graphicsview/qgraphicsscene.cpp
index 35f6298a8a..db41fc3eb9 100644
--- a/src/widgets/graphicsview/qgraphicsscene.cpp
+++ b/src/widgets/graphicsview/qgraphicsscene.cpp
@@ -243,10 +243,11 @@
#include <QtWidgets/qtooltip.h>
#include <QtGui/qtransform.h>
#include <QtGui/qinputmethod.h>
-#include <QtWidgets/qgraphicseffect.h>
#include <private/qapplication_p.h>
#include <private/qobject_p.h>
+#if QT_CONFIG(graphicseffect)
#include <private/qgraphicseffect_p.h>
+#endif
#include <private/qgesturemanager_p.h>
#include <private/qpathclipper_p.h>
@@ -4810,7 +4811,7 @@ void QGraphicsScenePrivate::drawSubtreeRecursive(QGraphicsItem *item, QPainter *
if (itemHasChildren && itemClipsChildrenToShape)
ENSURE_TRANSFORM_PTR;
-#ifndef QT_NO_GRAPHICSEFFECT
+#if QT_CONFIG(graphicseffect)
if (item->d_ptr->graphicsEffect && item->d_ptr->graphicsEffect->isEnabled()) {
ENSURE_TRANSFORM_PTR;
QGraphicsItemPaintInfo info(viewTransform, transformPtr, effectTransform, exposedRegion, widget, &styleOptionTmp,
@@ -4847,7 +4848,7 @@ void QGraphicsScenePrivate::drawSubtreeRecursive(QGraphicsItem *item, QPainter *
painter->setWorldTransform(restoreTransform);
sourced->info = 0;
} else
-#endif //QT_NO_GRAPHICSEFFECT
+#endif // QT_CONFIG(graphicseffect)
{
draw(item, painter, viewTransform, transformPtr, exposedRegion, widget, opacity,
effectTransform, wasDirtyParentSceneTransform, drawItem);
diff --git a/src/widgets/graphicsview/qgraphicsscene_p.h b/src/widgets/graphicsview/qgraphicsscene_p.h
index 795676878b..c52770501f 100644
--- a/src/widgets/graphicsview/qgraphicsscene_p.h
+++ b/src/widgets/graphicsview/qgraphicsscene_p.h
@@ -249,7 +249,7 @@ public:
item->d_ptr->fullUpdatePending = 0;
item->d_ptr->ignoreVisible = 0;
item->d_ptr->ignoreOpacity = 0;
-#ifndef QT_NO_GRAPHICSEFFECT
+#if QT_CONFIG(graphicseffect)
QGraphicsEffect::ChangeFlags flags;
if (item->d_ptr->notifyBoundingRectChanged) {
flags |= QGraphicsEffect::SourceBoundingRectChanged;
@@ -259,15 +259,15 @@ public:
flags |= QGraphicsEffect::SourceInvalidated;
item->d_ptr->notifyInvalidated = 0;
}
-#endif //QT_NO_GRAPHICSEFFECT
+#endif // QT_CONFIG(graphicseffect)
if (recursive) {
for (int i = 0; i < item->d_ptr->children.size(); ++i)
resetDirtyItem(item->d_ptr->children.at(i), recursive);
}
-#ifndef QT_NO_GRAPHICSEFFECT
+#if QT_CONFIG(graphicseffect)
if (flags && item->d_ptr->graphicsEffect)
item->d_ptr->graphicsEffect->sourceChanged(flags);
-#endif //QT_NO_GRAPHICSEFFECT
+#endif // QT_CONFIG(graphicseffect)
}
inline void ensureSortedTopLevelItems()
diff --git a/src/widgets/graphicsview/qgraphicsview.cpp b/src/widgets/graphicsview/qgraphicsview.cpp
index f5f24649c2..a00156ef01 100644
--- a/src/widgets/graphicsview/qgraphicsview.cpp
+++ b/src/widgets/graphicsview/qgraphicsview.cpp
@@ -353,7 +353,7 @@ QGraphicsViewPrivate::QGraphicsViewPrivate()
viewportUpdateMode(QGraphicsView::MinimalViewportUpdate),
optimizationFlags(0),
scene(0),
-#ifndef QT_NO_RUBBERBAND
+#if QT_CONFIG(rubberband)
rubberBanding(false),
rubberBandSelectionMode(Qt::IntersectsItemShape),
rubberBandSelectionOperation(Qt::ReplaceSelection),
@@ -633,7 +633,7 @@ void QGraphicsViewPrivate::mouseMoveEventHandler(QMouseEvent *event)
{
Q_Q(QGraphicsView);
-#ifndef QT_NO_RUBBERBAND
+#if QT_CONFIG(rubberband)
updateRubberBand(event);
#endif
@@ -708,7 +708,7 @@ void QGraphicsViewPrivate::mouseMoveEventHandler(QMouseEvent *event)
/*!
\internal
*/
-#ifndef QT_NO_RUBBERBAND
+#if QT_CONFIG(rubberband)
QRegion QGraphicsViewPrivate::rubberBandRegion(const QWidget *widget, const QRect &rect) const
{
QStyleHintReturnMask mask;
@@ -1508,7 +1508,7 @@ void QGraphicsView::setDragMode(DragMode mode)
#endif
}
-#ifndef QT_NO_RUBBERBAND
+#if QT_CONFIG(rubberband)
/*!
\property QGraphicsView::rubberBandSelectionMode
\brief the behavior for selecting items with a rubber band selection rectangle.
@@ -3274,7 +3274,7 @@ void QGraphicsView::mousePressEvent(QMouseEvent *event)
}
}
-#ifndef QT_NO_RUBBERBAND
+#if QT_CONFIG(rubberband)
if (d->dragMode == QGraphicsView::RubberBandDrag && !d->rubberBanding) {
if (d->sceneInteractionAllowed) {
// Rubberbanding is only allowed in interactive mode.
@@ -3336,7 +3336,7 @@ void QGraphicsView::mouseReleaseEvent(QMouseEvent *event)
{
Q_D(QGraphicsView);
-#ifndef QT_NO_RUBBERBAND
+#if QT_CONFIG(rubberband)
if (d->dragMode == QGraphicsView::RubberBandDrag && d->sceneInteractionAllowed && !event->buttons()) {
if (d->rubberBanding) {
if (d->viewportUpdateMode != QGraphicsView::NoViewportUpdate){
@@ -3459,7 +3459,7 @@ void QGraphicsView::paintEvent(QPaintEvent *event)
// Set up the painter
QPainter painter(viewport());
-#ifndef QT_NO_RUBBERBAND
+#if QT_CONFIG(rubberband)
if (d->rubberBanding && !d->rubberBandRect.isEmpty())
painter.save();
#endif
@@ -3583,7 +3583,7 @@ void QGraphicsView::paintEvent(QPaintEvent *event)
// Foreground
drawForeground(&painter, exposedSceneRect);
-#ifndef QT_NO_RUBBERBAND
+#if QT_CONFIG(rubberband)
// Rubberband
if (d->rubberBanding && !d->rubberBandRect.isEmpty()) {
painter.restore();
@@ -3651,7 +3651,7 @@ void QGraphicsView::scrollContentsBy(int dx, int dy)
if (d->viewportUpdateMode != QGraphicsView::NoViewportUpdate) {
if (d->viewportUpdateMode != QGraphicsView::FullViewportUpdate) {
if (d->accelerateScrolling) {
-#ifndef QT_NO_RUBBERBAND
+#if QT_CONFIG(rubberband)
// Update new and old rubberband regions
if (!d->rubberBandRect.isEmpty()) {
QRegion rubberBandRegion(d->rubberBandRegion(viewport(), d->rubberBandRect));
diff --git a/src/widgets/graphicsview/qgraphicsview.h b/src/widgets/graphicsview/qgraphicsview.h
index fb975b9d71..d70ce6cf1c 100644
--- a/src/widgets/graphicsview/qgraphicsview.h
+++ b/src/widgets/graphicsview/qgraphicsview.h
@@ -72,7 +72,7 @@ class Q_WIDGETS_EXPORT QGraphicsView : public QAbstractScrollArea
Q_PROPERTY(ViewportAnchor transformationAnchor READ transformationAnchor WRITE setTransformationAnchor)
Q_PROPERTY(ViewportAnchor resizeAnchor READ resizeAnchor WRITE setResizeAnchor)
Q_PROPERTY(ViewportUpdateMode viewportUpdateMode READ viewportUpdateMode WRITE setViewportUpdateMode)
-#ifndef QT_NO_RUBBERBAND
+#if QT_CONFIG(rubberband)
Q_PROPERTY(Qt::ItemSelectionMode rubberBandSelectionMode READ rubberBandSelectionMode WRITE setRubberBandSelectionMode)
#endif
Q_PROPERTY(OptimizationFlags optimizationFlags READ optimizationFlags WRITE setOptimizationFlags)
@@ -144,7 +144,7 @@ public:
DragMode dragMode() const;
void setDragMode(DragMode mode);
-#ifndef QT_NO_RUBBERBAND
+#if QT_CONFIG(rubberband)
Qt::ItemSelectionMode rubberBandSelectionMode() const;
void setRubberBandSelectionMode(Qt::ItemSelectionMode mode);
QRect rubberBandRect() const;
@@ -228,7 +228,7 @@ public Q_SLOTS:
void invalidateScene(const QRectF &rect = QRectF(), QGraphicsScene::SceneLayers layers = QGraphicsScene::AllLayers);
void updateSceneRect(const QRectF &rect);
-#ifndef QT_NO_RUBBERBAND
+#if QT_CONFIG(rubberband)
Q_SIGNALS:
void rubberBandChanged(QRect viewportRect, QPointF fromScenePoint, QPointF toScenePoint);
#endif
diff --git a/src/widgets/graphicsview/qgraphicsview_p.h b/src/widgets/graphicsview/qgraphicsview_p.h
index 10103a1809..b34be77f11 100644
--- a/src/widgets/graphicsview/qgraphicsview_p.h
+++ b/src/widgets/graphicsview/qgraphicsview_p.h
@@ -136,7 +136,7 @@ public:
QGraphicsView::OptimizationFlags optimizationFlags;
QPointer<QGraphicsScene> scene;
-#ifndef QT_NO_RUBBERBAND
+#if QT_CONFIG(rubberband)
QRect rubberBandRect;
QRegion rubberBandRegion(const QWidget *widget, const QRect &rect) const;
void updateRubberBand(const QMouseEvent *event);
diff --git a/src/widgets/itemviews/itemviews.pri b/src/widgets/itemviews/itemviews.pri
index af0a6f6898..4101be5631 100644
--- a/src/widgets/itemviews/itemviews.pri
+++ b/src/widgets/itemviews/itemviews.pri
@@ -9,8 +9,6 @@ HEADERS += \
itemviews/qlistview.h \
itemviews/qlistview_p.h \
itemviews/qbsptree_p.h \
- itemviews/qtableview.h \
- itemviews/qtableview_p.h \
itemviews/qtreeview.h \
itemviews/qtreeview_p.h \
itemviews/qabstractitemdelegate.h \
@@ -28,7 +26,6 @@ SOURCES += \
itemviews/qheaderview.cpp \
itemviews/qlistview.cpp \
itemviews/qbsptree.cpp \
- itemviews/qtableview.cpp \
itemviews/qtreeview.cpp \
itemviews/qabstractitemdelegate.cpp \
itemviews/qitemdelegate.cpp \
@@ -57,6 +54,14 @@ qtConfig(listwidget) {
SOURCES += itemviews/qlistwidget.cpp
}
+qtConfig(tableview) {
+ HEADERS += \
+ itemviews/qtableview.h \
+ itemviews/qtableview_p.h
+
+ SOURCES += itemviews/qtableview.cpp
+}
+
qtConfig(tablewidget) {
HEADERS += \
itemviews/qtablewidget.h \
diff --git a/src/widgets/itemviews/qabstractitemview.cpp b/src/widgets/itemviews/qabstractitemview.cpp
index b225678e0b..2ae885615f 100644
--- a/src/widgets/itemviews/qabstractitemview.cpp
+++ b/src/widgets/itemviews/qabstractitemview.cpp
@@ -53,7 +53,6 @@
#include <qlineedit.h>
#include <qspinbox.h>
#include <qtreeview.h>
-#include <qtableview.h>
#include <qheaderview.h>
#include <qstyleditemdelegate.h>
#include <private/qabstractitemview_p.h>
diff --git a/src/widgets/itemviews/qitemeditorfactory.cpp b/src/widgets/itemviews/qitemeditorfactory.cpp
index c535cf5f9e..a31689e0b5 100644
--- a/src/widgets/itemviews/qitemeditorfactory.cpp
+++ b/src/widgets/itemviews/qitemeditorfactory.cpp
@@ -44,7 +44,9 @@
#ifndef QT_NO_ITEMVIEWS
#include <qcombobox.h>
+#if QT_CONFIG(datetimeedit)
#include <qdatetimeedit.h>
+#endif
#if QT_CONFIG(label)
#include <qlabel.h>
#endif
@@ -252,7 +254,7 @@ QWidget *QDefaultItemEditorFactory::createEditor(int userType, QWidget *parent)
sb->setMaximum(INT_MAX);
return sb; }
#endif
-#ifndef QT_NO_DATETIMEEDIT
+#if QT_CONFIG(datetimeedit)
case QVariant::Date: {
QDateTimeEdit *ed = new QDateEdit(parent);
ed->setFrame(false);
@@ -308,7 +310,7 @@ QByteArray QDefaultItemEditorFactory::valuePropertyName(int userType) const
case QVariant::Double:
return "value";
#endif
-#ifndef QT_NO_DATETIMEEDIT
+#if QT_CONFIG(datetimeedit)
case QVariant::Date:
return "date";
case QVariant::Time:
diff --git a/src/widgets/itemviews/qlistview.cpp b/src/widgets/itemviews/qlistview.cpp
index bc0ca7dc1c..e234bae4dd 100644
--- a/src/widgets/itemviews/qlistview.cpp
+++ b/src/widgets/itemviews/qlistview.cpp
@@ -50,7 +50,9 @@
#include <qstyle.h>
#include <qevent.h>
#include <qscrollbar.h>
+#if QT_CONFIG(rubberband)
#include <qrubberband.h>
+#endif
#include <private/qlistview_p.h>
#include <private/qscrollbar_p.h>
#include <qdebug.h>
@@ -1042,7 +1044,7 @@ void QListView::paintEvent(QPaintEvent *e)
d->commonListView->paintDragDrop(&painter);
#endif
-#ifndef QT_NO_RUBBERBAND
+#if QT_CONFIG(rubberband)
// #### move this implementation into a dynamic class
if (d->showElasticBand && d->elasticBand.isValid()) {
QStyleOptionRubberBand opt;
@@ -1870,6 +1872,11 @@ void QCommonListViewBase::paintDragDrop(QPainter *painter)
}
#endif
+QSize QListModeViewBase::viewportSize(const QAbstractItemView *v)
+{
+ return v->contentsRect().marginsRemoved(v->viewportMargins()).size();
+}
+
void QCommonListViewBase::updateHorizontalScrollBar(const QSize &step)
{
horizontalScrollBar()->d_func()->itemviewChangeSingleStep(step.width() + spacing());
@@ -1882,7 +1889,7 @@ void QCommonListViewBase::updateHorizontalScrollBar(const QSize &step)
const bool bothScrollBarsAuto = qq->verticalScrollBarPolicy() == Qt::ScrollBarAsNeeded &&
qq->horizontalScrollBarPolicy() == Qt::ScrollBarAsNeeded;
- const QSize viewportSize = qq->contentsRect().size();
+ const QSize viewportSize = QListModeViewBase::viewportSize(qq);
bool verticalWantsToShow = contentsSize.height() > viewportSize.height();
bool horizontalWantsToShow;
@@ -1912,7 +1919,7 @@ void QCommonListViewBase::updateVerticalScrollBar(const QSize &step)
const bool bothScrollBarsAuto = qq->verticalScrollBarPolicy() == Qt::ScrollBarAsNeeded &&
qq->horizontalScrollBarPolicy() == Qt::ScrollBarAsNeeded;
- const QSize viewportSize = qq->contentsRect().size();
+ const QSize viewportSize = QListModeViewBase::viewportSize(qq);
bool horizontalWantsToShow = contentsSize.width() > viewportSize.width();
bool verticalWantsToShow;
diff --git a/src/widgets/itemviews/qlistview_p.h b/src/widgets/itemviews/qlistview_p.h
index 47effcdfd9..6c0e470a93 100644
--- a/src/widgets/itemviews/qlistview_p.h
+++ b/src/widgets/itemviews/qlistview_p.h
@@ -53,7 +53,6 @@
#include <QtWidgets/private/qtwidgetsglobal_p.h>
#include "private/qabstractitemview_p.h"
-#include "qrubberband.h"
#include "qbitarray.h"
#include "qbsptree_p.h"
#include <limits.h>
@@ -225,6 +224,7 @@ public:
QRect mapToViewport(const QRect &rect) const override;
int horizontalOffset() const override;
int verticalOffset() const override;
+ inline static QSize viewportSize(const QAbstractItemView *v);
void updateHorizontalScrollBar(const QSize &step) override;
void updateVerticalScrollBar(const QSize &step) override;
diff --git a/src/widgets/itemviews/qstyleditemdelegate.cpp b/src/widgets/itemviews/qstyleditemdelegate.cpp
index 4149d3ac3a..0b8019c21c 100644
--- a/src/widgets/itemviews/qstyleditemdelegate.cpp
+++ b/src/widgets/itemviews/qstyleditemdelegate.cpp
@@ -67,7 +67,9 @@
#include <private/qlayoutengine_p.h>
#include <qdebug.h>
#include <qlocale.h>
+#if QT_CONFIG(tableview)
#include <qtableview.h>
+#endif
#include <limits.h>
@@ -500,7 +502,7 @@ void QStyledItemDelegate::updateEditorGeometry(QWidget *editor,
// let the editor take up all available space
//if the editor is not a QLineEdit
//or it is in a QTableView
-#if !defined(QT_NO_TABLEVIEW) && !defined(QT_NO_LINEEDIT)
+#if QT_CONFIG(tableview) && !defined(QT_NO_LINEEDIT)
if (qobject_cast<QExpandingLineEdit*>(editor) && !qobject_cast<const QTableView*>(widget))
opt.showDecorationSelected = editor->style()->styleHint(QStyle::SH_ItemView_ShowDecorationSelected, 0, editor);
else
diff --git a/src/widgets/itemviews/qtableview.cpp b/src/widgets/itemviews/qtableview.cpp
index b79932327b..2d5813198c 100644
--- a/src/widgets/itemviews/qtableview.cpp
+++ b/src/widgets/itemviews/qtableview.cpp
@@ -39,7 +39,6 @@
#include "qtableview.h"
-#ifndef QT_NO_TABLEVIEW
#include <qheaderview.h>
#include <qitemdelegate.h>
#include <qapplication.h>
@@ -3352,5 +3351,3 @@ QT_END_NAMESPACE
#include "qtableview.moc"
#include "moc_qtableview.cpp"
-
-#endif // QT_NO_TABLEVIEW
diff --git a/src/widgets/itemviews/qtableview.h b/src/widgets/itemviews/qtableview.h
index b1c38d521f..75f2e7b44c 100644
--- a/src/widgets/itemviews/qtableview.h
+++ b/src/widgets/itemviews/qtableview.h
@@ -43,10 +43,9 @@
#include <QtWidgets/qtwidgetsglobal.h>
#include <QtWidgets/qabstractitemview.h>
-QT_BEGIN_NAMESPACE
-
+QT_REQUIRE_CONFIG(tableview);
-#ifndef QT_NO_TABLEVIEW
+QT_BEGIN_NAMESPACE
class QHeaderView;
class QTableViewPrivate;
@@ -191,8 +190,6 @@ private:
Q_PRIVATE_SLOT(d_func(), void _q_updateSpanRemovedColumns(QModelIndex,int,int))
};
-#endif // QT_NO_TABLEVIEW
-
QT_END_NAMESPACE
#endif // QTABLEVIEW_H
diff --git a/src/widgets/itemviews/qtableview_p.h b/src/widgets/itemviews/qtableview_p.h
index d2f45d557d..1a0fef9017 100644
--- a/src/widgets/itemviews/qtableview_p.h
+++ b/src/widgets/itemviews/qtableview_p.h
@@ -59,7 +59,7 @@
#include <QtCore/QDebug>
#include "private/qabstractitemview_p.h"
-#ifndef QT_NO_TABLEVIEW
+QT_REQUIRE_CONFIG(tableview);
QT_BEGIN_NAMESPACE
@@ -261,6 +261,4 @@ public:
QT_END_NAMESPACE
-#endif // QT_NO_TABLEVIEW
-
#endif // QTABLEVIEW_P_H
diff --git a/src/widgets/kernel/qapplication.cpp b/src/widgets/kernel/qapplication.cpp
index 0286a11612..09162b9ab4 100644
--- a/src/widgets/kernel/qapplication.cpp
+++ b/src/widgets/kernel/qapplication.cpp
@@ -51,6 +51,7 @@
#include "qhash.h"
#include "qset.h"
#include "qlayout.h"
+#include "qpixmapcache.h"
#include "qstyle.h"
#include "qstyleoption.h"
#include "qstylefactory.h"
diff --git a/src/widgets/kernel/qwidget.cpp b/src/widgets/kernel/qwidget.cpp
index 37f87c60dc..a8f5b39638 100644
--- a/src/widgets/kernel/qwidget.cpp
+++ b/src/widgets/kernel/qwidget.cpp
@@ -83,7 +83,9 @@
#include <QtGui/private/qopenglcontext_p.h>
#include <QtGui/qoffscreensurface.h>
+#if QT_CONFIG(graphicseffect)
#include <private/qgraphicseffect_p.h>
+#endif
#include <qbackingstore.h>
#include <private/qwidgetbackingstore_p.h>
#if 0 // Used to be included in Qt4 for Q_WS_MAC
@@ -2115,7 +2117,7 @@ void QWidgetPrivate::setSystemClip(QPaintEngine *paintEngine, qreal devicePixelR
}
-#ifndef QT_NO_GRAPHICSEFFECT
+#if QT_CONFIG(graphicseffect)
void QWidgetPrivate::invalidateGraphicsEffectsRecursively()
{
Q_Q(QWidget);
@@ -2130,7 +2132,7 @@ void QWidgetPrivate::invalidateGraphicsEffectsRecursively()
w = w->parentWidget();
} while (w);
}
-#endif //QT_NO_GRAPHICSEFFECT
+#endif // QT_CONFIG(graphicseffect)
void QWidgetPrivate::setDirtyOpaqueRegion()
{
@@ -2138,9 +2140,9 @@ void QWidgetPrivate::setDirtyOpaqueRegion()
dirtyOpaqueChildren = true;
-#ifndef QT_NO_GRAPHICSEFFECT
+#if QT_CONFIG(graphicseffect)
invalidateGraphicsEffectsRecursively();
-#endif //QT_NO_GRAPHICSEFFECT
+#endif // QT_CONFIG(graphicseffect)
if (q->isWindow())
return;
@@ -2294,12 +2296,12 @@ void QWidgetPrivate::clipToEffectiveMask(QRegion &region) const
const QWidget *w = q;
QPoint offset;
-#ifndef QT_NO_GRAPHICSEFFECT
+#if QT_CONFIG(graphicseffect)
if (graphicsEffect) {
w = q->parentWidget();
offset -= data.crect.topLeft();
}
-#endif //QT_NO_GRAPHICSEFFECT
+#endif // QT_CONFIG(graphicseffect)
while (w) {
const QWidgetPrivate *wd = w->d_func();
@@ -2332,13 +2334,13 @@ void QWidgetPrivate::updateIsOpaque()
// hw: todo: only needed if opacity actually changed
setDirtyOpaqueRegion();
-#ifndef QT_NO_GRAPHICSEFFECT
+#if QT_CONFIG(graphicseffect)
if (graphicsEffect) {
// ### We should probably add QGraphicsEffect::isOpaque at some point.
setOpaque(false);
return;
}
-#endif //QT_NO_GRAPHICSEFFECT
+#endif // QT_CONFIG(graphicseffect)
Q_Q(QWidget);
#if 0 // Used to be included in Qt4 for Q_WS_X11
@@ -5282,13 +5284,13 @@ QPixmap QWidget::grab(const QRect &rectangle)
\sa setGraphicsEffect()
*/
-#ifndef QT_NO_GRAPHICSEFFECT
+#if QT_CONFIG(graphicseffect)
QGraphicsEffect *QWidget::graphicsEffect() const
{
Q_D(const QWidget);
return d->graphicsEffect;
}
-#endif //QT_NO_GRAPHICSEFFECT
+#endif // QT_CONFIG(graphicseffect)
/*!
@@ -5312,7 +5314,7 @@ QGraphicsEffect *QWidget::graphicsEffect() const
\sa graphicsEffect()
*/
-#ifndef QT_NO_GRAPHICSEFFECT
+#if QT_CONFIG(graphicseffect)
void QWidget::setGraphicsEffect(QGraphicsEffect *effect)
{
Q_D(QWidget);
@@ -5336,7 +5338,7 @@ void QWidget::setGraphicsEffect(QGraphicsEffect *effect)
d->updateIsOpaque();
}
-#endif //QT_NO_GRAPHICSEFFECT
+#endif // QT_CONFIG(graphicseffect)
bool QWidgetPrivate::isAboutToShow() const
{
@@ -5488,7 +5490,7 @@ void QWidgetPrivate::drawWidget(QPaintDevice *pdev, const QRegion &rgn, const QP
bool onScreen = paintOnScreen();
Q_Q(QWidget);
-#ifndef QT_NO_GRAPHICSEFFECT
+#if QT_CONFIG(graphicseffect)
if (graphicsEffect && graphicsEffect->isEnabled()) {
QGraphicsEffectSource *source = graphicsEffect->d_func()->source;
QWidgetEffectSourcePrivate *sourced = static_cast<QWidgetEffectSourcePrivate *>
@@ -5526,7 +5528,7 @@ void QWidgetPrivate::drawWidget(QPaintDevice *pdev, const QRegion &rgn, const QP
return;
}
}
-#endif //QT_NO_GRAPHICSEFFECT
+#endif // QT_CONFIG(graphicseffect)
const bool alsoOnScreen = flags & DrawPaintOnScreen;
const bool recursive = flags & DrawRecursive;
@@ -5833,7 +5835,7 @@ void QWidgetPrivate::paintSiblingsRecursive(QPaintDevice *pdev, const QObjectLis
}
}
-#ifndef QT_NO_GRAPHICSEFFECT
+#if QT_CONFIG(graphicseffect)
QRectF QWidgetEffectSourcePrivate::boundingRect(Qt::CoordinateSystem system) const
{
if (system != Qt::DeviceCoordinates)
@@ -5908,7 +5910,7 @@ QPixmap QWidgetEffectSourcePrivate::pixmap(Qt::CoordinateSystem system, QPoint *
m_widget->render(&pixmap, pixmapOffset, QRegion(), QWidget::DrawChildren);
return pixmap;
}
-#endif //QT_NO_GRAPHICSEFFECT
+#endif // QT_CONFIG(graphicseffect)
#ifndef QT_NO_GRAPHICSVIEW
/*!
@@ -9647,7 +9649,7 @@ void QWidget::leaveEvent(QEvent *)
\note Generally, you should refrain from calling update() or repaint()
\b{inside} a paintEvent(). For example, calling update() or repaint() on
- children inside a paintevent() results in undefined behavior; the child may
+ children inside a paintEvent() results in undefined behavior; the child may
or may not get a paint event.
\warning If you are using a custom paint engine without Qt's backingstore,
diff --git a/src/widgets/kernel/qwidget.h b/src/widgets/kernel/qwidget.h
index 87a841c729..3b0678d349 100644
--- a/src/widgets/kernel/qwidget.h
+++ b/src/widgets/kernel/qwidget.h
@@ -347,10 +347,10 @@ public:
Q_INVOKABLE QPixmap grab(const QRect &rectangle = QRect(QPoint(0, 0), QSize(-1, -1)));
-#ifndef QT_NO_GRAPHICSEFFECT
+#if QT_CONFIG(graphicseffect)
QGraphicsEffect *graphicsEffect() const;
void setGraphicsEffect(QGraphicsEffect *effect);
-#endif //QT_NO_GRAPHICSEFFECT
+#endif // QT_CONFIG(graphicseffect)
#ifndef QT_NO_GESTURES
void grabGesture(Qt::GestureType type, Qt::GestureFlags flags = Qt::GestureFlags());
diff --git a/src/widgets/kernel/qwidget_p.h b/src/widgets/kernel/qwidget_p.h
index db054b9c58..85214e4bd7 100644
--- a/src/widgets/kernel/qwidget_p.h
+++ b/src/widgets/kernel/qwidget_p.h
@@ -64,7 +64,9 @@
#include "QtWidgets/qsizepolicy.h"
#include "QtWidgets/qstyle.h"
#include "QtWidgets/qapplication.h"
+#if QT_CONFIG(graphicseffect)
#include <private/qgraphicseffect_p.h>
+#endif
#include "QtWidgets/qgraphicsproxywidget.h"
#include "QtWidgets/qgraphicsscene.h"
#include "QtWidgets/qgraphicsview.h"
@@ -420,9 +422,9 @@ public:
void setOpaque(bool opaque);
void updateIsTranslucent();
bool paintOnScreen() const;
-#ifndef QT_NO_GRAPHICSEFFECT
+#if QT_CONFIG(graphicseffect)
void invalidateGraphicsEffectsRecursively();
-#endif //QT_NO_GRAPHICSEFFECT
+#endif // QT_CONFIG(graphicseffect)
const QRegion &getOpaqueChildren() const;
void setDirtyOpaqueRegion();
@@ -591,10 +593,10 @@ public:
inline QRect effectiveRectFor(const QRect &rect) const
{
-#ifndef QT_NO_GRAPHICSEFFECT
+#if QT_CONFIG(graphicseffect)
if (graphicsEffect && graphicsEffect->isEnabled())
return graphicsEffect->boundingRectFor(rect).toAlignedRect();
-#endif //QT_NO_GRAPHICSEFFECT
+#endif // QT_CONFIG(graphicseffect)
return rect;
}
@@ -890,7 +892,7 @@ struct QWidgetPaintContext
QPainter *painter;
};
-#ifndef QT_NO_GRAPHICSEFFECT
+#if QT_CONFIG(graphicseffect)
class QWidgetEffectSourcePrivate : public QGraphicsEffectSourcePrivate
{
public:
@@ -943,7 +945,7 @@ public:
QTransform lastEffectTransform;
bool updateDueToGraphicsEffect;
};
-#endif //QT_NO_GRAPHICSEFFECT
+#endif // QT_CONFIG(graphicseffect)
inline QWExtra *QWidgetPrivate::extraData() const
{
diff --git a/src/widgets/kernel/qwidgetbackingstore.cpp b/src/widgets/kernel/qwidgetbackingstore.cpp
index 4421218d1d..ee9a83a652 100644
--- a/src/widgets/kernel/qwidgetbackingstore.cpp
+++ b/src/widgets/kernel/qwidgetbackingstore.cpp
@@ -53,7 +53,9 @@
#include <private/qwidget_p.h>
#include <private/qapplication_p.h>
#include <private/qpaintengine_raster_p.h>
+#if QT_CONFIG(graphicseffect)
#include <private/qgraphicseffect_p.h>
+#endif
#include <QtGui/private/qwindow_p.h>
#include <qpa/qplatformbackingstore.h>
@@ -522,9 +524,9 @@ void QWidgetBackingStore::markDirty(const QRegion &rgn, QWidget *widget,
Q_ASSERT(widget->window() == tlw);
Q_ASSERT(!rgn.isEmpty());
-#ifndef QT_NO_GRAPHICSEFFECT
+#if QT_CONFIG(graphicseffect)
widget->d_func()->invalidateGraphicsEffectsRecursively();
-#endif //QT_NO_GRAPHICSEFFECT
+#endif // QT_CONFIG(graphicseffect)
if (widget->d_func()->paintOnScreen()) {
if (widget->d_func()->dirty.isEmpty()) {
@@ -563,11 +565,11 @@ void QWidgetBackingStore::markDirty(const QRegion &rgn, QWidget *widget,
if (bufferState == BufferInvalid) {
const bool eventAlreadyPosted = !dirty.isEmpty() || updateRequestSent;
-#ifndef QT_NO_GRAPHICSEFFECT
+#if QT_CONFIG(graphicseffect)
if (widget->d_func()->graphicsEffect)
dirty += widget->d_func()->effectiveRectFor(rgn.boundingRect()).translated(offset);
else
-#endif //QT_NO_GRAPHICSEFFECT
+#endif // QT_CONFIG(graphicseffect)
dirty += rgn.translated(offset);
if (!eventAlreadyPosted || updateTime == UpdateNow)
sendUpdateRequest(tlw, updateTime);
@@ -582,11 +584,11 @@ void QWidgetBackingStore::markDirty(const QRegion &rgn, QWidget *widget,
if (widget->d_func()->inDirtyList) {
if (!qt_region_strictContains(widget->d_func()->dirty, widgetRect)) {
-#ifndef QT_NO_GRAPHICSEFFECT
+#if QT_CONFIG(graphicseffect)
if (widget->d_func()->graphicsEffect)
widget->d_func()->dirty += widget->d_func()->effectiveRectFor(rgn.boundingRect());
else
-#endif //QT_NO_GRAPHICSEFFECT
+#endif // QT_CONFIG(graphicseffect)
widget->d_func()->dirty += rgn;
}
} else {
@@ -614,9 +616,9 @@ void QWidgetBackingStore::markDirty(const QRect &rect, QWidget *widget,
Q_ASSERT(widget->window() == tlw);
Q_ASSERT(!rect.isEmpty());
-#ifndef QT_NO_GRAPHICSEFFECT
+#if QT_CONFIG(graphicseffect)
widget->d_func()->invalidateGraphicsEffectsRecursively();
-#endif //QT_NO_GRAPHICSEFFECT
+#endif // QT_CONFIG(graphicseffect)
if (widget->d_func()->paintOnScreen()) {
if (widget->d_func()->dirty.isEmpty()) {
diff --git a/src/widgets/kernel/qwidgetbackingstore_p.h b/src/widgets/kernel/qwidgetbackingstore_p.h
index 16b36423a6..fa51cb71de 100644
--- a/src/widgets/kernel/qwidgetbackingstore_p.h
+++ b/src/widgets/kernel/qwidgetbackingstore_p.h
@@ -176,11 +176,11 @@ private:
{
if (widget && !widget->d_func()->inDirtyList && !widget->data->in_destructor) {
QWidgetPrivate *widgetPrivate = widget->d_func();
-#ifndef QT_NO_GRAPHICSEFFECT
+#if QT_CONFIG(graphicseffect)
if (widgetPrivate->graphicsEffect)
widgetPrivate->dirty = widgetPrivate->effectiveRectFor(rgn.boundingRect());
else
-#endif //QT_NO_GRAPHICSEFFECT
+#endif // QT_CONFIG(graphicseffect)
widgetPrivate->dirty = rgn;
dirtyWidgets.append(widget);
widgetPrivate->inDirtyList = true;
diff --git a/src/widgets/styles/qcommonstyle.cpp b/src/widgets/styles/qcommonstyle.cpp
index 8bad65273e..593dc9e779 100644
--- a/src/widgets/styles/qcommonstyle.cpp
+++ b/src/widgets/styles/qcommonstyle.cpp
@@ -68,7 +68,9 @@
#include <qtabwidget.h>
#include <qtoolbar.h>
#include <qtoolbutton.h>
+#if QT_CONFIG(rubberband)
#include <qrubberband.h>
+#endif
#include "qtreeview.h"
#include <private/qcommonstylepixmaps_p.h>
#include <private/qmath_p.h>
@@ -2002,7 +2004,7 @@ void QCommonStyle::drawControl(ControlElement element, const QStyleOption *opt,
p->restore();
break; }
#endif // QT_NO_SIZEGRIP
-#ifndef QT_NO_RUBBERBAND
+#if QT_CONFIG(rubberband)
case CE_RubberBand: {
if (const QStyleOptionRubberBand *rbOpt = qstyleoption_cast<const QStyleOptionRubberBand *>(opt)) {
QPixmap tiledPixmap(16, 16);
@@ -2030,7 +2032,7 @@ void QCommonStyle::drawControl(ControlElement element, const QStyleOption *opt,
p->restore();
}
break; }
-#endif // QT_NO_RUBBERBAND
+#endif // QT_CONFIG(rubberband)
#ifndef QT_NO_DOCKWIDGET
case CE_DockWidgetTitle:
if (const QStyleOptionDockWidget *dwOpt = qstyleoption_cast<const QStyleOptionDockWidget *>(opt)) {
@@ -5093,7 +5095,7 @@ int QCommonStyle::styleHint(StyleHint sh, const QStyleOption *opt, const QWidget
}
}
break;
-#ifndef QT_NO_RUBBERBAND
+#if QT_CONFIG(rubberband)
case SH_RubberBand_Mask:
if (const QStyleOptionRubberBand *rbOpt = qstyleoption_cast<const QStyleOptionRubberBand *>(opt)) {
ret = 0;
@@ -5107,7 +5109,7 @@ int QCommonStyle::styleHint(StyleHint sh, const QStyleOption *opt, const QWidget
}
}
break;
-#endif // QT_NO_RUBBERBAND
+#endif // QT_CONFIG(rubberband)
case SH_SpinControls_DisableOnBounds:
ret = 1;
break;
diff --git a/src/widgets/styles/qdrawutil.cpp b/src/widgets/styles/qdrawutil.cpp
index 0b0583ea94..299dbb9f82 100644
--- a/src/widgets/styles/qdrawutil.cpp
+++ b/src/widgets/styles/qdrawutil.cpp
@@ -49,6 +49,35 @@
QT_BEGIN_NAMESPACE
+namespace {
+class PainterStateGuard {
+ Q_DISABLE_COPY(PainterStateGuard)
+public:
+ explicit PainterStateGuard(QPainter *p) : m_painter(p) {}
+ ~PainterStateGuard()
+ {
+ for ( ; m_level > 0; --m_level)
+ m_painter->restore();
+ }
+
+ void save()
+ {
+ m_painter->save();
+ ++m_level;
+ }
+
+ void restore()
+ {
+ m_painter->restore();
+ --m_level;
+ }
+
+private:
+ QPainter *m_painter;
+ int m_level= 0;
+};
+} // namespace
+
/*!
\headerfile <qdrawutil.h>
\title Drawing Utility Functions
@@ -213,6 +242,21 @@ void qDrawShadeRect(QPainter *p, int x, int y, int w, int h,
qWarning("qDrawShadeRect: Invalid parameters");
return;
}
+
+ PainterStateGuard painterGuard(p);
+ const qreal devicePixelRatio = p->device()->devicePixelRatioF();
+ if (!qFuzzyCompare(devicePixelRatio, qreal(1))) {
+ painterGuard.save();
+ const qreal inverseScale = qreal(1) / devicePixelRatio;
+ p->scale(inverseScale, inverseScale);
+ x = qRound(devicePixelRatio * x);
+ y = qRound(devicePixelRatio * y);
+ w = qRound(devicePixelRatio * w);
+ h = qRound(devicePixelRatio * h);
+ lineWidth = qRound(devicePixelRatio * lineWidth);
+ midLineWidth = qRound(devicePixelRatio * midLineWidth);
+ }
+
QPen oldPen = p->pen();
if (sunken)
p->setPen(pal.dark().color());
@@ -312,6 +356,20 @@ void qDrawShadePanel(QPainter *p, int x, int y, int w, int h,
if (Q_UNLIKELY(w < 0 || h < 0 || lineWidth < 0)) {
qWarning("qDrawShadePanel: Invalid parameters");
}
+
+ PainterStateGuard painterGuard(p);
+ const qreal devicePixelRatio = p->device()->devicePixelRatioF();
+ if (!qFuzzyCompare(devicePixelRatio, qreal(1))) {
+ painterGuard.save();
+ const qreal inverseScale = qreal(1) / devicePixelRatio;
+ p->scale(inverseScale, inverseScale);
+ x = qRound(devicePixelRatio * x);
+ y = qRound(devicePixelRatio * y);
+ w = qRound(devicePixelRatio * w);
+ h = qRound(devicePixelRatio * h);
+ lineWidth = qRound(devicePixelRatio * lineWidth);
+ }
+
QColor shade = pal.dark().color();
QColor light = pal.light().color();
if (fill) {
@@ -389,6 +447,19 @@ static void qDrawWinShades(QPainter *p,
{
if (w < 2 || h < 2) // can't do anything with that
return;
+
+ PainterStateGuard painterGuard(p);
+ const qreal devicePixelRatio = p->device()->devicePixelRatioF();
+ if (!qFuzzyCompare(devicePixelRatio, qreal(1))) {
+ painterGuard.save();
+ const qreal inverseScale = qreal(1) / devicePixelRatio;
+ p->scale(inverseScale, inverseScale);
+ x = qRound(devicePixelRatio * x);
+ y = qRound(devicePixelRatio * y);
+ w = qRound(devicePixelRatio * w);
+ h = qRound(devicePixelRatio * h);
+ }
+
QPen oldPen = p->pen();
QPoint a[3] = { QPoint(x, y+h-2), QPoint(x, y), QPoint(x+w-2, y) };
p->setPen(c1);
@@ -518,6 +589,20 @@ void qDrawPlainRect(QPainter *p, int x, int y, int w, int h, const QColor &c,
if (Q_UNLIKELY(w < 0 || h < 0 || lineWidth < 0)) {
qWarning("qDrawPlainRect: Invalid parameters");
}
+
+ PainterStateGuard painterGuard(p);
+ const qreal devicePixelRatio = p->device()->devicePixelRatioF();
+ if (!qFuzzyCompare(devicePixelRatio, qreal(1))) {
+ painterGuard.save();
+ const qreal inverseScale = qreal(1) / devicePixelRatio;
+ p->scale(inverseScale, inverseScale);
+ x = qRound(devicePixelRatio * x);
+ y = qRound(devicePixelRatio * y);
+ w = qRound(devicePixelRatio * w);
+ h = qRound(devicePixelRatio * h);
+ lineWidth = qRound(devicePixelRatio * lineWidth);
+ }
+
QPen oldPen = p->pen();
QBrush oldBrush = p->brush();
p->setPen(c);
diff --git a/src/widgets/styles/qfusionstyle.cpp b/src/widgets/styles/qfusionstyle.cpp
index 704a226866..eb7a1599d6 100644
--- a/src/widgets/styles/qfusionstyle.cpp
+++ b/src/widgets/styles/qfusionstyle.cpp
@@ -967,11 +967,9 @@ void QFusionStyle::drawPrimitive(PrimitiveElement elem,
break;
case PE_PanelMenu: {
painter->save();
- QColor menuBackground = option->palette.base().color().lighter(108);
+ const QBrush menuBackground = option->palette.base().color().lighter(108);
QColor borderColor = option->palette.background().color().darker(160);
- painter->setPen(borderColor);
- painter->setBrush(menuBackground);
- painter->drawRect(option->rect.adjusted(0, 0, -1, -1));
+ qDrawPlainRect(painter, option->rect, borderColor, 1, &menuBackground);
painter->restore();
}
break;
diff --git a/src/widgets/styles/qstyleoption.cpp b/src/widgets/styles/qstyleoption.cpp
index a3bfbd2938..51fecd0d13 100644
--- a/src/widgets/styles/qstyleoption.cpp
+++ b/src/widgets/styles/qstyleoption.cpp
@@ -2793,7 +2793,7 @@ QStyleOptionToolBox::QStyleOptionToolBox(int version)
a selected tab nor is it the selected tab.
*/
-#ifndef QT_NO_RUBBERBAND
+#if QT_CONFIG(rubberband)
/*!
\class QStyleOptionRubberBand
\brief The QStyleOptionRubberBand class is used to describe the
@@ -2883,7 +2883,7 @@ QStyleOptionRubberBand::QStyleOptionRubberBand(int version)
The default value is true.
*/
-#endif // QT_NO_RUBBERBAND
+#endif // QT_CONFIG(rubberband)
/*!
\class QStyleOptionTitleBar
diff --git a/src/widgets/styles/qstyleoption.h b/src/widgets/styles/qstyleoption.h
index 0e76d53eea..a3ed35c762 100644
--- a/src/widgets/styles/qstyleoption.h
+++ b/src/widgets/styles/qstyleoption.h
@@ -49,7 +49,9 @@
#include <QtWidgets/qstyle.h>
#include <QtWidgets/qtabbar.h>
#include <QtWidgets/qtabwidget.h>
+#if QT_CONFIG(rubberband)
#include <QtWidgets/qrubberband.h>
+#endif
#include <QtWidgets/qframe.h>
#ifndef QT_NO_ITEMVIEWS
# include <QtCore/qabstractitemmodel.h>
@@ -467,7 +469,7 @@ protected:
typedef Q_DECL_DEPRECATED QStyleOptionToolBox QStyleOptionToolBoxV2;
-#ifndef QT_NO_RUBBERBAND
+#if QT_CONFIG(rubberband)
class Q_WIDGETS_EXPORT QStyleOptionRubberBand : public QStyleOption
{
public:
@@ -483,7 +485,7 @@ public:
protected:
QStyleOptionRubberBand(int version);
};
-#endif // QT_NO_RUBBERBAND
+#endif // QT_CONFIG(rubberband)
// -------------------------- Complex style options -------------------------------
class Q_WIDGETS_EXPORT QStyleOptionComplex : public QStyleOption
diff --git a/src/widgets/styles/qwindowsstyle.cpp b/src/widgets/styles/qwindowsstyle.cpp
index efbb972a06..f805e29db1 100644
--- a/src/widgets/styles/qwindowsstyle.cpp
+++ b/src/widgets/styles/qwindowsstyle.cpp
@@ -51,7 +51,9 @@
#include <private/qmenubar_p.h>
#include "qpaintengine.h"
#include "qpainter.h"
+#if QT_CONFIG(rubberband)
#include "qrubberband.h"
+#endif
#include "qstyleoption.h"
#include "qtabbar.h"
#include "qwidget.h"
@@ -606,7 +608,7 @@ int QWindowsStyle::styleHint(StyleHint hint, const QStyleOption *opt, const QWid
ret = 400;
break;
}
-#ifndef QT_NO_RUBBERBAND
+#if QT_CONFIG(rubberband)
case SH_RubberBand_Mask:
if (const QStyleOptionRubberBand *rbOpt = qstyleoption_cast<const QStyleOptionRubberBand *>(opt)) {
ret = 0;
@@ -622,7 +624,7 @@ int QWindowsStyle::styleHint(StyleHint hint, const QStyleOption *opt, const QWid
}
}
break;
-#endif // QT_NO_RUBBERBAND
+#endif // QT_CONFIG(rubberband)
#if QT_CONFIG(wizard)
case SH_WizardStyle:
ret = QWizard::ModernStyle;
@@ -1080,7 +1082,7 @@ void QWindowsStyle::drawControl(ControlElement ce, const QStyleOption *opt, QPai
const QWidget *widget) const
{
switch (ce) {
-#ifndef QT_NO_RUBBERBAND
+#if QT_CONFIG(rubberband)
case CE_RubberBand:
if (qstyleoption_cast<const QStyleOptionRubberBand *>(opt)) {
// ### workaround for slow general painter path
@@ -1103,7 +1105,7 @@ void QWindowsStyle::drawControl(ControlElement ce, const QStyleOption *opt, QPai
return;
}
break;
-#endif // QT_NO_RUBBERBAND
+#endif // QT_CONFIG(rubberband)
#if !defined(QT_NO_MENU) && !defined(QT_NO_MAINWINDOW)
case CE_MenuBarEmptyArea:
diff --git a/src/widgets/widgets.pro b/src/widgets/widgets.pro
index e4f7640a10..22bdf08408 100644
--- a/src/widgets/widgets.pro
+++ b/src/widgets/widgets.pro
@@ -23,8 +23,10 @@ include(itemviews/itemviews.pri)
include(graphicsview/graphicsview.pri)
include(util/util.pri)
include(statemachine/statemachine.pri)
-include(effects/effects.pri)
+qtConfig(graphicseffect) {
+ include(effects/effects.pri)
+}
QMAKE_LIBS += $$QMAKE_LIBS_GUI
diff --git a/src/widgets/widgets/qabstractspinbox.cpp b/src/widgets/widgets/qabstractspinbox.cpp
index 4a3abe0c32..22f3745b26 100644
--- a/src/widgets/widgets/qabstractspinbox.cpp
+++ b/src/widgets/widgets/qabstractspinbox.cpp
@@ -49,7 +49,9 @@
#include <qstylehints.h>
#include <qclipboard.h>
#include <qdatetime.h>
+#if QT_CONFIG(datetimeedit)
#include <qdatetimeedit.h>
+#endif
#include <qevent.h>
#include <qmenu.h>
#include <qpainter.h>
diff --git a/src/widgets/widgets/qcombobox.cpp b/src/widgets/widgets/qcombobox.cpp
index a8a54d8d67..90dfbe1633 100644
--- a/src/widgets/widgets/qcombobox.cpp
+++ b/src/widgets/widgets/qcombobox.cpp
@@ -47,7 +47,9 @@
#include <qapplication.h>
#include <qdesktopwidget.h>
#include <qlistview.h>
+#if QT_CONFIG(tableview)
#include <qtableview.h>
+#endif
#include <qitemdelegate.h>
#include <qmap.h>
#include <qmenu.h>
@@ -615,7 +617,7 @@ int QComboBoxPrivateContainer::topMargin() const
{
if (const QListView *lview = qobject_cast<const QListView*>(view))
return lview->spacing();
-#ifndef QT_NO_TABLEVIEW
+#if QT_CONFIG(tableview)
if (const QTableView *tview = qobject_cast<const QTableView*>(view))
return tview->showGrid() ? 1 : 0;
#endif
@@ -630,7 +632,7 @@ int QComboBoxPrivateContainer::spacing() const
QListView *lview = qobject_cast<QListView*>(view);
if (lview)
return 2 * lview->spacing(); // QListView::spacing is the padding around the item.
-#ifndef QT_NO_TABLEVIEW
+#if QT_CONFIG(tableview)
QTableView *tview = qobject_cast<QTableView*>(view);
if (tview)
return tview->showGrid() ? 1 : 0;
diff --git a/src/widgets/widgets/qdatetimeedit.cpp b/src/widgets/widgets/qdatetimeedit.cpp
index 46e6369e3c..6d1521c48b 100644
--- a/src/widgets/widgets/qdatetimeedit.cpp
+++ b/src/widgets/widgets/qdatetimeedit.cpp
@@ -54,8 +54,6 @@
#include <algorithm>
-#ifndef QT_NO_DATETIMEEDIT
-
//#define QDATETIMEEDIT_QDTEDEBUG
#ifdef QDATETIMEEDIT_QDTEDEBUG
# define QDTEDEBUG qDebug() << QString::fromLatin1("%1:%2").arg(__FILE__).arg(__LINE__)
@@ -2675,5 +2673,3 @@ void QCalendarPopup::hideEvent(QHideEvent *)
QT_END_NAMESPACE
#include "moc_qdatetimeedit.cpp"
#include "moc_qdatetimeedit_p.cpp"
-
-#endif // QT_NO_DATETIMEEDIT
diff --git a/src/widgets/widgets/qdatetimeedit.h b/src/widgets/widgets/qdatetimeedit.h
index 30e4a58bb3..b46434c1a4 100644
--- a/src/widgets/widgets/qdatetimeedit.h
+++ b/src/widgets/widgets/qdatetimeedit.h
@@ -45,10 +45,9 @@
#include <QtCore/qvariant.h>
#include <QtWidgets/qabstractspinbox.h>
-QT_BEGIN_NAMESPACE
-
+QT_REQUIRE_CONFIG(datetimeedit);
-#ifndef QT_NO_DATETIMEEDIT
+QT_BEGIN_NAMESPACE
class QDateTimeEditPrivate;
class QStyleOptionSpinBox;
@@ -228,8 +227,6 @@ Q_SIGNALS:
Q_DECLARE_OPERATORS_FOR_FLAGS(QDateTimeEdit::Sections)
-#endif // QT_NO_DATETIMEEDIT
-
QT_END_NAMESPACE
#endif // QDATETIMEEDIT_H
diff --git a/src/widgets/widgets/qdatetimeedit_p.h b/src/widgets/widgets/qdatetimeedit_p.h
index 5302d6d9a7..bc70780de9 100644
--- a/src/widgets/widgets/qdatetimeedit_p.h
+++ b/src/widgets/widgets/qdatetimeedit_p.h
@@ -63,8 +63,6 @@
#include "qdebug.h"
-#ifndef QT_NO_DATETIMEEDIT
-
QT_BEGIN_NAMESPACE
class QCalendarPopup;
@@ -181,6 +179,4 @@ private:
QT_END_NAMESPACE
-#endif // QT_NO_DATETIMEEDIT
-
#endif // QDATETIMEEDIT_P_H
diff --git a/src/widgets/widgets/qmainwindowlayout.cpp b/src/widgets/widgets/qmainwindowlayout.cpp
index e0269a3f02..e48ce301fb 100644
--- a/src/widgets/widgets/qmainwindowlayout.cpp
+++ b/src/widgets/widgets/qmainwindowlayout.cpp
@@ -49,7 +49,9 @@
#include "qtoolbar.h"
#include "qtoolbarlayout_p.h"
#include "qwidgetanimator_p.h"
+#if QT_CONFIG(rubberband)
#include "qrubberband.h"
+#endif
#include "qtabbar_p.h"
#include <qapplication.h>
@@ -2460,7 +2462,7 @@ QLayoutItem *QMainWindowLayout::unplug(QWidget *widget, bool group)
void QMainWindowLayout::updateGapIndicator()
{
-#ifndef QT_NO_RUBBERBAND
+#if QT_CONFIG(rubberband)
if (!widgetAnimator.animating() && (!currentGapPos.isEmpty()
#if QT_CONFIG(dockwidget)
|| currentHoveredFloat
@@ -2490,7 +2492,7 @@ void QMainWindowLayout::updateGapIndicator()
} else if (gapIndicator) {
gapIndicator->hide();
}
-#endif //QT_NO_RUBBERBAND
+#endif // QT_CONFIG(rubberband)
}
void QMainWindowLayout::hover(QLayoutItem *widgetItem, const QPoint &mousePos)
diff --git a/src/widgets/widgets/qmainwindowlayout_p.h b/src/widgets/widgets/qmainwindowlayout_p.h
index cc3b4e9261..6b75ef1caf 100644
--- a/src/widgets/widgets/qmainwindowlayout_p.h
+++ b/src/widgets/widgets/qmainwindowlayout_p.h
@@ -547,7 +547,7 @@ public:
QList<int> currentGapPos;
QRect currentGapRect;
QWidget *pluggingWidget;
-#ifndef QT_NO_RUBBERBAND
+#if QT_CONFIG(rubberband)
QPointer<QRubberBand> gapIndicator;
#endif
#ifndef QT_NO_DOCKWIDGET
diff --git a/src/widgets/widgets/qmdiarea.cpp b/src/widgets/widgets/qmdiarea.cpp
index 0dc45ddbc3..83b5068bba 100644
--- a/src/widgets/widgets/qmdiarea.cpp
+++ b/src/widgets/widgets/qmdiarea.cpp
@@ -669,7 +669,7 @@ QMdiAreaPrivate::QMdiAreaPrivate()
regularTiler(0),
iconTiler(0),
placer(0),
-#ifndef QT_NO_RUBBERBAND
+#if QT_CONFIG(rubberband)
rubberBand(0),
#endif
#ifndef QT_NO_TABBAR
@@ -1033,7 +1033,7 @@ void QMdiAreaPrivate::activateHighlightedWindow()
activateWindow(nextVisibleSubWindow(-1, QMdiArea::ActivationHistoryOrder));
else
activateWindow(childWindows.at(indexToHighlighted));
-#ifndef QT_NO_RUBBERBAND
+#if QT_CONFIG(rubberband)
hideRubberBand();
#endif
}
@@ -1137,7 +1137,7 @@ void QMdiAreaPrivate::updateActiveWindow(int removedIndex, bool activeRemoved)
}
if (indexToHighlighted >= 0) {
-#ifndef QT_NO_RUBBERBAND
+#if QT_CONFIG(rubberband)
// Hide rubber band if highlighted window is removed.
if (indexToHighlighted == removedIndex)
hideRubberBand();
@@ -1511,7 +1511,7 @@ void QMdiAreaPrivate::highlightNextSubWindow(int increaseFactor)
if (!highlight)
return;
-#ifndef QT_NO_RUBBERBAND
+#if QT_CONFIG(rubberband)
if (!rubberBand) {
rubberBand = new QRubberBand(QRubberBand::Rectangle, q);
// For accessibility to identify this special widget.
@@ -1521,7 +1521,7 @@ void QMdiAreaPrivate::highlightNextSubWindow(int increaseFactor)
#endif
// Only highlight if we're not switching back to the previously active window (Ctrl-Tab once).
-#ifndef QT_NO_RUBBERBAND
+#if QT_CONFIG(rubberband)
if (tabToPreviousTimerId == -1)
showRubberBandFor(highlight);
#endif
@@ -2348,7 +2348,7 @@ void QMdiArea::timerEvent(QTimerEvent *timerEvent)
d->tabToPreviousTimerId = -1;
if (d->indexToHighlighted < 0)
return;
-#ifndef QT_NO_RUBBERBAND
+#if QT_CONFIG(rubberband)
// We're not doing a "quick switch" ... show rubber band.
Q_ASSERT(d->indexToHighlighted < d->childWindows.size());
Q_ASSERT(d->rubberBand);
@@ -2591,7 +2591,7 @@ bool QMdiArea::eventFilter(QObject *object, QEvent *event)
if (keyPress)
area->d_func()->highlightNextSubWindow(keyEvent->key() == Qt::Key_Tab ? 1 : -1);
return true;
-#ifndef QT_NO_RUBBERBAND
+#if QT_CONFIG(rubberband)
case Qt::Key_Escape:
area->d_func()->hideRubberBand();
break;
@@ -2640,7 +2640,7 @@ bool QMdiArea::eventFilter(QObject *object, QEvent *event)
case QEvent::Hide:
d->isSubWindowsTiled = false;
break;
-#ifndef QT_NO_RUBBERBAND
+#if QT_CONFIG(rubberband)
case QEvent::Close:
if (d->childWindows.indexOf(subWindow) == d->indexToHighlighted)
d->hideRubberBand();
diff --git a/src/widgets/widgets/qmdiarea_p.h b/src/widgets/widgets/qmdiarea_p.h
index 353144a6ab..b77f3f63ea 100644
--- a/src/widgets/widgets/qmdiarea_p.h
+++ b/src/widgets/widgets/qmdiarea_p.h
@@ -144,7 +144,7 @@ public:
QMdi::Rearranger *regularTiler;
QMdi::Rearranger *iconTiler;
QMdi::Placer *placer;
-#ifndef QT_NO_RUBBERBAND
+#if QT_CONFIG(rubberband)
QRubberBand *rubberBand;
#endif
QMdiAreaTabBar *tabBar;
@@ -254,7 +254,7 @@ public:
subWindow->d_func()->setActive(active, changeFocus);
}
-#ifndef QT_NO_RUBBERBAND
+#if QT_CONFIG(rubberband)
void showRubberBandFor(QMdiSubWindow *subWindow);
inline void hideRubberBand()
@@ -263,7 +263,7 @@ public:
rubberBand->hide();
indexToHighlighted = -1;
}
-#endif // QT_NO_RUBBERBAND
+#endif // QT_CONFIG(rubberband)
};
#endif // QT_NO_MDIAREA
diff --git a/src/widgets/widgets/qmdisubwindow.cpp b/src/widgets/widgets/qmdisubwindow.cpp
index 664dd8d710..498744e81e 100644
--- a/src/widgets/widgets/qmdisubwindow.cpp
+++ b/src/widgets/widgets/qmdisubwindow.cpp
@@ -863,14 +863,14 @@ QMdiSubWindowPrivate::QMdiSubWindowPrivate()
#ifndef QT_NO_SIZEGRIP
sizeGrip(0),
#endif
-#ifndef QT_NO_RUBBERBAND
+#if QT_CONFIG(rubberband)
rubberBand(0),
#endif
userMinimumSize(0,0),
resizeEnabled(true),
moveEnabled(true),
isInInteractiveMode(false),
-#ifndef QT_NO_RUBBERBAND
+#if QT_CONFIG(rubberband)
isInRubberBandMode(false),
#endif
isShadeMode(false),
@@ -944,13 +944,13 @@ void QMdiSubWindowPrivate::_q_enterInteractiveMode()
oldGeometry = q->geometry();
isInInteractiveMode = true;
q->setFocus();
-#ifndef QT_NO_RUBBERBAND
+#if QT_CONFIG(rubberband)
if ((q->testOption(QMdiSubWindow::RubberBandResize)
&& (currentOperation == BottomRightResize || currentOperation == BottomLeftResize))
|| (q->testOption(QMdiSubWindow::RubberBandMove) && currentOperation == Move)) {
enterRubberBandMode();
} else
-#endif // QT_NO_RUBBERBAND
+#endif // QT_CONFIG(rubberband)
{
q->grabMouse();
}
@@ -977,7 +977,7 @@ void QMdiSubWindowPrivate::_q_processFocusChanged(QWidget *old, QWidget *now)
void QMdiSubWindowPrivate::leaveInteractiveMode()
{
Q_Q(QMdiSubWindow);
-#ifndef QT_NO_RUBBERBAND
+#if QT_CONFIG(rubberband)
if (isInRubberBandMode)
leaveRubberBandMode();
else
@@ -1881,7 +1881,7 @@ void QMdiSubWindowPrivate::updateWindowTitle(bool isRequestFromChild)
ignoreWindowTitleChange = false;
}
-#ifndef QT_NO_RUBBERBAND
+#if QT_CONFIG(rubberband)
void QMdiSubWindowPrivate::enterRubberBandMode()
{
Q_Q(QMdiSubWindow);
@@ -1913,7 +1913,7 @@ void QMdiSubWindowPrivate::leaveRubberBandMode()
rubberBand->hide();
currentOperation = None;
}
-#endif // QT_NO_RUBBERBAND
+#endif // QT_CONFIG(rubberband)
// Taken from the old QWorkspace (::readColors())
QPalette QMdiSubWindowPrivate::desktopPalette() const
@@ -2410,7 +2410,7 @@ void QMdiSubWindow::setOption(SubWindowOption option, bool on)
Q_D(QMdiSubWindow);
d->options.setFlag(option, on);
-#ifndef QT_NO_RUBBERBAND
+#if QT_CONFIG(rubberband)
if ((option & (RubberBandResize | RubberBandMove)) && !on && d->isInRubberBandMode)
d->leaveRubberBandMode();
#endif
@@ -2709,7 +2709,7 @@ bool QMdiSubWindow::eventFilter(QObject *object, QEvent *event)
d->oldGeometry = geometry();
d->currentOperation = isLeftToRight() ? QMdiSubWindowPrivate::BottomRightResize
: QMdiSubWindowPrivate::BottomLeftResize;
-#ifndef QT_NO_RUBBERBAND
+#if QT_CONFIG(rubberband)
d->enterRubberBandMode();
#endif
return true;
@@ -2823,7 +2823,7 @@ bool QMdiSubWindow::event(QEvent *event)
d->currentOperation = QMdiSubWindowPrivate::None;
d->activeSubControl = QStyle::SC_None;
d->hoveredSubControl = QStyle::SC_None;
-#ifndef QT_NO_RUBBERBAND
+#if QT_CONFIG(rubberband)
if (d->isInRubberBandMode)
d->leaveRubberBandMode();
#endif
@@ -3182,7 +3182,7 @@ void QMdiSubWindow::mousePressEvent(QMouseEvent *mouseEvent)
Q_D(QMdiSubWindow);
if (d->isInInteractiveMode)
d->leaveInteractiveMode();
-#ifndef QT_NO_RUBBERBAND
+#if QT_CONFIG(rubberband)
if (d->isInRubberBandMode)
d->leaveRubberBandMode();
#endif
@@ -3197,7 +3197,7 @@ void QMdiSubWindow::mousePressEvent(QMouseEvent *mouseEvent)
d->mousePressPosition = mapToParent(mouseEvent->pos());
if (d->resizeEnabled || d->moveEnabled)
d->oldGeometry = geometry();
-#ifndef QT_NO_RUBBERBAND
+#if QT_CONFIG(rubberband)
if ((testOption(QMdiSubWindow::RubberBandResize) && d->isResizeOperation())
|| (testOption(QMdiSubWindow::RubberBandMove) && d->isMoveOperation())) {
d->enterRubberBandMode();
@@ -3277,7 +3277,7 @@ void QMdiSubWindow::mouseReleaseEvent(QMouseEvent *mouseEvent)
Q_D(QMdiSubWindow);
if (d->currentOperation != QMdiSubWindowPrivate::None) {
-#ifndef QT_NO_RUBBERBAND
+#if QT_CONFIG(rubberband)
if (d->isInRubberBandMode && !d->isInInteractiveMode)
d->leaveRubberBandMode();
#endif
@@ -3392,13 +3392,13 @@ void QMdiSubWindow::keyPressEvent(QKeyEvent *keyEvent)
#ifndef QT_NO_CURSOR
QPoint newPosition = parentWidget()->mapFromGlobal(cursor().pos() + delta);
QRect oldGeometry =
-#ifndef QT_NO_RUBBERBAND
+#if QT_CONFIG(rubberband)
d->isInRubberBandMode ? d->rubberBand->geometry() :
#endif
geometry();
d->setNewGeometry(newPosition);
QRect currentGeometry =
-#ifndef QT_NO_RUBBERBAND
+#if QT_CONFIG(rubberband)
d->isInRubberBandMode ? d->rubberBand->geometry() :
#endif
geometry();
diff --git a/src/widgets/widgets/qmdisubwindow_p.h b/src/widgets/widgets/qmdisubwindow_p.h
index 33fa73eb0d..71fcc38378 100644
--- a/src/widgets/widgets/qmdisubwindow_p.h
+++ b/src/widgets/widgets/qmdisubwindow_p.h
@@ -179,7 +179,7 @@ public:
#ifndef QT_NO_SIZEGRIP
QPointer<QSizeGrip> sizeGrip;
#endif
-#ifndef QT_NO_RUBBERBAND
+#if QT_CONFIG(rubberband)
QRubberBand *rubberBand;
#endif
QPoint mousePressPosition;
@@ -190,7 +190,7 @@ public:
bool resizeEnabled;
bool moveEnabled;
bool isInInteractiveMode;
-#ifndef QT_NO_RUBBERBAND
+#if QT_CONFIG(rubberband)
bool isInRubberBandMode;
#endif
bool isShadeMode;
@@ -258,7 +258,7 @@ public:
void removeButtonsFromMenuBar();
#endif
void updateWindowTitle(bool requestFromChild);
-#ifndef QT_NO_RUBBERBAND
+#if QT_CONFIG(rubberband)
void enterRubberBandMode();
void leaveRubberBandMode();
#endif
@@ -310,7 +310,7 @@ public:
Q_Q(QMdiSubWindow);
Q_ASSERT(parent);
geometry->setSize(geometry->size().expandedTo(internalMinimumSize));
-#ifndef QT_NO_RUBBERBAND
+#if QT_CONFIG(rubberband)
if (isInRubberBandMode)
rubberBand->setGeometry(*geometry);
else
diff --git a/src/widgets/widgets/qrubberband.cpp b/src/widgets/widgets/qrubberband.cpp
index c91f837093..ade8675db8 100644
--- a/src/widgets/widgets/qrubberband.cpp
+++ b/src/widgets/widgets/qrubberband.cpp
@@ -43,8 +43,6 @@
#include "qrubberband.h"
#include "qtimer.h"
-#ifndef QT_NO_RUBBERBAND
-
#include "qstyle.h"
#include "qstyleoption.h"
#if 0 // Used to be included in Qt4 for Q_WS_MAC
@@ -334,5 +332,3 @@ bool QRubberBand::event(QEvent *e)
QT_END_NAMESPACE
#include "moc_qrubberband.cpp"
-
-#endif // QT_NO_RUBBERBAND
diff --git a/src/widgets/widgets/qrubberband.h b/src/widgets/widgets/qrubberband.h
index 217261bf75..a05eb0d543 100644
--- a/src/widgets/widgets/qrubberband.h
+++ b/src/widgets/widgets/qrubberband.h
@@ -43,10 +43,9 @@
#include <QtWidgets/qtwidgetsglobal.h>
#include <QtWidgets/qwidget.h>
-QT_BEGIN_NAMESPACE
-
+QT_REQUIRE_CONFIG(rubberband);
-#ifndef QT_NO_RUBBERBAND
+QT_BEGIN_NAMESPACE
class QRubberBandPrivate;
class QStyleOptionRubberBand;
@@ -91,8 +90,6 @@ inline void QRubberBand::setGeometry(int ax, int ay, int aw, int ah)
inline void QRubberBand::move(int ax, int ay)
{ setGeometry(ax, ay, width(), height()); }
-#endif // QT_NO_RUBBERBAND
-
QT_END_NAMESPACE
#endif // QRUBBERBAND_H
diff --git a/src/widgets/widgets/qsplitter.cpp b/src/widgets/widgets/qsplitter.cpp
index 0c98c3875a..7d507aa7f4 100644
--- a/src/widgets/widgets/qsplitter.cpp
+++ b/src/widgets/widgets/qsplitter.cpp
@@ -47,7 +47,9 @@
#include "qlayout.h"
#include "qlist.h"
#include "qpainter.h"
+#if QT_CONFIG(rubberband)
#include "qrubberband.h"
+#endif
#include "qstyle.h"
#include "qstyleoption.h"
#include "qtextstream.h"
diff --git a/src/widgets/widgets/qsplitter_p.h b/src/widgets/widgets/qsplitter_p.h
index 0730fab824..34ae34121e 100644
--- a/src/widgets/widgets/qsplitter_p.h
+++ b/src/widgets/widgets/qsplitter_p.h
@@ -53,7 +53,6 @@
#include <QtWidgets/private/qtwidgetsglobal_p.h>
#include "private/qframe_p.h"
-#include "qrubberband.h"
QT_BEGIN_NAMESPACE
diff --git a/src/widgets/widgets/qtoolbar.cpp b/src/widgets/widgets/qtoolbar.cpp
index f4d8c357f6..aaa64c8b2f 100644
--- a/src/widgets/widgets/qtoolbar.cpp
+++ b/src/widgets/widgets/qtoolbar.cpp
@@ -48,7 +48,9 @@
#include <qmainwindow.h>
#include <qmenu.h>
#include <qmenubar.h>
+#if QT_CONFIG(rubberband)
#include <qrubberband.h>
+#endif
#include <qsignalmapper.h>
#include <qstylepainter.h>
#include <qtoolbutton.h>
diff --git a/src/widgets/widgets/qwidgetlinecontrol.cpp b/src/widgets/widgets/qwidgetlinecontrol.cpp
index 905bc0f586..97df3427b0 100644
--- a/src/widgets/widgets/qwidgetlinecontrol.cpp
+++ b/src/widgets/widgets/qwidgetlinecontrol.cpp
@@ -973,12 +973,20 @@ void QWidgetLineControl::parseInputMask(const QString &maskFields)
// calculate m_maxLength / m_maskData length
m_maxLength = 0;
QChar c = 0;
+ bool escaped = false;
for (int i=0; i<m_inputMask.length(); i++) {
c = m_inputMask.at(i);
- if (i > 0 && m_inputMask.at(i-1) == QLatin1Char('\\')) {
- m_maxLength++;
- continue;
+ if (escaped) {
+ ++m_maxLength;
+ escaped = false;
+ continue;
}
+
+ if (c == '\\') {
+ escaped = true;
+ continue;
+ }
+
if (c != QLatin1Char('\\') && c != QLatin1Char('!') &&
c != QLatin1Char('<') && c != QLatin1Char('>') &&
c != QLatin1Char('{') && c != QLatin1Char('}') &&
diff --git a/src/widgets/widgets/widgets.pri b/src/widgets/widgets/widgets.pri
index 726235ef4e..610932c6ce 100644
--- a/src/widgets/widgets/widgets.pri
+++ b/src/widgets/widgets/widgets.pri
@@ -8,8 +8,6 @@ HEADERS += \
widgets/qcalendarwidget.h \
widgets/qcombobox.h \
widgets/qcombobox_p.h \
- widgets/qdatetimeedit.h \
- widgets/qdatetimeedit_p.h \
widgets/qdial.h \
widgets/qdockwidget.h \
widgets/qdockwidget_p.h \
@@ -32,7 +30,6 @@ HEADERS += \
widgets/qmenubar.h \
widgets/qmenubar_p.h \
widgets/qprogressbar.h \
- widgets/qrubberband.h \
widgets/qscrollbar.h \
widgets/qscrollbar_p.h \
widgets/qscrollarea_p.h \
@@ -72,7 +69,6 @@ SOURCES += \
widgets/qabstractspinbox.cpp \
widgets/qcalendarwidget.cpp \
widgets/qcombobox.cpp \
- widgets/qdatetimeedit.cpp \
widgets/qdial.cpp \
widgets/qdockwidget.cpp \
widgets/qdockarealayout.cpp \
@@ -89,7 +85,6 @@ SOURCES += \
widgets/qmenu.cpp \
widgets/qmenubar.cpp \
widgets/qprogressbar.cpp \
- widgets/qrubberband.cpp \
widgets/qscrollbar.cpp \
widgets/qsizegrip.cpp \
widgets/qslider.cpp \
@@ -150,6 +145,15 @@ qtConfig(commandlinkbutton) {
widgets/qcommandlinkbutton.cpp
}
+qtConfig(datetimeedit) {
+ HEADERS += \
+ widgets/qdatetimeedit.h \
+ widgets/qdatetimeedit_p.h
+
+ SOURCES += \
+ widgets/qdatetimeedit.cpp
+}
+
qtConfig(fontcombobox) {
HEADERS += widgets/qfontcombobox.h
SOURCES += widgets/qfontcombobox.cpp
@@ -197,6 +201,11 @@ qtConfig(dialogbuttonbox) {
widgets/qdialogbuttonbox.cpp
}
+qtConfig(rubberband) {
+ HEADERS += widgets/qrubberband.h
+ SOURCES += widgets/qrubberband.cpp
+}
+
qtConfig(splashscreen) {
HEADERS += \
widgets/qsplashscreen.h