r25053 by craig - Qt6: Remove uses of deprecated QFontDatabase()

scribus-commit scribus-commit at lists.scribus.net
Wed Mar 23 22:26:32 UTC 2022


Author: craig
Date: Wed Mar 23 22:26:32 2022
New Revision: 25053

URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=25053
Log:
Qt6: Remove uses of deprecated QFontDatabase()

Modified:
    trunk/Scribus/scribus/scribusapp.h
    trunk/Scribus/scribus/ui/fontcombo.cpp

Modified: trunk/Scribus/scribus/scribusapp.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=25053&path=/trunk/Scribus/scribus/scribusapp.h
==============================================================================
--- trunk/Scribus/scribus/scribusapp.h	(original)
+++ trunk/Scribus/scribus/scribusapp.h	Wed Mar 23 22:26:32 2022
@@ -23,7 +23,6 @@
 #define SCRIBUSAPP_H
 
 #include <QApplication>
-#include <QFontDatabase>
 #include <QString>
 #include <QStringList>
 
@@ -79,7 +78,6 @@
 		const QString& currGUILanguage() { return m_GUILang; }
 		const QString& userPrefsDir() { return m_prefsUserDir; }
 		ScDLManager* dlManager() { return m_scDLMgr; }
-		QFontDatabase& qtFontDatabase() { return m_fontDb; }
 		QString pythonScript; // script to be run in python from CLI
 		QStringList pythonScriptArgs; // command line arguments and flags for script from CLI
 
@@ -111,7 +109,6 @@
 		QString m_prefsUserDir;
 		QList<QString> m_filesToLoad;
 		QString m_fileName;
-		QFontDatabase m_fontDb;
 		ScDLManager *m_scDLMgr {nullptr};
 
 	protected:

Modified: trunk/Scribus/scribus/ui/fontcombo.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=25053&path=/trunk/Scribus/scribus/ui/fontcombo.cpp
==============================================================================
--- trunk/Scribus/scribus/ui/fontcombo.cpp	(original)
+++ trunk/Scribus/scribus/ui/fontcombo.cpp	Wed Mar 23 22:26:32 2022
@@ -25,6 +25,7 @@
 #include <QEvent>
 #include <QFont>
 #include <QFontInfo>
+#include <QFontDatabase>
 #include <QGridLayout>
 #include <QLabel>
 #include <QPixmap>
@@ -422,8 +423,7 @@
 
 QFontDatabase::WritingSystem writingSystemForFont(const QFont &font, bool *hasLatin)
 {
-	QFontDatabase& fontDb = ScQApp->qtFontDatabase();
-	QList<QFontDatabase::WritingSystem> writingSystems = fontDb.writingSystems(font.family());
+	QList<QFontDatabase::WritingSystem> writingSystems = QFontDatabase::writingSystems(font.family());
 
 	// this just confuses the algorithm below. Vietnamese is Latin with lots of special chars
 	writingSystems.removeOne(QFontDatabase::Vietnamese);
@@ -463,7 +463,6 @@
 
 const ScFace& getScFace(const QString& className, const QString& text)
 {
-	QFontDatabase& fontDb = ScQApp->qtFontDatabase();
 	SCFonts& availableFonts = PrefsManager::instance().appPrefs.fontPrefs.AvailFonts;
 
 	// Handle FontComboH class witch has only Family names in the combo class.
@@ -483,12 +482,12 @@
 		else if (styles.contains("Book"))
 			style = "Book";
 		const ScFace& fon = availableFonts.findFont(text, style);
-		if (!fontDb.families().contains(text))
+		if (!QFontDatabase::families().contains(text))
 			QFontDatabase::addApplicationFont(fon.fontFilePath());
 		return fon;
 	}
 	const ScFace& scFace = availableFonts.findFont(text);
-	if (!fontDb.families().contains(scFace.family()))
+	if (!QFontDatabase::families().contains(scFace.family()))
 		QFontDatabase::addApplicationFont(scFace.fontFilePath());
 	return scFace;
 }
@@ -516,7 +515,6 @@
 		return;
 	}
 
-	const QFontDatabase& fontDb = ScQApp->qtFontDatabase();
 	const ScFace& scFace = getScFace(this->parent()->metaObject()->className(), text);
 
 	QPixmap  pixmap(pixmapW, pixmapH);
@@ -537,7 +535,7 @@
 	QFont font2 = option.font;
 	if (!scFace.isNone())
 	{
-		font2 = fontDb.font(scFace.family(), scFace.style(), QFontInfo(option.font).pointSize());
+		font2 = QFontDatabase::font(scFace.family(), scFace.style(), QFontInfo(option.font).pointSize());
 		font2.setPointSize(QFontInfo(font2).pointSize() * 3 / 2.0);
 	}
 




More information about the scribus-commit mailing list