Merge remote-tracking branch 'origin/5.7' into dev
Conflicts: src/corelib/kernel/qobject.cpp src/gui/painting/qpaintengine_raster.cpp Change-Id: I74e1779832f43d033708dcfd6b666c7b4f0111fb
This commit is contained in:
commit
f34e73a16a
@ -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;
|
||||
}
|
||||
|
||||
|
@ -55,10 +55,12 @@ typedef QList<QStandardItem *> StandardItemList;
|
||||
|
||||
enum { mimeTypeRole = Qt::UserRole + 1, iconQueriedRole = Qt::UserRole + 2 };
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
bool operator<(const QMimeType &t1, const QMimeType &t2)
|
||||
{
|
||||
return t1.name() < t2.name();
|
||||
}
|
||||
QT_END_NAMESPACE
|
||||
|
||||
static StandardItemList createRow(const QMimeType &t)
|
||||
{
|
||||
|
@ -1,4 +1,3 @@
|
||||
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2016 The Qt Company Ltd.
|
||||
|
@ -131,6 +131,7 @@ void TabletCanvas::tabletEvent(QTabletEvent *event)
|
||||
default:
|
||||
break;
|
||||
}
|
||||
event->accept();
|
||||
update();
|
||||
}
|
||||
//! [3]
|
||||
|
@ -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 © 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>
|
||||
|
@ -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>
|
||||
|
@ -7,7 +7,7 @@ include(../common/gcc-base-mac.conf)
|
||||
include(../common/clang.conf)
|
||||
include(../common/clang-mac.conf)
|
||||
|
||||
QMAKE_MACOSX_DEPLOYMENT_TARGET = 10.7
|
||||
QMAKE_MACOSX_DEPLOYMENT_TARGET = 10.8
|
||||
|
||||
QMAKE_CFLAGS += -arch i386
|
||||
QMAKE_CXXFLAGS += -arch i386
|
||||
|
@ -7,6 +7,6 @@ include(../common/gcc-base-mac.conf)
|
||||
include(../common/clang.conf)
|
||||
include(../common/clang-mac.conf)
|
||||
|
||||
QMAKE_MACOSX_DEPLOYMENT_TARGET = 10.7
|
||||
QMAKE_MACOSX_DEPLOYMENT_TARGET = 10.8
|
||||
|
||||
load(qt_config)
|
||||
|
@ -14,7 +14,7 @@ include(../common/macx.conf)
|
||||
include(../common/gcc-base-mac.conf)
|
||||
include(../common/g++-macx.conf)
|
||||
|
||||
QMAKE_MACOSX_DEPLOYMENT_TARGET = 10.7
|
||||
QMAKE_MACOSX_DEPLOYMENT_TARGET = 10.8
|
||||
|
||||
QMAKE_CFLAGS += -arch i386
|
||||
QMAKE_CXXFLAGS += -arch i386
|
||||
|
@ -14,6 +14,6 @@ include(../common/macx.conf)
|
||||
include(../common/gcc-base-mac.conf)
|
||||
include(../common/g++-macx.conf)
|
||||
|
||||
QMAKE_MACOSX_DEPLOYMENT_TARGET = 10.7
|
||||
QMAKE_MACOSX_DEPLOYMENT_TARGET = 10.8
|
||||
|
||||
load(qt_config)
|
||||
|
@ -14,7 +14,7 @@ include(../common/macx.conf)
|
||||
include(../common/gcc-base-mac.conf)
|
||||
include(../common/g++-macx.conf)
|
||||
|
||||
QMAKE_MACOSX_DEPLOYMENT_TARGET = 10.7
|
||||
QMAKE_MACOSX_DEPLOYMENT_TARGET = 10.8
|
||||
|
||||
QMAKE_CC = gcc-4.0
|
||||
QMAKE_CXX = g++-4.0
|
||||
|
@ -14,7 +14,7 @@ include(../common/macx.conf)
|
||||
include(../common/gcc-base-mac.conf)
|
||||
include(../common/g++-macx.conf)
|
||||
|
||||
QMAKE_MACOSX_DEPLOYMENT_TARGET = 10.7
|
||||
QMAKE_MACOSX_DEPLOYMENT_TARGET = 10.8
|
||||
|
||||
QMAKE_CC = gcc-4.2
|
||||
QMAKE_CXX = g++-4.2
|
||||
|
@ -14,7 +14,7 @@ include(../common/macx.conf)
|
||||
include(../common/gcc-base-mac.conf)
|
||||
include(../common/llvm.conf)
|
||||
|
||||
QMAKE_MACOSX_DEPLOYMENT_TARGET = 10.7
|
||||
QMAKE_MACOSX_DEPLOYMENT_TARGET = 10.8
|
||||
|
||||
QMAKE_XCODE_GCC_VERSION = com.apple.compilers.llvmgcc42
|
||||
|
||||
|
@ -1290,8 +1290,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"))) {
|
||||
|
@ -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
|
||||
|
@ -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 += \
|
||||
|
@ -998,8 +998,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.
|
||||
|
@ -507,6 +507,7 @@ public:
|
||||
AA_DisableHighDpiScaling = 21,
|
||||
AA_UseStyleSheetPropagationInWidgetStyles = 22, // ### Qt 6: remove me
|
||||
AA_DontUseNativeDialogs = 23,
|
||||
AA_SynthesizeMouseForUnhandledTabletEvents = 24,
|
||||
|
||||
// Add new attributes before this line
|
||||
AA_AttributeCount
|
||||
@ -1338,6 +1339,7 @@ public:
|
||||
ImTextBeforeCursor = 0x800,
|
||||
ImTextAfterCursor = 0x1000,
|
||||
ImEnterKeyType = 0x2000,
|
||||
ImAnchorRectangle = 0x4000,
|
||||
|
||||
ImPlatformData = 0x80000000,
|
||||
ImQueryInput = ImCursorRectangle | ImCursorPosition | ImSurroundingText |
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
||||
|
@ -1717,15 +1717,15 @@ const QItemSelection QItemSelectionModel::selection() const
|
||||
Q_D(const QItemSelectionModel);
|
||||
QItemSelection selected = d->ranges;
|
||||
selected.merge(d->currentSelection, d->currentCommand);
|
||||
int i = 0;
|
||||
// make sure we have no invalid ranges
|
||||
// ### should probably be handled more generic somewhere else
|
||||
while (i<selected.count()) {
|
||||
if (selected.at(i).isValid())
|
||||
++i;
|
||||
else
|
||||
(selected.removeAt(i));
|
||||
}
|
||||
auto isNotValid = [](const QItemSelectionRange& range) {
|
||||
return !range.isValid();
|
||||
};
|
||||
|
||||
selected.erase(std::remove_if(selected.begin(), selected.end(),
|
||||
isNotValid),
|
||||
selected.end());
|
||||
return selected;
|
||||
}
|
||||
|
||||
|
@ -325,7 +325,9 @@ Qt::HANDLE qt_application_thread_id = 0;
|
||||
#endif // QT_NO_QOBJECT
|
||||
|
||||
QCoreApplication *QCoreApplication::self = 0;
|
||||
uint QCoreApplicationPrivate::attribs = (1 << Qt::AA_SynthesizeMouseForUnhandledTouchEvents);
|
||||
uint QCoreApplicationPrivate::attribs =
|
||||
(1 << Qt::AA_SynthesizeMouseForUnhandledTouchEvents) |
|
||||
(1 << Qt::AA_SynthesizeMouseForUnhandledTabletEvents);
|
||||
|
||||
struct QCoreApplicationData {
|
||||
QCoreApplicationData() Q_DECL_NOTHROW {
|
||||
|
@ -3628,8 +3628,6 @@ void QMetaObject::activate(QObject *sender, int signalOffset, int local_signal_i
|
||||
argv ? argv : empty_argv);
|
||||
}
|
||||
|
||||
Qt::HANDLE currentThreadId = QThread::currentThreadId();
|
||||
|
||||
{
|
||||
QMutexLocker locker(signalSlotLock(sender));
|
||||
struct ConnectionListsRef {
|
||||
@ -3673,6 +3671,8 @@ void QMetaObject::activate(QObject *sender, int signalOffset, int local_signal_i
|
||||
if (connectionLists->allsignals.first) // only add if non-empty
|
||||
lists[numLists++] = &connectionLists->allsignals;
|
||||
|
||||
Qt::HANDLE currentThreadId = QThread::currentThreadId();
|
||||
|
||||
for (int i = 0; i < numLists; ++i) {
|
||||
const auto *list = lists[i];
|
||||
if (i == 0) {
|
||||
|
@ -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)
|
||||
#ifdef Q_COMPILER_VARIADIC_MACROS
|
||||
#define Q_PROPERTY(...)
|
||||
#else
|
||||
#define Q_PROPERTY(text)
|
||||
#ifndef Q_CLASSINFO
|
||||
# define Q_CLASSINFO(name, value)
|
||||
#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_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(...) QT_ANNOTATE_CLASS(qt_property, __VA_ARGS__)
|
||||
#else
|
||||
# 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 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
|
||||
|
||||
|
@ -580,9 +580,7 @@ void QMimeBinaryProvider::loadMimeTypePrivate(QMimeTypePrivate &data)
|
||||
return;
|
||||
}
|
||||
|
||||
QString comment;
|
||||
QString mainPattern;
|
||||
const QString preferredLanguage = QLocale::system().name();
|
||||
|
||||
for (QStringList::const_reverse_iterator it = mimeFiles.crbegin(), end = mimeFiles.crend(); it != end; ++it) { // global first, then local.
|
||||
QFile qfile(*it);
|
||||
|
@ -254,7 +254,7 @@ static QString toOffsetString(Qt::DateFormat format, int offset)
|
||||
}
|
||||
|
||||
// Parse offset in [+-]HH[[:]mm] format
|
||||
static int fromOffsetString(const QStringRef &offsetString, bool *valid)
|
||||
static int fromOffsetString(const QStringRef &offsetString, bool *valid) Q_DECL_NOTHROW
|
||||
{
|
||||
*valid = false;
|
||||
|
||||
@ -275,19 +275,22 @@ static int fromOffsetString(const QStringRef &offsetString, bool *valid)
|
||||
return 0;
|
||||
|
||||
// Split the hour and minute parts
|
||||
QVector<QStringRef> parts = offsetString.mid(1).split(QLatin1Char(':'));
|
||||
if (parts.count() == 1) {
|
||||
// [+-]HHmm or [+-]HH format
|
||||
parts.append(parts.first().mid(2));
|
||||
parts[0] = parts.first().left(2);
|
||||
}
|
||||
const QStringRef time = offsetString.mid(1);
|
||||
int hhLen = time.indexOf(QLatin1Char(':'));
|
||||
int mmIndex;
|
||||
if (hhLen == -1)
|
||||
mmIndex = hhLen = 2; // [+-]HHmm or [+-]HH format
|
||||
else
|
||||
mmIndex = hhLen + 1;
|
||||
|
||||
const QStringRef hhRef = time.left(hhLen);
|
||||
bool ok = false;
|
||||
const int hour = parts.first().toInt(&ok);
|
||||
const int hour = hhRef.toInt(&ok);
|
||||
if (!ok)
|
||||
return 0;
|
||||
|
||||
const int minute = (parts.at(1).isEmpty()) ? 0 : parts.at(1).toInt(&ok);
|
||||
const QStringRef mmRef = time.mid(mmIndex);
|
||||
const int minute = mmRef.isEmpty() ? 0 : mmRef.toInt(&ok);
|
||||
if (!ok || minute < 0 || minute > 59)
|
||||
return 0;
|
||||
|
||||
@ -4434,7 +4437,7 @@ QDateTime QDateTime::fromString(const QString& string, Qt::DateFormat format)
|
||||
int second = 0;
|
||||
int millisecond = 0;
|
||||
if (timeParts.count() > 2) {
|
||||
QVector<QStringRef> secondParts = timeParts.at(2).split(QLatin1Char('.'));
|
||||
const QVector<QStringRef> secondParts = timeParts.at(2).split(QLatin1Char('.'));
|
||||
if (secondParts.size() > 2) {
|
||||
return QDateTime();
|
||||
}
|
||||
|
@ -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;
|
||||
@ -889,7 +890,7 @@ QDateTimeParser::StateNode QDateTimeParser::parse(QString &input, int &cursorPos
|
||||
QDTPDEBUG << "parse" << input;
|
||||
{
|
||||
int year, month, day;
|
||||
QDate currentDate = currentValue.date();
|
||||
const QDate currentDate = currentValue.date();
|
||||
const QTime currentTime = currentValue.time();
|
||||
currentDate.getDate(&year, &month, &day);
|
||||
int year2digits = year % 100;
|
||||
|
@ -1,4 +1,3 @@
|
||||
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2016 The Qt Company Ltd.
|
||||
|
@ -2390,9 +2390,11 @@ QLocale::MeasurementSystem QLocale::measurementSystem() const
|
||||
Qt::LayoutDirection QLocale::textDirection() const
|
||||
{
|
||||
switch (script()) {
|
||||
case QLocale::AdlamScript:
|
||||
case QLocale::ArabicScript:
|
||||
case QLocale::AvestanScript:
|
||||
case QLocale::CypriotScript:
|
||||
case QLocale::HatranScript:
|
||||
case QLocale::HebrewScript:
|
||||
case QLocale::ImperialAramaicScript:
|
||||
case QLocale::InscriptionalPahlaviScript:
|
||||
@ -2406,6 +2408,7 @@ Qt::LayoutDirection QLocale::textDirection() const
|
||||
case QLocale::MeroiticScript:
|
||||
case QLocale::NabataeanScript:
|
||||
case QLocale::NkoScript:
|
||||
case QLocale::OldHungarianScript:
|
||||
case QLocale::OldNorthArabianScript:
|
||||
case QLocale::OldSouthArabianScript:
|
||||
case QLocale::OrkhonScript:
|
||||
@ -3484,7 +3487,13 @@ QString QLocale::toCurrencyString(double value, const QString &symbol) const
|
||||
|
||||
/*!
|
||||
\since 5.7
|
||||
\overload
|
||||
\overload toCurrencyString()
|
||||
|
||||
Returns a localized string representation of \a value as a currency.
|
||||
If the \a symbol is provided it is used instead of the default currency symbol.
|
||||
If the \a precision is provided it is used to set the precision of the currency value.
|
||||
|
||||
\sa currencySymbol()
|
||||
*/
|
||||
QString QLocale::toCurrencyString(double value, const QString &symbol, int precision) const
|
||||
{
|
||||
|
@ -416,6 +416,27 @@ public:
|
||||
Mono = 337,
|
||||
TedimChin = 338,
|
||||
Maithili = 339,
|
||||
Ahom = 340,
|
||||
AmericanSignLanguage = 341,
|
||||
ArdhamagadhiPrakrit = 342,
|
||||
Bhojpuri = 343,
|
||||
HieroglyphicLuwian = 344,
|
||||
LiteraryChinese = 345,
|
||||
Mazanderani = 346,
|
||||
Mru = 347,
|
||||
Newari = 348,
|
||||
NorthernLuri = 349,
|
||||
Palauan = 350,
|
||||
Papiamento = 351,
|
||||
Saraiki = 352,
|
||||
TokelauLanguage = 353,
|
||||
TokPisin = 354,
|
||||
TuvaluLanguage = 355,
|
||||
UncodedLanguages = 356,
|
||||
Cantonese = 357,
|
||||
Osage = 358,
|
||||
Tangut = 359,
|
||||
|
||||
Norwegian = NorwegianBokmal,
|
||||
Moldavian = Romanian,
|
||||
SerboCroatian = Serbian,
|
||||
@ -430,7 +451,8 @@ public:
|
||||
Chewa = Nyanja,
|
||||
Frisian = WesternFrisian,
|
||||
Uigur = Uighur,
|
||||
LastLanguage = Maithili
|
||||
|
||||
LastLanguage = Tangut
|
||||
};
|
||||
|
||||
enum Script {
|
||||
@ -562,9 +584,25 @@ public:
|
||||
KhudawadiScript = 125,
|
||||
TirhutaScript = 126,
|
||||
VarangKshitiScript = 127,
|
||||
AhomScript = 128,
|
||||
AnatolianHieroglyphsScript = 129,
|
||||
HatranScript = 130,
|
||||
MultaniScript = 131,
|
||||
OldHungarianScript = 132,
|
||||
SignWritingScript = 133,
|
||||
AdlamScript = 134,
|
||||
BhaiksukiScript = 135,
|
||||
MarchenScript = 136,
|
||||
NewaScript = 137,
|
||||
OsageScript = 138,
|
||||
TangutScript = 139,
|
||||
HanWithBopomofoScript = 140,
|
||||
JamoScript = 141,
|
||||
|
||||
SimplifiedChineseScript = SimplifiedHanScript,
|
||||
TraditionalChineseScript = TraditionalHanScript,
|
||||
LastScript = VarangKshitiScript
|
||||
|
||||
LastScript = JamoScript
|
||||
};
|
||||
enum Country {
|
||||
AnyCountry = 0,
|
||||
@ -780,14 +818,14 @@ public:
|
||||
Tanzania = 210,
|
||||
Thailand = 211,
|
||||
Togo = 212,
|
||||
Tokelau = 213,
|
||||
TokelauCountry = 213,
|
||||
Tonga = 214,
|
||||
TrinidadAndTobago = 215,
|
||||
Tunisia = 216,
|
||||
Turkey = 217,
|
||||
Turkmenistan = 218,
|
||||
TurksAndCaicosIslands = 219,
|
||||
Tuvalu = 220,
|
||||
TuvaluCountry = 220,
|
||||
Uganda = 221,
|
||||
Ukraine = 222,
|
||||
UnitedArabEmirates = 223,
|
||||
@ -825,13 +863,19 @@ public:
|
||||
Bonaire = 255,
|
||||
SintMaarten = 256,
|
||||
Kosovo = 257,
|
||||
EuropeanUnion = 258,
|
||||
OutlyingOceania = 259,
|
||||
|
||||
Tokelau = TokelauCountry,
|
||||
Tuvalu = TuvaluCountry,
|
||||
DemocraticRepublicOfCongo = CongoKinshasa,
|
||||
PeoplesRepublicOfCongo = CongoBrazzaville,
|
||||
DemocraticRepublicOfKorea = NorthKorea,
|
||||
RepublicOfKorea = SouthKorea,
|
||||
RussianFederation = Russia,
|
||||
SyrianArabRepublic = Syria,
|
||||
LastCountry = Kosovo
|
||||
|
||||
LastCountry = OutlyingOceania
|
||||
};
|
||||
// GENERATED PART ENDS HERE
|
||||
|
||||
|
@ -92,7 +92,7 @@
|
||||
\note For the current keyboard input locale take a look at
|
||||
QInputMethod::locale().
|
||||
|
||||
QLocale's data is based on Common Locale Data Repository v27.
|
||||
QLocale's data is based on Common Locale Data Repository v29.
|
||||
|
||||
The double-to-string and string-to-double conversion functions are
|
||||
covered by the following licenses:
|
||||
@ -483,6 +483,26 @@
|
||||
\value Maithili Since Qt 5.5
|
||||
\value LowerSorbian Since Qt 5.5
|
||||
\value UpperSorbian Since Qt 5.5
|
||||
\value Ahom Since Qt 5.7
|
||||
\value AmericanSignLanguage Since Qt 5.7
|
||||
\value ArdhamagadhiPrakrit Since Qt 5.7
|
||||
\value Bhojpuri Since Qt 5.7
|
||||
\value Cantonese Since Qt 5.7
|
||||
\value HieroglyphicLuwian Since Qt 5.7
|
||||
\value LiteraryChinese Since Qt 5.7
|
||||
\value Mazanderani Since Qt 5.7
|
||||
\value Mru Since Qt 5.7
|
||||
\value Newari Since Qt 5.7
|
||||
\value NorthernLuri Since Qt 5.7
|
||||
\value Osage Since Qt 5.7
|
||||
\value Palauan Since Qt 5.7
|
||||
\value Papiamento Since Qt 5.7
|
||||
\value Saraiki Since Qt 5.7
|
||||
\value Tangut Since Qt 5.7
|
||||
\value TokelauLanguage Since Qt 5.7
|
||||
\value TokPisin Since Qt 5.7
|
||||
\value TuvaluLanguage Since Qt 5.7
|
||||
\value UncodedLanguages Since Qt 5.7
|
||||
\omitvalue LastLanguage
|
||||
|
||||
\sa language(), languageToString()
|
||||
@ -567,6 +587,7 @@
|
||||
\value Eritrea
|
||||
\value Estonia
|
||||
\value Ethiopia
|
||||
\value EuropeanUnion Since Qt 5.7
|
||||
\value FalklandIslands
|
||||
\value FaroeIslands
|
||||
\value Fiji
|
||||
@ -662,6 +683,7 @@
|
||||
\value NorthernMarianaIslands
|
||||
\value Norway
|
||||
\value Oman
|
||||
\value OutlyingOceania Since Qt 5.7
|
||||
\value Pakistan
|
||||
\value Palau
|
||||
\value PalestinianTerritories
|
||||
@ -714,14 +736,16 @@
|
||||
\value Tanzania
|
||||
\value Thailand
|
||||
\value Togo
|
||||
\value Tokelau
|
||||
\value TokelauCountry
|
||||
\value Tokelau Obsolete, please use TokelauCountry
|
||||
\value Tonga
|
||||
\value TrinidadAndTobago
|
||||
\value Tunisia
|
||||
\value Turkey
|
||||
\value Turkmenistan
|
||||
\value TurksAndCaicosIslands
|
||||
\value Tuvalu
|
||||
\value TuvaluCountry
|
||||
\value Tuvalu Obsolete, please use TuvaluCountry
|
||||
\value Uganda
|
||||
\value Ukraine
|
||||
\value UnitedArabEmirates
|
||||
@ -768,6 +792,9 @@
|
||||
This enumerated type is used to specify a script.
|
||||
|
||||
\value AnyScript
|
||||
\value AdlamScript Since Qt 5.7
|
||||
\value AhomScript Since Qt 5.7
|
||||
\value AnatolianHieroglyphsScript Since Qt 5.7
|
||||
\value ArabicScript
|
||||
\value ArmenianScript
|
||||
\value AvestanScript
|
||||
@ -776,6 +803,7 @@
|
||||
\value BassaVahScript Since Qt 5.5
|
||||
\value BatakScript
|
||||
\value BengaliScript
|
||||
\value BhaiksukiScript Since Qt 5.7
|
||||
\value BopomofoScript
|
||||
\value BrahmiScript
|
||||
\value BrailleScript
|
||||
@ -807,11 +835,14 @@
|
||||
\value HanScript
|
||||
\value HangulScript
|
||||
\value HanunooScript
|
||||
\value HanWithBopomofoScript Since Qt 5.7
|
||||
\value HatranScript Since Qt 5.7
|
||||
\value HebrewScript
|
||||
\value HiraganaScript
|
||||
\value ImperialAramaicScript
|
||||
\value InscriptionalPahlaviScript
|
||||
\value InscriptionalParthianScript
|
||||
\value JamoScript Since Qt 5.7
|
||||
\value JapaneseScript
|
||||
\value JavaneseScript
|
||||
\value KaithiScript
|
||||
@ -836,6 +867,7 @@
|
||||
\value MalayalamScript
|
||||
\value MandaeanScript
|
||||
\value ManichaeanScript Since Qt 5.5
|
||||
\value MarchenScript Since Qt 5.7
|
||||
\value MeiteiMayekScript
|
||||
\value MendeKikakuiScript Since Qt 5.5
|
||||
\value MeroiticScript
|
||||
@ -843,19 +875,23 @@
|
||||
\value ModiScript Since Qt 5.5
|
||||
\value MongolianScript
|
||||
\value MroScript Since Qt 5.5
|
||||
\value MultaniScript Since Qt 5.7
|
||||
\value MyanmarScript
|
||||
\value NabataeanScript Since Qt 5.5
|
||||
\value NkoScript
|
||||
\value NewaScript Since Qt 5.7
|
||||
\value NewTaiLueScript
|
||||
\value OghamScript
|
||||
\value OlChikiScript
|
||||
\value OldItalicScript
|
||||
\value OldHungarianScript Since Qt 5.7
|
||||
\value OldNorthArabianScript Since Qt 5.5
|
||||
\value OldPermicScript Since Qt 5.5
|
||||
\value OldPersianScript
|
||||
\value OldSouthArabianScript
|
||||
\value OriyaScript
|
||||
\value OrkhonScript
|
||||
\value OsageScript Since Qt 5.7
|
||||
\value OsmanyaScript
|
||||
\value PahawhHmongScript Since Qt 5.5
|
||||
\value PalmyreneScript Since Qt 5.5
|
||||
@ -871,6 +907,7 @@
|
||||
\value SharadaScript
|
||||
\value ShavianScript
|
||||
\value SiddhamScript Since Qt 5.5
|
||||
\value SignWritingScript Since Qt 5.7
|
||||
\value SimplifiedHanScript same as SimplifiedChineseScript
|
||||
\value SimplifiedChineseScript same as SimplifiedHanScript
|
||||
\value SinhalaScript
|
||||
@ -885,6 +922,7 @@
|
||||
\value TaiVietScript
|
||||
\value TakriScript
|
||||
\value TamilScript
|
||||
\value TangutScript Since Qt 5.7
|
||||
\value TeluguScript
|
||||
\value ThaanaScript
|
||||
\value ThaiScript
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -8828,7 +8828,20 @@ QDataStream &operator>>(QDataStream &in, QString &str)
|
||||
|
||||
/*!
|
||||
\typedef QStringRef::const_iterator
|
||||
\internal
|
||||
\since 5.4
|
||||
|
||||
This typedef provides an STL-style const iterator for QStringRef.
|
||||
|
||||
\sa QStringRef::const_reverse_iterator
|
||||
*/
|
||||
|
||||
/*!
|
||||
\typedef QStringRef::const_reverse_iterator
|
||||
\since 5.7
|
||||
|
||||
This typedef provides an STL-style const reverse iterator for QStringRef.
|
||||
|
||||
\sa QStringRef::const_iterator
|
||||
*/
|
||||
|
||||
/*!
|
||||
@ -8951,42 +8964,88 @@ ownership of it, no memory is freed when instances are destroyed.
|
||||
Same as unicode().
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn const QChar *QStringRef::begin() const
|
||||
\since 5.4
|
||||
|
||||
Same as unicode().
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn const QChar *QStringRef::cbegin() const
|
||||
\since 5.4
|
||||
|
||||
Same as unicode().
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn const QChar *QStringRef::end() const
|
||||
\since 5.4
|
||||
|
||||
Returns a pointer to one character past the last one in this string.
|
||||
(It is the same as \c {unicode() + size()}.)
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn const QChar *QStringRef::cend() const
|
||||
\since 5.4
|
||||
|
||||
Returns a pointer to one character past the last one in this string.
|
||||
(It is the same as \c {unicode() + size()}.)
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn const QChar *QStringRef::constData() const
|
||||
|
||||
Same as unicode().
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn QStringRef::const_iterator QStringRef::begin() const
|
||||
\since 5.4
|
||||
|
||||
Returns a const \l{STL-style iterators}{STL-style iterator} pointing to the first character in
|
||||
the string.
|
||||
|
||||
\sa cbegin(), end(), rbegin(), rend()
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn QStringRef::const_iterator QStringRef::cbegin() const
|
||||
\since 5.4
|
||||
|
||||
Same as begin().
|
||||
|
||||
\sa begin(), cend(), rbegin(), rend()
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn QStringRef::const_iterator QStringRef::end() const
|
||||
\since 5.4
|
||||
|
||||
Returns a const \l{STL-style iterators}{STL-style iterator} pointing to the imaginary
|
||||
character after the last character in the list.
|
||||
|
||||
\sa cbegin(), end(), rbegin(), rend()
|
||||
*/
|
||||
|
||||
/*! \fn QStringRef::const_iterator QStringRef::cend() const
|
||||
\since 5.4
|
||||
|
||||
Same as end().
|
||||
|
||||
\sa end(), cbegin(), rbegin(), rend()
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn QStringRef::const_reverse_iterator QStringRef::rbegin() const
|
||||
\since 5.7
|
||||
|
||||
Returns a const \l{STL-style iterators}{STL-style} reverse iterator pointing to the first
|
||||
character in the string, in reverse order.
|
||||
|
||||
\sa begin(), crbegin(), rend()
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn QStringRef::const_reverse_iterator QStringRef::crbegin() const
|
||||
\since 5.7
|
||||
|
||||
Same as rbegin().
|
||||
|
||||
\sa begin(), rbegin(), rend()
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn QStringRef::const_reverse_iterator QStringRef::rend() const
|
||||
\since 5.7
|
||||
|
||||
Returns a \l{STL-style iterators}{STL-style} reverse iterator pointing to one past
|
||||
the last character in the string, in reverse order.
|
||||
|
||||
\sa end(), crend(), rbegin()
|
||||
*/
|
||||
|
||||
|
||||
/*!
|
||||
\fn QStringRef::const_reverse_iterator QStringRef::crend() const
|
||||
\since 5.7
|
||||
|
||||
Same as rend().
|
||||
|
||||
\sa end(), rend(), rbegin()
|
||||
*/
|
||||
|
||||
/*!
|
||||
Returns a copy of the string reference as a QString object.
|
||||
|
||||
|
@ -1382,7 +1382,8 @@ class Q_CORE_EXPORT QStringRef {
|
||||
public:
|
||||
typedef QString::size_type size_type;
|
||||
typedef QString::value_type value_type;
|
||||
typedef QString::const_iterator const_iterator;
|
||||
typedef const QChar *const_iterator;
|
||||
typedef std::reverse_iterator<const_iterator> const_reverse_iterator;
|
||||
typedef QString::const_pointer const_pointer;
|
||||
typedef QString::const_reference const_reference;
|
||||
|
||||
@ -1461,10 +1462,15 @@ public:
|
||||
}
|
||||
inline const QChar *data() const { return unicode(); }
|
||||
inline const QChar *constData() const { return unicode(); }
|
||||
inline const QChar *begin() const { return unicode(); }
|
||||
inline const QChar *cbegin() const { return unicode(); }
|
||||
inline const QChar *end() const { return unicode() + size(); }
|
||||
inline const QChar *cend() const { return unicode() + size(); }
|
||||
|
||||
inline const_iterator begin() const { return unicode(); }
|
||||
inline const_iterator cbegin() const { return unicode(); }
|
||||
inline const_iterator end() const { return unicode() + size(); }
|
||||
inline const_iterator cend() const { return unicode() + size(); }
|
||||
inline const_reverse_iterator rbegin() const { return const_reverse_iterator(end()); }
|
||||
inline const_reverse_iterator crbegin() const { return rbegin(); }
|
||||
inline const_reverse_iterator rend() const { return const_reverse_iterator(begin()); }
|
||||
inline const_reverse_iterator crend() const { return rend(); }
|
||||
|
||||
#if QT_DEPRECATED_SINCE(5, 0)
|
||||
QT_DEPRECATED QByteArray toAscii() const Q_REQUIRED_RESULT
|
||||
@ -1658,9 +1664,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; }
|
||||
|
||||
@ -1669,13 +1675,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)
|
||||
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; }
|
||||
#endif // !defined(QT_NO_CAST_FROM_ASCII) && !defined(QT_RESTRICTED_CAST_FROM_ASCII)
|
||||
|
||||
inline int QString::localeAwareCompare(const QStringRef &s) const
|
||||
|
@ -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 '+'.
|
||||
/*
|
||||
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.
|
||||
|
||||
// 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);
|
||||
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.
|
||||
|
||||
// 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 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)
|
||||
}
|
||||
}
|
||||
|
@ -2300,9 +2300,17 @@ void QGuiApplicationPrivate::processTabletEvent(QWindowSystemInterfacePrivate::T
|
||||
e->device, e->pointerType, e->pressure, e->xTilt, e->yTilt,
|
||||
e->tangentialPressure, e->rotation, e->z,
|
||||
e->modifiers, e->uid, button, e->buttons);
|
||||
ev.setAccepted(false);
|
||||
ev.setTimestamp(e->timestamp);
|
||||
QGuiApplication::sendSpontaneousEvent(window, &ev);
|
||||
pointData.state = e->buttons;
|
||||
if (!ev.isAccepted() && !QWindowSystemInterfacePrivate::TabletEvent::platformSynthesizesMouse
|
||||
&& qApp->testAttribute(Qt::AA_SynthesizeMouseForUnhandledTabletEvents)) {
|
||||
QWindowSystemInterfacePrivate::MouseEvent fake(window, e->timestamp, e->local, e->global,
|
||||
e->buttons, e->modifiers, Qt::MouseEventSynthesizedByQt);
|
||||
fake.flags |= QWindowSystemInterfacePrivate::WindowSystemEvent::Synthetic;
|
||||
processMouseEvent(&fake);
|
||||
}
|
||||
#else
|
||||
Q_UNUSED(e)
|
||||
#endif
|
||||
|
@ -97,6 +97,7 @@ void QInputMethod::setInputItemTransform(const QTransform &transform)
|
||||
|
||||
d->inputItemTransform = transform;
|
||||
emit cursorRectangleChanged();
|
||||
emit anchorRectangleChanged();
|
||||
}
|
||||
|
||||
|
||||
@ -126,6 +127,19 @@ void QInputMethod::setInputItemRectangle(const QRectF &rect)
|
||||
d->inputRectangle = rect;
|
||||
}
|
||||
|
||||
static QRectF inputMethodQueryRectangle_helper(Qt::InputMethodQuery imquery, const QTransform &xform)
|
||||
{
|
||||
QRectF r;
|
||||
if (QObject *focusObject = qGuiApp->focusObject()) {
|
||||
QInputMethodQueryEvent query(imquery);
|
||||
QGuiApplication::sendEvent(focusObject, &query);
|
||||
r = query.value(imquery).toRectF();
|
||||
if (r.isValid())
|
||||
r = xform.mapRect(r);
|
||||
}
|
||||
return r;
|
||||
}
|
||||
|
||||
/*!
|
||||
\property QInputMethod::cursorRectangle
|
||||
\brief Input item's cursor rectangle in window coordinates.
|
||||
@ -136,18 +150,20 @@ void QInputMethod::setInputItemRectangle(const QRectF &rect)
|
||||
QRectF QInputMethod::cursorRectangle() const
|
||||
{
|
||||
Q_D(const QInputMethod);
|
||||
return inputMethodQueryRectangle_helper(Qt::ImCursorRectangle, d->inputItemTransform);
|
||||
}
|
||||
|
||||
QObject *focusObject = qGuiApp->focusObject();
|
||||
if (!focusObject)
|
||||
return QRectF();
|
||||
/*!
|
||||
\property QInputMethod::anchorRectangle
|
||||
\brief Input item's anchor rectangle in window coordinates.
|
||||
|
||||
QInputMethodQueryEvent query(Qt::ImCursorRectangle);
|
||||
QGuiApplication::sendEvent(focusObject, &query);
|
||||
QRectF r = query.value(Qt::ImCursorRectangle).toRectF();
|
||||
if (!r.isValid())
|
||||
return QRectF();
|
||||
|
||||
return d->inputItemTransform.mapRect(r);
|
||||
Anchor rectangle is often used by various text editing controls
|
||||
like text prediction popups for following the text selection.
|
||||
*/
|
||||
QRectF QInputMethod::anchorRectangle() const
|
||||
{
|
||||
Q_D(const QInputMethod);
|
||||
return inputMethodQueryRectangle_helper(Qt::ImAnchorRectangle, d->inputItemTransform);
|
||||
}
|
||||
|
||||
/*!
|
||||
@ -300,6 +316,10 @@ void QInputMethod::update(Qt::InputMethodQueries queries)
|
||||
|
||||
if (queries & Qt::ImCursorRectangle)
|
||||
emit cursorRectangleChanged();
|
||||
|
||||
if (queries & (Qt::ImAnchorRectangle))
|
||||
emit anchorRectangleChanged();
|
||||
|
||||
}
|
||||
|
||||
/*!
|
||||
|
@ -55,6 +55,7 @@ class Q_GUI_EXPORT QInputMethod : public QObject
|
||||
Q_OBJECT
|
||||
Q_DECLARE_PRIVATE(QInputMethod)
|
||||
Q_PROPERTY(QRectF cursorRectangle READ cursorRectangle NOTIFY cursorRectangleChanged)
|
||||
Q_PROPERTY(QRectF anchorRectangle READ anchorRectangle NOTIFY anchorRectangleChanged)
|
||||
Q_PROPERTY(QRectF keyboardRectangle READ keyboardRectangle NOTIFY keyboardRectangleChanged)
|
||||
Q_PROPERTY(bool visible READ isVisible NOTIFY visibleChanged)
|
||||
Q_PROPERTY(bool animating READ isAnimating NOTIFY animatingChanged)
|
||||
@ -70,6 +71,7 @@ public:
|
||||
|
||||
// in window coordinates
|
||||
QRectF cursorRectangle() const; // ### what if we have rotations for the item?
|
||||
QRectF anchorRectangle() const; // ### ditto
|
||||
|
||||
// keyboard geometry in window coords
|
||||
QRectF keyboardRectangle() const;
|
||||
@ -102,6 +104,7 @@ public Q_SLOTS:
|
||||
|
||||
Q_SIGNALS:
|
||||
void cursorRectangleChanged();
|
||||
void anchorRectangleChanged();
|
||||
void keyboardRectangleChanged();
|
||||
void visibleChanged();
|
||||
void animatingChanged();
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
/*!
|
||||
|
@ -43,6 +43,8 @@
|
||||
#include "private/qkeymapper_p.h"
|
||||
#include <qpa/qplatforminputcontext_p.h>
|
||||
|
||||
#include <QtGui/qtransform.h>
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
/*!
|
||||
@ -267,5 +269,30 @@ void QPlatformInputContextPrivate::setInputMethodAccepted(bool accepted)
|
||||
QPlatformInputContextPrivate::s_inputMethodAccepted = accepted;
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief QPlatformInputContext::setSelectionOnFocusObject
|
||||
* \param anchorPos Beginning of selection in currently active window coordinates
|
||||
* \param cursorPos End of selection in currently active window coordinates
|
||||
*/
|
||||
void QPlatformInputContext::setSelectionOnFocusObject(const QPointF &anchorPos, const QPointF &cursorPos)
|
||||
{
|
||||
QObject *focus = qApp->focusObject();
|
||||
if (!focus)
|
||||
return;
|
||||
|
||||
QInputMethod *im = QGuiApplication::inputMethod();
|
||||
const QTransform mapToLocal = im->inputItemTransform().inverted();
|
||||
bool success;
|
||||
int anchor = QInputMethod::queryFocusObject(Qt::ImCursorPosition, anchorPos * mapToLocal).toInt(&success);
|
||||
if (success) {
|
||||
int cursor = QInputMethod::queryFocusObject(Qt::ImCursorPosition, cursorPos * mapToLocal).toInt(&success);
|
||||
if (success) {
|
||||
QList<QInputMethodEvent::Attribute> imAttributes;
|
||||
imAttributes.append(QInputMethodEvent::Attribute(QInputMethodEvent::Selection, anchor, cursor - anchor, QVariant()));
|
||||
QInputMethodEvent event(QString(), imAttributes);
|
||||
QGuiApplication::sendEvent(focus, &event);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
@ -95,6 +95,8 @@ public:
|
||||
virtual void setFocusObject(QObject *object);
|
||||
bool inputMethodAccepted() const;
|
||||
|
||||
static void setSelectionOnFocusObject(const QPointF &anchorPos, const QPointF &cursorPos);
|
||||
|
||||
private:
|
||||
friend class QGuiApplication;
|
||||
friend class QGuiApplicationPrivate;
|
||||
|
@ -54,6 +54,7 @@ QT_BEGIN_NAMESPACE
|
||||
|
||||
QElapsedTimer QWindowSystemInterfacePrivate::eventTime;
|
||||
bool QWindowSystemInterfacePrivate::synchronousWindowSystemEvents = false;
|
||||
bool QWindowSystemInterfacePrivate::TabletEvent::platformSynthesizesMouse = true;
|
||||
QWaitCondition QWindowSystemInterfacePrivate::eventsFlushed;
|
||||
QMutex QWindowSystemInterfacePrivate::flushEventMutex;
|
||||
QAtomicInt QWindowSystemInterfacePrivate::eventAccepted;
|
||||
@ -948,4 +949,9 @@ QWindowSystemInterfacePrivate::WheelEvent::WheelEvent(QWindow *w, ulong time, co
|
||||
{
|
||||
}
|
||||
|
||||
void QWindowSystemInterfacePrivate::TabletEvent::setPlatformSynthesizesMouse(bool v)
|
||||
{
|
||||
platformSynthesizesMouse = v;
|
||||
}
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
@ -352,6 +352,7 @@ public:
|
||||
int device, int pointerType, Qt::MouseButtons buttons, qreal pressure, int xTilt, int yTilt,
|
||||
qreal tangentialPressure, qreal rotation, int z, qint64 uid,
|
||||
Qt::KeyboardModifiers modifiers = Qt::NoModifier);
|
||||
static void setPlatformSynthesizesMouse(bool v);
|
||||
|
||||
TabletEvent(QWindow *w, ulong time, const QPointF &local, const QPointF &global,
|
||||
int device, int pointerType, Qt::MouseButtons b, qreal pressure, int xTilt, int yTilt, qreal tpressure,
|
||||
@ -372,6 +373,7 @@ public:
|
||||
qreal rotation;
|
||||
int z;
|
||||
qint64 uid;
|
||||
static bool platformSynthesizesMouse;
|
||||
};
|
||||
|
||||
class TabletEnterProximityEvent : public InputEvent {
|
||||
|
@ -45,6 +45,8 @@
|
||||
#include <QtGui/private/qopenglcontext_p.h>
|
||||
#include <QtCore/qthreadstorage.h>
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
#if defined(QT_DEBUG)
|
||||
#include <QMetaEnum>
|
||||
#endif
|
||||
@ -475,15 +477,16 @@ QOpenGLEngineShaderProg *QOpenGLEngineSharedShaders::findProgramInCache(const QO
|
||||
|
||||
void QOpenGLEngineSharedShaders::cleanupCustomStage(QOpenGLCustomShaderStage* stage)
|
||||
{
|
||||
// Remove any shader programs which has this as the custom shader src:
|
||||
for (int i = 0; i < cachedPrograms.size(); ++i) {
|
||||
QOpenGLEngineShaderProg *cachedProg = cachedPrograms[i];
|
||||
auto hasStageAsCustomShaderSouce = [stage](QOpenGLEngineShaderProg *cachedProg) -> bool {
|
||||
if (cachedProg->customStageSource == stage->source()) {
|
||||
delete cachedProg;
|
||||
cachedPrograms.removeAt(i);
|
||||
i--;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
};
|
||||
cachedPrograms.erase(std::remove_if(cachedPrograms.begin(), cachedPrograms.end(),
|
||||
hasStageAsCustomShaderSouce),
|
||||
cachedPrograms.end());
|
||||
}
|
||||
|
||||
|
||||
|
@ -1693,8 +1693,12 @@ void QRasterPaintEngine::fill(const QVectorPath &path, const QBrush &brush)
|
||||
|
||||
// ### Optimize for non transformed ellipses and rectangles...
|
||||
QRectF cpRect = path.controlPointRect();
|
||||
const QRect deviceRect = s->matrix.mapRect(cpRect).toRect();
|
||||
ProcessSpans blend = d->getBrushFunc(deviceRect, &s->brushData);
|
||||
const QRect pathDeviceRect = s->matrix.mapRect(cpRect).toRect();
|
||||
// Skip paths that by conservative estimates are completely outside the paint device.
|
||||
if (!pathDeviceRect.intersects(d->deviceRect))
|
||||
return;
|
||||
|
||||
ProcessSpans blend = d->getBrushFunc(pathDeviceRect, &s->brushData);
|
||||
|
||||
// ### Falcon
|
||||
// const bool do_clip = (deviceRect.left() < -QT_RASTER_COORD_LIMIT
|
||||
@ -3893,7 +3897,7 @@ void QClipData::setClipRect(const QRect &rect)
|
||||
void QClipData::setClipRegion(const QRegion ®ion)
|
||||
{
|
||||
if (region.rectCount() == 1) {
|
||||
setClipRect(*region.begin());
|
||||
setClipRect(region.boundingRect());
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -1561,6 +1561,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();
|
||||
@ -1574,7 +1575,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
|
||||
@ -1617,7 +1618,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"
|
||||
@ -1641,7 +1642,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"
|
||||
|
@ -2901,14 +2901,12 @@ static void markFrames(QTextFrame *current, int from, int oldLength, int length)
|
||||
return;
|
||||
|
||||
QTextFrameData *fd = data(current);
|
||||
for (int i = 0; i < fd->floats.size(); ++i) {
|
||||
QTextFrame *f = fd->floats[i];
|
||||
if (!f) {
|
||||
// float got removed in editing operation
|
||||
fd->floats.removeAt(i);
|
||||
--i;
|
||||
}
|
||||
}
|
||||
// float got removed in editing operation
|
||||
QTextFrame *null = nullptr; // work-around for (at least) MSVC 2012 emitting
|
||||
// warning C4100 for its own header <algorithm>
|
||||
// when passing nullptr directly to std::remove
|
||||
fd->floats.erase(std::remove(fd->floats.begin(), fd->floats.end(), null),
|
||||
fd->floats.end());
|
||||
|
||||
fd->layoutDirty = true;
|
||||
fd->sizeDirty = true;
|
||||
|
@ -1569,8 +1569,12 @@ void QTextEngine::validate() const
|
||||
layoutData = new LayoutData();
|
||||
if (block.docHandle()) {
|
||||
layoutData->string = block.text();
|
||||
if (option.flags() & QTextOption::ShowLineAndParagraphSeparators)
|
||||
layoutData->string += QLatin1Char(block.next().isValid() ? 0xb6 : 0xA7);
|
||||
if (block.next().isValid()) {
|
||||
if (option.flags() & QTextOption::ShowLineAndParagraphSeparators)
|
||||
layoutData->string += QChar(0xb6);
|
||||
} else if (option.flags() & QTextOption::ShowDocumentTerminator) {
|
||||
layoutData->string += QChar(0xA7);
|
||||
}
|
||||
} else {
|
||||
layoutData->string = text;
|
||||
}
|
||||
|
@ -309,6 +309,8 @@ QList<QTextOption::Tab> QTextOption::tabs() const
|
||||
this width is excluded.
|
||||
\value ShowTabsAndSpaces Visualize spaces with little dots, and tabs with little arrows.
|
||||
\value ShowLineAndParagraphSeparators Visualize line and paragraph separators with appropriate symbol characters.
|
||||
\value ShowDocumentTerminator Visualize the end of the document with a section sign. This enum value was added
|
||||
in Qt 5.7.
|
||||
\value AddSpaceForLineAndParagraphSeparators While determining the line-break positions take into account the
|
||||
space added for drawing a separator character.
|
||||
\value SuppressColors Suppress all color changes in the character formats (except the main selection).
|
||||
|
@ -109,6 +109,7 @@ public:
|
||||
ShowLineAndParagraphSeparators = 0x2,
|
||||
AddSpaceForLineAndParagraphSeparators = 0x4,
|
||||
SuppressColors = 0x8,
|
||||
ShowDocumentTerminator = 0x10,
|
||||
IncludeTrailingSpaces = 0x80000000
|
||||
};
|
||||
Q_DECLARE_FLAGS(Flags, Flag)
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
|
@ -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()
|
||||
|
@ -138,7 +138,7 @@ QList<QSslCertificate> QSslSocketPrivate::systemCaCertificates()
|
||||
for (CFIndex i = 0; i < size; ++i) {
|
||||
SecCertificateRef cfCert = (SecCertificateRef)CFArrayGetValueAtIndex(cfCerts, i);
|
||||
QCFType<CFDataRef> derData = SecCertificateCopyData(cfCert);
|
||||
if (QT_PREPEND_NAMESPACE(isCaCertificateTrusted(cfCert, dom))) {
|
||||
if (isCaCertificateTrusted(cfCert, dom)) {
|
||||
if (derData == NULL) {
|
||||
qCWarning(lcSsl, "Error retrieving a CA certificate from the system store");
|
||||
} else {
|
||||
|
@ -48,6 +48,8 @@
|
||||
#include <QMetaEnum>
|
||||
#endif
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
// #define QT_GL_SHARED_SHADER_DEBUG
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
@ -472,15 +474,16 @@ QGLEngineShaderProg *QGLEngineSharedShaders::findProgramInCache(const QGLEngineS
|
||||
|
||||
void QGLEngineSharedShaders::cleanupCustomStage(QGLCustomShaderStage* stage)
|
||||
{
|
||||
// Remove any shader programs which has this as the custom shader src:
|
||||
for (int i = 0; i < cachedPrograms.size(); ++i) {
|
||||
QGLEngineShaderProg *cachedProg = cachedPrograms[i];
|
||||
auto hasStageAsCustomShaderSouce = [stage](QGLEngineShaderProg *cachedProg) -> bool {
|
||||
if (cachedProg->customStageSource == stage->source()) {
|
||||
delete cachedProg;
|
||||
cachedPrograms.removeAt(i);
|
||||
i--;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
};
|
||||
cachedPrograms.erase(std::remove_if(cachedPrograms.begin(), cachedPrograms.end(),
|
||||
hasStageAsCustomShaderSouce),
|
||||
cachedPrograms.end());
|
||||
}
|
||||
|
||||
|
||||
|
@ -1264,7 +1264,7 @@ QGLFormat::OpenGLVersionFlags Q_AUTOTEST_EXPORT qOpenGLVersionFlagsFromString(co
|
||||
QGLFormat::OpenGLVersionFlags versionFlags = QGLFormat::OpenGL_Version_None;
|
||||
|
||||
if (versionString.startsWith(QLatin1String("OpenGL ES"))) {
|
||||
QStringList parts = versionString.split(QLatin1Char(' '));
|
||||
const auto parts = versionString.splitRef(QLatin1Char(' '));
|
||||
if (parts.size() >= 3) {
|
||||
if (parts[2].startsWith(QLatin1String("1."))) {
|
||||
if (parts[1].endsWith(QLatin1String("-CM"))) {
|
||||
|
@ -215,8 +215,8 @@ bool QDeviceDiscoveryUDev::checkDeviceType(udev_device *dev)
|
||||
return false;
|
||||
|
||||
if ((m_types & Device_Keyboard) && (qstrcmp(udev_device_get_property_value(dev, "ID_INPUT_KEYBOARD"), "1") == 0 )) {
|
||||
const char *capabilities_key = udev_device_get_sysattr_value(dev, "capabilities/key");
|
||||
QStringList val = QString::fromUtf8(capabilities_key).split(QLatin1Char(' '), QString::SkipEmptyParts);
|
||||
const QString capabilities_key = QString::fromUtf8(udev_device_get_sysattr_value(dev, "capabilities/key"));
|
||||
const auto val = capabilities_key.splitRef(QLatin1Char(' '), QString::SkipEmptyParts);
|
||||
if (!val.isEmpty()) {
|
||||
bool ok;
|
||||
unsigned long long keys = val.last().toULongLong(&ok, 16);
|
||||
|
@ -40,6 +40,7 @@
|
||||
// We have to include this before the X11 headers dragged in by
|
||||
// qglxconvenience_p.h.
|
||||
#include <QtCore/QByteArray>
|
||||
#include <QtCore/QScopedPointer>
|
||||
|
||||
#include "qglxconvenience_p.h"
|
||||
|
||||
@ -77,173 +78,181 @@ enum {
|
||||
|
||||
QVector<int> qglx_buildSpec(const QSurfaceFormat &format, int drawableBit)
|
||||
{
|
||||
QVector<int> spec(48);
|
||||
int i = 0;
|
||||
QVector<int> spec;
|
||||
|
||||
spec[i++] = GLX_LEVEL;
|
||||
spec[i++] = 0;
|
||||
spec[i++] = GLX_DRAWABLE_TYPE; spec[i++] = drawableBit;
|
||||
spec << GLX_LEVEL
|
||||
<< 0
|
||||
|
||||
spec[i++] = GLX_RENDER_TYPE; spec[i++] = GLX_RGBA_BIT;
|
||||
<< GLX_RENDER_TYPE
|
||||
<< GLX_RGBA_BIT
|
||||
|
||||
spec[i++] = GLX_RED_SIZE; spec[i++] = (format.redBufferSize() == -1) ? 1 : format.redBufferSize();
|
||||
spec[i++] = GLX_GREEN_SIZE; spec[i++] = (format.greenBufferSize() == -1) ? 1 : format.greenBufferSize();
|
||||
spec[i++] = GLX_BLUE_SIZE; spec[i++] = (format.blueBufferSize() == -1) ? 1 : format.blueBufferSize();
|
||||
if (format.hasAlpha()) {
|
||||
spec[i++] = GLX_ALPHA_SIZE; spec[i++] = format.alphaBufferSize();
|
||||
}
|
||||
<< GLX_RED_SIZE
|
||||
<< qMax(1, format.redBufferSize())
|
||||
|
||||
spec[i++] = GLX_DOUBLEBUFFER; spec[i++] = format.swapBehavior() != QSurfaceFormat::SingleBuffer ? True : False;
|
||||
<< GLX_GREEN_SIZE
|
||||
<< qMax(1, format.greenBufferSize())
|
||||
|
||||
spec[i++] = GLX_STEREO; spec[i++] = format.stereo() ? True : False;
|
||||
<< GLX_BLUE_SIZE
|
||||
<< qMax(1, format.blueBufferSize())
|
||||
|
||||
if (format.depthBufferSize() > 0) {
|
||||
spec[i++] = GLX_DEPTH_SIZE; spec[i++] = format.depthBufferSize();
|
||||
}
|
||||
<< GLX_ALPHA_SIZE
|
||||
<< qMax(0, format.alphaBufferSize());
|
||||
|
||||
if (format.stencilBufferSize() > 0) {
|
||||
spec[i++] = GLX_STENCIL_SIZE; spec[i++] = (format.stencilBufferSize() == -1) ? 1 : format.stencilBufferSize();
|
||||
}
|
||||
if (format.swapBehavior() != QSurfaceFormat::SingleBuffer)
|
||||
spec << GLX_DOUBLEBUFFER
|
||||
<< True;
|
||||
|
||||
if (format.samples() > 1) {
|
||||
spec[i++] = GLX_SAMPLE_BUFFERS_ARB;
|
||||
spec[i++] = 1;
|
||||
spec[i++] = GLX_SAMPLES_ARB;
|
||||
spec[i++] = format.samples();
|
||||
}
|
||||
if (format.stereo())
|
||||
spec << GLX_STEREO
|
||||
<< True;
|
||||
|
||||
if (format.depthBufferSize() != -1)
|
||||
spec << GLX_DEPTH_SIZE
|
||||
<< format.depthBufferSize();
|
||||
|
||||
if (format.stencilBufferSize() != -1)
|
||||
spec << GLX_STENCIL_SIZE
|
||||
<< format.stencilBufferSize();
|
||||
|
||||
if (format.samples() > 1)
|
||||
spec << GLX_SAMPLE_BUFFERS_ARB
|
||||
<< 1
|
||||
<< GLX_SAMPLES_ARB
|
||||
<< format.samples();
|
||||
|
||||
spec << GLX_DRAWABLE_TYPE
|
||||
<< drawableBit
|
||||
|
||||
<< XNone;
|
||||
|
||||
spec[i++] = XNone;
|
||||
return spec;
|
||||
}
|
||||
|
||||
GLXFBConfig qglx_findConfig(Display *display, int screen , const QSurfaceFormat &format, int drawableBit)
|
||||
{
|
||||
// Allow forcing LIBGL_ALWAYS_SOFTWARE for Qt 5 applications only.
|
||||
// This is most useful with drivers that only support OpenGL 1.
|
||||
// We need OpenGL 2, but the user probably doesn't want
|
||||
// LIBGL_ALWAYS_SOFTWARE in OpenGL 1 apps.
|
||||
static bool checkedForceSoftwareOpenGL = false;
|
||||
static bool forceSoftwareOpenGL = false;
|
||||
if (!checkedForceSoftwareOpenGL) {
|
||||
// If LIBGL_ALWAYS_SOFTWARE is already set, don't mess with it.
|
||||
// We want to unset LIBGL_ALWAYS_SOFTWARE at the end so it does not
|
||||
// get inherited by other processes, of course only if it wasn't
|
||||
// already set before.
|
||||
if (!qEnvironmentVariableIsEmpty("QT_XCB_FORCE_SOFTWARE_OPENGL")
|
||||
&& !qEnvironmentVariableIsSet("LIBGL_ALWAYS_SOFTWARE"))
|
||||
forceSoftwareOpenGL = true;
|
||||
namespace {
|
||||
struct QXcbSoftwareOpenGLEnforcer {
|
||||
QXcbSoftwareOpenGLEnforcer() {
|
||||
// Allow forcing LIBGL_ALWAYS_SOFTWARE for Qt 5 applications only.
|
||||
// This is most useful with drivers that only support OpenGL 1.
|
||||
// We need OpenGL 2, but the user probably doesn't want
|
||||
// LIBGL_ALWAYS_SOFTWARE in OpenGL 1 apps.
|
||||
|
||||
checkedForceSoftwareOpenGL = true;
|
||||
}
|
||||
if (!checkedForceSoftwareOpenGL) {
|
||||
// If LIBGL_ALWAYS_SOFTWARE is already set, don't mess with it.
|
||||
// We want to unset LIBGL_ALWAYS_SOFTWARE at the end so it does not
|
||||
// get inherited by other processes, of course only if it wasn't
|
||||
// already set before.
|
||||
if (!qEnvironmentVariableIsEmpty("QT_XCB_FORCE_SOFTWARE_OPENGL")
|
||||
&& !qEnvironmentVariableIsSet("LIBGL_ALWAYS_SOFTWARE"))
|
||||
forceSoftwareOpenGL = true;
|
||||
|
||||
if (forceSoftwareOpenGL)
|
||||
qputenv("LIBGL_ALWAYS_SOFTWARE", QByteArrayLiteral("1"));
|
||||
|
||||
bool reduced = true;
|
||||
GLXFBConfig chosenConfig = 0;
|
||||
QSurfaceFormat reducedFormat = format;
|
||||
while (!chosenConfig && reduced) {
|
||||
QVector<int> spec = qglx_buildSpec(reducedFormat, drawableBit);
|
||||
int confcount = 0;
|
||||
GLXFBConfig *configs;
|
||||
configs = glXChooseFBConfig(display, screen,spec.constData(),&confcount);
|
||||
if (confcount)
|
||||
{
|
||||
for (int i = 0; i < confcount; i++) {
|
||||
chosenConfig = configs[i];
|
||||
// Make sure we try to get an ARGB visual if the format asked for an alpha:
|
||||
if (reducedFormat.hasAlpha()) {
|
||||
int alphaSize;
|
||||
glXGetFBConfigAttrib(display,configs[i],GLX_ALPHA_SIZE,&alphaSize);
|
||||
if (alphaSize > 0) {
|
||||
XVisualInfo *visual = glXGetVisualFromFBConfig(display, chosenConfig);
|
||||
bool hasAlpha = false;
|
||||
|
||||
#if !defined(QT_NO_XRENDER)
|
||||
XRenderPictFormat *pictFormat = XRenderFindVisualFormat(display, visual->visual);
|
||||
hasAlpha = pictFormat->direct.alphaMask > 0;
|
||||
#else
|
||||
hasAlpha = visual->depth == 32;
|
||||
#endif
|
||||
|
||||
XFree(visual);
|
||||
|
||||
if (hasAlpha)
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
break; // Just choose the first in the list if there's no alpha requested
|
||||
}
|
||||
}
|
||||
|
||||
XFree(configs);
|
||||
checkedForceSoftwareOpenGL = true;
|
||||
}
|
||||
if (!chosenConfig)
|
||||
reducedFormat = qglx_reduceSurfaceFormat(reducedFormat,&reduced);
|
||||
|
||||
if (forceSoftwareOpenGL)
|
||||
qputenv("LIBGL_ALWAYS_SOFTWARE", QByteArrayLiteral("1"));
|
||||
}
|
||||
|
||||
// unset LIBGL_ALWAYS_SOFTWARE now so other processes don't inherit it
|
||||
if (forceSoftwareOpenGL)
|
||||
qunsetenv("LIBGL_ALWAYS_SOFTWARE");
|
||||
~QXcbSoftwareOpenGLEnforcer() {
|
||||
// unset LIBGL_ALWAYS_SOFTWARE now so other processes don't inherit it
|
||||
if (forceSoftwareOpenGL)
|
||||
qunsetenv("LIBGL_ALWAYS_SOFTWARE");
|
||||
}
|
||||
|
||||
return chosenConfig;
|
||||
static bool checkedForceSoftwareOpenGL;
|
||||
static bool forceSoftwareOpenGL;
|
||||
};
|
||||
|
||||
bool QXcbSoftwareOpenGLEnforcer::checkedForceSoftwareOpenGL = false;
|
||||
bool QXcbSoftwareOpenGLEnforcer::forceSoftwareOpenGL = false;
|
||||
|
||||
template <class T>
|
||||
struct QXlibScopedPointerDeleter {
|
||||
static inline void cleanup(T *pointer) {
|
||||
XFree(pointer);
|
||||
}
|
||||
};
|
||||
|
||||
template <class T>
|
||||
using QXlibPointer = QScopedPointer<T, QXlibScopedPointerDeleter<T>>;
|
||||
|
||||
template <class T>
|
||||
using QXlibArrayPointer = QScopedArrayPointer<T, QXlibScopedPointerDeleter<T>>;
|
||||
}
|
||||
|
||||
XVisualInfo *qglx_findVisualInfo(Display *display, int screen, QSurfaceFormat *format)
|
||||
GLXFBConfig qglx_findConfig(Display *display, int screen , QSurfaceFormat format, bool highestPixelFormat, int drawableBit)
|
||||
{
|
||||
QXcbSoftwareOpenGLEnforcer softwareOpenGLEnforcer;
|
||||
|
||||
GLXFBConfig config = 0;
|
||||
|
||||
do {
|
||||
const QVector<int> spec = qglx_buildSpec(format, drawableBit);
|
||||
|
||||
int confcount = 0;
|
||||
QXlibArrayPointer<GLXFBConfig> configs(glXChooseFBConfig(display, screen, spec.constData(), &confcount));
|
||||
|
||||
if (!config && confcount > 0) {
|
||||
config = configs[0];
|
||||
if (highestPixelFormat && !format.hasAlpha())
|
||||
break;
|
||||
}
|
||||
|
||||
const int requestedRed = qMax(0, format.redBufferSize());
|
||||
const int requestedGreen = qMax(0, format.greenBufferSize());
|
||||
const int requestedBlue = qMax(0, format.blueBufferSize());
|
||||
const int requestedAlpha = qMax(0, format.alphaBufferSize());
|
||||
|
||||
for (int i = 0; i < confcount; i++) {
|
||||
GLXFBConfig candidate = configs[i];
|
||||
|
||||
QXlibPointer<XVisualInfo> visual(glXGetVisualFromFBConfig(display, candidate));
|
||||
|
||||
const int actualRed = qPopulationCount(visual->red_mask);
|
||||
const int actualGreen = qPopulationCount(visual->green_mask);
|
||||
const int actualBlue = qPopulationCount(visual->blue_mask);
|
||||
const int actualAlpha = visual->depth - actualRed - actualGreen - actualBlue;
|
||||
|
||||
if (requestedRed && actualRed != requestedRed)
|
||||
continue;
|
||||
if (requestedGreen && actualGreen != requestedGreen)
|
||||
continue;
|
||||
if (requestedBlue && actualBlue != requestedBlue)
|
||||
continue;
|
||||
if (requestedAlpha && actualAlpha != requestedAlpha)
|
||||
continue;
|
||||
|
||||
return candidate;
|
||||
}
|
||||
} while (qglx_reduceFormat(&format));
|
||||
|
||||
return config;
|
||||
}
|
||||
|
||||
XVisualInfo *qglx_findVisualInfo(Display *display, int screen, QSurfaceFormat *format, int drawableBit)
|
||||
{
|
||||
Q_ASSERT(format);
|
||||
|
||||
XVisualInfo *visualInfo = 0;
|
||||
|
||||
GLXFBConfig config = qglx_findConfig(display,screen,*format);
|
||||
if (config) {
|
||||
GLXFBConfig config = qglx_findConfig(display, screen, *format, false, drawableBit);
|
||||
if (config)
|
||||
visualInfo = glXGetVisualFromFBConfig(display, config);
|
||||
|
||||
if (visualInfo) {
|
||||
qglx_surfaceFormatFromGLXFBConfig(format, display, config);
|
||||
return visualInfo;
|
||||
}
|
||||
|
||||
// attempt to fall back to glXChooseVisual
|
||||
bool reduced = true;
|
||||
QSurfaceFormat reducedFormat = *format;
|
||||
while (!visualInfo && reduced) {
|
||||
QVarLengthArray<int, 13> attribs;
|
||||
attribs.append(GLX_RGBA);
|
||||
|
||||
if (reducedFormat.redBufferSize() > 0) {
|
||||
attribs.append(GLX_RED_SIZE);
|
||||
attribs.append(reducedFormat.redBufferSize());
|
||||
}
|
||||
|
||||
if (reducedFormat.greenBufferSize() > 0) {
|
||||
attribs.append(GLX_GREEN_SIZE);
|
||||
attribs.append(reducedFormat.greenBufferSize());
|
||||
}
|
||||
|
||||
if (reducedFormat.blueBufferSize() > 0) {
|
||||
attribs.append(GLX_BLUE_SIZE);
|
||||
attribs.append(reducedFormat.blueBufferSize());
|
||||
}
|
||||
|
||||
if (reducedFormat.stencilBufferSize() > 0) {
|
||||
attribs.append(GLX_STENCIL_SIZE);
|
||||
attribs.append(reducedFormat.stencilBufferSize());
|
||||
}
|
||||
|
||||
if (reducedFormat.depthBufferSize() > 0) {
|
||||
attribs.append(GLX_DEPTH_SIZE);
|
||||
attribs.append(reducedFormat.depthBufferSize());
|
||||
}
|
||||
|
||||
if (reducedFormat.swapBehavior() != QSurfaceFormat::SingleBuffer)
|
||||
attribs.append(GLX_DOUBLEBUFFER);
|
||||
|
||||
attribs.append(XNone);
|
||||
|
||||
do {
|
||||
QVector<int> attribs = qglx_buildSpec(*format, drawableBit);
|
||||
visualInfo = glXChooseVisual(display, screen, attribs.data());
|
||||
if (visualInfo)
|
||||
*format = reducedFormat;
|
||||
|
||||
reducedFormat = qglx_reduceSurfaceFormat(reducedFormat, &reduced);
|
||||
}
|
||||
if (visualInfo) {
|
||||
qglx_surfaceFormatFromVisualInfo(format, display, visualInfo);
|
||||
return visualInfo;
|
||||
}
|
||||
} while (qglx_reduceFormat(format));
|
||||
|
||||
return visualInfo;
|
||||
}
|
||||
@ -318,33 +327,64 @@ void qglx_surfaceFormatFromVisualInfo(QSurfaceFormat *format, Display *display,
|
||||
format->setStereo(stereo);
|
||||
}
|
||||
|
||||
QSurfaceFormat qglx_reduceSurfaceFormat(const QSurfaceFormat &format, bool *reduced)
|
||||
bool qglx_reduceFormat(QSurfaceFormat *format)
|
||||
{
|
||||
QSurfaceFormat retFormat = format;
|
||||
*reduced = true;
|
||||
Q_ASSERT(format);
|
||||
|
||||
if (retFormat.depthBufferSize() >= 32) {
|
||||
retFormat.setDepthBufferSize(24);
|
||||
} else if (retFormat.depthBufferSize() > 0) {
|
||||
retFormat.setDepthBufferSize(0);
|
||||
} else if (retFormat.redBufferSize() > 1) {
|
||||
retFormat.setRedBufferSize(1);
|
||||
} else if (retFormat.greenBufferSize() > 1) {
|
||||
retFormat.setGreenBufferSize(1);
|
||||
} else if (retFormat.blueBufferSize() > 1) {
|
||||
retFormat.setBlueBufferSize(1);
|
||||
} else if (retFormat.samples() > 1) {
|
||||
retFormat.setSamples(qMin(retFormat.samples() / 2, 16));
|
||||
} else if (retFormat.stereo()) {
|
||||
retFormat.setStereo(false);
|
||||
}else if (retFormat.stencilBufferSize() > 0) {
|
||||
retFormat.setStencilBufferSize(0);
|
||||
}else if (retFormat.hasAlpha()) {
|
||||
retFormat.setAlphaBufferSize(0);
|
||||
}else if (retFormat.swapBehavior() != QSurfaceFormat::SingleBuffer) {
|
||||
retFormat.setSwapBehavior(QSurfaceFormat::SingleBuffer);
|
||||
}else{
|
||||
*reduced = false;
|
||||
if (format->redBufferSize() > 1) {
|
||||
format->setRedBufferSize(1);
|
||||
return true;
|
||||
}
|
||||
return retFormat;
|
||||
|
||||
if (format->greenBufferSize() > 1) {
|
||||
format->setGreenBufferSize(1);
|
||||
return true;
|
||||
}
|
||||
|
||||
if (format->blueBufferSize() > 1) {
|
||||
format->setBlueBufferSize(1);
|
||||
return true;
|
||||
}
|
||||
|
||||
if (format->swapBehavior() != QSurfaceFormat::SingleBuffer){
|
||||
format->setSwapBehavior(QSurfaceFormat::SingleBuffer);
|
||||
return true;
|
||||
}
|
||||
|
||||
if (format->samples() > 1) {
|
||||
format->setSamples(qMin(16, format->samples() / 2));
|
||||
return true;
|
||||
}
|
||||
|
||||
if (format->depthBufferSize() >= 32) {
|
||||
format->setDepthBufferSize(24);
|
||||
return true;
|
||||
}
|
||||
|
||||
if (format->depthBufferSize() > 1) {
|
||||
format->setDepthBufferSize(1);
|
||||
return true;
|
||||
}
|
||||
|
||||
if (format->depthBufferSize() > 0) {
|
||||
format->setDepthBufferSize(0);
|
||||
return true;
|
||||
}
|
||||
|
||||
if (format->hasAlpha()) {
|
||||
format->setAlphaBufferSize(0);
|
||||
return true;
|
||||
}
|
||||
|
||||
if (format->stencilBufferSize() > 1) {
|
||||
format->setStencilBufferSize(1);
|
||||
return true;
|
||||
}
|
||||
|
||||
if (format->stencilBufferSize() > 0) {
|
||||
format->setStencilBufferSize(0);
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
@ -57,11 +57,11 @@
|
||||
#include <X11/Xlib.h>
|
||||
#include <GL/glx.h>
|
||||
|
||||
XVisualInfo *qglx_findVisualInfo(Display *display, int screen, QSurfaceFormat *format);
|
||||
GLXFBConfig qglx_findConfig(Display *display, int screen, const QSurfaceFormat &format, int drawableBit = GLX_WINDOW_BIT);
|
||||
QVector<int> qglx_buildSpec(const QSurfaceFormat &format, int drawableBit = GLX_WINDOW_BIT);
|
||||
XVisualInfo *qglx_findVisualInfo(Display *display, int screen, QSurfaceFormat *format, int drawableBit = GLX_WINDOW_BIT);
|
||||
GLXFBConfig qglx_findConfig(Display *display, int screen, QSurfaceFormat format, bool highestPixelFormat = false, int drawableBit = GLX_WINDOW_BIT);
|
||||
void qglx_surfaceFormatFromGLXFBConfig(QSurfaceFormat *format, Display *display, GLXFBConfig config);
|
||||
void qglx_surfaceFormatFromVisualInfo(QSurfaceFormat *format, Display *display, XVisualInfo *visualInfo);
|
||||
QVector<int> qglx_buildSpec(const QSurfaceFormat &format, int drawableBit = GLX_WINDOW_BIT);
|
||||
QSurfaceFormat qglx_reduceSurfaceFormat(const QSurfaceFormat &format, bool *reduced);
|
||||
bool qglx_reduceFormat(QSurfaceFormat *format);
|
||||
|
||||
#endif // QGLXCONVENIENCE_H
|
||||
|
@ -101,10 +101,10 @@ QEvdevKeyboardHandler *QEvdevKeyboardHandler::create(const QString &device,
|
||||
bool enableCompose = false;
|
||||
int grab = 0;
|
||||
|
||||
QStringList args = specification.split(QLatin1Char(':'));
|
||||
foreach (const QString &arg, args) {
|
||||
const auto args = specification.splitRef(QLatin1Char(':'));
|
||||
for (const QStringRef &arg : args) {
|
||||
if (arg.startsWith(QLatin1String("keymap=")))
|
||||
keymapFile = arg.mid(7);
|
||||
keymapFile = arg.mid(7).toString();
|
||||
else if (arg == QLatin1String("disable-zap"))
|
||||
disableZap = true;
|
||||
else if (arg == QLatin1String("enable-compose"))
|
||||
|
@ -135,9 +135,10 @@ void QEvdevKeyboardManager::loadKeymap(const QString &file)
|
||||
// Restore the default, which is either the built-in keymap or
|
||||
// the one given in the plugin spec.
|
||||
QString keymapFromSpec;
|
||||
foreach (const QString &arg, m_spec.split(QLatin1Char(':'))) {
|
||||
const auto specs = m_spec.splitRef(QLatin1Char(':'));
|
||||
for (const QStringRef &arg : specs) {
|
||||
if (arg.startsWith(QLatin1String("keymap=")))
|
||||
keymapFromSpec = arg.mid(7);
|
||||
keymapFromSpec = arg.mid(7).toString();
|
||||
}
|
||||
foreach (QEvdevKeyboardHandler *handler, m_keyboards) {
|
||||
if (keymapFromSpec.isEmpty())
|
||||
|
@ -71,8 +71,8 @@ QEvdevMouseHandler *QEvdevMouseHandler::create(const QString &device, const QStr
|
||||
int grab = 0;
|
||||
bool abs = false;
|
||||
|
||||
QStringList args = specification.split(QLatin1Char(':'));
|
||||
foreach (const QString &arg, args) {
|
||||
const auto args = specification.splitRef(QLatin1Char(':'));
|
||||
for (const QStringRef &arg : args) {
|
||||
if (arg == QLatin1String("nocompress"))
|
||||
compression = false;
|
||||
else if (arg.startsWith(QLatin1String("dejitter=")))
|
||||
|
@ -177,8 +177,9 @@ QStringList QGenericUnixTheme::xdgIconThemePaths()
|
||||
QString xdgDirString = QFile::decodeName(qgetenv("XDG_DATA_DIRS"));
|
||||
if (xdgDirString.isEmpty())
|
||||
xdgDirString = QLatin1String("/usr/local/share/:/usr/share/");
|
||||
foreach (const QString &xdgDir, xdgDirString.split(QLatin1Char(':'))) {
|
||||
const QFileInfo xdgIconsDir(xdgDir + QStringLiteral("/icons"));
|
||||
const auto xdgDirs = xdgDirString.splitRef(QLatin1Char(':'));
|
||||
for (const QStringRef &xdgDir : xdgDirs) {
|
||||
const QFileInfo xdgIconsDir(xdgDir + QLatin1String("/icons"));
|
||||
if (xdgIconsDir.isDir())
|
||||
paths.append(xdgIconsDir.absoluteFilePath());
|
||||
}
|
||||
@ -626,7 +627,7 @@ public:
|
||||
{
|
||||
Q_ASSERT(!systemFont);
|
||||
const int split = gtkFontName.lastIndexOf(QChar::Space);
|
||||
float size = gtkFontName.mid(split+1).toFloat();
|
||||
float size = gtkFontName.midRef(split + 1).toFloat();
|
||||
QString fontName = gtkFontName.left(split);
|
||||
|
||||
systemFont = new QFont(fontName, size);
|
||||
|
@ -864,6 +864,7 @@ Q_DECL_EXPORT jint JNICALL JNI_OnLoad(JavaVM *vm, void */*reserved*/)
|
||||
__android_log_print(ANDROID_LOG_FATAL, "Qt", "registerNatives failed");
|
||||
return -1;
|
||||
}
|
||||
QWindowSystemInterfacePrivate::TabletEvent::setPlatformSynthesizesMouse(false);
|
||||
|
||||
m_javaVM = vm;
|
||||
return JNI_VERSION_1_4;
|
||||
|
@ -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(),
|
||||
|
@ -48,6 +48,9 @@
|
||||
#include "qiosintegration.h"
|
||||
#include "qiostextresponder.h"
|
||||
|
||||
#include <algorithm>
|
||||
#include <iterator>
|
||||
|
||||
// m_currentMenu points to the currently visible menu.
|
||||
// Only one menu will be visible at a time, and if a second menu
|
||||
// is shown on top of a first, the first one will be told to hide.
|
||||
@ -525,14 +528,10 @@ bool QIOSMenu::eventFilter(QObject *obj, QEvent *event)
|
||||
|
||||
QIOSMenuItemList QIOSMenu::visibleMenuItems() const
|
||||
{
|
||||
QIOSMenuItemList visibleMenuItems = m_menuItems;
|
||||
|
||||
for (int i = visibleMenuItems.count() - 1; i >= 0; --i) {
|
||||
QIOSMenuItem *item = visibleMenuItems.at(i);
|
||||
if (!item->m_enabled || !item->m_visible || item->m_separator)
|
||||
visibleMenuItems.removeAt(i);
|
||||
}
|
||||
|
||||
QIOSMenuItemList visibleMenuItems;
|
||||
visibleMenuItems.reserve(m_menuItems.size());
|
||||
std::copy_if(m_menuItems.begin(), m_menuItems.end(), std::back_inserter(visibleMenuItems),
|
||||
[](QIOSMenuItem *item) { return item->m_enabled && item->m_visible && !item->m_separator; });
|
||||
return visibleMenuItems;
|
||||
}
|
||||
|
||||
|
@ -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;
|
||||
|
||||
|
@ -344,10 +344,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());
|
||||
|
@ -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;
|
||||
|
@ -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:
|
||||
|
@ -41,7 +41,7 @@
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
Q_LOGGING_CATEGORY(QT_XCB_GLINTEGRATION, "qt.xcb.glintegration")
|
||||
Q_LOGGING_CATEGORY(lcQpaGl, "qt.qpa.gl")
|
||||
|
||||
QXcbGlIntegration::QXcbGlIntegration()
|
||||
{
|
||||
|
@ -50,7 +50,7 @@ class QPlatformOffscreenSurface;
|
||||
class QOffscreenSurface;
|
||||
class QXcbNativeInterfaceHandler;
|
||||
|
||||
Q_XCB_EXPORT Q_DECLARE_LOGGING_CATEGORY(QT_XCB_GLINTEGRATION)
|
||||
Q_XCB_EXPORT Q_DECLARE_LOGGING_CATEGORY(lcQpaGl)
|
||||
|
||||
class Q_XCB_EXPORT QXcbGlIntegration
|
||||
{
|
||||
|
@ -51,7 +51,7 @@ QXcbEglIntegration::QXcbEglIntegration()
|
||||
: m_connection(Q_NULLPTR)
|
||||
, m_egl_display(EGL_NO_DISPLAY)
|
||||
{
|
||||
qCDebug(QT_XCB_GLINTEGRATION) << "Xcb EGL gl-integration created";
|
||||
qCDebug(lcQpaGl) << "Xcb EGL gl-integration created";
|
||||
}
|
||||
|
||||
QXcbEglIntegration::~QXcbEglIntegration()
|
||||
@ -69,13 +69,13 @@ bool QXcbEglIntegration::initialize(QXcbConnection *connection)
|
||||
bool success = eglInitialize(m_egl_display, &major, &minor);
|
||||
if (!success) {
|
||||
m_egl_display = eglGetDisplay(EGL_DEFAULT_DISPLAY);
|
||||
qCDebug(QT_XCB_GLINTEGRATION) << "Xcb EGL gl-integration retrying with display" << m_egl_display;
|
||||
qCDebug(lcQpaGl) << "Xcb EGL gl-integration retrying with display" << m_egl_display;
|
||||
success = eglInitialize(m_egl_display, &major, &minor);
|
||||
}
|
||||
|
||||
m_native_interface_handler.reset(new QXcbEglNativeInterfaceHandler(connection->nativeInterface()));
|
||||
|
||||
qCDebug(QT_XCB_GLINTEGRATION) << "Xcb EGL gl-integration successfully initialized";
|
||||
qCDebug(lcQpaGl) << "Xcb EGL gl-integration successfully initialized";
|
||||
return success;
|
||||
}
|
||||
|
||||
@ -87,7 +87,7 @@ QXcbWindow *QXcbEglIntegration::createWindow(QWindow *window) const
|
||||
QPlatformOpenGLContext *QXcbEglIntegration::createPlatformOpenGLContext(QOpenGLContext *context) const
|
||||
{
|
||||
QXcbScreen *screen = static_cast<QXcbScreen *>(context->screen()->handle());
|
||||
QXcbEglContext *platformContext = new QXcbEglContext(context->format(),
|
||||
QXcbEglContext *platformContext = new QXcbEglContext(screen->surfaceFormatFor(context->format()),
|
||||
context->shareHandle(),
|
||||
eglDisplay(),
|
||||
screen->connection(),
|
||||
@ -98,7 +98,8 @@ QPlatformOpenGLContext *QXcbEglIntegration::createPlatformOpenGLContext(QOpenGLC
|
||||
|
||||
QPlatformOffscreenSurface *QXcbEglIntegration::createPlatformOffscreenSurface(QOffscreenSurface *surface) const
|
||||
{
|
||||
return new QEGLPbuffer(eglDisplay(), surface->requestedFormat(), surface);
|
||||
QXcbScreen *screen = static_cast<QXcbScreen *>(surface->screen()->handle());
|
||||
return new QEGLPbuffer(eglDisplay(), screen->surfaceFormatFor(surface->requestedFormat()), surface);
|
||||
}
|
||||
|
||||
void *QXcbEglIntegration::xlib_display() const
|
||||
|
@ -59,15 +59,19 @@ QXcbEglWindow::~QXcbEglWindow()
|
||||
eglDestroySurface(m_glIntegration->eglDisplay(), m_surface);
|
||||
}
|
||||
|
||||
void QXcbEglWindow::resolveFormat()
|
||||
void QXcbEglWindow::resolveFormat(const QSurfaceFormat &format)
|
||||
{
|
||||
m_config = q_configFromGLFormat(m_glIntegration->eglDisplay(), window()->requestedFormat(), true);
|
||||
m_format = q_glFormatFromConfig(m_glIntegration->eglDisplay(), m_config, m_format);
|
||||
m_config = q_configFromGLFormat(m_glIntegration->eglDisplay(), format);
|
||||
m_format = q_glFormatFromConfig(m_glIntegration->eglDisplay(), m_config, format);
|
||||
}
|
||||
|
||||
void *QXcbEglWindow::createVisual()
|
||||
{
|
||||
#ifdef XCB_USE_XLIB
|
||||
const xcb_visualtype_t *QXcbEglWindow::createVisual()
|
||||
{
|
||||
QXcbScreen *scr = xcbScreen();
|
||||
if (!scr)
|
||||
return QXcbWindow::createVisual();
|
||||
|
||||
Display *xdpy = static_cast<Display *>(m_glIntegration->xlib_display());
|
||||
VisualID id = QXlibEglIntegration::getCompatibleVisualId(xdpy, m_glIntegration->eglDisplay(), m_config);
|
||||
|
||||
@ -78,11 +82,12 @@ void *QXcbEglWindow::createVisual()
|
||||
XVisualInfo *visualInfo;
|
||||
int matchingCount = 0;
|
||||
visualInfo = XGetVisualInfo(xdpy, VisualIDMask, &visualInfoTemplate, &matchingCount);
|
||||
return visualInfo;
|
||||
#else
|
||||
return QXcbWindow::createVisual();
|
||||
#endif
|
||||
const xcb_visualtype_t *xcb_visualtype = scr->visualForId(visualInfo->visualid);
|
||||
XFree(visualInfo);
|
||||
|
||||
return xcb_visualtype;
|
||||
}
|
||||
#endif
|
||||
|
||||
void QXcbEglWindow::create()
|
||||
{
|
||||
|
@ -60,8 +60,11 @@ public:
|
||||
|
||||
protected:
|
||||
void create() Q_DECL_OVERRIDE;
|
||||
void resolveFormat() Q_DECL_OVERRIDE;
|
||||
void *createVisual() Q_DECL_OVERRIDE;
|
||||
void resolveFormat(const QSurfaceFormat &format) Q_DECL_OVERRIDE;
|
||||
|
||||
#ifdef XCB_USE_XLIB
|
||||
const xcb_visualtype_t *createVisual() Q_DECL_OVERRIDE;
|
||||
#endif
|
||||
|
||||
private:
|
||||
QXcbEglIntegration *m_glIntegration;
|
||||
|
@ -715,8 +715,8 @@ bool QGLXContext::supportsThreading()
|
||||
|
||||
QGLXPbuffer::QGLXPbuffer(QOffscreenSurface *offscreenSurface)
|
||||
: QPlatformOffscreenSurface(offscreenSurface)
|
||||
, m_format(offscreenSurface->requestedFormat())
|
||||
, m_screen(static_cast<QXcbScreen *>(offscreenSurface->screen()->handle()))
|
||||
, m_format(m_screen->surfaceFormatFor(offscreenSurface->requestedFormat()))
|
||||
, m_pbuffer(0)
|
||||
{
|
||||
GLXFBConfig config = qglx_findConfig(DISPLAY_FROM_XCB(m_screen), m_screen->screenNumber(), m_format);
|
||||
|
@ -106,8 +106,8 @@ public:
|
||||
GLXPbuffer pbuffer() const { return m_pbuffer; }
|
||||
|
||||
private:
|
||||
QSurfaceFormat m_format;
|
||||
QXcbScreen *m_screen;
|
||||
QSurfaceFormat m_format;
|
||||
GLXPbuffer m_pbuffer;
|
||||
};
|
||||
|
||||
|
@ -93,7 +93,7 @@ QXcbGlxIntegration::QXcbGlxIntegration()
|
||||
: m_connection(Q_NULLPTR)
|
||||
, m_glx_first_event(0)
|
||||
{
|
||||
qCDebug(QT_XCB_GLINTEGRATION) << "Xcb GLX gl-integration created";
|
||||
qCDebug(lcQpaGl) << "Xcb GLX gl-integration created";
|
||||
}
|
||||
|
||||
QXcbGlxIntegration::~QXcbGlxIntegration()
|
||||
@ -118,7 +118,7 @@ bool QXcbGlxIntegration::initialize(QXcbConnection *connection)
|
||||
xcb_glx_query_version_reply_t *xglx_query = xcb_glx_query_version_reply(m_connection->xcb_connection(),
|
||||
xglx_query_cookie, &error);
|
||||
if (!xglx_query || error) {
|
||||
qCWarning(QT_XCB_GLINTEGRATION) << "QXcbConnection: Failed to initialize GLX";
|
||||
qCWarning(lcQpaGl) << "QXcbConnection: Failed to initialize GLX";
|
||||
free(error);
|
||||
return false;
|
||||
}
|
||||
@ -127,7 +127,7 @@ bool QXcbGlxIntegration::initialize(QXcbConnection *connection)
|
||||
|
||||
m_native_interface_handler.reset(new QXcbGlxNativeInterfaceHandler(connection->nativeInterface()));
|
||||
|
||||
qCDebug(QT_XCB_GLINTEGRATION) << "Xcb GLX gl-integration successfully initialized";
|
||||
qCDebug(lcQpaGl) << "Xcb GLX gl-integration successfully initialized";
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -189,7 +189,7 @@ QXcbWindow *QXcbGlxIntegration::createWindow(QWindow *window) const
|
||||
QPlatformOpenGLContext *QXcbGlxIntegration::createPlatformOpenGLContext(QOpenGLContext *context) const
|
||||
{
|
||||
QXcbScreen *screen = static_cast<QXcbScreen *>(context->screen()->handle());
|
||||
QGLXContext *platformContext = new QGLXContext(screen, context->format(),
|
||||
QGLXContext *platformContext = new QGLXContext(screen, screen->surfaceFormatFor(context->format()),
|
||||
context->shareHandle(), context->nativeHandle());
|
||||
context->setNativeHandle(platformContext->nativeHandle());
|
||||
return platformContext;
|
||||
|
@ -53,17 +53,15 @@ QXcbGlxWindow::~QXcbGlxWindow()
|
||||
{
|
||||
}
|
||||
|
||||
void QXcbGlxWindow::resolveFormat()
|
||||
{
|
||||
m_format = window()->requestedFormat(); //qglx_findVisualInfo sets the resovled format
|
||||
}
|
||||
|
||||
void *QXcbGlxWindow::createVisual()
|
||||
const xcb_visualtype_t *QXcbGlxWindow::createVisual()
|
||||
{
|
||||
QXcbScreen *scr = xcbScreen();
|
||||
if (!scr)
|
||||
return Q_NULLPTR;
|
||||
return qglx_findVisualInfo(DISPLAY_FROM_XCB(scr), scr->screenNumber(), &m_format);
|
||||
XVisualInfo *visualInfo = qglx_findVisualInfo(DISPLAY_FROM_XCB(scr), scr->screenNumber(), &m_format);
|
||||
const xcb_visualtype_t *xcb_visualtype = scr->visualForId(visualInfo->visualid);
|
||||
XFree(visualInfo);
|
||||
return xcb_visualtype;
|
||||
}
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
@ -52,8 +52,7 @@ public:
|
||||
~QXcbGlxWindow();
|
||||
|
||||
protected:
|
||||
void resolveFormat() Q_DECL_OVERRIDE;
|
||||
void *createVisual() Q_DECL_OVERRIDE;
|
||||
const xcb_visualtype_t *createVisual() Q_DECL_OVERRIDE;
|
||||
};
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
@ -58,6 +58,7 @@
|
||||
#include <QtGui/private/qhighdpiscaling_p.h>
|
||||
#include <qpa/qplatformgraphicsbuffer.h>
|
||||
#include <private/qimage_p.h>
|
||||
#include <qendian.h>
|
||||
|
||||
#include <algorithm>
|
||||
QT_BEGIN_NAMESPACE
|
||||
@ -107,6 +108,7 @@ private:
|
||||
// do a server-side copy on expose instead of sending the pixels every time
|
||||
xcb_pixmap_t m_xcb_pixmap;
|
||||
QRegion m_pendingFlush;
|
||||
QByteArray m_flushBuffer;
|
||||
|
||||
bool m_hasAlpha;
|
||||
};
|
||||
@ -287,11 +289,84 @@ void QXcbShmImage::ensureGC(xcb_drawable_t dst)
|
||||
}
|
||||
}
|
||||
|
||||
static inline void copy_unswapped(char *dst, int dstBytesPerLine, const QImage &img, const QRect &rect)
|
||||
{
|
||||
const uchar *srcData = img.constBits();
|
||||
const int srcBytesPerLine = img.bytesPerLine();
|
||||
|
||||
const int leftOffset = rect.left() * img.depth() >> 3;
|
||||
const int bottom = rect.bottom() + 1;
|
||||
|
||||
for (int yy = rect.top(); yy < bottom; ++yy) {
|
||||
const uchar *src = srcData + yy * srcBytesPerLine + leftOffset;
|
||||
::memmove(dst, src, dstBytesPerLine);
|
||||
dst += dstBytesPerLine;
|
||||
}
|
||||
}
|
||||
|
||||
template <class Pixel>
|
||||
static inline void copy_swapped(Pixel *dst, const QImage &img, const QRect &rect)
|
||||
{
|
||||
const uchar *srcData = img.constBits();
|
||||
const int srcBytesPerLine = img.bytesPerLine();
|
||||
|
||||
const int left = rect.left();
|
||||
const int right = rect.right() + 1;
|
||||
const int bottom = rect.bottom() + 1;
|
||||
|
||||
for (int yy = rect.top(); yy < bottom; ++yy) {
|
||||
const Pixel *src = reinterpret_cast<const Pixel *>(srcData + yy * srcBytesPerLine) + left;
|
||||
|
||||
for (int xx = left; xx < right; ++xx)
|
||||
*dst++ = qbswap<Pixel>(*src++);
|
||||
}
|
||||
}
|
||||
|
||||
static QImage native_sub_image(QByteArray *buffer, const QImage &src, int x, int y, int w, int h, bool swap)
|
||||
{
|
||||
const QRect rect(x, y, w, h);
|
||||
|
||||
if (!swap && src.rect() == rect)
|
||||
return src;
|
||||
|
||||
const int dstStride = w * src.depth() >> 3;
|
||||
buffer->resize(h * dstStride);
|
||||
|
||||
if (swap) {
|
||||
switch (src.depth()) {
|
||||
case 32:
|
||||
copy_swapped(reinterpret_cast<quint32 *>(buffer->data()), src, rect);
|
||||
break;
|
||||
case 16:
|
||||
copy_swapped(reinterpret_cast<quint16 *>(buffer->data()), src, rect);
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
copy_unswapped(buffer->data(), dstStride, src, rect);
|
||||
}
|
||||
|
||||
return QImage(reinterpret_cast<const uchar *>(buffer->constData()), w, h, dstStride, src.format());
|
||||
}
|
||||
|
||||
void QXcbShmImage::flushPixmap(const QRegion ®ion)
|
||||
{
|
||||
const QVector<QRect> rects = m_pendingFlush.intersected(region).rects();
|
||||
m_pendingFlush -= region;
|
||||
|
||||
xcb_image_t xcb_subimage;
|
||||
memset(&xcb_subimage, 0, sizeof(xcb_image_t));
|
||||
|
||||
xcb_subimage.format = m_xcb_image->format;
|
||||
xcb_subimage.scanline_pad = m_xcb_image->scanline_pad;
|
||||
xcb_subimage.depth = m_xcb_image->depth;
|
||||
xcb_subimage.bpp = m_xcb_image->bpp;
|
||||
xcb_subimage.unit = m_xcb_image->unit;
|
||||
xcb_subimage.plane_mask = m_xcb_image->plane_mask;
|
||||
xcb_subimage.byte_order = (xcb_image_order_t) connection()->setup()->image_byte_order;
|
||||
xcb_subimage.bit_order = m_xcb_image->bit_order;
|
||||
|
||||
const bool needsByteSwap = xcb_subimage.byte_order != m_xcb_image->byte_order;
|
||||
|
||||
for (const QRect &rect : rects) {
|
||||
// We must make sure that each request is not larger than max_req_size.
|
||||
// Each request takes req_size + m_xcb_image->stride * height bytes.
|
||||
@ -308,37 +383,29 @@ void QXcbShmImage::flushPixmap(const QRegion ®ion)
|
||||
// larger than the server's maximum request size and stuff breaks.
|
||||
// To work around that, we upload the image in chunks where each chunk
|
||||
// is small enough for a single request.
|
||||
int src_x = rect.x();
|
||||
int src_y = rect.y();
|
||||
int target_x = rect.x();
|
||||
int target_y = rect.y();
|
||||
int width = rect.width();
|
||||
const int x = rect.x();
|
||||
int y = rect.y();
|
||||
const int width = rect.width();
|
||||
int height = rect.height();
|
||||
|
||||
while (height > 0) {
|
||||
int rows = std::min(height, rows_per_put);
|
||||
const int rows = std::min(height, rows_per_put);
|
||||
const QImage subImage = native_sub_image(&m_flushBuffer, m_qimage, x, y, width, rows, needsByteSwap);
|
||||
|
||||
xcb_image_t *subimage = xcb_image_subimage(m_xcb_image, src_x, src_y, width, rows,
|
||||
0, 0, 0);
|
||||
|
||||
// Convert the image to the native byte order.
|
||||
xcb_image_t *native_subimage = xcb_image_native(xcb_connection(), subimage, 1);
|
||||
xcb_subimage.width = width;
|
||||
xcb_subimage.height = rows;
|
||||
xcb_subimage.data = const_cast<uint8_t *>(subImage.constBits());
|
||||
xcb_image_annotate(&xcb_subimage);
|
||||
|
||||
xcb_image_put(xcb_connection(),
|
||||
m_xcb_pixmap,
|
||||
m_gc,
|
||||
native_subimage,
|
||||
target_x,
|
||||
target_y,
|
||||
&xcb_subimage,
|
||||
x,
|
||||
y,
|
||||
0);
|
||||
|
||||
if (native_subimage != subimage)
|
||||
xcb_image_destroy(native_subimage);
|
||||
|
||||
xcb_image_destroy(subimage);
|
||||
|
||||
src_y += rows;
|
||||
target_y += rows;
|
||||
y += rows;
|
||||
height -= rows;
|
||||
}
|
||||
}
|
||||
|
@ -644,7 +644,7 @@ QXcbConnection::QXcbConnection(QXcbNativeInterface *nativeInterface, bool canGra
|
||||
glIntegrationNames << QStringLiteral("xcb_glx") << QStringLiteral("xcb_egl");
|
||||
QString glIntegrationName = QString::fromLocal8Bit(qgetenv("QT_XCB_GL_INTEGRATION"));
|
||||
if (!glIntegrationName.isEmpty()) {
|
||||
qCDebug(QT_XCB_GLINTEGRATION) << "QT_XCB_GL_INTEGRATION is set to" << glIntegrationName;
|
||||
qCDebug(lcQpaGl) << "QT_XCB_GL_INTEGRATION is set to" << glIntegrationName;
|
||||
if (glIntegrationName != QLatin1String("none")) {
|
||||
glIntegrationNames.removeAll(glIntegrationName);
|
||||
glIntegrationNames.prepend(glIntegrationName);
|
||||
@ -653,17 +653,19 @@ QXcbConnection::QXcbConnection(QXcbNativeInterface *nativeInterface, bool canGra
|
||||
}
|
||||
}
|
||||
|
||||
qCDebug(QT_XCB_GLINTEGRATION) << "Choosing xcb gl-integration based on following priority\n" << glIntegrationNames;
|
||||
for (int i = 0; i < glIntegrationNames.size() && !m_glIntegration; i++) {
|
||||
m_glIntegration = QXcbGlIntegrationFactory::create(glIntegrationNames.at(i));
|
||||
if (m_glIntegration && !m_glIntegration->initialize(this)) {
|
||||
qCDebug(QT_XCB_GLINTEGRATION) << "Failed to initialize xcb gl-integration" << glIntegrationNames.at(i);
|
||||
delete m_glIntegration;
|
||||
m_glIntegration = Q_NULLPTR;
|
||||
if (!glIntegrationNames.isEmpty()) {
|
||||
qCDebug(lcQpaGl) << "Choosing xcb gl-integration based on following priority\n" << glIntegrationNames;
|
||||
for (int i = 0; i < glIntegrationNames.size() && !m_glIntegration; i++) {
|
||||
m_glIntegration = QXcbGlIntegrationFactory::create(glIntegrationNames.at(i));
|
||||
if (m_glIntegration && !m_glIntegration->initialize(this)) {
|
||||
qCDebug(lcQpaGl) << "Failed to initialize xcb gl-integration" << glIntegrationNames.at(i);
|
||||
delete m_glIntegration;
|
||||
m_glIntegration = Q_NULLPTR;
|
||||
}
|
||||
}
|
||||
if (!m_glIntegration)
|
||||
qCDebug(lcQpaGl) << "Failed to create xcb gl-integration";
|
||||
}
|
||||
if (!m_glIntegration)
|
||||
qCDebug(QT_XCB_GLINTEGRATION) << "Failed to create xcb gl-integration";
|
||||
|
||||
sync();
|
||||
}
|
||||
|
@ -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);
|
||||
|
@ -47,6 +47,7 @@
|
||||
#include <stdio.h>
|
||||
|
||||
#include <QDebug>
|
||||
#include <QtAlgorithms>
|
||||
|
||||
#include <qpa/qwindowsysteminterface.h>
|
||||
#include <private/qmath_p.h>
|
||||
@ -359,6 +360,69 @@ void QXcbScreen::windowShown(QXcbWindow *window)
|
||||
}
|
||||
}
|
||||
|
||||
QSurfaceFormat QXcbScreen::surfaceFormatFor(const QSurfaceFormat &format) const
|
||||
{
|
||||
const xcb_visualid_t xcb_visualid = connection()->hasDefaultVisualId() ? connection()->defaultVisualId()
|
||||
: screen()->root_visual;
|
||||
const xcb_visualtype_t *xcb_visualtype = visualForId(xcb_visualid);
|
||||
|
||||
const int redSize = qPopulationCount(xcb_visualtype->red_mask);
|
||||
const int greenSize = qPopulationCount(xcb_visualtype->green_mask);
|
||||
const int blueSize = qPopulationCount(xcb_visualtype->blue_mask);
|
||||
|
||||
QSurfaceFormat result = format;
|
||||
|
||||
if (result.redBufferSize() < 0)
|
||||
result.setRedBufferSize(redSize);
|
||||
|
||||
if (result.greenBufferSize() < 0)
|
||||
result.setGreenBufferSize(greenSize);
|
||||
|
||||
if (result.blueBufferSize() < 0)
|
||||
result.setBlueBufferSize(blueSize);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
const xcb_visualtype_t *QXcbScreen::visualForFormat(const QSurfaceFormat &format) const
|
||||
{
|
||||
QVector<const xcb_visualtype_t *> candidates;
|
||||
|
||||
for (auto ii = m_visuals.constBegin(); ii != m_visuals.constEnd(); ++ii) {
|
||||
const xcb_visualtype_t &xcb_visualtype = ii.value();
|
||||
|
||||
const int redSize = qPopulationCount(xcb_visualtype.red_mask);
|
||||
const int greenSize = qPopulationCount(xcb_visualtype.green_mask);
|
||||
const int blueSize = qPopulationCount(xcb_visualtype.blue_mask);
|
||||
const int alphaSize = depthOfVisual(xcb_visualtype.visual_id) - redSize - greenSize - blueSize;
|
||||
|
||||
if (format.redBufferSize() != -1 && redSize != format.redBufferSize())
|
||||
continue;
|
||||
|
||||
if (format.greenBufferSize() != -1 && greenSize != format.greenBufferSize())
|
||||
continue;
|
||||
|
||||
if (format.blueBufferSize() != -1 && blueSize != format.blueBufferSize())
|
||||
continue;
|
||||
|
||||
if (format.alphaBufferSize() != -1 && alphaSize != format.alphaBufferSize())
|
||||
continue;
|
||||
|
||||
candidates.append(&xcb_visualtype);
|
||||
}
|
||||
|
||||
if (candidates.isEmpty())
|
||||
return nullptr;
|
||||
|
||||
// Try to find a RGB visual rather than e.g. BGR or GBR
|
||||
for (const xcb_visualtype_t *candidate : qAsConst(candidates))
|
||||
if (qCountTrailingZeroBits(candidate->blue_mask) == 0)
|
||||
return candidate;
|
||||
|
||||
// Did not find anything we like, just grab the first one and hope for the best
|
||||
return candidates.first();
|
||||
}
|
||||
|
||||
void QXcbScreen::sendStartupMessage(const QByteArray &message) const
|
||||
{
|
||||
xcb_window_t rootWindow = root();
|
||||
@ -403,7 +467,7 @@ quint8 QXcbScreen::depthOfVisual(xcb_visualid_t visualid) const
|
||||
|
||||
QImage::Format QXcbScreen::format() const
|
||||
{
|
||||
return QImage::Format_RGB32;
|
||||
return qt_xcb_imageFormatForVisual(connection(), screen()->root_depth, visualForId(screen()->root_visual));
|
||||
}
|
||||
|
||||
QDpi QXcbScreen::virtualDpi() const
|
||||
|
@ -155,6 +155,9 @@ public:
|
||||
QString windowManagerName() const { return m_windowManagerName; }
|
||||
bool syncRequestSupported() const { return m_syncRequestSupported; }
|
||||
|
||||
QSurfaceFormat surfaceFormatFor(const QSurfaceFormat &format) const;
|
||||
|
||||
const xcb_visualtype_t *visualForFormat(const QSurfaceFormat &format) const;
|
||||
const xcb_visualtype_t *visualForId(xcb_visualid_t) const;
|
||||
quint8 depthOfVisual(xcb_visualid_t) const;
|
||||
|
||||
|
@ -382,18 +382,6 @@ void QXcbWindow::create()
|
||||
return;
|
||||
}
|
||||
|
||||
const quint32 mask = XCB_CW_BACK_PIXMAP | XCB_CW_OVERRIDE_REDIRECT | XCB_CW_SAVE_UNDER | XCB_CW_EVENT_MASK;
|
||||
const quint32 values[] = {
|
||||
// XCB_CW_BACK_PIXMAP
|
||||
XCB_NONE,
|
||||
// XCB_CW_OVERRIDE_REDIRECT
|
||||
type == Qt::Popup || type == Qt::ToolTip || (window()->flags() & Qt::BypassWindowManagerHint),
|
||||
// XCB_CW_SAVE_UNDER
|
||||
type == Qt::Popup || type == Qt::Tool || type == Qt::SplashScreen || type == Qt::ToolTip || type == Qt::Drawer,
|
||||
// XCB_CW_EVENT_MASK
|
||||
defaultEventMask
|
||||
};
|
||||
|
||||
// Parameters to XCreateWindow() are frame corner + inner size.
|
||||
// This fits in case position policy is frame inclusive. There is
|
||||
// currently no way to implement it for frame-exclusive geometries.
|
||||
@ -424,108 +412,76 @@ void QXcbWindow::create()
|
||||
}
|
||||
}
|
||||
|
||||
resolveFormat();
|
||||
resolveFormat(platformScreen->surfaceFormatFor(window()->requestedFormat()));
|
||||
|
||||
#ifdef XCB_USE_XLIB
|
||||
if (window()->surfaceType() != QSurface::RasterSurface
|
||||
&& QGuiApplicationPrivate::platformIntegration()->hasCapability(QPlatformIntegration::OpenGL)) {
|
||||
XVisualInfo *visualInfo = Q_NULLPTR;
|
||||
if (connection()->hasDefaultVisualId())
|
||||
visualInfo = CREATE_VISUALINFO_FROM_DEFAULT_VISUALID(this);
|
||||
if (!visualInfo)
|
||||
visualInfo = static_cast<XVisualInfo *>(createVisual());
|
||||
const xcb_visualtype_t *visual = Q_NULLPTR;
|
||||
|
||||
if (Q_UNLIKELY(!visualInfo && window()->surfaceType() == QSurface::OpenGLSurface))
|
||||
qFatal("Could not initialize OpenGL");
|
||||
|
||||
if (!visualInfo && window()->surfaceType() == QSurface::RasterGLSurface) {
|
||||
qWarning("Could not initialize OpenGL for RasterGLSurface, reverting to RasterSurface.");
|
||||
window()->setSurfaceType(QSurface::RasterSurface);
|
||||
}
|
||||
|
||||
if (visualInfo) {
|
||||
m_depth = visualInfo->depth;
|
||||
m_imageFormat = imageFormatForVisual(visualInfo->depth, visualInfo->red_mask, visualInfo->blue_mask, &m_imageRgbSwap);
|
||||
Colormap cmap = XCreateColormap(DISPLAY_FROM_XCB(this), xcb_parent_id, visualInfo->visual, AllocNone);
|
||||
|
||||
XSetWindowAttributes a;
|
||||
a.background_pixel = WhitePixel(DISPLAY_FROM_XCB(this), platformScreen->screenNumber());
|
||||
a.border_pixel = BlackPixel(DISPLAY_FROM_XCB(this), platformScreen->screenNumber());
|
||||
a.colormap = cmap;
|
||||
|
||||
m_visualId = visualInfo->visualid;
|
||||
|
||||
m_window = XCreateWindow(DISPLAY_FROM_XCB(this), xcb_parent_id, rect.x(), rect.y(), rect.width(), rect.height(),
|
||||
0, visualInfo->depth, InputOutput, visualInfo->visual,
|
||||
CWBackPixel|CWBorderPixel|CWColormap, &a);
|
||||
|
||||
XFree(visualInfo);
|
||||
}
|
||||
if (connection()->hasDefaultVisualId()) {
|
||||
visual = platformScreen->visualForId(connection()->defaultVisualId());
|
||||
if (!visual)
|
||||
qWarning() << "Failed to use requested visual id.";
|
||||
}
|
||||
#endif
|
||||
|
||||
if (!m_window)
|
||||
{
|
||||
m_window = xcb_generate_id(xcb_connection());
|
||||
m_visualId = UINT_MAX;
|
||||
const xcb_visualtype_t *visual = Q_NULLPTR;
|
||||
m_depth = platformScreen->screen()->root_depth;
|
||||
if (!visual)
|
||||
visual = createVisual();
|
||||
|
||||
uint32_t mask = 0;
|
||||
uint32_t values[3];
|
||||
|
||||
if (connection()->hasDefaultVisualId()) {
|
||||
m_visualId = connection()->defaultVisualId();
|
||||
visual = platformScreen->visualForId(m_visualId);
|
||||
}
|
||||
|
||||
if (!visual) {
|
||||
if (connection()->hasDefaultVisualId())
|
||||
qWarning("Failed to use default visual id. Falling back to using screens root_visual");
|
||||
|
||||
m_visualId = platformScreen->screen()->root_visual;
|
||||
|
||||
if (m_format.alphaBufferSize() == 8) {
|
||||
xcb_depth_iterator_t depthIter = xcb_screen_allowed_depths_iterator(platformScreen->screen());
|
||||
while (depthIter.rem) {
|
||||
if (depthIter.data->depth == 32) {
|
||||
xcb_visualtype_iterator_t visualIter = xcb_depth_visuals_iterator(depthIter.data);
|
||||
if (visualIter.rem) {
|
||||
m_visualId = visualIter.data->visual_id;
|
||||
m_depth = 32;
|
||||
uint32_t colormap = xcb_generate_id(xcb_connection());
|
||||
xcb_create_colormap(xcb_connection(), XCB_COLORMAP_ALLOC_NONE, colormap,
|
||||
xcb_parent_id, m_visualId);
|
||||
mask |= XCB_CW_BACK_PIXEL | XCB_CW_BORDER_PIXEL | XCB_CW_COLORMAP;
|
||||
values[0] = platformScreen->screen()->white_pixel;
|
||||
values[1] = platformScreen->screen()->black_pixel;
|
||||
values[2] = colormap;
|
||||
break;
|
||||
}
|
||||
}
|
||||
xcb_depth_next(&depthIter);
|
||||
}
|
||||
}
|
||||
|
||||
visual = platformScreen->visualForId(m_visualId);
|
||||
}
|
||||
|
||||
m_imageFormat = imageFormatForVisual(m_depth, visual->red_mask, visual->blue_mask, &m_imageRgbSwap);
|
||||
Q_XCB_CALL(xcb_create_window(xcb_connection(),
|
||||
m_depth,
|
||||
m_window, // window id
|
||||
xcb_parent_id, // parent window id
|
||||
rect.x(),
|
||||
rect.y(),
|
||||
rect.width(),
|
||||
rect.height(),
|
||||
0, // border width
|
||||
XCB_WINDOW_CLASS_INPUT_OUTPUT, // window class
|
||||
m_visualId, // visual
|
||||
mask,
|
||||
values));
|
||||
if (!visual) {
|
||||
qWarning() << "Falling back to using screens root_visual.";
|
||||
visual = platformScreen->visualForId(platformScreen->screen()->root_visual);
|
||||
}
|
||||
|
||||
Q_ASSERT(visual);
|
||||
|
||||
m_visualId = visual->visual_id;
|
||||
m_depth = platformScreen->depthOfVisual(m_visualId);
|
||||
m_imageFormat = imageFormatForVisual(m_depth, visual->red_mask, visual->blue_mask, &m_imageRgbSwap);
|
||||
xcb_colormap_t colormap = 0;
|
||||
|
||||
quint32 mask = XCB_CW_BACK_PIXMAP
|
||||
| XCB_CW_BORDER_PIXEL
|
||||
| XCB_CW_BIT_GRAVITY
|
||||
| XCB_CW_OVERRIDE_REDIRECT
|
||||
| XCB_CW_SAVE_UNDER
|
||||
| XCB_CW_EVENT_MASK;
|
||||
|
||||
static const bool haveOpenGL = QGuiApplicationPrivate::platformIntegration()->hasCapability(QPlatformIntegration::OpenGL);
|
||||
|
||||
if ((window()->supportsOpenGL() && haveOpenGL) || m_format.hasAlpha()) {
|
||||
colormap = xcb_generate_id(xcb_connection());
|
||||
Q_XCB_CALL(xcb_create_colormap(xcb_connection(),
|
||||
XCB_COLORMAP_ALLOC_NONE,
|
||||
colormap,
|
||||
xcb_parent_id,
|
||||
m_visualId));
|
||||
|
||||
mask |= XCB_CW_COLORMAP;
|
||||
}
|
||||
|
||||
quint32 values[] = {
|
||||
XCB_BACK_PIXMAP_NONE,
|
||||
platformScreen->screen()->black_pixel,
|
||||
XCB_GRAVITY_NORTH_WEST,
|
||||
type == Qt::Popup || type == Qt::ToolTip || (window()->flags() & Qt::BypassWindowManagerHint),
|
||||
type == Qt::Popup || type == Qt::Tool || type == Qt::SplashScreen || type == Qt::ToolTip || type == Qt::Drawer,
|
||||
defaultEventMask,
|
||||
colormap
|
||||
};
|
||||
|
||||
m_window = xcb_generate_id(xcb_connection());
|
||||
Q_XCB_CALL(xcb_create_window(xcb_connection(),
|
||||
m_depth,
|
||||
m_window, // window id
|
||||
xcb_parent_id, // parent window id
|
||||
rect.x(),
|
||||
rect.y(),
|
||||
rect.width(),
|
||||
rect.height(),
|
||||
0, // border width
|
||||
XCB_WINDOW_CLASS_INPUT_OUTPUT, // window class
|
||||
m_visualId, // visual
|
||||
mask,
|
||||
values));
|
||||
|
||||
connection()->addWindowEventListener(m_window, this);
|
||||
|
||||
Q_XCB_CALL(xcb_change_window_attributes(xcb_connection(), m_window, mask, values));
|
||||
@ -2560,6 +2516,12 @@ void QXcbWindow::updateSyncRequestCounter()
|
||||
}
|
||||
}
|
||||
|
||||
const xcb_visualtype_t *QXcbWindow::createVisual()
|
||||
{
|
||||
return xcbScreen() ? xcbScreen()->visualForFormat(m_format)
|
||||
: nullptr;
|
||||
}
|
||||
|
||||
bool QXcbWindow::setKeyboardGrabEnabled(bool grab)
|
||||
{
|
||||
if (grab && !connection()->canGrab())
|
||||
@ -2830,3 +2792,4 @@ QXcbScreen *QXcbWindow::xcbScreen() const
|
||||
}
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
||||
|
@ -182,8 +182,8 @@ public Q_SLOTS:
|
||||
void updateSyncRequestCounter();
|
||||
|
||||
protected:
|
||||
virtual void resolveFormat() { m_format = window()->requestedFormat(); }
|
||||
virtual void *createVisual() { return Q_NULLPTR; }
|
||||
virtual void resolveFormat(const QSurfaceFormat &format) { m_format = format; }
|
||||
virtual const xcb_visualtype_t *createVisual();
|
||||
|
||||
QXcbScreen *parentScreen();
|
||||
|
||||
|
@ -1,4 +1,3 @@
|
||||
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2016 The Qt Company Ltd.
|
||||
|
@ -1,4 +1,3 @@
|
||||
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2016 The Qt Company Ltd.
|
||||
|
@ -3815,11 +3815,11 @@ QString QFileDialogPrivate::getEnvironmentVariable(const QString &string)
|
||||
{
|
||||
#ifdef Q_OS_UNIX
|
||||
if (string.size() > 1 && string.startsWith(QLatin1Char('$'))) {
|
||||
return QString::fromLocal8Bit(qgetenv(string.mid(1).toLatin1().constData()));
|
||||
return QString::fromLocal8Bit(qgetenv(string.midRef(1).toLatin1().constData()));
|
||||
}
|
||||
#else
|
||||
if (string.size() > 2 && string.startsWith(QLatin1Char('%')) && string.endsWith(QLatin1Char('%'))) {
|
||||
return QString::fromLocal8Bit(qgetenv(string.mid(1, string.size() - 2).toLatin1().constData()));
|
||||
return QString::fromLocal8Bit(qgetenv(string.midRef(1, string.size() - 2).toLatin1().constData()));
|
||||
}
|
||||
#endif
|
||||
return string;
|
||||
|
@ -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),
|
||||
|
@ -68,6 +68,8 @@
|
||||
# include <qscroller.h>
|
||||
#endif
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
QAbstractItemViewPrivate::QAbstractItemViewPrivate()
|
||||
@ -4459,10 +4461,12 @@ QModelIndexList QAbstractItemViewPrivate::selectedDraggableIndexes() const
|
||||
{
|
||||
Q_Q(const QAbstractItemView);
|
||||
QModelIndexList indexes = q->selectedIndexes();
|
||||
for(int i = indexes.count() - 1 ; i >= 0; --i) {
|
||||
if (!isIndexDragEnabled(indexes.at(i)))
|
||||
indexes.removeAt(i);
|
||||
}
|
||||
auto isNotDragEnabled = [this](const QModelIndex &index) {
|
||||
return !isIndexDragEnabled(index);
|
||||
};
|
||||
indexes.erase(std::remove_if(indexes.begin(), indexes.end(),
|
||||
isNotDragEnabled),
|
||||
indexes.end());
|
||||
return indexes;
|
||||
}
|
||||
|
||||
|
@ -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();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -956,6 +956,7 @@ void QWidgetWindow::handleTabletEvent(QTabletEvent *event)
|
||||
event->rotation(), event->z(), event->modifiers(), event->uniqueId(), event->button(), event->buttons());
|
||||
ev.setTimestamp(event->timestamp());
|
||||
QGuiApplication::sendSpontaneousEvent(qt_tablet_target, &ev);
|
||||
event->setAccepted(ev.isAccepted());
|
||||
}
|
||||
|
||||
if (event->type() == QEvent::TabletRelease && event->buttons() == Qt::NoButton)
|
||||
|
@ -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);
|
||||
|
@ -1649,7 +1649,7 @@ void QFusionStyle::drawControl(ControlElement element, const QStyleOption *optio
|
||||
|
||||
QRect textRect(xpos, y + windowsItemVMargin, w - xm - windowsRightBorder - tab + 1, h - 2 * windowsItemVMargin);
|
||||
QRect vTextRect = visualRect(opt->direction, menuitem->rect, textRect);
|
||||
QString s = menuitem->text;
|
||||
QStringRef s(&menuitem->text);
|
||||
if (!s.isEmpty()) { // draw text
|
||||
p->save();
|
||||
int t = s.indexOf(QLatin1Char('\t'));
|
||||
@ -1660,12 +1660,13 @@ void QFusionStyle::drawControl(ControlElement element, const QStyleOption *optio
|
||||
if (t >= 0) {
|
||||
QRect vShortcutRect = visualRect(opt->direction, menuitem->rect,
|
||||
QRect(textRect.topRight(), QPoint(menuitem->rect.right(), textRect.bottom())));
|
||||
const QString textToDraw = s.mid(t + 1).toString();
|
||||
if (dis && !act && proxy()->styleHint(SH_EtchDisabledText, option, widget)) {
|
||||
p->setPen(menuitem->palette.light().color());
|
||||
p->drawText(vShortcutRect.adjusted(1, 1, 1, 1), text_flags, s.mid(t + 1));
|
||||
p->drawText(vShortcutRect.adjusted(1, 1, 1, 1), text_flags, textToDraw);
|
||||
p->setPen(discol);
|
||||
}
|
||||
p->drawText(vShortcutRect, text_flags, s.mid(t + 1));
|
||||
p->drawText(vShortcutRect, text_flags, textToDraw);
|
||||
s = s.left(t);
|
||||
}
|
||||
QFont font = menuitem->font;
|
||||
@ -1680,12 +1681,13 @@ void QFusionStyle::drawControl(ControlElement element, const QStyleOption *optio
|
||||
font.setBold(true);
|
||||
|
||||
p->setFont(font);
|
||||
const QString textToDraw = s.left(t).toString();
|
||||
if (dis && !act && proxy()->styleHint(SH_EtchDisabledText, option, widget)) {
|
||||
p->setPen(menuitem->palette.light().color());
|
||||
p->drawText(vTextRect.adjusted(1, 1, 1, 1), text_flags, s.left(t));
|
||||
p->drawText(vTextRect.adjusted(1, 1, 1, 1), text_flags, textToDraw);
|
||||
p->setPen(discol);
|
||||
}
|
||||
p->drawText(vTextRect, text_flags, s.left(t));
|
||||
p->drawText(vTextRect, text_flags, textToDraw);
|
||||
p->restore();
|
||||
}
|
||||
|
||||
|
@ -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();
|
||||
|
@ -3679,7 +3679,7 @@ void QStyleSheetStyle::drawControl(ControlElement ce, const QStyleOption *opt, Q
|
||||
|
||||
QRect textRect = subRule.contentsRect(opt->rect);
|
||||
textRect.setWidth(textRect.width() - mi.tabWidth);
|
||||
QString s = mi.text;
|
||||
QStringRef s(&mi.text);
|
||||
p->setPen(mi.palette.buttonText().color());
|
||||
if (!s.isEmpty()) {
|
||||
int text_flags = Qt::AlignLeft | Qt::AlignVCenter | Qt::TextShowMnemonic | Qt::TextDontClip | Qt::TextSingleLine;
|
||||
@ -3689,10 +3689,10 @@ void QStyleSheetStyle::drawControl(ControlElement ce, const QStyleOption *opt, Q
|
||||
if (t >= 0) {
|
||||
QRect vShortcutRect = visualRect(opt->direction, mi.rect,
|
||||
QRect(textRect.topRight(), QPoint(mi.rect.right(), textRect.bottom())));
|
||||
p->drawText(vShortcutRect, text_flags, s.mid(t + 1));
|
||||
p->drawText(vShortcutRect, text_flags, s.mid(t + 1).toString());
|
||||
s = s.left(t);
|
||||
}
|
||||
p->drawText(textRect, text_flags, s.left(t));
|
||||
p->drawText(textRect, text_flags, s.left(t).toString());
|
||||
}
|
||||
|
||||
if (mi.menuItemType == QStyleOptionMenuItem::SubMenu) {// draw sub menu arrow
|
||||
|
@ -71,6 +71,8 @@
|
||||
#include <private/qstylehelper_p.h>
|
||||
#include <private/qstyleanimation_p.h>
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
#if defined(Q_OS_WIN)
|
||||
@ -117,8 +119,6 @@ enum QSliderDirection { SlUp, SlDown, SlLeft, SlRight };
|
||||
\internal
|
||||
*/
|
||||
|
||||
int QWindowsStylePrivate::m_appDevicePixelRatio = 0;
|
||||
|
||||
QWindowsStylePrivate::QWindowsStylePrivate()
|
||||
: alt_down(false), menuBarTimer(0)
|
||||
{
|
||||
@ -131,11 +131,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
|
||||
@ -163,12 +161,11 @@ bool QWindowsStyle::eventFilter(QObject *o, QEvent *e)
|
||||
|
||||
// Alt has been pressed - find all widgets that care
|
||||
QList<QWidget *> l = widget->findChildren<QWidget *>();
|
||||
for (int pos=0 ; pos < l.size() ; ++pos) {
|
||||
QWidget *w = l.at(pos);
|
||||
if (w->isWindow() || !w->isVisible() ||
|
||||
w->style()->styleHint(SH_UnderlineShortcut, 0, w))
|
||||
l.removeAt(pos);
|
||||
}
|
||||
auto ignorable = [](QWidget *w) {
|
||||
return w->isWindow() || !w->isVisible()
|
||||
|| w->style()->styleHint(SH_UnderlineShortcut, 0, w);
|
||||
};
|
||||
l.erase(std::remove_if(l.begin(), l.end(), ignorable), l.end());
|
||||
// Update states before repainting
|
||||
d->seenAlt.append(widget);
|
||||
d->alt_down = true;
|
||||
@ -397,7 +394,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)
|
||||
@ -1183,7 +1180,7 @@ void QWindowsStyle::drawControl(ControlElement ce, const QStyleOption *opt, QPai
|
||||
QRect textRect(xpos, y + QWindowsStylePrivate::windowsItemVMargin,
|
||||
w - xm - QWindowsStylePrivate::windowsRightBorder - tab + 1, h - 2 * QWindowsStylePrivate::windowsItemVMargin);
|
||||
QRect vTextRect = visualRect(opt->direction, menuitem->rect, textRect);
|
||||
QString s = menuitem->text;
|
||||
QStringRef s(&menuitem->text);
|
||||
if (!s.isEmpty()) { // draw text
|
||||
p->save();
|
||||
int t = s.indexOf(QLatin1Char('\t'));
|
||||
@ -1194,24 +1191,26 @@ void QWindowsStyle::drawControl(ControlElement ce, const QStyleOption *opt, QPai
|
||||
if (t >= 0) {
|
||||
QRect vShortcutRect = visualRect(opt->direction, menuitem->rect,
|
||||
QRect(textRect.topRight(), QPoint(menuitem->rect.right(), textRect.bottom())));
|
||||
const QString textToDraw = s.mid(t + 1).toString();
|
||||
if (dis && !act && proxy()->styleHint(SH_EtchDisabledText, opt, widget)) {
|
||||
p->setPen(menuitem->palette.light().color());
|
||||
p->drawText(vShortcutRect.adjusted(1,1,1,1), text_flags, s.mid(t + 1));
|
||||
p->drawText(vShortcutRect.adjusted(1, 1, 1, 1), text_flags, textToDraw);
|
||||
p->setPen(discol);
|
||||
}
|
||||
p->drawText(vShortcutRect, text_flags, s.mid(t + 1));
|
||||
p->drawText(vShortcutRect, text_flags, textToDraw);
|
||||
s = s.left(t);
|
||||
}
|
||||
QFont font = menuitem->font;
|
||||
if (menuitem->menuItemType == QStyleOptionMenuItem::DefaultItem)
|
||||
font.setBold(true);
|
||||
p->setFont(font);
|
||||
const QString textToDraw = s.left(t).toString();
|
||||
if (dis && !act && proxy()->styleHint(SH_EtchDisabledText, opt, widget)) {
|
||||
p->setPen(menuitem->palette.light().color());
|
||||
p->drawText(vTextRect.adjusted(1,1,1,1), text_flags, s.left(t));
|
||||
p->drawText(vTextRect.adjusted(1, 1, 1, 1), text_flags, textToDraw);
|
||||
p->setPen(discol);
|
||||
}
|
||||
p->drawText(vTextRect, text_flags, s.left(t));
|
||||
p->drawText(vTextRect, text_flags, textToDraw);
|
||||
p->restore();
|
||||
}
|
||||
if (menuitem->menuItemType == QStyleOptionMenuItem::SubMenu) {// draw sub menu arrow
|
||||
|
@ -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
|
||||
|
@ -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);
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user