diff options
Diffstat (limited to 'src/gui/text/qfontdatabase.cpp')
-rw-r--r-- | src/gui/text/qfontdatabase.cpp | 59 |
1 files changed, 56 insertions, 3 deletions
diff --git a/src/gui/text/qfontdatabase.cpp b/src/gui/text/qfontdatabase.cpp index 54b4629ca0..6703f66e29 100644 --- a/src/gui/text/qfontdatabase.cpp +++ b/src/gui/text/qfontdatabase.cpp @@ -53,9 +53,11 @@ #include <QtGui/private/qguiapplication_p.h> #include <qpa/qplatformfontdatabase.h> +#include <qpa/qplatformtheme.h> #include <stdlib.h> #include <limits.h> +#include <algorithm> // #define QFONTDATABASE_DEBUG @@ -1082,6 +1084,17 @@ QFontDatabase::QFontDatabase() */ /*! + \enum QFontDatabase::SystemFont + + \value GeneralFont The default system font. + \value FixedFont The fixed font that the system recommends. + \value TitleFont The system standard font for titles. + \value SmallestReadableFont The smallest readable system font. + + \since 5.2 +*/ + +/*! Returns a sorted list of the available writing systems. This is list generated from information about all installed fonts on the system. @@ -1107,7 +1120,7 @@ QList<QFontDatabase::WritingSystem> QFontDatabase::writingSystems() const list.append(writingSystem); } } - qSort(list); + std::sort(list.begin(), list.end()); return list; } @@ -1399,7 +1412,7 @@ QList<int> QFontDatabase::pointSizes(const QString &family, if (smoothScalable) return standardSizes(); - qSort(sizes); + std::sort(sizes.begin(), sizes.end()); return sizes; } @@ -1502,7 +1515,7 @@ QList<int> QFontDatabase::smoothSizes(const QString &family, if (smoothScalable) return QFontDatabase::standardSizes(); - qSort(sizes); + std::sort(sizes.begin(), sizes.end()); return sizes; } @@ -2090,6 +2103,43 @@ QStringList QFontDatabase::applicationFontFamilies(int id) } /*! + \since 5.2 + + Returns the most adequate font for a given \a type case for proper integration + with the system's look and feel. + + \sa QGuiApplication::font() +*/ + +QFont QFontDatabase::systemFont(QFontDatabase::SystemFont type) +{ + const QFont *font = 0; + if (const QPlatformTheme *theme = QGuiApplicationPrivate::platformTheme()) { + switch (type) { + case GeneralFont: + font = theme->font(QPlatformTheme::SystemFont); + break; + case FixedFont: + font = theme->font(QPlatformTheme::FixedFont); + break; + case TitleFont: + font = theme->font(QPlatformTheme::TitleBarFont); + break; + case SmallestReadableFont: + font = theme->font(QPlatformTheme::MiniFont); + break; + } + } + + if (font) + return *font; + else if (QPlatformIntegration *integration = QGuiApplicationPrivate::platformIntegration()) + return integration->fontDatabase()->defaultFont(); + else + return QFont(); +} + +/*! \fn bool QFontDatabase::removeApplicationFont(int id) \since 4.2 @@ -2117,12 +2167,15 @@ QStringList QFontDatabase::applicationFontFamilies(int id) /*! \fn bool QFontDatabase::supportsThreadedFontRendering() \since 4.4 + \deprecated Returns true if font rendering is supported outside the GUI thread, false otherwise. In other words, a return value of false means that all QPainter::drawText() calls outside the GUI thread will not produce readable output. + As of 5.0, always returns true. + \sa {Thread-Support in Qt Modules#Painting In Threads}{Painting In Threads} */ |