aboutsummaryrefslogtreecommitdiffstats
path: root/src/imports
diff options
context:
space:
mode:
authorLiang Qi <liang.qi@digia.com>2013-09-11 07:22:08 +0200
committerThe Qt Project <gerrit-noreply@qt-project.org>2013-09-18 22:33:36 +0200
commitd375a65ce10d2854cf6a4643bc9ffb221df99494 (patch)
treef413ee872af2ec206151a12221bba9d9e49cd727 /src/imports
parent93ecd34c323852812f8f74a4fe6d7dad8e43f35a (diff)
Add FontDialog to QtQuick.Dialogs
As with FileDialog, it tries QPA, then QFontDialog, and falls back to a QML implementation (which is also provided here) if neither type of native dialog is available. The update of plugins.qmltypes files will be in a separate commit. Task-number: QTBUG-31852 Done-with: Shawn Rutledge <shawn.rutledge@digia.com> Change-Id: I066ebbcf44c413af26020ddf8414252b99f5218b Reviewed-by: Shawn Rutledge <shawn.rutledge@digia.com>
Diffstat (limited to 'src/imports')
-rw-r--r--src/imports/dialogs-private/dialogs-private.pro17
-rw-r--r--src/imports/dialogs-private/dialogsprivateplugin.cpp66
-rw-r--r--src/imports/dialogs-private/qmldir3
-rw-r--r--src/imports/dialogs-private/qquickfontlistmodel.cpp276
-rw-r--r--src/imports/dialogs-private/qquickfontlistmodel_p.h125
-rw-r--r--src/imports/dialogs-private/qquickwritingsystemlistmodel.cpp169
-rw-r--r--src/imports/dialogs-private/qquickwritingsystemlistmodel_p.h100
-rw-r--r--src/imports/dialogs/DefaultFontDialog.qml457
-rw-r--r--src/imports/dialogs/WidgetFontDialog.qml44
-rw-r--r--src/imports/dialogs/dialogs.pro14
-rw-r--r--src/imports/dialogs/images/checkmark.pngbin0 -> 809 bytes
-rw-r--r--src/imports/dialogs/plugin.cpp11
-rw-r--r--src/imports/dialogs/qml/CheckBox.qml96
-rw-r--r--src/imports/dialogs/qml/qmldir1
-rw-r--r--src/imports/dialogs/qquickabstractfontdialog.cpp150
-rw-r--r--src/imports/dialogs/qquickabstractfontdialog_p.h113
-rw-r--r--src/imports/dialogs/qquickfontdialog.cpp120
-rw-r--r--src/imports/dialogs/qquickfontdialog_p.h80
-rw-r--r--src/imports/dialogs/qquickplatformfontdialog.cpp251
-rw-r--r--src/imports/dialogs/qquickplatformfontdialog_p.h78
-rw-r--r--src/imports/imports.pro1
-rw-r--r--src/imports/widgets/qquickqfontdialog.cpp178
-rw-r--r--src/imports/widgets/qquickqfontdialog_p.h78
-rw-r--r--src/imports/widgets/widgets.pro6
-rw-r--r--src/imports/widgets/widgetsplugin.cpp2
25 files changed, 2433 insertions, 3 deletions
diff --git a/src/imports/dialogs-private/dialogs-private.pro b/src/imports/dialogs-private/dialogs-private.pro
new file mode 100644
index 0000000000..8e35afa2bc
--- /dev/null
+++ b/src/imports/dialogs-private/dialogs-private.pro
@@ -0,0 +1,17 @@
+CXX_MODULE = qml
+TARGET = dialogsprivateplugin
+TARGETPATH = QtQuick/Dialogs/Private
+IMPORT_VERSION = 1.1
+
+SOURCES += \
+ qquickfontlistmodel.cpp \
+ qquickwritingsystemlistmodel.cpp \
+ dialogsprivateplugin.cpp
+
+HEADERS += \
+ qquickfontlistmodel_p.h \
+ qquickwritingsystemlistmodel_p.h
+
+QT += quick-private gui-private core-private qml-private
+
+load(qml_plugin)
diff --git a/src/imports/dialogs-private/dialogsprivateplugin.cpp b/src/imports/dialogs-private/dialogsprivateplugin.cpp
new file mode 100644
index 0000000000..f920df30f3
--- /dev/null
+++ b/src/imports/dialogs-private/dialogsprivateplugin.cpp
@@ -0,0 +1,66 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the plugins of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QtQml/qqmlextensionplugin.h>
+#include <QtQml/qqml.h>
+#include "qquickwritingsystemlistmodel_p.h"
+#include "qquickfontlistmodel_p.h"
+
+QT_BEGIN_NAMESPACE
+
+class QtQuick2DialogsPrivatePlugin : public QQmlExtensionPlugin
+{
+ Q_OBJECT
+ Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QQmlExtensionInterface/1.0")
+
+public:
+ virtual void registerTypes(const char *uri)
+ {
+ Q_ASSERT(QLatin1String(uri) == QLatin1String("QtQuick.Dialogs.Private"));
+
+ qmlRegisterType<QQuickWritingSystemListModel>(uri, 1, 1, "WritingSystemListModel");
+ qmlRegisterType<QQuickFontListModel>(uri, 1, 1, "FontListModel");
+ }
+};
+
+QT_END_NAMESPACE
+
+#include "dialogsprivateplugin.moc"
diff --git a/src/imports/dialogs-private/qmldir b/src/imports/dialogs-private/qmldir
new file mode 100644
index 0000000000..e184715519
--- /dev/null
+++ b/src/imports/dialogs-private/qmldir
@@ -0,0 +1,3 @@
+module QtQuick.Dialogs.Private
+plugin dialogsprivateplugin
+typeinfo plugins.qmltypes
diff --git a/src/imports/dialogs-private/qquickfontlistmodel.cpp b/src/imports/dialogs-private/qquickfontlistmodel.cpp
new file mode 100644
index 0000000000..54ce700238
--- /dev/null
+++ b/src/imports/dialogs-private/qquickfontlistmodel.cpp
@@ -0,0 +1,276 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the QtQuick.Dialogs module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qquickfontlistmodel_p.h"
+#include <QtGui/qfontdatabase.h>
+#include <QtQml/qqml.h>
+#include <QtQml/qqmlcontext.h>
+#include <QtQml/qqmlengine.h>
+#include <QtQml/qjsengine.h>
+
+QT_BEGIN_NAMESPACE
+
+class QQuickFontListModelPrivate
+{
+ Q_DECLARE_PUBLIC(QQuickFontListModel)
+
+public:
+ QQuickFontListModelPrivate(QQuickFontListModel *q)
+ : q_ptr(q), ws(QFontDatabase::Any)
+ , options(QSharedPointer<QFontDialogOptions>(new QFontDialogOptions()))
+ {}
+
+ QQuickFontListModel *q_ptr;
+ QFontDatabase db;
+ QFontDatabase::WritingSystem ws;
+ QSharedPointer<QFontDialogOptions> options;
+ QStringList families;
+ QHash<int, QByteArray> roleNames;
+ ~QQuickFontListModelPrivate() {}
+ void init();
+};
+
+
+void QQuickFontListModelPrivate::init()
+{
+ Q_Q(QQuickFontListModel);
+
+ families = db.families();
+
+ emit q->rowCountChanged();
+ emit q->writingSystemChanged();
+}
+
+QQuickFontListModel::QQuickFontListModel(QObject *parent)
+ : QAbstractListModel(parent), d_ptr(new QQuickFontListModelPrivate(this))
+{
+ Q_D(QQuickFontListModel);
+ d->roleNames[FontFamilyRole] = "family";
+ d->init();
+}
+
+QQuickFontListModel::~QQuickFontListModel()
+{
+}
+
+QVariant QQuickFontListModel::data(const QModelIndex &index, int role) const
+{
+ Q_D(const QQuickFontListModel);
+ QVariant rv;
+
+ if (index.row() >= d->families.size())
+ return rv;
+
+ switch (role)
+ {
+ case FontFamilyRole:
+ rv = d->families.at(index.row());
+ break;
+ default:
+ break;
+ }
+ return rv;
+}
+
+QHash<int, QByteArray> QQuickFontListModel::roleNames() const
+{
+ Q_D(const QQuickFontListModel);
+ return d->roleNames;
+}
+
+int QQuickFontListModel::rowCount(const QModelIndex &parent) const
+{
+ Q_D(const QQuickFontListModel);
+ Q_UNUSED(parent);
+ return d->families.size();
+}
+
+QModelIndex QQuickFontListModel::index(int row, int , const QModelIndex &) const
+{
+ return createIndex(row, 0);
+}
+
+QString QQuickFontListModel::writingSystem() const
+{
+ Q_D(const QQuickFontListModel);
+ return QFontDatabase::writingSystemName(d->ws);
+}
+
+void QQuickFontListModel::setWritingSystem(const QString &wSystem)
+{
+ Q_D(QQuickFontListModel);
+
+ if (wSystem == writingSystem())
+ return;
+
+ QList<QFontDatabase::WritingSystem> wss;
+ wss << QFontDatabase::Any;
+ wss << d->db.writingSystems();
+ QFontDatabase::WritingSystem ws;
+ foreach (ws, wss) {
+ if (wSystem == QFontDatabase::writingSystemName(ws)) {
+ d->ws = ws;
+ updateFamilies();
+ return;
+ }
+ }
+}
+
+void QQuickFontListModel::updateFamilies()
+{
+ Q_D(QQuickFontListModel);
+
+ beginResetModel();
+ const QFontDialogOptions::FontDialogOptions scalableMask = (QFontDialogOptions::FontDialogOptions)(QFontDialogOptions::ScalableFonts | QFontDialogOptions::NonScalableFonts);
+ const QFontDialogOptions::FontDialogOptions spacingMask = (QFontDialogOptions::FontDialogOptions)(QFontDialogOptions::ProportionalFonts | QFontDialogOptions::MonospacedFonts);
+ const QFontDialogOptions::FontDialogOptions options = d->options->options();
+
+ d->families.clear();
+ foreach (const QString &family, d->db.families(d->ws)) {
+ if ((options & scalableMask) && (options & scalableMask) != scalableMask) {
+ if (bool(options & QFontDialogOptions::ScalableFonts) != d->db.isSmoothlyScalable(family))
+ continue;
+ }
+ if ((options & spacingMask) && (options & spacingMask) != spacingMask) {
+ if (bool(options & QFontDialogOptions::MonospacedFonts) != d->db.isFixedPitch(family))
+ continue;
+ }
+ d->families << family;
+ }
+ endResetModel();
+}
+
+bool QQuickFontListModel::scalableFonts() const
+{
+ Q_D(const QQuickFontListModel);
+ return d->options->testOption(QFontDialogOptions::ScalableFonts);
+}
+
+bool QQuickFontListModel::nonScalableFonts() const
+{
+ Q_D(const QQuickFontListModel);
+ return d->options->testOption(QFontDialogOptions::NonScalableFonts);
+}
+
+bool QQuickFontListModel::monospacedFonts() const
+{
+ Q_D(const QQuickFontListModel);
+ return d->options->testOption(QFontDialogOptions::MonospacedFonts);
+}
+
+bool QQuickFontListModel::proportionalFonts() const
+{
+ Q_D(const QQuickFontListModel);
+ return d->options->testOption(QFontDialogOptions::ProportionalFonts);
+}
+
+QJSValue QQuickFontListModel::get(int idx) const
+{
+ Q_D(const QQuickFontListModel);
+
+ QQmlEngine *engine = qmlContext(this)->engine();
+
+ if (idx < 0 || idx >= count())
+ return engine->newObject();
+
+ QJSValue result = engine->newObject();
+ int count = d->roleNames.keys().count();
+ for (int i = 0; i < count; ++i)
+ result.setProperty(QString(d->roleNames[Qt::UserRole + i + 1]), data(index(idx, 0), Qt::UserRole + i + 1).toString());
+
+ return result;
+}
+
+QJSValue QQuickFontListModel::pointSizes()
+{
+ QQmlEngine *engine = qmlContext(this)->engine();
+
+ QList<int> pss = QFontDatabase::standardSizes();
+ int size = pss.size();
+
+ QJSValue result = engine->newArray(size);
+ for (int i = 0; i < size; ++i)
+ result.setProperty(i, pss.at(i));
+
+ return result;
+}
+
+void QQuickFontListModel::classBegin()
+{
+}
+
+void QQuickFontListModel::componentComplete()
+{
+}
+
+void QQuickFontListModel::setScalableFonts(bool arg)
+{
+ Q_D(QQuickFontListModel);
+ d->options->setOption(QFontDialogOptions::ScalableFonts, arg);
+ updateFamilies();
+ emit scalableFontsChanged();
+}
+
+void QQuickFontListModel::setNonScalableFonts(bool arg)
+{
+ Q_D(QQuickFontListModel);
+ d->options->setOption(QFontDialogOptions::NonScalableFonts, arg);
+ updateFamilies();
+ emit nonScalableFontsChanged();
+}
+
+void QQuickFontListModel::setMonospacedFonts(bool arg)
+{
+ Q_D(QQuickFontListModel);
+ d->options->setOption(QFontDialogOptions::MonospacedFonts, arg);
+ updateFamilies();
+ emit monospacedFontsChanged();
+}
+
+void QQuickFontListModel::setProportionalFonts(bool arg)
+{
+ Q_D(QQuickFontListModel);
+ d->options->setOption(QFontDialogOptions::ProportionalFonts, arg);
+ updateFamilies();
+ emit proportionalFontsChanged();
+}
+
+QT_END_NAMESPACE
diff --git a/src/imports/dialogs-private/qquickfontlistmodel_p.h b/src/imports/dialogs-private/qquickfontlistmodel_p.h
new file mode 100644
index 0000000000..4f86bc779b
--- /dev/null
+++ b/src/imports/dialogs-private/qquickfontlistmodel_p.h
@@ -0,0 +1,125 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the QtQuick.Dialogs module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QQUICKFONTLISTMODEL_P_H
+#define QQUICKFONTLISTMODEL_P_H
+
+#include <QtCore/qstringlist.h>
+#include <QtCore/QAbstractListModel>
+#include <QtGui/qpa/qplatformdialoghelper.h>
+#include <QtQml/qqmlparserstatus.h>
+#include <QtQml/qjsvalue.h>
+
+QT_BEGIN_NAMESPACE
+
+class QModelIndex;
+
+class QQuickFontListModelPrivate;
+
+class QQuickFontListModel : public QAbstractListModel, public QQmlParserStatus
+{
+ Q_OBJECT
+ Q_INTERFACES(QQmlParserStatus)
+ Q_PROPERTY(QString writingSystem READ writingSystem WRITE setWritingSystem NOTIFY writingSystemChanged)
+
+ Q_PROPERTY(bool scalableFonts READ scalableFonts WRITE setScalableFonts NOTIFY scalableFontsChanged)
+ Q_PROPERTY(bool nonScalableFonts READ nonScalableFonts WRITE setNonScalableFonts NOTIFY nonScalableFontsChanged)
+ Q_PROPERTY(bool monospacedFonts READ monospacedFonts WRITE setMonospacedFonts NOTIFY monospacedFontsChanged)
+ Q_PROPERTY(bool proportionalFonts READ proportionalFonts WRITE setProportionalFonts NOTIFY proportionalFontsChanged)
+
+ Q_PROPERTY(int count READ count NOTIFY rowCountChanged)
+
+public:
+ QQuickFontListModel(QObject *parent = 0);
+ ~QQuickFontListModel();
+
+ enum Roles {
+ FontFamilyRole = Qt::UserRole + 1
+ };
+
+ virtual int rowCount(const QModelIndex &parent = QModelIndex()) const;
+ virtual QModelIndex index(int row, int column, const QModelIndex &parent = QModelIndex()) const;
+ virtual QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const;
+ virtual QHash<int, QByteArray> roleNames() const;
+
+ int count() const { return rowCount(QModelIndex()); }
+
+ QString writingSystem() const;
+ void setWritingSystem(const QString& writingSystem);
+
+ bool scalableFonts() const;
+ bool nonScalableFonts() const;
+ bool monospacedFonts() const;
+ bool proportionalFonts() const;
+
+ Q_INVOKABLE QJSValue get(int index) const;
+ Q_INVOKABLE QJSValue pointSizes();
+
+ virtual void classBegin();
+ virtual void componentComplete();
+
+public Q_SLOTS:
+ void setScalableFonts(bool arg);
+ void setNonScalableFonts(bool arg);
+ void setMonospacedFonts(bool arg);
+ void setProportionalFonts(bool arg);
+
+Q_SIGNALS:
+ void scalableFontsChanged();
+ void nonScalableFontsChanged();
+ void monospacedFontsChanged();
+ void proportionalFontsChanged();
+ void writingSystemChanged();
+ void rowCountChanged() const;
+
+protected:
+ void updateFamilies();
+
+private:
+ Q_DISABLE_COPY(QQuickFontListModel)
+ Q_DECLARE_PRIVATE(QQuickFontListModel)
+ QScopedPointer<QQuickFontListModelPrivate> d_ptr;
+
+};
+
+QT_END_NAMESPACE
+
+#endif // QQUICKFONTLISTMODEL_P_H
diff --git a/src/imports/dialogs-private/qquickwritingsystemlistmodel.cpp b/src/imports/dialogs-private/qquickwritingsystemlistmodel.cpp
new file mode 100644
index 0000000000..23bc43a566
--- /dev/null
+++ b/src/imports/dialogs-private/qquickwritingsystemlistmodel.cpp
@@ -0,0 +1,169 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the QtQuick.Dialogs module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qquickwritingsystemlistmodel_p.h"
+#include <QtGui/qfontdatabase.h>
+#include <QtQml/qqml.h>
+#include <QtQml/qqmlcontext.h>
+#include <QtQml/qqmlengine.h>
+#include <QtQml/qjsengine.h>
+
+QT_BEGIN_NAMESPACE
+
+class QQuickWritingSystemListModelPrivate
+{
+ Q_DECLARE_PUBLIC(QQuickWritingSystemListModel)
+
+public:
+ QQuickWritingSystemListModelPrivate(QQuickWritingSystemListModel *q)
+ : q_ptr(q)
+ {}
+
+ QQuickWritingSystemListModel *q_ptr;
+ QList<QFontDatabase::WritingSystem> wss;
+ QHash<int, QByteArray> roleNames;
+ ~QQuickWritingSystemListModelPrivate() {}
+ void init();
+};
+
+
+void QQuickWritingSystemListModelPrivate::init()
+{
+ Q_Q(QQuickWritingSystemListModel);
+ wss << QFontDatabase::Any;
+ QFontDatabase db;
+ wss << db.writingSystems();
+
+ emit q->rowCountChanged();
+ emit q->writingSystemsChanged();
+}
+
+QQuickWritingSystemListModel::QQuickWritingSystemListModel(QObject *parent)
+ : QAbstractListModel(parent), d_ptr(new QQuickWritingSystemListModelPrivate(this))
+{
+ Q_D(QQuickWritingSystemListModel);
+ d->roleNames[WritingSystemNameRole] = "name";
+ d->roleNames[WritingSystemSampleRole] = "sample";
+ d->init();
+}
+
+QQuickWritingSystemListModel::~QQuickWritingSystemListModel()
+{
+}
+
+QVariant QQuickWritingSystemListModel::data(const QModelIndex &index, int role) const
+{
+ Q_D(const QQuickWritingSystemListModel);
+ QVariant rv;
+
+ if (index.row() >= d->wss.size())
+ return rv;
+
+ switch (role)
+ {
+ case WritingSystemNameRole:
+ rv = QFontDatabase::writingSystemName(d->wss.at(index.row()));
+ break;
+ case WritingSystemSampleRole:
+ rv = QFontDatabase::writingSystemSample(d->wss.at(index.row()));
+ break;
+ default:
+ break;
+ }
+ return rv;
+}
+
+QHash<int, QByteArray> QQuickWritingSystemListModel::roleNames() const
+{
+ Q_D(const QQuickWritingSystemListModel);
+ return d->roleNames;
+}
+
+int QQuickWritingSystemListModel::rowCount(const QModelIndex &parent) const
+{
+ Q_D(const QQuickWritingSystemListModel);
+ Q_UNUSED(parent);
+ return d->wss.size();
+}
+
+QModelIndex QQuickWritingSystemListModel::index(int row, int , const QModelIndex &) const
+{
+ return createIndex(row, 0);
+}
+
+QStringList QQuickWritingSystemListModel::writingSystems() const
+{
+ Q_D(const QQuickWritingSystemListModel);
+ QStringList result;
+ QFontDatabase::WritingSystem ws;
+ foreach (ws, d->wss)
+ result.append(QFontDatabase::writingSystemName(ws));
+
+ return result;
+}
+
+QJSValue QQuickWritingSystemListModel::get(int idx) const
+{
+ Q_D(const QQuickWritingSystemListModel);
+
+ QQmlEngine *engine = qmlContext(this)->engine();
+
+ if (idx < 0 || idx >= count())
+ return engine->newObject();
+
+ QJSValue result = engine->newObject();
+ int count = d->roleNames.keys().count();
+ for (int i = 0; i < count; ++i)
+ result.setProperty(QString(d->roleNames[Qt::UserRole + i + 1]), data(index(idx, 0), Qt::UserRole + i + 1).toString());
+
+ return result;
+
+}
+
+void QQuickWritingSystemListModel::classBegin()
+{
+}
+
+void QQuickWritingSystemListModel::componentComplete()
+{
+}
+
+QT_END_NAMESPACE
diff --git a/src/imports/dialogs-private/qquickwritingsystemlistmodel_p.h b/src/imports/dialogs-private/qquickwritingsystemlistmodel_p.h
new file mode 100644
index 0000000000..120dd8a6f2
--- /dev/null
+++ b/src/imports/dialogs-private/qquickwritingsystemlistmodel_p.h
@@ -0,0 +1,100 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the QtQuick.Dialogs module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QQUICKWRITINGSYSTEMLISTMODEL_P_H
+#define QQUICKWRITINGSYSTEMLISTMODEL_P_H
+
+#include <QtCore/qstringlist.h>
+#include <QtCore/QAbstractListModel>
+#include <QtQml/qqmlparserstatus.h>
+#include <QtQml/qjsvalue.h>
+
+QT_BEGIN_NAMESPACE
+
+class QModelIndex;
+
+class QQuickWritingSystemListModelPrivate;
+
+class QQuickWritingSystemListModel : public QAbstractListModel, public QQmlParserStatus
+{
+ Q_OBJECT
+ Q_INTERFACES(QQmlParserStatus)
+ Q_PROPERTY(QStringList writingSystems READ writingSystems NOTIFY writingSystemsChanged)
+
+ Q_PROPERTY(int count READ count NOTIFY rowCountChanged)
+
+public:
+ QQuickWritingSystemListModel(QObject *parent = 0);
+ ~QQuickWritingSystemListModel();
+
+ enum Roles {
+ WritingSystemNameRole = Qt::UserRole + 1,
+ WritingSystemSampleRole = Qt::UserRole + 2
+ };
+
+ virtual int rowCount(const QModelIndex &parent = QModelIndex()) const;
+ virtual QModelIndex index(int row, int column, const QModelIndex &parent = QModelIndex()) const;
+ virtual QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const;
+ virtual QHash<int, QByteArray> roleNames() const;
+
+ int count() const { return rowCount(QModelIndex()); }
+
+ QStringList writingSystems() const;
+
+ Q_INVOKABLE QJSValue get(int index) const;
+
+ virtual void classBegin();
+ virtual void componentComplete();
+
+Q_SIGNALS:
+ void writingSystemsChanged();
+ void rowCountChanged() const;
+
+private:
+ Q_DISABLE_COPY(QQuickWritingSystemListModel)
+ Q_DECLARE_PRIVATE(QQuickWritingSystemListModel)
+ QScopedPointer<QQuickWritingSystemListModelPrivate> d_ptr;
+
+};
+
+QT_END_NAMESPACE
+
+#endif // QQUICKWRITINGSYSTEMLISTMODEL_P_H
diff --git a/src/imports/dialogs/DefaultFontDialog.qml b/src/imports/dialogs/DefaultFontDialog.qml
new file mode 100644
index 0000000000..87bb812c42
--- /dev/null
+++ b/src/imports/dialogs/DefaultFontDialog.qml
@@ -0,0 +1,457 @@
+/*****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the QtQuick.Dialogs module of Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
+** of its contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+*****************************************************************************/
+
+import QtQuick 2.1
+import QtQuick.Window 2.1
+import QtQuick.Dialogs 1.1
+import QtQuick.Dialogs.Private 1.1
+import "qml"
+
+AbstractFontDialog {
+ id: root
+
+ property alias font: content.externalFont
+
+ Rectangle {
+ id: content
+ property int maxSize: Math.min(Screen.desktopAvailableWidth, Screen.desktopAvailableHeight)
+ implicitWidth: settings.implicitWidth + changeableWidth + outerSpacing * 2
+ implicitHeight: writingSystemLabel.implicitHeight + changeableHeight + buttonRow.height + outerSpacing * 2
+ color: palette.window
+ property real spacing: 8
+ property real outerSpacing: 12
+ property real listMargins: 4
+ property color borderColor: Qt.darker(palette.button, 1.5)
+
+ property font font: Qt.font({ family: "Helvetica", pointSize: 24, weight: Font.Normal })
+ property font externalFont
+ property string writingSystem
+ property string writingSystemSample
+ property var pointSizes
+
+ property real changeableWidth: 160
+ property real changeableHeight: 120
+
+ onFontChanged: externalFont = font
+
+ onExternalFontChanged: {
+ if (content.font != content.externalFont) {
+ font = externalFont
+ wsListView.reset()
+ fontListView.reset()
+ weightListView.reset()
+ }
+ }
+
+ SystemPalette { id: palette }
+
+ Grid {
+ id: settings
+ anchors {
+ top: parent.top
+ bottom: buttonRow.top
+ left: parent.left
+ margins: content.outerSpacing
+ }
+ columns: 5
+ spacing: content.spacing
+
+ Text { id: writingSystemLabel; text: qsTr("Writing System") }
+ Text { id: fontNameLabel; text: qsTr("Font") }
+ Text { id: weightLabel; text: qsTr("Weight") }
+ Text { id: sizeLabel; text: qsTr("Size") }
+ Text { id: optionsLabel; text: qsTr("Others") }
+ Rectangle {
+ radius: 3
+ color: palette.window
+ border.color: content.borderColor
+ implicitWidth: Math.max(writingSystemLabel.implicitWidth + content.listMargins * 2, 80)
+ implicitHeight: Math.max(content.changeableHeight, sampleRectangle.height)
+ clip: true
+ ListView {
+ id: wsListView
+ anchors.fill: parent
+ anchors.margins: content.listMargins
+ anchors.topMargin: 2
+ highlightMoveDuration: 0
+ function reset() {
+ if (wsModel.count > 0) {
+ content.writingSystem = wsModel.get(0).name;
+ fontModel.writingSystem = content.writingSystem;
+ content.writingSystemSample = wsModel.get(0).sample;
+ }
+ }
+
+ model: WritingSystemListModel {
+ id: wsModel
+ Component.onCompleted: wsListView.reset()
+ }
+ highlight: Rectangle {
+ color: palette.highlight
+ x: 2 - wsListView.anchors.margins
+ width: wsListView.parent.width - 4
+ }
+ delegate: Item {
+ width: parent.width
+ height: wsText.height
+ Text {
+ id: wsText
+ text: name
+ width: parent.width
+ elide: Text.ElideRight
+ }
+ MouseArea {
+ anchors.fill: parent
+ onClicked: {
+ wsListView.currentIndex = index;
+ content.writingSystem = wsModel.get(wsListView.currentIndex).name;
+ fontModel.writingSystem = content.writingSystem;
+ content.writingSystemSample = wsModel.get(wsListView.currentIndex).sample;
+ }
+ }
+ }
+ }
+ }
+ Rectangle {
+ radius: 3
+ color: palette.window
+ border.color: content.borderColor
+ implicitWidth: Math.max(fontNameLabel.implicitWidth + content.listMargins * 2, 100, (root.width - 400) / 3)
+ implicitHeight: Math.max(content.changeableHeight, sampleRectangle.height)
+ clip: true
+ ListView {
+ id: fontListView
+ anchors.fill: parent
+ anchors.margins: content.listMargins
+ anchors.topMargin: 2
+ highlightMoveDuration: 0
+ function reset() {
+ fontModel.findIndex()
+ content.pointSizes = fontModel.pointSizes()
+ fontModel.findPointSizesIndex()
+ }
+
+ model: FontListModel {
+ id: fontModel
+ scalableFonts: root.scalableFonts
+ nonScalableFonts: root.nonScalableFonts
+ monospacedFonts: root.monospacedFonts
+ proportionalFonts: root.proportionalFonts
+ Component.onCompleted: fontListView.reset()
+ onModelReset: { findIndex(); }
+ function findIndex() {
+ if (fontModel.count <= 0)
+ return
+
+ if (content.font.family == "") {
+ content.font.family = fontModel.get(0).family
+ fontListView.currentIndex = 0
+ } else {
+ var find = false
+ for (var i = 0; i < fontModel.count; ++i) {
+ if (content.font.family == fontModel.get(i).family) {
+ find = true
+ fontListView.currentIndex = i
+ break
+ }
+ }
+ if (find == false) {
+ content.font.family = fontModel.get(0).family
+ fontListView.currentIndex = 0
+ }
+ }
+ }
+ function findPointSizesIndex() {
+ if (content.pointSizes.length <= 0)
+ return
+
+ var find = false
+ for (var i = 0; i < content.pointSizes.length; ++i) {
+ if (content.font.pointSize == content.pointSizes[i]) {
+ find = true
+ pointSizesListView.currentIndex = i
+ break
+ }
+ }
+ if (find == false) {
+ content.font.pointSize = content.pointSizes[0]
+ pointSizesListView.currentIndex = 0
+ }
+ }
+ }
+ highlight: Rectangle {
+ color: palette.highlight
+ x: 2 - fontListView.anchors.margins
+ width: fontListView.parent.width - 4
+ }
+ delegate: Item {
+ width: parent.width
+ height: fontText.height
+ Text {
+ id: fontText
+ text: family
+ width: parent.width
+ elide: Text.ElideRight
+ }
+ MouseArea {
+ anchors.fill: parent
+ onClicked: {
+ fontListView.currentIndex = index
+ content.font.family = fontModel.get(fontListView.currentIndex).family
+ }
+ }
+ }
+ }
+ }
+ Rectangle {
+ radius: 3
+ color: palette.window
+ border.color: content.borderColor
+ implicitWidth: Math.max(weightLabel.implicitWidth + content.listMargins * 2, 80)
+ implicitHeight: Math.max(content.changeableHeight, sampleRectangle.height)
+ clip: true
+ ListView {
+ anchors.fill: parent
+ anchors.margins: content.listMargins
+ anchors.topMargin: 2
+ highlightMoveDuration: 0
+ id: weightListView
+ function reset() {
+ weightModel.findIndex()
+ }
+
+ model: ListModel {
+ id: weightModel
+ ListElement {
+ name: "Light"
+ weight: Font.Light
+ }
+ ListElement {
+ name: "Normal"
+ weight: Font.Normal
+ }
+ ListElement {
+ name: "DemiBold"
+ weight: Font.DemiBold
+ }
+ ListElement {
+ name: "Bold"
+ weight: Font.Bold
+ }
+ ListElement {
+ name: "Black"
+ weight: Font.Black
+ }
+ Component.onCompleted: weightListView.reset()
+ function findIndex() {
+ var find = false
+ for (var i = 0; i < weightModel.count; ++i) {
+ if (content.font.weight == weightModel.get(i).weight) {
+ find = true
+ weightListView.currentIndex = i
+ break
+ }
+ }
+ if (find == false) {
+ content.font.weight = weightModel.get(1).family
+ fontListView.currentIndex = 1
+ }
+ }
+ }
+ highlight: Rectangle {
+ color: palette.highlight
+ x: 2 - weightListView.anchors.margins
+ width: weightListView.parent.width - 4
+ }
+ delegate: Item {
+ width: parent.width
+ height: weightText.height
+ Text {
+ id: weightText
+ text: name
+ width: parent.width
+ elide: Text.ElideRight
+ }
+ MouseArea {
+ anchors.fill: parent
+ onClicked: {
+ weightListView.currentIndex = index
+ content.font.weight = weightModel.get(weightListView.currentIndex).weight
+ }
+ }
+ }
+ }
+ }
+ Rectangle {
+ radius: 3
+ color: palette.window
+ border.color: content.borderColor
+ implicitWidth: Math.max(sizeLabel.implicitWidth + content.listMargins * 2, 60)
+ implicitHeight: Math.max(content.changeableHeight, sampleRectangle.height)
+ clip: true
+ ListView {
+ anchors.fill: parent
+ anchors.margins: content.listMargins
+ anchors.topMargin: 2
+ highlightMoveDuration: 0
+ id: pointSizesListView
+ model: content.pointSizes
+ highlight: Rectangle {
+ color: palette.highlight
+ x: 2 - weightListView.anchors.margins
+ width: weightListView.parent.width - 4
+ }
+ delegate: Item {
+ width: parent.width
+ height: pointSizesText.height
+ Text {
+ id: pointSizesText
+ text: content.pointSizes[index]
+ width: parent.width
+ elide: Text.ElideRight
+ }
+ MouseArea {
+ anchors.fill: parent
+ onClicked: {
+ pointSizesListView.currentIndex = index
+ content.font.pointSize = content.pointSizes[pointSizesListView.currentIndex]
+ }
+ }
+ }
+ }
+ }
+ Column {
+ id: optionsColumn
+ anchors.margins: 2
+ spacing: 2
+ CheckBox {
+ id: italicCheckBox
+ text: qsTr("Italic")
+ checked: content.font.italic
+ onClicked: { content.font.italic = italicCheckBox.checked }
+ }
+ CheckBox {
+ id: underlineCheckBox
+ text: qsTr("Underline")
+ checked: content.font.underline
+ onClicked: { content.font.underline = underlineCheckBox.checked }
+ }
+ CheckBox {
+ id: overlineCheckBox
+ text: qsTr("Overline")
+ checked: content.font.overline
+ onClicked: { content.font.overline = overlineCheckBox.checked }
+ }
+ CheckBox {
+ id: strikeoutCheckBox
+ text: qsTr("Strikeout")
+ checked: content.font.strikeout
+ onClicked: { content.font.strikeout = strikeoutCheckBox.checked }
+ }
+ }
+ }
+
+ Rectangle {
+ id: fixsampleRectangle
+ color: palette.window
+ anchors {
+ top: parent.top
+ left: settings.right
+ right: parent.right
+ margins: content.outerSpacing
+ }
+ implicitWidth: fixsampleText.implicitWidth
+ implicitHeight: fixsampleText.implicitHeight
+ Text { id: fixsampleText; anchors.left: parent.left; text: qsTr("Sample") }
+ }
+ Rectangle {
+ id: sampleRectangle
+ clip: true
+ anchors {
+ top: fixsampleRectangle.bottom
+ bottom: buttonRow.top
+ left: fixsampleRectangle.left
+ right: parent.right
+ margins: content.outerSpacing
+ }
+ implicitWidth: content.changeableWidth
+ implicitHeight: content.changeableHeight
+ color: palette.window
+ border.color: content.borderColor
+ Text {
+ id: sample
+ anchors.centerIn: parent
+ font: content.font
+ text: content.writingSystemSample
+ }
+ }
+
+ Item {
+ id: buttonRow
+ height: buttonsOnly.height
+ width: parent.width
+ anchors {
+ left: parent.left
+ right: parent.right
+ bottom: content.bottom
+ margins: content.outerSpacing
+ }
+ Row {
+ id: buttonsOnly
+ spacing: content.spacing
+ anchors.right: parent.right
+ Button {
+ id: cancelButton
+ text: qsTr("Cancel")
+ onClicked: root.reject()
+ }
+ Button {
+ id: okButton
+ text: qsTr("OK")
+ onClicked: {
+ root.font = content.font
+ root.accept()
+ }
+ }
+ }
+ }
+ }
+}
+
diff --git a/src/imports/dialogs/WidgetFontDialog.qml b/src/imports/dialogs/WidgetFontDialog.qml
new file mode 100644
index 0000000000..69f98b28a2
--- /dev/null
+++ b/src/imports/dialogs/WidgetFontDialog.qml
@@ -0,0 +1,44 @@
+/*****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the QtQuick.Dialogs module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
+** of its contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+*****************************************************************************/
+
+import QtQuick 2.2
+import QtQuick.PrivateWidgets 1.1
+
+QtFontDialog { }
diff --git a/src/imports/dialogs/dialogs.pro b/src/imports/dialogs/dialogs.pro
index e745d52e2b..c1d7041263 100644
--- a/src/imports/dialogs/dialogs.pro
+++ b/src/imports/dialogs/dialogs.pro
@@ -1,7 +1,7 @@
CXX_MODULE = qml
TARGET = dialogplugin
TARGETPATH = QtQuick/Dialogs
-IMPORT_VERSION = 1.0
+IMPORT_VERSION = 1.1
QMAKE_DOCS = $$PWD/doc/qtquickdialogs.qdocconf
@@ -12,6 +12,9 @@ SOURCES += \
qquickabstractcolordialog.cpp \
qquickplatformcolordialog.cpp \
qquickcolordialog.cpp \
+ qquickabstractfontdialog.cpp \
+ qquickplatformfontdialog.cpp \
+ qquickfontdialog.cpp \
qquickabstractdialog.cpp \
plugin.cpp
@@ -22,6 +25,9 @@ HEADERS += \
qquickabstractcolordialog_p.h \
qquickplatformcolordialog_p.h \
qquickcolordialog_p.h \
+ qquickabstractfontdialog_p.h \
+ qquickplatformfontdialog_p.h \
+ qquickfontdialog_p.h \
qquickabstractdialog_p.h
QML_FILES += \
@@ -29,12 +35,16 @@ QML_FILES += \
WidgetFileDialog.qml \
DefaultColorDialog.qml \
WidgetColorDialog.qml \
+ DefaultFontDialog.qml \
+ WidgetFontDialog.qml \
qml/Button.qml \
+ qml/CheckBox.qml \
qml/ColorSlider.qml \
qml/DefaultWindowDecoration.qml \
qml/TextField.qml \
qml/qmldir \
images/checkers.png \
+ images/checkmark.png \
images/copy.png \
images/crosshairs.png \
images/slider_handle.png \
@@ -43,6 +53,6 @@ QML_FILES += \
images/folder.png \
images/up.png
-QT += quick-private gui-private core-private
+QT += quick-private gui gui-private core core-private qml
load(qml_plugin)
diff --git a/src/imports/dialogs/images/checkmark.png b/src/imports/dialogs/images/checkmark.png
new file mode 100644
index 0000000000..821aafccdd
--- /dev/null
+++ b/src/imports/dialogs/images/checkmark.png
Binary files differ
diff --git a/src/imports/dialogs/plugin.cpp b/src/imports/dialogs/plugin.cpp
index 8fa87bfc0b..e8c669cb49 100644
--- a/src/imports/dialogs/plugin.cpp
+++ b/src/imports/dialogs/plugin.cpp
@@ -47,6 +47,9 @@
#include "qquickcolordialog_p.h"
#include "qquickabstractcolordialog_p.h"
#include "qquickplatformcolordialog_p.h"
+#include "qquickfontdialog_p.h"
+#include "qquickabstractfontdialog_p.h"
+#include "qquickplatformfontdialog_p.h"
#include <private/qguiapplication_p.h>
#include <qpa/qplatformintegration.h>
@@ -113,6 +116,14 @@ public:
else
#endif
registerWidgetOrQmlImplementation<QQuickColorDialog>(widgetsDir, qmlDir, "ColorDialog", uri, hasTopLevelWindows, 1, 0);
+
+ // FontDialog
+#ifndef PURE_QML_ONLY
+ if (QGuiApplicationPrivate::platformTheme()->usePlatformNativeDialog(QPlatformTheme::FontDialog))
+ qmlRegisterType<QQuickPlatformFontDialog>(uri, 1, 1, "FontDialog");
+ else
+#endif
+ registerWidgetOrQmlImplementation<QQuickFontDialog>(widgetsDir, qmlDir, "FontDialog", uri, hasTopLevelWindows, 1, 1);
}
protected:
diff --git a/src/imports/dialogs/qml/CheckBox.qml b/src/imports/dialogs/qml/CheckBox.qml
new file mode 100644
index 0000000000..32b0e6ff70
--- /dev/null
+++ b/src/imports/dialogs/qml/CheckBox.qml
@@ -0,0 +1,96 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the QtQuick.Dialogs module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
+** of its contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.1
+
+Item {
+ id: root
+ implicitHeight: frame.height
+ implicitWidth: row.implicitWidth
+ width: implicitWidth
+ height: implicitHeight
+ property alias text: label.text
+ property bool checked
+ property alias pressed: mouseArea.pressed
+ signal clicked
+
+ SystemPalette { id: palette }
+
+ Row {
+ id: row
+ anchors.verticalCenter: parent.verticalCenter
+ spacing: 6
+ Rectangle {
+ id: frame
+ gradient: Gradient {
+ GradientStop { position: 0.0; color: mouseArea.pressed ? Qt.darker(palette.button, 1.3) : palette.button }
+ GradientStop { position: 1.0; color: Qt.darker(palette.button, 1.3) }
+ }
+ height: label.implicitHeight * 1.5
+ width: height
+ anchors.margins: 1
+ radius: 3
+ antialiasing: true
+ border.color: Qt.darker(palette.button, 1.5)
+ Image {
+ id: theX
+ source: "../images/checkmark.png"
+ anchors.fill: frame
+ anchors.margins: frame.width / 5
+ fillMode: Image.PreserveAspectFit
+ smooth: true
+ visible: checked
+ }
+ }
+ Text {
+ id: label
+ color: palette.text
+ anchors.verticalCenter: frame.verticalCenter
+ }
+ }
+ MouseArea {
+ id: mouseArea
+ anchors.fill: parent
+ onClicked: {
+ parent.checked = !parent.checked
+ parent.clicked()
+ }
+ }
+}
diff --git a/src/imports/dialogs/qml/qmldir b/src/imports/dialogs/qml/qmldir
index c475502cf1..39cbc937e5 100644
--- a/src/imports/dialogs/qml/qmldir
+++ b/src/imports/dialogs/qml/qmldir
@@ -1,3 +1,4 @@
Button 1.0 Button.qml
+CheckBox 1.1 CheckBox.qml
ColorSlider 1.0 ColorSlider.qml
TextField 1.0 TextField.qml
diff --git a/src/imports/dialogs/qquickabstractfontdialog.cpp b/src/imports/dialogs/qquickabstractfontdialog.cpp
new file mode 100644
index 0000000000..29dd15e8cc
--- /dev/null
+++ b/src/imports/dialogs/qquickabstractfontdialog.cpp
@@ -0,0 +1,150 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the QtQuick.Dialogs module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qquickabstractfontdialog_p.h"
+#include "qquickitem.h"
+
+#include <private/qguiapplication_p.h>
+#include <QWindow>
+#include <QQuickWindow>
+
+QT_BEGIN_NAMESPACE
+
+QQuickAbstractFontDialog::QQuickAbstractFontDialog(QObject *parent)
+ : QQuickAbstractDialog(parent)
+ , m_dlgHelper(0)
+ , m_options(QSharedPointer<QFontDialogOptions>(new QFontDialogOptions()))
+{
+ // On the Mac, modality doesn't work unless you call exec(). But this is a reasonable default anyway.
+ m_modality = Qt::NonModal;
+ connect(this, SIGNAL(accepted()), this, SIGNAL(selectionAccepted()));
+}
+
+QQuickAbstractFontDialog::~QQuickAbstractFontDialog()
+{
+}
+
+void QQuickAbstractFontDialog::setVisible(bool v)
+{
+ if (helper() && v) {
+ m_dlgHelper->setOptions(m_options);
+ // Due to the fact that QFontDialogOptions doesn't have currentFont...
+ m_dlgHelper->setCurrentFont(m_font);
+ }
+ QQuickAbstractDialog::setVisible(v);
+}
+
+void QQuickAbstractFontDialog::setModality(Qt::WindowModality m)
+{
+#ifdef Q_OS_MAC
+ // On the Mac, modality doesn't work unless you call exec()
+ m_modality = Qt::NonModal;
+ emit modalityChanged();
+ return;
+#endif
+ QQuickAbstractDialog::setModality(m);
+}
+
+QString QQuickAbstractFontDialog::title() const
+{
+ return m_options->windowTitle();
+}
+
+bool QQuickAbstractFontDialog::scalableFonts() const
+{
+ return m_options->testOption(QFontDialogOptions::ScalableFonts);
+}
+
+bool QQuickAbstractFontDialog::nonScalableFonts() const
+{
+ return m_options->testOption(QFontDialogOptions::NonScalableFonts);
+}
+
+bool QQuickAbstractFontDialog::monospacedFonts() const
+{
+ return m_options->testOption(QFontDialogOptions::MonospacedFonts);
+}
+
+bool QQuickAbstractFontDialog::proportionalFonts() const
+{
+ return m_options->testOption(QFontDialogOptions::ProportionalFonts);
+}
+
+void QQuickAbstractFontDialog::setTitle(const QString &t)
+{
+ if (m_options->windowTitle() == t) return;
+ m_options->setWindowTitle(t);
+ emit titleChanged();
+}
+
+void QQuickAbstractFontDialog::setFont(const QFont &arg)
+{
+ if (m_font != arg) {
+ m_font = arg;
+ emit fontChanged();
+ }
+}
+
+void QQuickAbstractFontDialog::setScalableFonts(bool arg)
+{
+ m_options->setOption(QFontDialogOptions::ScalableFonts, arg);
+ emit scalableFontsChanged();
+}
+
+void QQuickAbstractFontDialog::setNonScalableFonts(bool arg)
+{
+ m_options->setOption(QFontDialogOptions::NonScalableFonts, arg);
+ emit nonScalableFontsChanged();
+}
+
+void QQuickAbstractFontDialog::setMonospacedFonts(bool arg)
+{
+ m_options->setOption(QFontDialogOptions::MonospacedFonts, arg);
+ emit monospacedFontsChanged();
+}
+
+void QQuickAbstractFontDialog::setProportionalFonts(bool arg)
+{
+ m_options->setOption(QFontDialogOptions::ProportionalFonts, arg);
+ emit proportionalFontsChanged();
+}
+
+QT_END_NAMESPACE
diff --git a/src/imports/dialogs/qquickabstractfontdialog_p.h b/src/imports/dialogs/qquickabstractfontdialog_p.h
new file mode 100644
index 0000000000..858a0d3eac
--- /dev/null
+++ b/src/imports/dialogs/qquickabstractfontdialog_p.h
@@ -0,0 +1,113 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the QtQuick.Dialogs module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QQUICKABSTRACTFONTDIALOG_P_H
+#define QQUICKABSTRACTFONTDIALOG_P_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include <QtQml>
+#include <QQuickView>
+#include <QtGui/qpa/qplatformdialoghelper.h>
+#include <QtGui/qfont.h>
+#include <qpa/qplatformtheme.h>
+#include "qquickabstractdialog_p.h"
+
+QT_BEGIN_NAMESPACE
+
+class QQuickAbstractFontDialog : public QQuickAbstractDialog
+{
+ Q_OBJECT
+ Q_PROPERTY(bool scalableFonts READ scalableFonts WRITE setScalableFonts NOTIFY scalableFontsChanged)
+ Q_PROPERTY(bool nonScalableFonts READ nonScalableFonts WRITE setNonScalableFonts NOTIFY nonScalableFontsChanged)
+ Q_PROPERTY(bool monospacedFonts READ monospacedFonts WRITE setMonospacedFonts NOTIFY monospacedFontsChanged)
+ Q_PROPERTY(bool proportionalFonts READ proportionalFonts WRITE setProportionalFonts NOTIFY proportionalFontsChanged)
+ Q_PROPERTY(QFont font READ font WRITE setFont NOTIFY fontChanged)
+
+public:
+ QQuickAbstractFontDialog(QObject *parent = 0);
+ virtual ~QQuickAbstractFontDialog();
+
+ virtual QString title() const;
+ bool scalableFonts() const;
+ bool nonScalableFonts() const;
+ bool monospacedFonts() const;
+ bool proportionalFonts() const;
+ QFont font() const { return m_font; }
+
+public Q_SLOTS:
+ void setVisible(bool v);
+ void setModality(Qt::WindowModality m);
+ void setTitle(const QString &t);
+ void setFont(const QFont &arg);
+ void setScalableFonts(bool arg);
+ void setNonScalableFonts(bool arg);
+ void setMonospacedFonts(bool arg);
+ void setProportionalFonts(bool arg);
+
+Q_SIGNALS:
+ void scalableFontsChanged();
+ void nonScalableFontsChanged();
+ void monospacedFontsChanged();
+ void proportionalFontsChanged();
+ void fontChanged();
+ void selectionAccepted();
+
+protected:
+ QPlatformFontDialogHelper *m_dlgHelper;
+ QSharedPointer<QFontDialogOptions> m_options;
+ QFont m_font;
+
+ Q_DISABLE_COPY(QQuickAbstractFontDialog)
+};
+
+QT_END_NAMESPACE
+
+#endif // QQUICKABSTRACTFONTDIALOG_P_H
diff --git a/src/imports/dialogs/qquickfontdialog.cpp b/src/imports/dialogs/qquickfontdialog.cpp
new file mode 100644
index 0000000000..2f3c6d83bb
--- /dev/null
+++ b/src/imports/dialogs/qquickfontdialog.cpp
@@ -0,0 +1,120 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the QtQuick.Dialogs module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qquickfontdialog_p.h"
+#include <QQuickItem>
+#include <private/qguiapplication_p.h>
+#include <qpa/qplatformintegration.h>
+
+QT_BEGIN_NAMESPACE
+
+/*!
+ \qmltype AbstractFontDialog
+ \instantiates QQuickFontDialog
+ \inqmlmodule QtQuick.Dialogs 1
+ \ingroup qtquick-visual
+ \brief API wrapper for QML font dialog implementations
+ \since 5.2
+ \internal
+
+ AbstractFontDialog provides only the API for implementing a font dialog.
+ The implementation (e.g. a Window or preferably an Item, in case it is
+ shown on a device that doesn't support multiple windows) can be provided as
+ \l implementation, which is the default property (the only allowed child
+ element).
+*/
+
+/*!
+ \qmlsignal QtQuick::Dialogs::AbstractFontDialog::accepted
+
+ The \a accepted signal is emitted by \l accept().
+*/
+
+/*!
+ \qmlsignal QtQuick::Dialogs::AbstractFontDialog::rejected
+
+ The \a accepted signal is emitted by \l reject().
+*/
+
+/*!
+ \class QQuickFontDialog
+ \inmodule QtQuick.Dialogs
+ \internal
+
+ The QQuickFontDialog class is a concrete subclass of \l
+ QQuickAbstractFontDialog, but it is abstract from the QML perspective
+ because it needs to enclose a graphical implementation. It exists in order
+ to provide accessors and helper functions which the QML implementation will
+ need.
+
+ \since 5.2
+*/
+
+/*!
+ Constructs a font dialog wrapper with parent window \a parent.
+*/
+QQuickFontDialog::QQuickFontDialog(QObject *parent)
+ : QQuickAbstractFontDialog(parent)
+{
+}
+
+
+/*!
+ Destroys the font dialog wrapper.
+*/
+QQuickFontDialog::~QQuickFontDialog()
+{
+}
+
+/*!
+ \qmlproperty bool AbstractFontDialog::visible
+
+ This property holds whether the dialog is visible. By default this is false.
+*/
+
+/*!
+ \qmlproperty QObject AbstractFontDialog::implementation
+
+ The QML object which implements the actual font dialog. Should be either a
+ \l Window or an \l Item.
+*/
+
+QT_END_NAMESPACE
diff --git a/src/imports/dialogs/qquickfontdialog_p.h b/src/imports/dialogs/qquickfontdialog_p.h
new file mode 100644
index 0000000000..a8e2d82e6f
--- /dev/null
+++ b/src/imports/dialogs/qquickfontdialog_p.h
@@ -0,0 +1,80 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the QtQuick.Dialogs module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QQUICKFONTDIALOG_P_H
+#define QQUICKFONTDIALOG_P_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include "qquickabstractfontdialog_p.h"
+
+QT_BEGIN_NAMESPACE
+
+class QQuickFontDialog : public QQuickAbstractFontDialog
+{
+ Q_OBJECT
+ Q_PROPERTY(QObject* implementation READ qmlImplementation WRITE setQmlImplementation DESIGNABLE false)
+ Q_CLASSINFO("DefaultProperty", "implementation")
+
+public:
+ explicit QQuickFontDialog(QObject *parent = 0);
+ ~QQuickFontDialog();
+
+protected:
+ virtual QPlatformFontDialogHelper *helper() { return 0; }
+
+ Q_DISABLE_COPY(QQuickFontDialog)
+};
+
+QT_END_NAMESPACE
+
+QML_DECLARE_TYPE(QQuickFontDialog *)
+
+#endif // QQUICKFONTDIALOG_P_H
diff --git a/src/imports/dialogs/qquickplatformfontdialog.cpp b/src/imports/dialogs/qquickplatformfontdialog.cpp
new file mode 100644
index 0000000000..8b2e0e0501
--- /dev/null
+++ b/src/imports/dialogs/qquickplatformfontdialog.cpp
@@ -0,0 +1,251 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the QtQuick.Dialogs module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qquickplatformfontdialog_p.h"
+#include "qquickitem.h"
+
+#include <private/qguiapplication_p.h>
+#include <QWindow>
+#include <QQuickView>
+#include <QQuickWindow>
+
+QT_BEGIN_NAMESPACE
+
+/*!
+ \qmltype FontDialog
+ \instantiates QQuickPlatformFontDialog
+ \inqmlmodule QtQuick.Dialogs 1
+ \ingroup qtquick-visual
+ \brief Dialog component for choosing a font.
+ \since 5.2
+
+ FontDialog allows the user to select a font. The dialog is initially
+ invisible. You need to set the properties as desired first, then set
+ \l visible to true or call \l open().
+
+ Here is a minimal example to open a font dialog and exit after the user
+ chooses a font:
+
+ \qml
+ import QtQuick 2.2
+ import QtQuick.Dialogs 1.1
+
+ FontDialog {
+ id: fontDialog
+ title: "Please choose a font"
+ font: Qt.font({ family: "Arial", pointSize: 24, weight: Font.Normal })
+ onAccepted: {
+ console.log("You chose: " + fontDialog.font)
+ Qt.quit()
+ }
+ onRejected: {
+ console.log("Canceled")
+ Qt.quit()
+ }
+ Component.onCompleted: visible = true
+ }
+ \endqml
+
+ A FontDialog window is automatically transient for its parent window. So
+ whether you declare the dialog inside an \l Item or inside a \l Window, the
+ dialog will appear centered over the window containing the item, or over
+ the Window that you declared.
+
+ The implementation of FontDialog will be a platform font dialog if
+ possible. If that isn't possible, then it will try to instantiate a
+ \l QFontDialog. If that also isn't possible, then it will fall back to a QML
+ implementation, DefaultFontDialog.qml. In that case you can customize the
+ appearance by editing this file. DefaultFontDialog.qml contains a Rectangle
+ to hold the dialog's contents, because certain embedded systems do not
+ support multiple top-level windows. When the dialog becomes visible, it
+ will automatically be wrapped in a Window if possible, or simply reparented
+ on top of the main window if there can only be one window.
+*/
+
+/*!
+ \qmlsignal QtQuick::Dialogs::FontDialog::accepted
+
+ The \a accepted signal is emitted when the user has finished using the
+ dialog. You can then inspect the \a font property to get the selection.
+
+ Example:
+
+ \qml
+ FontDialog {
+ onAccepted: { console.log("Selected font: " + font) }
+ }
+ \endqml
+*/
+
+/*!
+ \qmlsignal QtQuick::Dialogs::FontDialog::rejected
+
+ The \a rejected signal is emitted when the user has dismissed the dialog,
+ either by closing the dialog window or by pressing the Cancel button.
+*/
+
+/*!
+ \class QQuickPlatformFontDialog
+ \inmodule QtQuick.Dialogs
+ \internal
+
+ \brief The QQuickPlatformFontDialog class provides a font dialog
+
+ The dialog is implemented via the QQuickPlatformFontDialogHelper when possible;
+ otherwise it falls back to a QFontDialog or a QML implementation.
+
+ \since 5.2
+*/
+
+/*!
+ Constructs a file dialog with parent window \a parent.
+*/
+QQuickPlatformFontDialog::QQuickPlatformFontDialog(QObject *parent) :
+ QQuickAbstractFontDialog(parent)
+{
+}
+
+/*!
+ Destroys the file dialog.
+*/
+QQuickPlatformFontDialog::~QQuickPlatformFontDialog()
+{
+ if (m_dlgHelper)
+ m_dlgHelper->hide();
+ delete m_dlgHelper;
+}
+
+QPlatformFontDialogHelper *QQuickPlatformFontDialog::helper()
+{
+ QQuickItem *parentItem = qobject_cast<QQuickItem *>(parent());
+ if (parentItem)
+ m_parentWindow = parentItem->window();
+
+ if ( !m_dlgHelper && QGuiApplicationPrivate::platformTheme()->
+ usePlatformNativeDialog(QPlatformTheme::FontDialog) ) {
+ m_dlgHelper = static_cast<QPlatformFontDialogHelper *>(QGuiApplicationPrivate::platformTheme()
+ ->createPlatformDialogHelper(QPlatformTheme::FontDialog));
+ if (!m_dlgHelper)
+ return m_dlgHelper;
+ connect(m_dlgHelper, SIGNAL(accept()), this, SLOT(accept()));
+ connect(m_dlgHelper, SIGNAL(reject()), this, SLOT(reject()));
+ connect(m_dlgHelper, SIGNAL(currentFontChanged(const QFont&)), this, SLOT(setFont(const QFont&)));
+ connect(m_dlgHelper, SIGNAL(fontSelected(const QFont&)), this, SLOT(setFont(const QFont&)));
+ }
+
+ return m_dlgHelper;
+}
+
+/*!
+ \qmlproperty bool FontDialog::visible
+
+ This property holds whether the dialog is visible. By default this is
+ false.
+
+ \sa modality
+*/
+
+/*!
+ \qmlproperty Qt::WindowModality FontDialog::modality
+
+ Whether the dialog should be shown modal with respect to the window
+ containing the dialog's parent Item, modal with respect to the whole
+ application, or non-modal.
+
+ By default it is \l WindowModal.
+
+ Modality does not mean that there are any blocking calls to wait for the
+ dialog to be accepted or rejected; it's only that the user will be
+ prevented from interacting with the parent window and/or the application
+ windows at the same time. You probably need to write an onAccepted handler
+ to actually load or save the chosen file.
+*/
+
+/*!
+ \qmlmethod void FontDialog::open()
+
+ Shows the dialog to the user. It is equivalent to setting \l visible to
+ true.
+*/
+
+/*!
+ \qmlmethod void FontDialog::close()
+
+ Closes the dialog.
+*/
+
+/*!
+ \qmlproperty string FontDialog::title
+
+ The title of the dialog window.
+*/
+
+/*!
+ \qmlproperty bool FontDialog::scalableFonts
+
+ Whether the dialog will show scalable fonts or not.
+*/
+
+/*!
+ \qmlproperty bool FontDialog::nonScalableFonts
+
+ Whether the dialog will show non scalable fonts or not.
+*/
+
+/*!
+ \qmlproperty bool FontDialog::monospacedFonts
+
+ Whether the dialog will show monospaced fonts or not.
+*/
+
+/*!
+ \qmlproperty bool FontDialog::proportionalFonts
+
+ Whether the dialog will show proportional fonts or not.
+*/
+
+/*!
+ \qmlproperty font FontDialog::font
+
+ The font which the user selected.
+*/
+
+QT_END_NAMESPACE
diff --git a/src/imports/dialogs/qquickplatformfontdialog_p.h b/src/imports/dialogs/qquickplatformfontdialog_p.h
new file mode 100644
index 0000000000..743b24ad87
--- /dev/null
+++ b/src/imports/dialogs/qquickplatformfontdialog_p.h
@@ -0,0 +1,78 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the QtQuick.Dialogs module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QQUICKPLATFORMFONTDIALOG_P_H
+#define QQUICKPLATFORMFONTDIALOG_P_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include "qquickabstractfontdialog_p.h"
+
+QT_BEGIN_NAMESPACE
+
+class QQuickPlatformFontDialog : public QQuickAbstractFontDialog
+{
+ Q_OBJECT
+
+public:
+ QQuickPlatformFontDialog(QObject *parent = 0);
+ virtual ~QQuickPlatformFontDialog();
+
+protected:
+ QPlatformFontDialogHelper *helper();
+
+ Q_DISABLE_COPY(QQuickPlatformFontDialog)
+};
+
+QT_END_NAMESPACE
+
+QML_DECLARE_TYPE(QQuickPlatformFontDialog *)
+
+#endif // QQUICKPLATFORMFONTDIALOG_P_H
diff --git a/src/imports/imports.pro b/src/imports/imports.pro
index 5bc5d61eb7..3f15755211 100644
--- a/src/imports/imports.pro
+++ b/src/imports/imports.pro
@@ -11,6 +11,7 @@ qtHaveModule(quick) {
qtquick2 \
particles \
window \
+ dialogs-private \
dialogs \
testlib
}
diff --git a/src/imports/widgets/qquickqfontdialog.cpp b/src/imports/widgets/qquickqfontdialog.cpp
new file mode 100644
index 0000000000..6d637e1ddb
--- /dev/null
+++ b/src/imports/widgets/qquickqfontdialog.cpp
@@ -0,0 +1,178 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the QtQuick.Dialogs module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qquickqfontdialog_p.h"
+#include "qquickitem.h"
+
+#include <private/qguiapplication_p.h>
+#include <private/qqmlcontext_p.h>
+#include <QWindow>
+#include <QQuickWindow>
+#include <QFontDialog>
+
+QT_BEGIN_NAMESPACE
+
+class QFontDialogHelper : public QPlatformFontDialogHelper
+{
+public:
+ QFontDialogHelper() :
+ QPlatformFontDialogHelper()
+ {
+ connect(&m_dialog, SIGNAL(currentFontChanged(const QFont &)), this, SIGNAL(currentFontChanged(const QFont &)));
+ connect(&m_dialog, SIGNAL(fontSelected(const QFont &)), this, SIGNAL(fontSelected(const QFont &)));
+ connect(&m_dialog, SIGNAL(accepted()), this, SIGNAL(accept()));
+ connect(&m_dialog, SIGNAL(rejected()), this, SIGNAL(reject()));
+ }
+
+ virtual void setCurrentFont(const QFont &font) { m_dialog.setCurrentFont(font); }
+ virtual QFont currentFont() const { return m_dialog.currentFont(); }
+
+ virtual void exec() { m_dialog.exec(); }
+
+ virtual bool show(Qt::WindowFlags f, Qt::WindowModality m, QWindow *parent) {
+ m_dialog.winId();
+ QWindow *window = m_dialog.windowHandle();
+ Q_ASSERT(window);
+ window->setTransientParent(parent);
+ window->setFlags(f);
+ m_dialog.windowHandle()->setTransientParent(parent);
+ m_dialog.windowHandle()->setFlags(f);
+ m_dialog.setWindowModality(m);
+ m_dialog.setWindowTitle(QPlatformFontDialogHelper::options()->windowTitle());
+ m_dialog.setOptions((QFontDialog::FontDialogOptions)((int)(QPlatformFontDialogHelper::options()->options())));
+ m_dialog.show();
+ return m_dialog.isVisible();
+ }
+
+ virtual void hide() { m_dialog.hide(); }
+
+private:
+ QFontDialog m_dialog;
+};
+
+/*!
+ \qmltype QtFontDialog
+ \instantiates QQuickQFontDialog
+ \inqmlmodule QtQuick.PrivateWidgets 1
+ \ingroup qtquick-visual
+ \brief Dialog component for choosing files from a local filesystem.
+ \since 5.2
+ \internal
+
+ QtFontDialog provides a means to instantiate and manage a QFontDialog.
+ It is not recommended to be used directly; it is an implementation
+ detail of \l FontDialog in the \l QtQuick.Dialogs module.
+
+ To use this type, you will need to import the module with the following line:
+ \code
+ import QtQuick.PrivateWidgets 1.1
+ \endcode
+*/
+
+/*!
+ \qmlsignal QtQuick::Dialogs::FontDialog::accepted
+
+ The \a accepted signal is emitted when the user has finished using the
+ dialog. You can then inspect the \a filePath or \a filePaths properties to
+ get the selection.
+
+ Example:
+
+ \qml
+ FontDialog {
+ onAccepted: { console.log("Selected file: " + filePath) }
+ }
+ \endqml
+*/
+
+/*!
+ \qmlsignal QtQuick::Dialogs::FontDialog::rejected
+
+ The \a rejected signal is emitted when the user has dismissed the dialog,
+ either by closing the dialog window or by pressing the Cancel button.
+*/
+
+/*!
+ \class QQuickQFontDialog
+ \inmodule QtQuick.PrivateWidgets
+ \internal
+
+ \brief The QQuickQFontDialog class is a wrapper for a QFontDialog.
+
+ \since 5.2
+*/
+
+/*!
+ Constructs a file dialog with parent window \a parent.
+*/
+QQuickQFontDialog::QQuickQFontDialog(QObject *parent)
+ : QQuickAbstractFontDialog(parent)
+{
+}
+
+/*!
+ Destroys the file dialog.
+*/
+QQuickQFontDialog::~QQuickQFontDialog()
+{
+ if (m_dlgHelper)
+ m_dlgHelper->hide();
+ delete m_dlgHelper;
+}
+
+QPlatformFontDialogHelper *QQuickQFontDialog::helper()
+{
+ QQuickItem *parentItem = qobject_cast<QQuickItem *>(parent());
+ if (parentItem)
+ m_parentWindow = parentItem->window();
+
+ if (!m_dlgHelper) {
+ m_dlgHelper = new QFontDialogHelper();
+ connect(m_dlgHelper, SIGNAL(currentFontChanged(const QFont &)), this, SLOT(setFont(const QFont &)));
+ connect(m_dlgHelper, SIGNAL(fontSelected(const QFont &)), this, SLOT(setFont(const QFont &)));
+ connect(m_dlgHelper, SIGNAL(accept()), this, SLOT(accept()));
+ connect(m_dlgHelper, SIGNAL(reject()), this, SLOT(reject()));
+ }
+
+ return m_dlgHelper;
+}
+
+QT_END_NAMESPACE
diff --git a/src/imports/widgets/qquickqfontdialog_p.h b/src/imports/widgets/qquickqfontdialog_p.h
new file mode 100644
index 0000000000..6efd15995b
--- /dev/null
+++ b/src/imports/widgets/qquickqfontdialog_p.h
@@ -0,0 +1,78 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the QtQuick.Dialogs module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QQUICKQFONTDIALOG_P_H
+#define QQUICKQFONTDIALOG_P_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include "../dialogs/qquickabstractfontdialog_p.h"
+
+QT_BEGIN_NAMESPACE
+
+class QQuickQFontDialog : public QQuickAbstractFontDialog
+{
+ Q_OBJECT
+
+public:
+ QQuickQFontDialog(QObject *parent = 0);
+ virtual ~QQuickQFontDialog();
+
+protected:
+ QPlatformFontDialogHelper *helper();
+
+ Q_DISABLE_COPY(QQuickQFontDialog)
+};
+
+QT_END_NAMESPACE
+
+QML_DECLARE_TYPE(QQuickQFontDialog *)
+
+#endif // QQUICKQFONTDIALOG_P_H
diff --git a/src/imports/widgets/widgets.pro b/src/imports/widgets/widgets.pro
index 7e6a04161a..6d40897781 100644
--- a/src/imports/widgets/widgets.pro
+++ b/src/imports/widgets/widgets.pro
@@ -1,13 +1,15 @@
CXX_MODULE = qml
TARGET = widgetsplugin
TARGETPATH = QtQuick/PrivateWidgets
-IMPORT_VERSION = 1.0
+IMPORT_VERSION = 1.1
SOURCES += \
qquickqfiledialog.cpp \
../dialogs/qquickabstractfiledialog.cpp \
qquickqcolordialog.cpp \
../dialogs/qquickabstractcolordialog.cpp \
+ qquickqfontdialog.cpp \
+ ../dialogs/qquickabstractfontdialog.cpp \
../dialogs/qquickabstractdialog.cpp \
widgetsplugin.cpp
@@ -16,6 +18,8 @@ HEADERS += \
../dialogs/qquickabstractfiledialog_p.h \
qquickqcolordialog_p.h \
../dialogs/qquickabstractcolordialog_p.h \
+ qquickqfontdialog_p.h \
+ ../dialogs/qquickabstractfontdialog_p.h \
../dialogs/qquickabstractdialog_p.h
QT += quick-private gui-private core-private qml-private widgets
diff --git a/src/imports/widgets/widgetsplugin.cpp b/src/imports/widgets/widgetsplugin.cpp
index be9d59f346..4df0292d8a 100644
--- a/src/imports/widgets/widgetsplugin.cpp
+++ b/src/imports/widgets/widgetsplugin.cpp
@@ -43,6 +43,7 @@
#include <QtQml/qqml.h>
#include "qquickqfiledialog_p.h"
#include "qquickqcolordialog_p.h"
+#include "qquickqfontdialog_p.h"
QT_BEGIN_NAMESPACE
@@ -77,6 +78,7 @@ public:
qmlRegisterType<QQuickQFileDialog>(uri, 1, 0, "QtFileDialog");
qmlRegisterType<QQuickQColorDialog>(uri, 1, 0, "QtColorDialog");
+ qmlRegisterType<QQuickQFontDialog>(uri, 1, 1, "QtFontDialog");
}
};