Created
July 17, 2013 10:37
-
-
Save liangqi/6019485 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| From 3d460625ef4003fe5e033e05bac564f013bd51d0 Mon Sep 17 00:00:00 2001 | |
| From: Liang Qi <liang.qi@digia.com> | |
| Date: Tue, 16 Jul 2013 08:40:24 +0200 | |
| Subject: [PATCH] tmp: test code for qcocoafontdialoghelper | |
| Change-Id: I17b8d3f6b29d109f9382f2bb9e5237a64460a459 | |
| --- | |
| src/gui/kernel/qplatformdialoghelper.cpp | 12 ++++++++++++ | |
| src/gui/kernel/qplatformdialoghelper.h | 6 ++++++ | |
| src/plugins/platforms/cocoa/qcocoafontdialoghelper.mm | 1 + | |
| 3 files changed, 19 insertions(+) | |
| diff --git a/src/gui/kernel/qplatformdialoghelper.cpp b/src/gui/kernel/qplatformdialoghelper.cpp | |
| index 0ee8e8b..083485b 100644 | |
| --- a/src/gui/kernel/qplatformdialoghelper.cpp | |
| +++ b/src/gui/kernel/qplatformdialoghelper.cpp | |
| @@ -47,6 +47,7 @@ | |
| #include <QtCore/QHash> | |
| #include <QtCore/QUrl> | |
| #include <QtGui/QColor> | |
| +#include <QtGui/QFont> | |
| QT_BEGIN_NAMESPACE | |
| @@ -165,6 +166,17 @@ QFontDialogOptions::FontDialogOptions QFontDialogOptions::options() const | |
| \brief The QPlatformFontDialogHelper class allows for platform-specific customization of font dialogs. | |
| */ | |
| +QPlatformFontDialogHelper::QPlatformFontDialogHelper() | |
| +{ | |
| + qDebug() << "QPlatformFontDialogHelper::QPlatformFontDialogHelper"; | |
| + connect(this, SIGNAL(currentFontChanged(const QFont&)), this, SLOT(slot_currentFontChanged(const QFont&))); | |
| +} | |
| + | |
| +void QPlatformFontDialogHelper::slot_currentFontChanged(const QFont &font) | |
| +{ | |
| + qDebug() << "QPlatformFontDialogHelper::slot_currentFontChanged:" << font; | |
| +} | |
| + | |
| const QSharedPointer<QFontDialogOptions> &QPlatformFontDialogHelper::options() const | |
| { | |
| return m_options; | |
| diff --git a/src/gui/kernel/qplatformdialoghelper.h b/src/gui/kernel/qplatformdialoghelper.h | |
| index 7412bdb..fab8c1f 100644 | |
| --- a/src/gui/kernel/qplatformdialoghelper.h | |
| +++ b/src/gui/kernel/qplatformdialoghelper.h | |
| @@ -59,6 +59,8 @@ | |
| #include <QtCore/QDir> | |
| #include <QtGui/QRgb> | |
| +#include <QtCore/QtDebug> | |
| + | |
| QT_BEGIN_NAMESPACE | |
| @@ -197,12 +199,16 @@ class Q_GUI_EXPORT QPlatformFontDialogHelper : public QPlatformDialogHelper | |
| { | |
| Q_OBJECT | |
| public: | |
| + QPlatformFontDialogHelper(); | |
| virtual void setCurrentFont(const QFont &) = 0; | |
| virtual QFont currentFont() const = 0; | |
| const QSharedPointer<QFontDialogOptions> &options() const; | |
| void setOptions(const QSharedPointer<QFontDialogOptions> &options); | |
| +public Q_SLOTS: | |
| + void slot_currentFontChanged(const QFont &font); | |
| + | |
| Q_SIGNALS: | |
| void currentFontChanged(const QFont &font); | |
| void fontSelected(const QFont &font); | |
| diff --git a/src/plugins/platforms/cocoa/qcocoafontdialoghelper.mm b/src/plugins/platforms/cocoa/qcocoafontdialoghelper.mm | |
| index 7ab20df..d0739ff 100644 | |
| --- a/src/plugins/platforms/cocoa/qcocoafontdialoghelper.mm | |
| +++ b/src/plugins/platforms/cocoa/qcocoafontdialoghelper.mm | |
| @@ -293,6 +293,7 @@ QT_NAMESPACE_ALIAS_OBJC_CLASS(QNSFontPanelDelegate); | |
| NSFont *panelFont = [fontManager convertFont:selectedFont]; | |
| mQtFont = qfontForCocoaFont(panelFont, mQtFont); | |
| + NSLog(@"emit mHelper->currentFontChanged(mQtFont) %@", panelFont); | |
| emit mHelper->currentFontChanged(mQtFont); | |
| } | |
| -- | |
| 1.8.2.2 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment