From 276036179a112abf45bb433ef3b918ed68b807ff Mon Sep 17 00:00:00 2001 From: Shawn Rutledge Date: Tue, 5 Aug 2014 11:33:48 +0200 Subject: QFileDialog docs: remove misleading sentence about static functions Native dialogs are used whenever possible, not just when the dialog is instantiated via the static function. Task-number: QTBUG-36657 Change-Id: Ibad67114e67f8e2f9956037f8469542c72bfd8ea Reviewed-by: Jerome Pasion --- src/widgets/dialogs/qfiledialog.cpp | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'src/widgets/dialogs') diff --git a/src/widgets/dialogs/qfiledialog.cpp b/src/widgets/dialogs/qfiledialog.cpp index 6349bdc301..9219757dbf 100644 --- a/src/widgets/dialogs/qfiledialog.cpp +++ b/src/widgets/dialogs/qfiledialog.cpp @@ -89,9 +89,7 @@ Q_GLOBAL_STATIC(QString, lastVisitedDir) The QFileDialog class enables a user to traverse the file system in order to select one or many files or a directory. - The easiest way to create a QFileDialog is to use the static - functions. On Windows, Mac OS X, KDE and GNOME, these static functions will - call the native file dialog when possible. + The easiest way to create a QFileDialog is to use the static functions. \snippet code/src_gui_dialogs_qfiledialog.cpp 0 -- cgit v1.2.3 From 909d3f5c733dde02074a737a5f1dbe3e51dbef32 Mon Sep 17 00:00:00 2001 From: Gabriel de Dietrich Date: Wed, 2 Jul 2014 13:18:50 +0200 Subject: Font Database: Add support for private, system UI font families MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit We introduce QPlatformFontDatabase::isPrivateFontFamily() to allow testing for private, system UI font families. Both QFontComboBox and QFontDialog need to filter out those private font families which, by definition, should be hidden from the end user. (The textedit example had to be updated to fix the issue where the default font would be private. In 5.4, we will be adding an equivalent, public API in QFontDatabase, and a better solution for the textedit example and QTexEdit in general). In particular, on OS X and iOS, private fonts are used for the system UI font. Those have their font family name prefixed by a dot. QCoreTextFontDatabase knows about this, and makes sure those are tested positive as private font families. In order to have a cleaner layer separation, we moved the QPA theme font resolution from the platform theme classes into QCoreTextFontDatabase for both Cocoa and iOS QPA plugins. In both cases, we use CoreText's CTFontCreateUIFontForLanguage(), that nicely maps to the HITheme API we were using so far on Mac. That means one HITheme dependency less. We also cache the font descriptors we get for these font for each time QCTFD::populateFamilies() gets called. (While not common, this currently happens in auto-tests, like tst_QFontDatabase, and could happen in actual applications -- specially when adding and removing application fonts.) Change-Id: Ic6f0b60f9f597afee1a43596a669742dc546b97f Reviewed-by: Morten Johan Sørvig --- src/widgets/dialogs/qfontdialog.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'src/widgets/dialogs') diff --git a/src/widgets/dialogs/qfontdialog.cpp b/src/widgets/dialogs/qfontdialog.cpp index 5a68bfbc66..fc9f36f0c2 100644 --- a/src/widgets/dialogs/qfontdialog.cpp +++ b/src/widgets/dialogs/qfontdialog.cpp @@ -65,6 +65,10 @@ #include #include +#include +#include +#include + QT_BEGIN_NAMESPACE class QFontListView : public QListView @@ -485,8 +489,13 @@ void QFontDialogPrivate::updateFamilies() const QFontDialog::FontDialogOptions spacingMask = (QFontDialog::ProportionalFonts | QFontDialog::MonospacedFonts); const QFontDialog::FontDialogOptions options = q->options(); + QPlatformFontDatabase *pfdb = QGuiApplicationPrivate::platformIntegration()->fontDatabase(); + QStringList familyNames; foreach (const QString &family, fdb.families(writingSystem)) { + if (pfdb->isPrivateFontFamily(family)) + continue; + if ((options & scalableMask) && (options & scalableMask) != scalableMask) { if (bool(options & QFontDialog::ScalableFonts) != fdb.isSmoothlyScalable(family)) continue; -- cgit v1.2.3