r24734 by craig - Revert QStringView conversions to keep 1.5.x Qt 5.14 compatible, bump

scribus-commit scribus-commit at lists.scribus.net
Tue Oct 5 20:26:09 UTC 2021


Author: craig
Date: Tue Oct  5 20:26:08 2021
New Revision: 24734

URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=24734
Log:
Revert QStringView conversions to keep 1.5.x Qt 5.14 compatible, bump
Qt6 minimum to 6.2

Modified:
    trunk/Scribus/CMakeLists_Dependencies.cmake
    trunk/Scribus/scribus/imagedataloaders/scimgdataloader_ps.cpp
    trunk/Scribus/scribus/latexhelpers.cpp
    trunk/Scribus/scribus/latexhelpers.h
    trunk/Scribus/scribus/nftrcreader.cpp
    trunk/Scribus/scribus/plugins/fileloader/scribus134format/scribus134format.cpp
    trunk/Scribus/scribus/plugins/import/ai/importai.cpp
    trunk/Scribus/scribus/plugins/saveastemplateplugin/satdialog.cpp
    trunk/Scribus/scribus/sccolor.cpp
    trunk/Scribus/scribus/scribusXml.cpp
    trunk/Scribus/scribus/ui/annot.cpp
    trunk/Scribus/scribus/ui/helpbrowser.cpp
    trunk/Scribus/scribus/ui/pagepalette_masterpages.cpp
    trunk/Scribus/scribus/ui/pagepalette_widgets.cpp

Modified: trunk/Scribus/CMakeLists_Dependencies.cmake
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=24734&path=/trunk/Scribus/CMakeLists_Dependencies.cmake
==============================================================================
--- trunk/Scribus/CMakeLists_Dependencies.cmake	(original)
+++ trunk/Scribus/CMakeLists_Dependencies.cmake	Tue Oct  5 20:26:08 2021
@@ -67,6 +67,8 @@
 else()
 #WANT QT6
     message(STATUS "Qt6 Requested")
+	set(QT_MIN_VERSION "6.2.0")
+
 	find_package(Qt6 COMPONENTS Core REQUIRED)
 	add_definitions(${Qt6Core_DEFINITIONS})
 	include_directories(${Qt6Core_INCLUDE_DIRS})

Modified: trunk/Scribus/scribus/imagedataloaders/scimgdataloader_ps.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=24734&path=/trunk/Scribus/scribus/imagedataloaders/scimgdataloader_ps.cpp
==============================================================================
--- trunk/Scribus/scribus/imagedataloaders/scimgdataloader_ps.cpp	(original)
+++ trunk/Scribus/scribus/imagedataloaders/scimgdataloader_ps.cpp	Tue Oct  5 20:26:08 2021
@@ -10,7 +10,6 @@
 #include <QFile>
 #include <QFileInfo>
 #include <QRegExp>
-#include <QStringView>
 
 #include "cmsettings.h"
 #include "colormgmt/sccolormgmtengine.h"
@@ -101,7 +100,7 @@
 				for (int a = 2; a < tmp.length(); a += 2)
 				{
 					bool ok;
-					ushort data = QStringView{tmp}.mid(a, 2).toUShort(&ok, 16);
+					ushort data = tmp.midRef(a, 2).toUShort(&ok, 16);
 					psdata.resize(psdata.size()+1);
 					psdata[psdata.size()-1] = data;
 				}
@@ -426,7 +425,7 @@
 							for (int a = 2; a < tmp.length(); a += 2)
 							{
 								bool ok;
-								ushort data = QStringView{tmp}.mid(a, 2).toUShort(&ok, 16);
+								ushort data = tmp.midRef(a, 2).toUShort(&ok, 16);
 								psdata.resize(psdata.size()+1);
 								psdata[psdata.size()-1] = data;
 							}
@@ -443,7 +442,7 @@
 							for (int a = 2; a < tmp.length(); a += 2)
 							{
 								bool ok;
-								ushort data = QStringView{tmp}.mid(a, 2).toUShort(&ok, 16);
+								ushort data = tmp.midRef(a, 2).toUShort(&ok, 16);
 								psdata.resize(psdata.size()+1);
 								psdata[psdata.size()-1] = data;
 							}
@@ -1245,7 +1244,7 @@
 						for (int a = 0; a < tmp.length(); a += 2)
 						{
 							bool ok;
-							ushort data = QStringView{tmp}.mid(a, 2).toUShort(&ok, 16);
+							ushort data = tmp.midRef(a, 2).toUShort(&ok, 16);
 							psdata.resize(psdata.size()+1);
 							psdata[psdata.size()-1] = data;
 						}
@@ -1378,7 +1377,7 @@
 							for (int a = 0; a < tmp.length(); a += 2)
 							{
 								bool ok;
-								ushort data = QStringView{tmp}.mid(a, 2).toUShort(&ok, 16);
+								ushort data = tmp.midRef(a, 2).toUShort(&ok, 16);
 								psdata.resize(psdata.size()+1);
 								psdata[psdata.size()-1] = data;
 							}

Modified: trunk/Scribus/scribus/latexhelpers.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=24734&path=/trunk/Scribus/scribus/latexhelpers.cpp
==============================================================================
--- trunk/Scribus/scribus/latexhelpers.cpp	(original)
+++ trunk/Scribus/scribus/latexhelpers.cpp	Tue Oct  5 20:26:08 2021
@@ -171,11 +171,11 @@
 	m_error += new_error + "\n";
 }
 
-bool LatexConfigParser::StrViewToBool(const QStringView &str) const
-{
-	if (str == QStringView(u"1") || str == QStringView(u"true"))
+bool LatexConfigParser::StrRefToBool(const QStringRef &str) const
+{
+	if (str == "1" || str == "true")
 		return true;
-	if (str == QStringView(u"0") || str == QStringView(u"false") || str.isEmpty())
+	if (str == "0" || str == "false" || str.isEmpty())
 		return false;
 	qWarning() << "Invalid bool string:" << str.toString();
 	return false;
@@ -202,10 +202,10 @@
 			continue;
 		}
 		QString regex = xml.attributes().value("regex").toString();
-		bool bold = StrViewToBool(xml.attributes().value("bold"));
-		bool italic = StrViewToBool(xml.attributes().value("italic"));
-		bool underline = StrViewToBool(xml.attributes().value("underline"));
-		bool minimal = StrViewToBool(xml.attributes().value("minimal"));
+		bool bold = StrRefToBool(xml.attributes().value("bold"));
+		bool italic = StrRefToBool(xml.attributes().value("italic"));
+		bool underline = StrRefToBool(xml.attributes().value("underline"));
+		bool minimal = StrRefToBool(xml.attributes().value("minimal"));
 		QString colorStr = xml.attributes().value("color").toString();
 		QColor color(colorStr);
 		if (!color.isValid())

Modified: trunk/Scribus/scribus/latexhelpers.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=24734&path=/trunk/Scribus/scribus/latexhelpers.h
==============================================================================
--- trunk/Scribus/scribus/latexhelpers.h	(original)
+++ trunk/Scribus/scribus/latexhelpers.h	Tue Oct  5 20:26:08 2021
@@ -26,7 +26,7 @@
 #include <QObject>
 #include <QPointer>
 #include <QString>
-#include <QStringView>
+#include <QStringRef>
 #include <QSyntaxHighlighter>
 #include <QXmlStreamReader>
 
@@ -89,7 +89,7 @@
 		void parseTab();
 		void parseHighlighter();
 		void ignoreList();
-		bool StrViewToBool(const QStringView& str) const;
+		bool StrRefToBool(const QStringRef& str) const;
 };
 
 class LatexConfigCache;

Modified: trunk/Scribus/scribus/nftrcreader.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=24734&path=/trunk/Scribus/scribus/nftrcreader.cpp
==============================================================================
--- trunk/Scribus/scribus/nftrcreader.cpp	(original)
+++ trunk/Scribus/scribus/nftrcreader.cpp	Tue Oct  5 20:26:08 2021
@@ -8,7 +8,7 @@
  *   Riku Leino, tsoots at gmail.com                                          *
  ***************************************************************************/
 
-#include <QStringView>
+#include <QStringRef>
 
 #include "nftrcreader.h"
 
@@ -36,16 +36,16 @@
 		if (tType != QXmlStreamReader::StartElement)
 			continue;
 
-		QStringView tagName = reader.name();
+		QStringRef tagName = reader.name();
 		if (firstElement)
 		{
-			if (tagName != QStringView(u"templates"))
+			if (tagName != "templates")
 				return false;
 			firstElement = false;
 			continue;
 		}
 
-		if (tagName == QStringView(u"template"))
+		if (tagName == "template")
 		{
 			QXmlStreamAttributes attrs = reader.attributes();
 			QString attrCat  = attrs.value("category").toString();
@@ -72,8 +72,8 @@
 	if (!reader.isStartElement())
 		return false;
 
-	QStringView elemName = reader.name();
-	if (elemName != QStringView(u"template"))
+	QStringRef elemName = reader.name();
+	if (elemName != "template")
 		return false;
 
 	while (!reader.atEnd() && !reader.hasError())
@@ -87,10 +87,10 @@
 		if (tType != QXmlStreamReader::StartElement)
 			continue;
 
-		QStringView tagName = reader.name();
-		if (tagName == QStringView(u"name"))
+		QStringRef tagName = reader.name();
+		if (tagName == "name")
 			nftTemplate->name = reader.readElementText();
-		else if (tagName == QStringView(u"file"))
+		else if (tagName == "file")
 		{
 			QString tmp = reader.readElementText();
 			if (tmp.left(1) == "/")
@@ -98,7 +98,7 @@
 			else 
 				nftTemplate->file = currentDir + "/" + tmp;
 		}
-		else if (tagName == QStringView(u"tnail"))
+		else if (tagName == "tnail")
 		{
 			QString tmp = reader.readElementText();
 			if (tmp.left(1) == "/")
@@ -106,7 +106,7 @@
 			else 
 				nftTemplate->tnail = currentDir + "/" + tmp;
 		}
-		else if (tagName == QStringView(u"img"))
+		else if (tagName == "img")
 		{
 			QString tmp = reader.readElementText();
 			if (tmp.left(1) == "/")
@@ -114,21 +114,21 @@
 			else 
 				nftTemplate->img = currentDir + "/" + tmp;
 		}
-		else if (tagName == QStringView(u"psize"))
+		else if (tagName == "psize")
 			nftTemplate->psize = reader.readElementText();
-		else if (tagName == QStringView(u"color"))
+		else if (tagName == "color")
 			nftTemplate->color = reader.readElementText();
-		else if (tagName == QStringView(u"descr"))
+		else if (tagName == "descr")
 			nftTemplate->descr = reader.readElementText();
-		else if (tagName == QStringView(u"usage"))
+		else if (tagName == "usage")
 			nftTemplate->usage = reader.readElementText();
-		else if (tagName == QStringView(u"scribus_version"))
+		else if (tagName == "scribus_version")
 			nftTemplate->scribusVersion = reader.readElementText();
-		else if (tagName == QStringView(u"date"))
+		else if (tagName == "date")
 			nftTemplate->date = reader.readElementText();
-		else if (tagName == QStringView(u"author"))
+		else if (tagName == "author")
 			nftTemplate->author = reader.readElementText();
-		else if (tagName == QStringView(u"email"))
+		else if (tagName == "email")
 			nftTemplate->email = reader.readElementText();
 		else
 		{

Modified: trunk/Scribus/scribus/plugins/fileloader/scribus134format/scribus134format.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=24734&path=/trunk/Scribus/scribus/plugins/fileloader/scribus134format/scribus134format.cpp
==============================================================================
--- trunk/Scribus/scribus/plugins/fileloader/scribus134format/scribus134format.cpp	(original)
+++ trunk/Scribus/scribus/plugins/fileloader/scribus134format/scribus134format.cpp	Tue Oct  5 20:26:08 2021
@@ -18,7 +18,6 @@
 #include <QIODevice>
 #include <QList>
 #include <QScopedPointer>
-#include <QStringView>
 
 #include "../../formatidlist.h"
 #include "commonstrings.h"

Modified: trunk/Scribus/scribus/plugins/import/ai/importai.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=24734&path=/trunk/Scribus/scribus/plugins/import/ai/importai.cpp
==============================================================================
--- trunk/Scribus/scribus/plugins/import/ai/importai.cpp	(original)
+++ trunk/Scribus/scribus/plugins/import/ai/importai.cpp	Tue Oct  5 20:26:08 2021
@@ -1360,7 +1360,7 @@
 	{
 		if (data.contains("~>"))
 		{
-			dataString += QStringView{data}.mid(1);
+			dataString += data.midRef(1);
 			dataMode = false;
 			QByteArray fData;
 			decodeA85(fData, dataString);
@@ -1419,9 +1419,7 @@
 			currentSpecialPath.svgInit();
 		}
 		else
-		{
-			dataString += QStringView{data}.mid(1);
-		}
+			dataString += data.midRef(1);
 		return;
 	}
 	getCommands(data, da);
@@ -2970,7 +2968,7 @@
 			for (int a = 1; a < tmp.length(); a += 2)
 			{
 				bool ok;
-				ushort data = QStringView{tmp}.mid(a, 2).toUShort(&ok, 16);
+				ushort data = tmp.midRef(a, 2).toUShort(&ok, 16);
 				psdata[dataPointer++] = data;
 			}
 		}

Modified: trunk/Scribus/scribus/plugins/saveastemplateplugin/satdialog.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=24734&path=/trunk/Scribus/scribus/plugins/saveastemplateplugin/satdialog.cpp
==============================================================================
--- trunk/Scribus/scribus/plugins/saveastemplateplugin/satdialog.cpp	(original)
+++ trunk/Scribus/scribus/plugins/saveastemplateplugin/satdialog.cpp	Tue Oct  5 20:26:08 2021
@@ -36,7 +36,7 @@
 
 		QXmlStreamReader sReader(&qFile);
 		QXmlStreamReader::TokenType tagType;
-		QStringView tagName;
+		QStringRef tagName;
 
 		while (!sReader.atEnd() && !sReader.hasError())
 		{
@@ -45,7 +45,7 @@
 				continue;
 
 			tagName = sReader.name();
-			if (tagName != QStringView(u"template"))
+			if (tagName != "template")
 				continue;
 
 			QXmlStreamAttributes attrs = sReader.attributes();

Modified: trunk/Scribus/scribus/sccolor.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=24734&path=/trunk/Scribus/scribus/sccolor.cpp
==============================================================================
--- trunk/Scribus/scribus/sccolor.cpp	(original)
+++ trunk/Scribus/scribus/sccolor.cpp	Tue Oct  5 20:26:08 2021
@@ -365,20 +365,19 @@
 void ScColor::setNamedColor(QString colorName)
 {
 	bool ok;
-	QStringView colorNameView(colorName);
 	if (colorName.length () == 9)
 	{
-		int c = colorNameView.mid(1,2).toInt(&ok, 16);
-		int m = colorNameView.mid(3,2).toInt(&ok, 16);
-		int y = colorNameView.mid(5,2).toInt(&ok, 16);
-		int k = colorNameView.mid(7,2).toInt(&ok, 16);
+		int c = colorName.midRef(1,2).toInt(&ok, 16);
+		int m = colorName.midRef(3,2).toInt(&ok, 16);
+		int y = colorName.midRef(5,2).toInt(&ok, 16);
+		int k = colorName.midRef(7,2).toInt(&ok, 16);
 		setColor(c, m, y, k);
 	}
 	else if (colorName.length () == 7)
 	{
-		int r = colorNameView.mid(1,2).toInt(&ok, 16);
-		int g = colorNameView.mid(3,2).toInt(&ok, 16);
-		int b = colorNameView.mid(5,2).toInt(&ok, 16);
+		int r = colorName.midRef(1,2).toInt(&ok, 16);
+		int g = colorName.midRef(3,2).toInt(&ok, 16);
+		int b = colorName.midRef(5,2).toInt(&ok, 16);
 		setRgbColor(r, g, b);
 	}
 }

Modified: trunk/Scribus/scribus/scribusXml.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=24734&path=/trunk/Scribus/scribus/scribusXml.cpp
==============================================================================
--- trunk/Scribus/scribus/scribusXml.cpp	(original)
+++ trunk/Scribus/scribus/scribusXml.cpp	Tue Oct  5 20:26:08 2021
@@ -83,7 +83,7 @@
 		ff  = file;
 
 	bool succeed = false;
-	QStringView tName;
+	QStringRef tName;
 	QXmlStreamReader sReader(ff);
 	QXmlStreamReader::TokenType tType;
 	while (!sReader.atEnd() && !sReader.hasError())
@@ -92,7 +92,7 @@
 		if (tType == QXmlStreamReader::StartElement)
 		{
 			tName = sReader.name();
-			if ((tName == QStringView(u"SCRIBUSELEM")) || (tName == QStringView(u"SCRIBUSELEMUTF8")))
+			if ((tName == "SCRIBUSELEM") || (tName == "SCRIBUSELEMUTF8"))
 			{
 				QXmlStreamAttributes attrs = sReader.attributes();;
 				QString attx = attrs.value("XP").toString();

Modified: trunk/Scribus/scribus/ui/annot.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=24734&path=/trunk/Scribus/scribus/ui/annot.cpp
==============================================================================
--- trunk/Scribus/scribus/ui/annot.cpp	(original)
+++ trunk/Scribus/scribus/ui/annot.cpp	Tue Oct  5 20:26:08 2021
@@ -27,7 +27,6 @@
 #include <QSpacerItem>
 #include <QStackedWidget>
 #include <QStringList>
-#include <QStringView>
 #include <QWidget>
 
 #include "annotation.h"
@@ -774,7 +773,7 @@
 	if (pfol.count() > 1)
 	{
 		tm2 = pfol[0].simplified();
-		tm += QStringView{tm2}.mid(1, tm2.length()-2);
+		tm += tm2.midRef(1, tm2.length()-2);
 		for (int cfx = 1; cfx < pfol.count(); ++cfx)
 		{
 			tm2 = pfol[cfx].simplified();

Modified: trunk/Scribus/scribus/ui/helpbrowser.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=24734&path=/trunk/Scribus/scribus/ui/helpbrowser.cpp
==============================================================================
--- trunk/Scribus/scribus/ui/helpbrowser.cpp	(original)
+++ trunk/Scribus/scribus/ui/helpbrowser.cpp	Tue Oct  5 20:26:08 2021
@@ -81,7 +81,7 @@
 
 			QXmlStreamReader sReader(&qFile);
 			QXmlStreamReader::TokenType tagType;
-			QStringView tagName;
+			QStringRef tagName;
 
 			while (!sReader.atEnd() && !sReader.hasError())
 			{
@@ -90,7 +90,7 @@
 					continue;
 
 				tagName = sReader.name();
-				if (tagName != QStringView(u"item"))
+				if (tagName != "item")
 					continue;
 
 				struct histd2 his;
@@ -126,7 +126,7 @@
 
 			QXmlStreamReader sReader(&qFile);
 			QXmlStreamReader::TokenType tagType;
-			QStringView tagName;
+			QStringRef tagName;
 
 			while (!sReader.atEnd() && !sReader.hasError())
 			{
@@ -135,7 +135,7 @@
 					continue;
 
 				tagName = sReader.name();
-				if (tagName != QStringView(u"item"))
+				if (tagName != "item")
 					continue;
 
 				QXmlStreamAttributes attrs = sReader.attributes();

Modified: trunk/Scribus/scribus/ui/pagepalette_masterpages.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=24734&path=/trunk/Scribus/scribus/ui/pagepalette_masterpages.cpp
==============================================================================
--- trunk/Scribus/scribus/ui/pagepalette_masterpages.cpp	(original)
+++ trunk/Scribus/scribus/ui/pagepalette_masterpages.cpp	Tue Oct  5 20:26:08 2021
@@ -550,7 +550,7 @@
 // FIXME: move to a new masterpages.h
 bool PagePalette_MasterPages::isReservedName(const QString& name) const
 {
-	return name == CommonStrings::masterPageNormal ||
+	bool retval = name == CommonStrings::masterPageNormal ||
 		name == CommonStrings::trMasterPageNormal ||
 		name == CommonStrings::masterPageNormalLeft ||
 		name == CommonStrings::trMasterPageNormalLeft ||
@@ -558,6 +558,7 @@
 		name == CommonStrings::trMasterPageNormalMiddle ||
 		name == CommonStrings::masterPageNormalRight ||
 		name == CommonStrings::trMasterPageNormalRight;
+	return retval;
 }
 
 // FIXME: move to a new masterpages.h

Modified: trunk/Scribus/scribus/ui/pagepalette_widgets.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=24734&path=/trunk/Scribus/scribus/ui/pagepalette_widgets.cpp
==============================================================================
--- trunk/Scribus/scribus/ui/pagepalette_widgets.cpp	(original)
+++ trunk/Scribus/scribus/ui/pagepalette_widgets.cpp	Tue Oct  5 20:26:08 2021
@@ -17,7 +17,6 @@
 #include <QMimeData>
 #include <QMessageBox>
 #include <QPainter>
-#include <QStringView>
 
 #include "commonstrings.h"
 #include "iconmanager.h"
@@ -262,7 +261,7 @@
 			int st = str.indexOf(" ");
 			int en = str.indexOf(" ", st + 1);
 			tmp = str.mid(en+1);
-			int dr = QStringView{str}.mid(st, en-st).toInt();
+			int dr = str.midRef(st, en-st).toInt();
 			int a = rowAt(e->pos().y());
 			int b = columnAt(e->pos().x());
 			if ((a == -1) || (b == -1))




More information about the scribus-commit mailing list