diff options
author | Maximilian Goldstein <max.goldstein@qt.io> | 2022-01-10 10:43:39 +0100 |
---|---|---|
committer | Maximilian Goldstein <max.goldstein@qt.io> | 2022-01-17 12:36:12 +0100 |
commit | c2598d344dfeb339ef791380737c9ad660151896 (patch) | |
tree | 690fe2edbc1c84b76388d078f63155bab465ae39 | |
parent | 2ffed97aac48e27b01ed29813e8e29b054f99254 (diff) |
qt.labs.platform: Use declarative registration
Makes qt.labs.platform use declarative registration which also allows
the plugin to become optional now.
Change-Id: I800b567c52e118485e08cf350509e312c7d01b5f
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
20 files changed, 40 insertions, 137 deletions
diff --git a/src/labs/platform/CMakeLists.txt b/src/labs/platform/CMakeLists.txt index 119f1d585a..ea1a3f2342 100644 --- a/src/labs/platform/CMakeLists.txt +++ b/src/labs/platform/CMakeLists.txt @@ -7,8 +7,6 @@ qt_internal_add_qml_module(qtlabsplatformplugin VERSION "1.1" CLASS_NAME QtLabsPlatformPlugin PLUGIN_TARGET qtlabsplatformplugin - NO_PLUGIN_OPTIONAL - NO_GENERATE_PLUGIN_SOURCE SOURCES qquicklabsplatformcolordialog.cpp qquicklabsplatformcolordialog_p.h qquicklabsplatformdialog.cpp qquicklabsplatformdialog_p.h @@ -24,7 +22,6 @@ qt_internal_add_qml_module(qtlabsplatformplugin qquicklabsplatformmenuseparator.cpp qquicklabsplatformmenuseparator_p.h qquicklabsplatformmessagedialog.cpp qquicklabsplatformmessagedialog_p.h qquicklabsplatformstandardpaths.cpp qquicklabsplatformstandardpaths_p.h - qtlabsplatformplugin.cpp DEFINES QT_NO_CAST_FROM_ASCII QT_NO_CAST_TO_ASCII diff --git a/src/labs/platform/qquicklabsplatformcolordialog_p.h b/src/labs/platform/qquicklabsplatformcolordialog_p.h index 98efcc6a03..dee0ff42d8 100644 --- a/src/labs/platform/qquicklabsplatformcolordialog_p.h +++ b/src/labs/platform/qquicklabsplatformcolordialog_p.h @@ -60,10 +60,11 @@ QT_BEGIN_NAMESPACE class QQuickLabsPlatformColorDialog : public QQuickLabsPlatformDialog { Q_OBJECT + QML_NAMED_ELEMENT(ColorDialog) + QML_EXTENDED_NAMESPACE(QColorDialogOptions) Q_PROPERTY(QColor color READ color WRITE setColor NOTIFY colorChanged FINAL) Q_PROPERTY(QColor currentColor READ currentColor WRITE setCurrentColor NOTIFY currentColorChanged FINAL) Q_PROPERTY(QColorDialogOptions::ColorDialogOptions options READ options WRITE setOptions NOTIFY optionsChanged FINAL) - Q_FLAGS(QColorDialogOptions::ColorDialogOptions) public: explicit QQuickLabsPlatformColorDialog(QObject *parent = nullptr); diff --git a/src/labs/platform/qquicklabsplatformdialog.cpp b/src/labs/platform/qquicklabsplatformdialog.cpp index 389f6b46b1..fa2e576140 100644 --- a/src/labs/platform/qquicklabsplatformdialog.cpp +++ b/src/labs/platform/qquicklabsplatformdialog.cpp @@ -88,7 +88,7 @@ QT_BEGIN_NAMESPACE \sa accepted() */ -Q_DECLARE_LOGGING_CATEGORY(qtLabsPlatformDialogs) +Q_LOGGING_CATEGORY(qtLabsPlatformDialogs, "qt.labs.platform.dialogs") QQuickLabsPlatformDialog::QQuickLabsPlatformDialog(QPlatformTheme::DialogType type, QObject *parent) : QObject(parent), diff --git a/src/labs/platform/qquicklabsplatformdialog_p.h b/src/labs/platform/qquicklabsplatformdialog_p.h index a3793896f0..a50ef411ca 100644 --- a/src/labs/platform/qquicklabsplatformdialog_p.h +++ b/src/labs/platform/qquicklabsplatformdialog_p.h @@ -67,6 +67,8 @@ class QQuickLabsPlatformDialog : public QObject, public QQmlParserStatus { Q_OBJECT Q_INTERFACES(QQmlParserStatus) + QML_NAMED_ELEMENT(Dialog) + QML_UNCREATABLE("Dialog is an abstract base class") Q_PROPERTY(QQmlListProperty<QObject> data READ data FINAL) Q_PROPERTY(QWindow *parentWindow READ parentWindow WRITE setParentWindow NOTIFY parentWindowChanged FINAL) Q_PROPERTY(QString title READ title WRITE setTitle NOTIFY titleChanged FINAL) @@ -149,6 +151,13 @@ private: QPlatformDialogHelper *m_handle; }; +class QPlatformDialogHelperForeign +{ + QML_FOREIGN(QPlatformDialogHelper) + QML_NAMED_ELEMENT(StandardButton) + QML_UNCREATABLE("Cannot create an instance of StandardButton") +}; + QT_END_NAMESPACE QML_DECLARE_TYPE(QQuickLabsPlatformDialog) diff --git a/src/labs/platform/qquicklabsplatformfiledialog_p.h b/src/labs/platform/qquicklabsplatformfiledialog_p.h index 2183992e3e..63e0b62bea 100644 --- a/src/labs/platform/qquicklabsplatformfiledialog_p.h +++ b/src/labs/platform/qquicklabsplatformfiledialog_p.h @@ -62,6 +62,8 @@ class QQuickLabsPlatformFileNameFilter; class QQuickLabsPlatformFileDialog : public QQuickLabsPlatformDialog { Q_OBJECT + QML_NAMED_ELEMENT(FileDialog) + QML_EXTENDED_NAMESPACE(QFileDialogOptions) Q_PROPERTY(FileMode fileMode READ fileMode WRITE setFileMode NOTIFY fileModeChanged FINAL) Q_PROPERTY(QUrl file READ file WRITE setFile NOTIFY fileChanged FINAL) Q_PROPERTY(QList<QUrl> files READ files WRITE setFiles NOTIFY filesChanged FINAL) @@ -74,7 +76,6 @@ class QQuickLabsPlatformFileDialog : public QQuickLabsPlatformDialog Q_PROPERTY(QString defaultSuffix READ defaultSuffix WRITE setDefaultSuffix RESET resetDefaultSuffix NOTIFY defaultSuffixChanged FINAL) Q_PROPERTY(QString acceptLabel READ acceptLabel WRITE setAcceptLabel RESET resetAcceptLabel NOTIFY acceptLabelChanged FINAL) Q_PROPERTY(QString rejectLabel READ rejectLabel WRITE setRejectLabel RESET resetRejectLabel NOTIFY rejectLabelChanged FINAL) - Q_FLAGS(QFileDialogOptions::FileDialogOptions) public: explicit QQuickLabsPlatformFileDialog(QObject *parent = nullptr); @@ -160,6 +161,7 @@ private: class QQuickLabsPlatformFileNameFilter : public QObject { Q_OBJECT + QML_ANONYMOUS Q_PROPERTY(int index READ index WRITE setIndex NOTIFY indexChanged FINAL) Q_PROPERTY(QString name READ name NOTIFY nameChanged FINAL) Q_PROPERTY(QStringList extensions READ extensions NOTIFY extensionsChanged FINAL) diff --git a/src/labs/platform/qquicklabsplatformfolderdialog_p.h b/src/labs/platform/qquicklabsplatformfolderdialog_p.h index 83e5c5f8cc..4b3d5f60ef 100644 --- a/src/labs/platform/qquicklabsplatformfolderdialog_p.h +++ b/src/labs/platform/qquicklabsplatformfolderdialog_p.h @@ -60,12 +60,13 @@ QT_BEGIN_NAMESPACE class QQuickLabsPlatformFolderDialog : public QQuickLabsPlatformDialog { Q_OBJECT + QML_NAMED_ELEMENT(FolderDialog) + QML_EXTENDED_NAMESPACE(QFileDialogOptions) Q_PROPERTY(QUrl folder READ folder WRITE setFolder NOTIFY folderChanged FINAL) Q_PROPERTY(QUrl currentFolder READ currentFolder WRITE setCurrentFolder NOTIFY currentFolderChanged FINAL) Q_PROPERTY(QFileDialogOptions::FileDialogOptions options READ options WRITE setOptions RESET resetOptions NOTIFY optionsChanged FINAL) Q_PROPERTY(QString acceptLabel READ acceptLabel WRITE setAcceptLabel RESET resetAcceptLabel NOTIFY acceptLabelChanged FINAL) Q_PROPERTY(QString rejectLabel READ rejectLabel WRITE setRejectLabel RESET resetRejectLabel NOTIFY rejectLabelChanged FINAL) - Q_FLAGS(QFileDialogOptions::FileDialogOptions) public: explicit QQuickLabsPlatformFolderDialog(QObject *parent = nullptr); diff --git a/src/labs/platform/qquicklabsplatformfontdialog_p.h b/src/labs/platform/qquicklabsplatformfontdialog_p.h index 3c5ef5bbfb..eb60736d6c 100644 --- a/src/labs/platform/qquicklabsplatformfontdialog_p.h +++ b/src/labs/platform/qquicklabsplatformfontdialog_p.h @@ -60,10 +60,11 @@ QT_BEGIN_NAMESPACE class QQuickLabsPlatformFontDialog : public QQuickLabsPlatformDialog { Q_OBJECT + QML_NAMED_ELEMENT(FontDialog) + QML_EXTENDED_NAMESPACE(QFontDialogOptions) Q_PROPERTY(QFont font READ font WRITE setFont NOTIFY fontChanged FINAL) Q_PROPERTY(QFont currentFont READ currentFont WRITE setCurrentFont NOTIFY currentFontChanged FINAL) Q_PROPERTY(QFontDialogOptions::FontDialogOptions options READ options WRITE setOptions NOTIFY optionsChanged FINAL) - Q_FLAGS(QFontDialogOptions::FontDialogOptions) public: explicit QQuickLabsPlatformFontDialog(QObject *parent = nullptr); diff --git a/src/labs/platform/qquicklabsplatformicon_p.h b/src/labs/platform/qquicklabsplatformicon_p.h index fdc4b76824..9b6e280805 100644 --- a/src/labs/platform/qquicklabsplatformicon_p.h +++ b/src/labs/platform/qquicklabsplatformicon_p.h @@ -54,6 +54,8 @@ #include <QtCore/qurl.h> #include <QtCore/qstring.h> +#include <QtQml/qqmlengine.h> + QT_BEGIN_NAMESPACE class QObject; @@ -61,6 +63,7 @@ class QObject; class QQuickLabsPlatformIcon { Q_GADGET + QML_ANONYMOUS Q_PROPERTY(QUrl source READ source WRITE setSource) Q_PROPERTY(QString name READ name WRITE setName) Q_PROPERTY(bool mask READ isMask WRITE setMask) diff --git a/src/labs/platform/qquicklabsplatformmenu.cpp b/src/labs/platform/qquicklabsplatformmenu.cpp index fc15892d89..b1115aa167 100644 --- a/src/labs/platform/qquicklabsplatformmenu.cpp +++ b/src/labs/platform/qquicklabsplatformmenu.cpp @@ -195,7 +195,7 @@ QT_BEGIN_NAMESPACE This signal is emitted when the menu is about to be hidden from the user. */ -Q_DECLARE_LOGGING_CATEGORY(qtLabsPlatformMenus) +Q_LOGGING_CATEGORY(qtLabsPlatformMenus, "qt.labs.platform.menus") QQuickLabsPlatformMenu::QQuickLabsPlatformMenu(QObject *parent) : QObject(parent), diff --git a/src/labs/platform/qquicklabsplatformmenu_p.h b/src/labs/platform/qquicklabsplatformmenu_p.h index 2f17180f57..877e10a47c 100644 --- a/src/labs/platform/qquicklabsplatformmenu_p.h +++ b/src/labs/platform/qquicklabsplatformmenu_p.h @@ -76,6 +76,8 @@ class QQuickLabsPlatformSystemTrayIcon; class QQuickLabsPlatformMenu : public QObject, public QQmlParserStatus { Q_OBJECT + QML_NAMED_ELEMENT(Menu) + QML_EXTENDED_NAMESPACE(QPlatformMenu) Q_INTERFACES(QQmlParserStatus) Q_PROPERTY(QQmlListProperty<QObject> data READ data FINAL) Q_PROPERTY(QQmlListProperty<QQuickLabsPlatformMenuItem> items READ items NOTIFY itemsChanged FINAL) @@ -90,7 +92,6 @@ class QQuickLabsPlatformMenu : public QObject, public QQmlParserStatus Q_PROPERTY(QString title READ title WRITE setTitle NOTIFY titleChanged FINAL) Q_PROPERTY(QFont font READ font WRITE setFont NOTIFY fontChanged FINAL) Q_PROPERTY(QQuickLabsPlatformIcon icon READ icon WRITE setIcon NOTIFY iconChanged FINAL REVISION(1, 1)) - Q_ENUMS(QPlatformMenu::MenuType) Q_CLASSINFO("DefaultProperty", "data") public: @@ -211,6 +212,5 @@ private: QT_END_NAMESPACE QML_DECLARE_TYPE(QQuickLabsPlatformMenu) -Q_DECLARE_METATYPE(QPlatformMenu::MenuType) #endif // QQUICKLABSPLATFORMMENU_P_H diff --git a/src/labs/platform/qquicklabsplatformmenubar_p.h b/src/labs/platform/qquicklabsplatformmenubar_p.h index cb5a8b0fb5..0166ec27f1 100644 --- a/src/labs/platform/qquicklabsplatformmenubar_p.h +++ b/src/labs/platform/qquicklabsplatformmenubar_p.h @@ -65,6 +65,7 @@ class QQuickLabsPlatformMenu; class QQuickLabsPlatformMenuBar : public QObject, public QQmlParserStatus { Q_OBJECT + QML_NAMED_ELEMENT(MenuBar) Q_INTERFACES(QQmlParserStatus) Q_PROPERTY(QQmlListProperty<QObject> data READ data FINAL) Q_PROPERTY(QQmlListProperty<QQuickLabsPlatformMenu> menus READ menus NOTIFY menusChanged FINAL) diff --git a/src/labs/platform/qquicklabsplatformmenuitem_p.h b/src/labs/platform/qquicklabsplatformmenuitem_p.h index 8daa7c0555..469cfce33b 100644 --- a/src/labs/platform/qquicklabsplatformmenuitem_p.h +++ b/src/labs/platform/qquicklabsplatformmenuitem_p.h @@ -70,6 +70,8 @@ class QQuickLabsPlatformMenuItemGroup; class QQuickLabsPlatformMenuItem : public QObject, public QQmlParserStatus { Q_OBJECT + QML_NAMED_ELEMENT(MenuItem) + QML_EXTENDED_NAMESPACE(QPlatformMenuItem) Q_INTERFACES(QQmlParserStatus) Q_PROPERTY(QQuickLabsPlatformMenu *menu READ menu NOTIFY menuChanged FINAL) Q_PROPERTY(QQuickLabsPlatformMenu *subMenu READ subMenu NOTIFY subMenuChanged FINAL) @@ -84,7 +86,6 @@ class QQuickLabsPlatformMenuItem : public QObject, public QQmlParserStatus Q_PROPERTY(QVariant shortcut READ shortcut WRITE setShortcut NOTIFY shortcutChanged FINAL) Q_PROPERTY(QFont font READ font WRITE setFont NOTIFY fontChanged FINAL) Q_PROPERTY(QQuickLabsPlatformIcon icon READ icon WRITE setIcon NOTIFY iconChanged FINAL REVISION(1, 1)) - Q_ENUMS(QPlatformMenuItem::MenuRole) public: explicit QQuickLabsPlatformMenuItem(QObject *parent = nullptr); diff --git a/src/labs/platform/qquicklabsplatformmenuitemgroup_p.h b/src/labs/platform/qquicklabsplatformmenuitemgroup_p.h index 98521becde..0c25244a6d 100644 --- a/src/labs/platform/qquicklabsplatformmenuitemgroup_p.h +++ b/src/labs/platform/qquicklabsplatformmenuitemgroup_p.h @@ -63,6 +63,7 @@ class QQuickLabsPlatformMenuItemGroupPrivate; class QQuickLabsPlatformMenuItemGroup : public QObject { Q_OBJECT + QML_NAMED_ELEMENT(MenuItemGroup) Q_PROPERTY(bool enabled READ isEnabled WRITE setEnabled NOTIFY enabledChanged FINAL) Q_PROPERTY(bool visible READ isVisible WRITE setVisible NOTIFY visibleChanged FINAL) Q_PROPERTY(bool exclusive READ isExclusive WRITE setExclusive NOTIFY exclusiveChanged FINAL) diff --git a/src/labs/platform/qquicklabsplatformmenuseparator_p.h b/src/labs/platform/qquicklabsplatformmenuseparator_p.h index 3138e3ab1f..bb91ed94e1 100644 --- a/src/labs/platform/qquicklabsplatformmenuseparator_p.h +++ b/src/labs/platform/qquicklabsplatformmenuseparator_p.h @@ -58,7 +58,7 @@ QT_BEGIN_NAMESPACE class QQuickLabsPlatformMenuSeparator : public QQuickLabsPlatformMenuItem { Q_OBJECT - + QML_NAMED_ELEMENT(MenuSeparator) public: explicit QQuickLabsPlatformMenuSeparator(QObject *parent = nullptr); }; diff --git a/src/labs/platform/qquicklabsplatformmessagedialog_p.h b/src/labs/platform/qquicklabsplatformmessagedialog_p.h index ba8a73e989..d48efc89fd 100644 --- a/src/labs/platform/qquicklabsplatformmessagedialog_p.h +++ b/src/labs/platform/qquicklabsplatformmessagedialog_p.h @@ -59,11 +59,12 @@ QT_BEGIN_NAMESPACE class QQuickLabsPlatformMessageDialog : public QQuickLabsPlatformDialog { Q_OBJECT + QML_NAMED_ELEMENT(MessageDialog) Q_PROPERTY(QString text READ text WRITE setText NOTIFY textChanged FINAL) Q_PROPERTY(QString informativeText READ informativeText WRITE setInformativeText NOTIFY informativeTextChanged FINAL) Q_PROPERTY(QString detailedText READ detailedText WRITE setDetailedText NOTIFY detailedTextChanged FINAL) Q_PROPERTY(QPlatformDialogHelper::StandardButtons buttons READ buttons WRITE setButtons NOTIFY buttonsChanged FINAL) - Q_FLAGS(QPlatformDialogHelper::StandardButtons) + QML_EXTENDED_NAMESPACE(QPlatformDialogHelper) public: explicit QQuickLabsPlatformMessageDialog(QObject *parent = nullptr); diff --git a/src/labs/platform/qquicklabsplatformstandardpaths_p.h b/src/labs/platform/qquicklabsplatformstandardpaths_p.h index 2dd3247e72..01f2901609 100644 --- a/src/labs/platform/qquicklabsplatformstandardpaths_p.h +++ b/src/labs/platform/qquicklabsplatformstandardpaths_p.h @@ -64,7 +64,9 @@ class QJSEngine; class QQuickLabsPlatformStandardPaths : public QObject { Q_OBJECT - Q_ENUMS(QStandardPaths::StandardLocation QStandardPaths::LocateOptions) + QML_SINGLETON + QML_NAMED_ELEMENT(StandardPaths) + QML_EXTENDED_NAMESPACE(QStandardPaths) public: explicit QQuickLabsPlatformStandardPaths(QObject *parent = nullptr); diff --git a/src/labs/platform/qquicklabsplatformsystemtrayicon.cpp b/src/labs/platform/qquicklabsplatformsystemtrayicon.cpp index 88e806ba09..3a0a8f746b 100644 --- a/src/labs/platform/qquicklabsplatformsystemtrayicon.cpp +++ b/src/labs/platform/qquicklabsplatformsystemtrayicon.cpp @@ -166,7 +166,7 @@ QT_BEGIN_NAMESPACE \sa showMessage() */ -Q_DECLARE_LOGGING_CATEGORY(qtLabsPlatformTray) +Q_LOGGING_CATEGORY(qtLabsPlatformTray, "qt.labs.platform.tray") QQuickLabsPlatformSystemTrayIcon::QQuickLabsPlatformSystemTrayIcon(QObject *parent) : QObject(parent), diff --git a/src/labs/platform/qquicklabsplatformsystemtrayicon_p.h b/src/labs/platform/qquicklabsplatformsystemtrayicon_p.h index 70a4c545e7..a487a09df5 100644 --- a/src/labs/platform/qquicklabsplatformsystemtrayicon_p.h +++ b/src/labs/platform/qquicklabsplatformsystemtrayicon_p.h @@ -69,6 +69,8 @@ class QQuickLabsPlatformIconLoader; class QQuickLabsPlatformSystemTrayIcon : public QObject, public QQmlParserStatus { Q_OBJECT + QML_NAMED_ELEMENT(SystemTrayIcon) + QML_EXTENDED_NAMESPACE(QPlatformSystemTrayIcon) Q_INTERFACES(QQmlParserStatus) Q_PROPERTY(bool available READ isAvailable CONSTANT FINAL) Q_PROPERTY(bool supportsMessages READ supportsMessages CONSTANT FINAL) @@ -77,7 +79,6 @@ class QQuickLabsPlatformSystemTrayIcon : public QObject, public QQmlParserStatus Q_PROPERTY(QQuickLabsPlatformMenu *menu READ menu WRITE setMenu NOTIFY menuChanged FINAL) Q_PROPERTY(QRect geometry READ geometry NOTIFY geometryChanged FINAL REVISION(1, 1)) Q_PROPERTY(QQuickLabsPlatformIcon icon READ icon WRITE setIcon NOTIFY iconChanged FINAL REVISION(1, 1)) - Q_ENUMS(QPlatformSystemTrayIcon::ActivationReason QPlatformSystemTrayIcon::MessageIcon) public: explicit QQuickLabsPlatformSystemTrayIcon(QObject *parent = nullptr); diff --git a/src/labs/platform/qtlabsplatformplugin.cpp b/src/labs/platform/qtlabsplatformplugin.cpp deleted file mode 100644 index 17448b5916..0000000000 --- a/src/labs/platform/qtlabsplatformplugin.cpp +++ /dev/null @@ -1,120 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2017 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the Qt Labs Templates 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 The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://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.LGPL3 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-3.0.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 (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include <QtQml/qqmlextensionplugin.h> -#include <QtQml/qqml.h> -#include <QtCore/qloggingcategory.h> - -#include "qquicklabsplatformdialog_p.h" -#include "qquicklabsplatformcolordialog_p.h" -#include "qquicklabsplatformfiledialog_p.h" -#include "qquicklabsplatformfolderdialog_p.h" -#include "qquicklabsplatformfontdialog_p.h" -#include "qquicklabsplatformmessagedialog_p.h" - -#include "qquicklabsplatformmenu_p.h" -#include "qquicklabsplatformmenubar_p.h" -#include "qquicklabsplatformmenuitem_p.h" -#include "qquicklabsplatformmenuitemgroup_p.h" -#include "qquicklabsplatformmenuseparator_p.h" - -#include "qquicklabsplatformstandardpaths_p.h" -#if QT_CONFIG(systemtrayicon) -# include "qquicklabsplatformsystemtrayicon_p.h" -#endif - -#include "qquicklabsplatformicon_p.h" - -QT_BEGIN_NAMESPACE - -Q_LOGGING_CATEGORY(qtLabsPlatformDialogs, "qt.labs.platform.dialogs") -Q_LOGGING_CATEGORY(qtLabsPlatformMenus, "qt.labs.platform.menus") -Q_LOGGING_CATEGORY(qtLabsPlatformTray, "qt.labs.platform.tray") - -class QtLabsPlatformPlugin: public QQmlExtensionPlugin -{ - Q_OBJECT - Q_PLUGIN_METADATA(IID QQmlExtensionInterface_iid) - -public: - QtLabsPlatformPlugin(QObject *parent = nullptr); - void registerTypes(const char *uri) override; -}; - -QtLabsPlatformPlugin::QtLabsPlatformPlugin(QObject *parent) : QQmlExtensionPlugin(parent) -{ -} - -void QtLabsPlatformPlugin::registerTypes(const char *uri) -{ - qmlRegisterUncreatableType<QQuickLabsPlatformDialog>(uri, 1, 0, "Dialog", QQuickLabsPlatformDialog::tr("Dialog is an abstract base class")); - qmlRegisterType<QQuickLabsPlatformColorDialog>(uri, 1, 0, "ColorDialog"); - qmlRegisterType<QQuickLabsPlatformFileDialog>(uri, 1, 0, "FileDialog"); - qmlRegisterAnonymousType<QQuickLabsPlatformFileNameFilter>(uri, 1); - qmlRegisterType<QQuickLabsPlatformFolderDialog>(uri, 1, 0, "FolderDialog"); - qmlRegisterType<QQuickLabsPlatformFontDialog>(uri, 1, 0, "FontDialog"); - qmlRegisterType<QQuickLabsPlatformMessageDialog>(uri, 1, 0, "MessageDialog"); - - qmlRegisterType<QQuickLabsPlatformMenu>(uri, 1, 0, "Menu"); - qmlRegisterType<QQuickLabsPlatformMenuBar>(uri, 1, 0, "MenuBar"); - qmlRegisterType<QQuickLabsPlatformMenuItem>(uri, 1, 0, "MenuItem"); - qmlRegisterType<QQuickLabsPlatformMenuItem, 1>(uri, 1, 1, "MenuItem"); - qmlRegisterType<QQuickLabsPlatformMenuItemGroup>(uri, 1, 0, "MenuItemGroup"); - qmlRegisterType<QQuickLabsPlatformMenuSeparator>(uri, 1, 0, "MenuSeparator"); - qRegisterMetaType<QPlatformMenu::MenuType>(); - - qmlRegisterUncreatableType<QPlatformDialogHelper>(uri, 1, 0, "StandardButton", QQuickLabsPlatformDialog::tr("Cannot create an instance of StandardButton")); - qmlRegisterSingletonType<QQuickLabsPlatformStandardPaths>(uri, 1, 0, "StandardPaths", QQuickLabsPlatformStandardPaths::create); - qRegisterMetaType<QStandardPaths::StandardLocation>(); - qRegisterMetaType<QStandardPaths::LocateOptions>(); - -#if QT_CONFIG(systemtrayicon) - qmlRegisterType<QQuickLabsPlatformSystemTrayIcon>(uri, 1, 0, "SystemTrayIcon"); - qmlRegisterType<QQuickLabsPlatformSystemTrayIcon, 1>(uri, 1, 1, "SystemTrayIcon"); - qRegisterMetaType<QPlatformSystemTrayIcon::ActivationReason>(); - qRegisterMetaType<QPlatformSystemTrayIcon::MessageIcon>(); -#endif - - qmlRegisterAnonymousType<QQuickLabsPlatformIcon>(uri, 1); - qRegisterMetaType<QQuickLabsPlatformIcon>(); -} - -QT_END_NAMESPACE - -#include "qtlabsplatformplugin.moc" diff --git a/src/labs/platform/widgets/qwidgetplatformmenu_p.h b/src/labs/platform/widgets/qwidgetplatformmenu_p.h index 7136fc0ea0..7032b6bf66 100644 --- a/src/labs/platform/widgets/qwidgetplatformmenu_p.h +++ b/src/labs/platform/widgets/qwidgetplatformmenu_p.h @@ -98,4 +98,6 @@ private: QT_END_NAMESPACE +Q_DECLARE_METATYPE(QPlatformMenu::MenuType) + #endif // QWIDGETPLATFORMMENU_P_H |