diff options
Diffstat (limited to 'src/imports/templates')
-rw-r--r-- | src/imports/templates/doc/src/qtquicktemplates2-qmltypes.qdoc | 4 | ||||
-rw-r--r-- | src/imports/templates/plugins.qmltypes | 336 | ||||
-rw-r--r-- | src/imports/templates/qquicktemplates2valuetypeprovider.cpp | 159 | ||||
-rw-r--r-- | src/imports/templates/qquicktemplates2valuetypeprovider_p.h | 68 | ||||
-rw-r--r-- | src/imports/templates/qtquicktemplates2plugin.cpp | 68 | ||||
-rw-r--r-- | src/imports/templates/templates.pro | 6 |
6 files changed, 601 insertions, 40 deletions
diff --git a/src/imports/templates/doc/src/qtquicktemplates2-qmltypes.qdoc b/src/imports/templates/doc/src/qtquicktemplates2-qmltypes.qdoc index 19725fa4..52796425 100644 --- a/src/imports/templates/doc/src/qtquicktemplates2-qmltypes.qdoc +++ b/src/imports/templates/doc/src/qtquicktemplates2-qmltypes.qdoc @@ -26,7 +26,7 @@ ****************************************************************************/ /*! - \qmlmodule QtQuick.Templates 2.2 + \qmlmodule QtQuick.Templates 2.3 \title Qt Quick Templates 2 QML Types \ingroup qmlmodules \brief Provides QML types for templates (Qt Quick Templates). @@ -38,7 +38,7 @@ \c .qml file: \badcode - import QtQuick.Templates 2.2 as T + import QtQuick.Templates 2.3 as T \endcode For the sake of clarity, there is a one-to-one mapping between the types diff --git a/src/imports/templates/plugins.qmltypes b/src/imports/templates/plugins.qmltypes index 712cf3b6..776c62ee 100644 --- a/src/imports/templates/plugins.qmltypes +++ b/src/imports/templates/plugins.qmltypes @@ -4,7 +4,7 @@ import QtQuick.tooling 1.2 // It is used for QML tooling purposes only. // // This file was auto-generated by: -// 'qmlplugindump -nonrelocatable -dependencies dependencies.json QtQuick.Templates 2.2' +// 'qmlplugindump -nonrelocatable -dependencies dependencies.json QtQuick.Templates 2.3' Module { dependencies: ["QtQuick 2.9", "QtQuick.Window 2.2"] @@ -14,9 +14,19 @@ Module { prototype: "QQuickControl" exports: [ "QtQuick.Templates/AbstractButton 2.0", - "QtQuick.Templates/AbstractButton 2.2" + "QtQuick.Templates/AbstractButton 2.2", + "QtQuick.Templates/AbstractButton 2.3" ] - exportMetaObjectRevisions: [0, 2] + exportMetaObjectRevisions: [0, 2, 3] + Enum { + name: "Display" + values: { + "IconOnly": 0, + "TextOnly": 1, + "TextBesideIcon": 2, + "TextUnderIcon": 3 + } + } Property { name: "text"; type: "string" } Property { name: "down"; type: "bool" } Property { name: "pressed"; type: "bool"; isReadonly: true } @@ -24,6 +34,9 @@ Module { Property { name: "checkable"; type: "bool" } Property { name: "autoExclusive"; type: "bool" } Property { name: "indicator"; type: "QQuickItem"; isPointer: true } + Property { name: "icon"; revision: 3; type: "QQuickIcon" } + Property { name: "display"; revision: 3; type: "Display" } + Property { name: "action"; revision: 3; type: "QQuickAction"; isPointer: true } Signal { name: "pressed" } Signal { name: "released" } Signal { name: "canceled" } @@ -31,14 +44,104 @@ Module { Signal { name: "toggled"; revision: 2 } Signal { name: "pressAndHold" } Signal { name: "doubleClicked" } + Signal { name: "iconChanged"; revision: 3 } + Signal { name: "displayChanged"; revision: 3 } + Signal { name: "actionChanged"; revision: 3 } + Method { name: "toggle" } + } + Component { + name: "QQuickAction" + prototype: "QObject" + exports: ["QtQuick.Templates/Action 2.3"] + exportMetaObjectRevisions: [0] + Property { name: "text"; type: "string" } + Property { name: "icon"; type: "QQuickIcon" } + Property { name: "enabled"; type: "bool" } + Property { name: "checked"; type: "bool" } + Property { name: "checkable"; type: "bool" } + Property { name: "shortcut"; type: "QVariant" } + Signal { + name: "textChanged" + Parameter { name: "text"; type: "string" } + } + Signal { + name: "iconChanged" + Parameter { name: "icon"; type: "QQuickIcon" } + } + Signal { + name: "enabledChanged" + Parameter { name: "enabled"; type: "bool" } + } + Signal { + name: "checkedChanged" + Parameter { name: "checked"; type: "bool" } + } + Signal { + name: "checkableChanged" + Parameter { name: "checkable"; type: "bool" } + } + Signal { + name: "shortcutChanged" + Parameter { name: "shortcut"; type: "QKeySequence" } + } + Signal { + name: "toggled" + Parameter { name: "source"; type: "QObject"; isPointer: true } + } + Signal { name: "toggled" } + Signal { + name: "triggered" + Parameter { name: "source"; type: "QObject"; isPointer: true } + } + Signal { name: "triggered" } + Method { + name: "toggle" + Parameter { name: "source"; type: "QObject"; isPointer: true } + } Method { name: "toggle" } + Method { + name: "trigger" + Parameter { name: "source"; type: "QObject"; isPointer: true } + } + Method { name: "trigger" } + } + Component { + name: "QQuickActionGroup" + prototype: "QObject" + exports: ["QtQuick.Templates/ActionGroup 2.3"] + exportMetaObjectRevisions: [0] + attachedType: "QQuickActionGroupAttached" + Property { name: "checkedAction"; type: "QQuickAction"; isPointer: true } + Property { name: "actions"; type: "QQuickAction"; isList: true; isReadonly: true } + Property { name: "exclusive"; type: "bool" } + Property { name: "enabled"; type: "bool" } + Signal { + name: "triggered" + Parameter { name: "action"; type: "QQuickAction"; isPointer: true } + } + Method { + name: "addAction" + Parameter { name: "action"; type: "QQuickAction"; isPointer: true } + } + Method { + name: "removeAction" + Parameter { name: "action"; type: "QQuickAction"; isPointer: true } + } + } + Component { + name: "QQuickActionGroupAttached" + prototype: "QObject" + Property { name: "group"; type: "QQuickActionGroup"; isPointer: true } } Component { name: "QQuickApplicationWindow" defaultProperty: "contentData" prototype: "QQuickWindowQmlImpl" - exports: ["QtQuick.Templates/ApplicationWindow 2.0"] - exportMetaObjectRevisions: [0] + exports: [ + "QtQuick.Templates/ApplicationWindow 2.0", + "QtQuick.Templates/ApplicationWindow 2.3" + ] + exportMetaObjectRevisions: [0, 3] attachedType: "QQuickApplicationWindowAttached" Property { name: "background"; type: "QQuickItem"; isPointer: true } Property { name: "contentItem"; type: "QQuickItem"; isReadonly: true; isPointer: true } @@ -49,6 +152,8 @@ Module { Property { name: "overlay"; type: "QQuickOverlay"; isReadonly: true; isPointer: true } Property { name: "font"; type: "QFont" } Property { name: "locale"; type: "QLocale" } + Property { name: "palette"; revision: 3; type: "QPalette" } + Signal { name: "paletteChanged"; revision: 3 } } Component { name: "QQuickApplicationWindowAttached" @@ -83,12 +188,15 @@ Module { prototype: "QObject" exports: [ "QtQuick.Templates/ButtonGroup 2.0", - "QtQuick.Templates/ButtonGroup 2.1" + "QtQuick.Templates/ButtonGroup 2.1", + "QtQuick.Templates/ButtonGroup 2.3" ] - exportMetaObjectRevisions: [0, 1] + exportMetaObjectRevisions: [0, 1, 3] attachedType: "QQuickButtonGroupAttached" Property { name: "checkedButton"; type: "QQuickAbstractButton"; isPointer: true } Property { name: "buttons"; type: "QQuickAbstractButton"; isList: true; isReadonly: true } + Property { name: "exclusive"; revision: 3; type: "bool" } + Signal { name: "exclusiveChanged"; revision: 3 } Signal { name: "clicked" revision: 1 @@ -199,9 +307,10 @@ Module { prototype: "QQuickControl" exports: [ "QtQuick.Templates/Container 2.0", - "QtQuick.Templates/Container 2.1" + "QtQuick.Templates/Container 2.1", + "QtQuick.Templates/Container 2.3" ] - exportMetaObjectRevisions: [0, 1] + exportMetaObjectRevisions: [0, 1, 3] Property { name: "count"; type: "int"; isReadonly: true } Property { name: "contentModel"; type: "QVariant"; isReadonly: true } Property { name: "contentData"; type: "QObject"; isList: true; isReadonly: true } @@ -235,6 +344,12 @@ Module { } Method { name: "removeItem" + Parameter { name: "item"; type: "QVariant" } + } + Method { + name: "takeItem" + revision: 3 + type: "QQuickItem*" Parameter { name: "index"; type: "int" } } } @@ -242,8 +357,11 @@ Module { name: "QQuickControl" defaultProperty: "data" prototype: "QQuickItem" - exports: ["QtQuick.Templates/Control 2.0"] - exportMetaObjectRevisions: [0] + exports: [ + "QtQuick.Templates/Control 2.0", + "QtQuick.Templates/Control 2.3" + ] + exportMetaObjectRevisions: [0, 3] Property { name: "font"; type: "QFont" } Property { name: "availableWidth"; type: "double"; isReadonly: true } Property { name: "availableHeight"; type: "double"; isReadonly: true } @@ -263,6 +381,8 @@ Module { Property { name: "wheelEnabled"; type: "bool" } Property { name: "background"; type: "QQuickItem"; isPointer: true } Property { name: "contentItem"; type: "QQuickItem"; isPointer: true } + Property { name: "palette"; revision: 3; type: "QPalette" } + Signal { name: "paletteChanged"; revision: 3 } } Component { name: "QQuickDelayButton" @@ -309,23 +429,52 @@ Module { name: "QQuickDialog" defaultProperty: "contentData" prototype: "QQuickPopup" - exports: ["QtQuick.Templates/Dialog 2.1"] - exportMetaObjectRevisions: [0] + exports: [ + "QtQuick.Templates/Dialog 2.1", + "QtQuick.Templates/Dialog 2.3" + ] + exportMetaObjectRevisions: [0, 3] + Enum { + name: "StandardCode" + values: { + "Rejected": 0, + "Accepted": 1 + } + } Property { name: "title"; type: "string" } Property { name: "header"; type: "QQuickItem"; isPointer: true } Property { name: "footer"; type: "QQuickItem"; isPointer: true } Property { name: "standardButtons"; type: "QPlatformDialogHelper::StandardButtons" } + Property { name: "result"; revision: 3; type: "int" } Signal { name: "accepted" } Signal { name: "rejected" } + Signal { name: "applied"; revision: 3 } + Signal { name: "reset"; revision: 3 } + Signal { name: "discarded"; revision: 3 } + Signal { name: "helpRequested"; revision: 3 } + Signal { name: "resultChanged"; revision: 3 } Method { name: "accept" } Method { name: "reject" } + Method { + name: "done" + Parameter { name: "result"; type: "int" } + } + Method { + name: "standardButton" + revision: 3 + type: "QQuickAbstractButton*" + Parameter { name: "button"; type: "QPlatformDialogHelper::StandardButton" } + } } Component { name: "QQuickDialogButtonBox" defaultProperty: "contentData" prototype: "QQuickContainer" - exports: ["QtQuick.Templates/DialogButtonBox 2.1"] - exportMetaObjectRevisions: [0] + exports: [ + "QtQuick.Templates/DialogButtonBox 2.1", + "QtQuick.Templates/DialogButtonBox 2.3" + ] + exportMetaObjectRevisions: [0, 0] attachedType: "QQuickDialogButtonBoxAttached" Enum { name: "Position" @@ -341,6 +490,9 @@ Module { Signal { name: "accepted" } Signal { name: "rejected" } Signal { name: "helpRequested" } + Signal { name: "applied"; revision: 3 } + Signal { name: "reset"; revision: 3 } + Signal { name: "discarded"; revision: 3 } Signal { name: "clicked" Parameter { name: "button"; type: "QQuickAbstractButton"; isPointer: true } @@ -404,16 +556,30 @@ Module { exportMetaObjectRevisions: [0] Property { name: "font"; type: "QFont" } Property { name: "background"; type: "QQuickItem"; isPointer: true } + Property { name: "palette"; revision: 3; type: "QPalette" } + Signal { name: "paletteChanged"; revision: 3 } } Component { name: "QQuickMenu" defaultProperty: "contentData" prototype: "QQuickPopup" - exports: ["QtQuick.Templates/Menu 2.0"] - exportMetaObjectRevisions: [0] + exports: ["QtQuick.Templates/Menu 2.0", "QtQuick.Templates/Menu 2.3"] + exportMetaObjectRevisions: [0, 3] Property { name: "contentModel"; type: "QVariant"; isReadonly: true } Property { name: "contentData"; type: "QObject"; isList: true; isReadonly: true } Property { name: "title"; type: "string" } + Property { name: "cascade"; revision: 3; type: "bool" } + Property { name: "overlap"; revision: 3; type: "double" } + Property { name: "delegate"; revision: 3; type: "QQmlComponent"; isPointer: true } + Property { name: "currentIndex"; revision: 3; type: "int" } + Signal { + name: "titleChanged" + Parameter { name: "title"; type: "string" } + } + Signal { name: "cascadeChanged"; revision: 3 } + Signal { name: "overlapChanged"; revision: 3 } + Signal { name: "delegateChanged"; revision: 3 } + Signal { name: "currentIndexChanged"; revision: 3 } Method { name: "itemAt" type: "QQuickItem*" @@ -435,17 +601,81 @@ Module { } Method { name: "removeItem" + Parameter { name: "item"; type: "QVariant" } + } + Method { + name: "takeItem" + revision: 3 + type: "QQuickItem*" + Parameter { name: "index"; type: "int" } + } + Method { + name: "addMenu" + revision: 3 + Parameter { name: "menu"; type: "QQuickMenu"; isPointer: true } + } + Method { + name: "insertMenu" + revision: 3 + Parameter { name: "index"; type: "int" } + Parameter { name: "menu"; type: "QQuickMenu"; isPointer: true } + } + Method { + name: "removeMenu" + revision: 3 + Parameter { name: "menu"; type: "QQuickMenu"; isPointer: true } + } + Method { + name: "takeMenu" + revision: 3 + type: "QQuickMenu*" + Parameter { name: "index"; type: "int" } + } + Method { + name: "addAction" + revision: 3 + Parameter { name: "action"; type: "QQuickAction"; isPointer: true } + } + Method { + name: "insertAction" + revision: 3 + Parameter { name: "index"; type: "int" } + Parameter { name: "action"; type: "QQuickAction"; isPointer: true } + } + Method { + name: "removeAction" + revision: 3 + Parameter { name: "action"; type: "QQuickAction"; isPointer: true } + } + Method { + name: "takeAction" + revision: 3 + type: "QQuickAction*" Parameter { name: "index"; type: "int" } } + Method { + name: "popup" + revision: 3 + Parameter { name: "args"; type: "QQmlV4Function"; isPointer: true } + } } Component { name: "QQuickMenuItem" defaultProperty: "data" prototype: "QQuickAbstractButton" - exports: ["QtQuick.Templates/MenuItem 2.0"] - exportMetaObjectRevisions: [0] + exports: [ + "QtQuick.Templates/MenuItem 2.0", + "QtQuick.Templates/MenuItem 2.3" + ] + exportMetaObjectRevisions: [0, 3] Property { name: "highlighted"; type: "bool" } + Property { name: "arrow"; revision: 3; type: "QQuickItem"; isPointer: true } + Property { name: "menu"; revision: 3; type: "QQuickMenu"; isReadonly: true; isPointer: true } + Property { name: "subMenu"; revision: 3; type: "QQuickMenu"; isReadonly: true; isPointer: true } Signal { name: "triggered" } + Signal { name: "arrowChanged"; revision: 3 } + Signal { name: "menuChanged"; revision: 3 } + Signal { name: "subMenuChanged"; revision: 3 } } Component { name: "QQuickMenuSeparator" @@ -507,9 +737,10 @@ Module { prototype: "QObject" exports: [ "QtQuick.Templates/Popup 2.0", - "QtQuick.Templates/Popup 2.1" + "QtQuick.Templates/Popup 2.1", + "QtQuick.Templates/Popup 2.3" ] - exportMetaObjectRevisions: [0, 1] + exportMetaObjectRevisions: [0, 1, 3] Enum { name: "ClosePolicy" values: { @@ -559,6 +790,7 @@ Module { Property { name: "bottomPadding"; type: "double" } Property { name: "locale"; type: "QLocale" } Property { name: "font"; type: "QFont" } + Property { name: "palette"; revision: 3; type: "QPalette" } Property { name: "parent"; type: "QQuickItem"; isPointer: true } Property { name: "background"; type: "QQuickItem"; isPointer: true } Property { name: "contentItem"; type: "QQuickItem"; isPointer: true } @@ -570,6 +802,8 @@ Module { Property { name: "modal"; type: "bool" } Property { name: "dim"; type: "bool" } Property { name: "visible"; type: "bool" } + Property { name: "enabled"; revision: 3; type: "bool" } + Property { name: "opened"; revision: 3; type: "bool"; isReadonly: true } Property { name: "opacity"; type: "double" } Property { name: "scale"; type: "double" } Property { name: "closePolicy"; type: "ClosePolicy" } @@ -577,6 +811,9 @@ Module { Property { name: "enter"; type: "QQuickTransition"; isPointer: true } Property { name: "exit"; type: "QQuickTransition"; isPointer: true } Signal { name: "spacingChanged"; revision: 1 } + Signal { name: "paletteChanged"; revision: 3 } + Signal { name: "enabledChanged"; revision: 3 } + Signal { name: "openedChanged"; revision: 3 } Signal { name: "windowChanged" Parameter { name: "window"; type: "QQuickWindow"; isPointer: true } @@ -627,9 +864,10 @@ Module { exports: [ "QtQuick.Templates/RangeSlider 2.0", "QtQuick.Templates/RangeSlider 2.1", - "QtQuick.Templates/RangeSlider 2.2" + "QtQuick.Templates/RangeSlider 2.2", + "QtQuick.Templates/RangeSlider 2.3" ] - exportMetaObjectRevisions: [0, 1, 2] + exportMetaObjectRevisions: [0, 1, 2, 3] Enum { name: "SnapMode" values: { @@ -645,6 +883,8 @@ Module { Property { name: "stepSize"; type: "double" } Property { name: "snapMode"; type: "SnapMode" } Property { name: "orientation"; type: "Qt::Orientation" } + Property { name: "horizontal"; revision: 3; type: "bool"; isReadonly: true } + Property { name: "vertical"; revision: 3; type: "bool"; isReadonly: true } Property { name: "live"; revision: 2; type: "bool" } Signal { name: "liveChanged"; revision: 2 } Method { @@ -680,9 +920,10 @@ Module { prototype: "QQuickControl" exports: [ "QtQuick.Templates/ScrollBar 2.0", - "QtQuick.Templates/ScrollBar 2.2" + "QtQuick.Templates/ScrollBar 2.2", + "QtQuick.Templates/ScrollBar 2.3" ] - exportMetaObjectRevisions: [0, 2] + exportMetaObjectRevisions: [0, 2, 3] attachedType: "QQuickScrollBarAttached" Enum { name: "SnapMode" @@ -709,6 +950,8 @@ Module { Property { name: "snapMode"; revision: 2; type: "SnapMode" } Property { name: "interactive"; revision: 2; type: "bool" } Property { name: "policy"; revision: 2; type: "Policy" } + Property { name: "horizontal"; revision: 3; type: "bool"; isReadonly: true } + Property { name: "vertical"; revision: 3; type: "bool"; isReadonly: true } Signal { name: "snapModeChanged"; revision: 2 } Signal { name: "interactiveChanged"; revision: 2 } Signal { name: "policyChanged"; revision: 2 } @@ -733,13 +976,18 @@ Module { name: "QQuickScrollIndicator" defaultProperty: "data" prototype: "QQuickControl" - exports: ["QtQuick.Templates/ScrollIndicator 2.0"] - exportMetaObjectRevisions: [0] + exports: [ + "QtQuick.Templates/ScrollIndicator 2.0", + "QtQuick.Templates/ScrollIndicator 2.3" + ] + exportMetaObjectRevisions: [0, 3] attachedType: "QQuickScrollIndicatorAttached" Property { name: "size"; type: "double" } Property { name: "position"; type: "double" } Property { name: "active"; type: "bool" } Property { name: "orientation"; type: "Qt::Orientation" } + Property { name: "horizontal"; revision: 3; type: "bool"; isReadonly: true } + Property { name: "vertical"; revision: 3; type: "bool"; isReadonly: true } Method { name: "setSize" Parameter { name: "size"; type: "double" } @@ -773,9 +1021,10 @@ Module { exports: [ "QtQuick.Templates/Slider 2.0", "QtQuick.Templates/Slider 2.1", - "QtQuick.Templates/Slider 2.2" + "QtQuick.Templates/Slider 2.2", + "QtQuick.Templates/Slider 2.3" ] - exportMetaObjectRevisions: [0, 1, 2] + exportMetaObjectRevisions: [0, 1, 2, 3] Enum { name: "SnapMode" values: { @@ -793,6 +1042,8 @@ Module { Property { name: "snapMode"; type: "SnapMode" } Property { name: "live"; revision: 2; type: "bool" } Property { name: "pressed"; type: "bool" } + Property { name: "horizontal"; revision: 3; type: "bool"; isReadonly: true } + Property { name: "vertical"; revision: 3; type: "bool"; isReadonly: true } Property { name: "orientation"; type: "Qt::Orientation" } Property { name: "handle"; type: "QQuickItem"; isPointer: true } Signal { name: "liveChanged"; revision: 2 } @@ -813,9 +1064,10 @@ Module { exports: [ "QtQuick.Templates/SpinBox 2.0", "QtQuick.Templates/SpinBox 2.1", - "QtQuick.Templates/SpinBox 2.2" + "QtQuick.Templates/SpinBox 2.2", + "QtQuick.Templates/SpinBox 2.3" ] - exportMetaObjectRevisions: [0, 1, 2] + exportMetaObjectRevisions: [0, 1, 2, 3] Property { name: "from"; type: "int" } Property { name: "to"; type: "int" } Property { name: "value"; type: "int" } @@ -828,9 +1080,11 @@ Module { Property { name: "down"; type: "QQuickSpinButton"; isReadonly: true; isPointer: true } Property { name: "inputMethodHints"; revision: 2; type: "Qt::InputMethodHints" } Property { name: "inputMethodComposing"; revision: 2; type: "bool"; isReadonly: true } + Property { name: "wrap"; revision: 3; type: "bool" } Signal { name: "valueModified"; revision: 2 } Signal { name: "inputMethodHintsChanged"; revision: 2 } Signal { name: "inputMethodComposingChanged"; revision: 2 } + Signal { name: "wrapChanged"; revision: 3 } Method { name: "increase" } Method { name: "decrease" } } @@ -888,6 +1142,12 @@ Module { Property { name: "pushExit"; type: "QQuickTransition"; isPointer: true } Property { name: "replaceEnter"; type: "QQuickTransition"; isPointer: true } Property { name: "replaceExit"; type: "QQuickTransition"; isPointer: true } + Property { name: "empty"; revision: 3; type: "bool"; isReadonly: true } + Signal { name: "emptyChanged"; revision: 3 } + Method { + name: "clear" + Parameter { name: "operation"; type: "Operation" } + } Method { name: "clear" } Method { name: "get" @@ -999,6 +1259,8 @@ Module { attachedType: "QQuickSwipeViewAttached" Property { name: "interactive"; revision: 1; type: "bool" } Property { name: "orientation"; revision: 2; type: "Qt::Orientation" } + Property { name: "horizontal"; revision: 3; type: "bool"; isReadonly: true } + Property { name: "vertical"; revision: 3; type: "bool"; isReadonly: true } Signal { name: "interactiveChanged"; revision: 1 } Signal { name: "orientationChanged"; revision: 2 } } @@ -1038,6 +1300,7 @@ Module { "QtQuick.Templates/TabBar 2.2" ] exportMetaObjectRevisions: [0, 2] + attachedType: "QQuickTabBarAttached" Enum { name: "Position" values: { @@ -1052,6 +1315,13 @@ Module { Signal { name: "contentHeightChanged"; revision: 2 } } Component { + name: "QQuickTabBarAttached" + prototype: "QObject" + Property { name: "index"; type: "int"; isReadonly: true } + Property { name: "tabBar"; type: "QQuickTabBar"; isReadonly: true; isPointer: true } + Property { name: "position"; type: "QQuickTabBar::Position"; isReadonly: true } + } + Component { name: "QQuickTabButton" defaultProperty: "data" prototype: "QQuickAbstractButton" @@ -1076,6 +1346,7 @@ Module { Property { name: "focusReason"; type: "Qt::FocusReason" } Property { name: "hovered"; revision: 1; type: "bool"; isReadonly: true } Property { name: "hoverEnabled"; revision: 1; type: "bool" } + Property { name: "palette"; revision: 3; type: "QPalette" } Signal { name: "implicitWidthChanged3" } Signal { name: "implicitHeightChanged3" } Signal { name: "hoveredChanged"; revision: 1 } @@ -1094,6 +1365,7 @@ Module { revision: 1 Parameter { name: "event"; type: "QQuickMouseEvent"; isPointer: true } } + Signal { name: "paletteChanged"; revision: 3 } } Component { name: "QQuickTextAreaAttached" @@ -1117,6 +1389,7 @@ Module { Property { name: "focusReason"; type: "Qt::FocusReason" } Property { name: "hovered"; revision: 1; type: "bool"; isReadonly: true } Property { name: "hoverEnabled"; revision: 1; type: "bool" } + Property { name: "palette"; revision: 3; type: "QPalette" } Signal { name: "implicitWidthChanged3" } Signal { name: "implicitHeightChanged3" } Signal { name: "hoveredChanged"; revision: 1 } @@ -1135,6 +1408,7 @@ Module { revision: 1 Parameter { name: "event"; type: "QQuickMouseEvent"; isPointer: true } } + Signal { name: "paletteChanged"; revision: 3 } } Component { name: "QQuickToolBar" diff --git a/src/imports/templates/qquicktemplates2valuetypeprovider.cpp b/src/imports/templates/qquicktemplates2valuetypeprovider.cpp new file mode 100644 index 00000000..6debdbc4 --- /dev/null +++ b/src/imports/templates/qquicktemplates2valuetypeprovider.cpp @@ -0,0 +1,159 @@ +/**************************************************************************** +** +** Copyright (C) 2017 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ +** +** This file is part of the Qt Quick Templates 2 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 "qquicktemplates2valuetypeprovider_p.h" + +#include <QtQml/private/qqmlvaluetype_p.h> +#include <QtQuickTemplates2/private/qquickpalette_p.h> + +QT_BEGIN_NAMESPACE + +#if defined(QT_NO_DEBUG) && !defined(QT_FORCE_ASSERTS) + #define ASSERT_VALID_SIZE(size, min) Q_UNUSED(size) +#else + #define ASSERT_VALID_SIZE(size, min) Q_ASSERT(size >= min) +#endif + +const QMetaObject *QQuickTemplates2ValueTypeProvider::getMetaObjectForMetaType(int type) +{ + switch (type) { + case QMetaType::QPalette: + return &QQuickPalette::staticMetaObject; + default: + break; + } + + return nullptr; +} + +bool QQuickTemplates2ValueTypeProvider::init(int type, QVariant& dst) +{ + switch (type) { + case QMetaType::QPalette: + dst.setValue<QPalette>(QPalette()); + return true; + default: break; + } + + return false; +} + +template<typename T> +bool typedEqual(const void *lhs, const QVariant& rhs) +{ + return (*(reinterpret_cast<const T *>(lhs)) == rhs.value<T>()); +} + +bool QQuickTemplates2ValueTypeProvider::equal(int type, const void *lhs, const QVariant &rhs) +{ + switch (type) { + case QMetaType::QPalette: + return typedEqual<QPalette>(lhs, rhs); + default: break; + } + + return false; +} + +template<typename T> +bool typedStore(const void *src, void *dst, size_t dstSize) +{ + ASSERT_VALID_SIZE(dstSize, sizeof(T)); + const T *srcT = reinterpret_cast<const T *>(src); + T *dstT = reinterpret_cast<T *>(dst); + new (dstT) T(*srcT); + return true; +} + +bool QQuickTemplates2ValueTypeProvider::store(int type, const void *src, void *dst, size_t dstSize) +{ + switch (type) { + case QMetaType::QPalette: + return typedStore<QPalette>(src, dst, dstSize); + default: break; + } + + return false; +} + +template<typename T> +bool typedRead(const QVariant& src, int dstType, void *dst) +{ + T *dstT = reinterpret_cast<T *>(dst); + if (src.type() == static_cast<uint>(dstType)) { + *dstT = src.value<T>(); + } else { + *dstT = T(); + } + return true; +} + +bool QQuickTemplates2ValueTypeProvider::read(const QVariant &src, void *dst, int dstType) +{ + switch (dstType) { + case QMetaType::QPalette: + return typedRead<QPalette>(src, dstType, dst); + default: break; + } + + return false; +} + +template<typename T> +bool typedWrite(const void *src, QVariant& dst) +{ + const T *srcT = reinterpret_cast<const T *>(src); + if (dst.value<T>() != *srcT) { + dst = *srcT; + return true; + } + return false; +} + +bool QQuickTemplates2ValueTypeProvider::write(int type, const void *src, QVariant& dst) +{ + switch (type) { + case QMetaType::QPalette: + return typedWrite<QPalette>(src, dst); + default: break; + } + + return false; +} + +#undef ASSERT_VALID_SIZE + +QT_END_NAMESPACE diff --git a/src/imports/templates/qquicktemplates2valuetypeprovider_p.h b/src/imports/templates/qquicktemplates2valuetypeprovider_p.h new file mode 100644 index 00000000..6b072029 --- /dev/null +++ b/src/imports/templates/qquicktemplates2valuetypeprovider_p.h @@ -0,0 +1,68 @@ +/**************************************************************************** +** +** Copyright (C) 2017 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ +** +** This file is part of the Qt Quick Templates 2 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 QQUICKTEMPLATES2VALUETYPEPROVIDER_P_H +#define QQUICKTEMPLATES2VALUETYPEPROVIDER_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/private/qqmlglobal_p.h> + +QT_BEGIN_NAMESPACE + +class QQuickTemplates2ValueTypeProvider : public QQmlValueTypeProvider +{ +public: + const QMetaObject *getMetaObjectForMetaType(int type) override; + bool init(int type, QVariant& dst) override; + bool equal(int type, const void *lhs, const QVariant &rhs) override; + bool store(int type, const void *src, void *dst, size_t dstSize) override; + bool read(const QVariant &src, void *dst, int dstType) override; + bool write(int type, const void *src, QVariant& dst) override; +}; + +QT_END_NAMESPACE + +#endif // QQUICKTEMPLATES2VALUETYPEPROVIDER_P_H diff --git a/src/imports/templates/qtquicktemplates2plugin.cpp b/src/imports/templates/qtquicktemplates2plugin.cpp index 263d7fde..c3f0cdd4 100644 --- a/src/imports/templates/qtquicktemplates2plugin.cpp +++ b/src/imports/templates/qtquicktemplates2plugin.cpp @@ -35,8 +35,11 @@ ****************************************************************************/ #include <QtQml/qqmlextensionplugin.h> +#include <QtQml/private/qqmlglobal_p.h> #include <QtQuickTemplates2/private/qquickabstractbutton_p.h> +#include <QtQuickTemplates2/private/qquickaction_p.h> +#include <QtQuickTemplates2/private/qquickactiongroup_p.h> #include <QtQuickTemplates2/private/qquickapplicationwindow_p.h> #include <QtQuickTemplates2/private/qquickbusyindicator_p.h> #include <QtQuickTemplates2/private/qquickbutton_p.h> @@ -53,9 +56,12 @@ #include <QtQuickTemplates2/private/qquickdrawer_p.h> #include <QtQuickTemplates2/private/qquickframe_p.h> #include <QtQuickTemplates2/private/qquickgroupbox_p.h> +#include <QtQuickTemplates2/private/qquickicon_p.h> #include <QtQuickTemplates2/private/qquickitemdelegate_p.h> #include <QtQuickTemplates2/private/qquicklabel_p.h> #include <QtQuickTemplates2/private/qquickmenu_p.h> +#include <QtQuickTemplates2/private/qquickmenubar_p.h> +#include <QtQuickTemplates2/private/qquickmenubaritem_p.h> #include <QtQuickTemplates2/private/qquickmenuitem_p.h> #include <QtQuickTemplates2/private/qquickmenuseparator_p.h> #include <QtQuickTemplates2/private/qquickoverlay_p.h> @@ -92,6 +98,8 @@ #include <QtQuickTemplates2/private/qquicktumbler_p.h> #endif +#include "qquicktemplates2valuetypeprovider_p.h" + static inline void initResources() { #ifdef QT_STATIC @@ -108,6 +116,22 @@ extern void qt_quick_set_shortcut_context_matcher(ShortcutContextMatcher matcher QT_BEGIN_NAMESPACE +static QQmlValueTypeProvider *valueTypeProvider() +{ + static QQuickTemplates2ValueTypeProvider provider; + return &provider; +} + +static void initProviders() +{ + QQml_addValueTypeProvider(valueTypeProvider()); +} + +static void cleanupProviders() +{ + QQml_removeValueTypeProvider(valueTypeProvider()); +} + class QtQuickTemplates2Plugin: public QQmlExtensionPlugin { Q_OBJECT @@ -117,7 +141,7 @@ public: QtQuickTemplates2Plugin(QObject *parent = nullptr); ~QtQuickTemplates2Plugin(); - void registerTypes(const char *uri); + void registerTypes(const char *uri) override; private: #if QT_CONFIG(shortcut) @@ -128,6 +152,7 @@ private: QtQuickTemplates2Plugin::QtQuickTemplates2Plugin(QObject *parent) : QQmlExtensionPlugin(parent) { initResources(); + initProviders(); #if QT_CONFIG(shortcut) originalContextMatcher = qt_quick_shortcut_context_matcher(); @@ -137,6 +162,8 @@ QtQuickTemplates2Plugin::QtQuickTemplates2Plugin(QObject *parent) : QQmlExtensio QtQuickTemplates2Plugin::~QtQuickTemplates2Plugin() { + cleanupProviders(); + #if QT_CONFIG(shortcut) qt_quick_set_shortcut_context_matcher(originalContextMatcher); #endif @@ -186,21 +213,21 @@ void QtQuickTemplates2Plugin::registerTypes(const char *uri) qmlRegisterType<QQuickSpinButton>(); qmlRegisterType<QQuickStackView>(uri, 2, 0, "StackView"); qmlRegisterType<QQuickStackViewAttached>(); - qmlRegisterType<QQuickSwipeDelegate>(uri, 2, 0, "SwipeDelegate"); qmlRegisterType<QQuickSwipe>(); - qmlRegisterType<QQuickSwipeViewAttached>(); + qmlRegisterType<QQuickSwipeDelegate>(uri, 2, 0, "SwipeDelegate"); qmlRegisterType<QQuickSwipeView>(uri, 2, 0, "SwipeView"); + qmlRegisterType<QQuickSwipeViewAttached>(); qmlRegisterType<QQuickSwitch>(uri, 2, 0, "Switch"); qmlRegisterType<QQuickSwitchDelegate>(uri, 2, 0, "SwitchDelegate"); qmlRegisterType<QQuickTabBar>(uri, 2, 0, "TabBar"); qmlRegisterType<QQuickTabButton>(uri, 2, 0, "TabButton"); - qmlRegisterType<QQuickTextAreaAttached>(); qmlRegisterType<QQuickTextArea>(uri, 2, 0, "TextArea"); + qmlRegisterType<QQuickTextAreaAttached>(); qmlRegisterType<QQuickTextField>(uri, 2, 0, "TextField"); qmlRegisterType<QQuickToolBar>(uri, 2, 0, "ToolBar"); qmlRegisterType<QQuickToolButton>(uri, 2, 0, "ToolButton"); - qmlRegisterType<QQuickToolTipAttached>(); qmlRegisterType<QQuickToolTip>(uri, 2, 0, "ToolTip"); + qmlRegisterType<QQuickToolTipAttached>(); #if QT_CONFIG(quick_listview) && QT_CONFIG(quick_pathview) qmlRegisterType<QQuickTumblerAttached>(); qmlRegisterType<QQuickTumbler>(uri, 2, 0, "Tumbler"); @@ -209,10 +236,10 @@ void QtQuickTemplates2Plugin::registerTypes(const char *uri) // NOTE: register the latest revisions of all template/control base classes to // make revisioned properties available to their subclasses (synced with Qt 5.7) qmlRegisterRevision<QQuickItem, 7>(uri, 2, 0); - qmlRegisterRevision<QQuickWindow, 2>(uri, 2, 0); qmlRegisterRevision<QQuickText, 6>(uri, 2, 0); qmlRegisterRevision<QQuickTextInput, 7>(uri, 2, 0); qmlRegisterRevision<QQuickTextEdit, 7>(uri, 2, 0); + qmlRegisterRevision<QQuickWindow, 2>(uri, 2, 0); qmlRegisterRevision<QWindow, 3>(uri, 2, 0); // QtQuick.Templates 2.1 (new types and revisions in Qt 5.8) @@ -262,6 +289,35 @@ void QtQuickTemplates2Plugin::registerTypes(const char *uri) qmlRegisterRevision<QQuickText, 9>(uri, 2, 2); qmlRegisterRevision<QQuickTextInput, 9>(uri, 2, 2); qmlRegisterRevision<QQuickWindowQmlImpl, 2>(uri, 2, 2); + + // QtQuick.Templates 2.3 (new types and revisions in Qt 5.10) + qmlRegisterType<QQuickAbstractButton, 3>(uri, 2, 3, "AbstractButton"); + qmlRegisterType<QQuickAction>(uri, 2, 3, "Action"); + qmlRegisterType<QQuickActionGroup>(uri, 2, 3, "ActionGroup"); + qmlRegisterType<QQuickApplicationWindow, 3>(uri, 2, 3, "ApplicationWindow"); + qmlRegisterType<QQuickButtonGroup, 3>(uri, 2, 3, "ButtonGroup"); + qmlRegisterType<QQuickControl, 3>(uri, 2, 3, "Control"); + qmlRegisterType<QQuickContainer, 3>(uri, 2, 3, "Container"); + qmlRegisterType<QQuickDialog, 3>(uri, 2, 3, "Dialog"); + qmlRegisterType<QQuickDialogButtonBox>(uri, 2, 3, "DialogButtonBox"); + qRegisterMetaType<QQuickIcon>(); + qmlRegisterType<QQuickMenu, 3>(uri, 2, 3, "Menu"); + qmlRegisterType<QQuickMenuBar>(uri, 2, 3, "MenuBar"); + qmlRegisterType<QQuickMenuBarItem>(uri, 2, 3, "MenuBarItem"); + qmlRegisterType<QQuickMenuItem, 3>(uri, 2, 3, "MenuItem"); + qmlRegisterUncreatableType<QQuickOverlay>(uri, 2, 3, "Overlay", QStringLiteral("Overlay is only available as an attached property.")); + qmlRegisterType<QQuickOverlayAttached>(); + qmlRegisterType<QQuickPopup, 3>(uri, 2, 3, "Popup"); + qmlRegisterType<QQuickRangeSlider, 3>(uri, 2, 3, "RangeSlider"); + qmlRegisterType<QQuickScrollBar, 3>(uri, 2, 3, "ScrollBar"); + qmlRegisterType<QQuickScrollIndicator, 3>(uri, 2, 3, "ScrollIndicator"); + qmlRegisterType<QQuickSlider, 3>(uri, 2, 3, "Slider"); + qmlRegisterType<QQuickSpinBox, 3>(uri, 2, 3, "SpinBox"); + + // NOTE: register the latest revisions of all template/control base classes to + // make revisioned properties available to their subclasses (synced with Qt 5.10) + qmlRegisterRevision<QQuickText, 10>(uri, 2, 3); + qmlRegisterRevision<QQuickTextEdit, 10>(uri, 2, 3); } QT_END_NAMESPACE diff --git a/src/imports/templates/templates.pro b/src/imports/templates/templates.pro index 28207807..4ff0a76e 100644 --- a/src/imports/templates/templates.pro +++ b/src/imports/templates/templates.pro @@ -1,6 +1,6 @@ TARGET = qtquicktemplates2plugin TARGETPATH = QtQuick/Templates.2 -IMPORT_VERSION = 2.2 +IMPORT_VERSION = 2.3 QT += qml quick QT_PRIVATE += core-private gui-private qml-private quick-private quicktemplates2-private @@ -10,7 +10,11 @@ DEFINES += QT_NO_CAST_TO_ASCII QT_NO_CAST_FROM_ASCII OTHER_FILES += \ qmldir +HEADERS += \ + $$PWD/qquicktemplates2valuetypeprovider_p.h + SOURCES += \ + $$PWD/qquicktemplates2valuetypeprovider.cpp \ $$PWD/qtquicktemplates2plugin.cpp CONFIG += no_cxx_module |