summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLiang Qi <liang.qi@theqtcompany.com>2016-04-07 10:47:20 +0200
committerLiang Qi <liang.qi@theqtcompany.com>2016-04-07 10:47:20 +0200
commitee0951d69b38f766e67262487be95b88501aa4a5 (patch)
tree116c334060500be340d4d61c99026316b0df3ce9
parent0bb645b1ccc5a9d57b21cf0b2c4306b8e48c611c (diff)
parentd37239aa419ee4adff4b0a8d5c1403cadff72319 (diff)
Merge remote-tracking branch 'origin/5.6' into 5.7
Conflicts: src/network/access/qftp.cpp src/widgets/itemviews/qheaderview.cpp src/widgets/itemviews/qlistview.cpp tests/auto/network/access/qftp/tst_qftp.cpp Change-Id: I9f928f25d45d8944dd60bb583f649fc1615bc5d9
-rw-r--r--doc/global/template/style/offline-simple.css16
-rw-r--r--examples/widgets/gestures/imagegestures/imagewidget.cpp1
-rw-r--r--examples/xml/htmlinfo/nokia_com.html215
-rw-r--r--examples/xml/htmlinfo/resources.qrc1
-rw-r--r--qmake/generators/win32/msvc_vcproj.cpp4
-rw-r--r--src/angle/src/config.pri2
-rw-r--r--src/angle/src/libGLESv2/libGLESv2.pro2
-rw-r--r--src/corelib/global/qglobal.h2
-rw-r--r--src/corelib/io/qdir.cpp8
-rw-r--r--src/corelib/itemmodels/qabstractitemmodel.h2
-rw-r--r--src/corelib/kernel/qobjectdefs.h73
-rw-r--r--src/corelib/tools/qdatetimeparser.cpp11
-rw-r--r--src/corelib/tools/qhash.cpp1
-rw-r--r--src/corelib/tools/qstring.h12
-rw-r--r--src/corelib/tools/qtimezoneprivate.cpp57
-rw-r--r--src/gui/kernel/qopenglcontext.cpp4
-rw-r--r--src/gui/painting/qpaintengine_raster.cpp2
-rw-r--r--src/gui/painting/qpdf.cpp7
-rw-r--r--src/network/access/qftp.cpp10
-rw-r--r--src/network/socket/qlocalsocket_win.cpp4
-rw-r--r--src/plugins/platforms/direct2d/qwindowsdirect2dhelpers.h14
-rw-r--r--src/plugins/platforms/windows/qwindowscursor.cpp10
-rw-r--r--src/plugins/platforms/windows/qwindowsintegration.cpp8
-rw-r--r--src/plugins/platforms/windows/qwindowsnativeinterface.cpp6
-rw-r--r--src/plugins/platforms/winrt/qwinrttheme.cpp2
-rw-r--r--src/plugins/platforms/xcb/qxcbkeyboard.cpp3
-rw-r--r--src/tools/qlalr/recognizer.cpp1
-rw-r--r--src/tools/qlalr/recognizer.h1
-rw-r--r--src/widgets/dialogs/qfontdialog.cpp2
-rw-r--r--src/widgets/itemviews/qheaderview.cpp6
-rw-r--r--src/widgets/styles/qcommonstyle.cpp10
-rw-r--r--src/widgets/styles/qstyleanimation.cpp1
-rw-r--r--src/widgets/styles/qwindowsstyle.cpp10
-rw-r--r--src/widgets/styles/qwindowsstyle_p_p.h7
-rw-r--r--src/widgets/styles/qwindowsvistastyle.cpp81
-rw-r--r--src/widgets/styles/qwindowsxpstyle.cpp100
-rw-r--r--src/widgets/styles/qwindowsxpstyle_p_p.h42
-rw-r--r--src/widgets/widgets/qabstractslider.cpp10
-rw-r--r--src/widgets/widgets/qlabel.cpp6
-rw-r--r--src/widgets/widgets/qtoolbutton.cpp9
-rw-r--r--src/widgets/widgets/qtoolbutton.h1
-rw-r--r--src/widgets/widgets/qwidgetlinecontrol.cpp2
-rw-r--r--tests/auto/network-settings.h7
-rw-r--r--tests/auto/network/access/qftp/tst_qftp.cpp5
-rw-r--r--tests/auto/widgets/graphicsview/qgraphicslinearlayout/tst_qgraphicslinearlayout.cpp1
-rw-r--r--tests/auto/widgets/styles/qstyle/tst_qstyle.cpp107
46 files changed, 430 insertions, 456 deletions
diff --git a/doc/global/template/style/offline-simple.css b/doc/global/template/style/offline-simple.css
index 5d8ce5c37f..84d206b2d0 100644
--- a/doc/global/template/style/offline-simple.css
+++ b/doc/global/template/style/offline-simple.css
@@ -1,11 +1,6 @@
-body {
- font-size: 10.5pt;
-}
-
pre {
background-color: #f0f0f0;
font-family: Courier, monospace;
- font-size: 11pt;
font-weight: 600;
vertical-align: top;
margin: 15px 85px 15px 35px;
@@ -41,7 +36,6 @@ a[href|="http://"], a[href|="https://"] {
h1.title {
margin-top: 30px;
margin-left: 6px;
- font-size: 24pt;
padding: 6px;
}
@@ -52,7 +46,6 @@ h2, p.h2 {
}
h3 {
- font-size: 12pt;
margin: 30px 0px 30px 6px;
}
@@ -82,7 +75,6 @@ h3.fn, span.fn {
padding: 5px;
text-decoration: none;
font-weight: 400;
- font-size: 12pt;
margin: 45px 0px 0px 6px;
}
@@ -107,7 +99,6 @@ table tr.odd {
table.qmlname td {
padding: 0px;
margin-left: 6px;
- font-size: 12pt;
}
table.qmlname p .name,
@@ -124,13 +115,8 @@ h3.fn .name, h3.fn .type {
margin-right: 6px;
}
-tr > td > pre {
- font-size: 10.5pt;
-}
-
code {
font-family: Courier, monospace;
- font-size: 12pt;
font-weight: 400;
}
@@ -167,7 +153,7 @@ td#buildversion {
.footer, .footer p {
padding: 5px 0px 5px 0px;
margin: 45px 15px 5px 15px;
- font-size: 7.5pt;
+ font-size: 8.5pt;
background-color: #cccccc;
}
diff --git a/examples/widgets/gestures/imagegestures/imagewidget.cpp b/examples/widgets/gestures/imagegestures/imagewidget.cpp
index 19311b0838..ca9affca70 100644
--- a/examples/widgets/gestures/imagegestures/imagewidget.cpp
+++ b/examples/widgets/gestures/imagegestures/imagewidget.cpp
@@ -1,4 +1,3 @@
-
/****************************************************************************
**
** Copyright (C) 2016 The Qt Company Ltd.
diff --git a/examples/xml/htmlinfo/nokia_com.html b/examples/xml/htmlinfo/nokia_com.html
deleted file mode 100644
index 46d4c95ee6..0000000000
--- a/examples/xml/htmlinfo/nokia_com.html
+++ /dev/null
@@ -1,215 +0,0 @@
-
-
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
- "http://www.w3.org/TR/html4/loose.dtd">
-
-<html>
-<head>
-
-
- <!--startindex-->
- <title>Nokia - Nokia on the Web</title>
-
-
- <meta name="description" content="Nokia is the world's leading mobile phone supplier and a leading supplier of mobile and fixed telecom networks including related customer services."/>
- <meta name="keywords" content="Nokia,mobile phones,cellular,telecommunications,wireless networks,datacom,GSM,multimedia terminals,handsets,customer services,press releases,financial information,student exchange,open positions,employment opportunities,career opportunities"/>
- <meta name="modified" content=""/>
- <meta name="category" content="Landing Page Global Flash"/>
- <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
- <meta name="siteid" content="101"/>
-
- <!--stopindex-->
- <link href="/css/style_46.css" rel="stylesheet" type="text/css">
-
- <link href="/NOKIA_COM_1/Home/Landing_page_2007/wayfinder.css" rel="stylesheet" type="text/css"/>
-
-<script type="text/javascript">
- var useHbx = true;
-</script>
-
-
-<!--WEBSIDESTORY CODE HBX1.0 (Universal)-->
-<!--COPYRIGHT 1997-2005 WEBSIDESTORY,INC. ALL RIGHTS RESERVED. U.S.PATENT No. 6,393,479B1. MORE INFO:http://websidestory.com/privacy-->
-<script language="javascript">
-var _hbEC=0,_hbE=new Array;function _hbEvent(a,b){b=_hbE[_hbEC++]=new Object();b._N=a;b._C=0;return b;}
-var hbx=_hbEvent("pv");hbx.vpc="HBX0100u";hbx.gn="ehg-nokiafin.hitbox.com";
-
-//BEGIN EDITABLE SECTION
-//CONFIGURATION VARIABLES
-hbx.acct="DM550514HPNZ";//ACCOUNT NUMBER(S)
-hbx.pn="Home";//PAGE NAME(S)
-hbx.mlc="/Home";//MULTI-LEVEL CONTENT CATEGORY
-hbx.pndef="title";//DEFAULT PAGE NAME
-hbx.ctdef="full";//DEFAULT CONTENT CATEGORY
-
-//OPTIONAL PAGE VARIABLES
-//ACTION SETTINGS
-hbx.fv="";//FORM VALIDATION MINIMUM ELEMENTS OR SUBMIT FUNCTION NAME
-hbx.lt="none";//LINK TRACKING
-hbx.dlf="n";//DOWNLOAD FILTER
-hbx.dft="n";//DOWNLOAD FILE NAMING
-hbx.elf="n";//EXIT LINK FILTER
-
-//SEGMENTS AND FUNNELS
-hbx.seg="";//VISITOR SEGMENTATION
-hbx.fnl="";//FUNNELS
-
-//CAMPAIGNS
-hbx.cmp="";//CAMPAIGN ID
-hbx.cmpn="";//CAMPAIGN ID IN QUERY
-hbx.dcmp="";//DYNAMIC CAMPAIGN ID
-hbx.dcmpn="";//DYNAMIC CAMPAIGN ID IN QUERY
-hbx.dcmpe="";//DYNAMIC CAMPAIGN EXPIRATION
-hbx.dcmpre="";//DYNAMIC CAMPAIGN RESPONSE EXPIRATION
-hbx.hra="";//RESPONSE ATTRIBUTE
-hbx.hqsr="";//RESPONSE ATTRIBUTE IN REFERRAL QUERY
-hbx.hqsp="";//RESPONSE ATTRIBUTE IN QUERY
-hbx.hlt="";//LEAD TRACKING
-hbx.hla="";//LEAD ATTRIBUTE
-hbx.gp="";//CAMPAIGN GOAL
-hbx.gpn="";//CAMPAIGN GOAL IN QUERY
-hbx.hcn="";//CONVERSION ATTRIBUTE
-hbx.hcv="";//CONVERSION VALUE
-hbx.cp="null";//LEGACY CAMPAIGN
-hbx.cpd="";//CAMPAIGN DOMAIN
-
-//CUSTOM VARIABLES
-hbx.ci="";//CUSTOMER ID
-hbx.hc1="";//CUSTOM 1
-hbx.hc2="";//CUSTOM 2
-hbx.hc3="";//CUSTOM 3
-hbx.hc4="";//CUSTOM 4
-hbx.hrf="";//CUSTOM REFERRER
-hbx.pec="";//ERROR CODES
-
-
-var cookieName = 'MyNokia';
-var nameEQ = cookieName + "=";
-var ca = document.cookie.split(';');
-for(var i=0;i < ca.length;i++) {
- var c = ca[i];
- while (c.charAt(0)==' ') c = c.substring(1,c.length);
- if (c.indexOf(nameEQ) == 0) {
- hbx.ci = c.substring(nameEQ.length,c.length);
- }
-}
-
-//INSERT CUSTOM EVENTS
-hbx.acct="DM550514HPNZ";
-hbx.mlc="/Home";
-hbx.pn="Home";
-hbx.lt="auto";
-
-
-//END EDITABLE SECTION
-
-//REQUIRED SECTION. CHANGE "YOURSERVER" TO VALID LOCATION ON YOUR WEB SERVER (HTTPS IF FROM SECURE SERVER)
-</script><script language="javascript1.1" defer src="/Hitbox/hbx_5.js"></script>
-<script language="javascript">if(navigator.appName!='Netscape'&&parseInt(navigator.appVersion)==4)document.write("<\!"+"--")</script><noscript>
-<img src="http://ehg-nokiafin.hitbox.com/HG?hc=we88&cd=1&hv=6&ce=u&hb=DM550514HPNZ&n=Home&vcon=/Home&seg=&cmp=&gp=&fnl=&pec=&dcmp=&ra=&gn=&cv=&ld=&la=&c1=&c2=&c3=&c4=&vpc=090101rn" border="0" width="1" height="1">
-</noscript><!--//-->
-
-<!--END WEBSIDESTORY CODE-->
-
-
-
-
-
-</head>
-<body lang='en'
- style="margin: 0 0 0 0;" bgcolor="#FFFFFF" link="#0033cc" text="#000000" alink="#0033cc" vlink="#800080">
- <div class="pagecontainer">
-
-
-<!-- start page template [Generated JSP Servlet: class=jsp_servlet._templates._page.__template6layout] -->
-
-
-
-
-
-
-
-
-
-
- <!--startindex-->
-
-
-
-<!-- Begin template '/templates/content/plain.jsp' -->
-
-<div id="wayfinderContainer">
- <div id="branding">
- <img src="/NOKIA_COM_1/Home/Landing_page_2007/noflash_img/nokia_connecting_people.png" alt="Nokia - Connecting people" />
-
- </div>
-
- <div id="flashcontent">
-
- <!-- main page noflash content -->
- <div id="mainContentGlobal">
- <div id="mainHdr"><h1>Welcome to Nokia</h1></div>
- <div id="selectContainer">
- <h2>Where would you like to go?</h2>
- <div id="selectLinks">
- <ul class="mainpage">
- <li><a href="/A4176248">Africa</a></li>
- <li><a href="/A4138125">Asia Pacific</a></li>
- <li><a href="/A4138121">Europe</a></li>
- <li><a href="/A4138127">Latin America</a></li>
- <li><a href="/A4176245">Middle East</a></li>
- <li><a href="/A4138126">North America</a></li>
- </ul>
- </div>
- </div>
- <!-- <a id="banner" href="http://www.nokia.com/seasonsgreetings/">Seasons Greetings</a> -->
- </div>
- <div id="navi">
- <ul>
- <li><a href="http://www.nokiaforbusiness.com/">Nokia for Business</a></li>
- <li><a href="http://www.nokia.com/aboutnokia">About Nokia</a></li>
- <li><a href="http://www.nokia.com/developers">Developers</a></li>
- <li><a href="http://www.nokia.com/press">Press</a></li>
- <li class="lastitem"><a href="http://www.nokia.com/investors">Investors</a></li>
- <!-- <li class="lastitem"><a href="http://www.nokia.com/environment">Environment</a></li> -->
- </ul>
- </div>
- <!-- noflash content ends -->
-
- </div>
-
- <div id="footer">
- <ul>
- <li><a href="http://www.nokia.com/siteterms">Site Terms</a></li>
- <li class="lastitem"><a href="http://www.nokia.com/privacypolicy">Privacy Policy</a></li>
- <span>Copyright &copy; 2008 Nokia. All rights reserved</span>
- </ul>
- <br /><br />
- </div>
-</div>
-
-<script type="text/javascript" src="/NOKIA_COM_1/javascript/flash_detection_main.js"></script> <!-- for redirection to mobile site -->
-<script type="text/javascript" src="/EUROPE_NOKIA_COM_3/flash/swfobject.js"></script>
-<script type="text/javascript" src="/NOKIA_COM_1/javascript/cookies.js"></script>
-<script type="text/javascript" >
- // <![CDATA[
- var so = new SWFObject("/NOKIA_COM_1/Home/Landing_page_2007/wayfinder_assets.swf", "wayfinder", "736", "560", "7");
- so.addParam("allowscriptaccess", "always");
- so.addParam("base", "/NOKIA_COM_1/Home/Landing_page_2007/");
- so.write("flashcontent");
- // ]]>
-</script>
-
-<!-- End template '/templates/content/plain.jsp' -->
- <!--stopindex-->
-
-
-
-
-
- </div>
-</body>
-
-
- </html>
-
diff --git a/examples/xml/htmlinfo/resources.qrc b/examples/xml/htmlinfo/resources.qrc
index a8cf88d57b..f427d9db10 100644
--- a/examples/xml/htmlinfo/resources.qrc
+++ b/examples/xml/htmlinfo/resources.qrc
@@ -1,7 +1,6 @@
<RCC>
<qresource prefix="/">
<file>apache_org.html</file>
- <file>nokia_com.html</file>
<file>simpleexample.html</file>
<file>trolltech_com.html</file>
<file>w3c_org.html</file>
diff --git a/qmake/generators/win32/msvc_vcproj.cpp b/qmake/generators/win32/msvc_vcproj.cpp
index c2b285ddc4..a972316972 100644
--- a/qmake/generators/win32/msvc_vcproj.cpp
+++ b/qmake/generators/win32/msvc_vcproj.cpp
@@ -1310,8 +1310,8 @@ void VcprojGenerator::initDeploymentTool()
+ "|0;";
if (!qpaPluginDeployed) {
QChar debugInfixChar;
- bool foundGuid = false;
- if (foundGuid = dllName.contains(QLatin1String("Guid")))
+ bool foundGuid = dllName.contains(QLatin1String("Guid"));
+ if (foundGuid)
debugInfixChar = QLatin1Char('d');
if (foundGuid || dllName.contains(QLatin1String("Gui"))) {
diff --git a/src/angle/src/config.pri b/src/angle/src/config.pri
index fddb395ab2..2c5b5ec615 100644
--- a/src/angle/src/config.pri
+++ b/src/angle/src/config.pri
@@ -97,8 +97,6 @@ gcc {
-Wno-strict-aliasing -Wno-type-limits -Wno-unused-local-typedefs
QMAKE_CXXFLAGS_WARN_ON = $$QMAKE_CFLAGS_WARN_ON -Wno-reorder -Wno-conversion-null -Wno-delete-non-virtual-dtor
-
- sse2: QMAKE_CXXFLAGS += -march=native
}
QMAKE_CXXFLAGS_DEBUG = $$QMAKE_CFLAGS_DEBUG
diff --git a/src/angle/src/libGLESv2/libGLESv2.pro b/src/angle/src/libGLESv2/libGLESv2.pro
index 1da079fd40..c90f3d326e 100644
--- a/src/angle/src/libGLESv2/libGLESv2.pro
+++ b/src/angle/src/libGLESv2/libGLESv2.pro
@@ -205,7 +205,6 @@ SOURCES += \
$$ANGLE_DIR/src/libANGLE/renderer/d3d/IndexBuffer.cpp \
$$ANGLE_DIR/src/libANGLE/renderer/d3d/IndexDataManager.cpp \
$$ANGLE_DIR/src/libANGLE/renderer/d3d/loadimage.cpp \
- $$ANGLE_DIR/src/libANGLE/renderer/d3d/loadimageSSE2.cpp \
$$ANGLE_DIR/src/libANGLE/renderer/d3d/ProgramD3D.cpp \
$$ANGLE_DIR/src/libANGLE/renderer/d3d/RenderbufferD3D.cpp \
$$ANGLE_DIR/src/libANGLE/renderer/d3d/RendererD3D.cpp \
@@ -227,6 +226,7 @@ SOURCES += \
$$ANGLE_DIR/src/libGLESv2/global_state.cpp \
$$ANGLE_DIR/src/libGLESv2/libGLESv2.cpp
+SSE2_SOURCES += $$ANGLE_DIR/src/libANGLE/renderer/d3d/loadimageSSE2.cpp
angle_d3d11 {
HEADERS += \
diff --git a/src/corelib/global/qglobal.h b/src/corelib/global/qglobal.h
index 86ac5d0312..235bae89af 100644
--- a/src/corelib/global/qglobal.h
+++ b/src/corelib/global/qglobal.h
@@ -1010,8 +1010,6 @@ Q_CORE_EXPORT QString qtTrId(const char *id, int n = -1);
#endif // QT_NO_TRANSLATION
-#define QDOC_PROPERTY(text)
-
/*
When RTTI is not available, define this macro to force any uses of
dynamic_cast to cause a compile failure.
diff --git a/src/corelib/io/qdir.cpp b/src/corelib/io/qdir.cpp
index 9b9b00f76d..9efe2fb90e 100644
--- a/src/corelib/io/qdir.cpp
+++ b/src/corelib/io/qdir.cpp
@@ -762,17 +762,13 @@ QString QDir::relativeFilePath(const QString &fileName) const
#endif
QString result;
-#if defined(Q_OS_WIN)
- QStringList dirElts = dir.split(QLatin1Char('/'), QString::SkipEmptyParts);
- QStringList fileElts = file.split(QLatin1Char('/'), QString::SkipEmptyParts);
-#else
QVector<QStringRef> dirElts = dir.splitRef(QLatin1Char('/'), QString::SkipEmptyParts);
QVector<QStringRef> fileElts = file.splitRef(QLatin1Char('/'), QString::SkipEmptyParts);
-#endif
+
int i = 0;
while (i < dirElts.size() && i < fileElts.size() &&
#if defined(Q_OS_WIN)
- dirElts.at(i).toLower() == fileElts.at(i).toLower())
+ dirElts.at(i).compare(fileElts.at(i), Qt::CaseInsensitive) == 0)
#else
dirElts.at(i) == fileElts.at(i))
#endif
diff --git a/src/corelib/itemmodels/qabstractitemmodel.h b/src/corelib/itemmodels/qabstractitemmodel.h
index ce35cf4730..0820626452 100644
--- a/src/corelib/itemmodels/qabstractitemmodel.h
+++ b/src/corelib/itemmodels/qabstractitemmodel.h
@@ -429,7 +429,7 @@ inline Qt::ItemFlags QModelIndex::flags() const
{ return m ? m->flags(*this) : Qt::ItemFlags(); }
inline uint qHash(const QModelIndex &index) Q_DECL_NOTHROW
-{ return uint((index.row() << 4) + index.column() + index.internalId()); }
+{ return uint((uint(index.row()) << 4) + index.column() + index.internalId()); }
QT_END_NAMESPACE
diff --git a/src/corelib/kernel/qobjectdefs.h b/src/corelib/kernel/qobjectdefs.h
index 3d47bae4a0..f8bebdf617 100644
--- a/src/corelib/kernel/qobjectdefs.h
+++ b/src/corelib/kernel/qobjectdefs.h
@@ -62,6 +62,25 @@ class QString;
#define Q_MOC_OUTPUT_REVISION 67
#endif
+// The following macros can be defined by tools that understand Qt
+// to have the information from the macro.
+#ifndef QT_ANNOTATE_CLASS
+# ifndef Q_COMPILER_VARIADIC_MACROS
+# define QT_ANNOTATE_CLASS(type, x)
+# else
+# define QT_ANNOTATE_CLASS(type, ...)
+# endif
+#endif
+#ifndef QT_ANNOTATE_CLASS2
+# define QT_ANNOTATE_CLASS2(type, a1, a2)
+#endif
+#ifndef QT_ANNOTATE_FUNCTION
+# define QT_ANNOTATE_FUNCTION(x)
+#endif
+#ifndef QT_ANNOTATE_ACCESS_SPECIFIER
+# define QT_ANNOTATE_ACCESS_SPECIFIER(x)
+#endif
+
// The following macros are our "extensions" to C++
// They are used, strictly speaking, only by the moc.
@@ -71,38 +90,44 @@ class QString;
# define QT_NO_EMIT
# else
# ifndef QT_NO_SIGNALS_SLOTS_KEYWORDS
-# define slots
-# define signals public
+# define slots Q_SLOTS
+# define signals Q_SIGNALS
# endif
# endif
-# define Q_SLOTS
-# define Q_SIGNALS public
-# define Q_PRIVATE_SLOT(d, signature)
+# define Q_SLOTS QT_ANNOTATE_ACCESS_SPECIFIER(qt_slot)
+# define Q_SIGNALS public QT_ANNOTATE_ACCESS_SPECIFIER(qt_signal)
+# define Q_PRIVATE_SLOT(d, signature) QT_ANNOTATE_CLASS2(qt_private_slot, d, signature)
# define Q_EMIT
#ifndef QT_NO_EMIT
# define emit
#endif
-#define Q_CLASSINFO(name, value)
-#define Q_PLUGIN_METADATA(x)
-#define Q_INTERFACES(x)
+#ifndef Q_CLASSINFO
+# define Q_CLASSINFO(name, value)
+#endif
+#define Q_PLUGIN_METADATA(x) QT_ANNOTATE_CLASS(qt_plugin_metadata, x)
+#define Q_INTERFACES(x) QT_ANNOTATE_CLASS(qt_interfaces, x)
#ifdef Q_COMPILER_VARIADIC_MACROS
-#define Q_PROPERTY(...)
+# define Q_PROPERTY(...) QT_ANNOTATE_CLASS(qt_property, __VA_ARGS__)
#else
-#define Q_PROPERTY(text)
+# define Q_PROPERTY(text) QT_ANNOTATE_CLASS(qt_property, text)
+#endif
+#define Q_PRIVATE_PROPERTY(d, text) QT_ANNOTATE_CLASS2(qt_private_property, d, text)
+#ifndef Q_REVISION
+# define Q_REVISION(v)
#endif
-#define Q_PRIVATE_PROPERTY(d, text)
-#define Q_REVISION(v)
-#define Q_OVERRIDE(text)
-#define Q_ENUMS(x)
-#define Q_FLAGS(x)
-#define Q_ENUM(ENUM) \
+#define Q_OVERRIDE(text) QT_ANNOTATE_CLASS(qt_override, text)
+#define QDOC_PROPERTY(text) QT_ANNOTATE_CLASS(qt_qdoc_property, text)
+#define Q_ENUMS(x) QT_ANNOTATE_CLASS(qt_enums, x)
+#define Q_FLAGS(x) QT_ANNOTATE_CLASS(qt_enums, x)
+#define Q_ENUM_IMPL(ENUM) \
friend Q_DECL_CONSTEXPR const QMetaObject *qt_getEnumMetaObject(ENUM) Q_DECL_NOEXCEPT { return &staticMetaObject; } \
friend Q_DECL_CONSTEXPR const char *qt_getEnumName(ENUM) Q_DECL_NOEXCEPT { return #ENUM; }
-#define Q_FLAG(ENUM) Q_ENUM(ENUM)
-#define Q_SCRIPTABLE
-#define Q_INVOKABLE
-#define Q_SIGNAL
-#define Q_SLOT
+#define Q_ENUM(x) Q_ENUMS(x) Q_ENUM_IMPL(x)
+#define Q_FLAG(x) Q_FLAGS(x) Q_ENUM_IMPL(x)
+#define Q_SCRIPTABLE QT_ANNOTATE_FUNCTION(qt_scriptable)
+#define Q_INVOKABLE QT_ANNOTATE_FUNCTION(qt_invokable)
+#define Q_SIGNAL QT_ANNOTATE_FUNCTION(qt_signal)
+#define Q_SLOT QT_ANNOTATE_FUNCTION(qt_slot)
#endif // QT_NO_META_MACROS
#ifndef QT_NO_TRANSLATION
@@ -180,10 +205,11 @@ private: \
Q_OBJECT_NO_ATTRIBUTES_WARNING \
Q_DECL_HIDDEN_STATIC_METACALL static void qt_static_metacall(QObject *, QMetaObject::Call, int, void **); \
QT_WARNING_POP \
- struct QPrivateSignal {};
+ struct QPrivateSignal {}; \
+ QT_ANNOTATE_CLASS(qt_qobject, "")
/* qmake ignore Q_OBJECT */
-#define Q_OBJECT_FAKE Q_OBJECT
+#define Q_OBJECT_FAKE Q_OBJECT QT_ANNOTATE_CLASS(qt_fake, "")
#ifndef QT_NO_META_MACROS
/* qmake ignore Q_GADGET */
@@ -197,6 +223,7 @@ private: \
Q_OBJECT_NO_ATTRIBUTES_WARNING \
Q_DECL_HIDDEN_STATIC_METACALL static void qt_static_metacall(QObject *, QMetaObject::Call, int, void **); \
QT_WARNING_POP \
+ QT_ANNOTATE_CLASS(qt_qgadget, "") \
/*end*/
#endif // QT_NO_META_MACROS
diff --git a/src/corelib/tools/qdatetimeparser.cpp b/src/corelib/tools/qdatetimeparser.cpp
index bbcd64d34f..73ecd4c47e 100644
--- a/src/corelib/tools/qdatetimeparser.cpp
+++ b/src/corelib/tools/qdatetimeparser.cpp
@@ -606,19 +606,20 @@ int QDateTimeParser::sectionMaxSize(Section s, int count) const
// fall through
#endif
case MonthSection:
- if (count <= 2)
- return 2;
-
#ifdef QT_NO_TEXTDATE
return 2;
#else
+ if (count <= 2)
+ return 2;
+
{
int ret = 0;
const QLocale l = locale();
+ const QLocale::FormatType format = count == 4 ? QLocale::LongFormat : QLocale::ShortFormat;
for (int i=1; i<=mcount; ++i) {
const QString str = (s == MonthSection
- ? l.monthName(i, count == 4 ? QLocale::LongFormat : QLocale::ShortFormat)
- : l.dayName(i, count == 4 ? QLocale::LongFormat : QLocale::ShortFormat));
+ ? l.monthName(i, format)
+ : l.dayName(i, format));
ret = qMax(str.size(), ret);
}
return ret;
diff --git a/src/corelib/tools/qhash.cpp b/src/corelib/tools/qhash.cpp
index 8ab98bd509..2f0886edce 100644
--- a/src/corelib/tools/qhash.cpp
+++ b/src/corelib/tools/qhash.cpp
@@ -1,4 +1,3 @@
-
/****************************************************************************
**
** Copyright (C) 2016 The Qt Company Ltd.
diff --git a/src/corelib/tools/qstring.h b/src/corelib/tools/qstring.h
index ddaab1f544..6676efab41 100644
--- a/src/corelib/tools/qstring.h
+++ b/src/corelib/tools/qstring.h
@@ -1546,9 +1546,9 @@ inline QT_ASCII_CAST_WARN bool QStringRef::operator!=(const char *s) const
inline QT_ASCII_CAST_WARN bool QStringRef::operator<(const char *s) const
{ return QString::compare_helper(constData(), size(), s, -1) < 0; }
inline QT_ASCII_CAST_WARN bool QStringRef::operator<=(const char *s) const
-{ return QString::compare_helper(constData(), size(), s, -1) > 0; }
-inline QT_ASCII_CAST_WARN bool QStringRef::operator>(const char *s) const
{ return QString::compare_helper(constData(), size(), s, -1) <= 0; }
+inline QT_ASCII_CAST_WARN bool QStringRef::operator>(const char *s) const
+{ return QString::compare_helper(constData(), size(), s, -1) > 0; }
inline QT_ASCII_CAST_WARN bool QStringRef::operator>=(const char *s) const
{ return QString::compare_helper(constData(), size(), s, -1) >= 0; }
@@ -1557,13 +1557,13 @@ inline QT_ASCII_CAST_WARN bool operator==(const char *s1, const QStringRef &s2)
inline QT_ASCII_CAST_WARN bool operator!=(const char *s1, const QStringRef &s2)
{ return QString::compare_helper(s2.constData(), s2.size(), s1, -1) != 0; }
inline QT_ASCII_CAST_WARN bool operator<(const char *s1, const QStringRef &s2)
-{ return QString::compare_helper(s2.constData(), s2.size(), s1, -1) < 0; }
-inline QT_ASCII_CAST_WARN bool operator<=(const char *s1, const QStringRef &s2)
{ return QString::compare_helper(s2.constData(), s2.size(), s1, -1) > 0; }
+inline QT_ASCII_CAST_WARN bool operator<=(const char *s1, const QStringRef &s2)
+{ return QString::compare_helper(s2.constData(), s2.size(), s1, -1) >= 0; }
inline QT_ASCII_CAST_WARN bool operator>(const char *s1, const QStringRef &s2)
-{ return QString::compare_helper(s2.constData(), s2.size(), s1, -1) <= 0; }
+{ return QString::compare_helper(s2.constData(), s2.size(), s1, -1) < 0; }
inline QT_ASCII_CAST_WARN bool operator>=(const char *s1, const QStringRef &s2)
-{ return QString::compare_helper(s2.constData(), s2.size(), s1, -1) >= 0; }
+{ return QString::compare_helper(s2.constData(), s2.size(), s1, -1) <= 0; }
#endif // !defined(QT_NO_CAST_FROM_ASCII) && !defined(QT_RESTRICTED_CAST_FROM_ASCII)
inline int QString::compare(const QStringRef &s, Qt::CaseSensitivity cs) const Q_DECL_NOTHROW
diff --git a/src/corelib/tools/qtimezoneprivate.cpp b/src/corelib/tools/qtimezoneprivate.cpp
index dc20bca27f..763d12b702 100644
--- a/src/corelib/tools/qtimezoneprivate.cpp
+++ b/src/corelib/tools/qtimezoneprivate.cpp
@@ -447,22 +447,45 @@ QTimeZone::OffsetData QTimeZonePrivate::toOffsetData(const QTimeZonePrivate::Dat
return offsetData;
}
-// If the format of the ID is valid
+// Is the format of the ID valid ?
bool QTimeZonePrivate::isValidId(const QByteArray &ianaId)
{
- // Rules for defining TZ/IANA names as per ftp://ftp.iana.org/tz/code/Theory
- // 1. Use only valid POSIX file name components
- // 2. Within a file name component, use only ASCII letters, `.', `-' and `_'.
- // 3. Do not use digits
- // 4. A file name component must not exceed 14 characters or start with `-'
- // Aliases such as "Etc/GMT+7" and "SystemV/EST5EDT" are valid so we need to accept digits, ':', and '+'.
-
- // The following would be preferable if QRegExp would work on QByteArrays directly:
- // const QRegExp rx(QStringLiteral("[a-z0-9:+._][a-z0-9:+._-]{,13}(?:/[a-z0-9:+._][a-z0-9:+._-]{,13})*"),
- // Qt::CaseInsensitive);
- // return rx.exactMatch(ianaId);
-
- // hand-rolled version:
+ /*
+ Main rules for defining TZ/IANA names as per ftp://ftp.iana.org/tz/code/Theory
+ 1. Use only valid POSIX file name components
+ 2. Within a file name component, use only ASCII letters, `.', `-' and `_'.
+ 3. Do not use digits (except in a [+-]\d+ suffix, when used).
+ 4. A file name component must not exceed 14 characters or start with `-'
+ However, the rules are really guidelines - a later one says
+ - Do not change established names if they only marginally violate the
+ above rules.
+ We may, therefore, need to be a bit slack in our check here, if we hit
+ legitimate exceptions in real time-zone databases.
+
+ In particular, aliases such as "Etc/GMT+7" and "SystemV/EST5EDT" are valid
+ so we need to accept digits, ':', and '+'; aliases typically have the form
+ of POSIX TZ strings, which allow a suffix to a proper IANA name. A POSIX
+ suffix starts with an offset (as in GMT+7) and may continue with another
+ name (as in EST5EDT, giving the DST name of the zone); a further offset is
+ allowed (for DST). The ("hard to describe and [...] error-prone in
+ practice") POSIX form even allows a suffix giving the dates (and
+ optionally times) of the annual DST transitions. Hopefully, no TZ aliases
+ go that far, but we at least need to accept an offset and (single
+ fragment) DST-name.
+
+ But for the legacy complications, the following would be preferable if
+ QRegExp would work on QByteArrays directly:
+ const QRegExp rx(QStringLiteral("[a-z+._][a-z+._-]{,13}"
+ "(?:/[a-z+._][a-z+._-]{,13})*"
+ // Optional suffix:
+ "(?:[+-]?\d{1,2}(?::\d{1,2}){,2}" // offset
+ // one name fragment (DST):
+ "(?:[a-z+._][a-z+._-]{,13})?)"),
+ Qt::CaseInsensitive);
+ return rx.exactMatch(ianaId);
+ */
+
+ // Somewhat slack hand-rolled version:
const int MinSectionLength = 1;
const int MaxSectionLength = 14;
int sectionLength = 0;
@@ -478,11 +501,11 @@ bool QTimeZonePrivate::isValidId(const QByteArray &ianaId)
} else if (!(ch >= 'a' && ch <= 'z')
&& !(ch >= 'A' && ch <= 'Z')
&& !(ch == '_')
+ && !(ch == '.')
+ // Should ideally check these only happen as an offset:
&& !(ch >= '0' && ch <= '9')
- && !(ch == '-')
&& !(ch == '+')
- && !(ch == ':')
- && !(ch == '.')) {
+ && !(ch == ':')) {
return false; // violates (2)
}
}
diff --git a/src/gui/kernel/qopenglcontext.cpp b/src/gui/kernel/qopenglcontext.cpp
index 81c0971ea0..59bf2bb065 100644
--- a/src/gui/kernel/qopenglcontext.cpp
+++ b/src/gui/kernel/qopenglcontext.cpp
@@ -516,8 +516,10 @@ void QOpenGLContext::setScreen(QScreen *screen)
void QOpenGLContextPrivate::_q_screenDestroyed(QObject *object)
{
Q_Q(QOpenGLContext);
- if (object == static_cast<QObject *>(screen))
+ if (object == static_cast<QObject *>(screen)) {
+ screen = 0;
q->setScreen(0);
+ }
}
/*!
diff --git a/src/gui/painting/qpaintengine_raster.cpp b/src/gui/painting/qpaintengine_raster.cpp
index 4ab029cf7a..348ccfffda 100644
--- a/src/gui/painting/qpaintengine_raster.cpp
+++ b/src/gui/painting/qpaintengine_raster.cpp
@@ -3893,7 +3893,7 @@ void QClipData::setClipRect(const QRect &rect)
void QClipData::setClipRegion(const QRegion &region)
{
if (region.rectCount() == 1) {
- setClipRect(region.rects().at(0));
+ setClipRect(region.boundingRect());
return;
}
diff --git a/src/gui/painting/qpdf.cpp b/src/gui/painting/qpdf.cpp
index f83f1c997e..10f0fcc21d 100644
--- a/src/gui/painting/qpdf.cpp
+++ b/src/gui/painting/qpdf.cpp
@@ -1562,6 +1562,7 @@ void QPdfEnginePrivate::embedFont(QFontSubset *font)
int toUnicode = requestObject();
QFontEngine::Properties properties = font->fontEngine->properties();
+ QByteArray postscriptName = properties.postscriptName.replace(' ', '_');
{
qreal scale = 1000/properties.emSquare.toReal();
@@ -1575,7 +1576,7 @@ void QPdfEnginePrivate::embedFont(QFontSubset *font)
s << (char)('A' + (tag % 26));
tag /= 26;
}
- s << '+' << properties.postscriptName << "\n"
+ s << '+' << postscriptName << "\n"
"/Flags " << 4 << "\n"
"/FontBBox ["
<< properties.boundingBox.x()*scale
@@ -1618,7 +1619,7 @@ void QPdfEnginePrivate::embedFont(QFontSubset *font)
QPdf::ByteStream s(&cid);
s << "<< /Type /Font\n"
"/Subtype /CIDFontType2\n"
- "/BaseFont /" << properties.postscriptName << "\n"
+ "/BaseFont /" << postscriptName << "\n"
"/CIDSystemInfo << /Registry (Adobe) /Ordering (Identity) /Supplement 0 >>\n"
"/FontDescriptor " << fontDescriptor << "0 R\n"
"/CIDToGIDMap /Identity\n"
@@ -1642,7 +1643,7 @@ void QPdfEnginePrivate::embedFont(QFontSubset *font)
QPdf::ByteStream s(&font);
s << "<< /Type /Font\n"
"/Subtype /Type0\n"
- "/BaseFont /" << properties.postscriptName << "\n"
+ "/BaseFont /" << postscriptName << "\n"
"/Encoding /Identity-H\n"
"/DescendantFonts [" << cidfont << "0 R]\n"
"/ToUnicode " << toUnicode << "0 R"
diff --git a/src/network/access/qftp.cpp b/src/network/access/qftp.cpp
index ac6a5f46b1..59f18015a5 100644
--- a/src/network/access/qftp.cpp
+++ b/src/network/access/qftp.cpp
@@ -617,7 +617,7 @@ bool QFtpDTP::parseDir(const QByteArray &buffer, const QString &userName, QUrlIn
if (buffer.isEmpty())
return false;
- QString bufferStr = QString::fromLatin1(buffer).trimmed();
+ QString bufferStr = QString::fromUtf8(buffer).trimmed();
// Unix style FTP servers
QRegExp unixPattern(QLatin1String("^([\\-dl])([a-zA-Z\\-]{9,9})\\s+\\d+\\s+(\\S*)\\s+"
@@ -682,7 +682,7 @@ void QFtpDTP::socketReadyRead()
// does not exist, but rather write a text to the data socket
// -- try to catch these cases
if (line.endsWith("No such file or directory\r\n"))
- err = QString::fromLatin1(line);
+ err = QString::fromUtf8(line);
}
}
} else {
@@ -938,7 +938,7 @@ void QFtpPI::readyRead()
while (commandSocket.canReadLine()) {
// read line with respect to line continuation
- QString line = QString::fromLatin1(commandSocket.readLine());
+ QString line = QString::fromUtf8(commandSocket.readLine());
if (replyText.isEmpty()) {
if (line.length() < 3) {
// protocol error
@@ -970,7 +970,7 @@ void QFtpPI::readyRead()
replyText += line;
if (!commandSocket.canReadLine())
return;
- line = QString::fromLatin1(commandSocket.readLine());
+ line = QString::fromUtf8(commandSocket.readLine());
lineLeft4 = line.leftRef(4);
}
replyText += line.midRef(4); // strip reply code 'xyz '
@@ -1221,7 +1221,7 @@ bool QFtpPI::startNextCmd()
qDebug("QFtpPI send: %s", currentCmd.left(currentCmd.length()-2).toLatin1().constData());
#endif
state = Waiting;
- commandSocket.write(currentCmd.toLatin1());
+ commandSocket.write(currentCmd.toUtf8());
return true;
}
diff --git a/src/network/socket/qlocalsocket_win.cpp b/src/network/socket/qlocalsocket_win.cpp
index 245108911e..5fc34c3ed6 100644
--- a/src/network/socket/qlocalsocket_win.cpp
+++ b/src/network/socket/qlocalsocket_win.cpp
@@ -39,10 +39,6 @@
#include "qlocalsocket_p.h"
-#include <private/qthread_p.h>
-#include <qcoreapplication.h>
-#include <qdebug.h>
-
QT_BEGIN_NAMESPACE
void QLocalSocketPrivate::init()
diff --git a/src/plugins/platforms/direct2d/qwindowsdirect2dhelpers.h b/src/plugins/platforms/direct2d/qwindowsdirect2dhelpers.h
index d8bf8c4a07..97715ad050 100644
--- a/src/plugins/platforms/direct2d/qwindowsdirect2dhelpers.h
+++ b/src/plugins/platforms/direct2d/qwindowsdirect2dhelpers.h
@@ -50,37 +50,37 @@
QT_BEGIN_NAMESPACE
-Q_DECL_CONSTEXPR inline D2D1_RECT_U to_d2d_rect_u(const QRect &qrect)
+inline D2D1_RECT_U to_d2d_rect_u(const QRect &qrect)
{
return D2D1::RectU(qrect.x(), qrect.y(), qrect.x() + qrect.width(), qrect.y() + qrect.height());
}
-Q_DECL_CONSTEXPR inline D2D1_RECT_F to_d2d_rect_f(const QRectF &qrect)
+inline D2D1_RECT_F to_d2d_rect_f(const QRectF &qrect)
{
return D2D1::RectF(qrect.x(), qrect.y(), qrect.x() + qrect.width(), qrect.y() + qrect.height());
}
-Q_DECL_CONSTEXPR inline D2D1_SIZE_U to_d2d_size_u(const QSizeF &qsize)
+inline D2D1_SIZE_U to_d2d_size_u(const QSizeF &qsize)
{
return D2D1::SizeU(qsize.width(), qsize.height());
}
-Q_DECL_CONSTEXPR inline D2D1_SIZE_U to_d2d_size_u(const QSize &qsize)
+inline D2D1_SIZE_U to_d2d_size_u(const QSize &qsize)
{
return D2D1::SizeU(qsize.width(), qsize.height());
}
-Q_DECL_CONSTEXPR inline D2D1_POINT_2F to_d2d_point_2f(const QPointF &qpoint)
+inline D2D1_POINT_2F to_d2d_point_2f(const QPointF &qpoint)
{
return D2D1::Point2F(qpoint.x(), qpoint.y());
}
-Q_DECL_CONSTEXPR inline D2D1::ColorF to_d2d_color_f(const QColor &c)
+inline D2D1::ColorF to_d2d_color_f(const QColor &c)
{
return D2D1::ColorF(c.redF(), c.greenF(), c.blueF(), c.alphaF());
}
-Q_DECL_CONSTEXPR inline D2D1_MATRIX_3X2_F to_d2d_matrix_3x2_f(const QTransform &transform)
+inline D2D1_MATRIX_3X2_F to_d2d_matrix_3x2_f(const QTransform &transform)
{
return D2D1::Matrix3x2F(transform.m11(), transform.m12(),
transform.m21(), transform.m22(),
diff --git a/src/plugins/platforms/windows/qwindowscursor.cpp b/src/plugins/platforms/windows/qwindowscursor.cpp
index 0eb7043bbc..d02648fade 100644
--- a/src/plugins/platforms/windows/qwindowscursor.cpp
+++ b/src/plugins/platforms/windows/qwindowscursor.cpp
@@ -103,9 +103,9 @@ QWindowsPixmapCursorCacheKey::QWindowsPixmapCursorCacheKey(const QCursor &c)
HCURSOR QWindowsCursor::createPixmapCursor(QPixmap pixmap, const QPoint &hotSpot, qreal scaleFactor)
{
HCURSOR cur = 0;
- scaleFactor /= pixmap.devicePixelRatioF();
- if (!qFuzzyCompare(scaleFactor, 1)) {
- pixmap = pixmap.scaled((scaleFactor * QSizeF(pixmap.size())).toSize(),
+ const qreal pixmapScaleFactor = scaleFactor / pixmap.devicePixelRatioF();
+ if (!qFuzzyCompare(pixmapScaleFactor, 1)) {
+ pixmap = pixmap.scaled((pixmapScaleFactor * QSizeF(pixmap.size())).toSize(),
Qt::KeepAspectRatio, Qt::SmoothTransformation);
}
QBitmap mask = pixmap.mask();
@@ -119,8 +119,8 @@ HCURSOR QWindowsCursor::createPixmapCursor(QPixmap pixmap, const QPoint &hotSpot
ICONINFO ii;
ii.fIcon = 0;
- ii.xHotspot = DWORD(hotSpot.x());
- ii.yHotspot = DWORD(hotSpot.y());
+ ii.xHotspot = DWORD(qRound(hotSpot.x() * scaleFactor));
+ ii.yHotspot = DWORD(qRound(hotSpot.y() * scaleFactor));
ii.hbmMask = im;
ii.hbmColor = ic;
diff --git a/src/plugins/platforms/windows/qwindowsintegration.cpp b/src/plugins/platforms/windows/qwindowsintegration.cpp
index e0ebb142f5..9486dd84f0 100644
--- a/src/plugins/platforms/windows/qwindowsintegration.cpp
+++ b/src/plugins/platforms/windows/qwindowsintegration.cpp
@@ -347,10 +347,14 @@ QPlatformWindow *QWindowsIntegration::createPlatformWindow(QWindow *window) cons
if (requested.flags != obtained.flags)
window->setFlags(obtained.flags);
- // Trigger geometry/screen change signals of QWindow.
+ // Trigger geometry change (unless it has a special state in which case setWindowState()
+ // will send the message) and screen change signals of QWindow.
if ((obtained.flags & Qt::Desktop) != Qt::Desktop) {
- if (requested.geometry != obtained.geometry)
+ const Qt::WindowState state = window->windowState();
+ if (state != Qt::WindowMaximized && state != Qt::WindowFullScreen
+ && requested.geometry != obtained.geometry) {
QWindowSystemInterface::handleGeometryChange(window, obtained.geometry);
+ }
QPlatformScreen *screen = result->screenForGeometry(obtained.geometry);
if (screen && result->screen() != screen)
QWindowSystemInterface::handleWindowScreenChanged(window, screen->screen());
diff --git a/src/plugins/platforms/windows/qwindowsnativeinterface.cpp b/src/plugins/platforms/windows/qwindowsnativeinterface.cpp
index babca35149..e0ae111b9a 100644
--- a/src/plugins/platforms/windows/qwindowsnativeinterface.cpp
+++ b/src/plugins/platforms/windows/qwindowsnativeinterface.cpp
@@ -163,8 +163,10 @@ void *QWindowsNativeInterface::nativeResourceForIntegration(const QByteArray &re
#ifdef QT_NO_OPENGL
Q_UNUSED(resource)
#else
- if (resourceType(resource) == GlHandleType)
- return QWindowsIntegration::staticOpenGLContext()->moduleHandle();
+ if (resourceType(resource) == GlHandleType) {
+ if (const QWindowsStaticOpenGLContext *sc = QWindowsIntegration::staticOpenGLContext())
+ return sc->moduleHandle();
+ }
#endif
return 0;
diff --git a/src/plugins/platforms/winrt/qwinrttheme.cpp b/src/plugins/platforms/winrt/qwinrttheme.cpp
index c9bebafea5..e9938894e6 100644
--- a/src/plugins/platforms/winrt/qwinrttheme.cpp
+++ b/src/plugins/platforms/winrt/qwinrttheme.cpp
@@ -358,7 +358,7 @@ QVariant QWinRTTheme::styleHint(QPlatformIntegration::StyleHint hint)
case QPlatformIntegration::PasswordMaskCharacter:
return defaultThemeHint(PasswordMaskCharacter);
case QPlatformIntegration::SetFocusOnTouchRelease:
- return false;
+ return true;
case QPlatformIntegration::ShowIsMaximized:
return true;
case QPlatformIntegration::MousePressAndHoldInterval:
diff --git a/src/plugins/platforms/xcb/qxcbkeyboard.cpp b/src/plugins/platforms/xcb/qxcbkeyboard.cpp
index a16e24061c..48912e0520 100644
--- a/src/plugins/platforms/xcb/qxcbkeyboard.cpp
+++ b/src/plugins/platforms/xcb/qxcbkeyboard.cpp
@@ -1002,7 +1002,6 @@ QList<int> QXcbKeyboard::possibleKeys(const QKeyEvent *event) const
Q_ASSERT(shiftMod < 32);
Q_ASSERT(altMod < 32);
Q_ASSERT(controlMod < 32);
- Q_ASSERT(metaMod < 32);
xkb_mod_mask_t depressed;
int qtKey = 0;
@@ -1023,7 +1022,7 @@ QList<int> QXcbKeyboard::possibleKeys(const QKeyEvent *event) const
depressed |= (1 << shiftMod);
if (neededMods & Qt::ControlModifier)
depressed |= (1 << controlMod);
- if (neededMods & Qt::MetaModifier)
+ if (metaMod < 32 && neededMods & Qt::MetaModifier)
depressed |= (1 << metaMod);
xkb_state_update_mask(kb_state, depressed, latchedMods, lockedMods, 0, 0, lockedLayout);
sym = xkb_state_key_get_one_sym(kb_state, keycode);
diff --git a/src/tools/qlalr/recognizer.cpp b/src/tools/qlalr/recognizer.cpp
index b2aa70a98f..ca2551707e 100644
--- a/src/tools/qlalr/recognizer.cpp
+++ b/src/tools/qlalr/recognizer.cpp
@@ -1,4 +1,3 @@
-
/****************************************************************************
**
** Copyright (C) 2016 The Qt Company Ltd.
diff --git a/src/tools/qlalr/recognizer.h b/src/tools/qlalr/recognizer.h
index a2ac1fc8df..ac05d9f33f 100644
--- a/src/tools/qlalr/recognizer.h
+++ b/src/tools/qlalr/recognizer.h
@@ -1,4 +1,3 @@
-
/****************************************************************************
**
** Copyright (C) 2016 The Qt Company Ltd.
diff --git a/src/widgets/dialogs/qfontdialog.cpp b/src/widgets/dialogs/qfontdialog.cpp
index a0525f6fbd..2a500d3a08 100644
--- a/src/widgets/dialogs/qfontdialog.cpp
+++ b/src/widgets/dialogs/qfontdialog.cpp
@@ -106,7 +106,7 @@ QFontListView::QFontListView(QWidget *parent)
}
static const Qt::WindowFlags DefaultWindowFlags =
- Qt::Dialog | Qt::WindowSystemMenuHint;
+ Qt::Dialog | Qt::WindowSystemMenuHint | Qt::WindowCloseButtonHint;
QFontDialogPrivate::QFontDialogPrivate()
: writingSystem(QFontDatabase::Any),
diff --git a/src/widgets/itemviews/qheaderview.cpp b/src/widgets/itemviews/qheaderview.cpp
index 2b3e1f1732..e046e4781f 100644
--- a/src/widgets/itemviews/qheaderview.cpp
+++ b/src/widgets/itemviews/qheaderview.cpp
@@ -1499,7 +1499,8 @@ bool QHeaderView::stretchLastSection() const
void QHeaderView::setStretchLastSection(bool stretch)
{
Q_D(QHeaderView);
- const bool changedStretchMode = (d->stretchLastSection != stretch);
+ if (d->stretchLastSection == stretch)
+ return;
d->stretchLastSection = stretch;
if (d->state != QHeaderViewPrivate::NoState)
return;
@@ -1507,8 +1508,7 @@ void QHeaderView::setStretchLastSection(bool stretch)
d->setNewLastSection(d->lastVisibleVisualIndex());
resizeSections();
} else {
- if (changedStretchMode)
- d->restoreSizeOnPrevLastSection();
+ d->restoreSizeOnPrevLastSection();
}
}
diff --git a/src/widgets/styles/qcommonstyle.cpp b/src/widgets/styles/qcommonstyle.cpp
index 63024360ae..437becbf70 100644
--- a/src/widgets/styles/qcommonstyle.cpp
+++ b/src/widgets/styles/qcommonstyle.cpp
@@ -803,10 +803,8 @@ static void drawArrow(const QStyle *style, const QStyleOptionToolButton *toolbut
default:
return;
}
- QStyleOption arrowOpt;
+ QStyleOption arrowOpt = *toolbutton;
arrowOpt.rect = rect;
- arrowOpt.palette = toolbutton->palette;
- arrowOpt.state = toolbutton->state;
style->drawPrimitive(pe, &arrowOpt, painter, widget);
}
#endif // QT_NO_TOOLBUTTON
@@ -3345,8 +3343,7 @@ void QCommonStyle::drawComplexControl(ComplexControl cc, const QStyleOptionCompl
mflags |= State_Sunken;
}
- QStyleOption tool(0);
- tool.palette = toolbutton->palette;
+ QStyleOption tool = *toolbutton;
if (toolbutton->subControls & SC_ToolButton) {
if (bflags & (State_Sunken | State_On | State_Raised)) {
tool.rect = button;
@@ -3415,8 +3412,7 @@ void QCommonStyle::drawComplexControl(ComplexControl cc, const QStyleOptionCompl
bool down = false;
QPixmap pm;
- QStyleOption tool(0);
- tool.palette = tb->palette;
+ QStyleOption tool = *tb;
if (tb->subControls & SC_TitleBarCloseButton && tb->titleBarFlags & Qt::WindowSystemMenuHint) {
ir = proxy()->subControlRect(CC_TitleBar, tb, SC_TitleBarCloseButton, widget);
down = tb->activeSubControls & SC_TitleBarCloseButton && (opt->state & State_Sunken);
diff --git a/src/widgets/styles/qstyleanimation.cpp b/src/widgets/styles/qstyleanimation.cpp
index 67e2ee3225..0b8e32be19 100644
--- a/src/widgets/styles/qstyleanimation.cpp
+++ b/src/widgets/styles/qstyleanimation.cpp
@@ -273,6 +273,7 @@ static QImage blendedImage(const QImage &start, const QImage &end, float alpha)
case 32:
{
blended = QImage(sw, sh, start.format());
+ blended.setDevicePixelRatio(start.devicePixelRatio());
uchar *mixed_data = blended.bits();
const uchar *back_data = start.bits();
const uchar *front_data = end.bits();
diff --git a/src/widgets/styles/qwindowsstyle.cpp b/src/widgets/styles/qwindowsstyle.cpp
index 2ef227762b..23f886e5b1 100644
--- a/src/widgets/styles/qwindowsstyle.cpp
+++ b/src/widgets/styles/qwindowsstyle.cpp
@@ -117,8 +117,6 @@ enum QSliderDirection { SlUp, SlDown, SlLeft, SlRight };
\internal
*/
-int QWindowsStylePrivate::m_appDevicePixelRatio = 0;
-
QWindowsStylePrivate::QWindowsStylePrivate()
: alt_down(false), menuBarTimer(0)
{
@@ -131,11 +129,9 @@ QWindowsStylePrivate::QWindowsStylePrivate()
#endif
}
-int QWindowsStylePrivate::appDevicePixelRatio()
+qreal QWindowsStylePrivate::appDevicePixelRatio()
{
- if (!QWindowsStylePrivate::m_appDevicePixelRatio)
- QWindowsStylePrivate::m_appDevicePixelRatio = qRound(qApp->devicePixelRatio());
- return QWindowsStylePrivate::m_appDevicePixelRatio;
+ return qApp->devicePixelRatio();
}
// Returns \c true if the toplevel parent of \a widget has seen the Alt-key
@@ -412,7 +408,7 @@ int QWindowsStyle::pixelMetric(PixelMetric pm, const QStyleOption *opt, const QW
{
int ret = QWindowsStylePrivate::pixelMetricFromSystemDp(pm, opt, widget);
if (ret != QWindowsStylePrivate::InvalidMetric)
- return ret / QWindowsStylePrivate::devicePixelRatio(widget);
+ return qRound(qreal(ret) / QWindowsStylePrivate::devicePixelRatio(widget));
ret = QWindowsStylePrivate::fixedPixelMetric(pm);
if (ret != QWindowsStylePrivate::InvalidMetric)
diff --git a/src/widgets/styles/qwindowsstyle_p_p.h b/src/widgets/styles/qwindowsstyle_p_p.h
index 503cd2ca26..e6c44f401e 100644
--- a/src/widgets/styles/qwindowsstyle_p_p.h
+++ b/src/widgets/styles/qwindowsstyle_p_p.h
@@ -70,8 +70,8 @@ public:
QWindowsStylePrivate();
static int pixelMetricFromSystemDp(QStyle::PixelMetric pm, const QStyleOption *option = 0, const QWidget *widget = 0);
static int fixedPixelMetric(QStyle::PixelMetric pm);
- static int devicePixelRatio(const QWidget *widget = 0)
- { return widget ? int(widget->devicePixelRatioF()) : QWindowsStylePrivate::appDevicePixelRatio(); }
+ static qreal devicePixelRatio(const QWidget *widget = 0)
+ { return widget ? widget->devicePixelRatioF() : QWindowsStylePrivate::appDevicePixelRatio(); }
bool hasSeenAlt(const QWidget *widget) const;
bool altDown() const { return alt_down; }
@@ -96,8 +96,7 @@ public:
};
private:
- static int appDevicePixelRatio();
- static int m_appDevicePixelRatio;
+ static qreal appDevicePixelRatio();
};
QT_END_NAMESPACE
diff --git a/src/widgets/styles/qwindowsvistastyle.cpp b/src/widgets/styles/qwindowsvistastyle.cpp
index a48417677a..2b2b919818 100644
--- a/src/widgets/styles/qwindowsvistastyle.cpp
+++ b/src/widgets/styles/qwindowsvistastyle.cpp
@@ -108,6 +108,15 @@ bool canAnimate(const QStyleOption *option) {
&& !option->styleObject->property("_q_no_animation").toBool();
}
+static inline QImage createAnimationBuffer(const QStyleOption *option, const QWidget *widget)
+{
+ const int devicePixelRatio = widget ? widget->devicePixelRatio() : 1;
+ QImage result(option->rect.size() * devicePixelRatio, QImage::Format_ARGB32_Premultiplied);
+ result.setDevicePixelRatio(devicePixelRatio);
+ result.fill(0);
+ return result;
+}
+
/* \internal
Used by animations to clone a styleoption and shift its offset
*/
@@ -320,12 +329,10 @@ void QWindowsVistaStyle::drawPrimitive(PrimitiveElement element, const QStyleOpt
// We create separate images for the initial and final transition states and store them in the
// Transition object.
- QImage startImage(option->rect.size(), QImage::Format_ARGB32_Premultiplied);
- startImage.fill(0);
+ QImage startImage = createAnimationBuffer(option, widget);
QPainter startPainter(&startImage);
- QImage endImage(option->rect.size(), QImage::Format_ARGB32_Premultiplied);
- endImage.fill(0);
+ QImage endImage = createAnimationBuffer(option, widget);
QPainter endPainter(&endImage);
// If we have a running animation on the widget already, we will use that to paint the initial
@@ -425,8 +432,8 @@ void QWindowsVistaStyle::drawPrimitive(PrimitiveElement element, const QStyleOpt
XPThemeData themeSize = theme;
themeSize.partId = TVP_HOTGLYPH;
themeSize.stateId = GLPS_OPENED;
- const QSize size = themeSize.size() / QWindowsXPStylePrivate::devicePixelRatio(widget);
- decoration_size = qMax(size.width(), size.height());
+ const QSizeF size = themeSize.size() / QWindowsXPStylePrivate::devicePixelRatio(widget);
+ decoration_size = qRound(qMax(size.width(), size.height()));
}
int mid_h = option->rect.x() + option->rect.width() / 2;
int mid_v = option->rect.y() + option->rect.height() / 2;
@@ -873,8 +880,7 @@ void QWindowsVistaStyle::drawControl(ControlElement element, const QStyleOption
QStyleOption *styleOption = clonedAnimationStyleOption(option);
styleOption->state = (QStyle::State)oldState;
- QImage startImage(option->rect.size(), QImage::Format_ARGB32_Premultiplied);
- startImage.fill(0);
+ QImage startImage = createAnimationBuffer(option, widget);
QPainter startPainter(&startImage);
// Use current state of existing animation if already one is running
@@ -886,8 +892,7 @@ void QWindowsVistaStyle::drawControl(ControlElement element, const QStyleOption
}
t->setStartImage(startImage);
- QImage endImage(option->rect.size(), QImage::Format_ARGB32_Premultiplied);
- endImage.fill(0);
+ QImage endImage = createAnimationBuffer(option, widget);
QPainter endPainter(&endImage);
styleOption->state = option->state;
proxy()->drawControl(element, styleOption, &endPainter, widget);
@@ -949,10 +954,8 @@ void QWindowsVistaStyle::drawControl(ControlElement element, const QStyleOption
QWindowsVistaAnimation *anim = qobject_cast<QWindowsVistaAnimation *>(d->animation(styleObject(option)));
if (!anim) {
- QImage startImage(option->rect.size(), QImage::Format_ARGB32_Premultiplied);
- startImage.fill(0);
- QImage alternateImage(option->rect.size(), QImage::Format_ARGB32_Premultiplied);
- alternateImage.fill(0);
+ QImage startImage = createAnimationBuffer(option, widget);
+ QImage alternateImage = createAnimationBuffer(option, widget);
QWindowsVistaPulse *pulse = new QWindowsVistaPulse(styleObject(option));
@@ -991,10 +994,10 @@ void QWindowsVistaStyle::drawControl(ControlElement element, const QStyleOption
XPThemeData theme(widget, 0, QWindowsXPStylePrivate::ToolBarTheme,
TP_DROPDOWNBUTTON);
if (theme.isValid()) {
- const QSize size = theme.size() / QWindowsXPStylePrivate::devicePixelRatio(widget);
+ const QSizeF size = theme.size() / QWindowsXPStylePrivate::devicePixelRatio(widget);
if (!size.isEmpty()) {
- mbiw = size.width();
- mbih = size.height();
+ mbiw = qRound(size.width());
+ mbih = qRound(size.height());
}
}
QRect ir = subElementRect(SE_PushButtonContents, option, 0);
@@ -1178,17 +1181,18 @@ void QWindowsVistaStyle::drawControl(ControlElement element, const QStyleOption
case CE_MenuItem:
if (const QStyleOptionMenuItem *menuitem = qstyleoption_cast<const QStyleOptionMenuItem *>(option)) {
// windows always has a check column, regardless whether we have an icon or not
- int checkcol = 25 / QWindowsXPStylePrivate::devicePixelRatio(widget);
- const int gutterWidth = 3 / QWindowsXPStylePrivate::devicePixelRatio(widget);
+ const qreal devicePixelRatio = QWindowsXPStylePrivate::devicePixelRatio(widget);
+ int checkcol = qRound(qreal(25) / devicePixelRatio);
+ const int gutterWidth = qRound(qreal(3) / devicePixelRatio);
{
XPThemeData theme(widget, 0, QWindowsXPStylePrivate::MenuTheme,
MENU_POPUPCHECKBACKGROUND, MBI_HOT);
XPThemeData themeSize = theme;
themeSize.partId = MENU_POPUPCHECK;
themeSize.stateId = 0;
- const QSize size = themeSize.size() / QWindowsXPStylePrivate::devicePixelRatio(widget);
- const QMargins margins = themeSize.margins() / QWindowsXPStylePrivate::devicePixelRatio(widget);
- checkcol = qMax(menuitem->maxIconWidth, gutterWidth + size.width() + margins.left() + margins.right());
+ const QSizeF size = themeSize.size() / QWindowsXPStylePrivate::devicePixelRatio(widget);
+ const QMarginsF margins = themeSize.margins() / QWindowsXPStylePrivate::devicePixelRatio(widget);
+ checkcol = qMax(menuitem->maxIconWidth, qRound(gutterWidth + size.width() + margins.left() + margins.right()));
}
QRect rect = option->rect;
@@ -1245,17 +1249,17 @@ void QWindowsVistaStyle::drawControl(ControlElement element, const QStyleOption
XPThemeData themeSize = theme;
themeSize.partId = MENU_POPUPCHECK;
themeSize.stateId = 0;
- const QSize size = themeSize.size() / QWindowsXPStylePrivate::devicePixelRatio(widget);
- const QMargins margins = themeSize.margins() / QWindowsXPStylePrivate::devicePixelRatio(widget);
- QRect checkRect(0, 0, size.width() + margins.left() + margins.right(),
- size.height() + margins.bottom() + margins.top());
+ const QSizeF size = themeSize.size() / QWindowsXPStylePrivate::devicePixelRatio(widget);
+ const QMarginsF margins = themeSize.margins() / QWindowsXPStylePrivate::devicePixelRatio(widget);
+ QRect checkRect(0, 0, qRound(size.width() + margins.left() + margins.right()),
+ qRound(size.height() + margins.bottom() + margins.top()));
checkRect.moveCenter(vCheckRect.center());
theme.rect = checkRect;
d->drawBackground(theme);
if (menuitem->icon.isNull()) {
- checkRect = QRect(QPoint(0, 0), size);
+ checkRect = QRect(QPoint(0, 0), size.toSize());
checkRect.moveCenter(theme.rect.center());
theme.rect = checkRect;
@@ -1549,13 +1553,10 @@ void QWindowsVistaStyle::drawComplexControl(ComplexControl control, const QStyle
}
if (doTransition) {
-
- QImage startImage(option->rect.size(), QImage::Format_ARGB32_Premultiplied);
- startImage.fill(0);
+ QImage startImage = createAnimationBuffer(option, widget);
QPainter startPainter(&startImage);
- QImage endImage(option->rect.size(), QImage::Format_ARGB32_Premultiplied);
- endImage.fill(0);
+ QImage endImage = createAnimationBuffer(option, widget);
QPainter endPainter(&endImage);
QWindowsVistaAnimation *anim = qobject_cast<QWindowsVistaAnimation *>(d->animation(styleObject));
@@ -1861,10 +1862,10 @@ QSize QWindowsVistaStyle::sizeFromContents(ContentsType type, const QStyleOption
XPThemeData themeSize = theme;
themeSize.partId = MENU_POPUPCHECK;
themeSize.stateId = 0;
- const QSize size = themeSize.size() / QWindowsXPStylePrivate::devicePixelRatio(widget);
- const QMargins margins = themeSize.margins() / QWindowsXPStylePrivate::devicePixelRatio(widget);
- minimumHeight = qMax(size.height() + margins.bottom() + margins.top(), sz.height());
- sz.rwidth() += size.width() + margins.left() + margins.right();
+ const QSizeF size = themeSize.size() / QWindowsXPStylePrivate::devicePixelRatio(widget);
+ const QMarginsF margins = themeSize.margins() / QWindowsXPStylePrivate::devicePixelRatio(widget);
+ minimumHeight = qMax(qRound(size.height() + margins.bottom() + margins.top()), sz.height());
+ sz.rwidth() += qRound(size.width() + margins.left() + margins.right());
}
if (const QStyleOptionMenuItem *menuitem = qstyleoption_cast<const QStyleOptionMenuItem *>(option)) {
@@ -1972,10 +1973,10 @@ QRect QWindowsVistaStyle::subElementRect(SubElement element, const QStyleOption
int arrowWidth = 13;
int arrowHeight = 5;
if (theme.isValid()) {
- const QSize size = theme.size() / QWindowsXPStylePrivate::devicePixelRatio(widget);
+ const QSizeF size = theme.size() / QWindowsXPStylePrivate::devicePixelRatio(widget);
if (!size.isEmpty()) {
- arrowWidth = size.width();
- arrowHeight = size.height();
+ arrowWidth = qRound(size.width());
+ arrowHeight = qRound(size.height());
}
}
if (option->state & State_Horizontal) {
@@ -2516,7 +2517,7 @@ QIcon QWindowsVistaStyle::standardIcon(StandardPixmap standardIcon,
QWindowsXPStylePrivate::ButtonTheme,
BP_COMMANDLINKGLYPH, CMDLGS_NORMAL);
if (theme.isValid()) {
- const QSize size = theme.size() / QWindowsXPStylePrivate::devicePixelRatio(widget);
+ const QSize size = (theme.size() / QWindowsXPStylePrivate::devicePixelRatio(widget)).toSize();
QIcon linkGlyph;
QPixmap pm(size);
pm.fill(Qt::transparent);
diff --git a/src/widgets/styles/qwindowsxpstyle.cpp b/src/widgets/styles/qwindowsxpstyle.cpp
index c33e4167c1..661c1f7a88 100644
--- a/src/widgets/styles/qwindowsxpstyle.cpp
+++ b/src/widgets/styles/qwindowsxpstyle.cpp
@@ -431,7 +431,7 @@ const QPixmap *QWindowsXPStylePrivate::tabBody(QWidget *widget)
{
if (!tabbody) {
XPThemeData theme(0, 0, QWindowsXPStylePrivate::TabTheme, TABP_BODY);
- const QSize size = theme.size() / QWindowsXPStylePrivate::devicePixelRatio(widget);
+ const QSize size = (theme.size() / QWindowsXPStylePrivate::devicePixelRatio(widget)).toSize();
tabbody = new QPixmap(size.width(), QApplication::desktop()->screenGeometry().height());
QPainter painter(tabbody);
@@ -712,6 +712,19 @@ bool QWindowsXPStylePrivate::swapAlphaChannel(const QRect &rect, bool allPixels)
return valueChange;
}
+enum TransformType { SimpleTransform, HighDpiScalingTransform, ComplexTransform };
+
+static inline TransformType transformType(const QTransform &transform, qreal devicePixelRatio)
+{
+ if (transform.type() <= QTransform::TxTranslate)
+ return SimpleTransform;
+ if (transform.type() > QTransform::TxScale)
+ return ComplexTransform;
+ return qFuzzyCompare(transform.m11(), devicePixelRatio)
+ && qFuzzyCompare(transform.m22(), devicePixelRatio)
+ ? HighDpiScalingTransform : ComplexTransform;
+}
+
/*! \internal
Main theme drawing function.
Determines the correct lowlevel drawing method depending on several
@@ -735,21 +748,22 @@ bool QWindowsXPStylePrivate::drawBackground(XPThemeData &themeData)
painter->save();
- bool complexXForm = painter->deviceTransform().type() > QTransform::TxTranslate;
-
// Access paintDevice via engine since the painter may
// return the clip device which can still be a widget device in case of grabWidget().
bool translucentToplevel = false;
const QPaintDevice *paintDevice = painter->device();
+ const qreal aditionalDevicePixelRatio = themeData.widget ? themeData.widget->devicePixelRatio() : 1;
if (paintDevice->devType() == QInternal::Widget) {
const QWidget *window = static_cast<const QWidget *>(paintDevice)->window();
translucentToplevel = window->testAttribute(Qt::WA_TranslucentBackground);
}
+ const TransformType tt = transformType(painter->deviceTransform(), aditionalDevicePixelRatio);
+
bool canDrawDirectly = false;
if (themeData.widget && painter->opacity() == 1.0 && !themeData.rotate
- && !complexXForm && !themeData.mirrorVertically
+ && tt != ComplexTransform && !themeData.mirrorVertically
&& (!themeData.mirrorHorizontally || pDrawThemeBackgroundEx)
&& !translucentToplevel) {
// Draw on backing store DC only for real widgets or backing store images.
@@ -767,26 +781,44 @@ bool QWindowsXPStylePrivate::drawBackground(XPThemeData &themeData)
}
const HDC dc = canDrawDirectly ? hdcForWidgetBackingStore(themeData.widget) : HDC(0);
- const bool result = dc ? drawBackgroundDirectly(themeData) : drawBackgroundThruNativeBuffer(themeData);
+ const bool result = dc
+ ? drawBackgroundDirectly(dc, themeData, qRound(aditionalDevicePixelRatio))
+ : drawBackgroundThruNativeBuffer(themeData, qRound(aditionalDevicePixelRatio));
painter->restore();
return result;
}
+static inline QRect scaleRect(const QRect &r, int factor)
+{
+ return r.isValid() && factor > 1
+ ? QRect(r.topLeft() * factor, r.size() * factor)
+ : r;
+}
+
+static QRegion scaleRegion(const QRegion &region, int factor)
+{
+ if (region.isEmpty() || factor == 1)
+ return region;
+ if (region.rectCount() == 1)
+ return QRegion(scaleRect(region.boundingRect(), factor));
+ QRegion result;
+ foreach (const QRect &rect, region.rects())
+ result += QRect(rect.topLeft() * factor, rect.size() * factor);
+ return result;
+}
+
/*! \internal
This function draws the theme parts directly to the paintengines HDC.
Do not use this if you need to perform other transformations on the
resulting data.
*/
-bool QWindowsXPStylePrivate::drawBackgroundDirectly(XPThemeData &themeData)
+bool QWindowsXPStylePrivate::drawBackgroundDirectly(HDC dc, XPThemeData &themeData, int additionalDevicePixelRatio)
{
QPainter *painter = themeData.painter;
- HDC dc = 0;
- if (themeData.widget)
- dc = hdcForWidgetBackingStore(themeData.widget);
QPoint redirectionDelta(int(painter->deviceMatrix().dx()),
int(painter->deviceMatrix().dy()));
- QRect area = themeData.rect.translated(redirectionDelta);
+ QRect area = scaleRect(themeData.rect, additionalDevicePixelRatio).translated(redirectionDelta);
QRegion sysRgn = painter->paintEngine()->systemClip();
if (sysRgn.isEmpty())
@@ -794,7 +826,7 @@ bool QWindowsXPStylePrivate::drawBackgroundDirectly(XPThemeData &themeData)
else
sysRgn &= area;
if (painter->hasClipping())
- sysRgn &= painter->clipRegion().translated(redirectionDelta);
+ sysRgn &= scaleRegion(painter->clipRegion(), additionalDevicePixelRatio).translated(redirectionDelta);
HRGN hrgn = qt_hrgn_from_qregion(sysRgn);
SelectClipRgn(dc, hrgn);
@@ -806,6 +838,7 @@ bool QWindowsXPStylePrivate::drawBackgroundDirectly(XPThemeData &themeData)
RECT drawRECT = themeData.toRECT(area);
DTBGOPTS drawOptions;
+ memset(&drawOptions, 0, sizeof(drawOptions));
drawOptions.dwSize = sizeof(drawOptions);
drawOptions.rcClip = themeData.toRECT(sysRgn.boundingRect());
drawOptions.dwFlags = DTBG_CLIPRECT
@@ -813,8 +846,9 @@ bool QWindowsXPStylePrivate::drawBackgroundDirectly(XPThemeData &themeData)
| (themeData.noContent ? DTBG_OMITCONTENT : 0)
| (themeData.mirrorHorizontally ? DTBG_MIRRORDC : 0);
+ HRESULT result = S_FALSE;
if (pDrawThemeBackgroundEx != 0) {
- pDrawThemeBackgroundEx(themeData.handle(), dc, themeData.partId, themeData.stateId, &(drawRECT), &drawOptions);
+ result = pDrawThemeBackgroundEx(themeData.handle(), dc, themeData.partId, themeData.stateId, &(drawRECT), &drawOptions);
} else {
// We are running on a system where the uxtheme.dll does not have
// the DrawThemeBackgroundEx function, so we need to clip away
@@ -848,11 +882,11 @@ bool QWindowsXPStylePrivate::drawBackgroundDirectly(XPThemeData &themeData)
}
}
- pDrawThemeBackground(themeData.handle(), dc, themeData.partId, themeData.stateId, &(drawRECT), &(drawOptions.rcClip));
+ result = pDrawThemeBackground(themeData.handle(), dc, themeData.partId, themeData.stateId, &(drawRECT), &(drawOptions.rcClip));
}
SelectClipRgn(dc, 0);
DeleteObject(hrgn);
- return true;
+ return SUCCEEDED(result);
}
/*! \internal
@@ -863,10 +897,11 @@ bool QWindowsXPStylePrivate::drawBackgroundDirectly(XPThemeData &themeData)
flips (horizonal mirroring only, vertical are handled by the theme
engine).
*/
-bool QWindowsXPStylePrivate::drawBackgroundThruNativeBuffer(XPThemeData &themeData)
+bool QWindowsXPStylePrivate::drawBackgroundThruNativeBuffer(XPThemeData &themeData,
+ int additionalDevicePixelRatio)
{
QPainter *painter = themeData.painter;
- QRect rect = themeData.rect;
+ QRect rect = scaleRect(themeData.rect, additionalDevicePixelRatio);
if ((themeData.rotate + 90) % 180 == 0) { // Catch 90,270,etc.. degree flips.
rect = QRect(0, 0, rect.height(), rect.width());
@@ -898,6 +933,8 @@ bool QWindowsXPStylePrivate::drawBackgroundThruNativeBuffer(XPThemeData &themeDa
pixmapCacheKey.append(QLatin1Char('w'));
pixmapCacheKey.append(QString::number(h));
pixmapCacheKey.append(QLatin1Char('h'));
+ pixmapCacheKey.append(QString::number(additionalDevicePixelRatio));
+ pixmapCacheKey.append(QLatin1Char('d'));
QPixmap cachedPixmap;
ThemeMapKey key(themeData);
@@ -1074,6 +1111,7 @@ bool QWindowsXPStylePrivate::drawBackgroundThruNativeBuffer(XPThemeData &themeDa
printf("Image format is: %s\n", alphaType == RealAlpha ? "Real Alpha" : alphaType == MaskAlpha ? "Masked Alpha" : "No Alpha");
#endif
img = QImage(bufferPixels, bufferW, bufferH, format);
+ img.setDevicePixelRatio(additionalDevicePixelRatio);
}
// Blitting backing store
@@ -2010,7 +2048,7 @@ void QWindowsXPStyle::drawControl(ControlElement element, const QStyleOption *op
themeNumber = QWindowsXPStylePrivate::StatusTheme;
partId = SP_GRIPPER;
XPThemeData theme(0, p, themeNumber, partId, 0);
- QSize size = theme.size() / QWindowsStylePrivate::devicePixelRatio(widget);
+ QSize size = (theme.size() / QWindowsStylePrivate::devicePixelRatio(widget)).toSize();
size.rheight()--;
if (const QStyleOptionSizeGrip *sg = qstyleoption_cast<const QStyleOptionSizeGrip *>(option)) {
switch (sg->corner) {
@@ -2081,7 +2119,7 @@ void QWindowsXPStyle::drawControl(ControlElement element, const QStyleOption *op
QWindowsXPStylePrivate::ToolBarTheme,
TP_SPLITBUTTONDROPDOWN);
if (theme.isValid()) {
- const QSize size = theme.size() / QWindowsStylePrivate::devicePixelRatio(widget);
+ const QSize size = (theme.size() / QWindowsStylePrivate::devicePixelRatio(widget)).toSize();
mbiw = size.width();
mbih = size.height();
}
@@ -2544,10 +2582,10 @@ void QWindowsXPStyle::drawControl(ControlElement element, const QStyleOption *op
QRect QWindowsXPStylePrivate::scrollBarGripperBounds(QStyle::State flags, const QWidget *widget, XPThemeData *theme)
{
const bool horizontal = flags & QStyle::State_Horizontal;
- const QMargins contentsMargin = theme->margins(theme->rect, TMT_SIZINGMARGINS)
- / QWindowsStylePrivate::devicePixelRatio(widget);
+ const QMargins contentsMargin = (theme->margins(theme->rect, TMT_SIZINGMARGINS)
+ / QWindowsStylePrivate::devicePixelRatio(widget)).toMargins();
theme->partId = horizontal ? SBP_GRIPPERHORZ : SBP_GRIPPERVERT;
- const QSize size = theme->size() / QWindowsStylePrivate::devicePixelRatio(widget);
+ const QSize size = (theme->size() / QWindowsStylePrivate::devicePixelRatio(widget)).toSize();
const int hSpace = theme->rect.width() - size.width();
const int vSpace = theme->rect.height() - size.height();
@@ -3362,7 +3400,7 @@ int QWindowsXPStyle::pixelMetric(PixelMetric pm, const QStyleOption *option, con
int res = QWindowsXPStylePrivate::pixelMetricFromSystemDp(pm, option, widget);
if (res != QWindowsStylePrivate::InvalidMetric)
- return res / QWindowsStylePrivate::devicePixelRatio(widget);
+ return qRound(qreal(res) / QWindowsStylePrivate::devicePixelRatio(widget));
res = 0;
switch (pm) {
@@ -3508,9 +3546,9 @@ QRect QWindowsXPStyle::subControlRect(ComplexControl cc, const QStyleOptionCompl
const int height = tb->rect.height();
const int width = tb->rect.width();
const int buttonMargin = int(QStyleHelper::dpiScaled(4));
- int buttonHeight = GetSystemMetrics(SM_CYSIZE) / QWindowsStylePrivate::devicePixelRatio(widget)
+ int buttonHeight = qRound(qreal(GetSystemMetrics(SM_CYSIZE)) / QWindowsStylePrivate::devicePixelRatio(widget))
- buttonMargin;
- int buttonWidth = GetSystemMetrics(SM_CXSIZE) / QWindowsStylePrivate::devicePixelRatio(widget)
+ int buttonWidth = qRound(qreal(GetSystemMetrics(SM_CXSIZE)) / QWindowsStylePrivate::devicePixelRatio(widget))
- buttonMargin;
const int delta = buttonWidth + 2;
int controlTop = option->rect.bottom() - buttonHeight - 2;
@@ -3705,10 +3743,10 @@ QSize QWindowsXPStyle::sizeFromContents(ContentsType ct, const QStyleOption *opt
{
XPThemeData buttontheme(widget, 0, QWindowsXPStylePrivate::ButtonTheme, BP_PUSHBUTTON, PBS_NORMAL);
if (buttontheme.isValid()) {
- const QMargins borderSize = buttontheme.margins() / QWindowsXPStylePrivate::devicePixelRatio(widget);
+ const QMarginsF borderSize = buttontheme.margins() / QWindowsXPStylePrivate::devicePixelRatio(widget);
if (!borderSize.isNull()) {
- sz.rwidth() += borderSize.left() + borderSize.right() - 2;
- sz.rheight() += borderSize.bottom() + borderSize.top() - 2;
+ sz.rwidth() += qRound(borderSize.left() + borderSize.right() - 2);
+ sz.rheight() += qRound(borderSize.bottom() + borderSize.top() - 2);
}
const int textMargins = 2*(proxy()->pixelMetric(PM_FocusFrameHMargin) + 1);
sz += QSize(qMax(pixelMetric(QStyle::PM_ScrollBarExtent, option, widget)
@@ -3878,7 +3916,7 @@ QPixmap QWindowsXPStyle::standardPixmap(StandardPixmap standardPixmap, const QSt
if (widget && widget->isWindow()) {
XPThemeData theme(widget, 0, QWindowsXPStylePrivate::WindowTheme, WP_SMALLCLOSEBUTTON, CBS_NORMAL);
if (theme.isValid()) {
- const QSize size = theme.size() / QWindowsXPStylePrivate::devicePixelRatio(widget);
+ const QSize size = (theme.size() / QWindowsXPStylePrivate::devicePixelRatio(widget)).toSize();
return QIcon(QWindowsStyle::standardPixmap(standardPixmap, option, widget)).pixmap(size);
}
}
@@ -3912,7 +3950,7 @@ QIcon QWindowsXPStyle::standardIcon(StandardPixmap standardIcon,
XPThemeData theme(0, 0, QWindowsXPStylePrivate::WindowTheme,
WP_MAXBUTTON, MAXBS_NORMAL);
if (theme.isValid()) {
- const QSize size = themeSize.size() / QWindowsXPStylePrivate::devicePixelRatio(widget);
+ const QSize size = (themeSize.size() / QWindowsXPStylePrivate::devicePixelRatio(widget)).toSize();
QPixmap pm(size);
pm.fill(Qt::transparent);
QPainter p(&pm);
@@ -3946,7 +3984,7 @@ QIcon QWindowsXPStyle::standardIcon(StandardPixmap standardIcon,
XPThemeData theme(0, 0, QWindowsXPStylePrivate::WindowTheme,
WP_SMALLCLOSEBUTTON, CBS_NORMAL);
if (theme.isValid()) {
- const QSize size = theme.size() / QWindowsXPStylePrivate::devicePixelRatio(widget);
+ const QSize size = (theme.size() / QWindowsXPStylePrivate::devicePixelRatio(widget)).toSize();
QPixmap pm(size);
pm.fill(Qt::transparent);
QPainter p(&pm);
@@ -3982,7 +4020,7 @@ QIcon QWindowsXPStyle::standardIcon(StandardPixmap standardIcon,
XPThemeData theme(0, 0, QWindowsXPStylePrivate::WindowTheme,
WP_RESTOREBUTTON, RBS_NORMAL);
if (theme.isValid()) {
- const QSize size = themeSize.size() / QWindowsStylePrivate::devicePixelRatio(widget);
+ const QSize size = (themeSize.size() / QWindowsStylePrivate::devicePixelRatio(widget)).toSize();
QPixmap pm(size);
pm.fill(Qt::transparent);
QPainter p(&pm);
diff --git a/src/widgets/styles/qwindowsxpstyle_p_p.h b/src/widgets/styles/qwindowsxpstyle_p_p.h
index 31977304fe..68aa10e12a 100644
--- a/src/widgets/styles/qwindowsxpstyle_p_p.h
+++ b/src/widgets/styles/qwindowsxpstyle_p_p.h
@@ -208,15 +208,15 @@ public:
static RECT toRECT(const QRect &qr);
bool isValid();
- QSize size();
- QMargins margins(const QRect &rect, int propId = TMT_CONTENTMARGINS);
- QMargins margins(int propId = TMT_CONTENTMARGINS);
+ QSizeF size();
+ QMarginsF margins(const QRect &rect, int propId = TMT_CONTENTMARGINS);
+ QMarginsF margins(int propId = TMT_CONTENTMARGINS);
- static QSize themeSize(const QWidget *w = 0, QPainter *p = 0, int themeIn = -1, int part = 0, int state = 0);
- static QMargins themeMargins(const QRect &rect, const QWidget *w = 0, QPainter *p = 0, int themeIn = -1,
- int part = 0, int state = 0, int propId = TMT_CONTENTMARGINS);
- static QMargins themeMargins(const QWidget *w = 0, QPainter *p = 0, int themeIn = -1,
- int part = 0, int state = 0, int propId = TMT_CONTENTMARGINS);
+ static QSizeF themeSize(const QWidget *w = 0, QPainter *p = 0, int themeIn = -1, int part = 0, int state = 0);
+ static QMarginsF themeMargins(const QRect &rect, const QWidget *w = 0, QPainter *p = 0, int themeIn = -1,
+ int part = 0, int state = 0, int propId = TMT_CONTENTMARGINS);
+ static QMarginsF themeMargins(const QWidget *w = 0, QPainter *p = 0, int themeIn = -1,
+ int part = 0, int state = 0, int propId = TMT_CONTENTMARGINS);
const QWidget *widget;
QPainter *painter;
@@ -393,8 +393,8 @@ public:
void setTransparency(QWidget *widget, XPThemeData &themeData);
bool drawBackground(XPThemeData &themeData);
- bool drawBackgroundThruNativeBuffer(XPThemeData &themeData);
- bool drawBackgroundDirectly(XPThemeData &themeData);
+ bool drawBackgroundThruNativeBuffer(XPThemeData &themeData, int aditionalDevicePixelRatio);
+ bool drawBackgroundDirectly(HDC dc, XPThemeData &themeData, int aditionalDevicePixelRatio);
bool hasAlphaChannel(const QRect &rect);
bool fixAlphaChannel(const QRect &rect);
@@ -433,9 +433,9 @@ private:
static HTHEME m_themes[NThemes];
};
-inline QSize XPThemeData::size()
+inline QSizeF XPThemeData::size()
{
- QSize result(0, 0);
+ QSizeF result(0, 0);
if (isValid()) {
SIZE size;
if (SUCCEEDED(QWindowsXPStylePrivate::pGetThemePartSize(handle(), 0, partId, stateId, 0, TS_TRUE, &size)))
@@ -444,9 +444,9 @@ inline QSize XPThemeData::size()
return result;
}
-inline QMargins XPThemeData::margins(const QRect &qRect, int propId)
+inline QMarginsF XPThemeData::margins(const QRect &qRect, int propId)
{
- QMargins result(0, 0, 0 ,0);
+ QMarginsF result(0, 0, 0 ,0);
if (isValid()) {
MARGINS margins;
RECT rect = XPThemeData::toRECT(qRect);
@@ -456,9 +456,9 @@ inline QMargins XPThemeData::margins(const QRect &qRect, int propId)
return result;
}
-inline QMargins XPThemeData::margins(int propId)
+inline QMarginsF XPThemeData::margins(int propId)
{
- QMargins result(0, 0, 0 ,0);
+ QMarginsF result(0, 0, 0 ,0);
if (isValid()) {
MARGINS margins;
if (SUCCEEDED(QWindowsXPStylePrivate::pGetThemeMargins(handle(), 0, partId, stateId, propId, NULL, &margins)))
@@ -467,21 +467,21 @@ inline QMargins XPThemeData::margins(int propId)
return result;
}
-inline QSize XPThemeData::themeSize(const QWidget *w, QPainter *p, int themeIn, int part, int state)
+inline QSizeF XPThemeData::themeSize(const QWidget *w, QPainter *p, int themeIn, int part, int state)
{
XPThemeData theme(w, p, themeIn, part, state);
return theme.size();
}
-inline QMargins XPThemeData::themeMargins(const QRect &rect, const QWidget *w, QPainter *p, int themeIn,
- int part, int state, int propId)
+inline QMarginsF XPThemeData::themeMargins(const QRect &rect, const QWidget *w, QPainter *p, int themeIn,
+ int part, int state, int propId)
{
XPThemeData theme(w, p, themeIn, part, state);
return theme.margins(rect, propId);
}
-inline QMargins XPThemeData::themeMargins(const QWidget *w, QPainter *p, int themeIn,
- int part, int state, int propId)
+inline QMarginsF XPThemeData::themeMargins(const QWidget *w, QPainter *p, int themeIn,
+ int part, int state, int propId)
{
XPThemeData theme(w, p, themeIn, part, state);
return theme.margins(propId);
diff --git a/src/widgets/widgets/qabstractslider.cpp b/src/widgets/widgets/qabstractslider.cpp
index 8cd35495e9..3f6185b4e7 100644
--- a/src/widgets/widgets/qabstractslider.cpp
+++ b/src/widgets/widgets/qabstractslider.cpp
@@ -731,8 +731,16 @@ bool QAbstractSliderPrivate::scrollByDelta(Qt::Orientation orientation, Qt::Keyb
stepsToScroll = int(offset_accumulated);
#endif
offset_accumulated -= int(offset_accumulated);
- if (stepsToScroll == 0)
+ if (stepsToScroll == 0) {
+ // We moved less than a line, but might still have accumulated partial scroll,
+ // unless we already are at one of the ends.
+ if (offset_accumulated > 0.f && value < maximum)
+ return true;
+ if (offset_accumulated < 0.f && value > minimum)
+ return true;
+ offset_accumulated = 0;
return false;
+ }
}
if (invertedControls)
diff --git a/src/widgets/widgets/qlabel.cpp b/src/widgets/widgets/qlabel.cpp
index d2d7af145c..5db1013fd2 100644
--- a/src/widgets/widgets/qlabel.cpp
+++ b/src/widgets/widgets/qlabel.cpp
@@ -1095,14 +1095,16 @@ void QLabel::paintEvent(QPaintEvent *)
if (d->pixmap && !d->pixmap->isNull()) {
QPixmap pix;
if (d->scaledcontents) {
- if (!d->scaledpixmap || d->scaledpixmap->size() != cr.size()) {
+ QSize scaledSize = cr.size() * devicePixelRatioF();
+ if (!d->scaledpixmap || d->scaledpixmap->size() != scaledSize) {
if (!d->cachedimage)
d->cachedimage = new QImage(d->pixmap->toImage());
delete d->scaledpixmap;
QImage scaledImage =
- d->cachedimage->scaled(cr.size() * devicePixelRatioF(),
+ d->cachedimage->scaled(scaledSize,
Qt::IgnoreAspectRatio, Qt::SmoothTransformation);
d->scaledpixmap = new QPixmap(QPixmap::fromImage(scaledImage));
+ d->scaledpixmap->setDevicePixelRatio(devicePixelRatioF());
}
pix = *d->scaledpixmap;
} else
diff --git a/src/widgets/widgets/qtoolbutton.cpp b/src/widgets/widgets/qtoolbutton.cpp
index 664aec9a53..aef4634a9a 100644
--- a/src/widgets/widgets/qtoolbutton.cpp
+++ b/src/widgets/widgets/qtoolbutton.cpp
@@ -68,6 +68,7 @@ public:
void init();
#ifndef QT_NO_MENU
void _q_buttonPressed();
+ void _q_buttonReleased();
void popupTimerDone();
void _q_updateButtonDown();
void _q_menuTriggered(QAction *);
@@ -217,6 +218,7 @@ void QToolButtonPrivate::init()
#ifndef QT_NO_MENU
QObject::connect(q, SIGNAL(pressed()), q, SLOT(_q_buttonPressed()));
+ QObject::connect(q, SIGNAL(released()), q, SLOT(_q_buttonReleased()));
#endif
setLayoutItemMargins(QStyle::SE_ToolButtonLayoutItem);
@@ -704,12 +706,17 @@ void QToolButtonPrivate::_q_buttonPressed()
return; // no menu to show
if (popupMode == QToolButton::MenuButtonPopup)
return;
- else if (delay > 0 && !popupTimer.isActive() && popupMode == QToolButton::DelayedPopup)
+ else if (delay > 0 && popupMode == QToolButton::DelayedPopup)
popupTimer.start(delay, q);
else if (delay == 0 || popupMode == QToolButton::InstantPopup)
q->showMenu();
}
+void QToolButtonPrivate::_q_buttonReleased()
+{
+ popupTimer.stop();
+}
+
void QToolButtonPrivate::popupTimerDone()
{
Q_Q(QToolButton);
diff --git a/src/widgets/widgets/qtoolbutton.h b/src/widgets/widgets/qtoolbutton.h
index d9bfed4c47..7b6114b5c1 100644
--- a/src/widgets/widgets/qtoolbutton.h
+++ b/src/widgets/widgets/qtoolbutton.h
@@ -125,6 +125,7 @@ private:
Q_DECLARE_PRIVATE(QToolButton)
#ifndef QT_NO_MENU
Q_PRIVATE_SLOT(d_func(), void _q_buttonPressed())
+ Q_PRIVATE_SLOT(d_func(), void _q_buttonReleased())
Q_PRIVATE_SLOT(d_func(), void _q_updateButtonDown())
Q_PRIVATE_SLOT(d_func(), void _q_menuTriggered(QAction*))
#endif
diff --git a/src/widgets/widgets/qwidgetlinecontrol.cpp b/src/widgets/widgets/qwidgetlinecontrol.cpp
index 7fab2c1de5..af8e5a8b42 100644
--- a/src/widgets/widgets/qwidgetlinecontrol.cpp
+++ b/src/widgets/widgets/qwidgetlinecontrol.cpp
@@ -118,7 +118,7 @@ void QWidgetLineControl::updateDisplayText(bool forceUpdate)
// characters)
QChar* uc = str.data();
for (int i = 0; i < (int)str.length(); ++i) {
- if ((uc[i] < 0x20 && uc[i] != 0x09)
+ if ((uc[i].unicode() < 0x20 && uc[i].unicode() != 0x09)
|| uc[i] == QChar::LineSeparator
|| uc[i] == QChar::ParagraphSeparator
|| uc[i] == QChar::ObjectReplacementCharacter)
diff --git a/tests/auto/network-settings.h b/tests/auto/network-settings.h
index 236cdb17ce..d6b63c6100 100644
--- a/tests/auto/network-settings.h
+++ b/tests/auto/network-settings.h
@@ -66,7 +66,12 @@ public:
#ifdef QT_NETWORK_LIB
static QHostAddress serverIP()
{
- return QHostInfo::fromName(serverName()).addresses().first();
+ const QHostInfo info = QHostInfo::fromName(serverName());
+ if (info.error()) {
+ QTest::qFail(qPrintable(info.errorString()), __FILE__, __LINE__);
+ return QHostAddress();
+ }
+ return info.addresses().constFirst();
}
#endif
diff --git a/tests/auto/network/access/qftp/tst_qftp.cpp b/tests/auto/network/access/qftp/tst_qftp.cpp
index eca913fe08..edeb471401 100644
--- a/tests/auto/network/access/qftp/tst_qftp.cpp
+++ b/tests/auto/network/access/qftp/tst_qftp.cpp
@@ -722,10 +722,11 @@ void tst_QFtp::put_data()
QByteArray bigData( 10*1024*1024, 0 );
bigData.fill( 'A' );
- // test the two put() overloads in one routine
+ // test the two put() overloads in one routine with a file name containing
+ // U+0x00FC (latin small letter u with diaeresis) for QTBUG-52303, testing UTF-8
for ( int i=0; i<2; i++ ) {
QTest::newRow(("relPath01_" + QByteArray::number(i)).constData()) << QtNetworkSettings::serverName() << (uint)21 << QString() << QString()
- << QString("qtest/upload/rel01_%1") << rfc3252
+ << (QLatin1String("qtest/upload/rel01_") + QChar(0xfc) + QLatin1String("%1")) << rfc3252
<< (bool)(i==1) << 1;
/*
QTest::newRow( QString("relPath02_%1").arg(i).toLatin1().constData() ) << QtNetworkSettings::serverName() << (uint)21 << QString("ftptest") << QString("password")
diff --git a/tests/auto/widgets/graphicsview/qgraphicslinearlayout/tst_qgraphicslinearlayout.cpp b/tests/auto/widgets/graphicsview/qgraphicslinearlayout/tst_qgraphicslinearlayout.cpp
index ceecd70cad..5794c32803 100644
--- a/tests/auto/widgets/graphicsview/qgraphicslinearlayout/tst_qgraphicslinearlayout.cpp
+++ b/tests/auto/widgets/graphicsview/qgraphicslinearlayout/tst_qgraphicslinearlayout.cpp
@@ -1,4 +1,3 @@
-
/****************************************************************************
**
** Copyright (C) 2016 The Qt Company Ltd.
diff --git a/tests/auto/widgets/styles/qstyle/tst_qstyle.cpp b/tests/auto/widgets/styles/qstyle/tst_qstyle.cpp
index 37b72cc99c..d4f398a61c 100644
--- a/tests/auto/widgets/styles/qstyle/tst_qstyle.cpp
+++ b/tests/auto/widgets/styles/qstyle/tst_qstyle.cpp
@@ -126,6 +126,7 @@ private slots:
void testFrameOnlyAroundContents();
void testProxyCalled();
+ void testStyleOptionInit();
private:
void lineUpLayoutTest(QStyle *);
QWidget *testWidget;
@@ -837,5 +838,111 @@ void tst_QStyle::testProxyCalled()
}
}
+
+class TestStyleOptionInitProxy: public QProxyStyle
+{
+ Q_OBJECT
+public:
+ mutable bool invalidOptionsDetected;
+ explicit TestStyleOptionInitProxy(QStyle *style = Q_NULLPTR)
+ : QProxyStyle(style),
+ invalidOptionsDetected(false)
+ {}
+
+ void drawPrimitive(PrimitiveElement pe, const QStyleOption *opt, QPainter *p, const QWidget *w) const Q_DECL_OVERRIDE {
+ checkStyleEnum<QStyle::PrimitiveElement>(pe, opt);
+ return QProxyStyle::drawPrimitive(pe, opt, p, w);
+ }
+
+ void drawControl(ControlElement element, const QStyleOption *opt, QPainter *p, const QWidget *w) const Q_DECL_OVERRIDE {
+ checkStyleEnum<QStyle::ControlElement>(element, opt);
+ return QProxyStyle::drawControl(element, opt, p, w);
+ }
+
+ QRect subElementRect(SubElement subElement, const QStyleOption *option, const QWidget *widget) const Q_DECL_OVERRIDE {
+ checkStyleEnum<QStyle::SubElement>(subElement, option);
+ return QProxyStyle::subElementRect(subElement, option, widget);
+ }
+
+ void drawComplexControl(ComplexControl cc, const QStyleOptionComplex *opt, QPainter *p, const QWidget *widget) const Q_DECL_OVERRIDE {
+ checkStyleEnum<QStyle::ComplexControl>(cc, opt);
+ return QProxyStyle::drawComplexControl(cc, opt, p, widget);
+ }
+
+ QRect subControlRect(ComplexControl cc, const QStyleOptionComplex *opt, SubControl sc, const QWidget *widget) const Q_DECL_OVERRIDE {
+ checkStyleEnum<QStyle::ComplexControl>(cc, opt);
+ return QProxyStyle::subControlRect(cc, opt, sc, widget);
+ }
+
+ int pixelMetric(PixelMetric metric, const QStyleOption *option, const QWidget *widget) const Q_DECL_OVERRIDE {
+ checkStyleEnum<QStyle::PixelMetric>(metric, option);
+ return QProxyStyle::pixelMetric(metric, option, widget);
+ }
+
+ QSize sizeFromContents(ContentsType ct, const QStyleOption *opt, const QSize &contentsSize, const QWidget *w) const Q_DECL_OVERRIDE {
+ checkStyleEnum<QStyle::ContentsType>(ct, opt);
+ return QProxyStyle::sizeFromContents(ct, opt, contentsSize, w);
+ }
+
+ int styleHint(StyleHint stylehint, const QStyleOption *opt, const QWidget *widget, QStyleHintReturn *returnData) const Q_DECL_OVERRIDE {
+ checkStyleEnum<QStyle::StyleHint>(stylehint, opt);
+ return QProxyStyle::styleHint(stylehint, opt, widget, returnData);
+ }
+
+ QPixmap standardPixmap(StandardPixmap standardPixmap, const QStyleOption *opt, const QWidget *widget) const Q_DECL_OVERRIDE {
+ checkStyleEnum<QStyle::StandardPixmap>(standardPixmap, opt);
+ return QProxyStyle::standardPixmap(standardPixmap, opt, widget);
+ }
+
+ QIcon standardIcon(StandardPixmap standardIcon, const QStyleOption *option, const QWidget *widget) const Q_DECL_OVERRIDE {
+ checkStyleEnum<QStyle::StandardPixmap>(standardIcon, option);
+ return QProxyStyle::standardIcon(standardIcon, option, widget);
+ }
+
+ QPixmap generatedIconPixmap(QIcon::Mode iconMode, const QPixmap &pixmap, const QStyleOption *opt) const Q_DECL_OVERRIDE {
+ checkStyle(QString::asprintf("QIcon::Mode(%i)", iconMode).toLatin1(), opt);
+ return QProxyStyle::generatedIconPixmap(iconMode, pixmap, opt);
+ }
+
+ int layoutSpacing(QSizePolicy::ControlType control1, QSizePolicy::ControlType control2, Qt::Orientation orientation, const QStyleOption *option, const QWidget *widget) const Q_DECL_OVERRIDE {
+ checkStyle(QString::asprintf("QSizePolicy::ControlType(%i), QSizePolicy::ControlType(%i)", control1, control2).toLatin1(), option);
+ return QProxyStyle::layoutSpacing(control1, control2, orientation, option, widget);
+ }
+
+private:
+ void checkStyle(const QByteArray &info, const QStyleOption *opt) const {
+ if (opt && (opt->version == 0 || opt->styleObject == Q_NULLPTR) ) {
+ invalidOptionsDetected = true;
+ qWarning() << baseStyle()->metaObject()->className()
+ << "Invalid QStyleOption found for"
+ << info;
+ qWarning() << "Version:" << opt->version << "StyleObject:" << opt->styleObject;
+ }
+ }
+
+ template<typename MEnum>
+ void checkStyleEnum(MEnum element, const QStyleOption *opt) const {
+ static QMetaEnum _enum = QMetaEnum::fromType<MEnum>();
+ checkStyle(_enum.valueToKey(element), opt);
+ }
+};
+
+void tst_QStyle::testStyleOptionInit()
+{
+ QStringList keys = QStyleFactory::keys();
+ QVector<QStyle*> styles;
+ styles.reserve(keys.size() + 1);
+
+ styles << new QCommonStyle();
+
+ Q_FOREACH (QStyle *style, styles) {
+ TestStyleOptionInitProxy testStyle;
+ testStyle.setBaseStyle(style);
+ testAllFunctions(style);
+ QVERIFY(!testStyle.invalidOptionsDetected);
+ delete style;
+ }
+}
+
QTEST_MAIN(tst_QStyle)
#include "tst_qstyle.moc"