summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorFriedemann Kleint <Friedemann.Kleint@qt.io>2020-01-07 08:34:53 +0100
committerFriedemann Kleint <Friedemann.Kleint@qt.io>2020-01-07 08:34:53 +0100
commit75391511ff75d6999822cda9f699da585f49ad37 (patch)
tree566dbd70ca624e733025a68612a95aaade463bba /src
parentfd9b0b86bb5f78ffa855409c4dd5976505ef83f5 (diff)
parent68c30e372b01561e8809fcfa5426ae896da70b8e (diff)
Merge remote-tracking branch 'origin/5.15' into dev
Diffstat (limited to 'src')
-rw-r--r--src/3rdparty/sqlite/patches/0002-Fix-CVE-2019-19242-in-SQLite.patch31
-rw-r--r--src/3rdparty/sqlite/patches/0003-Fix-CVE-2019-19603-in-SQLite.patch95
-rw-r--r--src/3rdparty/sqlite/patches/0004-Fix-CVE-2019-19646-in-SQLite.patch29
-rw-r--r--src/3rdparty/sqlite/patches/0005-Fix-CVE-2019-19645-in-SQLite.patch83
-rw-r--r--src/3rdparty/sqlite/sqlite3.c54
-rw-r--r--src/corelib/global/qfloat16.cpp8
-rw-r--r--src/corelib/kernel/qobject.cpp2
-rw-r--r--src/corelib/kernel/qvariant.h14
-rw-r--r--src/corelib/text/qlocale.qdoc10
-rw-r--r--src/corelib/text/qregularexpression.cpp48
-rw-r--r--src/corelib/text/qregularexpression.h20
-rw-r--r--src/corelib/tools/qhash.cpp2
-rw-r--r--src/gui/image/qimage.cpp95
-rw-r--r--src/gui/image/qimage.h4
-rw-r--r--src/gui/kernel/qguiactiongroup.cpp5
-rw-r--r--src/gui/painting/qdrawhelper.cpp6
-rw-r--r--src/gui/rhi/qrhi.cpp44
-rw-r--r--src/gui/rhi/qrhi_p.h2
-rw-r--r--src/gui/rhi/qrhid3d11.cpp43
-rw-r--r--src/gui/rhi/qrhid3d11_p.h5
-rw-r--r--src/gui/rhi/qrhid3d11_p_p.h3
-rw-r--r--src/gui/rhi/qrhigles2.cpp41
-rw-r--r--src/gui/rhi/qrhigles2_p.h5
-rw-r--r--src/gui/rhi/qrhigles2_p_p.h4
-rw-r--r--src/gui/rhi/qrhimetal.mm43
-rw-r--r--src/gui/rhi/qrhimetal_p.h5
-rw-r--r--src/gui/rhi/qrhimetal_p_p.h3
-rw-r--r--src/gui/rhi/qrhinull.cpp22
-rw-r--r--src/gui/rhi/qrhinull_p.h4
-rw-r--r--src/gui/rhi/qrhinull_p_p.h3
-rw-r--r--src/gui/rhi/qrhivulkan.cpp62
-rw-r--r--src/gui/rhi/qrhivulkan_p.h6
-rw-r--r--src/gui/rhi/qrhivulkan_p_p.h3
-rw-r--r--src/gui/text/qtextdocument.cpp39
-rw-r--r--src/gui/text/qtextdocument_p.h1
-rw-r--r--src/gui/vulkan/qvulkanwindow.cpp9
-rw-r--r--src/network/kernel/qhostinfo.cpp2
-rw-r--r--src/platformsupport/kmsconvenience/qkmsdevice.cpp2
-rw-r--r--src/platformsupport/vkconvenience/qbasicvulkanplatforminstance.cpp16
-rw-r--r--src/plugins/imageformats/ico/qicohandler.cpp2
-rw-r--r--src/plugins/platforms/cocoa/qcocoabackingstore.mm6
-rw-r--r--src/plugins/platforms/cocoa/qcocoaintegration.mm2
-rw-r--r--src/plugins/platforms/cocoa/qiosurfacegraphicsbuffer.mm13
-rw-r--r--src/printsupport/dialogs/qabstractprintdialog.cpp7
-rw-r--r--src/testlib/doc/src/qttest-best-practices.qdoc2
-rw-r--r--src/testlib/qsignalspy.qdoc2
-rw-r--r--src/tools/uic/cpp/cppwriteinitialization.cpp29
-rw-r--r--src/tools/uic/main.cpp5
-rw-r--r--src/tools/uic/option.h2
-rw-r--r--src/tools/uic/python/pythonwriteimports.cpp32
-rw-r--r--src/tools/uic/python/pythonwriteimports.h1
-rw-r--r--src/tools/uic/shared/language.cpp3
-rw-r--r--src/tools/uic/shared/language.h1
-rw-r--r--src/widgets/styles/qstyleoption.cpp16
-rw-r--r--src/widgets/styles/qstyleoption.h8
-rw-r--r--src/widgets/styles/qstylesheetstyle.cpp11
-rw-r--r--src/widgets/widgets/qdatetimeedit.cpp7
-rw-r--r--src/widgets/widgets/qplaintextedit.cpp3
-rw-r--r--src/widgets/widgets/qtabbar.cpp16
-rw-r--r--src/xml/dom/qdom.cpp37
-rw-r--r--src/xml/dom/qdom.h12
-rw-r--r--src/xml/dom/qdom_p.h5
-rw-r--r--src/xml/dom/qdomhelpers.cpp22
-rw-r--r--src/xml/dom/qdomhelpers_p.h23
-rw-r--r--src/xml/sax/qxml.cpp38
-rw-r--r--src/xml/sax/qxml.h70
-rw-r--r--src/xml/sax/qxml_p.h9
67 files changed, 771 insertions, 486 deletions
diff --git a/src/3rdparty/sqlite/patches/0002-Fix-CVE-2019-19242-in-SQLite.patch b/src/3rdparty/sqlite/patches/0002-Fix-CVE-2019-19242-in-SQLite.patch
new file mode 100644
index 0000000000..92739192e4
--- /dev/null
+++ b/src/3rdparty/sqlite/patches/0002-Fix-CVE-2019-19242-in-SQLite.patch
@@ -0,0 +1,31 @@
+From 7905740b8e79479298e83d8e559fc49b46cf980e Mon Sep 17 00:00:00 2001
+From: Andy Shaw <andy.shaw@qt.io>
+Date: Thu, 19 Dec 2019 21:59:09 +0100
+Subject: [PATCH] Fix CVE-2019-19242 in SQLite
+
+Change-Id: I78a72a574da5cf3503950afe47146ae6424f00c6
+---
+ src/3rdparty/sqlite/sqlite3.c | 7 ++++++-
+ 1 file changed, 6 insertions(+), 1 deletion(-)
+
+diff --git a/src/3rdparty/sqlite/sqlite3.c b/src/3rdparty/sqlite/sqlite3.c
+index bd647ca1c2..d3e0c065b6 100644
+--- a/src/3rdparty/sqlite/sqlite3.c
++++ b/src/3rdparty/sqlite/sqlite3.c
+@@ -101055,7 +101055,12 @@ expr_code_doover:
+ ** constant.
+ */
+ int iReg = sqlite3ExprCodeTarget(pParse, pExpr->pLeft,target);
+- int aff = sqlite3TableColumnAffinity(pExpr->y.pTab, pExpr->iColumn);
++ int aff;
++ if( pExpr->y.pTab ){
++ aff = sqlite3TableColumnAffinity(pExpr->y.pTab, pExpr->iColumn);
++ }else{
++ aff = pExpr->affExpr;
++ }
+ if( aff>SQLITE_AFF_BLOB ){
+ static const char zAff[] = "B\000C\000D\000E";
+ assert( SQLITE_AFF_BLOB=='A' );
+--
+2.21.0 (Apple Git-122.2)
+
diff --git a/src/3rdparty/sqlite/patches/0003-Fix-CVE-2019-19603-in-SQLite.patch b/src/3rdparty/sqlite/patches/0003-Fix-CVE-2019-19603-in-SQLite.patch
new file mode 100644
index 0000000000..1b8deaa4a1
--- /dev/null
+++ b/src/3rdparty/sqlite/patches/0003-Fix-CVE-2019-19603-in-SQLite.patch
@@ -0,0 +1,95 @@
+From 11a2f4647b67494fb731a6fd793f1b28074631d3 Mon Sep 17 00:00:00 2001
+From: Andy Shaw <andy.shaw@qt.io>
+Date: Thu, 19 Dec 2019 22:31:15 +0100
+Subject: [PATCH] Fix CVE-2019-19603 in SQLite
+
+This includes the patch needed to fix this CVE and a supporting one to
+include a new function added that it depends on.
+
+Task-number: QTBUG-80903
+Change-Id: Ic7639d50c89a3ee7d45426588c3ab0efd0eebb72
+---
+ src/3rdparty/sqlite/sqlite3.c | 32 ++++++++++++++++++++++++++------
+ 1 file changed, 26 insertions(+), 6 deletions(-)
+
+diff --git a/src/3rdparty/sqlite/sqlite3.c b/src/3rdparty/sqlite/sqlite3.c
+index d3e0c065b6..a430554db7 100644
+--- a/src/3rdparty/sqlite/sqlite3.c
++++ b/src/3rdparty/sqlite/sqlite3.c
+@@ -19519,6 +19519,12 @@ SQLITE_PRIVATE Module *sqlite3VtabCreateModule(
+ );
+ # define sqlite3VtabInSync(db) ((db)->nVTrans>0 && (db)->aVTrans==0)
+ #endif
++SQLITE_PRIVATE int sqlite3ReadOnlyShadowTables(sqlite3 *db);
++#ifndef SQLITE_OMIT_VIRTUALTABLE
++SQLITE_PRIVATE int sqlite3ShadowTableName(sqlite3 *db, const char *zName);
++#else
++# define sqlite3ShadowTableName(A,B) 0
++#endif
+ SQLITE_PRIVATE int sqlite3VtabEponymousTableInit(Parse*,Module*);
+ SQLITE_PRIVATE void sqlite3VtabEponymousTableClear(sqlite3*,Module*);
+ SQLITE_PRIVATE void sqlite3VtabMakeWritable(Parse*,Table*);
+@@ -108483,6 +108489,22 @@ SQLITE_PRIVATE int sqlite3WritableSchema(sqlite3 *db){
+ return (db->flags&(SQLITE_WriteSchema|SQLITE_Defensive))==SQLITE_WriteSchema;
+ }
+
++/*
++ ** Return TRUE if shadow tables should be read-only in the current
++ ** context.
++ */
++int sqlite3ReadOnlyShadowTables(sqlite3 *db){
++#ifndef SQLITE_OMIT_VIRTUALTABLE
++ if( (db->flags & SQLITE_Defensive)!=0
++ && db->pVtabCtx==0
++ && db->nVdbeExec==0
++ ){
++ return 1;
++ }
++#endif
++ return 0;
++}
++
+ /*
+ ** This routine is used to check if the UTF-8 string zName is a legal
+ ** unqualified name for a new schema object (table, index, view or
+@@ -108516,8 +108538,8 @@ SQLITE_PRIVATE int sqlite3CheckObjectName(
+ }
+ }
+ }else{
+- if( pParse->nested==0
+- && 0==sqlite3StrNICmp(zName, "sqlite_", 7)
++ if( (pParse->nested==0 && 0==sqlite3StrNICmp(zName, "sqlite_", 7))
++ || (sqlite3ReadOnlyShadowTables(db) && sqlite3ShadowTableName(db, zName))
+ ){
+ sqlite3ErrorMsg(pParse, "object name reserved for internal use: %s",
+ zName);
+@@ -109662,7 +109684,7 @@ static void convertToWithoutRowidTable(Parse *pParse, Table *pTab){
+ ** zName is temporarily modified while this routine is running, but is
+ ** restored to its original value prior to this routine returning.
+ */
+-static int isShadowTableName(sqlite3 *db, char *zName){
++int sqlite3ShadowTableName(sqlite3 *db, const char *zName){
+ char *zTail; /* Pointer to the last "_" in zName */
+ Table *pTab; /* Table that zName is a shadow of */
+ Module *pMod; /* Module for the virtual table */
+@@ -109680,8 +109702,6 @@ static int isShadowTableName(sqlite3 *db, char *zName){
+ if( pMod->pModule->xShadowName==0 ) return 0;
+ return pMod->pModule->xShadowName(zTail+1);
+ }
+-#else
+-# define isShadowTableName(x,y) 0
+ #endif /* ifndef SQLITE_OMIT_VIRTUALTABLE */
+
+ /*
+@@ -109723,7 +109743,7 @@ SQLITE_PRIVATE void sqlite3EndTable(
+ p = pParse->pNewTable;
+ if( p==0 ) return;
+
+- if( pSelect==0 && isShadowTableName(db, p->zName) ){
++ if( pSelect==0 && sqlite3ShadowTableName(db, p->zName) ){
+ p->tabFlags |= TF_Shadow;
+ }
+
+--
+2.21.0 (Apple Git-122.2)
+
diff --git a/src/3rdparty/sqlite/patches/0004-Fix-CVE-2019-19646-in-SQLite.patch b/src/3rdparty/sqlite/patches/0004-Fix-CVE-2019-19646-in-SQLite.patch
new file mode 100644
index 0000000000..db436ab4f6
--- /dev/null
+++ b/src/3rdparty/sqlite/patches/0004-Fix-CVE-2019-19646-in-SQLite.patch
@@ -0,0 +1,29 @@
+From a83bbce4d6f31d93ea4d2a681aa52c148f148e26 Mon Sep 17 00:00:00 2001
+From: Andy Shaw <andy.shaw@qt.io>
+Date: Thu, 2 Jan 2020 09:07:08 +0100
+Subject: [PATCH] Fix CVE-2019-19646 in SQLite
+
+Task-number: QTBUG-81020
+Change-Id: I7176db20d4a44b1fb443a6108675f719e9643343
+---
+ src/3rdparty/sqlite/sqlite3.c | 4 +++-
+ 1 file changed, 3 insertions(+), 1 deletion(-)
+
+diff --git a/src/3rdparty/sqlite/sqlite3.c b/src/3rdparty/sqlite/sqlite3.c
+index 57e61b8313..980a149b1a 100644
+--- a/src/3rdparty/sqlite/sqlite3.c
++++ b/src/3rdparty/sqlite/sqlite3.c
+@@ -123765,7 +123765,9 @@ SQLITE_PRIVATE void sqlite3Pragma(
+ if( j==pTab->iPKey ) continue;
+ if( pTab->aCol[j].notNull==0 ) continue;
+ sqlite3ExprCodeGetColumnOfTable(v, pTab, iDataCur, j, 3);
+- sqlite3VdbeChangeP5(v, OPFLAG_TYPEOFARG);
++ if( sqlite3VdbeGetOp(v,-1)->opcode==OP_Column ){
++ sqlite3VdbeChangeP5(v, OPFLAG_TYPEOFARG);
++ }
+ jmp2 = sqlite3VdbeAddOp1(v, OP_NotNull, 3); VdbeCoverage(v);
+ zErr = sqlite3MPrintf(db, "NULL value in %s.%s", pTab->zName,
+ pTab->aCol[j].zName);
+--
+2.21.0 (Apple Git-122.2)
+
diff --git a/src/3rdparty/sqlite/patches/0005-Fix-CVE-2019-19645-in-SQLite.patch b/src/3rdparty/sqlite/patches/0005-Fix-CVE-2019-19645-in-SQLite.patch
new file mode 100644
index 0000000000..e92c566881
--- /dev/null
+++ b/src/3rdparty/sqlite/patches/0005-Fix-CVE-2019-19645-in-SQLite.patch
@@ -0,0 +1,83 @@
+From 78c972eec5bab03a408b8ba1373572bcfe2db630 Mon Sep 17 00:00:00 2001
+From: Andy Shaw <andy.shaw@qt.io>
+Date: Thu, 2 Jan 2020 08:47:23 +0100
+Subject: [PATCH] Fix CVE-2019-19645 in SQLite
+
+Task-number: QTBUG-81020
+Change-Id: I58b1dd9e7a90ba998c3af7f25a4627d8bdd70970
+---
+ src/3rdparty/sqlite/sqlite3.c | 11 ++++++++++-
+ 1 file changed, 10 insertions(+), 1 deletion(-)
+
+diff --git a/src/3rdparty/sqlite/sqlite3.c b/src/3rdparty/sqlite/sqlite3.c
+index d3e0c065b6..57e61b8313 100644
+--- a/src/3rdparty/sqlite/sqlite3.c
++++ b/src/3rdparty/sqlite/sqlite3.c
+@@ -17946,6 +17946,7 @@ struct Select {
+ #define SF_IncludeHidden 0x20000 /* Include hidden columns in output */
+ #define SF_ComplexResult 0x40000 /* Result contains subquery or function */
+ #define SF_WhereBegin 0x80000 /* Really a WhereBegin() call. Debug Only */
++#define SF_View 0x0200000 /* SELECT statement is a view */
+
+ /*
+ ** The results of a SELECT can be distributed in several ways, as defined
+@@ -103920,6 +103921,7 @@ static int renameUnmapExprCb(Walker *pWalker, Expr *pExpr){
+ static int renameUnmapSelectCb(Walker *pWalker, Select *p){
+ Parse *pParse = pWalker->pParse;
+ int i;
++ if( p->selFlags & SF_View ) return WRC_Prune;
+ if( ALWAYS(p->pEList) ){
+ ExprList *pList = p->pEList;
+ for(i=0; i<pList->nExpr; i++){
+@@ -104024,6 +104026,7 @@ static void renameWalkWith(Walker *pWalker, Select *pSelect){
+ ** descend into sub-select statements.
+ */
+ static int renameColumnSelectCb(Walker *pWalker, Select *p){
++ if( p->selFlags & SF_View ) return WRC_Prune;
+ renameWalkWith(pWalker, p);
+ return WRC_Continue;
+ }
+@@ -104489,8 +104492,9 @@ static void renameColumnFunc(
+ if( sParse.pNewTable ){
+ Select *pSelect = sParse.pNewTable->pSelect;
+ if( pSelect ){
++ pSelect->selFlags &= ~SF_View;
+ sParse.rc = SQLITE_OK;
+- sqlite3SelectPrep(&sParse, sParse.pNewTable->pSelect, 0);
++ sqlite3SelectPrep(&sParse, pSelect, 0);
+ rc = (db->mallocFailed ? SQLITE_NOMEM : sParse.rc);
+ if( rc==SQLITE_OK ){
+ sqlite3WalkSelect(&sWalker, pSelect);
+@@ -104602,6 +104606,7 @@ static int renameTableSelectCb(Walker *pWalker, Select *pSelect){
+ int i;
+ RenameCtx *p = pWalker->u.pRename;
+ SrcList *pSrc = pSelect->pSrc;
++ if( pSelect->selFlags & SF_View ) return WRC_Prune;
+ if( pSrc==0 ){
+ assert( pWalker->pParse->db->mallocFailed );
+ return WRC_Abort;
+@@ -104681,10 +104686,13 @@ static void renameTableFunc(
+
+ if( pTab->pSelect ){
+ if( isLegacy==0 ){
++ Select *pSelect = pTab->pSelect;
+ NameContext sNC;
+ memset(&sNC, 0, sizeof(sNC));
+ sNC.pParse = &sParse;
+
++ assert( pSelect->selFlags & SF_View );
++ pSelect->selFlags &= ~SF_View;
+ sqlite3SelectPrep(&sParse, pTab->pSelect, &sNC);
+ if( sParse.nErr ) rc = sParse.rc;
+ sqlite3WalkSelect(&sWalker, pTab->pSelect);
+@@ -109994,6 +110002,7 @@ SQLITE_PRIVATE void sqlite3CreateView(
+ ** allocated rather than point to the input string - which means that
+ ** they will persist after the current sqlite3_exec() call returns.
+ */
++ pSelect->selFlags |= SF_View;
+ if( IN_RENAME_OBJECT ){
+ p->pSelect = pSelect;
+ pSelect = 0;
+--
+2.21.0 (Apple Git-122.2)
+
diff --git a/src/3rdparty/sqlite/sqlite3.c b/src/3rdparty/sqlite/sqlite3.c
index bd647ca1c2..d5b43857ad 100644
--- a/src/3rdparty/sqlite/sqlite3.c
+++ b/src/3rdparty/sqlite/sqlite3.c
@@ -17946,6 +17946,7 @@ struct Select {
#define SF_IncludeHidden 0x20000 /* Include hidden columns in output */
#define SF_ComplexResult 0x40000 /* Result contains subquery or function */
#define SF_WhereBegin 0x80000 /* Really a WhereBegin() call. Debug Only */
+#define SF_View 0x0200000 /* SELECT statement is a view */
/*
** The results of a SELECT can be distributed in several ways, as defined
@@ -19519,6 +19520,12 @@ SQLITE_PRIVATE Module *sqlite3VtabCreateModule(
);
# define sqlite3VtabInSync(db) ((db)->nVTrans>0 && (db)->aVTrans==0)
#endif
+SQLITE_PRIVATE int sqlite3ReadOnlyShadowTables(sqlite3 *db);
+#ifndef SQLITE_OMIT_VIRTUALTABLE
+SQLITE_PRIVATE int sqlite3ShadowTableName(sqlite3 *db, const char *zName);
+#else
+# define sqlite3ShadowTableName(A,B) 0
+#endif
SQLITE_PRIVATE int sqlite3VtabEponymousTableInit(Parse*,Module*);
SQLITE_PRIVATE void sqlite3VtabEponymousTableClear(sqlite3*,Module*);
SQLITE_PRIVATE void sqlite3VtabMakeWritable(Parse*,Table*);
@@ -101055,7 +101062,12 @@ expr_code_doover:
** constant.
*/
int iReg = sqlite3ExprCodeTarget(pParse, pExpr->pLeft,target);
- int aff = sqlite3TableColumnAffinity(pExpr->y.pTab, pExpr->iColumn);
+ int aff;
+ if( pExpr->y.pTab ){
+ aff = sqlite3TableColumnAffinity(pExpr->y.pTab, pExpr->iColumn);
+ }else{
+ aff = pExpr->affExpr;
+ }
if( aff>SQLITE_AFF_BLOB ){
static const char zAff[] = "B\000C\000D\000E";
assert( SQLITE_AFF_BLOB=='A' );
@@ -103915,6 +103927,7 @@ static int renameUnmapExprCb(Walker *pWalker, Expr *pExpr){
static int renameUnmapSelectCb(Walker *pWalker, Select *p){
Parse *pParse = pWalker->pParse;
int i;
+ if( p->selFlags & SF_View ) return WRC_Prune;
if( ALWAYS(p->pEList) ){
ExprList *pList = p->pEList;
for(i=0; i<pList->nExpr; i++){
@@ -104019,6 +104032,7 @@ static void renameWalkWith(Walker *pWalker, Select *pSelect){
** descend into sub-select statements.
*/
static int renameColumnSelectCb(Walker *pWalker, Select *p){
+ if( p->selFlags & SF_View ) return WRC_Prune;
renameWalkWith(pWalker, p);
return WRC_Continue;
}
@@ -104484,8 +104498,9 @@ static void renameColumnFunc(
if( sParse.pNewTable ){
Select *pSelect = sParse.pNewTable->pSelect;
if( pSelect ){
+ pSelect->selFlags &= ~SF_View;
sParse.rc = SQLITE_OK;
- sqlite3SelectPrep(&sParse, sParse.pNewTable->pSelect, 0);
+ sqlite3SelectPrep(&sParse, pSelect, 0);
rc = (db->mallocFailed ? SQLITE_NOMEM : sParse.rc);
if( rc==SQLITE_OK ){
sqlite3WalkSelect(&sWalker, pSelect);
@@ -104597,6 +104612,7 @@ static int renameTableSelectCb(Walker *pWalker, Select *pSelect){
int i;
RenameCtx *p = pWalker->u.pRename;
SrcList *pSrc = pSelect->pSrc;
+ if( pSelect->selFlags & SF_View ) return WRC_Prune;
if( pSrc==0 ){
assert( pWalker->pParse->db->mallocFailed );
return WRC_Abort;
@@ -104676,10 +104692,13 @@ static void renameTableFunc(
if( pTab->pSelect ){
if( isLegacy==0 ){
+ Select *pSelect = pTab->pSelect;
NameContext sNC;
memset(&sNC, 0, sizeof(sNC));
sNC.pParse = &sParse;
+ assert( pSelect->selFlags & SF_View );
+ pSelect->selFlags &= ~SF_View;
sqlite3SelectPrep(&sParse, pTab->pSelect, &sNC);
if( sParse.nErr ) rc = sParse.rc;
sqlite3WalkSelect(&sWalker, pTab->pSelect);
@@ -108479,6 +108498,22 @@ SQLITE_PRIVATE int sqlite3WritableSchema(sqlite3 *db){
}
/*
+ ** Return TRUE if shadow tables should be read-only in the current
+ ** context.
+ */
+int sqlite3ReadOnlyShadowTables(sqlite3 *db){
+#ifndef SQLITE_OMIT_VIRTUALTABLE
+ if( (db->flags & SQLITE_Defensive)!=0
+ && db->pVtabCtx==0
+ && db->nVdbeExec==0
+ ){
+ return 1;
+ }
+#endif
+ return 0;
+}
+
+/*
** This routine is used to check if the UTF-8 string zName is a legal
** unqualified name for a new schema object (table, index, view or
** trigger). All names are legal except those that begin with the string
@@ -108511,8 +108546,8 @@ SQLITE_PRIVATE int sqlite3CheckObjectName(
}
}
}else{
- if( pParse->nested==0
- && 0==sqlite3StrNICmp(zName, "sqlite_", 7)
+ if( (pParse->nested==0 && 0==sqlite3StrNICmp(zName, "sqlite_", 7))
+ || (sqlite3ReadOnlyShadowTables(db) && sqlite3ShadowTableName(db, zName))
){
sqlite3ErrorMsg(pParse, "object name reserved for internal use: %s",
zName);
@@ -109657,7 +109692,7 @@ static void convertToWithoutRowidTable(Parse *pParse, Table *pTab){
** zName is temporarily modified while this routine is running, but is
** restored to its original value prior to this routine returning.
*/
-static int isShadowTableName(sqlite3 *db, char *zName){
+int sqlite3ShadowTableName(sqlite3 *db, const char *zName){
char *zTail; /* Pointer to the last "_" in zName */
Table *pTab; /* Table that zName is a shadow of */
Module *pMod; /* Module for the virtual table */
@@ -109675,8 +109710,6 @@ static int isShadowTableName(sqlite3 *db, char *zName){
if( pMod->pModule->xShadowName==0 ) return 0;
return pMod->pModule->xShadowName(zTail+1);
}
-#else
-# define isShadowTableName(x,y) 0
#endif /* ifndef SQLITE_OMIT_VIRTUALTABLE */
/*
@@ -109718,7 +109751,7 @@ SQLITE_PRIVATE void sqlite3EndTable(
p = pParse->pNewTable;
if( p==0 ) return;
- if( pSelect==0 && isShadowTableName(db, p->zName) ){
+ if( pSelect==0 && sqlite3ShadowTableName(db, p->zName) ){
p->tabFlags |= TF_Shadow;
}
@@ -109989,6 +110022,7 @@ SQLITE_PRIVATE void sqlite3CreateView(
** allocated rather than point to the input string - which means that
** they will persist after the current sqlite3_exec() call returns.
*/
+ pSelect->selFlags |= SF_View;
if( IN_RENAME_OBJECT ){
p->pSelect = pSelect;
pSelect = 0;
@@ -123751,7 +123785,9 @@ SQLITE_PRIVATE void sqlite3Pragma(
if( j==pTab->iPKey ) continue;
if( pTab->aCol[j].notNull==0 ) continue;
sqlite3ExprCodeGetColumnOfTable(v, pTab, iDataCur, j, 3);
- sqlite3VdbeChangeP5(v, OPFLAG_TYPEOFARG);
+ if( sqlite3VdbeGetOp(v,-1)->opcode==OP_Column ){
+ sqlite3VdbeChangeP5(v, OPFLAG_TYPEOFARG);
+ }
jmp2 = sqlite3VdbeAddOp1(v, OP_NotNull, 3); VdbeCoverage(v);
zErr = sqlite3MPrintf(db, "NULL value in %s.%s", pTab->zName,
pTab->aCol[j].zName);
diff --git a/src/corelib/global/qfloat16.cpp b/src/corelib/global/qfloat16.cpp
index 97709d7685..51766c9760 100644
--- a/src/corelib/global/qfloat16.cpp
+++ b/src/corelib/global/qfloat16.cpp
@@ -109,7 +109,7 @@ QT_BEGIN_NAMESPACE
/*!
\internal
\since 5.14
- bool qfloat16::isInf() const noexcept
+ \fn bool qfloat16::isInf() const noexcept
Tests whether this \c qfloat16 value is an infinity.
@@ -119,7 +119,7 @@ QT_BEGIN_NAMESPACE
/*!
\internal
\since 5.14
- bool qfloat16::isNaN() const noexcept
+ \fn bool qfloat16::isNaN() const noexcept
Tests whether this \c qfloat16 value is "not a number".
@@ -128,7 +128,7 @@ QT_BEGIN_NAMESPACE
/*!
\since 5.14
- bool qfloat16::isNormal() const noexcept
+ \fn bool qfloat16::isNormal() const noexcept
Tests whether this \c qfloat16 value is finite and in normal form.
@@ -138,7 +138,7 @@ QT_BEGIN_NAMESPACE
/*!
\internal
\since 5.14
- bool qfloat16::isFinite() const noexcept
+ \fn bool qfloat16::isFinite() const noexcept
Tests whether this \c qfloat16 value is finite.
diff --git a/src/corelib/kernel/qobject.cpp b/src/corelib/kernel/qobject.cpp
index 304491844b..e51d91e389 100644
--- a/src/corelib/kernel/qobject.cpp
+++ b/src/corelib/kernel/qobject.cpp
@@ -4536,7 +4536,7 @@ QDebug operator<<(QDebug dbg, const QObject *o)
It works exactly like the Q_NAMESPACE macro. However, the external
\c{staticMetaObject} variable that gets defined in the namespace
- is declared with the supplied \c{EXPORT_MACRO} qualifier. This is
+ is declared with the supplied \a EXPORT_MACRO qualifier. This is
useful if the object needs to be exported from a dynamic library.
\sa Q_NAMESPACE, {Creating Shared Libraries}
diff --git a/src/corelib/kernel/qvariant.h b/src/corelib/kernel/qvariant.h
index 66bf8ce7b5..353bfa7ce7 100644
--- a/src/corelib/kernel/qvariant.h
+++ b/src/corelib/kernel/qvariant.h
@@ -795,7 +795,8 @@ namespace QtPrivate {
static QVariantList invoke(const QVariant &v)
{
const int typeId = v.userType();
- if (typeId == qMetaTypeId<QStringList>() || typeId == qMetaTypeId<QByteArrayList>() || QMetaType::hasRegisteredConverterFunction(typeId, qMetaTypeId<QtMetaTypePrivate::QSequentialIterableImpl>())) {
+ if (typeId == qMetaTypeId<QStringList>() || typeId == qMetaTypeId<QByteArrayList>() ||
+ (QMetaType::hasRegisteredConverterFunction(typeId, qMetaTypeId<QtMetaTypePrivate::QSequentialIterableImpl>()) && !QMetaType::hasRegisteredConverterFunction(typeId, qMetaTypeId<QVariantList>()))) {
QSequentialIterable iter = QVariantValueHelperInterface<QSequentialIterable>::invoke(v);
QVariantList l;
l.reserve(iter.size());
@@ -812,7 +813,7 @@ namespace QtPrivate {
static QVariantHash invoke(const QVariant &v)
{
const int typeId = v.userType();
- if (typeId == qMetaTypeId<QVariantMap>() || QMetaType::hasRegisteredConverterFunction(typeId, qMetaTypeId<QtMetaTypePrivate::QAssociativeIterableImpl>())) {
+ if (typeId == qMetaTypeId<QVariantMap>() || ((QMetaType::hasRegisteredConverterFunction(typeId, qMetaTypeId<QtMetaTypePrivate::QAssociativeIterableImpl>())) && !QMetaType::hasRegisteredConverterFunction(typeId, qMetaTypeId<QVariantHash>()))) {
QAssociativeIterable iter = QVariantValueHelperInterface<QAssociativeIterable>::invoke(v);
QVariantHash l;
l.reserve(iter.size());
@@ -829,7 +830,7 @@ namespace QtPrivate {
static QVariantMap invoke(const QVariant &v)
{
const int typeId = v.userType();
- if (typeId == qMetaTypeId<QVariantHash>() || QMetaType::hasRegisteredConverterFunction(typeId, qMetaTypeId<QtMetaTypePrivate::QAssociativeIterableImpl>())) {
+ if (typeId == qMetaTypeId<QVariantHash>() || (QMetaType::hasRegisteredConverterFunction(typeId, qMetaTypeId<QtMetaTypePrivate::QAssociativeIterableImpl>()) && !QMetaType::hasRegisteredConverterFunction(typeId, qMetaTypeId<QVariantMap>()))) {
QAssociativeIterable iter = QVariantValueHelperInterface<QAssociativeIterable>::invoke(v);
QVariantMap l;
for (QAssociativeIterable::const_iterator it = iter.begin(), end = iter.end(); it != end; ++it)
@@ -845,12 +846,9 @@ namespace QtPrivate {
static QPair<QVariant, QVariant> invoke(const QVariant &v)
{
const int typeId = v.userType();
- if (typeId == qMetaTypeId<QPair<QVariant, QVariant> >())
- return QVariantValueHelper<QPair<QVariant, QVariant> >::invoke(v);
-
- if (QMetaType::hasRegisteredConverterFunction(typeId, qMetaTypeId<QtMetaTypePrivate::QPairVariantInterfaceImpl>())) {
- QtMetaTypePrivate::QPairVariantInterfaceImpl pi = qvariant_cast<QtMetaTypePrivate::QPairVariantInterfaceImpl>(v);
+ if (QMetaType::hasRegisteredConverterFunction(typeId, qMetaTypeId<QtMetaTypePrivate::QPairVariantInterfaceImpl>()) && !(typeId == qMetaTypeId<QPair<QVariant, QVariant> >())) {
+ QtMetaTypePrivate::QPairVariantInterfaceImpl pi = v.value<QtMetaTypePrivate::QPairVariantInterfaceImpl>();
const QtMetaTypePrivate::VariantData d1 = pi.first();
QVariant v1(d1.metaTypeId, d1.data, d1.flags);
if (d1.metaTypeId == qMetaTypeId<QVariant>())
diff --git a/src/corelib/text/qlocale.qdoc b/src/corelib/text/qlocale.qdoc
index 6c9d6f9d11..592f9d0785 100644
--- a/src/corelib/text/qlocale.qdoc
+++ b/src/corelib/text/qlocale.qdoc
@@ -174,7 +174,7 @@
\value Chewa Obsolete, please use Nyanja
\value Chickasaw Since Qt 5.14
\value Chiga
- \value Chinese
+ \value Chinese (Mandarin)
\value Church
\value Chuvash
\value ClassicalMandaic Since Qt 5.1
@@ -1202,14 +1202,6 @@
*/
/*!
-\fn QString QLocale::toString(ushort i) const
-
-\overload
-
-\sa toUShort()
-*/
-
-/*!
\fn QString QLocale::toString(int i) const
\overload
diff --git a/src/corelib/text/qregularexpression.cpp b/src/corelib/text/qregularexpression.cpp
index 068c960910..fb8f5a5efc 100644
--- a/src/corelib/text/qregularexpression.cpp
+++ b/src/corelib/text/qregularexpression.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2016 Giuseppe D'Angelo <dangelog@gmail.com>.
-** Copyright (C) 2016 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com, author Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
+** Copyright (C) 2020 Giuseppe D'Angelo <dangelog@gmail.com>.
+** Copyright (C) 2020 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com, author Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
** Copyright (C) 2016 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
@@ -1829,7 +1829,19 @@ uint qHash(const QRegularExpression &key, uint seed) noexcept
return seed;
}
+#if QT_STRINGVIEW_LEVEL < 2
/*!
+ \overload
+*/
+QString QRegularExpression::escape(const QString &str)
+{
+ return escape(QStringView(str));
+}
+#endif // QT_STRINGVIEW_LEVEL < 2
+
+/*!
+ \since 5.15
+
Escapes all characters of \a str so that they no longer have any special
meaning when used as a regular expression pattern string, and returns
the escaped string. For instance:
@@ -1847,7 +1859,7 @@ uint qHash(const QRegularExpression &key, uint seed) noexcept
inside \a str is escaped with the sequence \c{"\\0"} (backslash +
\c{'0'}), instead of \c{"\\\0"} (backslash + \c{NUL}).
*/
-QString QRegularExpression::escape(const QString &str)
+QString QRegularExpression::escape(QStringView str)
{
QString result;
const int count = str.size();
@@ -1882,8 +1894,19 @@ QString QRegularExpression::escape(const QString &str)
return result;
}
+#if QT_STRINGVIEW_LEVEL < 2
/*!
\since 5.12
+ \overload
+*/
+QString QRegularExpression::wildcardToRegularExpression(const QString &pattern)
+{
+ return wildcardToRegularExpression(QStringView(pattern));
+}
+#endif // QT_STRINGVIEW_LEVEL < 2
+
+/*!
+ \since 5.15
Returns a regular expression representation of the given glob \a pattern.
The transformation is targeting file path globbing, which means in particular
@@ -1928,13 +1951,13 @@ QString QRegularExpression::escape(const QString &str)
\sa escape()
*/
-QString QRegularExpression::wildcardToRegularExpression(const QString &pattern)
+QString QRegularExpression::wildcardToRegularExpression(QStringView pattern)
{
const int wclen = pattern.length();
QString rx;
rx.reserve(wclen + wclen / 16);
int i = 0;
- const QChar *wc = pattern.unicode();
+ const QChar *wc = pattern.data();
#ifdef Q_OS_WIN
const QLatin1Char nativePathSeparator('\\');
@@ -2006,16 +2029,31 @@ QString QRegularExpression::wildcardToRegularExpression(const QString &pattern)
return anchoredPattern(rx);
}
+#if QT_STRINGVIEW_LEVEL < 2
/*!
\fn QRegularExpression::anchoredPattern(const QString &expression)
\since 5.12
+ \overload
+*/
+#endif // QT_STRINGVIEW_LEVEL < 2
+
+/*!
+ \since 5.15
+
Returns the \a expression wrapped between the \c{\A} and \c{\z} anchors to
be used for exact matching.
\sa {Porting from QRegExp's Exact Matching}
*/
+QString QRegularExpression::anchoredPattern(QStringView expression)
+{
+ return QString()
+ + QLatin1String("\\A(?:")
+ + expression
+ + QLatin1String(")\\z");
+}
/*!
\since 5.1
diff --git a/src/corelib/text/qregularexpression.h b/src/corelib/text/qregularexpression.h
index f799a38ae4..4fa258b080 100644
--- a/src/corelib/text/qregularexpression.h
+++ b/src/corelib/text/qregularexpression.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2012 Giuseppe D'Angelo <dangelog@gmail.com>.
-** Copyright (C) 2012 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com, author Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
+** Copyright (C) 2020 Giuseppe D'Angelo <dangelog@gmail.com>.
+** Copyright (C) 2020 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com, author Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
** Contact: https://www.qt.io/licensing/
**
** This file is part of the QtCore module of the Qt Toolkit.
@@ -42,9 +42,8 @@
#define QREGULAREXPRESSION_H
#include <QtCore/qglobal.h>
-
#include <QtCore/qstring.h>
-#include <QtCore/qstringlist.h>
+#include <QtCore/qstringview.h>
#include <QtCore/qshareddata.h>
#include <QtCore/qvariant.h>
@@ -52,7 +51,8 @@ QT_REQUIRE_CONFIG(regularexpression);
QT_BEGIN_NAMESPACE
-class QStringView;
+class QStringList;
+class QLatin1String;
class QRegularExpressionMatch;
class QRegularExpressionMatchIterator;
@@ -137,14 +137,18 @@ public:
void optimize() const;
+#if QT_STRINGVIEW_LEVEL < 2
static QString escape(const QString &str);
static QString wildcardToRegularExpression(const QString &str);
static inline QString anchoredPattern(const QString &expression)
{
- return QLatin1String("\\A(?:")
- + expression
- + QLatin1String(")\\z");
+ return anchoredPattern(QStringView(expression));
}
+#endif
+
+ static QString escape(QStringView str);
+ static QString wildcardToRegularExpression(QStringView str);
+ static QString anchoredPattern(QStringView expression);
bool operator==(const QRegularExpression &re) const;
inline bool operator!=(const QRegularExpression &re) const { return !operator==(re); }
diff --git a/src/corelib/tools/qhash.cpp b/src/corelib/tools/qhash.cpp
index 77c8da7f4a..15f731a603 100644
--- a/src/corelib/tools/qhash.cpp
+++ b/src/corelib/tools/qhash.cpp
@@ -2593,7 +2593,7 @@ uint qHash(long double key, uint seed) noexcept
\sa operator=()
*/
-/*! \fn template <class Key, class T> template <class InputIterator> QMultiHash::QMultiHash(InputIterator begin, InputIterator end)
+/*! \fn template <class Key, class T> template <class InputIterator> QMultiHash<Key, T>::QMultiHash(InputIterator begin, InputIterator end)
\since 5.14
Constructs a multi-hash with a copy of each of the elements in the iterator range
diff --git a/src/gui/image/qimage.cpp b/src/gui/image/qimage.cpp
index 1c8c6262ce..08b1373f96 100644
--- a/src/gui/image/qimage.cpp
+++ b/src/gui/image/qimage.cpp
@@ -4299,99 +4299,61 @@ bool QImage::isDetached() const
/*!
- \obsolete
Sets the alpha channel of this image to the given \a alphaChannel.
- If \a alphaChannel is an 8 bit grayscale image, the intensity values are
- written into this buffer directly. Otherwise, \a alphaChannel is converted
- to 32 bit and the intensity of the RGB pixel values is used.
-
- Note that the image will be converted to the Format_ARGB32_Premultiplied
- format if the function succeeds.
+ If \a alphaChannel is an 8 bit alpha image, the alpha values are
+ used directly. Otherwise, \a alphaChannel is converted to 8 bit
+ grayscale and the intensity of the pixel values is used.
- Use one of the composition modes in QPainter::CompositionMode instead.
+ If the image already has an alpha channel, the existing alpha channel
+ is multiplied with the new one. If the image doesn't have an alpha
+ channel it will be converted to a format that does.
- \warning This function is expensive.
+ The operation is similar to painting \a alphaChannel as an alpha image
+ over this image using \c QPainter::CompositionMode_DestinationIn.
- \sa alphaChannel(), {QImage#Image Transformations}{Image
- Transformations}, {QImage#Image Formats}{Image Formats}
+ \sa hasAlphaChannel(), alphaChannel(),
+ {QImage#Image Transformations}{Image Transformations},
+ {QImage#Image Formats}{Image Formats}
*/
void QImage::setAlphaChannel(const QImage &alphaChannel)
{
- if (!d)
+ if (!d || alphaChannel.isNull())
return;
- int w = d->width;
- int h = d->height;
-
- if (w != alphaChannel.d->width || h != alphaChannel.d->height) {
- qWarning("QImage::setAlphaChannel: "
- "Alpha channel must have same dimensions as the target image");
- return;
- }
-
if (d->paintEngine && d->paintEngine->isActive()) {
qWarning("QImage::setAlphaChannel: "
"Unable to set alpha channel while image is being painted on");
return;
}
- if (d->format == QImage::Format_ARGB32_Premultiplied)
+ const Format alphaFormat = qt_alphaVersionForPainting(d->format);
+ if (d->format == alphaFormat)
detach();
else
- *this = convertToFormat(QImage::Format_ARGB32_Premultiplied);
+ convertTo(alphaFormat);
if (isNull())
return;
- // Slight optimization since alphachannels are returned as 8-bit grays.
- if (alphaChannel.format() == QImage::Format_Alpha8 ||( alphaChannel.d->depth == 8 && alphaChannel.isGrayscale())) {
- const uchar *src_data = alphaChannel.d->data;
- uchar *dest_data = d->data;
- for (int y=0; y<h; ++y) {
- const uchar *src = src_data;
- QRgb *dest = (QRgb *)dest_data;
- for (int x=0; x<w; ++x) {
- int alpha = *src;
- int destAlpha = qt_div_255(alpha * qAlpha(*dest));
- *dest = ((destAlpha << 24)
- | (qt_div_255(qRed(*dest) * alpha) << 16)
- | (qt_div_255(qGreen(*dest) * alpha) << 8)
- | (qt_div_255(qBlue(*dest) * alpha)));
- ++dest;
- ++src;
- }
- src_data += alphaChannel.d->bytes_per_line;
- dest_data += d->bytes_per_line;
- }
+ QImage sourceImage;
+ if (alphaChannel.format() == QImage::Format_Alpha8 || (alphaChannel.d->depth == 8 && alphaChannel.isGrayscale()))
+ sourceImage = alphaChannel;
+ else
+ sourceImage = alphaChannel.convertToFormat(QImage::Format_Grayscale8);
+ if (!sourceImage.reinterpretAsFormat(QImage::Format_Alpha8))
+ return;
- } else {
- const QImage sourceImage = alphaChannel.convertToFormat(QImage::Format_RGB32);
- if (sourceImage.isNull())
- return;
- const uchar *src_data = sourceImage.d->data;
- uchar *dest_data = d->data;
- for (int y=0; y<h; ++y) {
- const QRgb *src = (const QRgb *) src_data;
- QRgb *dest = (QRgb *) dest_data;
- for (int x=0; x<w; ++x) {
- int alpha = qGray(*src);
- int destAlpha = qt_div_255(alpha * qAlpha(*dest));
- *dest = ((destAlpha << 24)
- | (qt_div_255(qRed(*dest) * alpha) << 16)
- | (qt_div_255(qGreen(*dest) * alpha) << 8)
- | (qt_div_255(qBlue(*dest) * alpha)));
- ++dest;
- ++src;
- }
- src_data += sourceImage.d->bytes_per_line;
- dest_data += d->bytes_per_line;
- }
- }
+ QPainter painter(this);
+ if (sourceImage.size() != size())
+ painter.setRenderHint(QPainter::SmoothPixmapTransform);
+ painter.setCompositionMode(QPainter::CompositionMode_DestinationIn);
+ painter.drawImage(rect(), sourceImage);
}
+#if QT_DEPRECATED_SINCE(5, 15)
/*!
\obsolete
@@ -4481,6 +4443,7 @@ QImage QImage::alphaChannel() const
return image;
}
+#endif
/*!
Returns \c true if the image has a format that respects the alpha
diff --git a/src/gui/image/qimage.h b/src/gui/image/qimage.h
index 1e462fc2e6..b8df4b83d1 100644
--- a/src/gui/image/qimage.h
+++ b/src/gui/image/qimage.h
@@ -225,7 +225,9 @@ public:
bool hasAlphaChannel() const;
void setAlphaChannel(const QImage &alphaChannel);
- QImage alphaChannel() const;
+#if QT_DEPRECATED_SINCE(5, 15)
+ QT_DEPRECATED QImage alphaChannel() const;
+#endif
QImage createAlphaMask(Qt::ImageConversionFlags flags = Qt::AutoColor) const;
#ifndef QT_NO_IMAGE_HEURISTIC_MASK
QImage createHeuristicMask(bool clipTight = true) const;
diff --git a/src/gui/kernel/qguiactiongroup.cpp b/src/gui/kernel/qguiactiongroup.cpp
index 82f5e0a0af..7360214aad 100644
--- a/src/gui/kernel/qguiactiongroup.cpp
+++ b/src/gui/kernel/qguiactiongroup.cpp
@@ -222,7 +222,8 @@ QList<QGuiAction*> QGuiActionGroup::guiActions() const
\brief Enable or disable the group exclusion checking
This is a convenience method that calls
- setExclusionPolicy(ExclusionPolicy::Exclusive).
+ setExclusionPolicy(ExclusionPolicy::Exclusive) when \a b is true,
+ else setExclusionPolicy(QActionGroup::ExclusionPolicy::None).
\sa QGuiActionGroup::exclusionPolicy
*/
@@ -233,7 +234,7 @@ void QGuiActionGroup::setExclusive(bool b)
}
/*!
- \brief Returs true if the group is exclusive
+ \brief Returns true if the group is exclusive
The group is exclusive if the ExclusionPolicy is either Exclusive
or ExclusionOptional.
diff --git a/src/gui/painting/qdrawhelper.cpp b/src/gui/painting/qdrawhelper.cpp
index 6819545bda..2d4045fe29 100644
--- a/src/gui/painting/qdrawhelper.cpp
+++ b/src/gui/painting/qdrawhelper.cpp
@@ -6048,7 +6048,11 @@ static inline void alphargbblend_argb32(quint32 *dst, uint coverage, const QRgba
// Give up and do a naive gray alphablend. Needed to deal with ARGB32 and invalid ARGB32_premultiplied, see QTBUG-60571
blend_pixel(*dst, src, qRgbAvg(coverage));
} else if (!colorProfile) {
- *dst = rgbBlend(*dst, src, coverage);
+ // First do naive blend with text-color
+ QRgb s = *dst;
+ blend_pixel(s, src);
+ // Then a naive blend with glyph shape
+ *dst = rgbBlend(*dst, s, coverage);
} else if (srcLinear.isOpaque()) {
rgbBlendPixel(dst, coverage, srcLinear, colorProfile);
} else {
diff --git a/src/gui/rhi/qrhi.cpp b/src/gui/rhi/qrhi.cpp
index 58f30deb41..00d4df53bd 100644
--- a/src/gui/rhi/qrhi.cpp
+++ b/src/gui/rhi/qrhi.cpp
@@ -2215,20 +2215,6 @@ QRhiResource::Type QRhiTexture::resourceType() const
*/
/*!
- \return a pointer to a backend-specific QRhiNativeHandles subclass, such as
- QRhiVulkanTextureNativeHandles. The returned value is null when exposing
- the underlying native resources is not supported by the backend.
-
- \sa QRhiVulkanTextureNativeHandles, QRhiD3D11TextureNativeHandles,
- QRhiMetalTextureNativeHandles, QRhiGles2TextureNativeHandles
- */
-// TODO: remove this version once QtQuick has stopped using it
-const QRhiNativeHandles *QRhiTexture::nativeHandles()
-{
- return nullptr;
-}
-
-/*!
\return the underlying native resources for this texture. The returned value
will be empty if exposing the underlying native resources is not supported by
the backend.
@@ -2242,36 +2228,6 @@ QRhiTexture::NativeTexture QRhiTexture::nativeTexture()
/*!
Similar to build() except that no new native textures are created. Instead,
- the texture from \a src is used.
-
- This allows importing an existing native texture object (which must belong
- to the same device or sharing context, depending on the graphics API) from
- an external graphics engine.
-
- \note format(), pixelSize(), sampleCount(), and flags() must still be set
- correctly. Passing incorrect sizes and other values to QRhi::newTexture()
- and then following it with a buildFrom() expecting that the native texture
- object alone is sufficient to deduce such values is \b wrong and will lead
- to problems.
-
- \note QRhiTexture does not take ownership of the texture object. release()
- does not free the object or any associated memory.
-
- The opposite of this operation, exposing a QRhiTexture-created native
- texture object to a foreign engine, is possible via nativeHandles().
-
- \sa QRhiVulkanTextureNativeHandles, QRhiD3D11TextureNativeHandles,
- QRhiMetalTextureNativeHandles, QRhiGles2TextureNativeHandles
- */
-// TODO: remove this version once QtQuick has stopped using it
-bool QRhiTexture::buildFrom(const QRhiNativeHandles *src)
-{
- Q_UNUSED(src);
- return false;
-}
-
-/*!
- Similar to build() except that no new native textures are created. Instead,
the native texture resources specified by \a src is used.
This allows importing an existing native texture object (which must belong
diff --git a/src/gui/rhi/qrhi_p.h b/src/gui/rhi/qrhi_p.h
index 44118b2f10..a6c65aac5e 100644
--- a/src/gui/rhi/qrhi_p.h
+++ b/src/gui/rhi/qrhi_p.h
@@ -780,9 +780,7 @@ public:
void setSampleCount(int s) { m_sampleCount = s; }
virtual bool build() = 0;
- virtual const QRhiNativeHandles *nativeHandles();
virtual NativeTexture nativeTexture();
- virtual bool buildFrom(const QRhiNativeHandles *src);
virtual bool buildFrom(NativeTexture src);
protected:
diff --git a/src/gui/rhi/qrhid3d11.cpp b/src/gui/rhi/qrhid3d11.cpp
index ba2488bffb..c5923fe411 100644
--- a/src/gui/rhi/qrhid3d11.cpp
+++ b/src/gui/rhi/qrhid3d11.cpp
@@ -108,17 +108,6 @@ QT_BEGIN_NAMESPACE
\c{ID3D11Device *} and \c{ID3D11DeviceContext *}.
*/
-/*!
- \class QRhiD3D11TextureNativeHandles
- \internal
- \inmodule QtGui
- \brief Holds the D3D texture object that is backing a QRhiTexture instance.
-
- \note The class uses \c{void *} as the type since including the COM-based
- \c{d3d11.h} headers is not acceptable here. The actual type is
- \c{ID3D11Texture2D *}.
- */
-
// help mingw with its ancient sdk headers
#ifndef DXGI_ADAPTER_FLAG_SOFTWARE
#define DXGI_ADAPTER_FLAG_SOFTWARE 2
@@ -2674,8 +2663,6 @@ bool QD3D11Texture::finishBuild()
return false;
}
- nativeHandlesStruct.texture = tex;
-
generation += 1;
return true;
}
@@ -2741,29 +2728,6 @@ bool QD3D11Texture::build()
return true;
}
-bool QD3D11Texture::buildFrom(const QRhiNativeHandles *src)
-{
- const QRhiD3D11TextureNativeHandles *h = static_cast<const QRhiD3D11TextureNativeHandles *>(src);
- if (!h || !h->texture)
- return false;
-
- if (!prepareBuild())
- return false;
-
- tex = static_cast<ID3D11Texture2D *>(h->texture);
-
- if (!finishBuild())
- return false;
-
- QRHI_PROF;
- QRHI_PROF_F(newTexture(this, false, int(mipLevelCount), m_flags.testFlag(CubeMap) ? 6 : 1, int(sampleDesc.Count)));
-
- owns = false;
- QRHI_RES_RHI(QRhiD3D11);
- rhiD->registerResource(this);
- return true;
-}
-
bool QD3D11Texture::buildFrom(QRhiTexture::NativeTexture src)
{
auto *srcTex = static_cast<ID3D11Texture2D * const *>(src.object);
@@ -2787,14 +2751,9 @@ bool QD3D11Texture::buildFrom(QRhiTexture::NativeTexture src)
return true;
}
-const QRhiNativeHandles *QD3D11Texture::nativeHandles()
-{
- return &nativeHandlesStruct;
-}
-
QRhiTexture::NativeTexture QD3D11Texture::nativeTexture()
{
- return {&nativeHandlesStruct.texture, 0};
+ return {&tex, 0};
}
ID3D11UnorderedAccessView *QD3D11Texture::unorderedAccessViewForLevel(int level)
diff --git a/src/gui/rhi/qrhid3d11_p.h b/src/gui/rhi/qrhid3d11_p.h
index 5df1843b1e..aba0f37ee7 100644
--- a/src/gui/rhi/qrhid3d11_p.h
+++ b/src/gui/rhi/qrhid3d11_p.h
@@ -69,11 +69,6 @@ struct Q_GUI_EXPORT QRhiD3D11NativeHandles : public QRhiNativeHandles
void *context = nullptr;
};
-struct Q_GUI_EXPORT QRhiD3D11TextureNativeHandles : public QRhiNativeHandles
-{
- void *texture = nullptr; // ID3D11Texture2D*
-};
-
QT_END_NAMESPACE
#endif
diff --git a/src/gui/rhi/qrhid3d11_p_p.h b/src/gui/rhi/qrhid3d11_p_p.h
index 8f02c4300b..9ddd2aa797 100644
--- a/src/gui/rhi/qrhid3d11_p_p.h
+++ b/src/gui/rhi/qrhid3d11_p_p.h
@@ -99,9 +99,7 @@ struct QD3D11Texture : public QRhiTexture
~QD3D11Texture();
void release() override;
bool build() override;
- bool buildFrom(const QRhiNativeHandles *src) override;
bool buildFrom(NativeTexture src) override;
- const QRhiNativeHandles *nativeHandles() override;
NativeTexture nativeTexture() override;
bool prepareBuild(QSize *adjustedSize = nullptr);
@@ -114,7 +112,6 @@ struct QD3D11Texture : public QRhiTexture
DXGI_FORMAT dxgiFormat;
uint mipLevelCount = 0;
DXGI_SAMPLE_DESC sampleDesc;
- QRhiD3D11TextureNativeHandles nativeHandlesStruct;
ID3D11UnorderedAccessView *perLevelViews[QRhi::MAX_LEVELS];
uint generation = 0;
friend class QRhiD3D11;
diff --git a/src/gui/rhi/qrhigles2.cpp b/src/gui/rhi/qrhigles2.cpp
index ffaccbad71..e63ed11dd4 100644
--- a/src/gui/rhi/qrhigles2.cpp
+++ b/src/gui/rhi/qrhigles2.cpp
@@ -137,13 +137,6 @@ QT_BEGIN_NAMESPACE
\brief Holds the OpenGL context used by the QRhi.
*/
-/*!
- \class QRhiGles2TextureNativeHandles
- \internal
- \inmodule QtGui
- \brief Holds the OpenGL texture object that is backing a QRhiTexture instance.
- */
-
#ifndef GL_BGRA
#define GL_BGRA 0x80E1
#endif
@@ -3324,7 +3317,6 @@ void QGles2Texture::release()
texture = 0;
specified = false;
- nativeHandlesStruct.texture = 0;
QRHI_RES_RHI(QRhiGles2);
if (owns)
@@ -3483,31 +3475,6 @@ bool QGles2Texture::build()
QRHI_PROF_F(newTexture(this, true, mipLevelCount, isCube ? 6 : 1, 1));
owns = true;
- nativeHandlesStruct.texture = texture;
-
- generation += 1;
- rhiD->registerResource(this);
- return true;
-}
-
-bool QGles2Texture::buildFrom(const QRhiNativeHandles *src)
-{
- const QRhiGles2TextureNativeHandles *h = static_cast<const QRhiGles2TextureNativeHandles *>(src);
- if (!h || !h->texture)
- return false;
-
- if (!prepareBuild())
- return false;
-
- texture = h->texture;
- specified = true;
-
- QRHI_RES_RHI(QRhiGles2);
- QRHI_PROF;
- QRHI_PROF_F(newTexture(this, false, mipLevelCount, m_flags.testFlag(CubeMap) ? 6 : 1, 1));
-
- owns = false;
- nativeHandlesStruct.texture = texture;
generation += 1;
rhiD->registerResource(this);
@@ -3531,21 +3498,15 @@ bool QGles2Texture::buildFrom(QRhiTexture::NativeTexture src)
QRHI_PROF_F(newTexture(this, false, mipLevelCount, m_flags.testFlag(CubeMap) ? 6 : 1, 1));
owns = false;
- nativeHandlesStruct.texture = texture;
generation += 1;
rhiD->registerResource(this);
return true;
}
-const QRhiNativeHandles *QGles2Texture::nativeHandles()
-{
- return &nativeHandlesStruct;
-}
-
QRhiTexture::NativeTexture QGles2Texture::nativeTexture()
{
- return {&nativeHandlesStruct.texture, 0};
+ return {&texture, 0};
}
QGles2Sampler::QGles2Sampler(QRhiImplementation *rhi, Filter magFilter, Filter minFilter, Filter mipmapMode,
diff --git a/src/gui/rhi/qrhigles2_p.h b/src/gui/rhi/qrhigles2_p.h
index 7f7c8b4c40..8d8f0c7396 100644
--- a/src/gui/rhi/qrhigles2_p.h
+++ b/src/gui/rhi/qrhigles2_p.h
@@ -74,11 +74,6 @@ struct Q_GUI_EXPORT QRhiGles2NativeHandles : public QRhiNativeHandles
QOpenGLContext *context = nullptr;
};
-struct Q_GUI_EXPORT QRhiGles2TextureNativeHandles : public QRhiNativeHandles
-{
- uint texture = 0;
-};
-
QT_END_NAMESPACE
#endif
diff --git a/src/gui/rhi/qrhigles2_p_p.h b/src/gui/rhi/qrhigles2_p_p.h
index d4f1336c3e..a9b3022612 100644
--- a/src/gui/rhi/qrhigles2_p_p.h
+++ b/src/gui/rhi/qrhigles2_p_p.h
@@ -132,9 +132,7 @@ struct QGles2Texture : public QRhiTexture
~QGles2Texture();
void release() override;
bool build() override;
- bool buildFrom(const QRhiNativeHandles *src) override;
bool buildFrom(NativeTexture src) override;
- const QRhiNativeHandles *nativeHandles() override;
NativeTexture nativeTexture() override;
bool prepareBuild(QSize *adjustedSize = nullptr);
@@ -149,7 +147,7 @@ struct QGles2Texture : public QRhiTexture
QGles2SamplerData samplerState;
bool specified = false;
int mipLevelCount = 0;
- QRhiGles2TextureNativeHandles nativeHandlesStruct;
+
enum Access {
AccessNone,
AccessSample,
diff --git a/src/gui/rhi/qrhimetal.mm b/src/gui/rhi/qrhimetal.mm
index b6ca40e08b..222bf170dc 100644
--- a/src/gui/rhi/qrhimetal.mm
+++ b/src/gui/rhi/qrhimetal.mm
@@ -114,15 +114,6 @@ QT_BEGIN_NAMESPACE
*/
/*!
- \class QRhiMetalTextureNativeHandles
- \inmodule QtRhi
- \brief Holds the Metal texture object that is backing a QRhiTexture instance.
-
- \note The class uses \c{void *} as the type since including the Objective C
- headers is not acceptable here. The actual type is \c{id<MTLTexture>}.
- */
-
-/*!
\class QRhiMetalCommandBufferNativeHandles
\inmodule QtRhi
\brief Holds the MTLCommandBuffer and MTLRenderCommandEncoder objects that are backing a QRhiCommandBuffer.
@@ -2296,7 +2287,6 @@ void QMetalTexture::release()
e.texture.texture = d->owns ? d->tex : nil;
d->tex = nil;
- nativeHandlesStruct.texture = nullptr;
for (int i = 0; i < QMTL_FRAMES_IN_FLIGHT; ++i) {
e.texture.stagingBuffers[i] = d->stagingBuf[i];
@@ -2508,7 +2498,6 @@ bool QMetalTexture::build()
d->tex.label = [NSString stringWithUTF8String: m_objectName.constData()];
d->owns = true;
- nativeHandlesStruct.texture = d->tex;
QRHI_PROF;
QRHI_PROF_F(newTexture(this, true, mipLevelCount, isCube ? 6 : 1, samples));
@@ -2519,30 +2508,6 @@ bool QMetalTexture::build()
return true;
}
-bool QMetalTexture::buildFrom(const QRhiNativeHandles *src)
-{
- const QRhiMetalTextureNativeHandles *h = static_cast<const QRhiMetalTextureNativeHandles *>(src);
- if (!h || !h->texture)
- return false;
-
- if (!prepareBuild())
- return false;
-
- d->tex = (id<MTLTexture>) h->texture;
-
- d->owns = false;
- nativeHandlesStruct.texture = d->tex;
-
- QRHI_PROF;
- QRHI_PROF_F(newTexture(this, false, mipLevelCount, m_flags.testFlag(CubeMap) ? 6 : 1, samples));
-
- lastActiveFrameSlot = -1;
- generation += 1;
- QRHI_RES_RHI(QRhiMetal);
- rhiD->registerResource(this);
- return true;
-}
-
bool QMetalTexture::buildFrom(QRhiTexture::NativeTexture src)
{
void * const * tex = (void * const *) src.object;
@@ -2555,7 +2520,6 @@ bool QMetalTexture::buildFrom(QRhiTexture::NativeTexture src)
d->tex = (id<MTLTexture>) *tex;
d->owns = false;
- nativeHandlesStruct.texture = d->tex;
QRHI_PROF;
QRHI_PROF_F(newTexture(this, false, mipLevelCount, m_flags.testFlag(CubeMap) ? 6 : 1, samples));
@@ -2567,14 +2531,9 @@ bool QMetalTexture::buildFrom(QRhiTexture::NativeTexture src)
return true;
}
-const QRhiNativeHandles *QMetalTexture::nativeHandles()
-{
- return &nativeHandlesStruct;
-}
-
QRhiTexture::NativeTexture QMetalTexture::nativeTexture()
{
- return {&nativeHandlesStruct.texture, 0};
+ return {&d->tex, 0};
}
id<MTLTexture> QMetalTextureData::viewForLevel(int level)
diff --git a/src/gui/rhi/qrhimetal_p.h b/src/gui/rhi/qrhimetal_p.h
index 094801c58c..17e28b2c0f 100644
--- a/src/gui/rhi/qrhimetal_p.h
+++ b/src/gui/rhi/qrhimetal_p.h
@@ -64,11 +64,6 @@ struct Q_GUI_EXPORT QRhiMetalNativeHandles : public QRhiNativeHandles
void *cmdQueue = nullptr; // id<MTLCommandQueue>
};
-struct Q_GUI_EXPORT QRhiMetalTextureNativeHandles : public QRhiNativeHandles
-{
- void *texture = nullptr; // id<MTLTexture>
-};
-
struct Q_GUI_EXPORT QRhiMetalCommandBufferNativeHandles : public QRhiNativeHandles
{
void *commandBuffer = nullptr; // id<MTLCommandBuffer>
diff --git a/src/gui/rhi/qrhimetal_p_p.h b/src/gui/rhi/qrhimetal_p_p.h
index 8e655fd98b..71d4325b1a 100644
--- a/src/gui/rhi/qrhimetal_p_p.h
+++ b/src/gui/rhi/qrhimetal_p_p.h
@@ -100,15 +100,12 @@ struct QMetalTexture : public QRhiTexture
~QMetalTexture();
void release() override;
bool build() override;
- bool buildFrom(const QRhiNativeHandles *src) override;
bool buildFrom(NativeTexture src) override;
- const QRhiNativeHandles *nativeHandles() override;
NativeTexture nativeTexture() override;
bool prepareBuild(QSize *adjustedSize = nullptr);
QMetalTextureData *d;
- QRhiMetalTextureNativeHandles nativeHandlesStruct;
int mipLevelCount = 0;
int samples = 1;
uint generation = 0;
diff --git a/src/gui/rhi/qrhinull.cpp b/src/gui/rhi/qrhinull.cpp
index 80f004e049..ea67f80138 100644
--- a/src/gui/rhi/qrhinull.cpp
+++ b/src/gui/rhi/qrhinull.cpp
@@ -67,13 +67,6 @@ QT_BEGIN_NAMESPACE
\brief Empty.
*/
-/*!
- \class QRhiNullTextureNativeHandles
- \internal
- \inmodule QtGui
- \brief Empty.
- */
-
QRhiNull::QRhiNull(QRhiNullInitParams *params)
: offscreenCommandBuffer(this)
{
@@ -638,9 +631,9 @@ bool QNullTexture::build()
return true;
}
-bool QNullTexture::buildFrom(const QRhiNativeHandles *src)
+bool QNullTexture::buildFrom(QRhiTexture::NativeTexture src)
{
- Q_UNUSED(src);
+ Q_UNUSED(src)
QRHI_RES_RHI(QRhiNull);
const bool isCube = m_flags.testFlag(CubeMap);
const bool hasMipMaps = m_flags.testFlag(MipMapped);
@@ -651,17 +644,6 @@ bool QNullTexture::buildFrom(const QRhiNativeHandles *src)
return true;
}
-bool QNullTexture::buildFrom(QRhiTexture::NativeTexture src)
-{
- Q_UNUSED(src)
- return buildFrom(nullptr);
-}
-
-const QRhiNativeHandles *QNullTexture::nativeHandles()
-{
- return &nativeHandlesStruct;
-}
-
QNullSampler::QNullSampler(QRhiImplementation *rhi, Filter magFilter, Filter minFilter, Filter mipmapMode,
AddressMode u, AddressMode v)
: QRhiSampler(rhi, magFilter, minFilter, mipmapMode, u, v)
diff --git a/src/gui/rhi/qrhinull_p.h b/src/gui/rhi/qrhinull_p.h
index 7d3ce5dbf1..dbf385555d 100644
--- a/src/gui/rhi/qrhinull_p.h
+++ b/src/gui/rhi/qrhinull_p.h
@@ -60,10 +60,6 @@ struct Q_GUI_EXPORT QRhiNullNativeHandles : public QRhiNativeHandles
{
};
-struct Q_GUI_EXPORT QRhiNullTextureNativeHandles : public QRhiNativeHandles
-{
-};
-
QT_END_NAMESPACE
#endif
diff --git a/src/gui/rhi/qrhinull_p_p.h b/src/gui/rhi/qrhinull_p_p.h
index 57c3de0418..f541fd90b8 100644
--- a/src/gui/rhi/qrhinull_p_p.h
+++ b/src/gui/rhi/qrhinull_p_p.h
@@ -80,11 +80,8 @@ struct QNullTexture : public QRhiTexture
~QNullTexture();
void release() override;
bool build() override;
- bool buildFrom(const QRhiNativeHandles *src) override;
bool buildFrom(NativeTexture src) override;
- const QRhiNativeHandles *nativeHandles() override;
- QRhiNullTextureNativeHandles nativeHandlesStruct;
QImage image[QRhi::MAX_LAYERS][QRhi::MAX_LEVELS];
};
diff --git a/src/gui/rhi/qrhivulkan.cpp b/src/gui/rhi/qrhivulkan.cpp
index 21ae142b1d..c5719b54aa 100644
--- a/src/gui/rhi/qrhivulkan.cpp
+++ b/src/gui/rhi/qrhivulkan.cpp
@@ -177,21 +177,6 @@ QT_BEGIN_NAMESPACE
*/
/*!
- \class QRhiVulkanTextureNativeHandles
- \internal
- \inmodule QtGui
- \brief Holds the Vulkan image object that is backing a QRhiTexture.
-
- Importing and exporting Vulkan image objects that back a QRhiTexture when
- running with the Vulkan backend is supported via this class. Ownership of
- the Vulkan object is never transferred.
-
- \note Memory allocation details are not exposed. This is intentional since
- memory is typically suballocated from a bigger chunk of VkDeviceMemory, and
- exposing the allocator details is not desirable for now.
- */
-
-/*!
\class QRhiVulkanCommandBufferNativeHandles
\internal
\inmodule QtGui
@@ -501,6 +486,17 @@ bool QRhiVulkan::create(QRhi::Flags flags)
}
}
+ QByteArrayList envExtList;
+ if (qEnvironmentVariableIsSet("QT_VULKAN_DEVICE_EXTENSIONS")) {
+ envExtList = qgetenv("QT_VULKAN_DEVICE_EXTENSIONS").split(';');
+ for (auto ext : requestedDevExts)
+ envExtList.removeAll(ext);
+ for (const QByteArray &ext : envExtList) {
+ if (!ext.isEmpty())
+ requestedDevExts.append(ext.constData());
+ }
+ }
+
VkDeviceCreateInfo devInfo;
memset(&devInfo, 0, sizeof(devInfo));
devInfo.sType = VK_STRUCTURE_TYPE_DEVICE_CREATE_INFO;
@@ -5187,7 +5183,6 @@ void QVkTexture::release()
image = VK_NULL_HANDLE;
imageView = VK_NULL_HANDLE;
imageAlloc = nullptr;
- nativeHandlesStruct.image = VK_NULL_HANDLE;
QRHI_RES_RHI(QRhiVulkan);
rhiD->releaseQueue.append(e);
@@ -5272,8 +5267,6 @@ bool QVkTexture::finishBuild()
return false;
}
- nativeHandlesStruct.image = image;
-
lastActiveFrameSlot = -1;
generation += 1;
@@ -5345,31 +5338,6 @@ bool QVkTexture::build()
return true;
}
-bool QVkTexture::buildFrom(const QRhiNativeHandles *src)
-{
- const QRhiVulkanTextureNativeHandles *h = static_cast<const QRhiVulkanTextureNativeHandles *>(src);
- if (!h || !h->image)
- return false;
-
- if (!prepareBuild())
- return false;
-
- image = h->image;
-
- if (!finishBuild())
- return false;
-
- QRHI_PROF;
- QRHI_PROF_F(newTexture(this, false, int(mipLevelCount), m_flags.testFlag(CubeMap) ? 6 : 1, samples));
-
- usageState.layout = h->layout;
-
- owns = false;
- QRHI_RES_RHI(QRhiVulkan);
- rhiD->registerResource(this);
- return true;
-}
-
bool QVkTexture::buildFrom(QRhiTexture::NativeTexture src)
{
auto *img = static_cast<const VkImage*>(src.object);
@@ -5395,15 +5363,9 @@ bool QVkTexture::buildFrom(QRhiTexture::NativeTexture src)
return true;
}
-const QRhiNativeHandles *QVkTexture::nativeHandles()
-{
- nativeHandlesStruct.layout = usageState.layout;
- return &nativeHandlesStruct;
-}
-
QRhiTexture::NativeTexture QVkTexture::nativeTexture()
{
- return {&nativeHandlesStruct.image, usageState.layout};
+ return {&image, usageState.layout};
}
VkImageView QVkTexture::imageViewForLevel(int level)
diff --git a/src/gui/rhi/qrhivulkan_p.h b/src/gui/rhi/qrhivulkan_p.h
index ff19c7a54e..d495919671 100644
--- a/src/gui/rhi/qrhivulkan_p.h
+++ b/src/gui/rhi/qrhivulkan_p.h
@@ -69,12 +69,6 @@ struct Q_GUI_EXPORT QRhiVulkanNativeHandles : public QRhiNativeHandles
void *vmemAllocator = nullptr;
};
-struct Q_GUI_EXPORT QRhiVulkanTextureNativeHandles : public QRhiNativeHandles
-{
- VkImage image = VK_NULL_HANDLE;
- VkImageLayout layout = VK_IMAGE_LAYOUT_GENERAL;
-};
-
struct Q_GUI_EXPORT QRhiVulkanCommandBufferNativeHandles : public QRhiNativeHandles
{
VkCommandBuffer commandBuffer = VK_NULL_HANDLE;
diff --git a/src/gui/rhi/qrhivulkan_p_p.h b/src/gui/rhi/qrhivulkan_p_p.h
index d1b77870a1..9f18d0bf5e 100644
--- a/src/gui/rhi/qrhivulkan_p_p.h
+++ b/src/gui/rhi/qrhivulkan_p_p.h
@@ -120,9 +120,7 @@ struct QVkTexture : public QRhiTexture
~QVkTexture();
void release() override;
bool build() override;
- bool buildFrom(const QRhiNativeHandles *src) override;
bool buildFrom(NativeTexture src) override;
- const QRhiNativeHandles *nativeHandles() override;
NativeTexture nativeTexture() override;
bool prepareBuild(QSize *adjustedSize = nullptr);
@@ -136,7 +134,6 @@ struct QVkTexture : public QRhiTexture
QVkAlloc stagingAllocations[QVK_FRAMES_IN_FLIGHT];
VkImageView perLevelImageViews[QRhi::MAX_LEVELS];
bool owns = true;
- QRhiVulkanTextureNativeHandles nativeHandlesStruct;
struct UsageState {
// no tracking of subresource layouts (some operations can keep
// subresources in different layouts for some time, but that does not
diff --git a/src/gui/text/qtextdocument.cpp b/src/gui/text/qtextdocument.cpp
index f2caedc25f..fb75954d9c 100644
--- a/src/gui/text/qtextdocument.cpp
+++ b/src/gui/text/qtextdocument.cpp
@@ -2297,6 +2297,17 @@ QTextHtmlExporter::QTextHtmlExporter(const QTextDocument *_doc)
defaultCharFormat.clearProperty(QTextFormat::TextUnderlineStyle);
}
+static QStringList resolvedFontFamilies(const QTextCharFormat &format)
+{
+ QStringList fontFamilies = format.fontFamilies().toStringList();
+ const QString mainFontFamily = format.fontFamily();
+ if (!mainFontFamily.isEmpty() && !fontFamilies.startsWith(mainFontFamily)) {
+ fontFamilies.removeAll(mainFontFamily);
+ fontFamilies.prepend(mainFontFamily);
+ }
+ return fontFamilies;
+}
+
/*!
Returns the document in HTML format. The conversion may not be
perfect, especially for complex documents, due to the limitations
@@ -2325,11 +2336,7 @@ QString QTextHtmlExporter::toHtml(const QByteArray &encoding, ExportMode mode)
if (mode == ExportEntireDocument) {
html += QLatin1String(" style=\"");
- QStringList fontFamilies = defaultCharFormat.fontFamilies().toStringList();
- if (!fontFamilies.isEmpty())
- emitFontFamily(fontFamilies);
- else
- emitFontFamily(defaultCharFormat.fontFamily());
+ emitFontFamily(resolvedFontFamilies(defaultCharFormat));
if (defaultCharFormat.hasProperty(QTextFormat::FontPointSize)) {
html += QLatin1String(" font-size:");
@@ -2391,14 +2398,10 @@ bool QTextHtmlExporter::emitCharFormatStyle(const QTextCharFormat &format)
bool attributesEmitted = false;
{
- const QStringList families = format.fontFamilies().toStringList();
- const QString family = format.fontFamily();
- if (!families.isEmpty() && families != defaultCharFormat.fontFamilies().toStringList()) {
+ const QStringList families = resolvedFontFamilies(format);
+ if (!families.isEmpty() && families != resolvedFontFamilies(defaultCharFormat)) {
emitFontFamily(families);
attributesEmitted = true;
- } else if (!family.isEmpty() && family != defaultCharFormat.fontFamily()) {
- emitFontFamily(family);
- attributesEmitted = true;
}
}
@@ -2661,20 +2664,6 @@ void QTextHtmlExporter::emitPageBreakPolicy(QTextFormat::PageBreakFlags policy)
html += QLatin1String(" page-break-after:always;");
}
-void QTextHtmlExporter::emitFontFamily(const QString &family)
-{
- html += QLatin1String(" font-family:");
-
- QLatin1String quote("\'");
- if (family.contains(QLatin1Char('\'')))
- quote = QLatin1String("&quot;");
-
- html += quote;
- html += family.toHtmlEscaped();
- html += quote;
- html += QLatin1Char(';');
-}
-
void QTextHtmlExporter::emitFontFamily(const QStringList &families)
{
html += QLatin1String(" font-family:");
diff --git a/src/gui/text/qtextdocument_p.h b/src/gui/text/qtextdocument_p.h
index 94c67b3264..ce8e905eb0 100644
--- a/src/gui/text/qtextdocument_p.h
+++ b/src/gui/text/qtextdocument_p.h
@@ -396,7 +396,6 @@ private:
void emitBorderStyle(QTextFrameFormat::BorderStyle style);
void emitPageBreakPolicy(QTextFormat::PageBreakFlags policy);
- void emitFontFamily(const QString &family);
void emitFontFamily(const QStringList &families);
void emitBackgroundAttribute(const QTextFormat &format);
diff --git a/src/gui/vulkan/qvulkanwindow.cpp b/src/gui/vulkan/qvulkanwindow.cpp
index ed73a77683..e211863f21 100644
--- a/src/gui/vulkan/qvulkanwindow.cpp
+++ b/src/gui/vulkan/qvulkanwindow.cpp
@@ -689,6 +689,15 @@ void QVulkanWindowPrivate::init()
QVulkanInfoVector<QVulkanExtension> supportedExtensions = q->supportedDeviceExtensions();
QByteArrayList reqExts = requestedDevExtensions;
reqExts.append("VK_KHR_swapchain");
+
+ QByteArray envExts = qgetenv("QT_VULKAN_DEVICE_EXTENSIONS");
+ if (!envExts.isEmpty()) {
+ QByteArrayList envExtList = envExts.split(';');
+ for (auto ext : reqExts)
+ envExtList.removeAll(ext);
+ reqExts.append(envExtList);
+ }
+
for (const QByteArray &ext : reqExts) {
if (supportedExtensions.contains(ext))
devExts.append(ext.constData());
diff --git a/src/network/kernel/qhostinfo.cpp b/src/network/kernel/qhostinfo.cpp
index 31671feece..6476ff7741 100644
--- a/src/network/kernel/qhostinfo.cpp
+++ b/src/network/kernel/qhostinfo.cpp
@@ -595,7 +595,7 @@ QHostInfo::QHostInfo(const QHostInfo &other)
}
/*!
- \fn QHostInfo(QHostInfo &&other)
+ \fn QHostInfo::QHostInfo(QHostInfo &&other)
Move-constructs a new QHostInfo from \a other.
diff --git a/src/platformsupport/kmsconvenience/qkmsdevice.cpp b/src/platformsupport/kmsconvenience/qkmsdevice.cpp
index 7171908c99..8cd7f9b368 100644
--- a/src/platformsupport/kmsconvenience/qkmsdevice.cpp
+++ b/src/platformsupport/kmsconvenience/qkmsdevice.cpp
@@ -262,7 +262,7 @@ QPlatformScreen *QKmsDevice::createScreenForConnector(drmModeResPtr resources,
// Get the current mode on the current crtc
drmModeModeInfo crtc_mode;
memset(&crtc_mode, 0, sizeof crtc_mode);
- if (drmModeEncoderPtr encoder = drmModeGetEncoder(m_dri_fd, connector->connector_id)) {
+ if (drmModeEncoderPtr encoder = drmModeGetEncoder(m_dri_fd, connector->encoder_id)) {
drmModeCrtcPtr crtc = drmModeGetCrtc(m_dri_fd, encoder->crtc_id);
drmModeFreeEncoder(encoder);
diff --git a/src/platformsupport/vkconvenience/qbasicvulkanplatforminstance.cpp b/src/platformsupport/vkconvenience/qbasicvulkanplatforminstance.cpp
index 68340a3173..6f6ba58319 100644
--- a/src/platformsupport/vkconvenience/qbasicvulkanplatforminstance.cpp
+++ b/src/platformsupport/vkconvenience/qbasicvulkanplatforminstance.cpp
@@ -214,6 +214,22 @@ void QBasicPlatformVulkanInstance::initInstance(QVulkanInstance *instance, const
for (const QByteArray &ext : extraExts)
m_enabledExtensions.append(ext);
+ QByteArray envExts = qgetenv("QT_VULKAN_INSTANCE_EXTENSIONS");
+ if (!envExts.isEmpty()) {
+ QByteArrayList envExtList = envExts.split(';');
+ for (auto ext : m_enabledExtensions)
+ envExtList.removeAll(ext);
+ m_enabledExtensions.append(envExtList);
+ }
+
+ QByteArray envLayers = qgetenv("QT_VULKAN_INSTANCE_LAYERS");
+ if (!envLayers.isEmpty()) {
+ QByteArrayList envLayerList = envLayers.split(';');
+ for (auto ext : m_enabledLayers)
+ envLayerList.removeAll(ext);
+ m_enabledLayers.append(envLayerList);
+ }
+
// No clever stuff with QSet and friends: the order for layers matters
// and the user-provided order must be kept.
for (int i = 0; i < m_enabledLayers.count(); ++i) {
diff --git a/src/plugins/imageformats/ico/qicohandler.cpp b/src/plugins/imageformats/ico/qicohandler.cpp
index 6515748bf5..eb50f52bd6 100644
--- a/src/plugins/imageformats/ico/qicohandler.cpp
+++ b/src/plugins/imageformats/ico/qicohandler.cpp
@@ -535,8 +535,6 @@ QImage ICOReader::iconAt(int index)
if (!mask.isNull()) {
img = image;
img.setAlphaChannel(mask);
- // (Luckily, it seems that setAlphaChannel() does not ruin the alpha values
- // of partially transparent pixels in those icons that have that)
}
}
}
diff --git a/src/plugins/platforms/cocoa/qcocoabackingstore.mm b/src/plugins/platforms/cocoa/qcocoabackingstore.mm
index 8a815a7665..2e15d11564 100644
--- a/src/plugins/platforms/cocoa/qcocoabackingstore.mm
+++ b/src/plugins/platforms/cocoa/qcocoabackingstore.mm
@@ -617,8 +617,10 @@ QImage QCALayerBackingStore::toImage() const
void QCALayerBackingStore::backingPropertiesChanged()
{
qCDebug(lcQpaBackingStore) << "Updating color space of existing buffers";
- for (auto &buffer : m_buffers)
- buffer->setColorSpace(colorSpace());
+ for (auto &buffer : m_buffers) {
+ if (buffer)
+ buffer->setColorSpace(colorSpace());
+ }
}
QPlatformGraphicsBuffer *QCALayerBackingStore::graphicsBuffer() const
diff --git a/src/plugins/platforms/cocoa/qcocoaintegration.mm b/src/plugins/platforms/cocoa/qcocoaintegration.mm
index 88a5c7dcf3..a77b97f538 100644
--- a/src/plugins/platforms/cocoa/qcocoaintegration.mm
+++ b/src/plugins/platforms/cocoa/qcocoaintegration.mm
@@ -406,8 +406,6 @@ QVariant QCocoaIntegration::styleHint(StyleHint hint) const
return QCoreTextFontEngine::fontSmoothingGamma();
case ShowShortcutsInContextMenus:
return QVariant(false);
- // case CursorFlashTime:
- // return 50000;
default: break;
}
diff --git a/src/plugins/platforms/cocoa/qiosurfacegraphicsbuffer.mm b/src/plugins/platforms/cocoa/qiosurfacegraphicsbuffer.mm
index 285e316d4a..fc187e0f51 100644
--- a/src/plugins/platforms/cocoa/qiosurfacegraphicsbuffer.mm
+++ b/src/plugins/platforms/cocoa/qiosurfacegraphicsbuffer.mm
@@ -89,9 +89,16 @@ QIOSurfaceGraphicsBuffer::~QIOSurfaceGraphicsBuffer()
void QIOSurfaceGraphicsBuffer::setColorSpace(QCFType<CGColorSpaceRef> colorSpace)
{
- Q_ASSERT(colorSpace);
- IOSurfaceSetValue(m_surface, CFSTR("IOSurfaceColorSpace"),
- QCFType<CFPropertyListRef>(CGColorSpaceCopyPropertyList(colorSpace)));
+ static const auto kIOSurfaceColorSpace = CFSTR("IOSurfaceColorSpace");
+
+ qCDebug(lcQpaIOSurface) << "Tagging" << this << "with color space" << colorSpace;
+
+ if (colorSpace) {
+ IOSurfaceSetValue(m_surface, kIOSurfaceColorSpace,
+ QCFType<CFPropertyListRef>(CGColorSpaceCopyPropertyList(colorSpace)));
+ } else {
+ IOSurfaceRemoveValue(m_surface, kIOSurfaceColorSpace);
+ }
}
const uchar *QIOSurfaceGraphicsBuffer::data() const
diff --git a/src/printsupport/dialogs/qabstractprintdialog.cpp b/src/printsupport/dialogs/qabstractprintdialog.cpp
index 1a2aa7afac..b0d03037e6 100644
--- a/src/printsupport/dialogs/qabstractprintdialog.cpp
+++ b/src/printsupport/dialogs/qabstractprintdialog.cpp
@@ -344,13 +344,6 @@ void QAbstractPrintDialogPrivate::setPrinter(QPrinter *newPrinter)
}
/*!
- \fn int QAbstractPrintDialog::exec()
-
- This virtual function is called to pop up the dialog. It must be
- reimplemented in subclasses.
-*/
-
-/*!
\class QPrintDialog
\brief The QPrintDialog class provides a dialog for specifying
diff --git a/src/testlib/doc/src/qttest-best-practices.qdoc b/src/testlib/doc/src/qttest-best-practices.qdoc
index 8ad67acce6..952fd3259d 100644
--- a/src/testlib/doc/src/qttest-best-practices.qdoc
+++ b/src/testlib/doc/src/qttest-best-practices.qdoc
@@ -243,7 +243,7 @@
Instead of \c Q_ASSERT, the \l QCOMPARE() or \l QVERIFY() macro variants
should be used. They cause the current test to report a failure and
terminate, but allow the remaining test functions to be executed and the
- entire test program to terminate normally. \l Q_VERIFY2() even allows a
+ entire test program to terminate normally. \l QVERIFY2() even allows a
descriptive error message to be recorded in the test log.
\section1 Writing Reliable Tests
diff --git a/src/testlib/qsignalspy.qdoc b/src/testlib/qsignalspy.qdoc
index d532ad478d..d40c84907c 100644
--- a/src/testlib/qsignalspy.qdoc
+++ b/src/testlib/qsignalspy.qdoc
@@ -98,7 +98,7 @@
\snippet code/doc_src_qsignalspy.cpp 6
*/
-/*! \fn QSignalSpy(const QObject *obj, const QMetaMethod &signal)
+/*! \fn QSignalSpy::QSignalSpy(const QObject *obj, const QMetaMethod &signal)
\since 5.14
Constructs a new QSignalSpy that listens for emissions of the \a signal
diff --git a/src/tools/uic/cpp/cppwriteinitialization.cpp b/src/tools/uic/cpp/cppwriteinitialization.cpp
index 8a8c5610af..5290abf9f6 100644
--- a/src/tools/uic/cpp/cppwriteinitialization.cpp
+++ b/src/tools/uic/cpp/cppwriteinitialization.cpp
@@ -731,7 +731,7 @@ void WriteInitialization::acceptWidget(DomWidget *node)
if (const DomProperty *picon = attributes.value(QLatin1String("icon")))
icon = QLatin1String(", ") + iconCall(picon); // Side effect: Writes icon definition
m_output << m_indent << parentWidget << language::derefPointer << "addTab("
- << varName << icon << ", " << "QString())" << language::eol;
+ << varName << icon << ", " << language::emptyString << ')' << language::eol;
autoTrOutput(ptitleString, pageDefaultString) << m_indent << parentWidget
<< language::derefPointer << "setTabText(" << parentWidget
@@ -1612,7 +1612,7 @@ QString WriteInitialization::writeFontProperties(const DomFont *f)
}
if (f->hasElementWeight() && f->elementWeight() > 0) {
m_output << m_indent << fontName << ".setWeight("
- << f->elementWeight() << ");" << Qt::endl;
+ << f->elementWeight() << ")" << language::eol;
}
if (f->hasElementStrikeOut()) {
m_output << m_indent << fontName << ".setStrikeOut("
@@ -2086,7 +2086,7 @@ void WriteInitialization::initializeComboBox(DomWidget *w)
m_output << iconValue << ", ";
if (needsTranslation(text->elementString())) {
- m_output << "QString())" << language::eol;
+ m_output << language::emptyString << ')' << language::eol;
m_refreshOut << m_indent << varName << language::derefPointer
<< "setItemText(" << i << ", " << trCall(text->elementString())
<< ')' << language::eol;
@@ -2288,7 +2288,7 @@ void WriteInitialization::initializeTreeWidget(DomWidget *w)
if (str && str->text().isEmpty()) {
m_output << m_indent << varName << language::derefPointer
<< "headerItem()" << language::derefPointer << "setText("
- << i << ", QString())" << language::eol;
+ << i << ", " << language::emptyString << ')' << language::eol;
}
}
}
@@ -2372,9 +2372,11 @@ void WriteInitialization::initializeTableWidget(DomWidget *w)
const auto &columns = w->elementColumn();
if (!columns.empty()) {
- m_output << m_indent << "if (" << varName << language::derefPointer << "columnCount() < "
- << columns.size() << ")\n"
- << m_dindent << varName << language::derefPointer << "setColumnCount("
+ m_output << m_indent << "if (" << varName << language::derefPointer
+ << "columnCount() < " << columns.size() << ')';
+ if (language::language() == Language::Python)
+ m_output << ':';
+ m_output << '\n' << m_dindent << varName << language::derefPointer << "setColumnCount("
<< columns.size() << ')' << language::eol;
}
@@ -2400,8 +2402,11 @@ void WriteInitialization::initializeTableWidget(DomWidget *w)
const auto &rows = w->elementRow();
if (!rows.isEmpty()) {
- m_output << m_indent << "if (" << varName << language::derefPointer << "rowCount() < " << rows.size() << ")\n"
- << m_dindent << varName << language::derefPointer << "setRowCount("
+ m_output << m_indent << "if (" << varName << language::derefPointer
+ << "rowCount() < " << rows.size() << ')';
+ if (language::language() == Language::Python)
+ m_output << ':';
+ m_output << '\n' << m_dindent << varName << language::derefPointer << "setRowCount("
<< rows.size() << ')' << language::eol;
}
@@ -2451,10 +2456,8 @@ void WriteInitialization::initializeTableWidget(DomWidget *w)
QString WriteInitialization::trCall(const QString &str, const QString &commentHint, const QString &id) const
{
- if (str.isEmpty()) {
- return language::language() == Language::Cpp
- ? QLatin1String("QString()") : QLatin1String("\"\"");
- }
+ if (str.isEmpty())
+ return language::emptyString;
QString result;
QTextStream ts(&result);
diff --git a/src/tools/uic/main.cpp b/src/tools/uic/main.cpp
index 853538479f..6f342fb398 100644
--- a/src/tools/uic/main.cpp
+++ b/src/tools/uic/main.cpp
@@ -104,6 +104,10 @@ int runUic(int argc, char *argv[])
idBasedOption.setDescription(QStringLiteral("Use id based function for i18n"));
parser.addOption(idBasedOption);
+ QCommandLineOption fromImportsOption(QStringLiteral("from-imports"));
+ fromImportsOption.setDescription(QStringLiteral("Python: generate imports relative to '.'"));
+ parser.addOption(fromImportsOption);
+
parser.addPositionalArgument(QStringLiteral("[uifile]"), QStringLiteral("Input file (*.ui), otherwise stdin."));
parser.process(app);
@@ -114,6 +118,7 @@ int runUic(int argc, char *argv[])
driver.option().headerProtection = !parser.isSet(noProtOption);
driver.option().implicitIncludes = !parser.isSet(noImplicitIncludesOption);
driver.option().idBased = parser.isSet(idBasedOption);
+ driver.option().fromImports = parser.isSet(fromImportsOption);
driver.option().postfix = parser.value(postfixOption);
driver.option().translateFunction = parser.value(translateOption);
driver.option().includeFile = parser.value(includeOption);
diff --git a/src/tools/uic/option.h b/src/tools/uic/option.h
index 4fc442e94a..8e882079c9 100644
--- a/src/tools/uic/option.h
+++ b/src/tools/uic/option.h
@@ -45,6 +45,7 @@ struct Option
unsigned int limitXPM_LineLength : 1;
unsigned int implicitIncludes: 1;
unsigned int idBased: 1;
+ unsigned int fromImports: 1;
QString inputFile;
QString outputFile;
@@ -65,6 +66,7 @@ struct Option
limitXPM_LineLength(0),
implicitIncludes(1),
idBased(0),
+ fromImports(0),
prefix(QLatin1String("Ui_"))
{ indent.fill(QLatin1Char(' '), 4); }
diff --git a/src/tools/uic/python/pythonwriteimports.cpp b/src/tools/uic/python/pythonwriteimports.cpp
index 303615f77b..be55696683 100644
--- a/src/tools/uic/python/pythonwriteimports.cpp
+++ b/src/tools/uic/python/pythonwriteimports.cpp
@@ -29,6 +29,7 @@
#include "pythonwriteimports.h"
#include <customwidgetsinfo.h>
+#include <option.h>
#include <uic.h>
#include <ui4.h>
@@ -46,6 +47,20 @@ from PySide2.QtGui import (QBrush, QColor, QConicalGradient, QFont,
from PySide2.QtWidgets import *
)I";
+// Change the name of a qrc file "dir/foo.qrc" file to the Python
+// module name "foo_rc" according to project conventions.
+static QString pythonResource(QString resource)
+{
+ const int lastSlash = resource.lastIndexOf(QLatin1Char('/'));
+ if (lastSlash != -1)
+ resource.remove(0, lastSlash + 1);
+ if (resource.endsWith(QLatin1String(".qrc"))) {
+ resource.chop(4);
+ resource.append(QLatin1String("_rc"));
+ }
+ return resource;
+}
+
namespace Python {
WriteImports::WriteImports(Uic *uic) : m_uic(uic)
@@ -60,6 +75,23 @@ void WriteImports::acceptUI(DomUI *node)
TreeWalker::acceptCustomWidgets(customWidgets);
output << '\n';
}
+
+ if (auto resources = node->elementResources()) {
+ const auto includes = resources->elementInclude();
+ for (auto include : includes) {
+ if (include->hasAttributeLocation())
+ writeImport(pythonResource(include->attributeLocation()));
+ }
+ output << '\n';
+ }
+}
+
+void WriteImports::writeImport(const QString &module)
+{
+
+ if (m_uic->option().fromImports)
+ m_uic->output() << "from . ";
+ m_uic->output() << "import " << module << '\n';
}
QString WriteImports::qtModuleOf(const DomCustomWidget *node) const
diff --git a/src/tools/uic/python/pythonwriteimports.h b/src/tools/uic/python/pythonwriteimports.h
index 427cbb48b1..5462453962 100644
--- a/src/tools/uic/python/pythonwriteimports.h
+++ b/src/tools/uic/python/pythonwriteimports.h
@@ -46,6 +46,7 @@ public:
void acceptCustomWidget(DomCustomWidget *node) override;
private:
+ void writeImport(const QString &module);
QString qtModuleOf(const DomCustomWidget *node) const;
Uic *const m_uic;
diff --git a/src/tools/uic/shared/language.cpp b/src/tools/uic/shared/language.cpp
index 235a8ed2fc..987d51e30c 100644
--- a/src/tools/uic/shared/language.cpp
+++ b/src/tools/uic/shared/language.cpp
@@ -49,6 +49,7 @@ void setLanguage(Language l)
qualifier = QLatin1String("::");
self = QLatin1String(""); // for testing: change to "this->";
eol = QLatin1String(";\n");
+ emptyString = QLatin1String("QString()");
encoding = Encoding::Utf8;
break;
case Language::Python:
@@ -59,6 +60,7 @@ void setLanguage(Language l)
qualifier = QLatin1String(".");
self = QLatin1String("self.");
eol = QLatin1String("\n");
+ emptyString = QLatin1String("\"\"");
encoding = Encoding::Unicode;
break;
}
@@ -71,6 +73,7 @@ QString qtQualifier;
QString qualifier;
QString self;
QString eol;
+QString emptyString;
QString cppQualifier = QLatin1String("::");
QString cppTrue = QLatin1String("true");
diff --git a/src/tools/uic/shared/language.h b/src/tools/uic/shared/language.h
index fc8af9715b..7b019ec8fc 100644
--- a/src/tools/uic/shared/language.h
+++ b/src/tools/uic/shared/language.h
@@ -49,6 +49,7 @@ extern QString qtQualifier;
extern QString qualifier;
extern QString self;
extern QString eol;
+extern QString emptyString;
extern QString cppQualifier;
extern QString cppTrue;
diff --git a/src/widgets/styles/qstyleoption.cpp b/src/widgets/styles/qstyleoption.cpp
index 4b861d938e..5a2ca2f2e7 100644
--- a/src/widgets/styles/qstyleoption.cpp
+++ b/src/widgets/styles/qstyleoption.cpp
@@ -1470,6 +1470,22 @@ QStyleOptionTab::QStyleOptionTab(int version)
The default value is QSize(-1, -1), i.e. an invalid size;
*/
+/*!
+ Constructs a QStyleOptionTabV4 object, initializing the members
+ variables to their default values.
+ */
+
+QStyleOptionTabV4::QStyleOptionTabV4() : QStyleOptionTab(QStyleOptionTabV4::Version)
+{
+}
+
+/*!
+ \variable QStyleOptionTabV4::tabIndex
+ \brief the index for the tab being represented.
+
+ The default value is -1, i.e. a tab not on a tabbar;
+ */
+
#endif // QT_CONFIG(tabbar)
/*!
diff --git a/src/widgets/styles/qstyleoption.h b/src/widgets/styles/qstyleoption.h
index 7f5edf4279..a8ce3b465e 100644
--- a/src/widgets/styles/qstyleoption.h
+++ b/src/widgets/styles/qstyleoption.h
@@ -296,6 +296,14 @@ protected:
QStyleOptionTab(int version);
};
+class Q_WIDGETS_EXPORT QStyleOptionTabV4 : public QStyleOptionTab
+{
+public:
+ enum StyleOptionVersion { Version = 4 };
+ QStyleOptionTabV4();
+ int tabIndex = -1;
+};
+
Q_DECLARE_OPERATORS_FOR_FLAGS(QStyleOptionTab::CornerWidgets)
typedef Q_DECL_DEPRECATED QStyleOptionTab QStyleOptionTabV2;
diff --git a/src/widgets/styles/qstylesheetstyle.cpp b/src/widgets/styles/qstylesheetstyle.cpp
index 7e8c9a6050..2eccb24431 100644
--- a/src/widgets/styles/qstylesheetstyle.cpp
+++ b/src/widgets/styles/qstylesheetstyle.cpp
@@ -3027,6 +3027,7 @@ void QStyleSheetStyle::drawComplexControl(ComplexControl cc, const QStyleOptionC
r = positionRect(w, subRule, subRule2, PseudoElement_ComboBoxArrow, r, opt->direction);
subRule2.drawRule(p, r);
} else {
+ rule.configurePalette(&cmbOpt.palette, QPalette::ButtonText, QPalette::Button);
cmbOpt.subControls = QStyle::SC_ComboBoxArrow;
QWindowsStyle::drawComplexControl(cc, &cmbOpt, p, w);
}
@@ -6009,6 +6010,16 @@ QRect QStyleSheetStyle::subElementRect(SubElement se, const QStyleOption *opt, c
case SE_TabBarTabRightButton: {
QRenderRule subRule = renderRule(w, opt, PseudoElement_TabBarTab);
if (subRule.hasBox() || !subRule.hasNativeBorder()) {
+ if (se == SE_TabBarTabText) {
+ if (const QStyleOptionTabV4 *tab = qstyleoption_cast<const QStyleOptionTabV4 *>(opt)) {
+ const QTabBar *bar = qobject_cast<const QTabBar *>(w);
+ const QRect optRect = bar && tab->tabIndex != -1 ? bar->tabRect(tab->tabIndex) : opt->rect;
+ const QRect r = positionRect(w, subRule, PseudoElement_TabBarTab, optRect, opt->direction);
+ QStyleOptionTabV4 tabCopy(*tab);
+ tabCopy.rect = subRule.contentsRect(r);
+ return ParentStyle::subElementRect(se, &tabCopy, w);
+ }
+ }
return ParentStyle::subElementRect(se, opt, w);
}
break;
diff --git a/src/widgets/widgets/qdatetimeedit.cpp b/src/widgets/widgets/qdatetimeedit.cpp
index 33300b542a..00fe0cd776 100644
--- a/src/widgets/widgets/qdatetimeedit.cpp
+++ b/src/widgets/widgets/qdatetimeedit.cpp
@@ -341,7 +341,6 @@ void QDateTimeEdit::setCalendar(QCalendar calendar)
/*!
\since 4.4
\property QDateTimeEdit::minimumDateTime
-
\brief the minimum datetime of the date time edit
Changing this property implicitly updates the \l minimumDate and \l
@@ -643,8 +642,8 @@ void QDateTimeEdit::setDateRange(const QDate &min, const QDate &max)
Note that these only constrain the date time edit's value on,
respectively, the \l minimumDate and \l maximumDate. When these date
- properties do not coincide, times after \a maximumTime are allowed on dates
- before \l maximumDate and times before \a minimumTime are allowed on dates
+ properties do not coincide, times after \a max are allowed on dates
+ before \l maximumDate and times before \a min are allowed on dates
after \l minimumDate.
\snippet code/src_gui_widgets_qdatetimeedit.cpp 5
@@ -655,7 +654,7 @@ void QDateTimeEdit::setDateRange(const QDate &min, const QDate &max)
If either \a min or \a max is invalid, this function does nothing. This
function preserves the \l minimumDate and \l maximumDate properties. If those
- properties coincide and max is \a less than \a min, \a min is used as \a max.
+ properties coincide and \a max is less than \a min, \a min is used as \a max.
\sa minimumTime, maximumTime, setDateTimeRange(), QTime::isValid()
*/
diff --git a/src/widgets/widgets/qplaintextedit.cpp b/src/widgets/widgets/qplaintextedit.cpp
index 0bfaa767c6..d54c0d0b20 100644
--- a/src/widgets/widgets/qplaintextedit.cpp
+++ b/src/widgets/widgets/qplaintextedit.cpp
@@ -839,7 +839,8 @@ void QPlainTextEditPrivate::_q_textChanged()
placeholderVisible = !placeholderText.isEmpty()
&& q->document()->isEmpty()
- && q->firstVisibleBlock().layout()->preeditAreaText().isEmpty();
+ && (!q->firstVisibleBlock().isValid() ||
+ q->firstVisibleBlock().layout()->preeditAreaText().isEmpty());
if (placeholderCurrentyVisible != placeholderVisible)
viewport->update();
diff --git a/src/widgets/widgets/qtabbar.cpp b/src/widgets/widgets/qtabbar.cpp
index aff95b0931..a7b115a1bc 100644
--- a/src/widgets/widgets/qtabbar.cpp
+++ b/src/widgets/widgets/qtabbar.cpp
@@ -229,6 +229,8 @@ void QTabBarPrivate::initBasicStyleOption(QStyleOptionTab *option, int tabIndex)
option->cornerWidgets |= QStyleOptionTab::RightCornerWidget;
}
#endif
+ if (QStyleOptionTabV4 *optv4 = qstyleoption_cast<QStyleOptionTabV4 *>(option))
+ optv4->tabIndex = tabIndex;
}
/*!
@@ -628,7 +630,7 @@ QRect QTabBarPrivate::normalizedScrollRect(int index)
// tab bar itself is in a different orientation.
Q_Q(QTabBar);
- QStyleOptionTab opt;
+ QStyleOptionTabV4 opt;
q->initStyleOption(&opt, currentIndex);
opt.rect = q->rect();
@@ -757,7 +759,7 @@ void QTabBarPrivate::layoutTab(int index)
if (!(tab.leftWidget || tab.rightWidget))
return;
- QStyleOptionTab opt;
+ QStyleOptionTabV4 opt;
q->initStyleOption(&opt, index);
if (tab.leftWidget) {
QRect rect = q->style()->subElementRect(QStyle::SE_TabBarTabLeftButton, &opt, q);
@@ -1003,7 +1005,7 @@ int QTabBar::insertTab(int index, const QIcon& icon, const QString &text)
}
if (d->closeButtonOnTabs) {
- QStyleOptionTab opt;
+ QStyleOptionTabV4 opt;
initStyleOption(&opt, index);
ButtonPosition closeSide = (ButtonPosition)style()->styleHint(QStyle::SH_TabBar_CloseButtonPosition, nullptr, this);
QAbstractButton *closeButton = new CloseButton(this);
@@ -1574,7 +1576,7 @@ QSize QTabBar::tabSizeHint(int index) const
//Note: this must match with the computations in QCommonStylePrivate::tabLayout
Q_D(const QTabBar);
if (const QTabBarPrivate::Tab *tab = d->at(index)) {
- QStyleOptionTab opt;
+ QStyleOptionTabV4 opt;
d->initBasicStyleOption(&opt, index);
opt.text = d->tabList.at(index).text;
QSize iconSize = tab->icon.isNull() ? QSize(0, 0) : opt.iconSize;
@@ -1819,7 +1821,7 @@ void QTabBar::paintEvent(QPaintEvent *)
for (int i = 0; i < d->tabList.count(); ++i) {
if (!d->at(i)->visible)
continue;
- QStyleOptionTab tab;
+ QStyleOptionTabV4 tab;
initStyleOption(&tab, i);
if (d->paintWithOffsets && d->tabList[i].dragOffset != 0) {
if (vertical) {
@@ -1859,7 +1861,7 @@ void QTabBar::paintEvent(QPaintEvent *)
// Draw the selected tab last to get it "on top"
if (selected >= 0) {
- QStyleOptionTab tab;
+ QStyleOptionTabV4 tab;
initStyleOption(&tab, selected);
if (d->paintWithOffsets && d->tabList[selected].dragOffset != 0) {
if (vertical)
@@ -2209,7 +2211,7 @@ void QTabBarPrivate::setupMovableTab()
grabImage.fill(Qt::transparent);
QStylePainter p(&grabImage, q);
- QStyleOptionTab tab;
+ QStyleOptionTabV4 tab;
q->initStyleOption(&tab, pressedIndex);
tab.position = QStyleOptionTab::OnlyOneTab;
if (verticalTabs(shape))
diff --git a/src/xml/dom/qdom.cpp b/src/xml/dom/qdom.cpp
index 1f70d7b602..90e97f512c 100644
--- a/src/xml/dom/qdom.cpp
+++ b/src/xml/dom/qdom.cpp
@@ -5691,6 +5691,10 @@ void QDomDocumentPrivate::clear()
QDomNodePrivate::clear();
}
+#if QT_DEPRECATED_SINCE(5, 15)
+
+QT_WARNING_PUSH
+QT_WARNING_DISABLE_DEPRECATED
static void initializeReader(QXmlSimpleReader &reader, bool namespaceProcessing)
{
reader.setFeature(QLatin1String("http://xml.org/sax/features/namespaces"), namespaceProcessing);
@@ -5734,6 +5738,9 @@ bool QDomDocumentPrivate::setContent(QXmlInputSource *source, QXmlReader *reader
return true;
}
+QT_WARNING_POP
+
+#endif // QT_DEPRECATED_SINCE(5, 15)
bool QDomDocumentPrivate::setContent(QXmlStreamReader *reader, bool namespaceProcessing,
QString *errorMsg, int *errorLine, int *errorColumn)
@@ -6183,8 +6190,11 @@ bool QDomDocument::setContent(const QString& text, bool namespaceProcessing, QSt
if (!impl)
impl = new QDomDocumentPrivate();
-#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
+#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) && QT_DEPRECATED_SINCE(5, 15)
+QT_WARNING_PUSH
+QT_WARNING_DISABLE_DEPRECATED
QXmlInputSource source;
+QT_WARNING_POP
source.setData(text);
return IMPL->setContent(&source, namespaceProcessing, errorMsg, errorLine, errorColumn);
#else
@@ -6252,10 +6262,13 @@ bool QDomDocument::setContent(const QByteArray &data, bool namespaceProcessing,
if (!impl)
impl = new QDomDocumentPrivate();
-#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
+#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) && QT_DEPRECATED_SINCE(5, 15)
QBuffer buf;
buf.setData(data);
+QT_WARNING_PUSH
+QT_WARNING_DISABLE_DEPRECATED
QXmlInputSource source(&buf);
+QT_WARNING_POP
return IMPL->setContent(&source, namespaceProcessing, errorMsg, errorLine, errorColumn);
#else
QXmlStreamReader streamReader(data);
@@ -6275,8 +6288,11 @@ bool QDomDocument::setContent(QIODevice* dev, bool namespaceProcessing, QString
if (!impl)
impl = new QDomDocumentPrivate();
-#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
+#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) && QT_DEPRECATED_SINCE(5, 15)
+QT_WARNING_PUSH
+QT_WARNING_DISABLE_DEPRECATED
QXmlInputSource source(dev);
+QT_WARNING_POP
return IMPL->setContent(&source, namespaceProcessing, errorMsg, errorLine, errorColumn);
#else
QXmlStreamReader streamReader(dev);
@@ -6285,14 +6301,18 @@ bool QDomDocument::setContent(QIODevice* dev, bool namespaceProcessing, QString
#endif
}
+#if QT_DEPRECATED_SINCE(5, 15)
/*!
\overload
+ \obsolete
\since 4.5
This function reads the XML document from the QXmlInputSource \a source,
returning true if the content was successfully parsed; otherwise returns \c false.
*/
+QT_WARNING_PUSH
+QT_WARNING_DISABLE_DEPRECATED
bool QDomDocument::setContent(QXmlInputSource *source, bool namespaceProcessing, QString *errorMsg, int *errorLine, int *errorColumn )
{
if (!impl)
@@ -6301,6 +6321,9 @@ bool QDomDocument::setContent(QXmlInputSource *source, bool namespaceProcessing,
initializeReader(reader, namespaceProcessing);
return IMPL->setContent(source, &reader, &reader, errorMsg, errorLine, errorColumn);
}
+QT_WARNING_POP
+
+#endif
/*!
\overload
@@ -6333,6 +6356,7 @@ bool QDomDocument::setContent(const QByteArray& buffer, QString *errorMsg, int *
/*!
\overload
+ \obsolete
This function reads the XML document from the IO device \a dev, returning
true if the content was successfully parsed; otherwise returns \c false.
@@ -6344,8 +6368,10 @@ bool QDomDocument::setContent(QIODevice* dev, QString *errorMsg, int *errorLine,
return setContent(dev, false, errorMsg, errorLine, errorColumn);
}
+#if QT_DEPRECATED_SINCE(5, 15)
/*!
\overload
+ \obsolete
This function reads the XML document from the QXmlInputSource \a source and
parses it with the QXmlReader \a reader, returning true if the content was
@@ -6357,12 +6383,17 @@ bool QDomDocument::setContent(QIODevice* dev, QString *errorMsg, int *errorLine,
\sa QXmlSimpleReader
*/
+QT_WARNING_PUSH
+QT_WARNING_DISABLE_DEPRECATED
bool QDomDocument::setContent(QXmlInputSource *source, QXmlReader *reader, QString *errorMsg, int *errorLine, int *errorColumn )
{
if (!impl)
impl = new QDomDocumentPrivate();
return IMPL->setContent(source, reader, nullptr, errorMsg, errorLine, errorColumn);
}
+QT_WARNING_POP
+
+#endif
/*!
\overload
diff --git a/src/xml/dom/qdom.h b/src/xml/dom/qdom.h
index 84abaea53e..9f34290121 100644
--- a/src/xml/dom/qdom.h
+++ b/src/xml/dom/qdom.h
@@ -339,11 +339,23 @@ public:
bool setContent(const QByteArray& text, bool namespaceProcessing, QString *errorMsg=nullptr, int *errorLine=nullptr, int *errorColumn=nullptr );
bool setContent(const QString& text, bool namespaceProcessing, QString *errorMsg=nullptr, int *errorLine=nullptr, int *errorColumn=nullptr );
bool setContent(QIODevice* dev, bool namespaceProcessing, QString *errorMsg=nullptr, int *errorLine=nullptr, int *errorColumn=nullptr );
+#if QT_DEPRECATED_SINCE(5, 15)
+QT_WARNING_PUSH
+QT_WARNING_DISABLE_DEPRECATED
+ QT_DEPRECATED_X("Use other overloads instead")
bool setContent(QXmlInputSource *source, bool namespaceProcessing, QString *errorMsg=nullptr, int *errorLine=nullptr, int *errorColumn=nullptr );
+QT_WARNING_POP
+#endif
bool setContent(const QByteArray& text, QString *errorMsg=nullptr, int *errorLine=nullptr, int *errorColumn=nullptr );
bool setContent(const QString& text, QString *errorMsg=nullptr, int *errorLine=nullptr, int *errorColumn=nullptr );
bool setContent(QIODevice* dev, QString *errorMsg=nullptr, int *errorLine=nullptr, int *errorColumn=nullptr );
+#if QT_DEPRECATED_SINCE(5, 15)
+QT_WARNING_PUSH
+QT_WARNING_DISABLE_DEPRECATED
+ QT_DEPRECATED_X("Use other overloads instead")
bool setContent(QXmlInputSource *source, QXmlReader *reader, QString *errorMsg=nullptr, int *errorLine=nullptr, int *errorColumn=nullptr );
+QT_WARNING_POP
+#endif
bool setContent(QXmlStreamReader *reader, bool namespaceProcessing, QString *errorMsg = nullptr,
int *errorLine = nullptr, int *errorColumn = nullptr);
diff --git a/src/xml/dom/qdom_p.h b/src/xml/dom/qdom_p.h
index b66c756af0..a9399d9901 100644
--- a/src/xml/dom/qdom_p.h
+++ b/src/xml/dom/qdom_p.h
@@ -461,10 +461,15 @@ public:
QDomDocumentPrivate(QDomDocumentPrivate *n, bool deep);
~QDomDocumentPrivate();
+#if QT_DEPRECATED_SINCE(5, 15)
+QT_WARNING_PUSH
+QT_WARNING_DISABLE_DEPRECATED
bool setContent(QXmlInputSource *source, bool namespaceProcessing, QString *errorMsg,
int *errorLine, int *errorColumn);
bool setContent(QXmlInputSource *source, QXmlReader *reader, QXmlSimpleReader *simpleReader,
QString *errorMsg, int *errorLine, int *errorColumn);
+QT_WARNING_POP
+#endif
bool setContent(QXmlStreamReader *reader, bool namespaceProcessing, QString *errorMsg,
int *errorLine, int *errorColumn);
diff --git a/src/xml/dom/qdomhelpers.cpp b/src/xml/dom/qdomhelpers.cpp
index 9399ad3b9b..10e37f7c0f 100644
--- a/src/xml/dom/qdomhelpers.cpp
+++ b/src/xml/dom/qdomhelpers.cpp
@@ -44,12 +44,15 @@
QT_BEGIN_NAMESPACE
+#if QT_DEPRECATED_SINCE(5, 15)
+
/**************************************************************
*
* QDomHandler
*
**************************************************************/
-
+QT_WARNING_PUSH
+QT_WARNING_DISABLE_DEPRECATED
QDomHandler::QDomHandler(QDomDocumentPrivate *adoc, QXmlSimpleReader *areader,
bool namespaceProcessing)
: cdata(false), reader(areader), domBuilder(adoc, &locator, namespaceProcessing)
@@ -160,6 +163,9 @@ QDomBuilder::ErrorInfo QDomHandler::errorInfo() const
{
return domBuilder.error();
}
+QT_WARNING_POP
+
+#endif // QT_DEPRECATED_SINCE(5, 15)
/**************************************************************
*
@@ -179,10 +185,15 @@ int QDomDocumentLocator::line() const
return static_cast<int>(reader->lineNumber());
}
+#if QT_DEPRECATED_SINCE(5, 15)
+
+QT_WARNING_PUSH
+QT_WARNING_DISABLE_DEPRECATED
void QSAXDocumentLocator::setLocator(QXmlLocator *l)
{
locator = l;
}
+QT_WARNING_POP
int QSAXDocumentLocator::column() const
{
@@ -200,6 +211,8 @@ int QSAXDocumentLocator::line() const
return static_cast<int>(locator->lineNumber());
}
+#endif // QT_DEPRECATED_SINCE(5, 15)
+
/**************************************************************
*
* QDomBuilder
@@ -234,6 +247,10 @@ bool QDomBuilder::startDTD(const QString &name, const QString &publicId, const Q
return true;
}
+#if QT_DEPRECATED_SINCE(5, 15)
+
+QT_WARNING_PUSH
+QT_WARNING_DISABLE_DEPRECATED
bool QDomBuilder::startElement(const QString &nsURI, const QString &qName,
const QXmlAttributes &atts)
{
@@ -264,6 +281,9 @@ bool QDomBuilder::startElement(const QString &nsURI, const QString &qName,
return true;
}
+QT_WARNING_POP
+
+#endif // QT_DEPRECATED_SINCE(5, 15)
inline QString stringRefToString(const QStringRef &stringRef)
{
diff --git a/src/xml/dom/qdomhelpers_p.h b/src/xml/dom/qdomhelpers_p.h
index f5efd8a42d..4de18f7d4d 100644
--- a/src/xml/dom/qdomhelpers_p.h
+++ b/src/xml/dom/qdomhelpers_p.h
@@ -93,6 +93,11 @@ private:
QXmlStreamReader *reader;
};
+#if QT_DEPRECATED_SINCE(5, 15)
+
+QT_WARNING_PUSH
+QT_WARNING_DISABLE_DEPRECATED
+
class QSAXDocumentLocator : public QXmlDocumentLocator
{
public:
@@ -107,6 +112,10 @@ private:
QXmlLocator *locator = nullptr;
};
+QT_WARNING_POP
+
+#endif
+
/**************************************************************
*
* QDomBuilder
@@ -120,7 +129,12 @@ public:
~QDomBuilder();
bool endDocument();
+#if QT_DEPRECATED_SINCE(5, 15)
+QT_WARNING_PUSH
+QT_WARNING_DISABLE_DEPRECATED
bool startElement(const QString &nsURI, const QString &qName, const QXmlAttributes &atts);
+QT_WARNING_POP
+#endif
bool startElement(const QString &nsURI, const QString &qName, const QXmlStreamAttributes &atts);
bool endElement();
bool characters(const QString &characters, bool cdata = false);
@@ -152,12 +166,17 @@ private:
bool nsProcessing;
};
+#if QT_DEPRECATED_SINCE(5, 15)
+
/**************************************************************
*
* QDomHandler
*
**************************************************************/
+QT_WARNING_PUSH
+QT_WARNING_DISABLE_DEPRECATED
+
class QDomHandler : public QXmlDefaultHandler
{
public:
@@ -205,6 +224,10 @@ private:
QDomBuilder domBuilder;
};
+QT_WARNING_POP
+
+#endif // QT_DEPRECATED_SINCE(5, 15)
+
/**************************************************************
*
* QDomParser
diff --git a/src/xml/sax/qxml.cpp b/src/xml/sax/qxml.cpp
index 1993073cce..0033d042d4 100644
--- a/src/xml/sax/qxml.cpp
+++ b/src/xml/sax/qxml.cpp
@@ -51,6 +51,7 @@
#include "qstack.h"
#include <qdebug.h>
+#if QT_DEPRECATED_SINCE(5, 15)
#ifdef Q_CC_BOR // borland 6 finds bogus warnings when building this file in uic3
# pragma warn -8080
@@ -284,6 +285,7 @@ class QXmlDefaultHandlerPrivate
/*!
\class QXmlParseException
+ \obsolete
\reentrant
\brief The QXmlParseException class is used to report errors with
the QXmlErrorHandler interface.
@@ -403,6 +405,7 @@ QString QXmlParseException::systemId() const
/*!
\class QXmlLocator
+ \obsolete
\reentrant
\brief The QXmlLocator class provides the XML handler classes with
information about the parsing position within a file.
@@ -445,6 +448,9 @@ QXmlLocator::~QXmlLocator()
number available.
*/
+QT_WARNING_PUSH
+QT_WARNING_DISABLE_DEPRECATED
+
class QXmlSimpleReaderLocator : public QXmlLocator
{
public:
@@ -497,6 +503,7 @@ public:
/*!
\class QXmlNamespaceSupport
+ \obsolete
\since 4.4
\reentrant
\brief The QXmlNamespaceSupport class is a helper class for XML
@@ -745,6 +752,7 @@ void QXmlNamespaceSupport::reset()
/*!
\class QXmlAttributes
+ \obsolete
\reentrant
\brief The QXmlAttributes class provides XML attributes.
@@ -1028,6 +1036,7 @@ void QXmlAttributes::append(const QString &qName, const QString &uri, const QStr
/*!
\class QXmlInputSource
+ \obsolete
\reentrant
\brief The QXmlInputSource class provides the input data for the
QXmlReader subclasses.
@@ -1446,6 +1455,7 @@ QString QXmlInputSource::fromRawData(const QByteArray &data, bool beginning)
/*!
\class QXmlContentHandler
+ \obsolete
\reentrant
\brief The QXmlContentHandler class provides an interface to
report the logical content of XML data.
@@ -1688,6 +1698,7 @@ QString QXmlInputSource::fromRawData(const QByteArray &data, bool beginning)
/*!
\class QXmlErrorHandler
+ \obsolete
\reentrant
\brief The QXmlErrorHandler class provides an interface to report
errors in XML data.
@@ -1763,6 +1774,7 @@ events are reported.
/*!
\class QXmlDTDHandler
+ \obsolete
\reentrant
\brief The QXmlDTDHandler class provides an interface to report
DTD content of XML data.
@@ -1830,6 +1842,7 @@ events are reported.
/*!
\class QXmlEntityResolver
+ \obsolete
\reentrant
\brief The QXmlEntityResolver class provides an interface to
resolve external entities contained in XML data.
@@ -1886,6 +1899,7 @@ events are reported.
/*!
\class QXmlLexicalHandler
+ \obsolete
\reentrant
\brief The QXmlLexicalHandler class provides an interface to
report the lexical content of XML data.
@@ -2037,6 +2051,7 @@ events are reported.
/*!
\class QXmlDeclHandler
+ \obsolete
\reentrant
\brief The QXmlDeclHandler class provides an interface to report declaration
content of XML data.
@@ -2124,6 +2139,7 @@ events are reported.
/*!
\class QXmlDefaultHandler
+ \obsolete
\reentrant
\brief The QXmlDefaultHandler class provides a default implementation of all
the XML handler classes.
@@ -2558,6 +2574,7 @@ void QXmlSimpleReaderPrivate::initIncrementalParsing()
/*!
\class QXmlReader
+ \obsolete
\reentrant
\brief The QXmlReader class provides an interface for XML readers (i.e.
parsers).
@@ -2597,6 +2614,9 @@ void QXmlSimpleReaderPrivate::initIncrementalParsing()
setDeclHandler(). The parse itself is started with a call to
parse().
+ Note that this class is now deprecated, please use QXmlStreamReader or
+ QDomDocument for reading XML files.
+
\sa QXmlSimpleReader
*/
@@ -2783,6 +2803,7 @@ void QXmlSimpleReaderPrivate::initIncrementalParsing()
/*!
\class QXmlSimpleReader
+ \obsolete
\nonreentrant
\brief The QXmlSimpleReader class provides an implementation of a
simple XML parser.
@@ -2845,6 +2866,9 @@ void QXmlSimpleReaderPrivate::initIncrementalParsing()
QXmlSimpleReader is not reentrant. If you want to use the class
in threaded code, lock the code using QXmlSimpleReader with a
locking mechanism, such as a QMutex.
+
+ Note that this class is now deprecated, please use QXmlStreamReader or
+ QDomDocument for reading XML files.
*/
static inline bool is_S(QChar ch)
@@ -5255,7 +5279,10 @@ bool QXmlSimpleReaderPrivate::parsePEReference()
} else if (entityRes) {
QMap<QString,QXmlSimpleReaderPrivate::ExternParameterEntity>::Iterator it2;
it2 = externParameterEntities.find(ref());
+QT_WARNING_PUSH
+QT_WARNING_DISABLE_DEPRECATED
QXmlInputSource *ret = nullptr;
+QT_WARNING_POP
if (it2 != externParameterEntities.end()) {
if (!entityRes->resolveEntity((*it2).publicId, (*it2).systemId, ret)) {
delete ret;
@@ -7610,7 +7637,10 @@ bool QXmlSimpleReaderPrivate::processReference()
// Included if validating
bool skipIt = true;
if (entityRes) {
+QT_WARNING_PUSH
+QT_WARNING_DISABLE_DEPRECATED
QXmlInputSource *ret = nullptr;
+QT_WARNING_POP
if (!entityRes->resolveEntity((*itExtern).publicId, (*itExtern).systemId, ret)) {
delete ret;
reportParseError(entityRes->errorString());
@@ -7850,6 +7880,8 @@ bool QXmlSimpleReaderPrivate::next_eat_ws()
This private function initializes the reader. \a i is the input source to
read the data from.
*/
+QT_WARNING_PUSH
+QT_WARNING_DISABLE_DEPRECATED
void QXmlSimpleReaderPrivate::init(const QXmlInputSource *i)
{
lineNr = 0;
@@ -7870,6 +7902,7 @@ void QXmlSimpleReaderPrivate::init(const QXmlInputSource *i)
standalone = QXmlSimpleReaderPrivate::Unknown;
error.clear();
}
+QT_WARNING_POP
/*
This private function initializes the XML data related variables. Especially,
@@ -7898,6 +7931,8 @@ bool QXmlSimpleReaderPrivate::entityExist(const QString& e) const
}
}
+QT_WARNING_PUSH
+QT_WARNING_DISABLE_DEPRECATED
void QXmlSimpleReaderPrivate::reportParseError(const QString& error)
{
this->error = error;
@@ -7913,6 +7948,7 @@ void QXmlSimpleReaderPrivate::reportParseError(const QString& error)
}
}
}
+QT_WARNING_POP
/*
This private function is called when a parsing function encounters an
@@ -8006,3 +8042,5 @@ void QXmlSimpleReaderPrivate::refAddC(QChar ch)
refArray[refArrayPos++] = ch;
}
QT_END_NAMESPACE
+
+#endif // QT_DEPRECATED_SINCE(5, 15)
diff --git a/src/xml/sax/qxml.h b/src/xml/sax/qxml.h
index 9be14bd7a9..e19a398ca7 100644
--- a/src/xml/sax/qxml.h
+++ b/src/xml/sax/qxml.h
@@ -40,6 +40,26 @@
#ifndef QXML_H
#define QXML_H
+#if 0
+// This is needed because of QTBUG-80347
+#pragma qt_class(QXmlNamespaceSupport)
+#pragma qt_class(QXmlAttributes)
+#pragma qt_class(QXmlInputSource)
+#pragma qt_class(QXmlParseException)
+#pragma qt_class(QXmlReader)
+#pragma qt_class(QXmlSimpleReader)
+#pragma qt_class(QXmlLocator)
+#pragma qt_class(QXmlContentHandler)
+#pragma qt_class(QXmlErrorHandler)
+#pragma qt_class(QXmlDTDHandler)
+#pragma qt_class(QXmlEntityResolver)
+#pragma qt_class(QXmlLexicalHandler)
+#pragma qt_class(QXmlDeclHandler)
+#pragma qt_class(QXmlDefaultHandler)
+#endif
+
+#include <QtCore/qglobal.h>
+
#include <QtXml/qtxmlglobal.h>
#include <QtCore/qtextstream.h>
#include <QtCore/qfile.h>
@@ -48,8 +68,12 @@
#include <QtCore/qlist.h>
#include <QtCore/qscopedpointer.h>
+#if QT_DEPRECATED_SINCE(5, 15)
+
QT_BEGIN_NAMESPACE
+QT_WARNING_PUSH
+QT_WARNING_DISABLE_DEPRECATED
class QXmlNamespaceSupport;
class QXmlAttributes;
@@ -76,12 +100,11 @@ class QXmlParseExceptionPrivate;
class QXmlLocatorPrivate;
class QXmlDefaultHandlerPrivate;
-
//
// SAX Namespace Support
//
-class Q_XML_EXPORT QXmlNamespaceSupport
+class QT_DEPRECATED_VERSION(5, 15) Q_XML_EXPORT QXmlNamespaceSupport
{
public:
QXmlNamespaceSupport();
@@ -112,10 +135,15 @@ private:
// SAX Attributes
//
+// Although deprecated warnings are disabled, the intel icc 18 compiler
+// still complains during the instantiation of the templated qSwap() call below
+// (with the parameter QXmlAttributes::AttributeList) when QXmlAttributes is
+// deprecated. This makes the build fail when warnings are treated as errors.
+// To workaround this, deprecated only the constructor.
class Q_XML_EXPORT QXmlAttributes
{
public:
- QXmlAttributes();
+ QT_DEPRECATED_VERSION(5, 15) QXmlAttributes();
QXmlAttributes(const QXmlAttributes &) = default;
QXmlAttributes(QXmlAttributes &&) noexcept = default;
QXmlAttributes &operator=(const QXmlAttributes &) = default;
@@ -158,6 +186,7 @@ private:
QXmlAttributesPrivate *d;
};
+
Q_DECLARE_TYPEINFO(QXmlAttributes::Attribute, Q_MOVABLE_TYPE);
Q_DECLARE_SHARED_NOT_MOVABLE_UNTIL_QT6(QXmlAttributes)
@@ -165,7 +194,7 @@ Q_DECLARE_SHARED_NOT_MOVABLE_UNTIL_QT6(QXmlAttributes)
// SAX Input Source
//
-class Q_XML_EXPORT QXmlInputSource
+class QT_DEPRECATED_VERSION(5, 15) Q_XML_EXPORT QXmlInputSource
{
public:
QXmlInputSource();
@@ -194,7 +223,7 @@ private:
// SAX Exception Classes
//
-class Q_XML_EXPORT QXmlParseException
+class QT_DEPRECATED_VERSION(5, 15) Q_XML_EXPORT QXmlParseException
{
public:
explicit QXmlParseException(const QString &name = QString(), int c = -1, int l = -1,
@@ -217,7 +246,7 @@ private:
// XML Reader
//
-class Q_XML_EXPORT QXmlReader
+class QT_DEPRECATED_VERSION_X(5, 15, "Use QXmlStreamReader") Q_XML_EXPORT QXmlReader
{
public:
virtual ~QXmlReader() {}
@@ -243,7 +272,8 @@ public:
virtual bool parse(const QXmlInputSource* input) = 0;
};
-class Q_XML_EXPORT QXmlSimpleReader : public QXmlReader
+class QT_DEPRECATED_VERSION_X(5, 15, "Use QXmlStreamReader") Q_XML_EXPORT QXmlSimpleReader
+ : public QXmlReader
{
public:
QXmlSimpleReader();
@@ -288,7 +318,7 @@ private:
// SAX Locator
//
-class Q_XML_EXPORT QXmlLocator
+class QT_DEPRECATED_VERSION(5, 15) Q_XML_EXPORT QXmlLocator
{
public:
QXmlLocator();
@@ -304,7 +334,7 @@ public:
// SAX handler classes
//
-class Q_XML_EXPORT QXmlContentHandler
+class QT_DEPRECATED_VERSION(5, 15) Q_XML_EXPORT QXmlContentHandler
{
public:
virtual ~QXmlContentHandler() {}
@@ -322,7 +352,7 @@ public:
virtual QString errorString() const = 0;
};
-class Q_XML_EXPORT QXmlErrorHandler
+class QT_DEPRECATED_VERSION(5, 15) Q_XML_EXPORT QXmlErrorHandler
{
public:
virtual ~QXmlErrorHandler() {}
@@ -332,7 +362,7 @@ public:
virtual QString errorString() const = 0;
};
-class Q_XML_EXPORT QXmlDTDHandler
+class QT_DEPRECATED_VERSION(5, 15) Q_XML_EXPORT QXmlDTDHandler
{
public:
virtual ~QXmlDTDHandler() {}
@@ -341,7 +371,7 @@ public:
virtual QString errorString() const = 0;
};
-class Q_XML_EXPORT QXmlEntityResolver
+class QT_DEPRECATED_VERSION(5, 15) Q_XML_EXPORT QXmlEntityResolver
{
public:
virtual ~QXmlEntityResolver() {}
@@ -349,7 +379,7 @@ public:
virtual QString errorString() const = 0;
};
-class Q_XML_EXPORT QXmlLexicalHandler
+class QT_DEPRECATED_VERSION(5, 15) Q_XML_EXPORT QXmlLexicalHandler
{
public:
virtual ~QXmlLexicalHandler() {}
@@ -363,7 +393,7 @@ public:
virtual QString errorString() const = 0;
};
-class Q_XML_EXPORT QXmlDeclHandler
+class QT_DEPRECATED_VERSION(5, 15) Q_XML_EXPORT QXmlDeclHandler
{
public:
virtual ~QXmlDeclHandler() {}
@@ -374,8 +404,12 @@ public:
// ### Conform to SAX by adding elementDecl
};
-
-class Q_XML_EXPORT QXmlDefaultHandler : public QXmlContentHandler, public QXmlErrorHandler, public QXmlDTDHandler, public QXmlEntityResolver, public QXmlLexicalHandler, public QXmlDeclHandler
+class QT_DEPRECATED_VERSION(5, 15) Q_XML_EXPORT QXmlDefaultHandler : public QXmlContentHandler,
+ public QXmlErrorHandler,
+ public QXmlDTDHandler,
+ public QXmlEntityResolver,
+ public QXmlLexicalHandler,
+ public QXmlDeclHandler
{
public:
QXmlDefaultHandler();
@@ -426,6 +460,10 @@ private:
inline int QXmlAttributes::count() const
{ return length(); }
+QT_WARNING_POP
+
QT_END_NAMESPACE
+#endif // QT_DEPRECATED_SINCE(5, 15)
+
#endif // QXML_H
diff --git a/src/xml/sax/qxml_p.h b/src/xml/sax/qxml_p.h
index eb6135db04..1b614dd886 100644
--- a/src/xml/sax/qxml_p.h
+++ b/src/xml/sax/qxml_p.h
@@ -46,6 +46,8 @@
#include <stack>
+#if QT_DEPRECATED_SINCE(5, 15)
+
QT_BEGIN_NAMESPACE
//
@@ -59,6 +61,9 @@ QT_BEGIN_NAMESPACE
// We mean it.
//
+QT_WARNING_PUSH
+QT_WARNING_DISABLE_DEPRECATED
+
class QXmlSimpleReaderPrivate
{
public:
@@ -313,6 +318,10 @@ Q_DECLARE_TYPEINFO(QXmlSimpleReaderPrivate::XmlRef, Q_MOVABLE_TYPE);
Q_DECLARE_TYPEINFO(QXmlSimpleReaderPrivate::ExternParameterEntity, Q_MOVABLE_TYPE);
Q_DECLARE_TYPEINFO(QXmlSimpleReaderPrivate::ExternEntity, Q_MOVABLE_TYPE);
+QT_WARNING_POP
+
QT_END_NAMESPACE
+#endif // QT_DEPRECATED_SINCE(5, 15)
+
#endif // QXML_P_H