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
This commit is contained in:
Liang Qi 2016-04-07 10:47:20 +02:00
commit ee0951d69b
46 changed files with 431 additions and 457 deletions

View File

@ -1,11 +1,6 @@
body {
font-size: 10.5pt;
}
pre { pre {
background-color: #f0f0f0; background-color: #f0f0f0;
font-family: Courier, monospace; font-family: Courier, monospace;
font-size: 11pt;
font-weight: 600; font-weight: 600;
vertical-align: top; vertical-align: top;
margin: 15px 85px 15px 35px; margin: 15px 85px 15px 35px;
@ -41,7 +36,6 @@ a[href|="http://"], a[href|="https://"] {
h1.title { h1.title {
margin-top: 30px; margin-top: 30px;
margin-left: 6px; margin-left: 6px;
font-size: 24pt;
padding: 6px; padding: 6px;
} }
@ -52,7 +46,6 @@ h2, p.h2 {
} }
h3 { h3 {
font-size: 12pt;
margin: 30px 0px 30px 6px; margin: 30px 0px 30px 6px;
} }
@ -82,7 +75,6 @@ h3.fn, span.fn {
padding: 5px; padding: 5px;
text-decoration: none; text-decoration: none;
font-weight: 400; font-weight: 400;
font-size: 12pt;
margin: 45px 0px 0px 6px; margin: 45px 0px 0px 6px;
} }
@ -107,7 +99,6 @@ table tr.odd {
table.qmlname td { table.qmlname td {
padding: 0px; padding: 0px;
margin-left: 6px; margin-left: 6px;
font-size: 12pt;
} }
table.qmlname p .name, table.qmlname p .name,
@ -124,13 +115,8 @@ h3.fn .name, h3.fn .type {
margin-right: 6px; margin-right: 6px;
} }
tr > td > pre {
font-size: 10.5pt;
}
code { code {
font-family: Courier, monospace; font-family: Courier, monospace;
font-size: 12pt;
font-weight: 400; font-weight: 400;
} }
@ -167,7 +153,7 @@ td#buildversion {
.footer, .footer p { .footer, .footer p {
padding: 5px 0px 5px 0px; padding: 5px 0px 5px 0px;
margin: 45px 15px 5px 15px; margin: 45px 15px 5px 15px;
font-size: 7.5pt; font-size: 8.5pt;
background-color: #cccccc; background-color: #cccccc;
} }

View File

@ -1,4 +1,3 @@
/**************************************************************************** /****************************************************************************
** **
** Copyright (C) 2016 The Qt Company Ltd. ** Copyright (C) 2016 The Qt Company Ltd.

View File

@ -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>

View File

@ -1,7 +1,6 @@
<RCC> <RCC>
<qresource prefix="/"> <qresource prefix="/">
<file>apache_org.html</file> <file>apache_org.html</file>
<file>nokia_com.html</file>
<file>simpleexample.html</file> <file>simpleexample.html</file>
<file>trolltech_com.html</file> <file>trolltech_com.html</file>
<file>w3c_org.html</file> <file>w3c_org.html</file>

View File

@ -1310,8 +1310,8 @@ void VcprojGenerator::initDeploymentTool()
+ "|0;"; + "|0;";
if (!qpaPluginDeployed) { if (!qpaPluginDeployed) {
QChar debugInfixChar; QChar debugInfixChar;
bool foundGuid = false; bool foundGuid = dllName.contains(QLatin1String("Guid"));
if (foundGuid = dllName.contains(QLatin1String("Guid"))) if (foundGuid)
debugInfixChar = QLatin1Char('d'); debugInfixChar = QLatin1Char('d');
if (foundGuid || dllName.contains(QLatin1String("Gui"))) { if (foundGuid || dllName.contains(QLatin1String("Gui"))) {

View File

@ -97,8 +97,6 @@ gcc {
-Wno-strict-aliasing -Wno-type-limits -Wno-unused-local-typedefs -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 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 QMAKE_CXXFLAGS_DEBUG = $$QMAKE_CFLAGS_DEBUG

View File

@ -205,7 +205,6 @@ SOURCES += \
$$ANGLE_DIR/src/libANGLE/renderer/d3d/IndexBuffer.cpp \ $$ANGLE_DIR/src/libANGLE/renderer/d3d/IndexBuffer.cpp \
$$ANGLE_DIR/src/libANGLE/renderer/d3d/IndexDataManager.cpp \ $$ANGLE_DIR/src/libANGLE/renderer/d3d/IndexDataManager.cpp \
$$ANGLE_DIR/src/libANGLE/renderer/d3d/loadimage.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/ProgramD3D.cpp \
$$ANGLE_DIR/src/libANGLE/renderer/d3d/RenderbufferD3D.cpp \ $$ANGLE_DIR/src/libANGLE/renderer/d3d/RenderbufferD3D.cpp \
$$ANGLE_DIR/src/libANGLE/renderer/d3d/RendererD3D.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/global_state.cpp \
$$ANGLE_DIR/src/libGLESv2/libGLESv2.cpp $$ANGLE_DIR/src/libGLESv2/libGLESv2.cpp
SSE2_SOURCES += $$ANGLE_DIR/src/libANGLE/renderer/d3d/loadimageSSE2.cpp
angle_d3d11 { angle_d3d11 {
HEADERS += \ HEADERS += \

View File

@ -1010,8 +1010,6 @@ Q_CORE_EXPORT QString qtTrId(const char *id, int n = -1);
#endif // QT_NO_TRANSLATION #endif // QT_NO_TRANSLATION
#define QDOC_PROPERTY(text)
/* /*
When RTTI is not available, define this macro to force any uses of When RTTI is not available, define this macro to force any uses of
dynamic_cast to cause a compile failure. dynamic_cast to cause a compile failure.

View File

@ -762,17 +762,13 @@ QString QDir::relativeFilePath(const QString &fileName) const
#endif #endif
QString result; 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> dirElts = dir.splitRef(QLatin1Char('/'), QString::SkipEmptyParts);
QVector<QStringRef> fileElts = file.splitRef(QLatin1Char('/'), QString::SkipEmptyParts); QVector<QStringRef> fileElts = file.splitRef(QLatin1Char('/'), QString::SkipEmptyParts);
#endif
int i = 0; int i = 0;
while (i < dirElts.size() && i < fileElts.size() && while (i < dirElts.size() && i < fileElts.size() &&
#if defined(Q_OS_WIN) #if defined(Q_OS_WIN)
dirElts.at(i).toLower() == fileElts.at(i).toLower()) dirElts.at(i).compare(fileElts.at(i), Qt::CaseInsensitive) == 0)
#else #else
dirElts.at(i) == fileElts.at(i)) dirElts.at(i) == fileElts.at(i))
#endif #endif

View File

@ -429,7 +429,7 @@ inline Qt::ItemFlags QModelIndex::flags() const
{ return m ? m->flags(*this) : Qt::ItemFlags(); } { return m ? m->flags(*this) : Qt::ItemFlags(); }
inline uint qHash(const QModelIndex &index) Q_DECL_NOTHROW 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 QT_END_NAMESPACE

View File

@ -62,6 +62,25 @@ class QString;
#define Q_MOC_OUTPUT_REVISION 67 #define Q_MOC_OUTPUT_REVISION 67
#endif #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++ // The following macros are our "extensions" to C++
// They are used, strictly speaking, only by the moc. // They are used, strictly speaking, only by the moc.
@ -71,38 +90,44 @@ class QString;
# define QT_NO_EMIT # define QT_NO_EMIT
# else # else
# ifndef QT_NO_SIGNALS_SLOTS_KEYWORDS # ifndef QT_NO_SIGNALS_SLOTS_KEYWORDS
# define slots # define slots Q_SLOTS
# define signals public # define signals Q_SIGNALS
# endif # endif
# endif # endif
# define Q_SLOTS # define Q_SLOTS QT_ANNOTATE_ACCESS_SPECIFIER(qt_slot)
# define Q_SIGNALS public # define Q_SIGNALS public QT_ANNOTATE_ACCESS_SPECIFIER(qt_signal)
# define Q_PRIVATE_SLOT(d, signature) # define Q_PRIVATE_SLOT(d, signature) QT_ANNOTATE_CLASS2(qt_private_slot, d, signature)
# define Q_EMIT # define Q_EMIT
#ifndef QT_NO_EMIT #ifndef QT_NO_EMIT
# define emit # define emit
#endif #endif
#define Q_CLASSINFO(name, value) #ifndef Q_CLASSINFO
#define Q_PLUGIN_METADATA(x) # define Q_CLASSINFO(name, value)
#define Q_INTERFACES(x)
#ifdef Q_COMPILER_VARIADIC_MACROS
#define Q_PROPERTY(...)
#else
#define Q_PROPERTY(text)
#endif #endif
#define Q_PRIVATE_PROPERTY(d, text) #define Q_PLUGIN_METADATA(x) QT_ANNOTATE_CLASS(qt_plugin_metadata, x)
#define Q_REVISION(v) #define Q_INTERFACES(x) QT_ANNOTATE_CLASS(qt_interfaces, x)
#define Q_OVERRIDE(text) #ifdef Q_COMPILER_VARIADIC_MACROS
#define Q_ENUMS(x) # define Q_PROPERTY(...) QT_ANNOTATE_CLASS(qt_property, __VA_ARGS__)
#define Q_FLAGS(x) #else
#define Q_ENUM(ENUM) \ # 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_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 QMetaObject *qt_getEnumMetaObject(ENUM) Q_DECL_NOEXCEPT { return &staticMetaObject; } \
friend Q_DECL_CONSTEXPR const char *qt_getEnumName(ENUM) Q_DECL_NOEXCEPT { return #ENUM; } friend Q_DECL_CONSTEXPR const char *qt_getEnumName(ENUM) Q_DECL_NOEXCEPT { return #ENUM; }
#define Q_FLAG(ENUM) Q_ENUM(ENUM) #define Q_ENUM(x) Q_ENUMS(x) Q_ENUM_IMPL(x)
#define Q_SCRIPTABLE #define Q_FLAG(x) Q_FLAGS(x) Q_ENUM_IMPL(x)
#define Q_INVOKABLE #define Q_SCRIPTABLE QT_ANNOTATE_FUNCTION(qt_scriptable)
#define Q_SIGNAL #define Q_INVOKABLE QT_ANNOTATE_FUNCTION(qt_invokable)
#define Q_SLOT #define Q_SIGNAL QT_ANNOTATE_FUNCTION(qt_signal)
#define Q_SLOT QT_ANNOTATE_FUNCTION(qt_slot)
#endif // QT_NO_META_MACROS #endif // QT_NO_META_MACROS
#ifndef QT_NO_TRANSLATION #ifndef QT_NO_TRANSLATION
@ -180,10 +205,11 @@ private: \
Q_OBJECT_NO_ATTRIBUTES_WARNING \ Q_OBJECT_NO_ATTRIBUTES_WARNING \
Q_DECL_HIDDEN_STATIC_METACALL static void qt_static_metacall(QObject *, QMetaObject::Call, int, void **); \ Q_DECL_HIDDEN_STATIC_METACALL static void qt_static_metacall(QObject *, QMetaObject::Call, int, void **); \
QT_WARNING_POP \ QT_WARNING_POP \
struct QPrivateSignal {}; struct QPrivateSignal {}; \
QT_ANNOTATE_CLASS(qt_qobject, "")
/* qmake ignore Q_OBJECT */ /* 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 #ifndef QT_NO_META_MACROS
/* qmake ignore Q_GADGET */ /* qmake ignore Q_GADGET */
@ -197,6 +223,7 @@ private: \
Q_OBJECT_NO_ATTRIBUTES_WARNING \ Q_OBJECT_NO_ATTRIBUTES_WARNING \
Q_DECL_HIDDEN_STATIC_METACALL static void qt_static_metacall(QObject *, QMetaObject::Call, int, void **); \ Q_DECL_HIDDEN_STATIC_METACALL static void qt_static_metacall(QObject *, QMetaObject::Call, int, void **); \
QT_WARNING_POP \ QT_WARNING_POP \
QT_ANNOTATE_CLASS(qt_qgadget, "") \
/*end*/ /*end*/
#endif // QT_NO_META_MACROS #endif // QT_NO_META_MACROS

View File

@ -606,19 +606,20 @@ int QDateTimeParser::sectionMaxSize(Section s, int count) const
// fall through // fall through
#endif #endif
case MonthSection: case MonthSection:
if (count <= 2)
return 2;
#ifdef QT_NO_TEXTDATE #ifdef QT_NO_TEXTDATE
return 2; return 2;
#else #else
if (count <= 2)
return 2;
{ {
int ret = 0; int ret = 0;
const QLocale l = locale(); const QLocale l = locale();
const QLocale::FormatType format = count == 4 ? QLocale::LongFormat : QLocale::ShortFormat;
for (int i=1; i<=mcount; ++i) { for (int i=1; i<=mcount; ++i) {
const QString str = (s == MonthSection const QString str = (s == MonthSection
? l.monthName(i, count == 4 ? QLocale::LongFormat : QLocale::ShortFormat) ? l.monthName(i, format)
: l.dayName(i, count == 4 ? QLocale::LongFormat : QLocale::ShortFormat)); : l.dayName(i, format));
ret = qMax(str.size(), ret); ret = qMax(str.size(), ret);
} }
return ret; return ret;

View File

@ -1,4 +1,3 @@
/**************************************************************************** /****************************************************************************
** **
** Copyright (C) 2016 The Qt Company Ltd. ** Copyright (C) 2016 The Qt Company Ltd.

View File

@ -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 inline QT_ASCII_CAST_WARN bool QStringRef::operator<(const char *s) const
{ return QString::compare_helper(constData(), size(), s, -1) < 0; } { return QString::compare_helper(constData(), size(), s, -1) < 0; }
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; } { 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 inline QT_ASCII_CAST_WARN bool QStringRef::operator>=(const char *s) const
{ return QString::compare_helper(constData(), size(), s, -1) >= 0; } { 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) 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) 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) 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; }
inline QT_ASCII_CAST_WARN bool operator>=(const char *s1, const QStringRef &s2)
{ return QString::compare_helper(s2.constData(), s2.size(), s1, -1) <= 0; }
#endif // !defined(QT_NO_CAST_FROM_ASCII) && !defined(QT_RESTRICTED_CAST_FROM_ASCII) #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 inline int QString::compare(const QStringRef &s, Qt::CaseSensitivity cs) const Q_DECL_NOTHROW

View File

@ -447,22 +447,45 @@ QTimeZone::OffsetData QTimeZonePrivate::toOffsetData(const QTimeZonePrivate::Dat
return offsetData; return offsetData;
} }
// If the format of the ID is valid // Is the format of the ID valid ?
bool QTimeZonePrivate::isValidId(const QByteArray &ianaId) 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 Main rules for defining TZ/IANA names as per ftp://ftp.iana.org/tz/code/Theory
// 2. Within a file name component, use only ASCII letters, `.', `-' and `_'. 1. Use only valid POSIX file name components
// 3. Do not use digits 2. Within a file name component, use only ASCII letters, `.', `-' and `_'.
// 4. A file name component must not exceed 14 characters or start with `-' 3. Do not use digits (except in a [+-]\d+ suffix, when used).
// Aliases such as "Etc/GMT+7" and "SystemV/EST5EDT" are valid so we need to accept digits, ':', and '+'. 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.
// The following would be preferable if QRegExp would work on QByteArrays directly: In particular, aliases such as "Etc/GMT+7" and "SystemV/EST5EDT" are valid
// const QRegExp rx(QStringLiteral("[a-z0-9:+._][a-z0-9:+._-]{,13}(?:/[a-z0-9:+._][a-z0-9:+._-]{,13})*"), so we need to accept digits, ':', and '+'; aliases typically have the form
// Qt::CaseInsensitive); of POSIX TZ strings, which allow a suffix to a proper IANA name. A POSIX
// return rx.exactMatch(ianaId); 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.
// hand-rolled version: 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 MinSectionLength = 1;
const int MaxSectionLength = 14; const int MaxSectionLength = 14;
int sectionLength = 0; int sectionLength = 0;
@ -478,11 +501,11 @@ bool QTimeZonePrivate::isValidId(const QByteArray &ianaId)
} else if (!(ch >= 'a' && ch <= 'z') } else if (!(ch >= 'a' && ch <= 'z')
&& !(ch >= 'A' && ch <= 'Z') && !(ch >= 'A' && ch <= 'Z')
&& !(ch == '_') && !(ch == '_')
&& !(ch == '.')
// Should ideally check these only happen as an offset:
&& !(ch >= '0' && ch <= '9') && !(ch >= '0' && ch <= '9')
&& !(ch == '-')
&& !(ch == '+') && !(ch == '+')
&& !(ch == ':') && !(ch == ':')) {
&& !(ch == '.')) {
return false; // violates (2) return false; // violates (2)
} }
} }

View File

@ -516,8 +516,10 @@ void QOpenGLContext::setScreen(QScreen *screen)
void QOpenGLContextPrivate::_q_screenDestroyed(QObject *object) void QOpenGLContextPrivate::_q_screenDestroyed(QObject *object)
{ {
Q_Q(QOpenGLContext); Q_Q(QOpenGLContext);
if (object == static_cast<QObject *>(screen)) if (object == static_cast<QObject *>(screen)) {
screen = 0;
q->setScreen(0); q->setScreen(0);
}
} }
/*! /*!

View File

@ -3893,7 +3893,7 @@ void QClipData::setClipRect(const QRect &rect)
void QClipData::setClipRegion(const QRegion &region) void QClipData::setClipRegion(const QRegion &region)
{ {
if (region.rectCount() == 1) { if (region.rectCount() == 1) {
setClipRect(region.rects().at(0)); setClipRect(region.boundingRect());
return; return;
} }

View File

@ -1562,6 +1562,7 @@ void QPdfEnginePrivate::embedFont(QFontSubset *font)
int toUnicode = requestObject(); int toUnicode = requestObject();
QFontEngine::Properties properties = font->fontEngine->properties(); QFontEngine::Properties properties = font->fontEngine->properties();
QByteArray postscriptName = properties.postscriptName.replace(' ', '_');
{ {
qreal scale = 1000/properties.emSquare.toReal(); qreal scale = 1000/properties.emSquare.toReal();
@ -1575,7 +1576,7 @@ void QPdfEnginePrivate::embedFont(QFontSubset *font)
s << (char)('A' + (tag % 26)); s << (char)('A' + (tag % 26));
tag /= 26; tag /= 26;
} }
s << '+' << properties.postscriptName << "\n" s << '+' << postscriptName << "\n"
"/Flags " << 4 << "\n" "/Flags " << 4 << "\n"
"/FontBBox [" "/FontBBox ["
<< properties.boundingBox.x()*scale << properties.boundingBox.x()*scale
@ -1618,7 +1619,7 @@ void QPdfEnginePrivate::embedFont(QFontSubset *font)
QPdf::ByteStream s(&cid); QPdf::ByteStream s(&cid);
s << "<< /Type /Font\n" s << "<< /Type /Font\n"
"/Subtype /CIDFontType2\n" "/Subtype /CIDFontType2\n"
"/BaseFont /" << properties.postscriptName << "\n" "/BaseFont /" << postscriptName << "\n"
"/CIDSystemInfo << /Registry (Adobe) /Ordering (Identity) /Supplement 0 >>\n" "/CIDSystemInfo << /Registry (Adobe) /Ordering (Identity) /Supplement 0 >>\n"
"/FontDescriptor " << fontDescriptor << "0 R\n" "/FontDescriptor " << fontDescriptor << "0 R\n"
"/CIDToGIDMap /Identity\n" "/CIDToGIDMap /Identity\n"
@ -1642,7 +1643,7 @@ void QPdfEnginePrivate::embedFont(QFontSubset *font)
QPdf::ByteStream s(&font); QPdf::ByteStream s(&font);
s << "<< /Type /Font\n" s << "<< /Type /Font\n"
"/Subtype /Type0\n" "/Subtype /Type0\n"
"/BaseFont /" << properties.postscriptName << "\n" "/BaseFont /" << postscriptName << "\n"
"/Encoding /Identity-H\n" "/Encoding /Identity-H\n"
"/DescendantFonts [" << cidfont << "0 R]\n" "/DescendantFonts [" << cidfont << "0 R]\n"
"/ToUnicode " << toUnicode << "0 R" "/ToUnicode " << toUnicode << "0 R"

View File

@ -617,7 +617,7 @@ bool QFtpDTP::parseDir(const QByteArray &buffer, const QString &userName, QUrlIn
if (buffer.isEmpty()) if (buffer.isEmpty())
return false; return false;
QString bufferStr = QString::fromLatin1(buffer).trimmed(); QString bufferStr = QString::fromUtf8(buffer).trimmed();
// Unix style FTP servers // Unix style FTP servers
QRegExp unixPattern(QLatin1String("^([\\-dl])([a-zA-Z\\-]{9,9})\\s+\\d+\\s+(\\S*)\\s+" 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 // does not exist, but rather write a text to the data socket
// -- try to catch these cases // -- try to catch these cases
if (line.endsWith("No such file or directory\r\n")) if (line.endsWith("No such file or directory\r\n"))
err = QString::fromLatin1(line); err = QString::fromUtf8(line);
} }
} }
} else { } else {
@ -938,7 +938,7 @@ void QFtpPI::readyRead()
while (commandSocket.canReadLine()) { while (commandSocket.canReadLine()) {
// read line with respect to line continuation // read line with respect to line continuation
QString line = QString::fromLatin1(commandSocket.readLine()); QString line = QString::fromUtf8(commandSocket.readLine());
if (replyText.isEmpty()) { if (replyText.isEmpty()) {
if (line.length() < 3) { if (line.length() < 3) {
// protocol error // protocol error
@ -970,7 +970,7 @@ void QFtpPI::readyRead()
replyText += line; replyText += line;
if (!commandSocket.canReadLine()) if (!commandSocket.canReadLine())
return; return;
line = QString::fromLatin1(commandSocket.readLine()); line = QString::fromUtf8(commandSocket.readLine());
lineLeft4 = line.leftRef(4); lineLeft4 = line.leftRef(4);
} }
replyText += line.midRef(4); // strip reply code 'xyz ' 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()); qDebug("QFtpPI send: %s", currentCmd.left(currentCmd.length()-2).toLatin1().constData());
#endif #endif
state = Waiting; state = Waiting;
commandSocket.write(currentCmd.toLatin1()); commandSocket.write(currentCmd.toUtf8());
return true; return true;
} }

View File

@ -39,10 +39,6 @@
#include "qlocalsocket_p.h" #include "qlocalsocket_p.h"
#include <private/qthread_p.h>
#include <qcoreapplication.h>
#include <qdebug.h>
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE
void QLocalSocketPrivate::init() void QLocalSocketPrivate::init()

View File

@ -50,37 +50,37 @@
QT_BEGIN_NAMESPACE 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()); 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()); 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()); 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()); 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()); 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()); 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(), return D2D1::Matrix3x2F(transform.m11(), transform.m12(),
transform.m21(), transform.m22(), transform.m21(), transform.m22(),

View File

@ -103,9 +103,9 @@ QWindowsPixmapCursorCacheKey::QWindowsPixmapCursorCacheKey(const QCursor &c)
HCURSOR QWindowsCursor::createPixmapCursor(QPixmap pixmap, const QPoint &hotSpot, qreal scaleFactor) HCURSOR QWindowsCursor::createPixmapCursor(QPixmap pixmap, const QPoint &hotSpot, qreal scaleFactor)
{ {
HCURSOR cur = 0; HCURSOR cur = 0;
scaleFactor /= pixmap.devicePixelRatioF(); const qreal pixmapScaleFactor = scaleFactor / pixmap.devicePixelRatioF();
if (!qFuzzyCompare(scaleFactor, 1)) { if (!qFuzzyCompare(pixmapScaleFactor, 1)) {
pixmap = pixmap.scaled((scaleFactor * QSizeF(pixmap.size())).toSize(), pixmap = pixmap.scaled((pixmapScaleFactor * QSizeF(pixmap.size())).toSize(),
Qt::KeepAspectRatio, Qt::SmoothTransformation); Qt::KeepAspectRatio, Qt::SmoothTransformation);
} }
QBitmap mask = pixmap.mask(); QBitmap mask = pixmap.mask();
@ -119,8 +119,8 @@ HCURSOR QWindowsCursor::createPixmapCursor(QPixmap pixmap, const QPoint &hotSpot
ICONINFO ii; ICONINFO ii;
ii.fIcon = 0; ii.fIcon = 0;
ii.xHotspot = DWORD(hotSpot.x()); ii.xHotspot = DWORD(qRound(hotSpot.x() * scaleFactor));
ii.yHotspot = DWORD(hotSpot.y()); ii.yHotspot = DWORD(qRound(hotSpot.y() * scaleFactor));
ii.hbmMask = im; ii.hbmMask = im;
ii.hbmColor = ic; ii.hbmColor = ic;

View File

@ -347,10 +347,14 @@ QPlatformWindow *QWindowsIntegration::createPlatformWindow(QWindow *window) cons
if (requested.flags != obtained.flags) if (requested.flags != obtained.flags)
window->setFlags(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 ((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); QWindowSystemInterface::handleGeometryChange(window, obtained.geometry);
}
QPlatformScreen *screen = result->screenForGeometry(obtained.geometry); QPlatformScreen *screen = result->screenForGeometry(obtained.geometry);
if (screen && result->screen() != screen) if (screen && result->screen() != screen)
QWindowSystemInterface::handleWindowScreenChanged(window, screen->screen()); QWindowSystemInterface::handleWindowScreenChanged(window, screen->screen());

View File

@ -163,8 +163,10 @@ void *QWindowsNativeInterface::nativeResourceForIntegration(const QByteArray &re
#ifdef QT_NO_OPENGL #ifdef QT_NO_OPENGL
Q_UNUSED(resource) Q_UNUSED(resource)
#else #else
if (resourceType(resource) == GlHandleType) if (resourceType(resource) == GlHandleType) {
return QWindowsIntegration::staticOpenGLContext()->moduleHandle(); if (const QWindowsStaticOpenGLContext *sc = QWindowsIntegration::staticOpenGLContext())
return sc->moduleHandle();
}
#endif #endif
return 0; return 0;

View File

@ -358,7 +358,7 @@ QVariant QWinRTTheme::styleHint(QPlatformIntegration::StyleHint hint)
case QPlatformIntegration::PasswordMaskCharacter: case QPlatformIntegration::PasswordMaskCharacter:
return defaultThemeHint(PasswordMaskCharacter); return defaultThemeHint(PasswordMaskCharacter);
case QPlatformIntegration::SetFocusOnTouchRelease: case QPlatformIntegration::SetFocusOnTouchRelease:
return false; return true;
case QPlatformIntegration::ShowIsMaximized: case QPlatformIntegration::ShowIsMaximized:
return true; return true;
case QPlatformIntegration::MousePressAndHoldInterval: case QPlatformIntegration::MousePressAndHoldInterval:

View File

@ -1002,7 +1002,6 @@ QList<int> QXcbKeyboard::possibleKeys(const QKeyEvent *event) const
Q_ASSERT(shiftMod < 32); Q_ASSERT(shiftMod < 32);
Q_ASSERT(altMod < 32); Q_ASSERT(altMod < 32);
Q_ASSERT(controlMod < 32); Q_ASSERT(controlMod < 32);
Q_ASSERT(metaMod < 32);
xkb_mod_mask_t depressed; xkb_mod_mask_t depressed;
int qtKey = 0; int qtKey = 0;
@ -1023,7 +1022,7 @@ QList<int> QXcbKeyboard::possibleKeys(const QKeyEvent *event) const
depressed |= (1 << shiftMod); depressed |= (1 << shiftMod);
if (neededMods & Qt::ControlModifier) if (neededMods & Qt::ControlModifier)
depressed |= (1 << controlMod); depressed |= (1 << controlMod);
if (neededMods & Qt::MetaModifier) if (metaMod < 32 && neededMods & Qt::MetaModifier)
depressed |= (1 << metaMod); depressed |= (1 << metaMod);
xkb_state_update_mask(kb_state, depressed, latchedMods, lockedMods, 0, 0, lockedLayout); xkb_state_update_mask(kb_state, depressed, latchedMods, lockedMods, 0, 0, lockedLayout);
sym = xkb_state_key_get_one_sym(kb_state, keycode); sym = xkb_state_key_get_one_sym(kb_state, keycode);

View File

@ -1,4 +1,3 @@
/**************************************************************************** /****************************************************************************
** **
** Copyright (C) 2016 The Qt Company Ltd. ** Copyright (C) 2016 The Qt Company Ltd.

View File

@ -1,4 +1,3 @@
/**************************************************************************** /****************************************************************************
** **
** Copyright (C) 2016 The Qt Company Ltd. ** Copyright (C) 2016 The Qt Company Ltd.

View File

@ -106,7 +106,7 @@ QFontListView::QFontListView(QWidget *parent)
} }
static const Qt::WindowFlags DefaultWindowFlags = static const Qt::WindowFlags DefaultWindowFlags =
Qt::Dialog | Qt::WindowSystemMenuHint; Qt::Dialog | Qt::WindowSystemMenuHint | Qt::WindowCloseButtonHint;
QFontDialogPrivate::QFontDialogPrivate() QFontDialogPrivate::QFontDialogPrivate()
: writingSystem(QFontDatabase::Any), : writingSystem(QFontDatabase::Any),

View File

@ -1499,7 +1499,8 @@ bool QHeaderView::stretchLastSection() const
void QHeaderView::setStretchLastSection(bool stretch) void QHeaderView::setStretchLastSection(bool stretch)
{ {
Q_D(QHeaderView); Q_D(QHeaderView);
const bool changedStretchMode = (d->stretchLastSection != stretch); if (d->stretchLastSection == stretch)
return;
d->stretchLastSection = stretch; d->stretchLastSection = stretch;
if (d->state != QHeaderViewPrivate::NoState) if (d->state != QHeaderViewPrivate::NoState)
return; return;
@ -1507,8 +1508,7 @@ void QHeaderView::setStretchLastSection(bool stretch)
d->setNewLastSection(d->lastVisibleVisualIndex()); d->setNewLastSection(d->lastVisibleVisualIndex());
resizeSections(); resizeSections();
} else { } else {
if (changedStretchMode) d->restoreSizeOnPrevLastSection();
d->restoreSizeOnPrevLastSection();
} }
} }

View File

@ -803,10 +803,8 @@ static void drawArrow(const QStyle *style, const QStyleOptionToolButton *toolbut
default: default:
return; return;
} }
QStyleOption arrowOpt; QStyleOption arrowOpt = *toolbutton;
arrowOpt.rect = rect; arrowOpt.rect = rect;
arrowOpt.palette = toolbutton->palette;
arrowOpt.state = toolbutton->state;
style->drawPrimitive(pe, &arrowOpt, painter, widget); style->drawPrimitive(pe, &arrowOpt, painter, widget);
} }
#endif // QT_NO_TOOLBUTTON #endif // QT_NO_TOOLBUTTON
@ -3345,8 +3343,7 @@ void QCommonStyle::drawComplexControl(ComplexControl cc, const QStyleOptionCompl
mflags |= State_Sunken; mflags |= State_Sunken;
} }
QStyleOption tool(0); QStyleOption tool = *toolbutton;
tool.palette = toolbutton->palette;
if (toolbutton->subControls & SC_ToolButton) { if (toolbutton->subControls & SC_ToolButton) {
if (bflags & (State_Sunken | State_On | State_Raised)) { if (bflags & (State_Sunken | State_On | State_Raised)) {
tool.rect = button; tool.rect = button;
@ -3415,8 +3412,7 @@ void QCommonStyle::drawComplexControl(ComplexControl cc, const QStyleOptionCompl
bool down = false; bool down = false;
QPixmap pm; QPixmap pm;
QStyleOption tool(0); QStyleOption tool = *tb;
tool.palette = tb->palette;
if (tb->subControls & SC_TitleBarCloseButton && tb->titleBarFlags & Qt::WindowSystemMenuHint) { if (tb->subControls & SC_TitleBarCloseButton && tb->titleBarFlags & Qt::WindowSystemMenuHint) {
ir = proxy()->subControlRect(CC_TitleBar, tb, SC_TitleBarCloseButton, widget); ir = proxy()->subControlRect(CC_TitleBar, tb, SC_TitleBarCloseButton, widget);
down = tb->activeSubControls & SC_TitleBarCloseButton && (opt->state & State_Sunken); down = tb->activeSubControls & SC_TitleBarCloseButton && (opt->state & State_Sunken);

View File

@ -273,6 +273,7 @@ static QImage blendedImage(const QImage &start, const QImage &end, float alpha)
case 32: case 32:
{ {
blended = QImage(sw, sh, start.format()); blended = QImage(sw, sh, start.format());
blended.setDevicePixelRatio(start.devicePixelRatio());
uchar *mixed_data = blended.bits(); uchar *mixed_data = blended.bits();
const uchar *back_data = start.bits(); const uchar *back_data = start.bits();
const uchar *front_data = end.bits(); const uchar *front_data = end.bits();

View File

@ -117,8 +117,6 @@ enum QSliderDirection { SlUp, SlDown, SlLeft, SlRight };
\internal \internal
*/ */
int QWindowsStylePrivate::m_appDevicePixelRatio = 0;
QWindowsStylePrivate::QWindowsStylePrivate() QWindowsStylePrivate::QWindowsStylePrivate()
: alt_down(false), menuBarTimer(0) : alt_down(false), menuBarTimer(0)
{ {
@ -131,11 +129,9 @@ QWindowsStylePrivate::QWindowsStylePrivate()
#endif #endif
} }
int QWindowsStylePrivate::appDevicePixelRatio() qreal QWindowsStylePrivate::appDevicePixelRatio()
{ {
if (!QWindowsStylePrivate::m_appDevicePixelRatio) return qApp->devicePixelRatio();
QWindowsStylePrivate::m_appDevicePixelRatio = qRound(qApp->devicePixelRatio());
return QWindowsStylePrivate::m_appDevicePixelRatio;
} }
// Returns \c true if the toplevel parent of \a widget has seen the Alt-key // 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); int ret = QWindowsStylePrivate::pixelMetricFromSystemDp(pm, opt, widget);
if (ret != QWindowsStylePrivate::InvalidMetric) if (ret != QWindowsStylePrivate::InvalidMetric)
return ret / QWindowsStylePrivate::devicePixelRatio(widget); return qRound(qreal(ret) / QWindowsStylePrivate::devicePixelRatio(widget));
ret = QWindowsStylePrivate::fixedPixelMetric(pm); ret = QWindowsStylePrivate::fixedPixelMetric(pm);
if (ret != QWindowsStylePrivate::InvalidMetric) if (ret != QWindowsStylePrivate::InvalidMetric)

View File

@ -70,8 +70,8 @@ public:
QWindowsStylePrivate(); QWindowsStylePrivate();
static int pixelMetricFromSystemDp(QStyle::PixelMetric pm, const QStyleOption *option = 0, const QWidget *widget = 0); static int pixelMetricFromSystemDp(QStyle::PixelMetric pm, const QStyleOption *option = 0, const QWidget *widget = 0);
static int fixedPixelMetric(QStyle::PixelMetric pm); static int fixedPixelMetric(QStyle::PixelMetric pm);
static int devicePixelRatio(const QWidget *widget = 0) static qreal devicePixelRatio(const QWidget *widget = 0)
{ return widget ? int(widget->devicePixelRatioF()) : QWindowsStylePrivate::appDevicePixelRatio(); } { return widget ? widget->devicePixelRatioF() : QWindowsStylePrivate::appDevicePixelRatio(); }
bool hasSeenAlt(const QWidget *widget) const; bool hasSeenAlt(const QWidget *widget) const;
bool altDown() const { return alt_down; } bool altDown() const { return alt_down; }
@ -96,8 +96,7 @@ public:
}; };
private: private:
static int appDevicePixelRatio(); static qreal appDevicePixelRatio();
static int m_appDevicePixelRatio;
}; };
QT_END_NAMESPACE QT_END_NAMESPACE

View File

@ -108,6 +108,15 @@ bool canAnimate(const QStyleOption *option) {
&& !option->styleObject->property("_q_no_animation").toBool(); && !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 /* \internal
Used by animations to clone a styleoption and shift its offset 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 // We create separate images for the initial and final transition states and store them in the
// Transition object. // Transition object.
QImage startImage(option->rect.size(), QImage::Format_ARGB32_Premultiplied); QImage startImage = createAnimationBuffer(option, widget);
startImage.fill(0);
QPainter startPainter(&startImage); QPainter startPainter(&startImage);
QImage endImage(option->rect.size(), QImage::Format_ARGB32_Premultiplied); QImage endImage = createAnimationBuffer(option, widget);
endImage.fill(0);
QPainter endPainter(&endImage); QPainter endPainter(&endImage);
// If we have a running animation on the widget already, we will use that to paint the initial // 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; XPThemeData themeSize = theme;
themeSize.partId = TVP_HOTGLYPH; themeSize.partId = TVP_HOTGLYPH;
themeSize.stateId = GLPS_OPENED; themeSize.stateId = GLPS_OPENED;
const QSize size = themeSize.size() / QWindowsXPStylePrivate::devicePixelRatio(widget); const QSizeF size = themeSize.size() / QWindowsXPStylePrivate::devicePixelRatio(widget);
decoration_size = qMax(size.width(), size.height()); decoration_size = qRound(qMax(size.width(), size.height()));
} }
int mid_h = option->rect.x() + option->rect.width() / 2; int mid_h = option->rect.x() + option->rect.width() / 2;
int mid_v = option->rect.y() + option->rect.height() / 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); QStyleOption *styleOption = clonedAnimationStyleOption(option);
styleOption->state = (QStyle::State)oldState; styleOption->state = (QStyle::State)oldState;
QImage startImage(option->rect.size(), QImage::Format_ARGB32_Premultiplied); QImage startImage = createAnimationBuffer(option, widget);
startImage.fill(0);
QPainter startPainter(&startImage); QPainter startPainter(&startImage);
// Use current state of existing animation if already one is running // 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); t->setStartImage(startImage);
QImage endImage(option->rect.size(), QImage::Format_ARGB32_Premultiplied); QImage endImage = createAnimationBuffer(option, widget);
endImage.fill(0);
QPainter endPainter(&endImage); QPainter endPainter(&endImage);
styleOption->state = option->state; styleOption->state = option->state;
proxy()->drawControl(element, styleOption, &endPainter, widget); 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))); QWindowsVistaAnimation *anim = qobject_cast<QWindowsVistaAnimation *>(d->animation(styleObject(option)));
if (!anim) { if (!anim) {
QImage startImage(option->rect.size(), QImage::Format_ARGB32_Premultiplied); QImage startImage = createAnimationBuffer(option, widget);
startImage.fill(0); QImage alternateImage = createAnimationBuffer(option, widget);
QImage alternateImage(option->rect.size(), QImage::Format_ARGB32_Premultiplied);
alternateImage.fill(0);
QWindowsVistaPulse *pulse = new QWindowsVistaPulse(styleObject(option)); QWindowsVistaPulse *pulse = new QWindowsVistaPulse(styleObject(option));
@ -991,10 +994,10 @@ void QWindowsVistaStyle::drawControl(ControlElement element, const QStyleOption
XPThemeData theme(widget, 0, QWindowsXPStylePrivate::ToolBarTheme, XPThemeData theme(widget, 0, QWindowsXPStylePrivate::ToolBarTheme,
TP_DROPDOWNBUTTON); TP_DROPDOWNBUTTON);
if (theme.isValid()) { if (theme.isValid()) {
const QSize size = theme.size() / QWindowsXPStylePrivate::devicePixelRatio(widget); const QSizeF size = theme.size() / QWindowsXPStylePrivate::devicePixelRatio(widget);
if (!size.isEmpty()) { if (!size.isEmpty()) {
mbiw = size.width(); mbiw = qRound(size.width());
mbih = size.height(); mbih = qRound(size.height());
} }
} }
QRect ir = subElementRect(SE_PushButtonContents, option, 0); QRect ir = subElementRect(SE_PushButtonContents, option, 0);
@ -1178,17 +1181,18 @@ void QWindowsVistaStyle::drawControl(ControlElement element, const QStyleOption
case CE_MenuItem: case CE_MenuItem:
if (const QStyleOptionMenuItem *menuitem = qstyleoption_cast<const QStyleOptionMenuItem *>(option)) { if (const QStyleOptionMenuItem *menuitem = qstyleoption_cast<const QStyleOptionMenuItem *>(option)) {
// windows always has a check column, regardless whether we have an icon or not // windows always has a check column, regardless whether we have an icon or not
int checkcol = 25 / QWindowsXPStylePrivate::devicePixelRatio(widget); const qreal devicePixelRatio = QWindowsXPStylePrivate::devicePixelRatio(widget);
const int gutterWidth = 3 / QWindowsXPStylePrivate::devicePixelRatio(widget); int checkcol = qRound(qreal(25) / devicePixelRatio);
const int gutterWidth = qRound(qreal(3) / devicePixelRatio);
{ {
XPThemeData theme(widget, 0, QWindowsXPStylePrivate::MenuTheme, XPThemeData theme(widget, 0, QWindowsXPStylePrivate::MenuTheme,
MENU_POPUPCHECKBACKGROUND, MBI_HOT); MENU_POPUPCHECKBACKGROUND, MBI_HOT);
XPThemeData themeSize = theme; XPThemeData themeSize = theme;
themeSize.partId = MENU_POPUPCHECK; themeSize.partId = MENU_POPUPCHECK;
themeSize.stateId = 0; themeSize.stateId = 0;
const QSize size = themeSize.size() / QWindowsXPStylePrivate::devicePixelRatio(widget); const QSizeF size = themeSize.size() / QWindowsXPStylePrivate::devicePixelRatio(widget);
const QMargins margins = themeSize.margins() / QWindowsXPStylePrivate::devicePixelRatio(widget); const QMarginsF margins = themeSize.margins() / QWindowsXPStylePrivate::devicePixelRatio(widget);
checkcol = qMax(menuitem->maxIconWidth, gutterWidth + size.width() + margins.left() + margins.right()); checkcol = qMax(menuitem->maxIconWidth, qRound(gutterWidth + size.width() + margins.left() + margins.right()));
} }
QRect rect = option->rect; QRect rect = option->rect;
@ -1245,17 +1249,17 @@ void QWindowsVistaStyle::drawControl(ControlElement element, const QStyleOption
XPThemeData themeSize = theme; XPThemeData themeSize = theme;
themeSize.partId = MENU_POPUPCHECK; themeSize.partId = MENU_POPUPCHECK;
themeSize.stateId = 0; themeSize.stateId = 0;
const QSize size = themeSize.size() / QWindowsXPStylePrivate::devicePixelRatio(widget); const QSizeF size = themeSize.size() / QWindowsXPStylePrivate::devicePixelRatio(widget);
const QMargins margins = themeSize.margins() / QWindowsXPStylePrivate::devicePixelRatio(widget); const QMarginsF margins = themeSize.margins() / QWindowsXPStylePrivate::devicePixelRatio(widget);
QRect checkRect(0, 0, size.width() + margins.left() + margins.right(), QRect checkRect(0, 0, qRound(size.width() + margins.left() + margins.right()),
size.height() + margins.bottom() + margins.top()); qRound(size.height() + margins.bottom() + margins.top()));
checkRect.moveCenter(vCheckRect.center()); checkRect.moveCenter(vCheckRect.center());
theme.rect = checkRect; theme.rect = checkRect;
d->drawBackground(theme); d->drawBackground(theme);
if (menuitem->icon.isNull()) { if (menuitem->icon.isNull()) {
checkRect = QRect(QPoint(0, 0), size); checkRect = QRect(QPoint(0, 0), size.toSize());
checkRect.moveCenter(theme.rect.center()); checkRect.moveCenter(theme.rect.center());
theme.rect = checkRect; theme.rect = checkRect;
@ -1549,13 +1553,10 @@ void QWindowsVistaStyle::drawComplexControl(ComplexControl control, const QStyle
} }
if (doTransition) { if (doTransition) {
QImage startImage = createAnimationBuffer(option, widget);
QImage startImage(option->rect.size(), QImage::Format_ARGB32_Premultiplied);
startImage.fill(0);
QPainter startPainter(&startImage); QPainter startPainter(&startImage);
QImage endImage(option->rect.size(), QImage::Format_ARGB32_Premultiplied); QImage endImage = createAnimationBuffer(option, widget);
endImage.fill(0);
QPainter endPainter(&endImage); QPainter endPainter(&endImage);
QWindowsVistaAnimation *anim = qobject_cast<QWindowsVistaAnimation *>(d->animation(styleObject)); QWindowsVistaAnimation *anim = qobject_cast<QWindowsVistaAnimation *>(d->animation(styleObject));
@ -1861,10 +1862,10 @@ QSize QWindowsVistaStyle::sizeFromContents(ContentsType type, const QStyleOption
XPThemeData themeSize = theme; XPThemeData themeSize = theme;
themeSize.partId = MENU_POPUPCHECK; themeSize.partId = MENU_POPUPCHECK;
themeSize.stateId = 0; themeSize.stateId = 0;
const QSize size = themeSize.size() / QWindowsXPStylePrivate::devicePixelRatio(widget); const QSizeF size = themeSize.size() / QWindowsXPStylePrivate::devicePixelRatio(widget);
const QMargins margins = themeSize.margins() / QWindowsXPStylePrivate::devicePixelRatio(widget); const QMarginsF margins = themeSize.margins() / QWindowsXPStylePrivate::devicePixelRatio(widget);
minimumHeight = qMax(size.height() + margins.bottom() + margins.top(), sz.height()); minimumHeight = qMax(qRound(size.height() + margins.bottom() + margins.top()), sz.height());
sz.rwidth() += size.width() + margins.left() + margins.right(); sz.rwidth() += qRound(size.width() + margins.left() + margins.right());
} }
if (const QStyleOptionMenuItem *menuitem = qstyleoption_cast<const QStyleOptionMenuItem *>(option)) { if (const QStyleOptionMenuItem *menuitem = qstyleoption_cast<const QStyleOptionMenuItem *>(option)) {
@ -1972,10 +1973,10 @@ QRect QWindowsVistaStyle::subElementRect(SubElement element, const QStyleOption
int arrowWidth = 13; int arrowWidth = 13;
int arrowHeight = 5; int arrowHeight = 5;
if (theme.isValid()) { if (theme.isValid()) {
const QSize size = theme.size() / QWindowsXPStylePrivate::devicePixelRatio(widget); const QSizeF size = theme.size() / QWindowsXPStylePrivate::devicePixelRatio(widget);
if (!size.isEmpty()) { if (!size.isEmpty()) {
arrowWidth = size.width(); arrowWidth = qRound(size.width());
arrowHeight = size.height(); arrowHeight = qRound(size.height());
} }
} }
if (option->state & State_Horizontal) { if (option->state & State_Horizontal) {
@ -2516,7 +2517,7 @@ QIcon QWindowsVistaStyle::standardIcon(StandardPixmap standardIcon,
QWindowsXPStylePrivate::ButtonTheme, QWindowsXPStylePrivate::ButtonTheme,
BP_COMMANDLINKGLYPH, CMDLGS_NORMAL); BP_COMMANDLINKGLYPH, CMDLGS_NORMAL);
if (theme.isValid()) { if (theme.isValid()) {
const QSize size = theme.size() / QWindowsXPStylePrivate::devicePixelRatio(widget); const QSize size = (theme.size() / QWindowsXPStylePrivate::devicePixelRatio(widget)).toSize();
QIcon linkGlyph; QIcon linkGlyph;
QPixmap pm(size); QPixmap pm(size);
pm.fill(Qt::transparent); pm.fill(Qt::transparent);

View File

@ -431,7 +431,7 @@ const QPixmap *QWindowsXPStylePrivate::tabBody(QWidget *widget)
{ {
if (!tabbody) { if (!tabbody) {
XPThemeData theme(0, 0, QWindowsXPStylePrivate::TabTheme, TABP_BODY); 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()); tabbody = new QPixmap(size.width(), QApplication::desktop()->screenGeometry().height());
QPainter painter(tabbody); QPainter painter(tabbody);
@ -712,6 +712,19 @@ bool QWindowsXPStylePrivate::swapAlphaChannel(const QRect &rect, bool allPixels)
return valueChange; 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 /*! \internal
Main theme drawing function. Main theme drawing function.
Determines the correct lowlevel drawing method depending on several Determines the correct lowlevel drawing method depending on several
@ -735,21 +748,22 @@ bool QWindowsXPStylePrivate::drawBackground(XPThemeData &themeData)
painter->save(); painter->save();
bool complexXForm = painter->deviceTransform().type() > QTransform::TxTranslate;
// Access paintDevice via engine since the painter may // Access paintDevice via engine since the painter may
// return the clip device which can still be a widget device in case of grabWidget(). // return the clip device which can still be a widget device in case of grabWidget().
bool translucentToplevel = false; bool translucentToplevel = false;
const QPaintDevice *paintDevice = painter->device(); const QPaintDevice *paintDevice = painter->device();
const qreal aditionalDevicePixelRatio = themeData.widget ? themeData.widget->devicePixelRatio() : 1;
if (paintDevice->devType() == QInternal::Widget) { if (paintDevice->devType() == QInternal::Widget) {
const QWidget *window = static_cast<const QWidget *>(paintDevice)->window(); const QWidget *window = static_cast<const QWidget *>(paintDevice)->window();
translucentToplevel = window->testAttribute(Qt::WA_TranslucentBackground); translucentToplevel = window->testAttribute(Qt::WA_TranslucentBackground);
} }
const TransformType tt = transformType(painter->deviceTransform(), aditionalDevicePixelRatio);
bool canDrawDirectly = false; bool canDrawDirectly = false;
if (themeData.widget && painter->opacity() == 1.0 && !themeData.rotate if (themeData.widget && painter->opacity() == 1.0 && !themeData.rotate
&& !complexXForm && !themeData.mirrorVertically && tt != ComplexTransform && !themeData.mirrorVertically
&& (!themeData.mirrorHorizontally || pDrawThemeBackgroundEx) && (!themeData.mirrorHorizontally || pDrawThemeBackgroundEx)
&& !translucentToplevel) { && !translucentToplevel) {
// Draw on backing store DC only for real widgets or backing store images. // 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 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(); painter->restore();
return result; 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 /*! \internal
This function draws the theme parts directly to the paintengines HDC. This function draws the theme parts directly to the paintengines HDC.
Do not use this if you need to perform other transformations on the Do not use this if you need to perform other transformations on the
resulting data. resulting data.
*/ */
bool QWindowsXPStylePrivate::drawBackgroundDirectly(XPThemeData &themeData) bool QWindowsXPStylePrivate::drawBackgroundDirectly(HDC dc, XPThemeData &themeData, int additionalDevicePixelRatio)
{ {
QPainter *painter = themeData.painter; QPainter *painter = themeData.painter;
HDC dc = 0;
if (themeData.widget)
dc = hdcForWidgetBackingStore(themeData.widget);
QPoint redirectionDelta(int(painter->deviceMatrix().dx()), QPoint redirectionDelta(int(painter->deviceMatrix().dx()),
int(painter->deviceMatrix().dy())); int(painter->deviceMatrix().dy()));
QRect area = themeData.rect.translated(redirectionDelta); QRect area = scaleRect(themeData.rect, additionalDevicePixelRatio).translated(redirectionDelta);
QRegion sysRgn = painter->paintEngine()->systemClip(); QRegion sysRgn = painter->paintEngine()->systemClip();
if (sysRgn.isEmpty()) if (sysRgn.isEmpty())
@ -794,7 +826,7 @@ bool QWindowsXPStylePrivate::drawBackgroundDirectly(XPThemeData &themeData)
else else
sysRgn &= area; sysRgn &= area;
if (painter->hasClipping()) if (painter->hasClipping())
sysRgn &= painter->clipRegion().translated(redirectionDelta); sysRgn &= scaleRegion(painter->clipRegion(), additionalDevicePixelRatio).translated(redirectionDelta);
HRGN hrgn = qt_hrgn_from_qregion(sysRgn); HRGN hrgn = qt_hrgn_from_qregion(sysRgn);
SelectClipRgn(dc, hrgn); SelectClipRgn(dc, hrgn);
@ -806,6 +838,7 @@ bool QWindowsXPStylePrivate::drawBackgroundDirectly(XPThemeData &themeData)
RECT drawRECT = themeData.toRECT(area); RECT drawRECT = themeData.toRECT(area);
DTBGOPTS drawOptions; DTBGOPTS drawOptions;
memset(&drawOptions, 0, sizeof(drawOptions));
drawOptions.dwSize = sizeof(drawOptions); drawOptions.dwSize = sizeof(drawOptions);
drawOptions.rcClip = themeData.toRECT(sysRgn.boundingRect()); drawOptions.rcClip = themeData.toRECT(sysRgn.boundingRect());
drawOptions.dwFlags = DTBG_CLIPRECT drawOptions.dwFlags = DTBG_CLIPRECT
@ -813,8 +846,9 @@ bool QWindowsXPStylePrivate::drawBackgroundDirectly(XPThemeData &themeData)
| (themeData.noContent ? DTBG_OMITCONTENT : 0) | (themeData.noContent ? DTBG_OMITCONTENT : 0)
| (themeData.mirrorHorizontally ? DTBG_MIRRORDC : 0); | (themeData.mirrorHorizontally ? DTBG_MIRRORDC : 0);
HRESULT result = S_FALSE;
if (pDrawThemeBackgroundEx != 0) { 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 { } else {
// We are running on a system where the uxtheme.dll does not have // We are running on a system where the uxtheme.dll does not have
// the DrawThemeBackgroundEx function, so we need to clip away // 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); SelectClipRgn(dc, 0);
DeleteObject(hrgn); DeleteObject(hrgn);
return true; return SUCCEEDED(result);
} }
/*! \internal /*! \internal
@ -863,10 +897,11 @@ bool QWindowsXPStylePrivate::drawBackgroundDirectly(XPThemeData &themeData)
flips (horizonal mirroring only, vertical are handled by the theme flips (horizonal mirroring only, vertical are handled by the theme
engine). engine).
*/ */
bool QWindowsXPStylePrivate::drawBackgroundThruNativeBuffer(XPThemeData &themeData) bool QWindowsXPStylePrivate::drawBackgroundThruNativeBuffer(XPThemeData &themeData,
int additionalDevicePixelRatio)
{ {
QPainter *painter = themeData.painter; 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. if ((themeData.rotate + 90) % 180 == 0) { // Catch 90,270,etc.. degree flips.
rect = QRect(0, 0, rect.height(), rect.width()); rect = QRect(0, 0, rect.height(), rect.width());
@ -898,6 +933,8 @@ bool QWindowsXPStylePrivate::drawBackgroundThruNativeBuffer(XPThemeData &themeDa
pixmapCacheKey.append(QLatin1Char('w')); pixmapCacheKey.append(QLatin1Char('w'));
pixmapCacheKey.append(QString::number(h)); pixmapCacheKey.append(QString::number(h));
pixmapCacheKey.append(QLatin1Char('h')); pixmapCacheKey.append(QLatin1Char('h'));
pixmapCacheKey.append(QString::number(additionalDevicePixelRatio));
pixmapCacheKey.append(QLatin1Char('d'));
QPixmap cachedPixmap; QPixmap cachedPixmap;
ThemeMapKey key(themeData); 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"); printf("Image format is: %s\n", alphaType == RealAlpha ? "Real Alpha" : alphaType == MaskAlpha ? "Masked Alpha" : "No Alpha");
#endif #endif
img = QImage(bufferPixels, bufferW, bufferH, format); img = QImage(bufferPixels, bufferW, bufferH, format);
img.setDevicePixelRatio(additionalDevicePixelRatio);
} }
// Blitting backing store // Blitting backing store
@ -2010,7 +2048,7 @@ void QWindowsXPStyle::drawControl(ControlElement element, const QStyleOption *op
themeNumber = QWindowsXPStylePrivate::StatusTheme; themeNumber = QWindowsXPStylePrivate::StatusTheme;
partId = SP_GRIPPER; partId = SP_GRIPPER;
XPThemeData theme(0, p, themeNumber, partId, 0); XPThemeData theme(0, p, themeNumber, partId, 0);
QSize size = theme.size() / QWindowsStylePrivate::devicePixelRatio(widget); QSize size = (theme.size() / QWindowsStylePrivate::devicePixelRatio(widget)).toSize();
size.rheight()--; size.rheight()--;
if (const QStyleOptionSizeGrip *sg = qstyleoption_cast<const QStyleOptionSizeGrip *>(option)) { if (const QStyleOptionSizeGrip *sg = qstyleoption_cast<const QStyleOptionSizeGrip *>(option)) {
switch (sg->corner) { switch (sg->corner) {
@ -2081,7 +2119,7 @@ void QWindowsXPStyle::drawControl(ControlElement element, const QStyleOption *op
QWindowsXPStylePrivate::ToolBarTheme, QWindowsXPStylePrivate::ToolBarTheme,
TP_SPLITBUTTONDROPDOWN); TP_SPLITBUTTONDROPDOWN);
if (theme.isValid()) { if (theme.isValid()) {
const QSize size = theme.size() / QWindowsStylePrivate::devicePixelRatio(widget); const QSize size = (theme.size() / QWindowsStylePrivate::devicePixelRatio(widget)).toSize();
mbiw = size.width(); mbiw = size.width();
mbih = size.height(); 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) QRect QWindowsXPStylePrivate::scrollBarGripperBounds(QStyle::State flags, const QWidget *widget, XPThemeData *theme)
{ {
const bool horizontal = flags & QStyle::State_Horizontal; const bool horizontal = flags & QStyle::State_Horizontal;
const QMargins contentsMargin = theme->margins(theme->rect, TMT_SIZINGMARGINS) const QMargins contentsMargin = (theme->margins(theme->rect, TMT_SIZINGMARGINS)
/ QWindowsStylePrivate::devicePixelRatio(widget); / QWindowsStylePrivate::devicePixelRatio(widget)).toMargins();
theme->partId = horizontal ? SBP_GRIPPERHORZ : SBP_GRIPPERVERT; 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 hSpace = theme->rect.width() - size.width();
const int vSpace = theme->rect.height() - size.height(); 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); int res = QWindowsXPStylePrivate::pixelMetricFromSystemDp(pm, option, widget);
if (res != QWindowsStylePrivate::InvalidMetric) if (res != QWindowsStylePrivate::InvalidMetric)
return res / QWindowsStylePrivate::devicePixelRatio(widget); return qRound(qreal(res) / QWindowsStylePrivate::devicePixelRatio(widget));
res = 0; res = 0;
switch (pm) { switch (pm) {
@ -3508,9 +3546,9 @@ QRect QWindowsXPStyle::subControlRect(ComplexControl cc, const QStyleOptionCompl
const int height = tb->rect.height(); const int height = tb->rect.height();
const int width = tb->rect.width(); const int width = tb->rect.width();
const int buttonMargin = int(QStyleHelper::dpiScaled(4)); 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; - buttonMargin;
int buttonWidth = GetSystemMetrics(SM_CXSIZE) / QWindowsStylePrivate::devicePixelRatio(widget) int buttonWidth = qRound(qreal(GetSystemMetrics(SM_CXSIZE)) / QWindowsStylePrivate::devicePixelRatio(widget))
- buttonMargin; - buttonMargin;
const int delta = buttonWidth + 2; const int delta = buttonWidth + 2;
int controlTop = option->rect.bottom() - buttonHeight - 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); XPThemeData buttontheme(widget, 0, QWindowsXPStylePrivate::ButtonTheme, BP_PUSHBUTTON, PBS_NORMAL);
if (buttontheme.isValid()) { if (buttontheme.isValid()) {
const QMargins borderSize = buttontheme.margins() / QWindowsXPStylePrivate::devicePixelRatio(widget); const QMarginsF borderSize = buttontheme.margins() / QWindowsXPStylePrivate::devicePixelRatio(widget);
if (!borderSize.isNull()) { if (!borderSize.isNull()) {
sz.rwidth() += borderSize.left() + borderSize.right() - 2; sz.rwidth() += qRound(borderSize.left() + borderSize.right() - 2);
sz.rheight() += borderSize.bottom() + borderSize.top() - 2; sz.rheight() += qRound(borderSize.bottom() + borderSize.top() - 2);
} }
const int textMargins = 2*(proxy()->pixelMetric(PM_FocusFrameHMargin) + 1); const int textMargins = 2*(proxy()->pixelMetric(PM_FocusFrameHMargin) + 1);
sz += QSize(qMax(pixelMetric(QStyle::PM_ScrollBarExtent, option, widget) sz += QSize(qMax(pixelMetric(QStyle::PM_ScrollBarExtent, option, widget)
@ -3878,7 +3916,7 @@ QPixmap QWindowsXPStyle::standardPixmap(StandardPixmap standardPixmap, const QSt
if (widget && widget->isWindow()) { if (widget && widget->isWindow()) {
XPThemeData theme(widget, 0, QWindowsXPStylePrivate::WindowTheme, WP_SMALLCLOSEBUTTON, CBS_NORMAL); XPThemeData theme(widget, 0, QWindowsXPStylePrivate::WindowTheme, WP_SMALLCLOSEBUTTON, CBS_NORMAL);
if (theme.isValid()) { 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); return QIcon(QWindowsStyle::standardPixmap(standardPixmap, option, widget)).pixmap(size);
} }
} }
@ -3912,7 +3950,7 @@ QIcon QWindowsXPStyle::standardIcon(StandardPixmap standardIcon,
XPThemeData theme(0, 0, QWindowsXPStylePrivate::WindowTheme, XPThemeData theme(0, 0, QWindowsXPStylePrivate::WindowTheme,
WP_MAXBUTTON, MAXBS_NORMAL); WP_MAXBUTTON, MAXBS_NORMAL);
if (theme.isValid()) { if (theme.isValid()) {
const QSize size = themeSize.size() / QWindowsXPStylePrivate::devicePixelRatio(widget); const QSize size = (themeSize.size() / QWindowsXPStylePrivate::devicePixelRatio(widget)).toSize();
QPixmap pm(size); QPixmap pm(size);
pm.fill(Qt::transparent); pm.fill(Qt::transparent);
QPainter p(&pm); QPainter p(&pm);
@ -3946,7 +3984,7 @@ QIcon QWindowsXPStyle::standardIcon(StandardPixmap standardIcon,
XPThemeData theme(0, 0, QWindowsXPStylePrivate::WindowTheme, XPThemeData theme(0, 0, QWindowsXPStylePrivate::WindowTheme,
WP_SMALLCLOSEBUTTON, CBS_NORMAL); WP_SMALLCLOSEBUTTON, CBS_NORMAL);
if (theme.isValid()) { if (theme.isValid()) {
const QSize size = theme.size() / QWindowsXPStylePrivate::devicePixelRatio(widget); const QSize size = (theme.size() / QWindowsXPStylePrivate::devicePixelRatio(widget)).toSize();
QPixmap pm(size); QPixmap pm(size);
pm.fill(Qt::transparent); pm.fill(Qt::transparent);
QPainter p(&pm); QPainter p(&pm);
@ -3982,7 +4020,7 @@ QIcon QWindowsXPStyle::standardIcon(StandardPixmap standardIcon,
XPThemeData theme(0, 0, QWindowsXPStylePrivate::WindowTheme, XPThemeData theme(0, 0, QWindowsXPStylePrivate::WindowTheme,
WP_RESTOREBUTTON, RBS_NORMAL); WP_RESTOREBUTTON, RBS_NORMAL);
if (theme.isValid()) { if (theme.isValid()) {
const QSize size = themeSize.size() / QWindowsStylePrivate::devicePixelRatio(widget); const QSize size = (themeSize.size() / QWindowsStylePrivate::devicePixelRatio(widget)).toSize();
QPixmap pm(size); QPixmap pm(size);
pm.fill(Qt::transparent); pm.fill(Qt::transparent);
QPainter p(&pm); QPainter p(&pm);

View File

@ -208,15 +208,15 @@ public:
static RECT toRECT(const QRect &qr); static RECT toRECT(const QRect &qr);
bool isValid(); bool isValid();
QSize size(); QSizeF size();
QMargins margins(const QRect &rect, int propId = TMT_CONTENTMARGINS); QMarginsF margins(const QRect &rect, int propId = TMT_CONTENTMARGINS);
QMargins margins(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 QSizeF 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, 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); int part = 0, int state = 0, int propId = TMT_CONTENTMARGINS);
static QMargins themeMargins(const QWidget *w = 0, QPainter *p = 0, int themeIn = -1, static QMarginsF themeMargins(const QWidget *w = 0, QPainter *p = 0, int themeIn = -1,
int part = 0, int state = 0, int propId = TMT_CONTENTMARGINS); int part = 0, int state = 0, int propId = TMT_CONTENTMARGINS);
const QWidget *widget; const QWidget *widget;
QPainter *painter; QPainter *painter;
@ -393,8 +393,8 @@ public:
void setTransparency(QWidget *widget, XPThemeData &themeData); void setTransparency(QWidget *widget, XPThemeData &themeData);
bool drawBackground(XPThemeData &themeData); bool drawBackground(XPThemeData &themeData);
bool drawBackgroundThruNativeBuffer(XPThemeData &themeData); bool drawBackgroundThruNativeBuffer(XPThemeData &themeData, int aditionalDevicePixelRatio);
bool drawBackgroundDirectly(XPThemeData &themeData); bool drawBackgroundDirectly(HDC dc, XPThemeData &themeData, int aditionalDevicePixelRatio);
bool hasAlphaChannel(const QRect &rect); bool hasAlphaChannel(const QRect &rect);
bool fixAlphaChannel(const QRect &rect); bool fixAlphaChannel(const QRect &rect);
@ -433,9 +433,9 @@ private:
static HTHEME m_themes[NThemes]; static HTHEME m_themes[NThemes];
}; };
inline QSize XPThemeData::size() inline QSizeF XPThemeData::size()
{ {
QSize result(0, 0); QSizeF result(0, 0);
if (isValid()) { if (isValid()) {
SIZE size; SIZE size;
if (SUCCEEDED(QWindowsXPStylePrivate::pGetThemePartSize(handle(), 0, partId, stateId, 0, TS_TRUE, &size))) if (SUCCEEDED(QWindowsXPStylePrivate::pGetThemePartSize(handle(), 0, partId, stateId, 0, TS_TRUE, &size)))
@ -444,9 +444,9 @@ inline QSize XPThemeData::size()
return result; 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()) { if (isValid()) {
MARGINS margins; MARGINS margins;
RECT rect = XPThemeData::toRECT(qRect); RECT rect = XPThemeData::toRECT(qRect);
@ -456,9 +456,9 @@ inline QMargins XPThemeData::margins(const QRect &qRect, int propId)
return result; 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()) { if (isValid()) {
MARGINS margins; MARGINS margins;
if (SUCCEEDED(QWindowsXPStylePrivate::pGetThemeMargins(handle(), 0, partId, stateId, propId, NULL, &margins))) if (SUCCEEDED(QWindowsXPStylePrivate::pGetThemeMargins(handle(), 0, partId, stateId, propId, NULL, &margins)))
@ -467,21 +467,21 @@ inline QMargins XPThemeData::margins(int propId)
return result; 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); XPThemeData theme(w, p, themeIn, part, state);
return theme.size(); return theme.size();
} }
inline QMargins XPThemeData::themeMargins(const QRect &rect, const QWidget *w, QPainter *p, int themeIn, inline QMarginsF XPThemeData::themeMargins(const QRect &rect, const QWidget *w, QPainter *p, int themeIn,
int part, int state, int propId) int part, int state, int propId)
{ {
XPThemeData theme(w, p, themeIn, part, state); XPThemeData theme(w, p, themeIn, part, state);
return theme.margins(rect, propId); return theme.margins(rect, propId);
} }
inline QMargins XPThemeData::themeMargins(const QWidget *w, QPainter *p, int themeIn, inline QMarginsF XPThemeData::themeMargins(const QWidget *w, QPainter *p, int themeIn,
int part, int state, int propId) int part, int state, int propId)
{ {
XPThemeData theme(w, p, themeIn, part, state); XPThemeData theme(w, p, themeIn, part, state);
return theme.margins(propId); return theme.margins(propId);

View File

@ -731,8 +731,16 @@ bool QAbstractSliderPrivate::scrollByDelta(Qt::Orientation orientation, Qt::Keyb
stepsToScroll = int(offset_accumulated); stepsToScroll = int(offset_accumulated);
#endif #endif
offset_accumulated -= int(offset_accumulated); 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; return false;
}
} }
if (invertedControls) if (invertedControls)

View File

@ -1095,14 +1095,16 @@ void QLabel::paintEvent(QPaintEvent *)
if (d->pixmap && !d->pixmap->isNull()) { if (d->pixmap && !d->pixmap->isNull()) {
QPixmap pix; QPixmap pix;
if (d->scaledcontents) { 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) if (!d->cachedimage)
d->cachedimage = new QImage(d->pixmap->toImage()); d->cachedimage = new QImage(d->pixmap->toImage());
delete d->scaledpixmap; delete d->scaledpixmap;
QImage scaledImage = QImage scaledImage =
d->cachedimage->scaled(cr.size() * devicePixelRatioF(), d->cachedimage->scaled(scaledSize,
Qt::IgnoreAspectRatio, Qt::SmoothTransformation); Qt::IgnoreAspectRatio, Qt::SmoothTransformation);
d->scaledpixmap = new QPixmap(QPixmap::fromImage(scaledImage)); d->scaledpixmap = new QPixmap(QPixmap::fromImage(scaledImage));
d->scaledpixmap->setDevicePixelRatio(devicePixelRatioF());
} }
pix = *d->scaledpixmap; pix = *d->scaledpixmap;
} else } else

View File

@ -68,6 +68,7 @@ public:
void init(); void init();
#ifndef QT_NO_MENU #ifndef QT_NO_MENU
void _q_buttonPressed(); void _q_buttonPressed();
void _q_buttonReleased();
void popupTimerDone(); void popupTimerDone();
void _q_updateButtonDown(); void _q_updateButtonDown();
void _q_menuTriggered(QAction *); void _q_menuTriggered(QAction *);
@ -217,6 +218,7 @@ void QToolButtonPrivate::init()
#ifndef QT_NO_MENU #ifndef QT_NO_MENU
QObject::connect(q, SIGNAL(pressed()), q, SLOT(_q_buttonPressed())); QObject::connect(q, SIGNAL(pressed()), q, SLOT(_q_buttonPressed()));
QObject::connect(q, SIGNAL(released()), q, SLOT(_q_buttonReleased()));
#endif #endif
setLayoutItemMargins(QStyle::SE_ToolButtonLayoutItem); setLayoutItemMargins(QStyle::SE_ToolButtonLayoutItem);
@ -704,12 +706,17 @@ void QToolButtonPrivate::_q_buttonPressed()
return; // no menu to show return; // no menu to show
if (popupMode == QToolButton::MenuButtonPopup) if (popupMode == QToolButton::MenuButtonPopup)
return; return;
else if (delay > 0 && !popupTimer.isActive() && popupMode == QToolButton::DelayedPopup) else if (delay > 0 && popupMode == QToolButton::DelayedPopup)
popupTimer.start(delay, q); popupTimer.start(delay, q);
else if (delay == 0 || popupMode == QToolButton::InstantPopup) else if (delay == 0 || popupMode == QToolButton::InstantPopup)
q->showMenu(); q->showMenu();
} }
void QToolButtonPrivate::_q_buttonReleased()
{
popupTimer.stop();
}
void QToolButtonPrivate::popupTimerDone() void QToolButtonPrivate::popupTimerDone()
{ {
Q_Q(QToolButton); Q_Q(QToolButton);

View File

@ -125,6 +125,7 @@ private:
Q_DECLARE_PRIVATE(QToolButton) Q_DECLARE_PRIVATE(QToolButton)
#ifndef QT_NO_MENU #ifndef QT_NO_MENU
Q_PRIVATE_SLOT(d_func(), void _q_buttonPressed()) 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_updateButtonDown())
Q_PRIVATE_SLOT(d_func(), void _q_menuTriggered(QAction*)) Q_PRIVATE_SLOT(d_func(), void _q_menuTriggered(QAction*))
#endif #endif

View File

@ -118,7 +118,7 @@ void QWidgetLineControl::updateDisplayText(bool forceUpdate)
// characters) // characters)
QChar* uc = str.data(); QChar* uc = str.data();
for (int i = 0; i < (int)str.length(); ++i) { 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::LineSeparator
|| uc[i] == QChar::ParagraphSeparator || uc[i] == QChar::ParagraphSeparator
|| uc[i] == QChar::ObjectReplacementCharacter) || uc[i] == QChar::ObjectReplacementCharacter)

View File

@ -66,7 +66,12 @@ public:
#ifdef QT_NETWORK_LIB #ifdef QT_NETWORK_LIB
static QHostAddress serverIP() 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 #endif

View File

@ -722,10 +722,11 @@ void tst_QFtp::put_data()
QByteArray bigData( 10*1024*1024, 0 ); QByteArray bigData( 10*1024*1024, 0 );
bigData.fill( 'A' ); 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++ ) { for ( int i=0; i<2; i++ ) {
QTest::newRow(("relPath01_" + QByteArray::number(i)).constData()) << QtNetworkSettings::serverName() << (uint)21 << QString() << QString() 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; << (bool)(i==1) << 1;
/* /*
QTest::newRow( QString("relPath02_%1").arg(i).toLatin1().constData() ) << QtNetworkSettings::serverName() << (uint)21 << QString("ftptest") << QString("password") QTest::newRow( QString("relPath02_%1").arg(i).toLatin1().constData() ) << QtNetworkSettings::serverName() << (uint)21 << QString("ftptest") << QString("password")

View File

@ -1,4 +1,3 @@
/**************************************************************************** /****************************************************************************
** **
** Copyright (C) 2016 The Qt Company Ltd. ** Copyright (C) 2016 The Qt Company Ltd.

View File

@ -126,6 +126,7 @@ private slots:
void testFrameOnlyAroundContents(); void testFrameOnlyAroundContents();
void testProxyCalled(); void testProxyCalled();
void testStyleOptionInit();
private: private:
void lineUpLayoutTest(QStyle *); void lineUpLayoutTest(QStyle *);
QWidget *testWidget; 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) QTEST_MAIN(tst_QStyle)
#include "tst_qstyle.moc" #include "tst_qstyle.moc"