aboutsummaryrefslogtreecommitdiffstats
path: root/src/imports/platform/widgets
diff options
context:
space:
mode:
Diffstat (limited to 'src/imports/platform/widgets')
-rw-r--r--src/imports/platform/widgets/qwidgetplatform_p.h125
-rw-r--r--src/imports/platform/widgets/qwidgetplatformcolordialog.cpp87
-rw-r--r--src/imports/platform/widgets/qwidgetplatformcolordialog_p.h78
-rw-r--r--src/imports/platform/widgets/qwidgetplatformdialog.cpp58
-rw-r--r--src/imports/platform/widgets/qwidgetplatformdialog_p.h66
-rw-r--r--src/imports/platform/widgets/qwidgetplatformfiledialog.cpp140
-rw-r--r--src/imports/platform/widgets/qwidgetplatformfiledialog_p.h84
-rw-r--r--src/imports/platform/widgets/qwidgetplatformfontdialog.cpp87
-rw-r--r--src/imports/platform/widgets/qwidgetplatformfontdialog_p.h78
-rw-r--r--src/imports/platform/widgets/qwidgetplatformmenu.cpp186
-rw-r--r--src/imports/platform/widgets/qwidgetplatformmenu_p.h99
-rw-r--r--src/imports/platform/widgets/qwidgetplatformmenuitem.cpp131
-rw-r--r--src/imports/platform/widgets/qwidgetplatformmenuitem_p.h89
-rw-r--r--src/imports/platform/widgets/qwidgetplatformmessagedialog.cpp85
-rw-r--r--src/imports/platform/widgets/qwidgetplatformmessagedialog_p.h75
-rw-r--r--src/imports/platform/widgets/qwidgetplatformsystemtrayicon.cpp114
-rw-r--r--src/imports/platform/widgets/qwidgetplatformsystemtrayicon_p.h85
-rw-r--r--src/imports/platform/widgets/widgets.pri23
18 files changed, 1690 insertions, 0 deletions
diff --git a/src/imports/platform/widgets/qwidgetplatform_p.h b/src/imports/platform/widgets/qwidgetplatform_p.h
new file mode 100644
index 00000000..06dcc9d3
--- /dev/null
+++ b/src/imports/platform/widgets/qwidgetplatform_p.h
@@ -0,0 +1,125 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Labs Platform module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** 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 The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/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 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later 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 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QWIDGETPLATFORM_P_H
+#define QWIDGETPLATFORM_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 <QtCore/qdebug.h>
+#include <QtCore/qcoreapplication.h>
+#include <QtGui/qpa/qplatformtheme.h>
+#include <QtGui/qpa/qplatformdialoghelper.h>
+#include <QtGui/qpa/qplatformsystemtrayicon.h>
+#include <QtGui/qpa/qplatformmenu.h>
+
+#ifdef QT_WIDGETS_LIB
+#include "qwidgetplatformcolordialog_p.h"
+#include "qwidgetplatformfiledialog_p.h"
+#include "qwidgetplatformfontdialog_p.h"
+#include "qwidgetplatformmessagedialog_p.h"
+#include "qwidgetplatformmenu_p.h"
+#include "qwidgetplatformmenuitem_p.h"
+#include "qwidgetplatformsystemtrayicon_p.h"
+#endif
+
+QT_BEGIN_NAMESPACE
+
+#ifndef QT_WIDGETS_LIB
+typedef QPlatformMenu QWidgetPlatformMenu;
+typedef QPlatformMenuItem QWidgetPlatformMenuItem;
+typedef QPlatformColorDialogHelper QWidgetPlatformColorDialog;
+typedef QPlatformFileDialogHelper QWidgetPlatformFileDialog;
+typedef QPlatformFontDialogHelper QWidgetPlatformFontDialog;
+typedef QPlatformMessageDialogHelper QWidgetPlatformMessageDialog;
+typedef QPlatformSystemTrayIcon QWidgetPlatformSystemTrayIcon;
+#endif
+
+namespace QWidgetPlatform
+{
+ static inline bool isAvailable(const char *type)
+ {
+ if (!qApp->inherits("QApplication")) {
+ qCritical("\nERROR: No native %s implementation available."
+ "\nQt Labs Platform requires Qt Widgets on this setup."
+ "\nAdd 'QT += widgets' to .pro and create QApplication in main().\n", type);
+ return false;
+ }
+ return true;
+ }
+
+ template<typename T>
+ static inline T *createWidget(const char *name, QObject *parent)
+ {
+ static bool available = isAvailable(name);
+#ifdef QT_WIDGETS_LIB
+ if (available)
+ return new T(parent);
+#else
+ Q_UNUSED(parent)
+ Q_UNUSED(available)
+#endif
+ return nullptr;
+ }
+
+ static inline QPlatformMenu *createMenu(QObject *parent = nullptr) { return createWidget<QWidgetPlatformMenu>("Menu", parent); }
+ static inline QPlatformMenuItem *createMenuItem(QObject *parent = nullptr) { return createWidget<QWidgetPlatformMenuItem>("MenuItem", parent); }
+ static inline QPlatformSystemTrayIcon *createSystemTrayIcon(QObject *parent = nullptr) { return createWidget<QWidgetPlatformSystemTrayIcon>("SystemTrayIcon", parent); }
+ static inline QPlatformDialogHelper *createDialog(QPlatformTheme::DialogType type, QObject *parent = nullptr)
+ {
+ switch (type) {
+ case QPlatformTheme::ColorDialog: return createWidget<QWidgetPlatformColorDialog>("ColorDialog", parent);
+ case QPlatformTheme::FileDialog: return createWidget<QWidgetPlatformFileDialog>("FileDialog", parent);
+ case QPlatformTheme::FontDialog: return createWidget<QWidgetPlatformFontDialog>("FontDialog", parent);
+ case QPlatformTheme::MessageDialog: return createWidget<QWidgetPlatformMessageDialog>("MessageDialog", parent);
+ default: Q_UNREACHABLE(); break;
+ return nullptr;
+ }
+ }
+}
+
+QT_END_NAMESPACE
+
+#endif // QWIDGETPLATFORM_P_H
diff --git a/src/imports/platform/widgets/qwidgetplatformcolordialog.cpp b/src/imports/platform/widgets/qwidgetplatformcolordialog.cpp
new file mode 100644
index 00000000..69a76eb2
--- /dev/null
+++ b/src/imports/platform/widgets/qwidgetplatformcolordialog.cpp
@@ -0,0 +1,87 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Labs Platform module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** 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 The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/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 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later 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 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qwidgetplatformcolordialog_p.h"
+#include "qwidgetplatformdialog_p.h"
+
+#include <QtWidgets/qcolordialog.h>
+
+QT_BEGIN_NAMESPACE
+
+QWidgetPlatformColorDialog::QWidgetPlatformColorDialog(QObject *parent)
+ : m_dialog(new QColorDialog)
+{
+ setParent(parent);
+
+ connect(m_dialog.data(), &QColorDialog::accepted, this, &QPlatformDialogHelper::accept);
+ connect(m_dialog.data(), &QColorDialog::rejected, this, &QPlatformDialogHelper::reject);
+ connect(m_dialog.data(), &QColorDialog::currentColorChanged, this, &QPlatformColorDialogHelper::currentColorChanged);
+}
+
+QWidgetPlatformColorDialog::~QWidgetPlatformColorDialog()
+{
+}
+
+QColor QWidgetPlatformColorDialog::currentColor() const
+{
+ return m_dialog->currentColor();
+}
+
+void QWidgetPlatformColorDialog::setCurrentColor(const QColor &color)
+{
+ m_dialog->setCurrentColor(color);
+}
+
+void QWidgetPlatformColorDialog::exec()
+{
+ m_dialog->exec();
+}
+
+bool QWidgetPlatformColorDialog::show(Qt::WindowFlags flags, Qt::WindowModality modality, QWindow *parent)
+{
+ QSharedPointer<QColorDialogOptions> options = QPlatformColorDialogHelper::options();
+ m_dialog->setWindowTitle(options->windowTitle());
+ m_dialog->setOptions(static_cast<QColorDialog::ColorDialogOptions>(int(options->options())) | QColorDialog::DontUseNativeDialog);
+
+ return QWidgetPlatformDialog::show(m_dialog.data(), flags, modality, parent);
+}
+
+void QWidgetPlatformColorDialog::hide()
+{
+ m_dialog->hide();
+}
+
+QT_END_NAMESPACE
diff --git a/src/imports/platform/widgets/qwidgetplatformcolordialog_p.h b/src/imports/platform/widgets/qwidgetplatformcolordialog_p.h
new file mode 100644
index 00000000..14bbcd1f
--- /dev/null
+++ b/src/imports/platform/widgets/qwidgetplatformcolordialog_p.h
@@ -0,0 +1,78 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Labs Platform module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** 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 The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/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 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later 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 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QWIDGETPLATFORMCOLORDIALOG_P_H
+#define QWIDGETPLATFORMCOLORDIALOG_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 <QtGui/qpa/qplatformdialoghelper.h>
+
+QT_BEGIN_NAMESPACE
+
+class QColorDialog;
+
+class QWidgetPlatformColorDialog : public QPlatformColorDialogHelper
+{
+ Q_OBJECT
+
+public:
+ explicit QWidgetPlatformColorDialog(QObject *parent = nullptr);
+ ~QWidgetPlatformColorDialog();
+
+ QColor currentColor() const override;
+ void setCurrentColor(const QColor &color) override;
+
+ void exec() override;
+ bool show(Qt::WindowFlags flags, Qt::WindowModality modality, QWindow *parent) override;
+ void hide() override;
+
+private:
+ QScopedPointer<QColorDialog> m_dialog;
+};
+
+QT_END_NAMESPACE
+
+#endif // QWIDGETPLATFORMCOLORDIALOG_P_H
diff --git a/src/imports/platform/widgets/qwidgetplatformdialog.cpp b/src/imports/platform/widgets/qwidgetplatformdialog.cpp
new file mode 100644
index 00000000..ebca7ea8
--- /dev/null
+++ b/src/imports/platform/widgets/qwidgetplatformdialog.cpp
@@ -0,0 +1,58 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Labs Platform module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** 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 The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/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 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later 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 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qwidgetplatformdialog_p.h"
+
+#include <QtGui/qwindow.h>
+#include <QtWidgets/qdialog.h>
+
+QT_BEGIN_NAMESPACE
+
+bool QWidgetPlatformDialog::show(QDialog *dialog, Qt::WindowFlags flags, Qt::WindowModality modality, QWindow *parent)
+{
+ dialog->setWindowFlags(flags);
+ dialog->setWindowModality(modality);
+
+ dialog->createWinId();
+ QWindow *handle = dialog->windowHandle();
+ Q_ASSERT(handle);
+ handle->setTransientParent(const_cast<QWindow *>(parent));
+
+ dialog->show();
+ return true;
+}
+
+QT_END_NAMESPACE
diff --git a/src/imports/platform/widgets/qwidgetplatformdialog_p.h b/src/imports/platform/widgets/qwidgetplatformdialog_p.h
new file mode 100644
index 00000000..efc99b85
--- /dev/null
+++ b/src/imports/platform/widgets/qwidgetplatformdialog_p.h
@@ -0,0 +1,66 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Labs Platform module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** 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 The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/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 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later 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 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QWIDGETPLATFORMDIALOG_P_H
+#define QWIDGETPLATFORMDIALOG_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 <QtCore/qnamespace.h>
+
+QT_BEGIN_NAMESPACE
+
+class QDialog;
+class QWindow;
+
+class QWidgetPlatformDialog
+{
+public:
+ static bool show(QDialog *dialog, Qt::WindowFlags flags, Qt::WindowModality modality, QWindow *parent);
+};
+
+QT_END_NAMESPACE
+
+#endif // QWIDGETPLATFORMDIALOG_P_H
diff --git a/src/imports/platform/widgets/qwidgetplatformfiledialog.cpp b/src/imports/platform/widgets/qwidgetplatformfiledialog.cpp
new file mode 100644
index 00000000..772443a5
--- /dev/null
+++ b/src/imports/platform/widgets/qwidgetplatformfiledialog.cpp
@@ -0,0 +1,140 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Labs Platform module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** 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 The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/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 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later 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 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qwidgetplatformfiledialog_p.h"
+#include "qwidgetplatformdialog_p.h"
+
+#include <QtWidgets/qfiledialog.h>
+
+QT_BEGIN_NAMESPACE
+
+QWidgetPlatformFileDialog::QWidgetPlatformFileDialog(QObject *parent)
+ : m_dialog(new QFileDialog)
+{
+ setParent(parent);
+
+ connect(m_dialog.data(), &QDialog::accepted, this, &QPlatformDialogHelper::accept);
+ connect(m_dialog.data(), &QDialog::rejected, this, &QPlatformDialogHelper::reject);
+
+ connect(m_dialog.data(), &QFileDialog::fileSelected, [this](const QString &file) {
+ emit fileSelected(QUrl::fromLocalFile(file));
+ });
+ connect(m_dialog.data(), &QFileDialog::filesSelected, [this](const QList<QString> &files) {
+ QList<QUrl> urls;
+ urls.reserve(files.count());
+ for (const QString &file : files)
+ urls += QUrl::fromLocalFile(file);
+ emit filesSelected(urls);
+ });
+ connect(m_dialog.data(), &QFileDialog::currentChanged, [this](const QString &path) {
+ emit currentChanged(QUrl::fromLocalFile(path));
+ });
+ connect(m_dialog.data(), &QFileDialog::directoryEntered, this, &QWidgetPlatformFileDialog::directoryEntered);
+ connect(m_dialog.data(), &QFileDialog::filterSelected, this, &QWidgetPlatformFileDialog::filterSelected);
+}
+
+QWidgetPlatformFileDialog::~QWidgetPlatformFileDialog()
+{
+}
+
+bool QWidgetPlatformFileDialog::defaultNameFilterDisables() const
+{
+ return false; // TODO: ?
+}
+
+void QWidgetPlatformFileDialog::setDirectory(const QUrl &directory)
+{
+ m_dialog->setDirectory(directory.toLocalFile());
+}
+
+QUrl QWidgetPlatformFileDialog::directory() const
+{
+ return m_dialog->directoryUrl();
+}
+
+void QWidgetPlatformFileDialog::selectFile(const QUrl &filename)
+{
+ m_dialog->selectUrl(filename);
+}
+
+QList<QUrl> QWidgetPlatformFileDialog::selectedFiles() const
+{
+ return m_dialog->selectedUrls();
+}
+
+void QWidgetPlatformFileDialog::setFilter()
+{
+ // TODO: ?
+}
+
+void QWidgetPlatformFileDialog::selectNameFilter(const QString &filter)
+{
+ m_dialog->selectNameFilter(filter);
+}
+
+QString QWidgetPlatformFileDialog::selectedNameFilter() const
+{
+ return m_dialog->selectedNameFilter();
+}
+
+void QWidgetPlatformFileDialog::exec()
+{
+ m_dialog->exec();
+}
+
+bool QWidgetPlatformFileDialog::show(Qt::WindowFlags flags, Qt::WindowModality modality, QWindow *parent)
+{
+ QSharedPointer<QFileDialogOptions> options = QPlatformFileDialogHelper::options();
+ m_dialog->setWindowTitle(options->windowTitle());
+ m_dialog->setAcceptMode(static_cast<QFileDialog::AcceptMode>(options->acceptMode()));
+ m_dialog->setFileMode(static_cast<QFileDialog::FileMode>(options->fileMode()));
+ m_dialog->setOptions(static_cast<QFileDialog::Options>(int(options->options())) | QFileDialog::DontUseNativeDialog);
+ m_dialog->setNameFilters(options->nameFilters());
+ m_dialog->setDefaultSuffix(options->defaultSuffix());
+ if (options->isLabelExplicitlySet(QFileDialogOptions::Accept))
+ m_dialog->setLabelText(QFileDialog::Accept, options->labelText(QFileDialogOptions::Accept));
+ if (options->isLabelExplicitlySet(QFileDialogOptions::Reject))
+ m_dialog->setLabelText(QFileDialog::Reject, options->labelText(QFileDialogOptions::Reject));
+
+ return QWidgetPlatformDialog::show(m_dialog.data(), flags, modality, parent);
+}
+
+void QWidgetPlatformFileDialog::hide()
+{
+ m_dialog->hide();
+}
+
+QT_END_NAMESPACE
diff --git a/src/imports/platform/widgets/qwidgetplatformfiledialog_p.h b/src/imports/platform/widgets/qwidgetplatformfiledialog_p.h
new file mode 100644
index 00000000..743bc571
--- /dev/null
+++ b/src/imports/platform/widgets/qwidgetplatformfiledialog_p.h
@@ -0,0 +1,84 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Labs Platform module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** 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 The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/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 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later 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 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QWIDGETPLATFORMFILEDIALOG_P_H
+#define QWIDGETPLATFORMFILEDIALOG_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 <QtGui/qpa/qplatformdialoghelper.h>
+
+QT_BEGIN_NAMESPACE
+
+class QFileDialog;
+
+class QWidgetPlatformFileDialog : public QPlatformFileDialogHelper
+{
+ Q_OBJECT
+
+public:
+ explicit QWidgetPlatformFileDialog(QObject *parent = nullptr);
+ ~QWidgetPlatformFileDialog();
+
+ bool defaultNameFilterDisables() const override;
+ void setDirectory(const QUrl &directory) override;
+ QUrl directory() const override;
+ void selectFile(const QUrl &filename) override;
+ QList<QUrl> selectedFiles() const override;
+ void setFilter() override;
+ void selectNameFilter(const QString &filter) override;
+ QString selectedNameFilter() const override;
+
+ void exec() override;
+ bool show(Qt::WindowFlags flags, Qt::WindowModality modality, QWindow *parent) override;
+ void hide() override;
+
+private:
+ QScopedPointer<QFileDialog> m_dialog;
+};
+
+QT_END_NAMESPACE
+
+#endif // QWIDGETPLATFORMFILEDIALOG_P_H
diff --git a/src/imports/platform/widgets/qwidgetplatformfontdialog.cpp b/src/imports/platform/widgets/qwidgetplatformfontdialog.cpp
new file mode 100644
index 00000000..d2b6c539
--- /dev/null
+++ b/src/imports/platform/widgets/qwidgetplatformfontdialog.cpp
@@ -0,0 +1,87 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Labs Platform module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** 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 The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/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 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later 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 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qwidgetplatformfontdialog_p.h"
+#include "qwidgetplatformdialog_p.h"
+
+#include <QtWidgets/qfontdialog.h>
+
+QT_BEGIN_NAMESPACE
+
+QWidgetPlatformFontDialog::QWidgetPlatformFontDialog(QObject *parent)
+ : m_dialog(new QFontDialog)
+{
+ setParent(parent);
+
+ connect(m_dialog.data(), &QFontDialog::accepted, this, &QPlatformDialogHelper::accept);
+ connect(m_dialog.data(), &QFontDialog::rejected, this, &QPlatformDialogHelper::reject);
+ connect(m_dialog.data(), &QFontDialog::currentFontChanged, this, &QPlatformFontDialogHelper::currentFontChanged);
+}
+
+QWidgetPlatformFontDialog::~QWidgetPlatformFontDialog()
+{
+}
+
+QFont QWidgetPlatformFontDialog::currentFont() const
+{
+ return m_dialog->currentFont();
+}
+
+void QWidgetPlatformFontDialog::setCurrentFont(const QFont &font)
+{
+ m_dialog->setCurrentFont(font);
+}
+
+void QWidgetPlatformFontDialog::exec()
+{
+ m_dialog->exec();
+}
+
+bool QWidgetPlatformFontDialog::show(Qt::WindowFlags flags, Qt::WindowModality modality, QWindow *parent)
+{
+ QSharedPointer<QFontDialogOptions> options = QPlatformFontDialogHelper::options();
+ m_dialog->setWindowTitle(options->windowTitle());
+ m_dialog->setOptions(static_cast<QFontDialog::FontDialogOptions>(int(options->options())) | QFontDialog::DontUseNativeDialog);
+
+ return QWidgetPlatformDialog::show(m_dialog.data(), flags, modality, parent);
+}
+
+void QWidgetPlatformFontDialog::hide()
+{
+ m_dialog->hide();
+}
+
+QT_END_NAMESPACE
diff --git a/src/imports/platform/widgets/qwidgetplatformfontdialog_p.h b/src/imports/platform/widgets/qwidgetplatformfontdialog_p.h
new file mode 100644
index 00000000..97d5463d
--- /dev/null
+++ b/src/imports/platform/widgets/qwidgetplatformfontdialog_p.h
@@ -0,0 +1,78 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Labs Platform module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** 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 The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/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 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later 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 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QWIDGETPLATFORMFONTDIALOG_P_H
+#define QWIDGETPLATFORMFONTDIALOG_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 <QtGui/qpa/qplatformdialoghelper.h>
+
+QT_BEGIN_NAMESPACE
+
+class QFontDialog;
+
+class QWidgetPlatformFontDialog : public QPlatformFontDialogHelper
+{
+ Q_OBJECT
+
+public:
+ explicit QWidgetPlatformFontDialog(QObject *parent = nullptr);
+ ~QWidgetPlatformFontDialog();
+
+ QFont currentFont() const override;
+ void setCurrentFont(const QFont &font) override;
+
+ void exec() override;
+ bool show(Qt::WindowFlags windowFlags, Qt::WindowModality windowModality, QWindow *parent) override;
+ void hide() override;
+
+private:
+ QScopedPointer<QFontDialog> m_dialog;
+};
+
+QT_END_NAMESPACE
+
+#endif // QWIDGETPLATFORMFONTDIALOG_P_H
diff --git a/src/imports/platform/widgets/qwidgetplatformmenu.cpp b/src/imports/platform/widgets/qwidgetplatformmenu.cpp
new file mode 100644
index 00000000..d9ecb16f
--- /dev/null
+++ b/src/imports/platform/widgets/qwidgetplatformmenu.cpp
@@ -0,0 +1,186 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Labs Platform module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** 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 The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/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 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later 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 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qwidgetplatformmenu_p.h"
+#include "qwidgetplatformmenuitem_p.h"
+
+#include <QtGui/qwindow.h>
+#include <QtWidgets/qmenu.h>
+#include <QtWidgets/qaction.h>
+
+QT_BEGIN_NAMESPACE
+
+QWidgetPlatformMenu::QWidgetPlatformMenu(QObject *parent)
+ : m_menu(new QMenu)
+{
+ setParent(parent);
+
+ connect(m_menu.data(), &QMenu::aboutToShow, this, &QPlatformMenu::aboutToShow);
+ connect(m_menu.data(), &QMenu::aboutToHide, this, &QPlatformMenu::aboutToHide);
+}
+
+QWidgetPlatformMenu::~QWidgetPlatformMenu()
+{
+}
+
+QMenu *QWidgetPlatformMenu::menu() const
+{
+ return m_menu.data();
+}
+
+void QWidgetPlatformMenu::insertMenuItem(QPlatformMenuItem *item, QPlatformMenuItem *before)
+{
+ QWidgetPlatformMenuItem *widgetItem = qobject_cast<QWidgetPlatformMenuItem *>(item);
+ if (!widgetItem)
+ return;
+
+ QWidgetPlatformMenuItem *widgetBefore = qobject_cast<QWidgetPlatformMenuItem *>(before);
+ m_menu->insertAction(widgetBefore ? widgetBefore->action() : nullptr, widgetItem->action());
+}
+
+void QWidgetPlatformMenu::removeMenuItem(QPlatformMenuItem *item)
+{
+ QWidgetPlatformMenuItem *widgetItem = qobject_cast<QWidgetPlatformMenuItem *>(item);
+ if (!widgetItem)
+ return;
+
+ m_menu->removeAction(widgetItem->action());
+}
+
+void QWidgetPlatformMenu::syncMenuItem(QPlatformMenuItem *item)
+{
+ Q_UNUSED(item);
+}
+
+void QWidgetPlatformMenu::syncSeparatorsCollapsible(bool enable)
+{
+ Q_UNUSED(enable);
+}
+
+quintptr QWidgetPlatformMenu::tag() const
+{
+ return 0;
+}
+
+void QWidgetPlatformMenu::setTag(quintptr tag)
+{
+ Q_UNUSED(tag);
+}
+
+void QWidgetPlatformMenu::setText(const QString &text)
+{
+ m_menu->setTitle(text);
+}
+
+void QWidgetPlatformMenu::setIcon(const QIcon &icon)
+{
+ m_menu->setIcon(icon);
+}
+
+void QWidgetPlatformMenu::setEnabled(bool enabled)
+{
+ m_menu->menuAction()->setEnabled(enabled);
+}
+
+bool QWidgetPlatformMenu::isEnabled() const
+{
+ return m_menu->menuAction()->isEnabled();
+}
+
+void QWidgetPlatformMenu::setVisible(bool visible)
+{
+ m_menu->menuAction()->setVisible(visible);
+}
+
+void QWidgetPlatformMenu::setMinimumWidth(int width)
+{
+ if (width > 0)
+ m_menu->setMinimumWidth(width);
+}
+
+void QWidgetPlatformMenu::setFont(const QFont &font)
+{
+ m_menu->setFont(font);
+}
+
+void QWidgetPlatformMenu::setMenuType(MenuType type)
+{
+ Q_UNUSED(type);
+}
+
+void QWidgetPlatformMenu::showPopup(const QWindow *window, const QRect &targetRect, const QPlatformMenuItem *item)
+{
+ m_menu->createWinId();
+ QWindow *handle = m_menu->windowHandle();
+ Q_ASSERT(handle);
+ handle->setTransientParent(const_cast<QWindow *>(window));
+
+ QPoint targetPos = targetRect.bottomLeft();
+ if (window)
+ targetPos = window->mapToGlobal(targetPos);
+
+ const QWidgetPlatformMenuItem *widgetItem = qobject_cast<const QWidgetPlatformMenuItem *>(item);
+ m_menu->popup(targetPos, widgetItem ? widgetItem->action() : nullptr);
+}
+
+void QWidgetPlatformMenu::dismiss()
+{
+ m_menu->close();
+}
+
+QPlatformMenuItem *QWidgetPlatformMenu::menuItemAt(int position) const
+{
+ Q_UNUSED(position);
+ return nullptr;
+}
+
+QPlatformMenuItem *QWidgetPlatformMenu::menuItemForTag(quintptr tag) const
+{
+ Q_UNUSED(tag);
+ return nullptr;
+}
+
+QPlatformMenuItem *QWidgetPlatformMenu::createMenuItem() const
+{
+ return nullptr;
+}
+
+QPlatformMenu *QWidgetPlatformMenu::createSubMenu() const
+{
+ return nullptr;
+}
+
+QT_END_NAMESPACE
diff --git a/src/imports/platform/widgets/qwidgetplatformmenu_p.h b/src/imports/platform/widgets/qwidgetplatformmenu_p.h
new file mode 100644
index 00000000..56ea7a45
--- /dev/null
+++ b/src/imports/platform/widgets/qwidgetplatformmenu_p.h
@@ -0,0 +1,99 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Labs Platform module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** 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 The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/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 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later 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 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QWIDGETPLATFORMMENU_P_H
+#define QWIDGETPLATFORMMENU_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 <QtGui/qpa/qplatformmenu.h>
+
+QT_BEGIN_NAMESPACE
+
+class QMenu;
+
+class QWidgetPlatformMenu : public QPlatformMenu
+{
+ Q_OBJECT
+
+public:
+ explicit QWidgetPlatformMenu(QObject *parent = nullptr);
+ ~QWidgetPlatformMenu();
+
+ QMenu *menu() const;
+
+ void insertMenuItem(QPlatformMenuItem *item, QPlatformMenuItem *before) override;
+ void removeMenuItem(QPlatformMenuItem *item) override;
+ void syncMenuItem(QPlatformMenuItem *item) override;
+ void syncSeparatorsCollapsible(bool enable) override;
+
+ quintptr tag()const override;
+ void setTag(quintptr tag) override;
+
+ void setText(const QString &text) override;
+ void setIcon(const QIcon &icon) override;
+ void setEnabled(bool enabled) override;
+ bool isEnabled() const override;
+ void setVisible(bool visible) override;
+ void setMinimumWidth(int width) override;
+ void setFont(const QFont &font) override;
+ void setMenuType(MenuType type) override;
+
+ void showPopup(const QWindow *window, const QRect &targetRect, const QPlatformMenuItem *item) override;
+ void dismiss() override;
+
+ QPlatformMenuItem *menuItemAt(int position) const override;
+ QPlatformMenuItem *menuItemForTag(quintptr tag) const override;
+
+ QPlatformMenuItem *createMenuItem() const override;
+ QPlatformMenu *createSubMenu() const override;
+
+private:
+ QScopedPointer<QMenu> m_menu;
+};
+
+QT_END_NAMESPACE
+
+#endif // QWIDGETPLATFORMMENU_P_H
diff --git a/src/imports/platform/widgets/qwidgetplatformmenuitem.cpp b/src/imports/platform/widgets/qwidgetplatformmenuitem.cpp
new file mode 100644
index 00000000..4d168f7a
--- /dev/null
+++ b/src/imports/platform/widgets/qwidgetplatformmenuitem.cpp
@@ -0,0 +1,131 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Labs Platform module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** 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 The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/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 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later 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 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qwidgetplatformmenuitem_p.h"
+
+#include <QtWidgets/qmenu.h>
+#include <QtWidgets/qaction.h>
+
+QT_BEGIN_NAMESPACE
+
+QWidgetPlatformMenuItem::QWidgetPlatformMenuItem(QObject *parent)
+ : m_action(new QAction)
+{
+ setParent(parent);
+ connect(m_action.data(), &QAction::hovered, this, &QPlatformMenuItem::hovered);
+ connect(m_action.data(), &QAction::triggered, this, &QPlatformMenuItem::activated);
+}
+
+QWidgetPlatformMenuItem::~QWidgetPlatformMenuItem()
+{
+}
+
+QAction *QWidgetPlatformMenuItem::action() const
+{
+ return m_action.data();
+}
+
+quintptr QWidgetPlatformMenuItem::tag() const
+{
+ return 0;
+}
+
+void QWidgetPlatformMenuItem::setTag(quintptr tag)
+{
+ Q_UNUSED(tag);
+}
+
+void QWidgetPlatformMenuItem::setText(const QString &text)
+{
+ m_action->setText(text);
+}
+
+void QWidgetPlatformMenuItem::setIcon(const QIcon &icon)
+{
+ m_action->setIcon(icon);
+}
+
+void QWidgetPlatformMenuItem::setMenu(QPlatformMenu *menu)
+{
+ m_action->setMenu(qobject_cast<QMenu *>(menu));
+}
+
+void QWidgetPlatformMenuItem::setVisible(bool visible)
+{
+ m_action->setVisible(visible);
+}
+
+void QWidgetPlatformMenuItem::setIsSeparator(bool separator)
+{
+ m_action->setSeparator(separator);
+}
+
+void QWidgetPlatformMenuItem::setFont(const QFont &font)
+{
+ m_action->setFont(font);
+}
+
+void QWidgetPlatformMenuItem::setRole(MenuRole role)
+{
+ m_action->setMenuRole(static_cast<QAction::MenuRole>(role));
+}
+
+void QWidgetPlatformMenuItem::setCheckable(bool checkable)
+{
+ m_action->setCheckable(checkable);
+}
+
+void QWidgetPlatformMenuItem::setChecked(bool checked)
+{
+ m_action->setChecked(checked);
+}
+
+void QWidgetPlatformMenuItem::setShortcut(const QKeySequence &shortcut)
+{
+ m_action->setShortcut(shortcut);
+}
+
+void QWidgetPlatformMenuItem::setEnabled(bool enabled)
+{
+ m_action->setEnabled(enabled);
+}
+
+void QWidgetPlatformMenuItem::setIconSize(int size)
+{
+ Q_UNUSED(size);
+}
+
+QT_END_NAMESPACE
diff --git a/src/imports/platform/widgets/qwidgetplatformmenuitem_p.h b/src/imports/platform/widgets/qwidgetplatformmenuitem_p.h
new file mode 100644
index 00000000..d1a08187
--- /dev/null
+++ b/src/imports/platform/widgets/qwidgetplatformmenuitem_p.h
@@ -0,0 +1,89 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Labs Platform module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** 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 The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/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 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later 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 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QWIDGETPLATFORMMENUITEM_P_H
+#define QWIDGETPLATFORMMENUITEM_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 <QtGui/qpa/qplatformmenu.h>
+
+QT_BEGIN_NAMESPACE
+
+class QAction;
+
+class QWidgetPlatformMenuItem : public QPlatformMenuItem
+{
+ Q_OBJECT
+
+public:
+ explicit QWidgetPlatformMenuItem(QObject *parent = nullptr);
+ ~QWidgetPlatformMenuItem();
+
+ QAction *action() const;
+
+ quintptr tag()const override;
+ void setTag(quintptr tag) override;
+
+ void setText(const QString &text) override;
+ void setIcon(const QIcon &icon) override;
+ void setMenu(QPlatformMenu *menu) override;
+ void setVisible(bool visible) override;
+ void setIsSeparator(bool separator) override;
+ void setFont(const QFont &font) override;
+ void setRole(MenuRole role) override;
+ void setCheckable(bool checkable) override;
+ void setChecked(bool checked) override;
+ void setShortcut(const QKeySequence& shortcut) override;
+ void setEnabled(bool enabled) override;
+ void setIconSize(int size) override;
+
+private:
+ QScopedPointer<QAction> m_action;
+};
+
+QT_END_NAMESPACE
+
+#endif // QWIDGETPLATFORMMENUITEM_P_H
diff --git a/src/imports/platform/widgets/qwidgetplatformmessagedialog.cpp b/src/imports/platform/widgets/qwidgetplatformmessagedialog.cpp
new file mode 100644
index 00000000..b546e534
--- /dev/null
+++ b/src/imports/platform/widgets/qwidgetplatformmessagedialog.cpp
@@ -0,0 +1,85 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Labs Platform module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** 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 The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/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 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later 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 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qwidgetplatformmessagedialog_p.h"
+#include "qwidgetplatformdialog_p.h"
+
+#include <QtWidgets/qmessagebox.h>
+#include <QtWidgets/qabstractbutton.h>
+
+QT_BEGIN_NAMESPACE
+
+QWidgetPlatformMessageDialog::QWidgetPlatformMessageDialog(QObject *parent)
+ : m_dialog(new QMessageBox)
+{
+ setParent(parent);
+
+ connect(m_dialog.data(), &QMessageBox::accepted, this, &QPlatformDialogHelper::accept);
+ connect(m_dialog.data(), &QMessageBox::rejected, this, &QPlatformDialogHelper::reject);
+ connect(m_dialog.data(), &QMessageBox::buttonClicked, [this](QAbstractButton *button) {
+ QMessageBox::ButtonRole role = m_dialog->buttonRole(button);
+ QMessageBox::StandardButton standardButton = m_dialog->standardButton(button);
+ emit clicked(static_cast<StandardButton>(standardButton), static_cast<ButtonRole>(role));
+ });
+}
+
+QWidgetPlatformMessageDialog::~QWidgetPlatformMessageDialog()
+{
+}
+void QWidgetPlatformMessageDialog::exec()
+{
+ m_dialog->exec();
+}
+
+bool QWidgetPlatformMessageDialog::show(Qt::WindowFlags flags, Qt::WindowModality modality, QWindow *parent)
+{
+ QSharedPointer<QMessageDialogOptions> options = QPlatformMessageDialogHelper::options();
+ m_dialog->setWindowTitle(options->windowTitle());
+ m_dialog->setIcon(static_cast<QMessageBox::Icon>(options->icon()));
+ m_dialog->setText(options->text());
+ m_dialog->setInformativeText(options->informativeText());
+ m_dialog->setDetailedText(options->detailedText());
+ m_dialog->setStandardButtons(static_cast<QMessageBox::StandardButtons>(int(options->standardButtons())));
+
+ return QWidgetPlatformDialog::show(m_dialog.data(), flags, modality, parent);
+}
+
+void QWidgetPlatformMessageDialog::hide()
+{
+ m_dialog->hide();
+}
+
+QT_END_NAMESPACE
diff --git a/src/imports/platform/widgets/qwidgetplatformmessagedialog_p.h b/src/imports/platform/widgets/qwidgetplatformmessagedialog_p.h
new file mode 100644
index 00000000..319bb34d
--- /dev/null
+++ b/src/imports/platform/widgets/qwidgetplatformmessagedialog_p.h
@@ -0,0 +1,75 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Labs Platform module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** 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 The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/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 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later 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 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QWIDGETPLATFORMMESSAGEDIALOG_P_H
+#define QWIDGETPLATFORMMESSAGEDIALOG_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 <QtGui/qpa/qplatformdialoghelper.h>
+
+QT_BEGIN_NAMESPACE
+
+class QMessageBox;
+
+class QWidgetPlatformMessageDialog : public QPlatformMessageDialogHelper
+{
+ Q_OBJECT
+
+public:
+ explicit QWidgetPlatformMessageDialog(QObject *parent = nullptr);
+ ~QWidgetPlatformMessageDialog();
+
+ void exec() override;
+ bool show(Qt::WindowFlags flags, Qt::WindowModality modality, QWindow *parent) override;
+ void hide() override;
+
+private:
+ QScopedPointer<QMessageBox> m_dialog;
+};
+
+QT_END_NAMESPACE
+
+#endif // QWIDGETPLATFORMMESSAGEDIALOG_P_H
diff --git a/src/imports/platform/widgets/qwidgetplatformsystemtrayicon.cpp b/src/imports/platform/widgets/qwidgetplatformsystemtrayicon.cpp
new file mode 100644
index 00000000..cfee02aa
--- /dev/null
+++ b/src/imports/platform/widgets/qwidgetplatformsystemtrayicon.cpp
@@ -0,0 +1,114 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Labs Platform module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** 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 The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/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 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later 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 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qwidgetplatformsystemtrayicon_p.h"
+#include "qwidgetplatformmenu_p.h"
+
+#include <QtWidgets/qsystemtrayicon.h>
+
+QT_BEGIN_NAMESPACE
+
+QWidgetPlatformSystemTrayIcon::QWidgetPlatformSystemTrayIcon(QObject *parent)
+ : m_systray(new QSystemTrayIcon)
+{
+ setParent(parent);
+
+ connect(m_systray.data(), &QSystemTrayIcon::messageClicked, this, &QPlatformSystemTrayIcon::messageClicked);
+ connect(m_systray.data(), &QSystemTrayIcon::activated, [this](QSystemTrayIcon::ActivationReason reason) {
+ emit activated(static_cast<ActivationReason>(reason));
+ });
+}
+
+QWidgetPlatformSystemTrayIcon::~QWidgetPlatformSystemTrayIcon()
+{
+}
+
+void QWidgetPlatformSystemTrayIcon::init()
+{
+ m_systray->show();
+}
+
+void QWidgetPlatformSystemTrayIcon::cleanup()
+{
+ m_systray->hide();
+}
+
+void QWidgetPlatformSystemTrayIcon::updateIcon(const QIcon &icon)
+{
+ m_systray->setIcon(icon);
+}
+
+void QWidgetPlatformSystemTrayIcon::updateToolTip(const QString &tooltip)
+{
+ m_systray->setToolTip(tooltip);
+}
+
+void QWidgetPlatformSystemTrayIcon::updateMenu(QPlatformMenu *menu)
+{
+ QWidgetPlatformMenu *widgetMenu = qobject_cast<QWidgetPlatformMenu *>(menu);
+ if (!widgetMenu)
+ return;
+
+ m_systray->setContextMenu(widgetMenu->menu());
+}
+
+QRect QWidgetPlatformSystemTrayIcon::geometry() const
+{
+ return m_systray->geometry();
+}
+
+void QWidgetPlatformSystemTrayIcon::showMessage(const QString &title, const QString &msg, const QIcon &icon, MessageIcon iconType, int msecs)
+{
+ Q_UNUSED(icon);
+ m_systray->showMessage(title, msg, static_cast<QSystemTrayIcon::MessageIcon>(iconType), msecs);
+}
+
+bool QWidgetPlatformSystemTrayIcon::isSystemTrayAvailable() const
+{
+ return QSystemTrayIcon::isSystemTrayAvailable();
+}
+
+bool QWidgetPlatformSystemTrayIcon::supportsMessages() const
+{
+ return QSystemTrayIcon::supportsMessages();
+}
+
+QPlatformMenu *QWidgetPlatformSystemTrayIcon::createMenu() const
+{
+ return new QWidgetPlatformMenu;
+}
+
+QT_END_NAMESPACE
diff --git a/src/imports/platform/widgets/qwidgetplatformsystemtrayicon_p.h b/src/imports/platform/widgets/qwidgetplatformsystemtrayicon_p.h
new file mode 100644
index 00000000..f48430a4
--- /dev/null
+++ b/src/imports/platform/widgets/qwidgetplatformsystemtrayicon_p.h
@@ -0,0 +1,85 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Labs Platform module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** 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 The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/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 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later 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 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QWIDGETPLATFORMSYSTEMTRAYICON_P_H
+#define QWIDGETPLATFORMSYSTEMTRAYICON_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 <QtGui/qpa/qplatformsystemtrayicon.h>
+
+QT_BEGIN_NAMESPACE
+
+class QSystemTrayIcon;
+
+class QWidgetPlatformSystemTrayIcon : public QPlatformSystemTrayIcon
+{
+ Q_OBJECT
+
+public:
+ explicit QWidgetPlatformSystemTrayIcon(QObject *parent = nullptr);
+ ~QWidgetPlatformSystemTrayIcon();
+
+ void init() override;
+ void cleanup() override;
+ void updateIcon(const QIcon &icon) override;
+ void updateToolTip(const QString &tooltip) override;
+ void updateMenu(QPlatformMenu *menu) override;
+ QRect geometry() const override;
+ void showMessage(const QString &title, const QString &msg,
+ const QIcon &icon, MessageIcon iconType, int msecs) override;
+
+ bool isSystemTrayAvailable() const override;
+ bool supportsMessages() const override;
+
+ QPlatformMenu *createMenu() const override;
+
+private:
+ QScopedPointer<QSystemTrayIcon> m_systray;
+};
+
+QT_END_NAMESPACE
+
+#endif // QWIDGETPLATFORMSYSTEMTRAYICON_P_H
diff --git a/src/imports/platform/widgets/widgets.pri b/src/imports/platform/widgets/widgets.pri
new file mode 100644
index 00000000..c904e924
--- /dev/null
+++ b/src/imports/platform/widgets/widgets.pri
@@ -0,0 +1,23 @@
+QT += widgets
+DEPENDPATH += $$PWD
+
+HEADERS += \
+ $$PWD/qwidgetplatform_p.h \
+ $$PWD/qwidgetplatformcolordialog_p.h \
+ $$PWD/qwidgetplatformdialog_p.h \
+ $$PWD/qwidgetplatformfiledialog_p.h \
+ $$PWD/qwidgetplatformfontdialog_p.h \
+ $$PWD/qwidgetplatformmenu_p.h \
+ $$PWD/qwidgetplatformmenuitem_p.h \
+ $$PWD/qwidgetplatformmessagedialog_p.h \
+ $$PWD/qwidgetplatformsystemtrayicon_p.h
+
+SOURCES += \
+ $$PWD/qwidgetplatformcolordialog.cpp \
+ $$PWD/qwidgetplatformdialog.cpp \
+ $$PWD/qwidgetplatformfiledialog.cpp \
+ $$PWD/qwidgetplatformfontdialog.cpp \
+ $$PWD/qwidgetplatformmenu.cpp \
+ $$PWD/qwidgetplatformmenuitem.cpp \
+ $$PWD/qwidgetplatformmessagedialog.cpp \
+ $$PWD/qwidgetplatformsystemtrayicon.cpp