aboutsummaryrefslogtreecommitdiffstats
path: root/share
diff options
context:
space:
mode:
Diffstat (limited to 'share')
-rw-r--r--share/qtcreator/CMakeLists.txt6
-rw-r--r--share/qtcreator/android/sdk_definitions.json18
-rw-r--r--share/qtcreator/debugger/dumper.py31
-rw-r--r--share/qtcreator/debugger/gdbbridge.py10
-rw-r--r--share/qtcreator/debugger/lldbbridge.py8
-rw-r--r--share/qtcreator/debugger/misctypes.py9
-rw-r--r--share/qtcreator/debugger/qttypes.py53
-rw-r--r--share/qtcreator/debugger/stdtypes.py5
-rw-r--r--share/qtcreator/glsl/glsl_330.frag51
-rw-r--r--share/qtcreator/glsl/glsl_330.vert83
-rw-r--r--share/qtcreator/glsl/glsl_330_common.glsl806
-rw-r--r--share/qtcreator/qml/qmlpuppet/commands/captureddatacommand.h13
-rw-r--r--share/qtcreator/qml/qmlpuppet/commands/commands.pri6
-rw-r--r--share/qtcreator/qml/qmlpuppet/commands/createscenecommand.cpp138
-rw-r--r--share/qtcreator/qml/qmlpuppet/commands/createscenecommand.h118
-rw-r--r--share/qtcreator/qml/qmlpuppet/commands/puppettocreatorcommand.h2
-rw-r--r--share/qtcreator/qml/qmlpuppet/commands/requestmodelnodepreviewimagecommand.cpp93
-rw-r--r--share/qtcreator/qml/qmlpuppet/commands/requestmodelnodepreviewimagecommand.h65
-rw-r--r--share/qtcreator/qml/qmlpuppet/commands/valueschangedcommand.cpp6
-rw-r--r--share/qtcreator/qml/qmlpuppet/images/non-visual-component.pngbin0 -> 3311 bytes
-rw-r--r--share/qtcreator/qml/qmlpuppet/images/non-visual-component@2x.pngbin0 -> 7260 bytes
-rw-r--r--share/qtcreator/qml/qmlpuppet/instances/nodeinstanceclientproxy.cpp11
-rw-r--r--share/qtcreator/qml/qmlpuppet/instances/nodeinstanceclientproxy.h2
-rw-r--r--share/qtcreator/qml/qmlpuppet/interfaces/nodeinstanceserverinterface.cpp198
-rw-r--r--share/qtcreator/qml/qmlpuppet/interfaces/nodeinstanceserverinterface.h3
-rw-r--r--share/qtcreator/qml/qmlpuppet/mockfiles/CameraGizmo.qml4
-rw-r--r--share/qtcreator/qml/qmlpuppet/mockfiles/EditCameraController.qml5
-rw-r--r--share/qtcreator/qml/qmlpuppet/mockfiles/EditView3D.qml100
-rw-r--r--share/qtcreator/qml/qmlpuppet/mockfiles/EffectNodeView.qml65
-rw-r--r--share/qtcreator/qml/qmlpuppet/mockfiles/IconGizmo.qml6
-rw-r--r--share/qtcreator/qml/qmlpuppet/mockfiles/IconRenderer3D.qml3
-rw-r--r--share/qtcreator/qml/qmlpuppet/mockfiles/LightGizmo.qml16
-rw-r--r--share/qtcreator/qml/qmlpuppet/mockfiles/LightIconGizmo.qml1
-rw-r--r--share/qtcreator/qml/qmlpuppet/mockfiles/LightModel.qml2
-rw-r--r--share/qtcreator/qml/qmlpuppet/mockfiles/MaterialNodeView.qml59
-rw-r--r--share/qtcreator/qml/qmlpuppet/mockfiles/ModelNode2DImageView.qml45
-rw-r--r--share/qtcreator/qml/qmlpuppet/mockfiles/ModelNode3DImageView.qml141
-rw-r--r--share/qtcreator/qml/qmlpuppet/mockfiles/ModelNodeView.qml96
-rw-r--r--share/qtcreator/qml/qmlpuppet/mockfiles/NodeNodeView.qml96
-rw-r--r--share/qtcreator/qml/qmlpuppet/qml2puppet/editor3d/camerageometry.cpp22
-rw-r--r--share/qtcreator/qml/qmlpuppet/qml2puppet/editor3d/camerageometry.h15
-rw-r--r--share/qtcreator/qml/qmlpuppet/qml2puppet/editor3d/editor3d.pri5
-rw-r--r--share/qtcreator/qml/qmlpuppet/qml2puppet/editor3d/generalhelper.cpp72
-rw-r--r--share/qtcreator/qml/qmlpuppet/qml2puppet/editor3d/generalhelper.h16
-rw-r--r--share/qtcreator/qml/qmlpuppet/qml2puppet/editor3d/gridgeometry.cpp13
-rw-r--r--share/qtcreator/qml/qmlpuppet/qml2puppet/editor3d/gridgeometry.h15
-rw-r--r--share/qtcreator/qml/qmlpuppet/qml2puppet/editor3d/lightgeometry.cpp13
-rw-r--r--share/qtcreator/qml/qmlpuppet/qml2puppet/editor3d/lightgeometry.h15
-rw-r--r--share/qtcreator/qml/qmlpuppet/qml2puppet/editor3d/linegeometry.cpp13
-rw-r--r--share/qtcreator/qml/qmlpuppet/qml2puppet/editor3d/linegeometry.h15
-rw-r--r--share/qtcreator/qml/qmlpuppet/qml2puppet/editor3d/qt5compat/qquick3darealight.cpp59
-rw-r--r--share/qtcreator/qml/qmlpuppet/qml2puppet/editor3d/qt5compat/qquick3darealight_p.h66
-rw-r--r--share/qtcreator/qml/qmlpuppet/qml2puppet/editor3d/selectionboxgeometry.cpp22
-rw-r--r--share/qtcreator/qml/qmlpuppet/qml2puppet/editor3d/selectionboxgeometry.h15
-rw-r--r--share/qtcreator/qml/qmlpuppet/qml2puppet/iconrenderer/iconrenderer.cpp157
-rw-r--r--share/qtcreator/qml/qmlpuppet/qml2puppet/iconrenderer/iconrenderer.h8
-rw-r--r--share/qtcreator/qml/qmlpuppet/qml2puppet/instances/instances.pri5
-rw-r--r--share/qtcreator/qml/qmlpuppet/qml2puppet/instances/nodeinstanceserver.cpp109
-rw-r--r--share/qtcreator/qml/qmlpuppet/qml2puppet/instances/nodeinstanceserver.h8
-rw-r--r--share/qtcreator/qml/qmlpuppet/qml2puppet/instances/nodeinstanceserverdispatcher.cpp9
-rw-r--r--share/qtcreator/qml/qmlpuppet/qml2puppet/instances/nodeinstanceserverdispatcher.h1
-rw-r--r--share/qtcreator/qml/qmlpuppet/qml2puppet/instances/nodeinstancesignalspy.cpp2
-rw-r--r--share/qtcreator/qml/qmlpuppet/qml2puppet/instances/objectnodeinstance.cpp23
-rw-r--r--share/qtcreator/qml/qmlpuppet/qml2puppet/instances/objectnodeinstance.h11
-rw-r--r--share/qtcreator/qml/qmlpuppet/qml2puppet/instances/qt5captureimagenodeinstanceserver.cpp84
-rw-r--r--share/qtcreator/qml/qmlpuppet/qml2puppet/instances/qt5captureimagenodeinstanceserver.h45
-rw-r--r--share/qtcreator/qml/qmlpuppet/qml2puppet/instances/qt5capturepreviewnodeinstanceserver.cpp2
-rw-r--r--share/qtcreator/qml/qmlpuppet/qml2puppet/instances/qt5informationnodeinstanceserver.cpp640
-rw-r--r--share/qtcreator/qml/qmlpuppet/qml2puppet/instances/qt5informationnodeinstanceserver.h33
-rw-r--r--share/qtcreator/qml/qmlpuppet/qml2puppet/instances/qt5nodeinstanceclientproxy.cpp19
-rw-r--r--share/qtcreator/qml/qmlpuppet/qml2puppet/instances/qt5nodeinstanceserver.cpp20
-rw-r--r--share/qtcreator/qml/qmlpuppet/qml2puppet/instances/qt5previewnodeinstanceserver.cpp2
-rw-r--r--share/qtcreator/qml/qmlpuppet/qml2puppet/instances/qt5rendernodeinstanceserver.cpp20
-rw-r--r--share/qtcreator/qml/qmlpuppet/qml2puppet/instances/quick3dnodeinstance.cpp77
-rw-r--r--share/qtcreator/qml/qmlpuppet/qml2puppet/instances/quick3dnodeinstance.h3
-rw-r--r--share/qtcreator/qml/qmlpuppet/qml2puppet/instances/quickitemnodeinstance.cpp102
-rw-r--r--share/qtcreator/qml/qmlpuppet/qml2puppet/instances/quickitemnodeinstance.h8
-rw-r--r--share/qtcreator/qml/qmlpuppet/qml2puppet/instances/servernodeinstance.cpp19
-rw-r--r--share/qtcreator/qml/qmlpuppet/qml2puppet/instances/servernodeinstance.h6
-rw-r--r--share/qtcreator/qml/qmlpuppet/qml2puppet/qml2puppet.pri2
-rw-r--r--share/qtcreator/qml/qmlpuppet/qml2puppet/qml2puppetmain.cpp65
-rw-r--r--share/qtcreator/qml/qmlpuppet/qmlprivategate/qmlprivategate_56.cpp13
-rw-r--r--share/qtcreator/qml/qmlpuppet/qmlpuppet.qrc8
-rw-r--r--share/qtcreator/qmldesigner/itemLibraryQmlSources/ItemDelegate.qml7
-rw-r--r--share/qtcreator/qmldesigner/propertyEditorQmlSources/PropertyTemplates/ColorEditorTemplate.template13
-rw-r--r--share/qtcreator/qmldesigner/propertyEditorQmlSources/PropertyTemplates/FontEditorTemplate.template5
-rw-r--r--share/qtcreator/qmldesigner/propertyEditorQmlSources/PropertyTemplates/ImageEditorTemplate.template215
-rw-r--r--share/qtcreator/qmldesigner/propertyEditorQmlSources/PropertyTemplates/RectangleEditorTemplate.template17
-rw-r--r--share/qtcreator/qmldesigner/propertyEditorQmlSources/PropertyTemplates/TemplateTypes.qml9
-rw-r--r--share/qtcreator/qmldesigner/propertyEditorQmlSources/PropertyTemplates/TextEditorTemplate.template4
-rw-r--r--share/qtcreator/qmldesigner/propertyEditorQmlSources/QtQuick/AdvancedSection.qml6
-rw-r--r--share/qtcreator/qmldesigner/propertyEditorQmlSources/QtQuick/AnimatedImageSpecifics.qml4
-rw-r--r--share/qtcreator/qmldesigner/propertyEditorQmlSources/QtQuick/AnimationSection.qml16
-rw-r--r--share/qtcreator/qmldesigner/propertyEditorQmlSources/QtQuick/AnimationTargetSection.qml6
-rw-r--r--share/qtcreator/qmldesigner/propertyEditorQmlSources/QtQuick/BorderImageSpecifics.qml12
-rw-r--r--share/qtcreator/qmldesigner/propertyEditorQmlSources/QtQuick/FlowSpecifics.qml2
-rw-r--r--share/qtcreator/qmldesigner/propertyEditorQmlSources/QtQuick/GridSpecifics.qml2
-rw-r--r--share/qtcreator/qmldesigner/propertyEditorQmlSources/QtQuick/GridViewSpecifics.qml8
-rw-r--r--share/qtcreator/qmldesigner/propertyEditorQmlSources/QtQuick/ImageSpecifics.qml12
-rw-r--r--share/qtcreator/qmldesigner/propertyEditorQmlSources/QtQuick/ItemPane.qml6
-rw-r--r--share/qtcreator/qmldesigner/propertyEditorQmlSources/QtQuick/LayerSection.qml18
-rw-r--r--share/qtcreator/qmldesigner/propertyEditorQmlSources/QtQuick/LayoutPoperties.qml6
-rw-r--r--share/qtcreator/qmldesigner/propertyEditorQmlSources/QtQuick/ListViewSpecifics.qml6
-rw-r--r--share/qtcreator/qmldesigner/propertyEditorQmlSources/QtQuick/MouseAreaSpecifics.qml28
-rw-r--r--share/qtcreator/qmldesigner/propertyEditorQmlSources/QtQuick/NumberAnimationSpecifics.qml4
-rw-r--r--share/qtcreator/qmldesigner/propertyEditorQmlSources/QtQuick/PathViewSpecifics.qml4
-rw-r--r--share/qtcreator/qmldesigner/propertyEditorQmlSources/QtQuick/PropertyActionSpecifics.qml2
-rw-r--r--share/qtcreator/qmldesigner/propertyEditorQmlSources/QtQuick/QtObjectPane.qml4
-rw-r--r--share/qtcreator/qmldesigner/propertyEditorQmlSources/QtQuick/RectangleSpecifics.qml2
-rw-r--r--share/qtcreator/qmldesigner/propertyEditorQmlSources/QtQuick/RowSpecifics.qml2
-rw-r--r--share/qtcreator/qmldesigner/propertyEditorQmlSources/QtQuick/TextInputSection.qml6
-rw-r--r--share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/HelperWidgets/ColorButton.qml1
-rw-r--r--share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/HelperWidgets/ComponentButton.qml52
-rw-r--r--share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/HelperWidgets/DoubleSpinBox.qml3
-rw-r--r--share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/HelperWidgets/FlickableSection.qml12
-rw-r--r--share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/HelperWidgets/FontComboBox.qml23
-rw-r--r--share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/HelperWidgets/FontSection.qml14
-rw-r--r--share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/HelperWidgets/ImagePreviewTooltipArea.qml48
-rw-r--r--share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/HelperWidgets/Section.qml59
-rw-r--r--share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/HelperWidgets/SpinBox.qml7
-rw-r--r--share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/HelperWidgets/StandardTextSection.qml8
-rw-r--r--share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/HelperWidgets/UrlChooser.qml90
-rw-r--r--share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/HelperWidgets/qmldir2
-rw-r--r--share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/StudioControls/ActionIndicator.qml3
-rw-r--r--share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/StudioControls/RealSpinBox.qml3
-rw-r--r--share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/StudioControls/RealSpinBoxInput.qml179
-rw-r--r--share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/StudioTheme/InternalConstants.qml61
-rw-r--r--share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/StudioTheme/Values.qml2
-rw-r--r--share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/StudioTheme/icons.ttfbin14124 -> 15660 bytes
-rw-r--r--share/qtcreator/qmldesigner/qt4mcu/metadata.qml37
-rw-r--r--share/qtcreator/qmldesigner/qt4mcu/qul-14.qml156
-rw-r--r--share/qtcreator/snippets/cpp.xml14
-rw-r--r--share/qtcreator/static.pro2
-rw-r--r--share/qtcreator/styles/creator-dark.xml2
-rw-r--r--share/qtcreator/styles/dark.xml2
-rw-r--r--share/qtcreator/styles/default_classic.xml2
-rw-r--r--share/qtcreator/styles/inkpot.xml2
-rw-r--r--share/qtcreator/styles/modnokai_night_shift_v2.xml2
-rw-r--r--share/qtcreator/styles/solarized-dark.xml2
-rw-r--r--share/qtcreator/styles/solarized-light.xml2
-rw-r--r--share/qtcreator/templates/wizards/autotest/files/tst.txt22
-rw-r--r--share/qtcreator/templates/wizards/classes/cpp/wizard.json8
-rw-r--r--share/qtcreator/templates/wizards/projects/consoleapp/CMakeLists.txt3
-rw-r--r--share/qtcreator/templates/wizards/projects/qtquickapplication/CMakeLists.txt34
-rw-r--r--share/qtcreator/templates/wizards/projects/qtwidgetsapplication/CMakeLists.txt48
-rw-r--r--share/qtcreator/templates/wizards/projects/qtwidgetsapplication/widget.cpp12
-rw-r--r--share/qtcreator/templates/wizards/projects/qtwidgetsapplication/widget.h19
-rw-r--r--share/qtcreator/templates/wizards/qtcreatorplugin/CMakeLists.txt32
-rw-r--r--share/qtcreator/templates/wizards/qtcreatorplugin/README.md35
-rw-r--r--share/qtcreator/templates/wizards/qtcreatorplugin/github_workflows_README.md2
-rw-r--r--share/qtcreator/templates/wizards/qtcreatorplugin/github_workflows_build_cmake.yml (renamed from share/qtcreator/templates/wizards/qtcreatorplugin/github_workflows_build_qmake.yml)242
-rw-r--r--share/qtcreator/templates/wizards/qtcreatorplugin/myplugin.pro53
-rw-r--r--share/qtcreator/templates/wizards/qtcreatorplugin/wizard.json51
-rw-r--r--share/qtcreator/translations/README48
-rw-r--r--share/qtcreator/translations/README.md48
-rw-r--r--share/qtcreator/translations/qtcreator_ru.ts14
-rw-r--r--share/share.qbs1
157 files changed, 4815 insertions, 1324 deletions
diff --git a/share/qtcreator/CMakeLists.txt b/share/qtcreator/CMakeLists.txt
index 622761f4d8..667ef9259c 100644
--- a/share/qtcreator/CMakeLists.txt
+++ b/share/qtcreator/CMakeLists.txt
@@ -28,6 +28,10 @@ qtc_copy_to_builddir(copy_share_to_builddir
)
# create install rule for resource directories
-install(DIRECTORY ${resource_directories} DESTINATION "${IDE_DATA_PATH}")
+install(
+ DIRECTORY ${resource_directories}
+ DESTINATION "${IDE_DATA_PATH}"
+ USE_SOURCE_PERMISSIONS
+)
add_subdirectory(translations)
diff --git a/share/qtcreator/android/sdk_definitions.json b/share/qtcreator/android/sdk_definitions.json
index e4bd1ac571..056b425f6c 100644
--- a/share/qtcreator/android/sdk_definitions.json
+++ b/share/qtcreator/android/sdk_definitions.json
@@ -1,15 +1,15 @@
{
"common": {
"sdk_tools_url": {
- "linux": "https://dl.google.com/android/repository/commandlinetools-linux-6609375_latest.zip",
- "linux_sha256": "89f308315e041c93a37a79e0627c47f21d5c5edbe5e80ea8dc0aac8a649e0e92",
- "windows": "https://dl.google.com/android/repository/commandlinetools-win-6609375_latest.zip",
- "windows_sha256": "40bba20275180194bebf89bb58c74d712bb93cc401f36bd2f8f32383acf9826c",
- "mac": "https://dl.google.com/android/repository/commandlinetools-mac-6609375_latest.zip",
- "mac_sha256": "2c3822db1c916655223e5ee8ce0fbf6b73d0b99012045c9dc8eaa6a5736c0c55"
+ "linux": "https://dl.google.com/android/repository/commandlinetools-linux-6858069_latest.zip",
+ "linux_sha256": "87f6dcf41d4e642e37ba03cb2e387a542aa0bd73cb689a9e7152aad40a6e7a08",
+ "windows": "https://dl.google.com/android/repository/commandlinetools-win-6858069_latest.zip",
+ "windows_sha256": "d2f6c9bb7db0362995c0b8dd2fd5949ce23c1dccb7f9392350b5e29b6d5fec7d",
+ "mac": "https://dl.google.com/android/repository/commandlinetools-mac-6858069_latest.zip",
+ "mac_sha256": "58a55d9c5bcacd7c42170d2cf2c9ae2889c6797a6128307aaf69100636f54a13"
},
"sdk_essential_packages": {
- "default": ["platform-tools", "platforms;android-29", "cmdline-tools;latest"],
+ "default": ["platform-tools", "platforms;android-30", "cmdline-tools;latest"],
"linux": [],
"mac": [],
"windows": ["extras;google;usb_driver"]
@@ -18,8 +18,8 @@
"specific_qt_versions": [
{
"versions": ["default"],
- "sdk_essential_packages": ["build-tools;29.0.2", "ndk;21.1.6352462"],
- "ndk_path": "ndk/21.1.6352462"
+ "sdk_essential_packages": ["build-tools;30.0.2", "ndk;21.3.6528147"],
+ "ndk_path": "ndk/21.3.6528147"
},
{
"versions": ["5.12.[0-5]", "5.13.[0-1]"],
diff --git a/share/qtcreator/debugger/dumper.py b/share/qtcreator/debugger/dumper.py
index 42dd8e9ba8..9b31a54289 100644
--- a/share/qtcreator/debugger/dumper.py
+++ b/share/qtcreator/debugger/dumper.py
@@ -26,6 +26,7 @@
import os
import codecs
import collections
+import glob
import struct
import sys
import base64
@@ -207,13 +208,8 @@ class DumperBase():
self.childrenSuffix = '],'
self.dumpermodules = [
- 'qttypes',
- 'stdtypes',
- 'misctypes',
- 'boosttypes',
- 'opencvtypes',
- 'creatortypes',
- 'personaltypes',
+ os.path.splitext(os.path.basename(p))[0] for p in
+ glob.glob(os.path.join(os.path.dirname(__file__), '*types.py'))
]
# These values are never used, but the variables need to have
@@ -1187,6 +1183,10 @@ class DumperBase():
nsStrippedType = self.stripNamespaceFromType(typeName)\
.replace('::', '__')
+ # Strip leading 'struct' for C structs
+ if nsStrippedType.startswith('struct '):
+ nsStrippedType = nsStrippedType[7:]
+
#DumperBase.warn('STRIPPED: %s' % nsStrippedType)
# The following block is only needed for D.
if nsStrippedType.startswith('_A'):
@@ -1228,7 +1228,11 @@ class DumperBase():
# This is shared by pointer and array formatting.
def tryPutSimpleFormattedPointer(self, ptr, typeName, innerType, displayFormat, limit):
if displayFormat == DisplayFormat.Automatic:
- if innerType.name in ('char', 'signed char', 'unsigned char', 'CHAR'):
+ targetType = innerType
+ if innerType.code == TypeCode.Typedef:
+ targetType = innerType.ltarget
+
+ if targetType.name in ('char', 'signed char', 'unsigned char', 'CHAR'):
# Use UTF-8 as default for char *.
self.putType(typeName)
(elided, shown, data) = self.readToFirstZero(ptr, 1, limit)
@@ -1237,7 +1241,7 @@ class DumperBase():
self.putArrayData(ptr, shown, innerType)
return True
- if innerType.name in ('wchar_t', 'WCHAR'):
+ if targetType.name in ('wchar_t', 'WCHAR'):
self.putType(typeName)
charSize = self.lookupType('wchar_t').size()
(elided, data) = self.encodeCArray(ptr, charSize, limit)
@@ -1336,10 +1340,7 @@ class DumperBase():
return
displayFormat = self.currentItemFormat(value.type.name)
-
innerType = value.type.target() # .unqualified()
- if innerType.code == TypeCode.Typedef:
- innerType = innerType.ltarget
if innerType.name == 'void':
#DumperBase.warn('VOID POINTER: %s' % displayFormat)
@@ -2851,6 +2852,7 @@ class DumperBase():
self.type = None
self.ldata = None # Target address in case of references and pointers.
self.laddress = None # Own address.
+ self.lvalue = None
self.lIsInScope = True
self.ldisplay = None
self.summary = None # Always hexencoded UTF-8.
@@ -2924,7 +2926,7 @@ class DumperBase():
def integer(self, bitsize=None):
if self.type.code == TypeCode.Typedef:
return self.detypedef().integer()
- elif self.type.code == TypeCode.Bitfield:
+ elif isinstance(self.lvalue, int):
return self.lvalue
# Could be something like 'short unsigned int'
unsigned = self.type.name == 'unsigned' \
@@ -3539,7 +3541,8 @@ class DumperBase():
'long long': 'int:8',
'unsigned long long': 'uint:8',
'float': 'float:4',
- 'double': 'float:8'
+ 'double': 'float:8',
+ 'QChar': 'uint:2'
}.get(self.name, None)
return res
diff --git a/share/qtcreator/debugger/gdbbridge.py b/share/qtcreator/debugger/gdbbridge.py
index 824f4c50f7..f5ee86c349 100644
--- a/share/qtcreator/debugger/gdbbridge.py
+++ b/share/qtcreator/debugger/gdbbridge.py
@@ -307,6 +307,13 @@ class Dumper(DumperBase):
val.ldisplay += ' (%s)' % intval
elif code == gdb.TYPE_CODE_COMPLEX:
val.ldisplay = str(nativeValue)
+ elif code in [gdb.TYPE_CODE_BOOL, gdb.TYPE_CODE_INT]:
+ try:
+ # extract int presentation from native value and remember it
+ val.lvalue = int(nativeValue)
+ except:
+ # GDB only support converting integers of max. 64 bits to Python int as of now
+ pass
#elif code == gdb.TYPE_CODE_ARRAY:
# val.type.ltarget = nativeValue[0].type.unqualified()
return val
@@ -1110,7 +1117,8 @@ class Dumper(DumperBase):
self.qtCustomEventPltFunc = self.findSymbol(sym)
sym = '_ZNK%s7QObject8propertyEPKc' % strns
- self.qtPropertyFunc = self.findSymbol(sym)
+ if not self.isWindowsTarget(): # prevent calling the property function on windows
+ self.qtPropertyFunc = self.findSymbol(sym)
def assignValue(self, args):
typeName = self.hexdecode(args['type'])
diff --git a/share/qtcreator/debugger/lldbbridge.py b/share/qtcreator/debugger/lldbbridge.py
index 13ad3d3e9e..1a114704f5 100644
--- a/share/qtcreator/debugger/lldbbridge.py
+++ b/share/qtcreator/debugger/lldbbridge.py
@@ -546,9 +546,9 @@ class Dumper(DumperBase):
return targs
def typeName(self, nativeType):
- if hasattr(nativeType, 'GetDisplayTypeName'):
- return nativeType.GetDisplayTypeName() # Xcode 6 (lldb-320)
- return nativeType.GetName() # Xcode 5 (lldb-310)
+ # Don't use GetDisplayTypeName since LLDB removed the inline namespace __1
+ # https://reviews.llvm.org/D74478
+ return nativeType.GetName()
def nativeTypeId(self, nativeType):
name = self.typeName(nativeType)
@@ -804,7 +804,7 @@ class Dumper(DumperBase):
typeobjlist = self.target.FindTypes(nonPrefixedName)
if typeobjlist.IsValid():
for typeobj in typeobjlist:
- n = self.canonicalTypeName(self.removeTypePrefix(typeobj.GetDisplayTypeName()))
+ n = self.canonicalTypeName(self.removeTypePrefix(typeobj.GetName()))
if n == nonPrefixedName:
#DumperBase.warn('FOUND TYPE USING FindTypes : %s' % typeobj)
self.typeCache[name] = typeobj
diff --git a/share/qtcreator/debugger/misctypes.py b/share/qtcreator/debugger/misctypes.py
index 8592653551..cb16267737 100644
--- a/share/qtcreator/debugger/misctypes.py
+++ b/share/qtcreator/debugger/misctypes.py
@@ -36,36 +36,42 @@ import re
def qdump____m128(d, value):
d.putEmptyValue()
+ d.putExpandable()
if d.isExpanded():
d.putArrayData(value.address(), 4, d.lookupType('float'))
def qdump____m256(d, value):
d.putEmptyValue()
+ d.putExpandable()
if d.isExpanded():
d.putArrayData(value.address(), 8, d.lookupType('float'))
def qdump____m512(d, value):
d.putEmptyValue()
+ d.putExpandable()
if d.isExpanded():
d.putArrayData(value.address(), 16, d.lookupType('float'))
def qdump____m128d(d, value):
d.putEmptyValue()
+ d.putExpandable()
if d.isExpanded():
d.putArrayData(value.address(), 2, d.lookupType('double'))
def qdump____m256d(d, value):
d.putEmptyValue()
+ d.putExpandable()
if d.isExpanded():
d.putArrayData(value.address(), 4, d.lookupType('double'))
def qdump____m512d(d, value):
d.putEmptyValue()
+ d.putExpandable()
if d.isExpanded():
d.putArrayData(value.address(), 8, d.lookupType('double'))
@@ -73,6 +79,7 @@ def qdump____m512d(d, value):
def qdump____m128i(d, value):
data = d.hexencode(value.data(16))
d.putValue(':'.join('%04x' % int(data[i:i + 4], 16) for i in range(0, 32, 4)))
+ d.putExpandable()
if d.isExpanded():
with Children(d):
addr = value.address()
@@ -85,6 +92,7 @@ def qdump____m128i(d, value):
def qdump____m256i(d, value):
data = d.hexencode(value.data(32))
d.putValue(':'.join('%04x' % int(data[i:i + 4], 16) for i in range(0, 64, 4)))
+ d.putExpandable()
if d.isExpanded():
with Children(d):
addr = value.address()
@@ -98,6 +106,7 @@ def qdump____m512i(d, value):
data = d.hexencode(value.data(64))
d.putValue(':'.join('%04x' % int(data[i:i + 4], 16) for i in range(0, 64, 4))
+ ', ' + ':'.join('%04x' % int(data[i:i + 4], 16) for i in range(64, 128, 4)))
+ d.putExpandable()
if d.isExpanded():
with Children(d):
d.putArrayItem('uint32x16', value.address(), 16, 'unsigned int')
diff --git a/share/qtcreator/debugger/qttypes.py b/share/qtcreator/debugger/qttypes.py
index f68b1fa2e2..5fd48d816c 100644
--- a/share/qtcreator/debugger/qttypes.py
+++ b/share/qtcreator/debugger/qttypes.py
@@ -57,7 +57,10 @@ def qedit__QByteArray(d, value, data):
def qdump__QByteArray(d, value):
if d.qtVersion() >= 0x60000:
dd, data, size = value.split('ppi')
- _, _, alloc = d.split('iii', dd)
+ if dd:
+ _, _, alloc = d.split('iii', dd)
+ else: # fromRawData
+ alloc = size
else:
data, size, alloc = d.byteArrayData(value)
@@ -98,8 +101,11 @@ def qdump__QByteArrayData(d, value):
def qdump__QBitArray(d, value):
- data, basize, alloc = d.byteArrayDataHelper(d.extractPointer(value['d']))
- unused = d.extractByte(data)
+ if d.qtVersion() >= 0x60000:
+ _, data, basize = value.split('ppi')
+ else:
+ data, basize, _ = d.byteArrayDataHelper(d.extractPointer(value['d']))
+ unused = d.extractByte(data) if data else 0
size = basize * 8 - unused
d.putItemCount(size)
if d.isExpanded():
@@ -987,19 +993,17 @@ def qdump__QVariantList(d, value):
def qdumpHelper_QList(d, value, innerType):
if d.qtVersion() >= 0x60000:
dd, data, size = value.split('ppi')
- _, _, alloc = d.split('iii', dd)
d.putItemCount(size)
d.putPlotData(data, size, innerType)
return
base = d.extractPointer(value)
- (ref, alloc, begin, end) = d.split('IIII', base)
+ _, _, begin, end = d.split('IIII', base)
array = base + 16
if d.qtVersion() < 0x50000:
array += d.ptrSize()
d.check(begin >= 0 and end >= 0 and end <= 1000 * 1000 * 1000)
size = end - begin
d.check(size >= 0)
- #d.checkRef(private['ref'])
d.putItemCount(size)
if d.isExpanded():
@@ -1556,8 +1560,11 @@ def qform__QString():
def qdump__QString(d, value):
if d.qtVersion() >= 0x60000:
dd, data, size = value.split('ppi')
- _, _, alloc = d.split('iii', dd)
- elided, shown = d.computeLimit(2 * size, d.displayStringLimit)
+ if dd:
+ _, _, alloc = d.split('iii', dd)
+ else: # fromRawData
+ alloc = size
+ elided, shown = d.computeLimit(2 * size, 2 * d.displayStringLimit)
p = d.readMemory(data, shown)
d.putValue(p, 'utf16', elided=elided)
else:
@@ -1975,18 +1982,9 @@ def qdump__QVariant(d, value):
if d.isExpanded():
innerType = None
with Children(d):
- ev = d.parseAndEvaluate
- p = None
- if p is None:
- # Without debug info.
- symbol = d.mangleName(d.qtNamespace() + 'QMetaType::typeName') + 'i'
- p = ev('((const char *(*)(int))%s)(%d)' % (symbol, variantType))
- #if p is None:
- # p = ev('((const char *(*)(int))%sQMetaType::typeName)(%d)' % (ns, variantType))
- if p is None:
- # LLDB on Linux
- p = ev('((const char *(*)(int))QMetaType::typeName)(%d)' % variantType)
- if p is None:
+ try:
+ p = d.call('const char *', value, 'typeName')
+ except:
d.putSpecialValue('notcallable')
return None
ptr = p.pointer()
@@ -2026,13 +2024,18 @@ def qform__QVector():
def qdump__QVector(d, value):
if d.qtVersion() >= 0x060000:
dd, data, size = value.split('ppi')
- _, _, alloc = d.split('iii', dd)
+ d.putItemCount(size)
+ d.putPlotData(data, size, value.type.ltarget[0])
+ # g++ 9.3 does not add the template parameter list to the debug info.
+ # Fake it for the common case:
+ if value.type.name == d.qtNamespace() + "QVector":
+ d.putBetterType(value.type.name + '<' + value.type.ltarget[0].name + '>')
else:
dd = d.extractPointer(value)
data, size, alloc = d.vectorDataHelper(dd)
- d.check(0 <= size and size <= alloc and alloc <= 1000 * 1000 * 1000)
- d.putItemCount(size)
- d.putPlotData(data, size, value.type[0])
+ d.check(0 <= size and size <= alloc and alloc <= 1000 * 1000 * 1000)
+ d.putItemCount(size)
+ d.putPlotData(data, size, value.type[0])
if False:
@@ -2496,7 +2499,7 @@ def qdump_64__QV4__Value(d, value):
d.putValue('%d' % vv)
elif (v >> QV4_IsDouble_Shift):
d.putBetterType('%sQV4::Value (double)' % ns)
- d.putValue('%x' % (v ^ QV4_NaNEncodeMask), 'float:8')
+ d.putValue('%0.16x' % (v ^ QV4_NaNEncodeMask), 'float:8')
elif tag == QV4_ValueType_Undefined_Type and not new:
d.putBetterType('%sQV4::Value (undefined)' % ns)
d.putValue('(undefined)')
diff --git a/share/qtcreator/debugger/stdtypes.py b/share/qtcreator/debugger/stdtypes.py
index 6c69c4cefd..4de5baf4f9 100644
--- a/share/qtcreator/debugger/stdtypes.py
+++ b/share/qtcreator/debugger/stdtypes.py
@@ -707,8 +707,7 @@ def qdumpHelper_std__string(d, value, charType, format):
# We can't lookup the std::string::_Rep type without crashing LLDB,
# so hard-code assumption on member position
# struct { size_type _M_length, size_type _M_capacity, int _M_refcount; }
- (size, alloc, refcount) = d.split("ppp", data - 3 * d.ptrSize())
- refcount = refcount & 0xffffffff
+ (size, alloc, refcount) = d.split("ppi", data - 3 * d.ptrSize())
d.check(refcount >= -1) # Can be -1 according to docs.
d.check(0 <= size and size <= alloc and alloc <= 100 * 1000 * 1000)
d.putCharArrayHelper(data, size, charType, format)
@@ -1061,7 +1060,7 @@ def qdumpHelper__std__vector(d, value, isLibCpp):
if isBool:
if isLibCpp:
start = value["__begin_"].pointer()
- size = value["__size_"]
+ size = value["__size_"].integer()
alloc = size
else:
start = value["_M_start"]["_M_p"].pointer()
diff --git a/share/qtcreator/glsl/glsl_330.frag b/share/qtcreator/glsl/glsl_330.frag
new file mode 100644
index 0000000000..1c2c672d5d
--- /dev/null
+++ b/share/qtcreator/glsl/glsl_330.frag
@@ -0,0 +1,51 @@
+/****************************************************************************
+**
+** Copyright (C) 2020 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of Qt Creator.
+**
+** 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 General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3 as published by the Free Software
+** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
+** 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-3.0.html.
+**
+****************************************************************************/
+
+// Fragment shader special variables.
+vec4 gl_FragCoord;
+bool gl_FrontFacing;
+float gl_ClipDistance[];
+vec4 gl_FragColor;
+vec4 gl_FragData[gl_MaxDrawBuffers];
+float gl_FragDepth;
+
+// Varying variables.
+varying vec4 gl_Color;
+varying vec2 gl_PointCoord;
+varying int gl_PrimitiveID;
+
+// Fragment processing functions.
+float dFdx(float p);
+vec2 dFdx(vec2 p);
+vec3 dFdx(vec3 p);
+vec4 dFdx(vec4 p);
+float dFdy(float p);
+vec2 dFdy(vec2 p);
+vec3 dFdy(vec3 p);
+vec4 dFdy(vec4 p);
+float fwidth(float p);
+vec2 fwidth(vec2 p);
+vec3 fwidth(vec3 p);
+vec4 fwidth(vec4 p);
diff --git a/share/qtcreator/glsl/glsl_330.vert b/share/qtcreator/glsl/glsl_330.vert
new file mode 100644
index 0000000000..d7b8e7d3b2
--- /dev/null
+++ b/share/qtcreator/glsl/glsl_330.vert
@@ -0,0 +1,83 @@
+/****************************************************************************
+**
+** Copyright (C) 2020 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of Qt Creator.
+**
+** 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 General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3 as published by the Free Software
+** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
+** 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-3.0.html.
+**
+****************************************************************************/
+
+// Vertex shader special variables.
+vec4 gl_Position;
+float gl_PointSize;
+vec4 gl_ClipVertex;
+
+int gl_VertexID;
+int gl_InstanceID;
+
+struct gl_PerVertex {
+ vec4 gl_Position;
+ float gl_PointSize;
+ float gl_ClipDistance[];
+};
+
+struct gl_PerVertex {
+ vec4 gl_Position;
+ float gl_PointSize;
+ float gl_ClipDistance[];
+} gl_in[];
+
+int gl_PrimitiveIDIn;
+struct gl_PerVertex {
+ vec4 gl_Position;
+ float gl_PointSize;
+ float gl_ClipDistance[];
+};
+
+int gl_PrimitiveID;
+int gl_Layer;
+
+// Compatibility profile.
+struct gl_PerVertex {
+ vec4 gl_Position;
+ float gl_PointSize;
+ float gl_ClipDistance[];
+ vec4 gl_ClipVertex;
+};
+
+struct gl_PerVertex {
+ vec4 gl_Position;
+ float gl_PointSize;
+ float gl_ClipDistance[];
+ vec4 gl_ClipVertex;
+} gl_in[];
+
+vec4 gl_Color;
+vec4 gl_SecondaryColor;
+vec3 gl_Normal;
+vec4 gl_Vertex;
+vec4 gl_MultiTexCoord0;
+vec4 gl_MultiTexCoord1;
+vec4 gl_MultiTexCoord2;
+vec4 gl_MultiTexCoord3;
+vec4 gl_MultiTexCoord4;
+vec4 gl_MultiTexCoord5;
+vec4 gl_MultiTexCoord6;
+vec4 gl_MultiTexCoord7;
+float gl_FogCoord;
diff --git a/share/qtcreator/glsl/glsl_330_common.glsl b/share/qtcreator/glsl/glsl_330_common.glsl
new file mode 100644
index 0000000000..3077c8b645
--- /dev/null
+++ b/share/qtcreator/glsl/glsl_330_common.glsl
@@ -0,0 +1,806 @@
+/****************************************************************************
+**
+** Copyright (C) 2020 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of Qt Creator.
+**
+** 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 General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3 as published by the Free Software
+** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
+** 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-3.0.html.
+**
+****************************************************************************/
+
+// Built-in constants.
+const int gl_MaxVertexAttribs = 16;
+const int gl_MaxVertexUniformComponents = 1024;
+const int gl_MaxVaryingFloats = 60; // Deprecated
+const int gl_MaxVaryingComponents = 60; // Deprecated
+const int gl_MaxVertexOutputComponents = 64;
+const int gl_MaxGeometryInputComponents = 64;
+const int gl_MaxGeometryOutputComponents = 128;
+const int gl_MaxFragmentInputComponents = 128;
+const int gl_MaxVertexTextureImageUnits = 16;
+const int gl_MaxCombinedTextureImageUnits = 48;
+const int gl_MaxTextureImageUnits = 16;
+const int gl_MaxFragmentUniformComponents = 1024;
+const int gl_MaxDrawBuffers = 8;
+const int gl_MaxClipDistances = 8;
+const int gl_MaxGeometryTextureImageUnits = 16;
+const int gl_MaxGeometryOutputVertices = 256;
+const int gl_MaxGeometryTotalOutputComponents = 1024;
+const int gl_MaxGeometryUniformComponents = 1024;
+const int gl_MaxGeometryVaryingComponents = 64;
+
+// Compatibility profile built-in constants.
+const int gl_MaxTextureUnits = 2;
+const int gl_MaxTextureCoords = 8;
+const int gl_MaxClipPlanes = 8;
+
+// Built-in uniform state.
+struct gl_DepthRangeParameters {
+ highp float near;
+ highp float far;
+ highp float diff;
+};
+uniform gl_DepthRangeParameters gl_DepthRange;
+uniform lowp int gl_NumSamples;
+
+// Compatibility profile built-in uniform state.
+uniform mat4 gl_ModelViewMatrix;
+uniform mat4 gl_ProjectionMatrix;
+uniform mat4 gl_ModelViewProjectionMatrix;
+uniform mat4 gl_TextureMatrix[gl_MaxTextureCoords];
+uniform mat3 gl_NormalMatrix;
+uniform mat4 gl_ModelViewMatrixInverse;
+uniform mat4 gl_ProjectionMatrixInverse;
+uniform mat4 gl_ModelViewProjectionMatrixInverse;
+uniform mat4 gl_TextureMatrixInverse[gl_MaxTextureCoords];
+uniform mat4 gl_ModelViewMatrixTranspose;
+uniform mat4 gl_ProjectionMatrixTranspose;
+uniform mat4 gl_ModelViewProjectionMatrixTranspose;
+uniform mat4 gl_TextureMatrixTranspose[gl_MaxTextureCoords];
+uniform mat4 gl_ModelViewMatrixInverseTranspose;
+uniform mat4 gl_ProjectionMatrixInverseTranspose;
+uniform mat4 gl_ModelViewProjectionMatrixInverseTranspose;
+uniform mat4 gl_TextureMatrixInverseTranspose[gl_MaxTextureCoords];
+uniform float gl_NormalScale;
+uniform vec4 gl_ClipPlane[gl_MaxClipPlanes];
+
+struct gl_PointParameters {
+ float size;
+ float sizeMin;
+ float sizeMax;
+ float fadeThresholdSize;
+ float distanceConstantAttenuation;
+ float distanceLinearAttenuation;
+ float distanceQuadraticAttenuation;
+};
+uniform gl_PointParameters gl_Point;
+
+struct gl_MaterialParameters {
+ vec4 emission;
+ vec4 ambient;
+ vec4 diffuse;
+ vec4 specular;
+ float shininess;
+};
+uniform gl_MaterialParameters gl_FrontMaterial;
+uniform gl_MaterialParameters gl_BackMaterial;
+
+struct gl_LightSourceParameters {
+ vec4 ambient;
+ vec4 diffuse;
+ vec4 specular;
+ vec4 position;
+ vec4 halfVector;
+ vec3 spotDirection;
+ float spotExponent;
+ float spotCutoff;
+ float spotCosCutoff;
+ float constantAttenuation;
+ float linearAttenuation;
+ float quadraticAttenuation;
+};
+uniform gl_LightSourceParameters gl_LightSource[gl_MaxLights];
+
+struct gl_LightModelParameters {
+ vec4 ambient;
+};
+uniform gl_LightModelParameters gl_LightModel;
+
+struct gl_LightModelProducts {
+ vec4 sceneColor;
+};
+uniform gl_LightModelProducts gl_FrontLightModelProduct;
+uniform gl_LightModelProducts gl_BackLightModelProduct;
+
+struct gl_LightProducts {
+ vec4 ambient;
+ vec4 diffuse;
+ vec4 specular;
+};
+uniform gl_LightProducts gl_FrontLightProduct[gl_MaxLights];
+uniform gl_LightProducts gl_BackLightProduct[gl_MaxLights];
+
+uniform vec4 gl_TextureEnvColor[gl_MaxTextureUnits];
+uniform vec4 gl_EyePlaneS[gl_MaxTextureCoords];
+uniform vec4 gl_EyePlaneT[gl_MaxTextureCoords];
+uniform vec4 gl_EyePlaneR[gl_MaxTextureCoords];
+uniform vec4 gl_EyePlaneQ[gl_MaxTextureCoords];
+uniform vec4 gl_ObjectPlaneS[gl_MaxTextureCoords];
+uniform vec4 gl_ObjectPlaneT[gl_MaxTextureCoords];
+uniform vec4 gl_ObjectPlaneR[gl_MaxTextureCoords];
+uniform vec4 gl_ObjectPlaneQ[gl_MaxTextureCoords];
+
+struct gl_FogParameters {
+ vec4 color;
+ float density;
+ float start;
+ float end;
+ float scale;
+};
+uniform gl_FogParameters gl_Fog;
+
+// Angle and trigonometry functions.
+float radians(float degrees);
+vec2 radians(vec2 degrees);
+vec3 radians(vec3 degrees);
+vec4 radians(vec4 degrees);
+float degrees(float radians);
+vec2 degrees(vec2 radians);
+vec3 degrees(vec3 radians);
+vec4 degrees(vec4 radians);
+float sin(float angle);
+vec2 sin(vec2 angle);
+vec3 sin(vec3 angle);
+vec4 sin(vec4 angle);
+float cos(float angle);
+vec2 cos(vec2 angle);
+vec3 cos(vec3 angle);
+vec4 cos(vec4 angle);
+float tan(float angle);
+vec2 tan(vec2 angle);
+vec3 tan(vec3 angle);
+vec4 tan(vec4 angle);
+float asin(float angle);
+vec2 asin(vec2 angle);
+vec3 asin(vec3 angle);
+vec4 asin(vec4 angle);
+float acos(float angle);
+vec2 acos(vec2 angle);
+vec3 acos(vec3 angle);
+vec4 acos(vec4 angle);
+float atan(float y, float x);
+vec2 atan(vec2 y, vec2 x);
+vec3 atan(vec3 y, vec3 x);
+vec4 atan(vec4 y, vec4 x);
+float atan(float y_over_x);
+vec2 atan(vec2 y_over_x);
+vec3 atan(vec3 y_over_x);
+vec4 atan(vec4 y_over_x);
+float sinh(float x);
+vec2 sinh(vec2 x);
+vec3 sinh(vec3 x);
+vec4 sinh(vec4 x);
+float cosh(float x);
+vec2 cosh(vec2 x);
+vec3 cosh(vec3 x);
+vec4 cosh(vec4 x);
+float tanh(float x);
+vec2 tanh(vec2 x);
+vec3 tanh(vec3 x);
+vec4 tanh(vec4 x);
+float asinh(float x);
+vec2 asinh(vec2 x);
+vec3 asinh(vec3 x);
+vec4 asinh(vec4 x);
+float acosh(float x);
+vec2 acosh(vec2 x);
+vec3 acosh(vec3 x);
+vec4 acosh(vec4 x);
+float atanh(float x);
+vec2 atanh(vec2 x);
+vec3 atanh(vec3 x);
+vec4 atanh(vec4 x);
+
+// Exponential functions.
+float pow(float x, float y);
+vec2 pow(vec2 x, vec2 y);
+vec3 pow(vec3 x, vec3 y);
+vec4 pow(vec4 x, vec4 y);
+float exp(float x);
+vec2 exp(vec2 x);
+vec3 exp(vec3 x);
+vec4 exp(vec4 x);
+float log(float x);
+vec2 log(vec2 x);
+vec3 log(vec3 x);
+vec4 log(vec4 x);
+float exp2(float x);
+vec2 exp2(vec2 x);
+vec3 exp2(vec3 x);
+vec4 exp2(vec4 x);
+float log2(float x);
+vec2 log2(vec2 x);
+vec3 log2(vec3 x);
+vec4 log2(vec4 x);
+float sqrt(float x);
+vec2 sqrt(vec2 x);
+vec3 sqrt(vec3 x);
+vec4 sqrt(vec4 x);
+float inversesqrt(float x);
+vec2 inversesqrt(vec2 x);
+vec3 inversesqrt(vec3 x);
+vec4 inversesqrt(vec4 x);
+
+// Common functions.
+float abs(float x);
+vec2 abs(vec2 x);
+vec3 abs(vec3 x);
+vec4 abs(vec4 x);
+int abs(int x);
+ivec2 abs(ivec2 x);
+ivec3 abs(ivec3 x);
+ivec4 abs(ivec4 x);
+float sign(float x);
+vec2 sign(vec2 x);
+vec3 sign(vec3 x);
+vec4 sign(vec4 x);
+int sign(int x);
+ivec2 sign(ivec2 x);
+ivec3 sign(ivec3 x);
+ivec4 sign(ivec4 x);
+float floor(float x);
+vec2 floor(vec2 x);
+vec3 floor(vec3 x);
+vec4 floor(vec4 x);
+float trunc(float x);
+vec2 trunc(vec2 x);
+vec3 trunc(vec3 x);
+vec4 trunc(vec4 x);
+float round(float x);
+vec2 round(vec2 x);
+vec3 round(vec3 x);
+vec4 round(vec4 x);
+float roundEven(float x);
+vec2 roundEven(vec2 x);
+vec3 roundEven(vec3 x);
+vec4 roundEven(vec4 x);
+float ceil(float x);
+vec2 ceil(vec2 x);
+vec3 ceil(vec3 x);
+vec4 ceil(vec4 x);
+float fract(float x);
+vec2 fract(vec2 x);
+vec3 fract(vec3 x);
+vec4 fract(vec4 x);
+float mod(float x, float y);
+vec2 mod(vec2 x, float y);
+vec3 mod(vec3 x, float y);
+vec4 mod(vec4 x, float y);
+vec2 mod(vec2 x, vec2 y);
+vec3 mod(vec3 x, vec3 y);
+vec4 mod(vec4 x, vec4 y);
+float modf(float x, float y);
+vec2 modf(vec2 x, vec2 y);
+vec3 modf(vec3 x, vec3 y);
+vec4 modf(vec4 x, vec4 y);
+float min(float x, float y);
+vec2 min(vec2 x, vec2 y);
+vec3 min(vec3 x, vec3 y);
+vec4 min(vec4 x, vec4 y);
+vec2 min(vec2 x, float y);
+vec3 min(vec3 x, float y);
+vec4 min(vec4 x, float y);
+int min(int x, int y);
+ivec2 min(ivec2 x, ivec2 y);
+ivec3 min(ivec3 x, ivec3 y);
+ivec4 min(ivec4 x, ivec4 y);
+ivec2 min(ivec2 x, int y);
+ivec3 min(ivec3 x, int y);
+ivec4 min(ivec4 x, int y);
+uint min(uint x, uint y);
+uvec2 min(uvec2 x, uvec2 y);
+uvec3 min(uvec3 x, uvec3 y);
+uvec4 min(uvec4 x, uvec4 y);
+uvec2 min(uvec2 x, uint y);
+uvec3 min(uvec3 x, uint y);
+uvec4 min(uvec4 x, uint y);
+float max(float x, float y);
+vec2 max(vec2 x, vec2 y);
+vec3 max(vec3 x, vec3 y);
+vec4 max(vec4 x, vec4 y);
+vec2 max(vec2 x, float y);
+vec3 max(vec3 x, float y);
+vec4 max(vec4 x, float y);
+int max(int x, int y);
+ivec2 max(ivec2 x, ivec2 y);
+ivec3 max(ivec3 x, ivec3 y);
+ivec4 max(ivec4 x, ivec4 y);
+ivec2 max(ivec2 x, int y);
+ivec3 max(ivec3 x, int y);
+ivec4 max(ivec4 x, int y);
+uint max(uint x, uint y);
+uvec2 max(uvec2 x, uvec2 y);
+uvec3 max(uvec3 x, uvec3 y);
+uvec4 max(uvec4 x, uvec4 y);
+uvec2 max(uvec2 x, uint y);
+uvec3 max(uvec3 x, uint y);
+uvec4 max(uvec4 x, uint y);
+float clamp(float x, float min, float max);
+vec2 clamp(vec2 x, vec2 min, vec2 max);
+vec3 clamp(vec3 x, vec3 min, vec3 max);
+vec4 clamp(vec4 x, vec4 min, vec4 max);
+vec2 clamp(vec2 x, vec2 min, float max);
+vec3 clamp(vec3 x, vec3 min, float max);
+vec4 clamp(vec4 x, vec4 min, float max);
+int clamp(int x, int min, int max);
+ivec2 clamp(ivec2 x, ivec2 min, ivec2 max);
+ivec3 clamp(ivec3 x, ivec3 min, ivec3 max);
+ivec4 clamp(ivec4 x, ivec4 min, ivec4 max);
+ivec2 clamp(ivec2 x, ivec2 min, int max);
+ivec3 clamp(ivec3 x, ivec3 min, int max);
+ivec4 clamp(ivec4 x, ivec4 min, int max);
+uint clamp(uint x, uint min, uint max);
+uvec2 clamp(uvec2 x, uvec2 min, uvec2 max);
+uvec3 clamp(uvec3 x, uvec3 min, uvec3 max);
+uvec4 clamp(uvec4 x, uvec4 min, uvec4 max);
+uvec2 clamp(uvec2 x, uvec2 min, uint max);
+uvec3 clamp(uvec3 x, uvec3 min, uint max);
+uvec4 clamp(uvec4 x, uvec4 min, uint max);
+float mix(float x, float y, float a);
+vec2 mix(vec2 x, vec2 y, vec2 a);
+vec3 mix(vec3 x, vec3 y, vec3 a);
+vec4 mix(vec4 x, vec4 y, vec4 a);
+vec2 mix(vec2 x, vec2 y, float a);
+vec3 mix(vec3 x, vec3 y, float a);
+vec4 mix(vec4 x, vec4 y, float a);
+float mix(float x, float y, bool a);
+vec2 mix(vec2 x, vec2 y, bool a);
+vec3 mix(vec3 x, vec3 y, bool a);
+vec4 mix(vec4 x, vec4 y, bool a);
+float mix(float x, float y, bvec2 a);
+vec2 mix(vec2 x, vec2 y, bvec2 a);
+vec3 mix(vec3 x, vec3 y, bvec2 a);
+vec4 mix(vec4 x, vec4 y, bvec2 a);
+float mix(float x, float y, bvec3 a);
+vec2 mix(vec2 x, vec2 y, bvec3 a);
+vec3 mix(vec3 x, vec3 y, bvec3 a);
+vec4 mix(vec4 x, vec4 y, bvec3 a);
+float mix(float x, float y, bvec4 a);
+vec2 mix(vec2 x, vec2 y, bvec4 a);
+vec3 mix(vec3 x, vec3 y, bvec4 a);
+vec4 mix(vec4 x, vec4 y, bvec4 a);
+float step(float edge, float x);
+vec2 step(vec2 edge, vec2 x);
+vec3 step(vec3 edge, vec3 x);
+vec4 step(vec4 edge, vec4 x);
+vec2 step(float edge, vec2 x);
+vec3 step(float edge, vec3 x);
+vec4 step(float edge, vec4 x);
+float smoothstep(float edge0, float edge1, float x);
+vec2 smoothstep(vec2 edge0, vec2 edge1, vec2 x);
+vec3 smoothstep(vec3 edge0, vec3 edge1, vec3 x);
+vec4 smoothstep(vec4 edge0, vec4 edge1, vec4 x);
+vec2 smoothstep(float edge0, float edge1, vec2 x);
+vec3 smoothstep(float edge0, float edge1, vec3 x);
+vec4 smoothstep(float edge0, float edge1, vec4 x);
+bool isnan(float x);
+bvec2 isnan(vec2 x);
+bvec3 isnan(vec3 x);
+bvec4 isnan(vec4 x);
+bool isinf(float x);
+bvec2 isinf(vec2 x);
+bvec3 isinf(vec3 x);
+bvec4 isinf(vec4 x);
+int floatBitsToInt(float x);
+ivec2 floatBitsToInt(vec2 x);
+ivec3 floatBitsToInt(vec3 x);
+ivec4 floatBitsToInt(vec4 x);
+uint floatBitsToUint(float x);
+uvec2 floatBitsToUint(vec2 x);
+uvec3 floatBitsToUint(vec3 x);
+uvec4 floatBitsToUint(vec4 x);
+float intBitsToFloat(int x);
+vec2 intBitsToFloat(ivec2 x);
+vec3 intBitsToFloat(ivec3 x);
+vec4 intBitsToFloat(ivec4 x);
+float uintBitsToFloat(uint x);
+vec2 uintBitsToFloat(uvec2 x);
+vec3 uintBitsToFloat(uvec3 x);
+vec4 uintBitsToFloat(uvec4 x);
+
+// Geometric functions.
+float length(float x);
+float length(vec2 x);
+float length(vec3 x);
+float length(vec4 x);
+float distance(float x, float y);
+float distance(vec2 x, vec2 y);
+float distance(vec3 x, vec3 y);
+float distance(vec4 x, vec4 y);
+float dot(float x, float y);
+float dot(vec2 x, vec2 y);
+float dot(vec3 x, vec3 y);
+float dot(vec4 x, vec4 y);
+vec3 cross(vec3 x, vec3 y);
+float normalize(float x);
+vec2 normalize(vec2 x);
+vec3 normalize(vec3 x);
+vec4 normalize(vec4 x);
+
+// Compatibility profile only.
+vec4 transform();
+float faceforward(float n, float i, float nref);
+vec2 faceforward(vec2 n, vec2 i, vec2 nref);
+vec3 faceforward(vec3 n, vec3 i, vec3 nref);
+vec4 faceforward(vec4 n, vec4 i, vec4 nref);
+float reflect(float n, float i);
+vec2 reflect(vec2 n, vec2 i);
+vec3 reflect(vec3 n, vec3 i);
+vec4 reflect(vec4 n, vec4 i);
+float refract(float n, float i, float eta);
+vec2 refract(vec2 n, vec2 i, float eta);
+vec3 refract(vec3 n, vec3 i, float eta);
+vec4 refract(vec4 n, vec4 i, float eta);
+
+// Matrix functions.
+mat2 matrixCompMult(mat2 x, mat2 y);
+mat3 matrixCompMult(mat3 x, mat3 y);
+mat4 matrixCompMult(mat4 x, mat4 y);
+mat2x4 matrixCompMult(mat2x4 x, mat2x4 y);
+mat4x2 matrixCompMult(mat4x2 x, mat4x2 y);
+mat2x3 matrixCompMult(mat2x3 x, mat2x3 y);
+mat3x2 matrixCompMult(mat3x2 x, mat3x2 y);
+mat3x4 matrixCompMult(mat3x4 x, mat3x4 y);
+mat4x3 matrixCompMult(mat4x3 x, mat4x3 y);
+mat2 outerProduct(vec2 c, vec2 r);
+mat3 outerProduct(vec3 c, vec3 r);
+mat4 outerProduct(vec4 c, vec4 r);
+mat2x3 outerProduct(vec3 c, vec2 r);
+mat3x2 outerProduct(vec2 c, vec3 r);
+mat2x4 outerProduct(vec4 c, vec2 r);
+mat4x2 outerProduct(vec2 c, vec4 r);
+mat3x4 outerProduct(vec4 c, vec3 r);
+mat4x3 outerProduct(vec3 c, vec4 r);
+mat2 transpose(mat2 m);
+mat3 transpose(mat3 m);
+mat4 transpose(mat4 m);
+mat2x3 transpose(mat3x2 m);
+mat3x2 transpose(mat2x3 m);
+mat2x4 transpose(mat4x2 m);
+mat4x2 transpose(mat2x4 m);
+mat3x4 transpose(mat4x3 m);
+mat4x3 transpose(mat3x4 m);
+float determinant(mat2 m);
+float determinant(mat3 m);
+float determinant(mat4 m);
+mat2 inverse(mat2 m);
+mat3 inverse(mat3 m);
+mat4 inverse(mat4 m);
+
+// Vector relational functions.
+bvec2 lessThan(vec2 x, vec2 y);
+bvec3 lessThan(vec3 x, vec3 y);
+bvec4 lessThan(vec4 x, vec4 y);
+bvec2 lessThan(ivec2 x, ivec2 y);
+bvec3 lessThan(ivec3 x, ivec3 y);
+bvec4 lessThan(ivec4 x, ivec4 y);
+bvec2 lessThan(uvec2 x, uvec2 y);
+bvec3 lessThan(uvec3 x, uvec3 y);
+bvec4 lessThan(uvec4 x, uvec4 y);
+bvec2 lessThanEqual(vec2 x, vec2 y);
+bvec3 lessThanEqual(vec3 x, vec3 y);
+bvec4 lessThanEqual(vec4 x, vec4 y);
+bvec2 lessThanEqual(ivec2 x, ivec2 y);
+bvec3 lessThanEqual(ivec3 x, ivec3 y);
+bvec4 lessThanEqual(ivec4 x, ivec4 y);
+bvec2 lessThanEqual(uvec2 x, uvec2 y);
+bvec3 lessThanEqual(uvec3 x, uvec3 y);
+bvec4 lessThanEqual(uvec4 x, uvec4 y);
+bvec2 greaterThan(vec2 x, vec2 y);
+bvec3 greaterThan(vec3 x, vec3 y);
+bvec4 greaterThan(vec4 x, vec4 y);
+bvec2 greaterThan(ivec2 x, ivec2 y);
+bvec3 greaterThan(ivec3 x, ivec3 y);
+bvec4 greaterThan(ivec4 x, ivec4 y);
+bvec2 greaterThan(uvec2 x, uvec2 y);
+bvec3 greaterThan(uvec3 x, uvec3 y);
+bvec4 greaterThan(uvec4 x, uvec4 y);
+bvec2 greaterThanEqual(vec2 x, vec2 y);
+bvec3 greaterThanEqual(vec3 x, vec3 y);
+bvec4 greaterThanEqual(vec4 x, vec4 y);
+bvec2 greaterThanEqual(ivec2 x, ivec2 y);
+bvec3 greaterThanEqual(ivec3 x, ivec3 y);
+bvec4 greaterThanEqual(ivec4 x, ivec4 y);
+bvec2 greaterThanEqual(uvec2 x, uvec2 y);
+bvec3 greaterThanEqual(uvec3 x, uvec3 y);
+bvec4 greaterThanEqual(uvec4 x, uvec4 y);
+bvec2 equal(vec2 x, vec2 y);
+bvec3 equal(vec3 x, vec3 y);
+bvec4 equal(vec4 x, vec4 y);
+bvec2 equal(ivec2 x, ivec2 y);
+bvec3 equal(ivec3 x, ivec3 y);
+bvec4 equal(ivec4 x, ivec4 y);
+bvec2 equal(uvec2 x, uvec2 y);
+bvec3 equal(uvec3 x, uvec3 y);
+bvec4 equal(uvec4 x, uvec4 y);
+bvec2 equal(bvec2 x, bvec2 y);
+bvec3 equal(bvec3 x, bvec3 y);
+bvec4 equal(bvec4 x, bvec4 y);
+bvec2 notEqual(vec2 x, vec2 y);
+bvec3 notEqual(vec3 x, vec3 y);
+bvec4 notEqual(vec4 x, vec4 y);
+bvec2 notEqual(ivec2 x, ivec2 y);
+bvec3 notEqual(ivec3 x, ivec3 y);
+bvec4 notEqual(ivec4 x, ivec4 y);
+bvec2 notEqual(uvec2 x, uvec2 y);
+bvec3 notEqual(uvec3 x, uvec3 y);
+bvec4 notEqual(uvec4 x, uvec4 y);
+bvec2 notEqual(bvec2 x, bvec2 y);
+bvec3 notEqual(bvec3 x, bvec3 y);
+bvec4 notEqual(bvec4 x, bvec4 y);
+bool any(bvec2 b);
+bool any(bvec3 b);
+bool any(bvec4 b);
+bool all(bvec2 b);
+bool all(bvec3 b);
+bool all(bvec4 b);
+bvec2 not(bvec2 x);
+bvec3 not(bvec3 x);
+bvec4 not(bvec4 x);
+
+// Texture lookup functions.
+int textureSize(sampler1D sampler, int lod);
+ivec2 textureSize(sampler2D sampler, int lod);
+ivec3 textureSize(sampler3D sampler, int lod);
+ivec2 textureSize(samplerCube sampler, int lod);
+int textureSize(sampler1DShadow sampler, int lod);
+ivec2 textureSize(sampler2DShadow sampler, int lod);
+ivec2 textureSize(samplerCubeShadow sampler, int lod);
+ivec2 textureSize(sampler2DRect sampler);
+ivec2 textureSize(sampler2DRectShadow sampler);
+ivec2 textureSize(sampler1DArray sampler, int lod);
+ivec3 textureSize(sampler2DArray sampler, int lod);
+ivec2 textureSize(sampler1DArrayShadow sampler, int lod);
+ivec3 textureSize(sampler2DArrayShadow sampler, int lod);
+int textureSize(samplerBuffer sampler);
+ivec2 textureSize(sampler2DMS sampler);
+ivec2 textureSize(sampler2DMSArray sampler);
+vec4 texture(sampler1D sampler, float P);
+vec4 texture(sampler1D sampler, float P, float bias);
+vec4 texture(sampler2D sampler, vec2 P);
+vec4 texture(sampler2D sampler, vec2 P, float bias);
+vec4 texture(sampler3D sampler, vec3 P);
+vec4 texture(sampler3D sampler, vec3 P, float bias);
+vec4 texture(samplerCube sampler, vec3 P);
+vec4 texture(samplerCube sampler, vec3 P, float bias);
+float texture(sampler1DShadow sampler, vec3 P);
+float texture(sampler1DShadow sampler, vec3 P, float bias);
+float texture(sampler2DShadow sampler, vec3 P);
+float texture(sampler2DShadow sampler, vec3 P, float bias);
+float texture(samplerCubeShadow sampler, vec4 P);
+float texture(samplerCubeShadow sampler, vec4 P, float bias);
+vec4 texture(sampler1DArray sampler, vec2 P);
+vec4 texture(sampler1DArray sampler, vec2 P, float bias);
+vec4 texture(sampler2DArray sampler, vec3 P);
+vec4 texture(sampler2DArray sampler, vec3 P, float bias);
+float texture(sampler1DArrayShadow sampler, vec3 P);
+float texture(sampler1DArrayShadow sampler, vec3 P, float bias);
+float texture(sampler2DArrayShadow sampler, vec4 P);
+vec4 texture(sampler2DRect sampler, vec2 P);
+float texture(sampler2DRectShadow sampler, vec3 P);
+vec4 textureProj(sampler1D sampler, vec2 P);
+vec4 textureProj(sampler1D sampler, vec2 P, float bias);
+vec4 textureProj(sampler1D sampler, vec4 P);
+vec4 textureProj(sampler1D sampler, vec4 P, float bias);
+vec4 textureProj(sampler2D sampler, vec3 P);
+vec4 textureProj(sampler2D sampler, vec3 P, float bias);
+vec4 textureProj(sampler2D sampler, vec4 P);
+vec4 textureProj(sampler2D sampler, vec4 P, float bias);
+vec4 textureProj(sampler3D sampler, vec4 P);
+vec4 textureProj(sampler3D sampler, vec4 P, float bias);
+float textureProj(sampler1DShadow sampler, vec4 P);
+float textureProj(sampler1DShadow sampler, vec4 P, float bias);
+float textureProj(sampler2DShadow sampler, vec4 P);
+float textureProj(sampler2DShadow sampler, vec4 P, float bias);
+vec4 textureProj(sampler2DRect sampler, vec3 P);
+vec4 textureProj(sampler2DRect sampler, vec4 P);
+float textureProj(sampler2DRectShadow sampler, vec4 P);
+vec4 textureLod(sampler1D sampler, float P, float lod);
+vec4 textureLod(sampler2D sampler, vec2 P, float lod);
+vec4 textureLod(sampler3D sampler, vec3 P, float lod);
+vec4 textureLod(samplerCube sampler, vec3 P, float lod);
+float textureLod(sampler1DShadow sampler, vec3 P, float lod);
+float textureLod(sampler2DShadow sampler, vec3 P, float lod);
+vec4 textureLod(sampler1DArray sampler, vec2 P, float lod);
+vec4 textureLod(sampler2DArray sampler, vec3 P, float lod);
+float textureLod(sampler1DArrayShadow sampler, vec3 P, float lod);
+vec4 textureOffset(sampler1D sampler, float P, int offset);
+vec4 textureOffset(sampler1D sampler, float P, int offset, float bias);
+vec4 textureOffset(sampler2D sampler, vec2 P, ivec2 offset);
+vec4 textureOffset(sampler2D sampler, vec2 P, ivec2 offset, float bias);
+vec4 textureOffset(sampler3D sampler, vec3 P, ivec3 offset);
+vec4 textureOffset(sampler3D sampler, vec3 P, ivec3 offset, float bias);
+vec4 textureOffset(sampler2DRect sampler, vec2 P, ivec2 offset);
+float textureOffset(sampler2DRectShadow sampler, vec3 P, ivec2 offset);
+float textureOffset(sampler1DShadow sampler, vec3 P, int offset);
+float textureOffset(sampler1DShadow sampler, vec3 P, int offset, float bias);
+float textureOffset(sampler2DShadow sampler, vec3 P, ivec2 offset);
+float textureOffset(sampler2DShadow sampler, vec3 P, ivec2 offset, float bias);
+vec4 textureOffset(sampler1DArray sampler, vec2 P, int offset);
+vec4 textureOffset(sampler1DArray sampler, vec2 P, int offset, float bias);
+vec4 textureOffset(sampler2DArray sampler, vec3 P, ivec2 offset);
+vec4 textureOffset(sampler2DArray sampler, vec3 P, ivec2 offset, float bias);
+float textureOffset(sampler1DArrayShadow sampler, vec3 P, int offset);
+float textureOffset(sampler1DArrayShadow sampler, vec3 P, int offset, float bias);
+vec4 texelFetch(sampler1D sampler, int P, int lod);
+vec4 texelFetch(sampler2D sampler, ivec2 P, int lod);
+vec4 texelFetch(sampler3D sampler, ivec3 P, int lod);
+vec4 texelFetch(sampler2DRect sampler, ivec2 P);
+vec4 texelFetch(sampler1DArray sampler, ivec2 P, int lod);
+vec4 texelFetch(sampler2DArray sampler, ivec3 P, int lod);
+vec4 texelFetch(samplerBuffer sampler, int P);
+vec4 texelFetch(sampler2DMS sampler, ivec2 P, int sampleno);
+vec4 texelFetch(sampler2DMSArray sampler, ivec3 P, int sampleno);
+vec4 texelFetchOffset(sampler1D sampler, int P, int lod, int offset);
+vec4 texelFetchOffset(sampler2D sampler, ivec2 P, int lod, ivec2 offset);
+vec4 texelFetchOffset(sampler3D sampler, ivec3 P, int lod, ivec3 offset);
+vec4 texelFetchOffset(sampler2DRect sampler, ivec2 P, ivec2 offset);
+vec4 texelFetchOffset(sampler1DArray sampler, ivec2 P, int lod, int offset);
+vec4 texelFetchOffset(sampler2DArray sampler, ivec3 P, int lod, ivec2 offset);
+vec4 textureProjOffset(sampler1D sampler, vec2 P, int offset);
+vec4 textureProjOffset(sampler1D sampler, vec2 P, int offset, float bias);
+vec4 textureProjOffset(sampler1D sampler, vec4 P, int offset);
+vec4 textureProjOffset(sampler1D sampler, vec4 P, int offset, float bias);
+vec4 textureProjOffset(sampler2D sampler, vec3 P, ivec2 offset);
+vec4 textureProjOffset(sampler2D sampler, vec3 P, ivec2 offset, float bias);
+vec4 textureProjOffset(sampler2D sampler, vec4 P, ivec2 offset);
+vec4 textureProjOffset(sampler2D sampler, vec4 P, ivec2 offset, float bias);
+vec4 textureProjOffset(sampler3D sampler, vec4 P, ivec3 offset);
+vec4 textureProjOffset(sampler3D sampler, vec4 P, ivec3 offset, float bias);
+vec4 textureProjOffset(sampler2DRect sampler, vec3 P, ivec2 offset);
+vec4 textureProjOffset(sampler2DRect sampler, vec4 P, ivec2 offset);
+float textureProjOffset(sampler2DRectShadow sampler, vec4 P, ivec2 offset );
+float textureProjOffset(sampler1DShadow sampler, vec4 P, int offset);
+float textureProjOffset(sampler1DShadow sampler, vec4 P, int offset, float bias);
+float textureProjOffset(sampler2DShadow sampler, vec4 P, ivec2 offset);
+float textureProjOffset(sampler2DShadow sampler, vec4 P, ivec2 offset, float bias);
+vec4 textureLodOffset(sampler1D sampler, float P, float lod, int offset);
+vec4 textureLodOffset(sampler2D sampler, vec2 P, float lod, ivec2 offset);
+vec4 textureLodOffset(sampler3D sampler, vec3 P, float lod, ivec3 offset);
+float textureLodOffset(sampler1DShadow sampler, vec3 P, float lod, int offset);
+float textureLodOffset(sampler2DShadow sampler, vec3 P, float lod, ivec2 offset);
+vec4 textureLodOffset(sampler1DArray sampler, vec2 P, float lod, int offset);
+vec4 textureLodOffset(sampler2DArray sampler, vec3 P, float lod, ivec2 offset);
+float textureLodOffset(sampler1DArrayShadow sampler, vec3 P, float lod, int offset);
+vec4 textureProjLod(sampler1D sampler, vec2 P, float lod);
+vec4 textureProjLod(sampler1D sampler, vec4 P, float lod);
+vec4 textureProjLod(sampler2D sampler, vec3 P, float lod);
+vec4 textureProjLod(sampler2D sampler, vec4 P, float lod);
+vec4 textureProjLod(sampler3D sampler, vec4 P, float lod);
+float textureProjLod(sampler1DShadow sampler, vec4 P, float lod);
+float textureProjLod(sampler2DShadow sampler, vec4 P, float lod);
+vec4 textureProjLodOffset(sampler1D sampler, vec2 P, float lod, int offset);
+vec4 textureProjLodOffset(sampler1D sampler, vec4 P, float lod, int offset);
+vec4 textureProjLodOffset(sampler2D sampler, vec3 P, float lod, ivec2 offset);
+vec4 textureProjLodOffset(sampler2D sampler, vec4 P, float lod, ivec2 offset);
+vec4 textureProjLodOffset(sampler3D sampler, vec4 P, float lod, ivec3 offset);
+float textureProjLodOffset(sampler1DShadow sampler, vec4 P, float lod, int offset);
+float textureProjLodOffset(sampler2DShadow sampler, vec4 P, float lod, ivec2 offset);
+vec4 textureGrad(sampler1D sampler, float P, float dPdx, float dPdy);
+vec4 textureGrad(sampler2D sampler, vec2 P, vec2 dPdx, vec2 dPdy);
+vec4 textureGrad(sampler3D sampler, vec3 P, vec3 dPdx, vec3 dPdy);
+vec4 textureGrad(samplerCube sampler, vec3 P, vec3 dPdx, vec3 dPdy);
+vec4 textureGrad(sampler2DRect sampler, vec2 P, vec2 dPdx, vec2 dPdy);
+float textureGrad(sampler2DRectShadow sampler, vec3 P, vec2 dPdx, vec2 dPdy);
+float textureGrad(sampler1DShadow sampler, vec3 P, float dPdx, float dPdy);
+float textureGrad(sampler2DShadow sampler, vec3 P, vec2 dPdx, vec2 dPdy);
+float textureGrad(samplerCubeShadow sampler, vec4 P, vec3 dPdx, vec3 dPdy);
+vec4 textureGrad(sampler1DArray sampler, vec2 P, float dPdx, float dPdy);
+vec4 textureGrad(sampler2DArray sampler, vec3 P, vec2 dPdx, vec2 dPdy);
+float textureGrad(sampler1DArrayShadow sampler, vec3 P, float dPdx, float dPdy);
+float textureGrad(sampler2DArrayShadow sampler, vec4 P, vec2 dPdx, vec2 dPdy);
+vec4 textureGradOffset(sampler1D sampler, float P, float dPdx, float dPdy, int offset);
+vec4 textureGradOffset(sampler2D sampler, vec2 P, vec2 dPdx, vec2 dPdy, ivec2 offset);
+vec4 textureGradOffset(sampler3D sampler, vec3 P, vec3 dPdx, vec3 dPdy, ivec3 offset);
+vec4 textureGradOffset(sampler2DRect sampler, vec2 P, vec2 dPdx, vec2 dPdy, ivec2 offset);
+float textureGradOffset(sampler2DRectShadow sampler, vec3 P, vec2 dPdx, vec2 dPdy, ivec2 offset);
+float textureGradOffset(sampler1DShadow sampler, vec3 P, float dPdx, float dPdy, int offset );
+float textureGradOffset(sampler2DShadow sampler, vec3 P, vec2 dPdx, vec2 dPdy, ivec2 offset);
+vec4 textureGradOffset(sampler1DArray sampler, vec2 P, float dPdx, float dPdy, int offset);
+vec4 textureGradOffset(sampler2DArray sampler, vec3 P, vec2 dPdx, vec2 dPdy, ivec2 offset);
+float textureGradOffset(sampler1DArrayShadow sampler, vec3 P, float dPdx, float dPdy, int offset);
+float textureGradOffset(sampler2DArrayShadow sampler, vec4 P, vec2 dPdx, vec2 dPdy, ivec2 offset);
+vec4 textureProjGrad(sampler1D sampler, vec2 P, float dPdx, float dPdy);
+vec4 textureProjGrad(sampler1D sampler, vec4 P, float dPdx, float dPdy);
+vec4 textureProjGrad(sampler2D sampler, vec3 P, vec2 dPdx, vec2 dPdy);
+vec4 textureProjGrad(sampler2D sampler, vec4 P, vec2 dPdx, vec2 dPdy);
+vec4 textureProjGrad(sampler3D sampler, vec4 P, vec3 dPdx, vec3 dPdy);
+vec4 textureProjGrad(sampler2DRect sampler, vec3 P, vec2 dPdx, vec2 dPdy);
+vec4 textureProjGrad(sampler2DRect sampler, vec4 P, vec2 dPdx, vec2 dPdy);
+float textureProjGrad(sampler2DRectShadow sampler, vec4 P, vec2 dPdx, vec2 dPdy);
+float textureProjGrad(sampler1DShadow sampler, vec4 P, float dPdx, float dPdy);
+float textureProjGrad(sampler2DShadow sampler, vec4 P, vec2 dPdx, vec2 dPdy);
+vec4 textureProjGradOffset(sampler1D sampler, vec2 P, float dPdx, float dPdy, int offset);
+vec4 textureProjGradOffset(sampler1D sampler, vec4 P, float dPdx, float dPdy, int offset);
+vec4 textureProjGradOffset(sampler2D sampler, vec3 P, vec2 dPdx, vec2 dPdy, vec2 offset);
+vec4 textureProjGradOffset(sampler2D sampler, vec4 P, vec2 dPdx, vec2 dPdy, vec2 offset);
+vec4 textureProjGradOffset(sampler2DRect sampler, vec3 P, vec2 dPdx, vec2 dPdy, ivec2 offset);
+vec4 textureProjGradOffset(sampler2DRect sampler, vec4 P, vec2 dPdx, vec2 dPdy, ivec2 offset);
+float textureProjGradOffset(sampler2DRectShadow sampler, vec4 P, vec2 dPdx, vec2 dPdy, ivec2 offset);
+vec4 textureProjGradOffset(sampler3D sampler, vec4 P, vec3 dPdx, vec3 dPdy, vec3 offset);
+float textureProjGradOffset(sampler1DShadow sampler, vec4 P, float dPdx, float dPdy, int offset);
+float textureProjGradOffset(sampler2DShadow sampler, vec4 P, vec2 dPdx, vec2 dPdy, vec2 offset);
+
+// Deprecated texture functions.
+vec4 texture1D(sampler1D sampler, float coord);
+vec4 texture1D(sampler1D sampler, float coord, float bias);
+vec4 texture1DProj(sampler1D sampler, vec2 coord);
+vec4 texture1DProj(sampler1D sampler, vec2 coord, float bias);
+vec4 texture1DProj(sampler1D sampler, vec4 coord);
+vec4 texture1DProj(sampler1D sampler, vec4 coord, float bias);
+vec4 texture1DLod(sampler1D sampler, float coord, float lod);
+vec4 texture1DProjLod(sampler1D sampler, vec2 coord, float lod);
+vec4 texture1DProjLod(sampler1D sampler, vec4 coord, float lod);
+vec4 texture2D(sampler2D sampler, vec2 coord);
+vec4 texture2D(sampler2D sampler, vec2 coord, float bias);
+vec4 texture2DProj(sampler2D sampler, vec3 coord);
+vec4 texture2DProj(sampler2D sampler, vec3 coord, float bias);
+vec4 texture2DProj(sampler2D sampler, vec4 coord);
+vec4 texture2DProj(sampler2D sampler, vec4 coord, float bias);
+vec4 texture2DLod(sampler2D sampler, vec2 coord, float lod);
+vec4 texture2DProjLod(sampler2D sampler, vec3 coord, float lod);
+vec4 texture2DProjLod(sampler2D sampler, vec4 coord, float lod);
+vec4 texture3D(sampler3D sampler, vec3 coord);
+vec4 texture3D(sampler3D sampler, vec3 coord, float bias);
+vec4 texture3DProj(sampler3D sampler, vec4 coord);
+vec4 texture3DProj(sampler3D sampler, vec4 coord, float bias);
+vec4 texture3DLod(sampler3D sampler, vec3 coord, float lod);
+vec4 texture3DProjLod(sampler3D sampler, vec4 coord, float lod);
+vec4 textureCube(samplerCube sampler, vec3 coord);
+vec4 textureCube(samplerCube sampler, vec3 coord, float bias);
+vec4 textureCubeLod(samplerCube sampler, vec3 coord, float lod);
+vec4 shadow1D(sampler1DShadow sampler, vec3 coord);
+vec4 shadow1D(sampler1DShadow sampler, vec3 coord, float bias);
+vec4 shadow2D(sampler2DShadow sampler, vec3 coord);
+vec4 shadow2D(sampler2DShadow sampler, vec3 coord, float bias);
+vec4 shadow1DProj(sampler1DShadow sampler, vec4 coord);
+vec4 shadow1DProj(sampler1DShadow sampler, vec4 coord, float bias);
+vec4 shadow2DProj(sampler2DShadow sampler, vec4 coord);
+vec4 shadow2DProj(sampler2DShadow sampler, vec4 coord, float bias);
+vec4 shadow1DLod(sampler1DShadow sampler, vec3 coord, float lod);
+vec4 shadow2DLod(sampler2DShadow sampler, vec3 coord, float lod);
+vec4 shadow1DProjLod(sampler1DShadow sampler, vec4 coord, float lod);
+vec4 shadow2DProjLod(sampler2DShadow sampler, vec4 coord, float lod);
+
+// Noise functions.
+float noise1(float x);
+float noise1(vec2 x);
+float noise1(vec3 x);
+float noise1(vec4 x);
+vec2 noise2(float x);
+vec2 noise2(vec2 x);
+vec2 noise2(vec3 x);
+vec2 noise2(vec4 x);
+vec3 noise3(float x);
+vec3 noise3(vec2 x);
+vec3 noise3(vec3 x);
+vec3 noise3(vec4 x);
+vec4 noise4(float x);
+vec4 noise4(vec2 x);
+vec4 noise4(vec3 x);
+vec4 noise4(vec4 x);
diff --git a/share/qtcreator/qml/qmlpuppet/commands/captureddatacommand.h b/share/qtcreator/qml/qmlpuppet/commands/captureddatacommand.h
index 6c3715dd5f..0d3bbba7b7 100644
--- a/share/qtcreator/qml/qmlpuppet/commands/captureddatacommand.h
+++ b/share/qtcreator/qml/qmlpuppet/commands/captureddatacommand.h
@@ -151,8 +151,19 @@ public:
qint32 nodeId = -1;
};
+ CapturedDataCommand() = default;
+
+ CapturedDataCommand(QVector<StateData> &&stateData)
+ : stateData{std::move(stateData)}
+ {}
+
+ CapturedDataCommand(QImage &&image)
+ : image{std::move(image)}
+ {}
+
friend QDataStream &operator<<(QDataStream &out, const CapturedDataCommand &command)
{
+ out << command.image;
out << command.stateData;
return out;
@@ -160,12 +171,14 @@ public:
friend QDataStream &operator>>(QDataStream &in, CapturedDataCommand &command)
{
+ in >> command.image;
in >> command.stateData;
return in;
}
public:
+ QImage image;
QVector<StateData> stateData;
};
diff --git a/share/qtcreator/qml/qmlpuppet/commands/commands.pri b/share/qtcreator/qml/qmlpuppet/commands/commands.pri
index 680abb2744..270c326a33 100644
--- a/share/qtcreator/qml/qmlpuppet/commands/commands.pri
+++ b/share/qtcreator/qml/qmlpuppet/commands/commands.pri
@@ -34,7 +34,8 @@ HEADERS += $$PWD/synchronizecommand.h \ \
$$PWD/update3dviewstatecommand.h \
$$PWD/puppettocreatorcommand.h \
$$PWD/inputeventcommand.h \
- $$PWD/view3dactioncommand.h
+ $$PWD/view3dactioncommand.h \
+ $$PWD/requestmodelnodepreviewimagecommand.h
SOURCES += $$PWD/synchronizecommand.cpp \
$$PWD/changepreviewimagesizecommand.cpp \
@@ -68,4 +69,5 @@ SOURCES += $$PWD/synchronizecommand.cpp \
$$PWD/update3dviewstatecommand.cpp \
$$PWD/puppettocreatorcommand.cpp \
$$PWD/inputeventcommand.cpp \
- $$PWD/view3dactioncommand.cpp
+ $$PWD/view3dactioncommand.cpp \
+ $$PWD/requestmodelnodepreviewimagecommand.cpp
diff --git a/share/qtcreator/qml/qmlpuppet/commands/createscenecommand.cpp b/share/qtcreator/qml/qmlpuppet/commands/createscenecommand.cpp
index 1ee34ff447..da86573a7a 100644
--- a/share/qtcreator/qml/qmlpuppet/commands/createscenecommand.cpp
+++ b/share/qtcreator/qml/qmlpuppet/commands/createscenecommand.cpp
@@ -29,136 +29,20 @@
namespace QmlDesigner {
-CreateSceneCommand::CreateSceneCommand() = default;
-
-CreateSceneCommand::CreateSceneCommand(const QVector<InstanceContainer> &instanceContainer,
- const QVector<ReparentContainer> &reparentContainer,
- const QVector<IdContainer> &idVector,
- const QVector<PropertyValueContainer> &valueChangeVector,
- const QVector<PropertyBindingContainer> &bindingChangeVector,
- const QVector<PropertyValueContainer> &auxiliaryChangeVector,
- const QVector<AddImportContainer> &importVector,
- const QVector<MockupTypeContainer> &mockupTypeVector,
- const QUrl &fileUrl,
- const QHash<QString, QVariantMap> &edit3dToolStates,
- const QString &language)
- : m_instanceVector(instanceContainer),
- m_reparentInstanceVector(reparentContainer),
- m_idVector(idVector),
- m_valueChangeVector(valueChangeVector),
- m_bindingChangeVector(bindingChangeVector),
- m_auxiliaryChangeVector(auxiliaryChangeVector),
- m_importVector(importVector),
- m_mockupTypeVector(mockupTypeVector),
- m_fileUrl(fileUrl),
- m_edit3dToolStates(edit3dToolStates),
- m_language(language)
-{
-}
-
-QVector<InstanceContainer> CreateSceneCommand::instances() const
-{
- return m_instanceVector;
-}
-
-QVector<ReparentContainer> CreateSceneCommand::reparentInstances() const
-{
- return m_reparentInstanceVector;
-}
-
-QVector<IdContainer> CreateSceneCommand::ids() const
-{
- return m_idVector;
-}
-
-QVector<PropertyValueContainer> CreateSceneCommand::valueChanges() const
-{
- return m_valueChangeVector;
-}
-
-QVector<PropertyBindingContainer> CreateSceneCommand::bindingChanges() const
-{
- return m_bindingChangeVector;
-}
-
-QVector<PropertyValueContainer> CreateSceneCommand::auxiliaryChanges() const
-{
- return m_auxiliaryChangeVector;
-}
-
-QVector<AddImportContainer> CreateSceneCommand::imports() const
-{
- return m_importVector;
-}
-
-QVector<MockupTypeContainer> CreateSceneCommand::mockupTypes() const
-{
- return m_mockupTypeVector;
-}
-
-QUrl CreateSceneCommand::fileUrl() const
-{
- return m_fileUrl;
-}
-
-QHash<QString, QVariantMap> CreateSceneCommand::edit3dToolStates() const
-{
- return m_edit3dToolStates;
-}
-
-QString CreateSceneCommand::language() const
-{
- return m_language;
-}
-
-QDataStream &operator<<(QDataStream &out, const CreateSceneCommand &command)
-{
- out << command.instances();
- out << command.reparentInstances();
- out << command.ids();
- out << command.valueChanges();
- out << command.bindingChanges();
- out << command.auxiliaryChanges();
- out << command.imports();
- out << command.mockupTypes();
- out << command.fileUrl();
- out << command.edit3dToolStates();
- out << command.language();
-
- return out;
-}
-
-QDataStream &operator>>(QDataStream &in, CreateSceneCommand &command)
-{
- in >> command.m_instanceVector;
- in >> command.m_reparentInstanceVector;
- in >> command.m_idVector;
- in >> command.m_valueChangeVector;
- in >> command.m_bindingChangeVector;
- in >> command.m_auxiliaryChangeVector;
- in >> command.m_importVector;
- in >> command.m_mockupTypeVector;
- in >> command.m_fileUrl;
- in >> command.m_edit3dToolStates;
- in >> command.m_language;
-
- return in;
-}
-
QDebug operator <<(QDebug debug, const CreateSceneCommand &command)
{
return debug.nospace() << "CreateSceneCommand("
- << "instances: " << command.instances() << ", "
- << "reparentInstances: " << command.reparentInstances() << ", "
- << "ids: " << command.ids() << ", "
- << "valueChanges: " << command.valueChanges() << ", "
- << "bindingChanges: " << command.bindingChanges() << ", "
- << "auxiliaryChanges: " << command.auxiliaryChanges() << ", "
- << "imports: " << command.imports() << ", "
- << "mockupTypes: " << command.mockupTypes() << ", "
- << "fileUrl: " << command.fileUrl() << ", "
- << "edit3dToolStates: " << command.edit3dToolStates() << ", "
- << "language: " << command.language() << ")";
+ << "instances: " << command.instances << ", "
+ << "reparentInstances: " << command.reparentInstances << ", "
+ << "ids: " << command.ids << ", "
+ << "valueChanges: " << command.valueChanges << ", "
+ << "bindingChanges: " << command.bindingChanges << ", "
+ << "auxiliaryChanges: " << command.auxiliaryChanges << ", "
+ << "imports: " << command.imports << ", "
+ << "mockupTypes: " << command.mockupTypes << ", "
+ << "fileUrl: " << command.fileUrl << ", "
+ << "edit3dToolStates: " << command.edit3dToolStates << ", "
+ << "language: " << command.language << ")";
}
}
diff --git a/share/qtcreator/qml/qmlpuppet/commands/createscenecommand.h b/share/qtcreator/qml/qmlpuppet/commands/createscenecommand.h
index aee8fe0d47..021d43a60e 100644
--- a/share/qtcreator/qml/qmlpuppet/commands/createscenecommand.h
+++ b/share/qtcreator/qml/qmlpuppet/commands/createscenecommand.h
@@ -41,53 +41,87 @@ namespace QmlDesigner {
class CreateSceneCommand
{
- friend QDataStream &operator>>(QDataStream &in, CreateSceneCommand &command);
-
public:
- CreateSceneCommand();
- explicit CreateSceneCommand(
- const QVector<InstanceContainer> &instanceContainer,
- const QVector<ReparentContainer> &reparentContainer,
- const QVector<IdContainer> &idVector,
- const QVector<PropertyValueContainer> &valueChangeVector,
- const QVector<PropertyBindingContainer> &bindingChangeVector,
- const QVector<PropertyValueContainer> &auxiliaryChangeVector,
- const QVector<AddImportContainer> &importVector,
- const QVector<MockupTypeContainer> &mockupTypeVector,
- const QUrl &fileUrl,
- const QHash<QString, QVariantMap> &edit3dToolStates,
- const QString &language);
+ CreateSceneCommand() = default;
+ explicit CreateSceneCommand(const QVector<InstanceContainer> &instanceContainer,
+ const QVector<ReparentContainer> &reparentContainer,
+ const QVector<IdContainer> &idVector,
+ const QVector<PropertyValueContainer> &valueChangeVector,
+ const QVector<PropertyBindingContainer> &bindingChangeVector,
+ const QVector<PropertyValueContainer> &auxiliaryChangeVector,
+ const QVector<AddImportContainer> &importVector,
+ const QVector<MockupTypeContainer> &mockupTypeVector,
+ const QUrl &fileUrl,
+ const QHash<QString, QVariantMap> &edit3dToolStates,
+ const QString &language,
+ qint32 stateInstanceId)
+ : instances(instanceContainer)
+ , reparentInstances(reparentContainer)
+ , ids(idVector)
+ , valueChanges(valueChangeVector)
+ , bindingChanges(bindingChangeVector)
+ , auxiliaryChanges(auxiliaryChangeVector)
+ , imports(importVector)
+ , mockupTypes(mockupTypeVector)
+ , fileUrl(fileUrl)
+ , edit3dToolStates(edit3dToolStates)
+ , language(language)
+ , stateInstanceId{stateInstanceId}
+ {}
+
+ friend QDataStream &operator<<(QDataStream &out, const CreateSceneCommand &command)
+ {
+ out << command.instances;
+ out << command.reparentInstances;
+ out << command.ids;
+ out << command.valueChanges;
+ out << command.bindingChanges;
+ out << command.auxiliaryChanges;
+ out << command.imports;
+ out << command.mockupTypes;
+ out << command.fileUrl;
+ out << command.edit3dToolStates;
+ out << command.language;
+ out << command.stateInstanceId;
+
+ return out;
+ }
- QVector<InstanceContainer> instances() const;
- QVector<ReparentContainer> reparentInstances() const;
- QVector<IdContainer> ids() const;
- QVector<PropertyValueContainer> valueChanges() const;
- QVector<PropertyBindingContainer> bindingChanges() const;
- QVector<PropertyValueContainer> auxiliaryChanges() const;
- QVector<AddImportContainer> imports() const;
- QVector<MockupTypeContainer> mockupTypes() const;
- QUrl fileUrl() const;
- QHash<QString, QVariantMap> edit3dToolStates() const;
- QString language() const;
+ friend QDataStream &operator>>(QDataStream &in, CreateSceneCommand &command)
+ {
+ in >> command.instances;
+ in >> command.reparentInstances;
+ in >> command.ids;
+ in >> command.valueChanges;
+ in >> command.bindingChanges;
+ in >> command.auxiliaryChanges;
+ in >> command.imports;
+ in >> command.mockupTypes;
+ in >> command.fileUrl;
+ in >> command.edit3dToolStates;
+ in >> command.language;
+ in >> command.stateInstanceId;
-private:
- QVector<InstanceContainer> m_instanceVector;
- QVector<ReparentContainer> m_reparentInstanceVector;
- QVector<IdContainer> m_idVector;
- QVector<PropertyValueContainer> m_valueChangeVector;
- QVector<PropertyBindingContainer> m_bindingChangeVector;
- QVector<PropertyValueContainer> m_auxiliaryChangeVector;
- QVector<AddImportContainer> m_importVector;
- QVector<MockupTypeContainer> m_mockupTypeVector;
- QUrl m_fileUrl;
- QHash<QString, QVariantMap> m_edit3dToolStates;
- QString m_language;
+ return in;
+ }
+
+public:
+ QVector<InstanceContainer> instances;
+ QVector<ReparentContainer> reparentInstances;
+ QVector<IdContainer> ids;
+ QVector<PropertyValueContainer> valueChanges;
+ QVector<PropertyBindingContainer> bindingChanges;
+ QVector<PropertyValueContainer> auxiliaryChanges;
+ QVector<AddImportContainer> imports;
+ QVector<MockupTypeContainer> mockupTypes;
+ QUrl fileUrl;
+ QHash<QString, QVariantMap> edit3dToolStates;
+ QString language;
+ qint32 stateInstanceId = 0;
};
-QDataStream &operator<<(QDataStream &out, const CreateSceneCommand &command);
-QDataStream &operator>>(QDataStream &in, CreateSceneCommand &command);
+QDebug operator<<(QDebug debug, const CreateSceneCommand &command);
-QDebug operator <<(QDebug debug, const CreateSceneCommand &command);
-}
+} // namespace QmlDesigner
Q_DECLARE_METATYPE(QmlDesigner::CreateSceneCommand)
diff --git a/share/qtcreator/qml/qmlpuppet/commands/puppettocreatorcommand.h b/share/qtcreator/qml/qmlpuppet/commands/puppettocreatorcommand.h
index a713656bde..dc125d4ead 100644
--- a/share/qtcreator/qml/qmlpuppet/commands/puppettocreatorcommand.h
+++ b/share/qtcreator/qml/qmlpuppet/commands/puppettocreatorcommand.h
@@ -34,7 +34,7 @@ namespace QmlDesigner {
class PuppetToCreatorCommand
{
public:
- enum Type { Edit3DToolState, Render3DView, ActiveSceneChanged, None };
+ enum Type { Edit3DToolState, Render3DView, ActiveSceneChanged, RenderModelNodePreviewImage, None };
PuppetToCreatorCommand(Type type, const QVariant &data);
PuppetToCreatorCommand() = default;
diff --git a/share/qtcreator/qml/qmlpuppet/commands/requestmodelnodepreviewimagecommand.cpp b/share/qtcreator/qml/qmlpuppet/commands/requestmodelnodepreviewimagecommand.cpp
new file mode 100644
index 0000000000..265b7fd917
--- /dev/null
+++ b/share/qtcreator/qml/qmlpuppet/commands/requestmodelnodepreviewimagecommand.cpp
@@ -0,0 +1,93 @@
+/****************************************************************************
+**
+** Copyright (C) 2020 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of Qt Creator.
+**
+** 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 General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3 as published by the Free Software
+** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
+** 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-3.0.html.
+**
+****************************************************************************/
+
+#include "requestmodelnodepreviewimagecommand.h"
+
+#include <QDataStream>
+#include <QDebug>
+
+namespace QmlDesigner {
+
+RequestModelNodePreviewImageCommand::RequestModelNodePreviewImageCommand() = default;
+
+RequestModelNodePreviewImageCommand::RequestModelNodePreviewImageCommand(qint32 id, const QSize &size,
+ const QString &componentPath,
+ qint32 renderItemId)
+ : m_instanceId(id)
+ , m_size(size)
+ , m_componentPath(componentPath)
+ , m_renderItemId(renderItemId)
+{
+}
+
+qint32 RequestModelNodePreviewImageCommand::instanceId() const
+{
+ return m_instanceId;
+}
+
+QSize QmlDesigner::RequestModelNodePreviewImageCommand::size() const
+{
+ return m_size;
+}
+
+QString RequestModelNodePreviewImageCommand::componentPath() const
+{
+ return m_componentPath;
+}
+
+qint32 RequestModelNodePreviewImageCommand::renderItemId() const
+{
+ return m_renderItemId;
+}
+
+QDataStream &operator<<(QDataStream &out, const RequestModelNodePreviewImageCommand &command)
+{
+ out << int(command.instanceId());
+ out << command.size();
+ out << command.componentPath();
+ out << command.renderItemId();
+
+ return out;
+}
+
+QDataStream &operator>>(QDataStream &in, RequestModelNodePreviewImageCommand &command)
+{
+ in >> command.m_instanceId;
+ in >> command.m_size;
+ in >> command.m_componentPath;
+ in >> command.m_renderItemId;
+ return in;
+}
+
+QDebug operator <<(QDebug debug, const RequestModelNodePreviewImageCommand &command)
+{
+ return debug.nospace() << "RequestModelNodePreviewImageCommand("
+ << "instanceId: " << command.instanceId() << ", "
+ << "size: " << command.size() << ", "
+ << "componentPath: " << command.componentPath() << ", "
+ << "renderItemId: " << command.renderItemId() << ")";
+}
+
+} // namespace QmlDesigner
diff --git a/share/qtcreator/qml/qmlpuppet/commands/requestmodelnodepreviewimagecommand.h b/share/qtcreator/qml/qmlpuppet/commands/requestmodelnodepreviewimagecommand.h
new file mode 100644
index 0000000000..91ef0eddba
--- /dev/null
+++ b/share/qtcreator/qml/qmlpuppet/commands/requestmodelnodepreviewimagecommand.h
@@ -0,0 +1,65 @@
+/****************************************************************************
+**
+** Copyright (C) 2020 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of Qt Creator.
+**
+** 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 General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3 as published by the Free Software
+** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
+** 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-3.0.html.
+**
+****************************************************************************/
+
+#pragma once
+
+#include <QtCore/qmetatype.h>
+#include <QtCore/qdatastream.h>
+#include <QtGui/qevent.h>
+
+#include "instancecontainer.h"
+
+namespace QmlDesigner {
+
+class RequestModelNodePreviewImageCommand
+{
+ friend QDataStream &operator>>(QDataStream &in, RequestModelNodePreviewImageCommand &command);
+ friend QDebug operator <<(QDebug debug, const RequestModelNodePreviewImageCommand &command);
+
+public:
+ RequestModelNodePreviewImageCommand();
+ explicit RequestModelNodePreviewImageCommand(qint32 id, const QSize &size,
+ const QString &componentPath, qint32 renderItemId);
+
+ qint32 instanceId() const;
+ QSize size() const;
+ QString componentPath() const;
+ qint32 renderItemId() const;
+
+private:
+ qint32 m_instanceId;
+ QSize m_size;
+ QString m_componentPath;
+ qint32 m_renderItemId;
+};
+
+QDataStream &operator<<(QDataStream &out, const RequestModelNodePreviewImageCommand &command);
+QDataStream &operator>>(QDataStream &in, RequestModelNodePreviewImageCommand &command);
+
+QDebug operator <<(QDebug debug, const RequestModelNodePreviewImageCommand &command);
+
+} // namespace QmlDesigner
+
+Q_DECLARE_METATYPE(QmlDesigner::RequestModelNodePreviewImageCommand)
diff --git a/share/qtcreator/qml/qmlpuppet/commands/valueschangedcommand.cpp b/share/qtcreator/qml/qmlpuppet/commands/valueschangedcommand.cpp
index 22482c8178..530447cb94 100644
--- a/share/qtcreator/qml/qmlpuppet/commands/valueschangedcommand.cpp
+++ b/share/qtcreator/qml/qmlpuppet/commands/valueschangedcommand.cpp
@@ -26,8 +26,10 @@
#include "valueschangedcommand.h"
#include "sharedmemory.h"
+
#include <QCache>
#include <QDebug>
+#include <QIODevice>
#include <cstring>
@@ -107,7 +109,11 @@ QDataStream &operator<<(QDataStream &out, const ValuesChangedCommand &command)
++keyCounter;
command.m_keyNumber = keyCounter;
QByteArray outDataStreamByteArray;
+#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
QDataStream temporaryOutDataStream(&outDataStreamByteArray, QIODevice::WriteOnly);
+#else
+ QDataStream temporaryOutDataStream(&outDataStreamByteArray, QDataStream::WriteOnly);
+#endif
temporaryOutDataStream.setVersion(QDataStream::Qt_4_8);
temporaryOutDataStream << propertyValueContainer;
diff --git a/share/qtcreator/qml/qmlpuppet/images/non-visual-component.png b/share/qtcreator/qml/qmlpuppet/images/non-visual-component.png
new file mode 100644
index 0000000000..f66e2b8b11
--- /dev/null
+++ b/share/qtcreator/qml/qmlpuppet/images/non-visual-component.png
Binary files differ
diff --git a/share/qtcreator/qml/qmlpuppet/images/non-visual-component@2x.png b/share/qtcreator/qml/qmlpuppet/images/non-visual-component@2x.png
new file mode 100644
index 0000000000..25a136ff25
--- /dev/null
+++ b/share/qtcreator/qml/qmlpuppet/images/non-visual-component@2x.png
Binary files differ
diff --git a/share/qtcreator/qml/qmlpuppet/instances/nodeinstanceclientproxy.cpp b/share/qtcreator/qml/qmlpuppet/instances/nodeinstanceclientproxy.cpp
index 67f9efe987..ded21b71cf 100644
--- a/share/qtcreator/qml/qmlpuppet/instances/nodeinstanceclientproxy.cpp
+++ b/share/qtcreator/qml/qmlpuppet/instances/nodeinstanceclientproxy.cpp
@@ -75,10 +75,11 @@
#include "update3dviewstatecommand.h"
#include "valueschangedcommand.h"
#include "view3dactioncommand.h"
+#include "requestmodelnodepreviewimagecommand.h"
namespace QmlDesigner {
-constexpr void (QLocalSocket::*LocalSocketErrorFunction)(QLocalSocket::LocalSocketError)
+void (QLocalSocket::*LocalSocketErrorFunction)(QLocalSocket::LocalSocketError)
#if QT_VERSION < QT_VERSION_CHECK(5, 15, 0)
= &QLocalSocket::error;
#else
@@ -339,6 +340,11 @@ void NodeInstanceClientProxy::view3DAction(const View3DActionCommand &command)
nodeInstanceServer()->view3DAction(command);
}
+void NodeInstanceClientProxy::requestModelNodePreviewImage(const RequestModelNodePreviewImageCommand &command)
+{
+ nodeInstanceServer()->requestModelNodePreviewImage(command);
+}
+
void NodeInstanceClientProxy::changeLanguage(const ChangeLanguageCommand &command)
{
nodeInstanceServer()->changeLanguage(command);
@@ -516,6 +522,7 @@ void NodeInstanceClientProxy::dispatchCommand(const QVariant &command)
static const int changeSelectionCommandType = QMetaType::type("ChangeSelectionCommand");
static const int inputEventCommandType = QMetaType::type("InputEventCommand");
static const int view3DActionCommandType = QMetaType::type("View3DActionCommand");
+ static const int requestModelNodePreviewImageCommandType = QMetaType::type("RequestModelNodePreviewImageCommand");
static const int changeLanguageCommand = QMetaType::type("ChangeLanguageCommand");
static const int changePreviewImageSizeCommand = QMetaType::type(
"ChangePreviewImageSizeCommand");
@@ -562,6 +569,8 @@ void NodeInstanceClientProxy::dispatchCommand(const QVariant &command)
redirectToken(command.value<EndPuppetCommand>());
else if (commandType == view3DActionCommandType)
view3DAction(command.value<View3DActionCommand>());
+ else if (commandType == requestModelNodePreviewImageCommandType)
+ requestModelNodePreviewImage(command.value<RequestModelNodePreviewImageCommand>());
else if (commandType == synchronizeCommandType) {
SynchronizeCommand synchronizeCommand = command.value<SynchronizeCommand>();
m_synchronizeId = synchronizeCommand.synchronizeId();
diff --git a/share/qtcreator/qml/qmlpuppet/instances/nodeinstanceclientproxy.h b/share/qtcreator/qml/qmlpuppet/instances/nodeinstanceclientproxy.h
index 11658c5dd5..f4471b3470 100644
--- a/share/qtcreator/qml/qmlpuppet/instances/nodeinstanceclientproxy.h
+++ b/share/qtcreator/qml/qmlpuppet/instances/nodeinstanceclientproxy.h
@@ -63,6 +63,7 @@ class ChangeSelectionCommand;
class PuppetToCreatorCommand;
class InputEventCommand;
class View3DActionCommand;
+class RequestModelNodePreviewImageCommand;
class ChangeLanguageCommand;
class ChangePreviewImageSizeCommand;
@@ -123,6 +124,7 @@ protected:
static QVariant readCommandFromIOStream(QIODevice *ioDevice, quint32 *readCommandCounter, quint32 *blockSize);
void inputEvent(const InputEventCommand &command);
void view3DAction(const View3DActionCommand &command);
+ void requestModelNodePreviewImage(const RequestModelNodePreviewImageCommand &command);
void changeLanguage(const ChangeLanguageCommand &command);
void changePreviewImageSize(const ChangePreviewImageSizeCommand &command);
diff --git a/share/qtcreator/qml/qmlpuppet/interfaces/nodeinstanceserverinterface.cpp b/share/qtcreator/qml/qmlpuppet/interfaces/nodeinstanceserverinterface.cpp
index 638308af11..184265951e 100644
--- a/share/qtcreator/qml/qmlpuppet/interfaces/nodeinstanceserverinterface.cpp
+++ b/share/qtcreator/qml/qmlpuppet/interfaces/nodeinstanceserverinterface.cpp
@@ -67,6 +67,7 @@
#include "update3dviewstatecommand.h"
#include "valueschangedcommand.h"
#include "view3dactioncommand.h"
+#include "requestmodelnodepreviewimagecommand.h"
#include <enumeration.h>
@@ -80,6 +81,15 @@ NodeInstanceServerInterface::NodeInstanceServerInterface(QObject *parent) :
registerCommands();
}
+template<typename T>
+inline void registerCommand(const char *typeName)
+{
+ qRegisterMetaType<T>(typeName);
+#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
+ qRegisterMetaTypeStreamOperators<T>(typeName);
+#endif
+}
+
void NodeInstanceServerInterface::registerCommands()
{
if (isRegistered)
@@ -87,146 +97,54 @@ void NodeInstanceServerInterface::registerCommands()
isRegistered = true;
- qRegisterMetaType<CreateInstancesCommand>("CreateInstancesCommand");
- qRegisterMetaTypeStreamOperators<CreateInstancesCommand>("CreateInstancesCommand");
-
- qRegisterMetaType<ClearSceneCommand>("ClearSceneCommand");
- qRegisterMetaTypeStreamOperators<ClearSceneCommand>("ClearSceneCommand");
-
- qRegisterMetaType<CreateSceneCommand>("CreateSceneCommand");
- qRegisterMetaTypeStreamOperators<CreateSceneCommand>("CreateSceneCommand");
-
- qRegisterMetaType<Update3dViewStateCommand>("Update3dViewStateCommand");
- qRegisterMetaTypeStreamOperators<Update3dViewStateCommand>("Update3dViewStateCommand");
-
- qRegisterMetaType<ChangeBindingsCommand>("ChangeBindingsCommand");
- qRegisterMetaTypeStreamOperators<ChangeBindingsCommand>("ChangeBindingsCommand");
-
- qRegisterMetaType<ChangeValuesCommand>("ChangeValuesCommand");
- qRegisterMetaTypeStreamOperators<ChangeValuesCommand>("ChangeValuesCommand");
-
- qRegisterMetaType<ChangeFileUrlCommand>("ChangeFileUrlCommand");
- qRegisterMetaTypeStreamOperators<ChangeFileUrlCommand>("ChangeFileUrlCommand");
-
- qRegisterMetaType<ChangeStateCommand>("ChangeStateCommand");
- qRegisterMetaTypeStreamOperators<ChangeStateCommand>("ChangeStateCommand");
-
- qRegisterMetaType<RemoveInstancesCommand>("RemoveInstancesCommand");
- qRegisterMetaTypeStreamOperators<RemoveInstancesCommand>("RemoveInstancesCommand");
-
- qRegisterMetaType<ChangeSelectionCommand>("ChangeSelectionCommand");
- qRegisterMetaTypeStreamOperators<ChangeSelectionCommand>("ChangeSelectionCommand");
-
- qRegisterMetaType<RemovePropertiesCommand>("RemovePropertiesCommand");
- qRegisterMetaTypeStreamOperators<RemovePropertiesCommand>("RemovePropertiesCommand");
-
- qRegisterMetaType<ReparentInstancesCommand>("ReparentInstancesCommand");
- qRegisterMetaTypeStreamOperators<ReparentInstancesCommand>("ReparentInstancesCommand");
-
- qRegisterMetaType<ChangeIdsCommand>("ChangeIdsCommand");
- qRegisterMetaTypeStreamOperators<ChangeIdsCommand>("ChangeIdsCommand");
-
- qRegisterMetaType<PropertyAbstractContainer>("PropertyAbstractContainer");
- qRegisterMetaTypeStreamOperators<PropertyAbstractContainer>("PropertyAbstractContainer");
-
- qRegisterMetaType<InformationChangedCommand>("InformationChangedCommand");
- qRegisterMetaTypeStreamOperators<InformationChangedCommand>("InformationChangedCommand");
-
- qRegisterMetaType<ValuesChangedCommand>("ValuesChangedCommand");
- qRegisterMetaTypeStreamOperators<ValuesChangedCommand>("ValuesChangedCommand");
-
- qRegisterMetaType<ValuesModifiedCommand>("ValuesModifiedCommand");
- qRegisterMetaTypeStreamOperators<ValuesModifiedCommand>("ValuesModifiedCommand");
-
- qRegisterMetaType<PixmapChangedCommand>("PixmapChangedCommand");
- qRegisterMetaTypeStreamOperators<PixmapChangedCommand>("PixmapChangedCommand");
-
- qRegisterMetaType<InformationContainer>("InformationContainer");
- qRegisterMetaTypeStreamOperators<InformationContainer>("InformationContainer");
-
- qRegisterMetaType<PropertyValueContainer>("PropertyValueContainer");
- qRegisterMetaTypeStreamOperators<PropertyValueContainer>("PropertyValueContainer");
-
- qRegisterMetaType<PropertyBindingContainer>("PropertyBindingContainer");
- qRegisterMetaTypeStreamOperators<PropertyBindingContainer>("PropertyBindingContainer");
-
- qRegisterMetaType<PropertyAbstractContainer>("PropertyAbstractContainer");
- qRegisterMetaTypeStreamOperators<PropertyAbstractContainer>("PropertyAbstractContainer");
-
- qRegisterMetaType<InstanceContainer>("InstanceContainer");
- qRegisterMetaTypeStreamOperators<InstanceContainer>("InstanceContainer");
-
- qRegisterMetaType<IdContainer>("IdContainer");
- qRegisterMetaTypeStreamOperators<IdContainer>("IdContainer");
-
- qRegisterMetaType<ChildrenChangedCommand>("ChildrenChangedCommand");
- qRegisterMetaTypeStreamOperators<ChildrenChangedCommand>("ChildrenChangedCommand");
-
- qRegisterMetaType<ImageContainer>("ImageContainer");
- qRegisterMetaTypeStreamOperators<ImageContainer>("ImageContainer");
-
- qRegisterMetaType<StatePreviewImageChangedCommand>("StatePreviewImageChangedCommand");
- qRegisterMetaTypeStreamOperators<StatePreviewImageChangedCommand>("StatePreviewImageChangedCommand");
-
- qRegisterMetaType<CompleteComponentCommand>("CompleteComponentCommand");
- qRegisterMetaTypeStreamOperators<CompleteComponentCommand>("CompleteComponentCommand");
-
- qRegisterMetaType<ComponentCompletedCommand>("ComponentCompletedCommand");
- qRegisterMetaTypeStreamOperators<ComponentCompletedCommand>("ComponentCompletedCommand");
-
- qRegisterMetaType<AddImportContainer>("AddImportContainer");
- qRegisterMetaTypeStreamOperators<AddImportContainer>("AddImportContainer");
-
- qRegisterMetaType<SynchronizeCommand>("SynchronizeCommand");
- qRegisterMetaTypeStreamOperators<SynchronizeCommand>("SynchronizeCommand");
-
- qRegisterMetaType<ChangeNodeSourceCommand>("ChangeNodeSourceCommand");
- qRegisterMetaTypeStreamOperators<ChangeNodeSourceCommand>("ChangeNodeSourceCommand");
-
- qRegisterMetaType<ChangeAuxiliaryCommand>("ChangeAuxiliaryCommand");
- qRegisterMetaTypeStreamOperators<ChangeAuxiliaryCommand>("ChangeAuxiliaryCommand");
-
- qRegisterMetaType<TokenCommand>("TokenCommand");
- qRegisterMetaTypeStreamOperators<TokenCommand>("TokenCommand");
-
- qRegisterMetaType<RemoveSharedMemoryCommand>("RemoveSharedMemoryCommand");
- qRegisterMetaTypeStreamOperators<RemoveSharedMemoryCommand>("RemoveSharedMemoryCommand");
-
- qRegisterMetaType<EndPuppetCommand>("EndPuppetCommand");
- qRegisterMetaTypeStreamOperators<EndPuppetCommand>("EndPuppetCommand");
-
- qRegisterMetaType<DebugOutputCommand>("DebugOutputCommand");
- qRegisterMetaTypeStreamOperators<DebugOutputCommand>("DebugOutputCommand");
-
- qRegisterMetaType<Enumeration>("Enumeration");
- qRegisterMetaTypeStreamOperators<Enumeration>("Enumeration");
-
- qRegisterMetaType<PuppetAliveCommand>("PuppetAliveCommand");
- qRegisterMetaTypeStreamOperators<PuppetAliveCommand>("PuppetAliveCommand");
-
- qRegisterMetaType<PuppetToCreatorCommand>("PuppetToCreatorCommand");
- qRegisterMetaTypeStreamOperators<PuppetToCreatorCommand>("PuppetToCreatorCommand");
-
- qRegisterMetaType<InputEventCommand>("InputEventCommand");
- qRegisterMetaTypeStreamOperators<InputEventCommand>("InputEventCommand");
-
- qRegisterMetaType<View3DActionCommand>("View3DActionCommand");
- qRegisterMetaTypeStreamOperators<View3DActionCommand>("View3DActionCommand");
-
- qRegisterMetaType<QPair<int, int>>("QPairIntInt");
- qRegisterMetaTypeStreamOperators<QPair<int, int>>("QPairIntInt");
-
- qRegisterMetaType<ChangeLanguageCommand>("ChangeLanguageCommand");
- qRegisterMetaTypeStreamOperators<ChangeLanguageCommand>("ChangeLanguageCommand");
-
- qRegisterMetaType<ChangePreviewImageSizeCommand>("ChangePreviewImageSizeCommand");
- qRegisterMetaTypeStreamOperators<ChangePreviewImageSizeCommand>("ChangePreviewImageSizeCommand");
-
- qRegisterMetaType<CapturedDataCommand>("CapturedDataCommand");
- qRegisterMetaTypeStreamOperators<CapturedDataCommand>("CapturedDataCommand");
-
- qRegisterMetaType<SceneCreatedCommand>("SceneCreatedCommand");
- qRegisterMetaTypeStreamOperators<SceneCreatedCommand>("SceneCreatedCommand");
+ registerCommand<CreateInstancesCommand>("CreateInstancesCommand");
+ registerCommand<ClearSceneCommand>("ClearSceneCommand");
+ registerCommand<CreateSceneCommand>("CreateSceneCommand");
+ registerCommand<Update3dViewStateCommand>("Update3dViewStateCommand");
+ registerCommand<ChangeBindingsCommand>("ChangeBindingsCommand");
+ registerCommand<ChangeValuesCommand>("ChangeValuesCommand");
+ registerCommand<ChangeFileUrlCommand>("ChangeFileUrlCommand");
+ registerCommand<ChangeStateCommand>("ChangeStateCommand");
+ registerCommand<RemoveInstancesCommand>("RemoveInstancesCommand");
+ registerCommand<ChangeSelectionCommand>("ChangeSelectionCommand");
+ registerCommand<RemovePropertiesCommand>("RemovePropertiesCommand");
+ registerCommand<ReparentInstancesCommand>("ReparentInstancesCommand");
+ registerCommand<ChangeIdsCommand>("ChangeIdsCommand");
+ registerCommand<PropertyAbstractContainer>("PropertyAbstractContainer");
+ registerCommand<InformationChangedCommand>("InformationChangedCommand");
+ registerCommand<ValuesChangedCommand>("ValuesChangedCommand");
+ registerCommand<ValuesModifiedCommand>("ValuesModifiedCommand");
+ registerCommand<PixmapChangedCommand>("PixmapChangedCommand");
+ registerCommand<InformationContainer>("InformationContainer");
+ registerCommand<PropertyValueContainer>("PropertyValueContainer");
+ registerCommand<PropertyBindingContainer>("PropertyBindingContainer");
+ registerCommand<PropertyAbstractContainer>("PropertyAbstractContainer");
+ registerCommand<InstanceContainer>("InstanceContainer");
+ registerCommand<IdContainer>("IdContainer");
+ registerCommand<ChildrenChangedCommand>("ChildrenChangedCommand");
+ registerCommand<ImageContainer>("ImageContainer");
+ registerCommand<StatePreviewImageChangedCommand>("StatePreviewImageChangedCommand");
+ registerCommand<CompleteComponentCommand>("CompleteComponentCommand");
+ registerCommand<ComponentCompletedCommand>("ComponentCompletedCommand");
+ registerCommand<AddImportContainer>("AddImportContainer");
+ registerCommand<SynchronizeCommand>("SynchronizeCommand");
+ registerCommand<ChangeNodeSourceCommand>("ChangeNodeSourceCommand");
+ registerCommand<ChangeAuxiliaryCommand>("ChangeAuxiliaryCommand");
+ registerCommand<TokenCommand>("TokenCommand");
+ registerCommand<RemoveSharedMemoryCommand>("RemoveSharedMemoryCommand");
+ registerCommand<EndPuppetCommand>("EndPuppetCommand");
+ registerCommand<DebugOutputCommand>("DebugOutputCommand");
+ registerCommand<Enumeration>("Enumeration");
+ registerCommand<PuppetAliveCommand>("PuppetAliveCommand");
+ registerCommand<PuppetToCreatorCommand>("PuppetToCreatorCommand");
+ registerCommand<InputEventCommand>("InputEventCommand");
+ registerCommand<View3DActionCommand>("View3DActionCommand");
+ registerCommand<RequestModelNodePreviewImageCommand>("RequestModelNodePreviewImageCommand");
+ registerCommand<QPair<int, int>>("QPairIntInt");
+ registerCommand<ChangeLanguageCommand>("ChangeLanguageCommand");
+ registerCommand<ChangePreviewImageSizeCommand>("ChangePreviewImageSizeCommand");
+ registerCommand<CapturedDataCommand>("CapturedDataCommand");
+ registerCommand<SceneCreatedCommand>("SceneCreatedCommand");
}
}
diff --git a/share/qtcreator/qml/qmlpuppet/interfaces/nodeinstanceserverinterface.h b/share/qtcreator/qml/qmlpuppet/interfaces/nodeinstanceserverinterface.h
index 39eb2618d6..b4ffb74903 100644
--- a/share/qtcreator/qml/qmlpuppet/interfaces/nodeinstanceserverinterface.h
+++ b/share/qtcreator/qml/qmlpuppet/interfaces/nodeinstanceserverinterface.h
@@ -53,6 +53,7 @@ class RemoveSharedMemoryCommand;
class ChangeSelectionCommand;
class InputEventCommand;
class View3DActionCommand;
+class RequestModelNodePreviewImageCommand;
class ChangeLanguageCommand;
class ChangePreviewImageSizeCommand;
@@ -82,8 +83,10 @@ public:
virtual void changeSelection(const ChangeSelectionCommand &command) = 0;
virtual void inputEvent(const InputEventCommand &command) = 0;
virtual void view3DAction(const View3DActionCommand &command) = 0;
+ virtual void requestModelNodePreviewImage(const RequestModelNodePreviewImageCommand &command) = 0;
virtual void changeLanguage(const ChangeLanguageCommand &command) = 0;
virtual void changePreviewImageSize(const ChangePreviewImageSizeCommand &command) = 0;
+ virtual void dispatchCommand(const QVariant &) {}
virtual void benchmark(const QString &) {}
diff --git a/share/qtcreator/qml/qmlpuppet/mockfiles/CameraGizmo.qml b/share/qtcreator/qml/qmlpuppet/mockfiles/CameraGizmo.qml
index e522a60cf4..a108190ff7 100644
--- a/share/qtcreator/qml/qmlpuppet/mockfiles/CameraGizmo.qml
+++ b/share/qtcreator/qml/qmlpuppet/mockfiles/CameraGizmo.qml
@@ -46,8 +46,8 @@ IconGizmo {
frustum.targetNode = targetNode;
frustum.targetNode = Qt.binding(function() {return targetNode;});
- frustum.visible = visible;
- frustum.visible = Qt.binding(function() {return visible;});
+ frustum.visible = visible || (targetNode && selected && activeScene === scene);
+ frustum.visible = Qt.binding(function() {return visible || (targetNode && selected && activeScene === scene);});
}
onActiveSceneChanged: {
diff --git a/share/qtcreator/qml/qmlpuppet/mockfiles/EditCameraController.qml b/share/qtcreator/qml/qmlpuppet/mockfiles/EditCameraController.qml
index 20dd112d61..1379369953 100644
--- a/share/qtcreator/qml/qmlpuppet/mockfiles/EditCameraController.qml
+++ b/share/qtcreator/qml/qmlpuppet/mockfiles/EditCameraController.qml
@@ -46,10 +46,11 @@ Item {
readonly property vector3d _defaultCameraPosition: Qt.vector3d(0, 600, 600)
readonly property vector3d _defaultCameraRotation: Qt.vector3d(-45, 0, 0)
readonly property real _defaultCameraLookAtDistance: _defaultCameraPosition.length()
+ property bool ignoreToolState: false
function restoreCameraState(cameraState)
{
- if (!camera)
+ if (!camera || ignoreToolState)
return;
_lookAtPoint = cameraState[0];
@@ -75,7 +76,7 @@ Item {
function storeCameraState(delay)
{
- if (!camera)
+ if (!camera || ignoreToolState)
return;
var cameraState = [];
diff --git a/share/qtcreator/qml/qmlpuppet/mockfiles/EditView3D.qml b/share/qtcreator/qml/qmlpuppet/mockfiles/EditView3D.qml
index 95245aae5e..002ed7bc04 100644
--- a/share/qtcreator/qml/qmlpuppet/mockfiles/EditView3D.qml
+++ b/share/qtcreator/qml/qmlpuppet/mockfiles/EditView3D.qml
@@ -25,8 +25,6 @@
import QtQuick 2.12
import QtQuick3D 1.15
-import QtQuick.Controls 2.0
-import QtGraphicalEffects 1.0
import MouseArea3D 1.0
Item {
@@ -100,6 +98,7 @@ Item {
if (editView) {
// Destroy is async, so make sure we don't get any more updates for the old editView
_generalHelper.enableItemUpdate(editView, false);
+ editView.visible = false;
editView.destroy();
}
@@ -264,11 +263,16 @@ Item {
function handleObjectClicked(object, multi)
{
- var theObject = object;
+ var clickedObject;
+
+ // Click on locked object is treated same as click on empty space
+ if (!_generalHelper.isLocked(object))
+ clickedObject = object;
+
if (selectionMode === EditView3D.SelectionMode.Group) {
- while (theObject && theObject !== activeScene
- && (activeScene instanceof Model || theObject.parent !== activeScene)) {
- theObject = theObject.parent;
+ while (clickedObject && clickedObject !== activeScene
+ && (activeScene instanceof Model || clickedObject.parent !== activeScene)) {
+ clickedObject = clickedObject.parent;
}
}
// Object selection logic:
@@ -277,20 +281,20 @@ Item {
// One or more objects selected: Multiselect
// Null object always clears entire selection
var newSelection = [];
- if (object !== null) {
+ if (clickedObject) {
if (multi && selectedNodes.length > 0) {
var deselect = false;
for (var i = 0; i < selectedNodes.length; ++i) {
// Multiselecting already selected object clears that object from selection
- if (selectedNodes[i] !== object)
+ if (selectedNodes[i] !== clickedObject)
newSelection[newSelection.length] = selectedNodes[i];
else
deselect = true;
}
if (!deselect)
- newSelection[newSelection.length] = object;
+ newSelection[newSelection.length] = clickedObject;
} else {
- newSelection[0] = theObject;
+ newSelection[0] = clickedObject;
}
}
selectObjects(newSelection);
@@ -299,22 +303,36 @@ Item {
function addLightGizmo(scene, obj)
{
- // Insert into first available gizmo
+ // Insert into first available gizmo if we don't already have gizmo for this object
+ var slotFound = -1;
for (var i = 0; i < lightIconGizmos.length; ++i) {
if (!lightIconGizmos[i].targetNode) {
+ slotFound = i;
+ } else if (lightIconGizmos[i].targetNode === obj) {
lightIconGizmos[i].scene = scene;
- lightIconGizmos[i].targetNode = obj;
return;
}
}
+ if (slotFound !== -1) {
+ lightIconGizmos[slotFound].scene = scene;
+ lightIconGizmos[slotFound].targetNode = obj;
+ lightIconGizmos[slotFound].locked = _generalHelper.isLocked(obj);
+ lightIconGizmos[slotFound].hidden = _generalHelper.isHidden(obj);
+ _generalHelper.registerGizmoTarget(obj);
+ return;
+ }
+
// No free gizmos available, create a new one
var gizmoComponent = Qt.createComponent("LightIconGizmo.qml");
if (gizmoComponent.status === Component.Ready) {
+ _generalHelper.registerGizmoTarget(obj);
var gizmo = gizmoComponent.createObject(overlayView,
{"view3D": overlayView, "targetNode": obj,
"selectedNodes": selectedNodes, "scene": scene,
- "activeScene": activeScene});
+ "activeScene": activeScene,
+ "locked": _generalHelper.isLocked(obj),
+ "hidden": _generalHelper.isHidden(obj)});
lightIconGizmos[lightIconGizmos.length] = gizmo;
gizmo.clicked.connect(handleObjectClicked);
gizmo.selectedNodes = Qt.binding(function() {return selectedNodes;});
@@ -324,18 +342,31 @@ Item {
function addCameraGizmo(scene, obj)
{
- // Insert into first available gizmo
+ // Insert into first available gizmo if we don't already have gizmo for this object
+ var slotFound = -1;
for (var i = 0; i < cameraGizmos.length; ++i) {
if (!cameraGizmos[i].targetNode) {
+ slotFound = i;
+ } else if (cameraGizmos[i].targetNode === obj) {
cameraGizmos[i].scene = scene;
- cameraGizmos[i].targetNode = obj;
return;
}
}
+
+ if (slotFound !== -1) {
+ cameraGizmos[slotFound].scene = scene;
+ cameraGizmos[slotFound].targetNode = obj;
+ cameraGizmos[slotFound].locked = _generalHelper.isLocked(obj);
+ cameraGizmos[slotFound].hidden = _generalHelper.isHidden(obj);
+ _generalHelper.registerGizmoTarget(obj);
+ return;
+ }
+
// No free gizmos available, create a new one
var gizmoComponent = Qt.createComponent("CameraGizmo.qml");
var frustumComponent = Qt.createComponent("CameraFrustum.qml");
if (gizmoComponent.status === Component.Ready && frustumComponent.status === Component.Ready) {
+ _generalHelper.registerGizmoTarget(obj);
var geometryName = _generalHelper.generateUniqueName("CameraGeometry");
var frustum = frustumComponent.createObject(
overlayScene,
@@ -343,7 +374,8 @@ Item {
var gizmo = gizmoComponent.createObject(
overlayView,
{"view3D": overlayView, "targetNode": obj,
- "selectedNodes": selectedNodes, "scene": scene, "activeScene": activeScene});
+ "selectedNodes": selectedNodes, "scene": scene, "activeScene": activeScene,
+ "locked": _generalHelper.isLocked(obj), "hidden": _generalHelper.isHidden(obj)});
cameraGizmos[cameraGizmos.length] = gizmo;
gizmo.clicked.connect(handleObjectClicked);
@@ -360,6 +392,7 @@ Item {
if (lightIconGizmos[i].targetNode === obj) {
lightIconGizmos[i].scene = null;
lightIconGizmos[i].targetNode = null;
+ _generalHelper.unregisterGizmoTarget(obj);
return;
}
}
@@ -371,6 +404,7 @@ Item {
if (cameraGizmos[i].targetNode === obj) {
cameraGizmos[i].scene = null;
cameraGizmos[i].targetNode = null;
+ _generalHelper.unregisterGizmoTarget(obj);
return;
}
}
@@ -407,6 +441,40 @@ Item {
onWidthChanged: _generalHelper.requestOverlayUpdate()
onHeightChanged: _generalHelper.requestOverlayUpdate()
+ Connections {
+ target: _generalHelper
+ function onLockedStateChanged(node)
+ {
+ for (var i = 0; i < cameraGizmos.length; ++i) {
+ if (cameraGizmos[i].targetNode === node) {
+ cameraGizmos[i].locked = _generalHelper.isLocked(node);
+ return;
+ }
+ }
+ for (var i = 0; i < lightIconGizmos.length; ++i) {
+ if (lightIconGizmos[i].targetNode === node) {
+ lightIconGizmos[i].locked = _generalHelper.isLocked(node);
+ return;
+ }
+ }
+ }
+ function onHiddenStateChanged(node)
+ {
+ for (var i = 0; i < cameraGizmos.length; ++i) {
+ if (cameraGizmos[i].targetNode === node) {
+ cameraGizmos[i].hidden = _generalHelper.isHidden(node);
+ return;
+ }
+ }
+ for (var i = 0; i < lightIconGizmos.length; ++i) {
+ if (lightIconGizmos[i].targetNode === node) {
+ lightIconGizmos[i].hidden = _generalHelper.isHidden(node);
+ return;
+ }
+ }
+ }
+ }
+
Node {
id: overlayScene
diff --git a/share/qtcreator/qml/qmlpuppet/mockfiles/EffectNodeView.qml b/share/qtcreator/qml/qmlpuppet/mockfiles/EffectNodeView.qml
new file mode 100644
index 0000000000..cb2e581021
--- /dev/null
+++ b/share/qtcreator/qml/qmlpuppet/mockfiles/EffectNodeView.qml
@@ -0,0 +1,65 @@
+/****************************************************************************
+**
+** Copyright (C) 2020 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of Qt Creator.
+**
+** 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 General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3 as published by the Free Software
+** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
+** 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-3.0.html.
+**
+****************************************************************************/
+
+import QtQuick3D 1.15
+import QtQuick3D.Effects 1.15
+
+View3D {
+ id: root
+ anchors.fill: parent
+ environment: sceneEnv
+
+ property Effect previewEffect
+
+ SceneEnvironment {
+ id: sceneEnv
+ antialiasingMode: SceneEnvironment.MSAA
+ antialiasingQuality: SceneEnvironment.High
+ effects: previewEffect
+ }
+
+ Node {
+ DirectionalLight {
+ eulerRotation.x: -30
+ eulerRotation.y: -30
+ }
+
+ PerspectiveCamera {
+ z: 120
+ clipFar: 1000
+ clipNear: 1
+ }
+
+ Model {
+ id: model
+ source: "#Sphere"
+ materials: [
+ DefaultMaterial {
+ diffuseColor: "#4aee45"
+ }
+ ]
+ }
+ }
+}
diff --git a/share/qtcreator/qml/qmlpuppet/mockfiles/IconGizmo.qml b/share/qtcreator/qml/qmlpuppet/mockfiles/IconGizmo.qml
index 10de1f224c..78f4190621 100644
--- a/share/qtcreator/qml/qmlpuppet/mockfiles/IconGizmo.qml
+++ b/share/qtcreator/qml/qmlpuppet/mockfiles/IconGizmo.qml
@@ -43,6 +43,8 @@ Item {
return false;
}
property bool hasMouse: false
+ property bool hidden: false
+ property bool locked: false
property alias iconSource: iconImage.source
@@ -53,7 +55,7 @@ Item {
hasMouse = false;
}
- visible: activeScene === scene && (targetNode ? targetNode.visible : false)
+ visible: activeScene === scene && !hidden && (targetNode ? targetNode.visible : false)
Overlay2D {
id: iconOverlay
@@ -70,7 +72,7 @@ Item {
y: -height / 2
color: "transparent"
border.color: "#7777ff"
- border.width: iconGizmo.highlightOnHover && iconGizmo.hasMouse ? 2 : 0
+ border.width: !iconGizmo.locked && iconGizmo.highlightOnHover && iconGizmo.hasMouse ? 2 : 0
radius: 5
opacity: iconGizmo.selected ? 0.2 : 1
Image {
diff --git a/share/qtcreator/qml/qmlpuppet/mockfiles/IconRenderer3D.qml b/share/qtcreator/qml/qmlpuppet/mockfiles/IconRenderer3D.qml
index 99c20047a4..8119c00f34 100644
--- a/share/qtcreator/qml/qmlpuppet/mockfiles/IconRenderer3D.qml
+++ b/share/qtcreator/qml/qmlpuppet/mockfiles/IconRenderer3D.qml
@@ -45,7 +45,7 @@ Item {
cameraControl.focusObject(selectionBox.model, viewCamera.eulerRotation, true, true);
if (cameraControl._zoomFactor < 0.1)
view3D.importScene.scale = view3D.importScene.scale.times(10);
- if (cameraControl._zoomFactor > 100)
+ if (cameraControl._zoomFactor > 10)
view3D.importScene.scale = view3D.importScene.scale.times(0.1);
selectionBox.visible = false;
@@ -82,6 +82,7 @@ Item {
id: cameraControl
camera: view3D.camera
view3d: view3D
+ ignoreToolState: true
}
}
}
diff --git a/share/qtcreator/qml/qmlpuppet/mockfiles/LightGizmo.qml b/share/qtcreator/qml/qmlpuppet/mockfiles/LightGizmo.qml
index 2e9791dc28..b69884cb7d 100644
--- a/share/qtcreator/qml/qmlpuppet/mockfiles/LightGizmo.qml
+++ b/share/qtcreator/qml/qmlpuppet/mockfiles/LightGizmo.qml
@@ -26,7 +26,7 @@
import QtQuick 2.0
import QtQuick3D 1.15
import MouseArea3D 1.0
-import LightGeometry 1.0
+import LightUtils 1.0
Node {
id: lightGizmo
@@ -35,7 +35,6 @@ Node {
property Node targetNode: null
property MouseArea3D dragHelper: null
property color color: Qt.rgba(1, 1, 0, 1)
- property real brightnessScale: targetNode ? Math.max(1.0, 1.0 + targetNode.brightness) : 100
property real fadeScale: {
// Value indicates area where intensity is above certain percent of total brightness.
if (lightGizmo.targetNode instanceof SpotLight || lightGizmo.targetNode instanceof PointLight) {
@@ -64,6 +63,8 @@ Node {
|| pointLightFadeHandle.dragging
property point currentMousePos
property string currentLabel
+ property int brightnessDecimals: _generalHelper.brightnessScaler() > 10. ? 0 : 2;
+ property real brightnessMultiplier: Math.pow(10, brightnessDecimals);
signal propertyValueCommit(string propName)
signal propertyValueChange(string propName)
@@ -226,7 +227,6 @@ Node {
onValueCommit: lightGizmo.propertyValueCommit(propName)
}
}
-
Node {
id: areaParts
visible: lightGizmo.targetNode instanceof AreaLight
@@ -305,15 +305,19 @@ Node {
active: lightGizmo.visible
dragHelper: lightGizmo.dragHelper
scale: autoScaler.getScale(Qt.vector3d(5, 5, 5))
- length: (lightGizmo.brightnessScale / 10) + 3
+ length: targetNode ? Math.max(1.0, 1.0 + targetNode.brightness / _generalHelper.brightnessScaler() * 10.0) + 3 : 10
property real _startBrightness
function updateBrightness(relativeDistance, screenPos)
{
- var currentValue = Math.round(Math.max(0, _startBrightness + relativeDistance * 10));
+ var currentValue = Math.max(0, (_startBrightness + relativeDistance * _generalHelper.brightnessScaler() / 10.0));
+ currentValue *= brightnessMultiplier;
+ currentValue = Math.round(currentValue);
+ currentValue /= brightnessMultiplier;
+
var l = Qt.locale();
- lightGizmo.currentLabel = "brightness" + qsTr(": ") + Number(currentValue).toLocaleString(l, 'f', 0);
+ lightGizmo.currentLabel = "brightness" + qsTr(": ") + Number(currentValue).toLocaleString(l, 'f', brightnessDecimals);
lightGizmo.currentMousePos = screenPos;
targetNode.brightness = currentValue;
}
diff --git a/share/qtcreator/qml/qmlpuppet/mockfiles/LightIconGizmo.qml b/share/qtcreator/qml/qmlpuppet/mockfiles/LightIconGizmo.qml
index 6f0d426c1f..8cbce4d1d9 100644
--- a/share/qtcreator/qml/qmlpuppet/mockfiles/LightIconGizmo.qml
+++ b/share/qtcreator/qml/qmlpuppet/mockfiles/LightIconGizmo.qml
@@ -25,6 +25,7 @@
import QtQuick 2.0
import QtQuick3D 1.15
+import LightUtils 1.0
IconGizmo {
id: lightIconGizmo
diff --git a/share/qtcreator/qml/qmlpuppet/mockfiles/LightModel.qml b/share/qtcreator/qml/qmlpuppet/mockfiles/LightModel.qml
index 9ccb3c49ae..3e42760ca1 100644
--- a/share/qtcreator/qml/qmlpuppet/mockfiles/LightModel.qml
+++ b/share/qtcreator/qml/qmlpuppet/mockfiles/LightModel.qml
@@ -25,7 +25,7 @@
import QtQuick 2.0
import QtQuick3D 1.15
-import LightGeometry 1.0
+import LightUtils 1.0
Model {
id: lightModel
diff --git a/share/qtcreator/qml/qmlpuppet/mockfiles/MaterialNodeView.qml b/share/qtcreator/qml/qmlpuppet/mockfiles/MaterialNodeView.qml
new file mode 100644
index 0000000000..f52bcf4bee
--- /dev/null
+++ b/share/qtcreator/qml/qmlpuppet/mockfiles/MaterialNodeView.qml
@@ -0,0 +1,59 @@
+/****************************************************************************
+**
+** Copyright (C) 2020 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of Qt Creator.
+**
+** 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 General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3 as published by the Free Software
+** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
+** 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-3.0.html.
+**
+****************************************************************************/
+
+import QtQuick3D 1.15
+
+View3D {
+ id: root
+ anchors.fill: parent
+ environment: sceneEnv
+
+ property Material previewMaterial
+
+ SceneEnvironment {
+ id: sceneEnv
+ antialiasingMode: SceneEnvironment.MSAA
+ antialiasingQuality: SceneEnvironment.High
+ }
+
+ Node {
+ DirectionalLight {
+ eulerRotation.x: -30
+ eulerRotation.y: -30
+ }
+
+ PerspectiveCamera {
+ z: 120
+ clipFar: 1000
+ clipNear: 1
+ }
+
+ Model {
+ id: model
+ source: "#Sphere"
+ materials: previewMaterial
+ }
+ }
+}
diff --git a/share/qtcreator/qml/qmlpuppet/mockfiles/ModelNode2DImageView.qml b/share/qtcreator/qml/qmlpuppet/mockfiles/ModelNode2DImageView.qml
new file mode 100644
index 0000000000..ea0498927f
--- /dev/null
+++ b/share/qtcreator/qml/qmlpuppet/mockfiles/ModelNode2DImageView.qml
@@ -0,0 +1,45 @@
+/****************************************************************************
+**
+** Copyright (C) 2020 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of Qt Creator.
+**
+** 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 General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3 as published by the Free Software
+** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
+** 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-3.0.html.
+**
+****************************************************************************/
+
+import QtQuick 2.15
+
+Item {
+ id: root
+ width: 150
+ height: 150
+
+ property alias contentItem: contentItem
+
+ /*
+ View3D {
+ // Dummy view to hold the context in case View3D items are used in the component
+ // TODO remove when QTBUG-87678 is fixed
+ }
+ */
+
+ Item {
+ id: contentItem
+ }
+}
diff --git a/share/qtcreator/qml/qmlpuppet/mockfiles/ModelNode3DImageView.qml b/share/qtcreator/qml/qmlpuppet/mockfiles/ModelNode3DImageView.qml
new file mode 100644
index 0000000000..4c73ce5fd0
--- /dev/null
+++ b/share/qtcreator/qml/qmlpuppet/mockfiles/ModelNode3DImageView.qml
@@ -0,0 +1,141 @@
+/****************************************************************************
+**
+** Copyright (C) 2020 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of Qt Creator.
+**
+** 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 General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3 as published by the Free Software
+** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
+** 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-3.0.html.
+**
+****************************************************************************/
+
+import QtQuick 2.15
+import QtQuick3D 1.15
+import QtQuick3D.Effects 1.15
+
+Item {
+ id: root
+ width: 150
+ height: 150
+ visible: true
+
+ property View3D view: null
+ property alias contentItem: contentItem
+
+ property var previewObject
+
+ property var materialViewComponent
+ property var effectViewComponent
+ property var modelViewComponent
+ property var nodeViewComponent
+
+ property bool ready: false
+
+ function destroyView()
+ {
+ previewObject = null;
+ if (view)
+ view.destroy();
+ }
+
+ function createViewForObject(obj, w, h)
+ {
+ width = w;
+ height = h;
+
+ if (obj instanceof Material)
+ createViewForMaterial(obj);
+ else if (obj instanceof Effect)
+ createViewForEffect(obj);
+ else if (obj instanceof Model)
+ createViewForModel(obj);
+ else if (obj instanceof Node)
+ createViewForNode(obj);
+
+ previewObject = obj;
+ }
+
+ function createViewForMaterial(material)
+ {
+ if (!materialViewComponent)
+ materialViewComponent = Qt.createComponent("MaterialNodeView.qml");
+
+ // Always recreate the view to ensure material is up to date
+ if (materialViewComponent.status === Component.Ready)
+ view = materialViewComponent.createObject(viewRect, {"previewMaterial": material});
+ }
+
+ function createViewForEffect(effect)
+ {
+ if (!effectViewComponent)
+ effectViewComponent = Qt.createComponent("EffectNodeView.qml");
+
+ // Always recreate the view to ensure effect is up to date
+ if (effectViewComponent.status === Component.Ready)
+ view = effectViewComponent.createObject(viewRect, {"previewEffect": effect});
+ }
+
+ function createViewForModel(model)
+ {
+ if (!modelViewComponent)
+ modelViewComponent = Qt.createComponent("ModelNodeView.qml");
+
+ // Always recreate the view to ensure model is up to date
+ if (modelViewComponent.status === Component.Ready)
+ view = modelViewComponent.createObject(viewRect, {"sourceModel": model});
+ }
+
+ function createViewForNode(node)
+ {
+ if (!nodeViewComponent)
+ nodeViewComponent = Qt.createComponent("NodeNodeView.qml");
+
+ // Always recreate the view to ensure node is up to date
+ if (nodeViewComponent.status === Component.Ready)
+ view = nodeViewComponent.createObject(viewRect, {"importScene": node});
+ }
+
+ function afterRender()
+ {
+ if (previewObject instanceof Node) {
+ view.fitToViewPort();
+ ready = view.ready;
+ } else {
+ ready = true;
+ }
+ }
+
+ View3D {
+ // Dummy view to hold the context
+ // TODO remove when QTBUG-87678 is fixed
+ }
+
+ Item {
+ id: contentItem
+ anchors.fill: parent
+
+ Rectangle {
+ id: viewRect
+ anchors.fill: parent
+
+ gradient: Gradient {
+ GradientStop { position: 1.0; color: "#222222" }
+ GradientStop { position: 0.0; color: "#999999" }
+ }
+ }
+ }
+}
diff --git a/share/qtcreator/qml/qmlpuppet/mockfiles/ModelNodeView.qml b/share/qtcreator/qml/qmlpuppet/mockfiles/ModelNodeView.qml
new file mode 100644
index 0000000000..dc10f441e1
--- /dev/null
+++ b/share/qtcreator/qml/qmlpuppet/mockfiles/ModelNodeView.qml
@@ -0,0 +1,96 @@
+/****************************************************************************
+**
+** Copyright (C) 2020 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of Qt Creator.
+**
+** 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 General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3 as published by the Free Software
+** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
+** 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-3.0.html.
+**
+****************************************************************************/
+
+import QtQuick 2.15
+import QtQuick3D 1.15
+
+View3D {
+ id: root
+ anchors.fill: parent
+ environment: sceneEnv
+ camera: theCamera
+
+ property bool ready: false
+ property real prevZoomFactor: -1
+ property Model sourceModel
+
+ function fitToViewPort()
+ {
+ cameraControl.focusObject(model, theCamera.eulerRotation, true, false);
+
+ if (cameraControl._zoomFactor < 0.1) {
+ model.scale = model.scale.times(10);
+ } else if (cameraControl._zoomFactor > 10) {
+ model.scale = model.scale.times(0.1);
+ } else {
+ // We need one more render after zoom factor change, so only set ready when zoom factor
+ // or scaling hasn't changed from the previous frame
+ ready = _generalHelper.fuzzyCompare(cameraControl._zoomFactor, prevZoomFactor);
+ prevZoomFactor = cameraControl._zoomFactor;
+ }
+ }
+
+ SceneEnvironment {
+ id: sceneEnv
+ antialiasingMode: SceneEnvironment.MSAA
+ antialiasingQuality: SceneEnvironment.High
+ }
+
+ EditCameraController {
+ id: cameraControl
+ camera: theCamera
+ anchors.fill: parent
+ view3d: root
+ ignoreToolState: true
+ }
+
+ DirectionalLight {
+ eulerRotation.x: -30
+ eulerRotation.y: -30
+ }
+
+ PerspectiveCamera {
+ id: theCamera
+ z: 600
+ y: 600
+ eulerRotation.x: -45
+ clipFar: 10000
+ clipNear: 1
+ }
+
+ Model {
+ id: model
+ eulerRotation.y: 45
+
+ source: sourceModel.source
+ geometry: sourceModel.geometry
+
+ materials: [
+ DefaultMaterial {
+ diffuseColor: "#4aee45"
+ }
+ ]
+ }
+}
diff --git a/share/qtcreator/qml/qmlpuppet/mockfiles/NodeNodeView.qml b/share/qtcreator/qml/qmlpuppet/mockfiles/NodeNodeView.qml
new file mode 100644
index 0000000000..b41c74af54
--- /dev/null
+++ b/share/qtcreator/qml/qmlpuppet/mockfiles/NodeNodeView.qml
@@ -0,0 +1,96 @@
+/****************************************************************************
+**
+** Copyright (C) 2020 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of Qt Creator.
+**
+** 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 General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3 as published by the Free Software
+** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
+** 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-3.0.html.
+**
+****************************************************************************/
+
+import QtQuick 2.15
+import QtQuick3D 1.15
+
+View3D {
+ id: root
+ anchors.fill: parent
+ environment: sceneEnv
+ camera: theCamera
+
+ property bool ready: false
+ property bool first: true
+ property real prevZoomFactor: -1
+
+ function fitToViewPort()
+ {
+ if (first) {
+ first = false;
+ selectionBox.targetNode = root.importScene;
+ } else {
+ cameraControl.focusObject(selectionBox.model, theCamera.eulerRotation, true, false);
+
+ if (cameraControl._zoomFactor < 0.1) {
+ root.importScene.scale = root.importScene.scale.times(10);
+ } else if (cameraControl._zoomFactor > 10) {
+ root.importScene.scale = root.importScene.scale.times(0.1);
+ } else {
+ // We need one more render after zoom factor change, so only set ready when zoom factor
+ // or scaling hasn't changed from the previous frame
+ ready = _generalHelper.fuzzyCompare(cameraControl._zoomFactor, prevZoomFactor);
+ prevZoomFactor = cameraControl._zoomFactor;
+ selectionBox.visible = false;
+ }
+ }
+ }
+
+ SceneEnvironment {
+ id: sceneEnv
+ antialiasingMode: SceneEnvironment.MSAA
+ antialiasingQuality: SceneEnvironment.High
+ }
+
+ SelectionBox {
+ id: selectionBox
+ view3D: root
+ geometryName: "NodeNodeViewSB"
+ }
+
+ EditCameraController {
+ id: cameraControl
+ camera: theCamera
+ anchors.fill: parent
+ view3d: root
+ ignoreToolState: true
+ }
+
+ DirectionalLight {
+ eulerRotation.x: -30
+ eulerRotation.y: -30
+ }
+
+ PerspectiveCamera {
+ id: theCamera
+ z: 600
+ y: 600
+ x: 600
+ eulerRotation.x: -45
+ eulerRotation.y: -45
+ clipFar: 10000
+ clipNear: 1
+ }
+}
diff --git a/share/qtcreator/qml/qmlpuppet/qml2puppet/editor3d/camerageometry.cpp b/share/qtcreator/qml/qmlpuppet/qml2puppet/editor3d/camerageometry.cpp
index 9c81fdc970..0fbc28c6b5 100644
--- a/share/qtcreator/qml/qmlpuppet/qml2puppet/editor3d/camerageometry.cpp
+++ b/share/qtcreator/qml/qmlpuppet/qml2puppet/editor3d/camerageometry.cpp
@@ -51,6 +51,19 @@ CameraGeometry::~CameraGeometry()
{
}
+#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
+QString CameraGeometry::name() const
+{
+ return objectName();
+}
+
+void CameraGeometry::setName(const QString &name)
+{
+ setObjectName(name);
+ emit nameChanged();
+}
+#endif
+
QQuick3DCamera *CameraGeometry::camera() const
{
return m_camera;
@@ -173,13 +186,16 @@ void CameraGeometry::fillVertexData(QByteArray &vertexData, QByteArray &indexDat
QMatrix4x4 m;
QSSGRenderCamera *camera = m_camera->cameraNode();
if (camera) {
+ QRectF rect = m_viewPortRect;
+ if (rect.isNull())
+ rect = QRectF(0, 0, 1000, 1000); // Let's have some visualization for null viewports
if (qobject_cast<QQuick3DOrthographicCamera *>(m_camera)) {
// For some reason ortho cameras show double what projection suggests,
// so give them doubled viewport to match visualization to actual camera view
- camera->calculateGlobalVariables(QRectF(0, 0, m_viewPortRect.width() * 2.0,
- m_viewPortRect.height() * 2.0));
+ camera->calculateGlobalVariables(QRectF(0, 0, rect.width() * 2.0,
+ rect.height() * 2.0));
} else {
- camera->calculateGlobalVariables(m_viewPortRect);
+ camera->calculateGlobalVariables(rect);
}
m = camera->projection.inverted();
}
diff --git a/share/qtcreator/qml/qmlpuppet/qml2puppet/editor3d/camerageometry.h b/share/qtcreator/qml/qmlpuppet/qml2puppet/editor3d/camerageometry.h
index 73722cd7a1..55d31ca389 100644
--- a/share/qtcreator/qml/qmlpuppet/qml2puppet/editor3d/camerageometry.h
+++ b/share/qtcreator/qml/qmlpuppet/qml2puppet/editor3d/camerageometry.h
@@ -39,6 +39,17 @@ class CameraGeometry : public QQuick3DGeometry
Q_PROPERTY(QQuick3DCamera *camera READ camera WRITE setCamera NOTIFY cameraChanged)
Q_PROPERTY(QRectF viewPortRect READ viewPortRect WRITE setViewPortRect NOTIFY viewPortRectChanged)
+#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
+ // Name property was removed in Qt 6, so define it here for compatibility.
+ // Name maps to object name.
+ Q_PROPERTY(QString name READ name WRITE setName NOTIFY nameChanged)
+public:
+ QString name() const;
+ void setName(const QString &name);
+signals:
+ void nameChanged();
+#endif
+
public:
CameraGeometry();
~CameraGeometry() override;
@@ -46,12 +57,12 @@ public:
QQuick3DCamera *camera() const;
QRectF viewPortRect() const;
-public Q_SLOTS:
+public slots:
void setCamera(QQuick3DCamera *camera);
void setViewPortRect(const QRectF &rect);
void handleCameraPropertyChange();
-Q_SIGNALS:
+signals:
void cameraChanged();
void viewPortRectChanged();
diff --git a/share/qtcreator/qml/qmlpuppet/qml2puppet/editor3d/editor3d.pri b/share/qtcreator/qml/qmlpuppet/qml2puppet/editor3d/editor3d.pri
index 755aef73e2..bcfbc5e12e 100644
--- a/share/qtcreator/qml/qmlpuppet/qml2puppet/editor3d/editor3d.pri
+++ b/share/qtcreator/qml/qmlpuppet/qml2puppet/editor3d/editor3d.pri
@@ -15,3 +15,8 @@ SOURCES += $$PWD/generalhelper.cpp \
$$PWD/selectionboxgeometry.cpp \
$$PWD/linegeometry.cpp \
$$PWD/icongizmoimageprovider.cpp
+
+versionAtLeast(QT_VERSION, 6.0.0) {
+ HEADERS += $$PWD/qt5compat/qquick3darealight_p.h
+ SOURCES += $$PWD/qt5compat/qquick3darealight.cpp
+}
diff --git a/share/qtcreator/qml/qmlpuppet/qml2puppet/editor3d/generalhelper.cpp b/share/qtcreator/qml/qmlpuppet/qml2puppet/editor3d/generalhelper.cpp
index ae2f235673..133035de20 100644
--- a/share/qtcreator/qml/qmlpuppet/qml2puppet/editor3d/generalhelper.cpp
+++ b/share/qtcreator/qml/qmlpuppet/qml2puppet/editor3d/generalhelper.cpp
@@ -36,6 +36,7 @@
#include <QtQuick3D/private/qquick3dmodel_p.h>
#include <QtQuick3D/private/qquick3dviewport_p.h>
#include <QtQuick3D/private/qquick3ddefaultmaterial_p.h>
+#include <QtQuick3D/private/qquick3dscenemanager_p.h>
#include <QtQuick3DRuntimeRender/private/qssgrendercontextcore_p.h>
#include <QtQuick3DRuntimeRender/private/qssgrenderbuffermanager_p.h>
#include <QtQuick3DRuntimeRender/private/qssgrendermodel_p.h>
@@ -166,7 +167,12 @@ QVector4D GeneralHelper::focusObjectToCamera(QQuick3DCamera *camera, float defau
if (auto renderModel = static_cast<QSSGRenderModel *>(targetPriv->spatialNode)) {
QWindow *window = static_cast<QWindow *>(viewPort->window());
if (window) {
- auto context = QSSGRenderContextInterface::getRenderContextInterface(quintptr(window));
+ QSSGRef<QSSGRenderContextInterface> context;
+#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
+ context = QSSGRenderContextInterface::getRenderContextInterface(quintptr(window));
+#else
+ context = targetPriv->sceneManager->rci;
+#endif
if (!context.isNull()) {
QSSGBounds3 bounds;
auto geometry = qobject_cast<SelectionBoxGeometry *>(modelNode->geometry());
@@ -211,6 +217,11 @@ QVector4D GeneralHelper::focusObjectToCamera(QQuick3DCamera *camera, float defau
return QVector4D(lookAt, cameraZoomFactor);
}
+bool GeneralHelper::fuzzyCompare(double a, double b)
+{
+ return qFuzzyCompare(a, b);
+}
+
void GeneralHelper::delayedPropertySet(QObject *obj, int delay, const QString &property,
const QVariant &value)
{
@@ -233,6 +244,40 @@ QQuick3DNode *GeneralHelper::resolvePick(QQuick3DNode *pickNode)
return pickNode;
}
+void GeneralHelper::registerGizmoTarget(QQuick3DNode *node)
+{
+ if (!m_gizmoTargets.contains(node)) {
+ m_gizmoTargets.insert(node);
+ node->installEventFilter(this);
+ }
+}
+
+void GeneralHelper::unregisterGizmoTarget(QQuick3DNode *node)
+{
+ if (m_gizmoTargets.contains(node)) {
+ m_gizmoTargets.remove(node);
+ node->removeEventFilter(this);
+ }
+}
+
+bool GeneralHelper::isLocked(QQuick3DNode *node)
+{
+ if (node) {
+ QVariant lockValue = node->property("_edit3dLocked");
+ return lockValue.isValid() && lockValue.toBool();
+ }
+ return false;
+}
+
+bool GeneralHelper::isHidden(QQuick3DNode *node)
+{
+ if (node) {
+ QVariant hideValue = node->property("_edit3dHidden");
+ return hideValue.isValid() && hideValue.toBool();
+ }
+ return false;
+}
+
void GeneralHelper::storeToolState(const QString &sceneId, const QString &tool, const QVariant &state,
int delay)
{
@@ -292,6 +337,16 @@ QString GeneralHelper::rootSizeKey() const
return _rootSizeKey;
}
+double GeneralHelper::brightnessScaler() const
+{
+ // Light brightness was rescaled in Qt6 from 100 -> 1.
+#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
+ return 100.;
+#else
+ return 1.;
+#endif
+}
+
bool GeneralHelper::isMacOS() const
{
#ifdef Q_OS_MACOS
@@ -301,6 +356,21 @@ bool GeneralHelper::isMacOS() const
#endif
}
+bool GeneralHelper::eventFilter(QObject *obj, QEvent *event)
+{
+ if (event->type() == QEvent::DynamicPropertyChange) {
+ auto node = qobject_cast<QQuick3DNode *>(obj);
+ if (m_gizmoTargets.contains(node)) {
+ auto de = static_cast<QDynamicPropertyChangeEvent *>(event);
+ if (de->propertyName() == "_edit3dLocked")
+ emit lockedStateChanged(node);
+ else if (de->propertyName() == "_edit3dHidden")
+ emit hiddenStateChanged(node);
+ }
+ }
+ return QObject::eventFilter(obj, event);
+}
+
void GeneralHelper::handlePendingToolStateUpdate()
{
m_toolStateUpdateTimer.stop();
diff --git a/share/qtcreator/qml/qmlpuppet/qml2puppet/editor3d/generalhelper.h b/share/qtcreator/qml/qmlpuppet/qml2puppet/editor3d/generalhelper.h
index 5e3adbf16b..f40e8a4569 100644
--- a/share/qtcreator/qml/qmlpuppet/qml2puppet/editor3d/generalhelper.h
+++ b/share/qtcreator/qml/qmlpuppet/qml2puppet/editor3d/generalhelper.h
@@ -31,6 +31,7 @@
#include <QtCore/qtimer.h>
#include <QtCore/qhash.h>
#include <QtCore/qpointer.h>
+#include <QtCore/qvariant.h>
#include <QtGui/qvector3d.h>
#include <QtGui/qmatrix4x4.h>
@@ -69,9 +70,16 @@ public:
QQuick3DNode *targetObject, QQuick3DViewport *viewPort,
float oldZoom, bool updateZoom = true,
bool closeUp = false);
+ Q_INVOKABLE bool fuzzyCompare(double a, double b);
Q_INVOKABLE void delayedPropertySet(QObject *obj, int delay, const QString &property,
const QVariant& value);
Q_INVOKABLE QQuick3DNode *resolvePick(QQuick3DNode *pickNode);
+
+ Q_INVOKABLE void registerGizmoTarget(QQuick3DNode *node);
+ Q_INVOKABLE void unregisterGizmoTarget(QQuick3DNode *node);
+ Q_INVOKABLE bool isLocked(QQuick3DNode *node);
+ Q_INVOKABLE bool isHidden(QQuick3DNode *node);
+
Q_INVOKABLE void storeToolState(const QString &sceneId, const QString &tool,
const QVariant &state, int delayEmit = 0);
void initToolStates(const QString &sceneId, const QVariantMap &toolStates);
@@ -81,11 +89,18 @@ public:
QString lastSceneIdKey() const;
QString rootSizeKey() const;
+ Q_INVOKABLE double brightnessScaler() const;
+
bool isMacOS() const;
signals:
void overlayUpdateNeeded();
void toolStateChanged(const QString &sceneId, const QString &tool, const QVariant &toolState);
+ void hiddenStateChanged(QQuick3DNode *node);
+ void lockedStateChanged(QQuick3DNode *node);
+
+protected:
+ bool eventFilter(QObject *obj, QEvent *event);
private:
void handlePendingToolStateUpdate();
@@ -94,6 +109,7 @@ private:
QTimer m_toolStateUpdateTimer;
QHash<QString, QVariantMap> m_toolStates;
QHash<QString, QVariantMap> m_toolStatesPending;
+ QSet<QQuick3DNode *> m_gizmoTargets;
};
}
diff --git a/share/qtcreator/qml/qmlpuppet/qml2puppet/editor3d/gridgeometry.cpp b/share/qtcreator/qml/qmlpuppet/qml2puppet/editor3d/gridgeometry.cpp
index 4b548239ca..66a2a6b2a5 100644
--- a/share/qtcreator/qml/qmlpuppet/qml2puppet/editor3d/gridgeometry.cpp
+++ b/share/qtcreator/qml/qmlpuppet/qml2puppet/editor3d/gridgeometry.cpp
@@ -41,6 +41,19 @@ GridGeometry::~GridGeometry()
{
}
+#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
+QString GridGeometry::name() const
+{
+ return objectName();
+}
+
+void GridGeometry::setName(const QString &name)
+{
+ setObjectName(name);
+ emit nameChanged();
+}
+#endif
+
int GridGeometry::lines() const
{
return m_lines;
diff --git a/share/qtcreator/qml/qmlpuppet/qml2puppet/editor3d/gridgeometry.h b/share/qtcreator/qml/qmlpuppet/qml2puppet/editor3d/gridgeometry.h
index 50b41288e2..6074fb4245 100644
--- a/share/qtcreator/qml/qmlpuppet/qml2puppet/editor3d/gridgeometry.h
+++ b/share/qtcreator/qml/qmlpuppet/qml2puppet/editor3d/gridgeometry.h
@@ -41,6 +41,17 @@ class GridGeometry : public QQuick3DGeometry
Q_PROPERTY(bool isCenterLine READ isCenterLine WRITE setIsCenterLine NOTIFY isCenterLineChanged)
Q_PROPERTY(bool isSubdivision MEMBER m_isSubdivision)
+#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
+ // Name property was removed in Qt 6, so define it here for compatibility.
+ // Name maps to object name.
+ Q_PROPERTY(QString name READ name WRITE setName NOTIFY nameChanged)
+public:
+ QString name() const;
+ void setName(const QString &name);
+signals:
+ void nameChanged();
+#endif
+
public:
GridGeometry();
~GridGeometry() override;
@@ -49,12 +60,12 @@ public:
float step() const;
bool isCenterLine() const;
-public Q_SLOTS:
+public slots:
void setLines(int count);
void setStep(float step);
void setIsCenterLine(bool enabled);
-Q_SIGNALS:
+signals:
void linesChanged();
void stepChanged();
void isCenterLineChanged();
diff --git a/share/qtcreator/qml/qmlpuppet/qml2puppet/editor3d/lightgeometry.cpp b/share/qtcreator/qml/qmlpuppet/qml2puppet/editor3d/lightgeometry.cpp
index cebf3232f1..2facb77139 100644
--- a/share/qtcreator/qml/qmlpuppet/qml2puppet/editor3d/lightgeometry.cpp
+++ b/share/qtcreator/qml/qmlpuppet/qml2puppet/editor3d/lightgeometry.cpp
@@ -45,6 +45,19 @@ LightGeometry::~LightGeometry()
{
}
+#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
+QString LightGeometry::name() const
+{
+ return objectName();
+}
+
+void LightGeometry::setName(const QString &name)
+{
+ setObjectName(name);
+ emit nameChanged();
+}
+#endif
+
LightGeometry::LightType LightGeometry::lightType() const
{
return m_lightType;
diff --git a/share/qtcreator/qml/qmlpuppet/qml2puppet/editor3d/lightgeometry.h b/share/qtcreator/qml/qmlpuppet/qml2puppet/editor3d/lightgeometry.h
index cac375d675..e9ba718218 100644
--- a/share/qtcreator/qml/qmlpuppet/qml2puppet/editor3d/lightgeometry.h
+++ b/share/qtcreator/qml/qmlpuppet/qml2puppet/editor3d/lightgeometry.h
@@ -37,6 +37,17 @@ class LightGeometry : public QQuick3DGeometry
Q_OBJECT
Q_PROPERTY(LightType lightType READ lightType WRITE setLightType NOTIFY lightTypeChanged)
+#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
+ // Name property was removed in Qt 6, so define it here for compatibility.
+ // Name maps to object name.
+ Q_PROPERTY(QString name READ name WRITE setName NOTIFY nameChanged)
+public:
+ QString name() const;
+ void setName(const QString &name);
+signals:
+ void nameChanged();
+#endif
+
public:
enum class LightType {
Invalid,
@@ -52,10 +63,10 @@ public:
LightType lightType() const;
-public Q_SLOTS:
+public slots:
void setLightType(LightType lightType);
-Q_SIGNALS:
+signals:
void lightTypeChanged();
protected:
diff --git a/share/qtcreator/qml/qmlpuppet/qml2puppet/editor3d/linegeometry.cpp b/share/qtcreator/qml/qmlpuppet/qml2puppet/editor3d/linegeometry.cpp
index cd2e890f86..5b6110d2af 100644
--- a/share/qtcreator/qml/qmlpuppet/qml2puppet/editor3d/linegeometry.cpp
+++ b/share/qtcreator/qml/qmlpuppet/qml2puppet/editor3d/linegeometry.cpp
@@ -41,6 +41,19 @@ LineGeometry::~LineGeometry()
{
}
+#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
+QString LineGeometry::name() const
+{
+ return objectName();
+}
+
+void LineGeometry::setName(const QString &name)
+{
+ setObjectName(name);
+ emit nameChanged();
+}
+#endif
+
QVector3D LineGeometry::startPos() const
{
return m_startPos;
diff --git a/share/qtcreator/qml/qmlpuppet/qml2puppet/editor3d/linegeometry.h b/share/qtcreator/qml/qmlpuppet/qml2puppet/editor3d/linegeometry.h
index 2e87ff8748..df83f89b25 100644
--- a/share/qtcreator/qml/qmlpuppet/qml2puppet/editor3d/linegeometry.h
+++ b/share/qtcreator/qml/qmlpuppet/qml2puppet/editor3d/linegeometry.h
@@ -39,6 +39,17 @@ class LineGeometry : public QQuick3DGeometry
Q_PROPERTY(QVector3D startPos READ startPos WRITE setStartPos NOTIFY startPosChanged)
Q_PROPERTY(QVector3D endPos READ endPos WRITE setEndPos NOTIFY endPosChanged)
+#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
+ // Name property was removed in Qt 6, so define it here for compatibility.
+ // Name maps to object name.
+ Q_PROPERTY(QString name READ name WRITE setName NOTIFY nameChanged)
+public:
+ QString name() const;
+ void setName(const QString &name);
+signals:
+ void nameChanged();
+#endif
+
public:
LineGeometry();
~LineGeometry() override;
@@ -46,11 +57,11 @@ public:
QVector3D startPos() const;
QVector3D endPos() const;
-public Q_SLOTS:
+public slots:
void setStartPos(const QVector3D &pos);
void setEndPos(const QVector3D &pos);
-Q_SIGNALS:
+signals:
void startPosChanged();
void endPosChanged();
diff --git a/share/qtcreator/qml/qmlpuppet/qml2puppet/editor3d/qt5compat/qquick3darealight.cpp b/share/qtcreator/qml/qmlpuppet/qml2puppet/editor3d/qt5compat/qquick3darealight.cpp
new file mode 100644
index 0000000000..6fcbdcb89e
--- /dev/null
+++ b/share/qtcreator/qml/qmlpuppet/qml2puppet/editor3d/qt5compat/qquick3darealight.cpp
@@ -0,0 +1,59 @@
+/****************************************************************************
+**
+** Copyright (C) 2020 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of Qt Creator.
+**
+** 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 General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3 as published by the Free Software
+** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
+** 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-3.0.html.
+**
+****************************************************************************/
+
+#ifdef QUICK3D_MODULE
+
+#include "qquick3darealight_p.h"
+#include <QtQuick3D/private/qquick3dobject_p.h>
+
+#include <QtQuick3DRuntimeRender/private/qssgrenderlight_p.h>
+
+namespace QmlDesigner::Internal {
+
+float QQuick3DAreaLight::width() const
+{
+ return m_width;
+}
+
+float QQuick3DAreaLight::height() const
+{
+ return m_height;
+}
+
+void QQuick3DAreaLight::setWidth(float width)
+{
+ m_width = width;
+ emit widthChanged();
+}
+
+void QQuick3DAreaLight::setHeight(float height)
+{
+ m_height = height;
+ emit heightChanged();
+}
+
+}
+
+#endif
diff --git a/share/qtcreator/qml/qmlpuppet/qml2puppet/editor3d/qt5compat/qquick3darealight_p.h b/share/qtcreator/qml/qmlpuppet/qml2puppet/editor3d/qt5compat/qquick3darealight_p.h
new file mode 100644
index 0000000000..8db5487960
--- /dev/null
+++ b/share/qtcreator/qml/qmlpuppet/qml2puppet/editor3d/qt5compat/qquick3darealight_p.h
@@ -0,0 +1,66 @@
+/****************************************************************************
+**
+** Copyright (C) 2020 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of Qt Creator.
+**
+** 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 General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3 as published by the Free Software
+** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
+** 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-3.0.html.
+**
+****************************************************************************/
+
+#pragma once
+
+#ifdef QUICK3D_MODULE
+
+// This is a dummy class for Qt 5 compatibility purposes only
+
+#include <QtQuick3D/private/qquick3dabstractlight_p.h>
+
+namespace QmlDesigner::Internal {
+
+class QQuick3DAreaLight : public QQuick3DAbstractLight
+{
+ Q_OBJECT
+ Q_PROPERTY(float width READ width WRITE setWidth NOTIFY widthChanged)
+ Q_PROPERTY(float height READ height WRITE setHeight NOTIFY heightChanged)
+
+public:
+ QQuick3DAreaLight() : QQuick3DAbstractLight() {}
+ ~QQuick3DAreaLight() override {}
+
+ float width() const;
+ float height() const;
+
+public slots:
+ void setWidth(float width);
+ void setHeight(float height);
+
+signals:
+ void widthChanged();
+ void heightChanged();
+
+private:
+ float m_width = 100.0f;
+ float m_height = 100.0f;
+};
+
+}
+
+QML_DECLARE_TYPE(QmlDesigner::Internal::QQuick3DAreaLight)
+
+#endif
diff --git a/share/qtcreator/qml/qmlpuppet/qml2puppet/editor3d/selectionboxgeometry.cpp b/share/qtcreator/qml/qmlpuppet/qml2puppet/editor3d/selectionboxgeometry.cpp
index 621508c499..1e1fe8937c 100644
--- a/share/qtcreator/qml/qmlpuppet/qml2puppet/editor3d/selectionboxgeometry.cpp
+++ b/share/qtcreator/qml/qmlpuppet/qml2puppet/editor3d/selectionboxgeometry.cpp
@@ -32,6 +32,7 @@
#include <QtQuick3DRuntimeRender/private/qssgrendercontextcore_p.h>
#include <QtQuick3DRuntimeRender/private/qssgrenderbuffermanager_p.h>
#include <QtQuick3D/private/qquick3dmodel_p.h>
+#include <QtQuick3D/private/qquick3dscenemanager_p.h>
#include <QtQuick3D/qquick3dobject.h>
#include <QtQuick/qquickwindow.h>
#include <QtCore/qvector.h>
@@ -59,6 +60,19 @@ SelectionBoxGeometry::~SelectionBoxGeometry()
m_connections.clear();
}
+#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
+QString SelectionBoxGeometry::name() const
+{
+ return objectName();
+}
+
+void SelectionBoxGeometry::setName(const QString &name)
+{
+ setObjectName(name);
+ emit nameChanged();
+}
+#endif
+
QQuick3DNode *SelectionBoxGeometry::targetNode() const
{
return m_targetNode;
@@ -291,8 +305,12 @@ void SelectionBoxGeometry::getBounds(
if (auto renderModel = static_cast<QSSGRenderModel *>(renderNode)) {
QWindow *window = static_cast<QWindow *>(m_view3D->window());
if (window) {
- auto context = QSSGRenderContextInterface::getRenderContextInterface(
- quintptr(window));
+ QSSGRef<QSSGRenderContextInterface> context;
+#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
+ context = QSSGRenderContextInterface::getRenderContextInterface(quintptr(window));
+#else
+ context = QQuick3DObjectPrivate::get(this)->sceneManager->rci;
+#endif
if (!context.isNull()) {
auto bufferManager = context->bufferManager();
QSSGBounds3 bounds = renderModel->getModelBounds(bufferManager);
diff --git a/share/qtcreator/qml/qmlpuppet/qml2puppet/editor3d/selectionboxgeometry.h b/share/qtcreator/qml/qmlpuppet/qml2puppet/editor3d/selectionboxgeometry.h
index 6cf9a153c2..947ef7d54a 100644
--- a/share/qtcreator/qml/qmlpuppet/qml2puppet/editor3d/selectionboxgeometry.h
+++ b/share/qtcreator/qml/qmlpuppet/qml2puppet/editor3d/selectionboxgeometry.h
@@ -43,6 +43,17 @@ class SelectionBoxGeometry : public QQuick3DGeometry
Q_PROPERTY(QQuick3DViewport *view3D READ view3D WRITE setView3D NOTIFY view3DChanged)
Q_PROPERTY(bool isEmpty READ isEmpty NOTIFY isEmptyChanged)
+#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
+ // Name property was removed in Qt 6, so define it here for compatibility.
+ // Name maps to object name.
+ Q_PROPERTY(QString name READ name WRITE setName NOTIFY nameChanged)
+public:
+ QString name() const;
+ void setName(const QString &name);
+signals:
+ void nameChanged();
+#endif
+
public:
SelectionBoxGeometry();
~SelectionBoxGeometry() override;
@@ -54,12 +65,12 @@ public:
QSSGBounds3 bounds() const;
-public Q_SLOTS:
+public slots:
void setTargetNode(QQuick3DNode *targetNode);
void setRootNode(QQuick3DNode *rootNode);
void setView3D(QQuick3DViewport *view);
-Q_SIGNALS:
+signals:
void targetNodeChanged();
void rootNodeChanged();
void view3DChanged();
diff --git a/share/qtcreator/qml/qmlpuppet/qml2puppet/iconrenderer/iconrenderer.cpp b/share/qtcreator/qml/qmlpuppet/qml2puppet/iconrenderer/iconrenderer.cpp
index 54ba6bed07..cb9d867b0f 100644
--- a/share/qtcreator/qml/qmlpuppet/qml2puppet/iconrenderer/iconrenderer.cpp
+++ b/share/qtcreator/qml/qmlpuppet/qml2puppet/iconrenderer/iconrenderer.cpp
@@ -58,102 +58,123 @@ IconRenderer::IconRenderer(int size, const QString &filePath, const QString &sou
void IconRenderer::setupRender()
{
DesignerSupport::activateDesignerMode();
+#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
DesignerSupport::activateDesignerWindowManager();
+#endif
m_quickView = new QQuickView;
+#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
QSurfaceFormat surfaceFormat = m_quickView->requestedFormat();
surfaceFormat.setVersion(4, 1);
surfaceFormat.setProfile(QSurfaceFormat::CoreProfile);
m_quickView->setFormat(surfaceFormat);
DesignerSupport::createOpenGLContext(m_quickView);
+#else
+ m_quickView->setDefaultAlphaBuffer(true);
+ m_quickView->setColor(Qt::transparent);
+ m_ratio = m_quickView->devicePixelRatio();
+ m_quickView->installEventFilter(this);
+#endif
QQmlComponent component(m_quickView->engine());
component.loadUrl(QUrl::fromLocalFile(m_source));
QObject *iconItem = component.create();
if (iconItem) {
- QQuickItem *containerItem = nullptr;
- bool is3D = false;
#ifdef QUICK3D_MODULE
if (auto scene = qobject_cast<QQuick3DNode *>(iconItem)) {
qmlRegisterType<QmlDesigner::Internal::SelectionBoxGeometry>("SelectionBoxGeometry", 1, 0, "SelectionBoxGeometry");
QQmlComponent component(m_quickView->engine());
component.loadUrl(QUrl("qrc:/qtquickplugin/mockfiles/IconRenderer3D.qml"));
- containerItem = qobject_cast<QQuickItem *>(component.create());
- DesignerSupport::setRootItem(m_quickView, containerItem);
+ m_containerItem = qobject_cast<QQuickItem *>(component.create());
+ DesignerSupport::setRootItem(m_quickView, m_containerItem);
auto helper = new QmlDesigner::Internal::GeneralHelper();
m_quickView->engine()->rootContext()->setContextProperty("_generalHelper", helper);
- m_contentItem = QQmlProperty::read(containerItem, "view3D").value<QQuickItem *>();
+ m_contentItem = QQmlProperty::read(m_containerItem, "view3D").value<QQuickItem *>();
auto view3D = qobject_cast<QQuick3DViewport *>(m_contentItem);
view3D->setImportScene(scene);
- is3D = true;
+ m_is3D = true;
} else
#endif
if (auto scene = qobject_cast<QQuickItem *>(iconItem)) {
m_contentItem = scene;
- containerItem = new QQuickItem();
- containerItem->setSize(QSizeF(1024, 1024));
- DesignerSupport::setRootItem(m_quickView, containerItem);
- m_contentItem->setParentItem(containerItem);
+ m_containerItem = new QQuickItem();
+ m_containerItem->setSize(QSizeF(1024, 1024));
+ DesignerSupport::setRootItem(m_quickView, m_containerItem);
+ m_contentItem->setParentItem(m_containerItem);
}
- if (containerItem && m_contentItem) {
- m_contentItem->setSize(QSizeF(m_size, m_size));
- if (m_contentItem->width() > containerItem->width())
- containerItem->setWidth(m_contentItem->width());
- if (m_contentItem->height() > containerItem->height())
- containerItem->setHeight(m_contentItem->height());
+ if (m_containerItem && m_contentItem) {
+ resizeContent(m_size);
+#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
+ QTimer::singleShot(0, this, &IconRenderer::createIcon);
+#else
+ m_quickView->show();
+ m_quickView->lower();
- QTimer::singleShot(0, this, [this, is3D, containerItem]() {
- m_designerSupport.refFromEffectItem(m_quickView->rootObject(), false);
- QQuickDesignerSupportItems::disableNativeTextRendering(m_quickView->rootObject());
+ // Failsafe to exit eventually if window fails to expose
+ QTimer::singleShot(10000, qGuiApp, &QGuiApplication::quit);
+#endif
+ } else {
+ QTimer::singleShot(0, qGuiApp, &QGuiApplication::quit);
+ }
+ } else {
+ QTimer::singleShot(0, qGuiApp, &QGuiApplication::quit);
+ }
+}
+
+bool IconRenderer::eventFilter(QObject *watched, QEvent *event)
+{
+#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
+ if (watched == m_quickView && event->type() == QEvent::Expose)
+ QTimer::singleShot(0, this, &IconRenderer::createIcon);
+#endif
+ return false;
+}
+
+void IconRenderer::createIcon()
+{
+#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
+ m_designerSupport.refFromEffectItem(m_quickView->rootObject(), false);
+#endif
+ QQuickDesignerSupportItems::disableNativeTextRendering(m_quickView->rootObject());
#ifdef QUICK3D_MODULE
- if (is3D) {
- // Render once to make sure scene is up to date before we set up the selection box
- render({});
- QMetaObject::invokeMethod(containerItem, "setSceneToBox");
- int tries = 0;
- while (tries < 10) {
- ++tries;
- render({});
- QMetaObject::invokeMethod(containerItem, "fitAndHideBox");
- }
- }
-#else
- Q_UNUSED(is3D)
- Q_UNUSED(containerItem)
+ if (m_is3D) {
+ // Render once to make sure scene is up to date before we set up the selection box
+ render({});
+ QMetaObject::invokeMethod(m_containerItem, "setSceneToBox");
+ int tries = 0;
+ while (tries < 10) {
+ ++tries;
+ render({});
+ QMetaObject::invokeMethod(m_containerItem, "fitAndHideBox");
+ }
+ }
#endif
- QFileInfo fi(m_filePath);
+ QFileInfo fi(m_filePath);
- // Render regular size image
- render(fi.absoluteFilePath());
+ // Render regular size image
+ render(fi.absoluteFilePath());
- // Render @2x image
- m_contentItem->setSize(QSizeF(m_size * 2, m_size * 2));
+ // Render @2x image
+ resizeContent(m_size * 2);
- QString saveFile;
- saveFile = fi.absolutePath() + '/' + fi.completeBaseName() + "@2x";
- if (!fi.suffix().isEmpty())
- saveFile += '.' + fi.suffix();
+ QString saveFile;
+ saveFile = fi.absolutePath() + '/' + fi.completeBaseName() + "@2x";
+ if (!fi.suffix().isEmpty())
+ saveFile += '.' + fi.suffix();
- fi.absoluteDir().mkpath(".");
+ fi.absoluteDir().mkpath(".");
- render(saveFile);
+ render(saveFile);
- // Allow little time for file operations to finish
- QTimer::singleShot(1000, qGuiApp, &QGuiApplication::quit);
- });
- } else {
- QTimer::singleShot(0, qGuiApp, &QGuiApplication::quit);
- }
- } else {
- QTimer::singleShot(0, qGuiApp, &QGuiApplication::quit);
- }
+ // Allow little time for file operations to finish
+ QTimer::singleShot(1000, qGuiApp, &QGuiApplication::quit);
}
void IconRenderer::render(const QString &fileName)
@@ -163,14 +184,30 @@ void IconRenderer::render(const QString &fileName)
const auto childItems = item->childItems();
for (QQuickItem *childItem : childItems)
updateNodesRecursive(childItem);
+#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
DesignerSupport::updateDirtyNode(item);
+#else
+ if (item->flags() & QQuickItem::ItemHasContents)
+ item->update();
+#endif
};
updateNodesRecursive(m_quickView->rootObject());
QRect rect(QPoint(), m_contentItem->size().toSize());
+#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
QImage renderImage = m_designerSupport.renderImageForItem(m_quickView->rootObject(),
rect, rect.size());
+#else
+ QImage renderImage = m_quickView->grabWindow();
+#endif
if (!fileName.isEmpty()) {
+#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
+ if (m_ratio != 1.) {
+ rect.setWidth(qRound(rect.size().width() * m_ratio));
+ rect.setHeight(qRound(rect.size().height() * m_ratio));
+ }
+ renderImage = renderImage.copy(rect);
+#endif
QFileInfo fi(fileName);
if (fi.suffix().isEmpty())
renderImage.save(fileName, "PNG");
@@ -178,3 +215,17 @@ void IconRenderer::render(const QString &fileName)
renderImage.save(fileName);
}
}
+
+void IconRenderer::resizeContent(int size)
+{
+ int theSize = size;
+#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
+ if (m_ratio != 1.)
+ theSize = qRound(qreal(size) / m_quickView->devicePixelRatio());
+#endif
+ m_contentItem->setSize(QSizeF(theSize, theSize));
+ if (m_contentItem->width() > m_containerItem->width())
+ m_containerItem->setWidth(m_contentItem->width());
+ if (m_contentItem->height() > m_containerItem->height())
+ m_containerItem->setHeight(m_contentItem->height());
+}
diff --git a/share/qtcreator/qml/qmlpuppet/qml2puppet/iconrenderer/iconrenderer.h b/share/qtcreator/qml/qmlpuppet/qml2puppet/iconrenderer/iconrenderer.h
index f7bab0f6fc..64afed6f8a 100644
--- a/share/qtcreator/qml/qmlpuppet/qml2puppet/iconrenderer/iconrenderer.h
+++ b/share/qtcreator/qml/qmlpuppet/qml2puppet/iconrenderer/iconrenderer.h
@@ -44,13 +44,21 @@ public:
void setupRender();
+protected:
+ bool eventFilter(QObject *watched, QEvent *event) override;
+
private:
+ void createIcon();
void render(const QString &fileName);
+ void resizeContent(int size);
int m_size = 16;
+ double m_ratio = 1.;
QString m_filePath;
QString m_source;
QQuickView *m_quickView = nullptr;
QQuickItem *m_contentItem = nullptr;
+ QQuickItem *m_containerItem = nullptr;
DesignerSupport m_designerSupport;
+ bool m_is3D = false;
};
diff --git a/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/instances.pri b/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/instances.pri
index 85de00c5ff..448a67c913 100644
--- a/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/instances.pri
+++ b/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/instances.pri
@@ -9,6 +9,7 @@ HEADERS += $$PWD/qt5nodeinstanceserver.h \
$$PWD/capturenodeinstanceserverdispatcher.h \
$$PWD/capturescenecreatedcommand.h \
$$PWD/nodeinstanceserverdispatcher.h \
+ $$PWD/qt5captureimagenodeinstanceserver.h \
$$PWD/qt5capturepreviewnodeinstanceserver.h \
$$PWD/qt5testnodeinstanceserver.h \
$$PWD/qt5informationnodeinstanceserver.h \
@@ -33,11 +34,13 @@ HEADERS += $$PWD/qt5nodeinstanceserver.h \
$$PWD/layoutnodeinstance.h \
$$PWD/qt3dpresentationnodeinstance.h \
$$PWD/quick3dnodeinstance.h \
- $$PWD/quick3dtexturenodeinstance.h
+ $$PWD/quick3dtexturenodeinstance.h \
+
SOURCES += $$PWD/qt5nodeinstanceserver.cpp \
$$PWD/capturenodeinstanceserverdispatcher.cpp \
$$PWD/nodeinstanceserverdispatcher.cpp \
+ $$PWD/qt5captureimagenodeinstanceserver.cpp \
$$PWD/qt5capturepreviewnodeinstanceserver.cpp \
$$PWD/qt5testnodeinstanceserver.cpp \
$$PWD/qt5informationnodeinstanceserver.cpp \
diff --git a/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/nodeinstanceserver.cpp b/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/nodeinstanceserver.cpp
index c53e537862..552d323247 100644
--- a/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/nodeinstanceserver.cpp
+++ b/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/nodeinstanceserver.cpp
@@ -69,25 +69,25 @@
#include <changeselectioncommand.h>
#include <inputeventcommand.h>
#include <view3dactioncommand.h>
+#include <requestmodelnodepreviewimagecommand.h>
#include <changelanguagecommand.h>
+#include <designersupportdelegate.h>
+#include <QAbstractAnimation>
#include <QDebug>
-#include <QQmlEngine>
-#include <QQmlApplicationEngine>
-#include <QFileSystemWatcher>
-#include <QUrl>
-#include <QSet>
#include <QDir>
-#include <QVariant>
+#include <QFileSystemWatcher>
#include <QMetaType>
+#include <QQmlApplicationEngine>
#include <QQmlComponent>
#include <QQmlContext>
-#include <qqmllist.h>
-#include <QAbstractAnimation>
-#include <QMutableVectorIterator>
+#include <QQmlEngine>
+#include <QQuickItemGrabResult>
#include <QQuickView>
#include <QSet>
-#include <designersupportdelegate.h>
+#include <QUrl>
+#include <QVariant>
+#include <qqmllist.h>
#include <algorithm>
@@ -318,12 +318,13 @@ void NodeInstanceServer::stopRenderTimer()
void NodeInstanceServer::createScene(const CreateSceneCommand &command)
{
- setTranslationLanguage(command.language());
+ setTranslationLanguage(command.language);
initializeView();
Internal::QmlPrivateGate::stopUnifiedTimer();
setupScene(command);
+ setupState(command.stateInstanceId);
refreshBindings();
startRenderTimer();
}
@@ -399,15 +400,7 @@ void NodeInstanceServer::reparentInstances(const ReparentInstancesCommand &comma
void NodeInstanceServer::changeState(const ChangeStateCommand &command)
{
- if (hasInstanceForId(command.stateInstanceId())) {
- if (activeStateInstance().isValid())
- activeStateInstance().deactivateState();
- ServerNodeInstance instance = instanceForId(command.stateInstanceId());
- instance.activateState();
- } else {
- if (activeStateInstance().isValid())
- activeStateInstance().deactivateState();
- }
+ setupState(command.stateInstanceId());
startRenderTimer();
}
@@ -569,38 +562,37 @@ void NodeInstanceServer::setupDefaultDummyData()
QList<ServerNodeInstance> NodeInstanceServer::setupInstances(const CreateSceneCommand &command)
{
- QList<ServerNodeInstance> instanceList = createInstances(command.instances());
+ QList<ServerNodeInstance> instanceList = createInstances(command.instances);
- foreach (const IdContainer &container, command.ids()) {
+ for (const IdContainer &container : std::as_const(command.ids)) {
if (hasInstanceForId(container.instanceId()))
instanceForId(container.instanceId()).setId(container.id());
}
- foreach (const PropertyValueContainer &container, command.valueChanges()) {
+ for (const PropertyValueContainer &container : std::as_const(command.valueChanges)) {
if (container.isDynamic())
setInstancePropertyVariant(container);
}
- foreach (const PropertyValueContainer &container, command.valueChanges()) {
+ for (const PropertyValueContainer &container : std::as_const(command.valueChanges)) {
if (!container.isDynamic())
setInstancePropertyVariant(container);
}
- reparentInstances(command.reparentInstances());
+ reparentInstances(command.reparentInstances);
- foreach (const PropertyBindingContainer &container, command.bindingChanges()) {
+ for (const PropertyBindingContainer &container : std::as_const(command.bindingChanges)) {
if (container.isDynamic())
setInstancePropertyBinding(container);
}
- foreach (const PropertyBindingContainer &container, command.bindingChanges()) {
+ for (const PropertyBindingContainer &container : std::as_const(command.bindingChanges)) {
if (!container.isDynamic())
setInstancePropertyBinding(container);
}
- foreach (const PropertyValueContainer &container, command.auxiliaryChanges()) {
+ for (const PropertyValueContainer &container : std::as_const(command.auxiliaryChanges))
setInstanceAuxiliaryData(container);
- }
for (int i = instanceList.size(); --i >= 0; )
instanceList[i].doComponentComplete();
@@ -998,9 +990,17 @@ void NodeInstanceServer::setInstanceAuxiliaryData(const PropertyValueContainer &
if (hasInstanceForId(auxiliaryContainer.instanceId())) {
ServerNodeInstance instance = instanceForId(auxiliaryContainer.instanceId());
if (!auxiliaryContainer.value().isNull())
- instance.setHideInEditor(auxiliaryContainer.value().toBool());
+ instance.setHiddenInEditor(auxiliaryContainer.value().toBool());
+ else
+ instance.setHiddenInEditor(false);
+ }
+ } else if (auxiliaryContainer.name() == "locked") {
+ if (hasInstanceForId(auxiliaryContainer.instanceId())) {
+ ServerNodeInstance instance = instanceForId(auxiliaryContainer.instanceId());
+ if (!auxiliaryContainer.value().isNull())
+ instance.setLockedInEditor(auxiliaryContainer.value().toBool());
else
- instance.setHideInEditor(false);
+ instance.setLockedInEditor(false);
}
}
}
@@ -1418,6 +1418,11 @@ void NodeInstanceServer::view3DAction(const View3DActionCommand &command)
Q_UNUSED(command)
}
+void NodeInstanceServer::requestModelNodePreviewImage(const RequestModelNodePreviewImageCommand &command)
+{
+ Q_UNUSED(command)
+}
+
void NodeInstanceServer::changeLanguage(const ChangeLanguageCommand &command)
{
setTranslationLanguage(command.language);
@@ -1456,4 +1461,46 @@ void NodeInstanceServer::disableTimer()
m_timerMode = TimerMode::DisableTimer;
}
+void NodeInstanceServer::sheduleRootItemRender()
+{
+ QSharedPointer<QQuickItemGrabResult> result = m_rootNodeInstance.createGrabResult();
+ qint32 instanceId = m_rootNodeInstance.instanceId();
+
+ if (result) {
+ connect(result.data(), &QQuickItemGrabResult::ready, [this, result, instanceId] {
+ QVector<ImageContainer> imageVector;
+ ImageContainer container(instanceId, result->image(), instanceId);
+ imageVector.append(container);
+ nodeInstanceClient()->pixmapChanged(PixmapChangedCommand(imageVector));
+ });
+ }
+}
+
+void NodeInstanceServer::initializeAuxiliaryViews()
+{
+}
+
+void NodeInstanceServer::handleInstanceLocked(const ServerNodeInstance &/*instance*/, bool /*enable*/,
+ bool /*checkAncestors*/)
+{
+}
+
+void NodeInstanceServer::handleInstanceHidden(const ServerNodeInstance &/*instance*/, bool /*enable*/,
+ bool /*checkAncestors*/)
+{
+}
+
+void NodeInstanceServer::setupState(qint32 stateInstanceId)
+{
+ if (hasInstanceForId(stateInstanceId)) {
+ if (activeStateInstance().isValid())
+ activeStateInstance().deactivateState();
+ ServerNodeInstance instance = instanceForId(stateInstanceId);
+ instance.activateState();
+ } else {
+ if (activeStateInstance().isValid())
+ activeStateInstance().deactivateState();
+ }
+}
+
} // namespace QmlDesigner
diff --git a/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/nodeinstanceserver.h b/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/nodeinstanceserver.h
index 0c5810b3ec..021a2bd6d0 100644
--- a/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/nodeinstanceserver.h
+++ b/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/nodeinstanceserver.h
@@ -152,6 +152,7 @@ public:
void changeSelection(const ChangeSelectionCommand &command) override;
void inputEvent(const InputEventCommand &command) override;
void view3DAction(const View3DActionCommand &command) override;
+ void requestModelNodePreviewImage(const RequestModelNodePreviewImageCommand &command) override;
void changeLanguage(const ChangeLanguageCommand &command) override;
void changePreviewImageSize(const ChangePreviewImageSizeCommand &command) override;
@@ -207,6 +208,9 @@ public:
virtual void collectItemChangesAndSendChangeCommands() = 0;
+ virtual void handleInstanceLocked(const ServerNodeInstance &instance, bool enable, bool checkAncestors);
+ virtual void handleInstanceHidden(const ServerNodeInstance &instance, bool enable, bool checkAncestors);
+
public slots:
void refreshLocalFileProperty(const QString &path);
void refreshDummyData(const QString &path);
@@ -240,6 +244,8 @@ protected:
ComponentCompletedCommand createComponentCompletedCommand(const QList<ServerNodeInstance> &instanceList);
ChangeSelectionCommand createChangeSelectionCommand(const QList<ServerNodeInstance> &instanceList);
+ void sheduleRootItemRender();
+
void addChangedProperty(const InstancePropertyPair &property);
virtual void startRenderTimer();
@@ -250,6 +256,7 @@ protected:
void setSlowRenderTimerInterval(int timerInterval);
virtual void initializeView() = 0;
+ virtual void initializeAuxiliaryViews();
virtual void setupScene(const CreateSceneCommand &command) = 0;
void setTranslationLanguage(const QString &language);
void loadDummyDataFiles(const QString& directory);
@@ -282,6 +289,7 @@ protected:
static QList<QObject*> allSubObjectsForObject(QObject *object);
virtual void resizeCanvasSizeToRootItemSize() = 0;
+ void setupState(qint32 stateInstanceId);
private:
void setupOnlyWorkingImports(const QStringList &workingImportStatementList);
diff --git a/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/nodeinstanceserverdispatcher.cpp b/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/nodeinstanceserverdispatcher.cpp
index a06a156e15..eb5aae6a7e 100644
--- a/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/nodeinstanceserverdispatcher.cpp
+++ b/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/nodeinstanceserverdispatcher.cpp
@@ -25,6 +25,7 @@
#include "nodeinstanceserverdispatcher.h"
+#include "qt5captureimagenodeinstanceserver.h"
#include "qt5capturepreviewnodeinstanceserver.h"
#include "qt5informationnodeinstanceserver.h"
#include "qt5rendernodeinstanceserver.h"
@@ -158,6 +159,12 @@ void NodeInstanceServerDispatcher::view3DAction(const View3DActionCommand &comma
server->view3DAction(command);
}
+void NodeInstanceServerDispatcher::requestModelNodePreviewImage(const RequestModelNodePreviewImageCommand &command)
+{
+ for (std::unique_ptr<NodeInstanceServer> &server : m_servers)
+ server->requestModelNodePreviewImage(command);
+}
+
void NodeInstanceServerDispatcher::changeLanguage(const ChangeLanguageCommand &command)
{
for (std::unique_ptr<NodeInstanceServer> &server : m_servers)
@@ -177,6 +184,8 @@ std::unique_ptr<NodeInstanceServer> createNodeInstanceServer(
{
if (serverName == "capturemode")
return std::make_unique<Qt5CapturePreviewNodeInstanceServer>(nodeInstanceClient);
+ else if (serverName == "captureiconmode")
+ return std::make_unique<Qt5CaptureImageNodeInstanceServer>(nodeInstanceClient);
else if (serverName == "rendermode")
return std::make_unique<Qt5RenderNodeInstanceServer>(nodeInstanceClient);
else if (serverName == "editormode")
diff --git a/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/nodeinstanceserverdispatcher.h b/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/nodeinstanceserverdispatcher.h
index c09c629573..03323a511d 100644
--- a/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/nodeinstanceserverdispatcher.h
+++ b/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/nodeinstanceserverdispatcher.h
@@ -58,6 +58,7 @@ public:
void changeSelection(const ChangeSelectionCommand &command);
void inputEvent(const InputEventCommand &command);
void view3DAction(const View3DActionCommand &command);
+ void requestModelNodePreviewImage(const RequestModelNodePreviewImageCommand &command);
void changeLanguage(const ChangeLanguageCommand &command);
void changePreviewImageSize(const ChangePreviewImageSizeCommand &command);
diff --git a/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/nodeinstancesignalspy.cpp b/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/nodeinstancesignalspy.cpp
index cb77360252..9d9c3ec8fa 100644
--- a/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/nodeinstancesignalspy.cpp
+++ b/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/nodeinstancesignalspy.cpp
@@ -89,7 +89,7 @@ void NodeInstanceSignalSpy::registerChildObject(const QMetaProperty &metaPropert
if (metaProperty.isReadable()
&& !metaProperty.isWritable()
&& QmlPrivateGate::isPropertyQObject(metaProperty)
- && QLatin1String(metaProperty.name()) != "parent") {
+ && QLatin1String(metaProperty.name()) != QLatin1String("parent")) {
QObject *childObject = QmlPrivateGate::readQObjectProperty(metaProperty, spiedObject);
if (childObject) {
diff --git a/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/objectnodeinstance.cpp b/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/objectnodeinstance.cpp
index 5991e2b28e..d7fba0a8e7 100644
--- a/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/objectnodeinstance.cpp
+++ b/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/objectnodeinstance.cpp
@@ -392,8 +392,24 @@ PropertyNameList ObjectNodeInstance::ignoredProperties() const
return PropertyNameList();
}
-void ObjectNodeInstance::setHideInEditor(bool)
+void ObjectNodeInstance::setHiddenInEditor(bool b)
{
+ m_isHiddenInEditor = b;
+}
+
+bool ObjectNodeInstance::isHiddenInEditor() const
+{
+ return m_isHiddenInEditor;
+}
+
+void ObjectNodeInstance::setLockedInEditor(bool b)
+{
+ m_isLockedInEditor = b;
+}
+
+bool ObjectNodeInstance::isLockedInEditor() const
+{
+ return m_isLockedInEditor;
}
void ObjectNodeInstance::setModifiedFlag(bool b)
@@ -908,6 +924,11 @@ QImage ObjectNodeInstance::renderPreviewImage(const QSize & /*previewImageSize*/
return QImage();
}
+QSharedPointer<QQuickItemGrabResult> ObjectNodeInstance::createGrabResult() const
+{
+ return {};
+}
+
QObject *ObjectNodeInstance::parent() const
{
if (!object())
diff --git a/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/objectnodeinstance.h b/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/objectnodeinstance.h
index 3026ffefce..01cb1c46fc 100644
--- a/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/objectnodeinstance.h
+++ b/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/objectnodeinstance.h
@@ -84,6 +84,8 @@ public:
virtual QImage renderImage() const;
virtual QImage renderPreviewImage(const QSize &previewImageSize) const;
+ virtual QSharedPointer<QQuickItemGrabResult> createGrabResult() const;
+
virtual QObject *parent() const;
Pointer parentInstance() const;
@@ -194,7 +196,11 @@ public:
virtual PropertyNameList ignoredProperties() const;
- void virtual setHideInEditor(bool b);
+ virtual void setHiddenInEditor(bool b);
+ bool isHiddenInEditor() const;
+
+ virtual void setLockedInEditor(bool b);
+ bool isLockedInEditor() const;
void setModifiedFlag(bool b);
@@ -211,6 +217,7 @@ protected:
void initializePropertyWatcher(const ObjectNodeInstance::Pointer &objectNodeInstance);
void ensureVector3DDotProperties(PropertyNameList &list) const;
+
private:
QString m_id;
@@ -225,6 +232,8 @@ private:
bool m_deleteHeldInstance;
bool m_isInLayoutable;
bool m_isModified = false;
+ bool m_isLockedInEditor = false;
+ bool m_isHiddenInEditor = false;
static QHash<EnumerationName, QVariant> m_enumationValueHash;
};
diff --git a/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/qt5captureimagenodeinstanceserver.cpp b/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/qt5captureimagenodeinstanceserver.cpp
new file mode 100644
index 0000000000..d24c4e5552
--- /dev/null
+++ b/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/qt5captureimagenodeinstanceserver.cpp
@@ -0,0 +1,84 @@
+/****************************************************************************
+**
+** Copyright (C) 2020 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of Qt Creator.
+**
+** 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 General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3 as published by the Free Software
+** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
+** 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-3.0.html.
+**
+****************************************************************************/
+
+#include "qt5captureimagenodeinstanceserver.h"
+#include "servernodeinstance.h"
+
+#include <captureddatacommand.h>
+#include <createscenecommand.h>
+#include <nodeinstanceclientinterface.h>
+
+#include <QImage>
+#include <QQuickItem>
+#include <QQuickView>
+
+namespace QmlDesigner {
+
+namespace {
+
+QImage renderImage(ServerNodeInstance rootNodeInstance)
+{
+ rootNodeInstance.updateDirtyNodeRecursive();
+
+ QSize previewImageSize = rootNodeInstance.boundingRect().size().toSize();
+ if (previewImageSize.isEmpty())
+ previewImageSize = {640, 480};
+
+ if (previewImageSize.width() > 800 || previewImageSize.height() > 800)
+ previewImageSize.scale({800, 800}, Qt::KeepAspectRatio);
+
+ QImage previewImage = rootNodeInstance.renderPreviewImage(previewImageSize);
+
+ return previewImage;
+}
+} // namespace
+
+void Qt5CaptureImageNodeInstanceServer::collectItemChangesAndSendChangeCommands()
+{
+ static bool inFunction = false;
+
+ if (!rootNodeInstance().holdsGraphical()) {
+ nodeInstanceClient()->capturedData(CapturedDataCommand{});
+ return;
+ }
+
+ if (!inFunction) {
+ inFunction = true;
+
+ auto rooNodeInstance = rootNodeInstance();
+ rooNodeInstance.rootQuickItem()->setClip(true);
+
+ DesignerSupport::polishItems(quickView());
+
+ QImage image = renderImage(rooNodeInstance);
+
+ nodeInstanceClient()->capturedData(CapturedDataCommand{std::move(image)});
+
+ slowDownRenderTimer();
+ inFunction = false;
+ }
+}
+
+} // namespace
diff --git a/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/qt5captureimagenodeinstanceserver.h b/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/qt5captureimagenodeinstanceserver.h
new file mode 100644
index 0000000000..7c26e47a87
--- /dev/null
+++ b/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/qt5captureimagenodeinstanceserver.h
@@ -0,0 +1,45 @@
+/****************************************************************************
+**
+** Copyright (C) 2020 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of Qt Creator.
+**
+** 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 General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3 as published by the Free Software
+** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
+** 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-3.0.html.
+**
+****************************************************************************/
+
+#pragma once
+
+#include <qt5previewnodeinstanceserver.h>
+
+namespace QmlDesigner {
+
+class Qt5CaptureImageNodeInstanceServer : public Qt5PreviewNodeInstanceServer
+{
+public:
+ explicit Qt5CaptureImageNodeInstanceServer(NodeInstanceClientInterface *nodeInstanceClient)
+ : Qt5PreviewNodeInstanceServer(nodeInstanceClient)
+ {}
+
+protected:
+ void collectItemChangesAndSendChangeCommands() override;
+
+private:
+};
+
+} // namespace QmlDesigner
diff --git a/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/qt5capturepreviewnodeinstanceserver.cpp b/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/qt5capturepreviewnodeinstanceserver.cpp
index c70ef76afe..7fb87defb0 100644
--- a/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/qt5capturepreviewnodeinstanceserver.cpp
+++ b/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/qt5capturepreviewnodeinstanceserver.cpp
@@ -100,7 +100,7 @@ void Qt5CapturePreviewNodeInstanceServer::collectItemChangesAndSendChangeCommand
stateInstance.deactivateState();
}
- nodeInstanceClient()->capturedData(CapturedDataCommand{stateDatas});
+ nodeInstanceClient()->capturedData(CapturedDataCommand{std::move(stateDatas)});
slowDownRenderTimer();
inFunction = false;
diff --git a/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/qt5informationnodeinstanceserver.cpp b/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/qt5informationnodeinstanceserver.cpp
index 6b6cbefa5e..07f2398151 100644
--- a/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/qt5informationnodeinstanceserver.cpp
+++ b/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/qt5informationnodeinstanceserver.cpp
@@ -62,6 +62,7 @@
#include "puppettocreatorcommand.h"
#include "inputeventcommand.h"
#include "view3dactioncommand.h"
+#include "requestmodelnodepreviewimagecommand.h"
#include "dummycontextobject.h"
#include "../editor3d/generalhelper.h"
@@ -75,6 +76,7 @@
#include <designersupportdelegate.h>
#include <qmlprivategate.h>
+#include <quickitemnodeinstance.h>
#include <QVector3D>
#include <QQmlProperty>
@@ -91,6 +93,9 @@
#include <QtQuick3D/private/qquick3dabstractlight_p.h>
#include <QtQuick3D/private/qquick3dviewport_p.h>
#include <QtQuick3D/private/qquick3dscenerootnode_p.h>
+#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
+#include "../editor3d/qt5compat/qquick3darealight_p.h"
+#endif
#endif
namespace QmlDesigner {
@@ -100,16 +105,91 @@ static QVariant objectToVariant(QObject *object)
return QVariant::fromValue(object);
}
+static QImage nonVisualComponentPreviewImage()
+{
+ static double ratio = qgetenv("FORMEDITOR_DEVICE_PIXEL_RATIO").toDouble();
+ if (ratio == 1.) {
+ static const QImage image(":/qtquickplugin/images/non-visual-component.png");
+ return image;
+ } else {
+ static const QImage image(":/qtquickplugin/images/non-visual-component@2x.png");
+ return image;
+ }
+}
+
+static bool imageHasContent(const QImage &image)
+{
+ // Check if any image pixel contains non-zero data
+ const uchar *pData = image.constBits();
+ const qsizetype size = image.sizeInBytes();
+ for (qsizetype i = 0; i < size; ++i) {
+ if (*(pData++) != 0)
+ return true;
+ }
+ return false;
+}
+
+static bool isQuick3DMode()
+{
+ static bool mode3D = qEnvironmentVariableIsSet("QMLDESIGNER_QUICK3D_MODE");
+ return mode3D;
+}
+
+QQuickView *Qt5InformationNodeInstanceServer::createAuxiliaryQuickView(const QUrl &url,
+ QQuickItem *&rootItem)
+{
+#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
+ auto view = new QQuickView(quickView()->engine(), quickView());
+ view->setFormat(quickView()->format());
+ DesignerSupport::createOpenGLContext(view);
+#else
+ auto view = new QQuickView(quickView()->engine(), nullptr);
+ view->setFormat(quickView()->format());
+#endif
+ QQmlComponent component(engine());
+ component.loadUrl(url);
+ rootItem = qobject_cast<QQuickItem *>(component.create());
+
+ if (!rootItem) {
+ qWarning() << "Could not create view for: " << url.toString() << component.errors();
+ return nullptr;
+ }
+
+ DesignerSupport::setRootItem(view, rootItem);
+
+ return view;
+}
+
+void Qt5InformationNodeInstanceServer::updateLockedAndHiddenStates(const QSet<ServerNodeInstance> &instances)
+{
+ if (!isQuick3DMode())
+ return;
+
+ // We only want to update the topmost parents in the set
+ for (const auto &instance : instances) {
+ if (instance.isValid()) {
+ const auto parentInst = instance.parent();
+ if (!parentInst.isValid() || !instances.contains(parentInst)) {
+ handleInstanceHidden(instance, instance.internalInstance()->isHiddenInEditor(), true);
+ handleInstanceLocked(instance, instance.internalInstance()->isLockedInEditor(), true);
+ }
+ }
+ }
+}
+
void Qt5InformationNodeInstanceServer::createEditView3D()
{
#ifdef QUICK3D_MODULE
qmlRegisterRevision<QQuick3DNode, 1>("MouseArea3D", 1, 0);
qmlRegisterType<QmlDesigner::Internal::MouseArea3D>("MouseArea3D", 1, 0, "MouseArea3D");
qmlRegisterType<QmlDesigner::Internal::CameraGeometry>("CameraGeometry", 1, 0, "CameraGeometry");
- qmlRegisterType<QmlDesigner::Internal::LightGeometry>("LightGeometry", 1, 0, "LightGeometry");
+ qmlRegisterType<QmlDesigner::Internal::LightGeometry>("LightUtils", 1, 0, "LightGeometry");
qmlRegisterType<QmlDesigner::Internal::GridGeometry>("GridGeometry", 1, 0, "GridGeometry");
qmlRegisterType<QmlDesigner::Internal::SelectionBoxGeometry>("SelectionBoxGeometry", 1, 0, "SelectionBoxGeometry");
qmlRegisterType<QmlDesigner::Internal::LineGeometry>("LineGeometry", 1, 0, "LineGeometry");
+#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
+ qmlRegisterType<QmlDesigner::Internal::QQuick3DAreaLight>("LightUtils", 1, 0, "AreaLight");
+#endif
auto helper = new QmlDesigner::Internal::GeneralHelper();
QObject::connect(helper, &QmlDesigner::Internal::GeneralHelper::toolStateChanged,
@@ -119,36 +199,10 @@ void Qt5InformationNodeInstanceServer::createEditView3D()
new QmlDesigner::Internal::IconGizmoImageProvider);
m_3dHelper = helper;
- m_editView3D = new QQuickView(quickView()->engine(), quickView());
- m_editView3D->setFormat(quickView()->format());
- DesignerSupport::createOpenGLContext(m_editView3D.data());
- QQmlComponent component(engine());
- component.loadUrl(QUrl("qrc:/qtquickplugin/mockfiles/EditView3D.qml"));
- m_editView3DRootItem = qobject_cast<QQuickItem *>(component.create());
-
- if (!m_editView3DRootItem) {
- qWarning() << "Could not create edit view 3D: " << component.errors();
- return;
- }
-
- DesignerSupport::setRootItem(m_editView3D, m_editView3DRootItem);
-
- QObject::connect(m_editView3DRootItem, SIGNAL(selectionChanged(QVariant)),
- this, SLOT(handleSelectionChanged(QVariant)));
- QObject::connect(m_editView3DRootItem, SIGNAL(commitObjectProperty(QVariant, QVariant)),
- this, SLOT(handleObjectPropertyCommit(QVariant, QVariant)));
- QObject::connect(m_editView3DRootItem, SIGNAL(changeObjectProperty(QVariant, QVariant)),
- this, SLOT(handleObjectPropertyChange(QVariant, QVariant)));
- QObject::connect(m_editView3DRootItem, SIGNAL(notifyActiveSceneChange()),
- this, SLOT(handleActiveSceneChange()));
- QObject::connect(&m_propertyChangeTimer, &QTimer::timeout,
- this, &Qt5InformationNodeInstanceServer::handleObjectPropertyChangeTimeout);
- QObject::connect(&m_selectionChangeTimer, &QTimer::timeout,
- this, &Qt5InformationNodeInstanceServer::handleSelectionChangeTimeout);
- QObject::connect(&m_renderTimer, &QTimer::timeout,
- this, &Qt5InformationNodeInstanceServer::doRender3DEditView);
+ m_editView3D = createAuxiliaryQuickView(QUrl("qrc:/qtquickplugin/mockfiles/EditView3D.qml"), m_editView3DRootItem);
- helper->setParent(m_editView3DRootItem);
+ if (m_editView3DRootItem)
+ helper->setParent(m_editView3DRootItem);
#endif
}
@@ -345,6 +399,9 @@ void Qt5InformationNodeInstanceServer::updateView3DRect(QObject *view3D)
void Qt5InformationNodeInstanceServer::updateActiveSceneToEditView3D()
{
#ifdef QUICK3D_MODULE
+ if (!m_editView3DSetupDone)
+ return;
+
// Active scene change handling on qml side is async, so a deleted importScene would crash
// editView when it updates next. Disable/enable edit view update synchronously to avoid this.
QVariant activeSceneVar = objectToVariant(m_active3DScene);
@@ -396,6 +453,9 @@ void Qt5InformationNodeInstanceServer::removeNode3D(QObject *node)
void Qt5InformationNodeInstanceServer::resolveSceneRoots()
{
#ifdef QUICK3D_MODULE
+ if (!m_editView3DSetupDone)
+ return;
+
const auto oldMap = m_3DSceneMap;
m_3DSceneMap.clear();
auto it = oldMap.begin();
@@ -440,55 +500,281 @@ ServerNodeInstance Qt5InformationNodeInstanceServer::active3DSceneInstance() con
return sceneInstance;
}
+void Qt5InformationNodeInstanceServer::updateNodesRecursive(QQuickItem *item)
+{
+ const auto childItems = item->childItems();
+ for (QQuickItem *childItem : childItems)
+ updateNodesRecursive(childItem);
+ if (Internal::QuickItemNodeInstance::unifiedRenderPath()) {
+ if (item->flags() & QQuickItem::ItemHasContents)
+ item->update();
+ } else {
+ DesignerSupport::updateDirtyNode(item);
+ }
+}
+
+QQuickItem *Qt5InformationNodeInstanceServer::getContentItemForRendering(QQuickItem *rootItem)
+{
+ QQuickItem *contentItem = QQmlProperty::read(rootItem, "contentItem").value<QQuickItem *>();
+ if (contentItem) {
+ if (!Internal::QuickItemNodeInstance::unifiedRenderPath())
+ designerSupport()->refFromEffectItem(contentItem, false);
+ QmlDesigner::Internal::QmlPrivateGate::disableNativeTextRendering(contentItem);
+ }
+ return contentItem;
+}
+
void Qt5InformationNodeInstanceServer::render3DEditView(int count)
{
- m_needRender = qMax(count, m_needRender);
- if (!m_renderTimer.isActive())
- m_renderTimer.start(0);
+ m_need3DEditViewRender = qMax(count, m_need3DEditViewRender);
+ if (!m_render3DEditViewTimer.isActive())
+ m_render3DEditViewTimer.start(0);
}
// render the 3D edit view and send the result to creator process
void Qt5InformationNodeInstanceServer::doRender3DEditView()
{
- if (m_editView3DRootItem) {
- if (!m_editView3DContentItem) {
- m_editView3DContentItem = QQmlProperty::read(m_editView3DRootItem, "contentItem").value<QQuickItem *>();
- if (m_editView3DContentItem) {
- designerSupport()->refFromEffectItem(m_editView3DContentItem, false);
- QmlDesigner::Internal::QmlPrivateGate::disableNativeTextRendering(m_editView3DContentItem);
- }
- }
+ if (m_editView3DSetupDone) {
+ if (!m_editView3DContentItem)
+ m_editView3DContentItem = getContentItemForRendering(m_editView3DRootItem);
+
+ QImage renderImage;
- std::function<void (QQuickItem *)> updateNodesRecursive;
- updateNodesRecursive = [&updateNodesRecursive](QQuickItem *item) {
- for (QQuickItem *childItem : item->childItems())
- updateNodesRecursive(childItem);
- DesignerSupport::updateDirtyNode(item);
- };
updateNodesRecursive(m_editView3DContentItem);
- // Fake render loop signaling to update things like QML items as 3D textures
- m_editView3D->beforeSynchronizing();
- m_editView3D->beforeRendering();
+#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
+ if (Internal::QuickItemNodeInstance::unifiedRenderPath()) {
+ renderImage = m_editView3D->grabWindow();
+ } else {
+ // Fake render loop signaling to update things like QML items as 3D textures
+ m_editView3D->beforeSynchronizing();
+ m_editView3D->beforeRendering();
- QSizeF size = qobject_cast<QQuickItem *>(m_editView3DContentItem)->size();
- QRectF renderRect(QPointF(0., 0.), size);
- QImage renderImage = designerSupport()->renderImageForItem(m_editView3DContentItem,
- renderRect, size.toSize());
+ QSizeF size = qobject_cast<QQuickItem *>(m_editView3DContentItem)->size();
+ QRectF renderRect(QPointF(0., 0.), size);
+ renderImage = designerSupport()->renderImageForItem(m_editView3DContentItem,
+ renderRect, size.toSize());
- m_editView3D->afterRendering();
+ m_editView3D->afterRendering();
+ }
+#else
+ renderImage = m_editView3D->grabWindow();
+#endif
// There's no instance related to image, so instance id is -1.
// Key number is selected so that it is unlikely to conflict other ImageContainer use.
- const qint32 edit3DKey = 2100000000;
- auto imgContainer = ImageContainer(-1, renderImage, edit3DKey);
+ auto imgContainer = ImageContainer(-1, renderImage, 2100000000);
// send the rendered image to creator process
nodeInstanceClient()->handlePuppetToCreatorCommand({PuppetToCreatorCommand::Render3DView,
QVariant::fromValue(imgContainer)});
- if (m_needRender > 0) {
- m_renderTimer.start(0);
- --m_needRender;
+ if (m_need3DEditViewRender > 0) {
+ m_render3DEditViewTimer.start(0);
+ --m_need3DEditViewRender;
+ }
+ }
+}
+
+void Qt5InformationNodeInstanceServer::renderModelNodeImageView()
+{
+ if (!m_renderModelNodeImageViewTimer.isActive())
+ m_renderModelNodeImageViewTimer.start(0);
+}
+
+void Qt5InformationNodeInstanceServer::doRenderModelNodeImageView()
+{
+
+ ServerNodeInstance instance;
+ if (m_modelNodePreviewImageCommand.renderItemId() >= 0)
+ instance = instanceForId(m_modelNodePreviewImageCommand.renderItemId());
+ else
+ instance = instanceForId(m_modelNodePreviewImageCommand.instanceId());
+
+ if (instance.isSubclassOf("QQuick3DObject"))
+ doRenderModelNode3DImageView();
+ else if (instance.isSubclassOf("QQuickItem"))
+ doRenderModelNode2DImageView();
+}
+
+void Qt5InformationNodeInstanceServer::doRenderModelNode3DImageView()
+{
+#ifdef QUICK3D_MODULE
+ if (m_ModelNode3DImageViewRootItem) {
+ if (!m_ModelNode3DImageViewContentItem)
+ m_ModelNode3DImageViewContentItem = getContentItemForRendering(m_ModelNode3DImageViewRootItem);
+
+ // Key number is selected so that it is unlikely to conflict other ImageContainer use.
+ auto imgContainer = ImageContainer(m_modelNodePreviewImageCommand.instanceId(), {}, 2100000001);
+ QImage renderImage;
+ if (m_modelNodePreviewImageCache.contains(m_modelNodePreviewImageCommand.componentPath())) {
+ renderImage = m_modelNodePreviewImageCache[m_modelNodePreviewImageCommand.componentPath()];
+ } else {
+ QObject *instanceObj = nullptr;
+ if (!m_modelNodePreviewImageCommand.componentPath().isEmpty()) {
+ QQmlComponent component(engine());
+ component.loadUrl(QUrl::fromLocalFile(m_modelNodePreviewImageCommand.componentPath()));
+ instanceObj = qobject_cast<QQuick3DObject *>(component.create());
+ if (!instanceObj) {
+ qWarning() << "Could not create preview component: " << component.errors();
+ return;
+ }
+ } else {
+ ServerNodeInstance instance = instanceForId(m_modelNodePreviewImageCommand.instanceId());
+ instanceObj = instance.internalObject();
+ }
+ QSize renderSize = m_modelNodePreviewImageCommand.size();
+ if (Internal::QuickItemNodeInstance::unifiedRenderPath()) {
+ // Requested size is already adjusted for target pixel ratio, so we have to adjust
+ // back if ratio is not default for our window.
+ double ratio = m_ModelNode3DImageView->devicePixelRatio();
+ renderSize.setWidth(qRound(qreal(renderSize.width()) / ratio));
+ renderSize.setHeight(qRound(qreal(renderSize.height()) / ratio));
+ }
+
+ QMetaObject::invokeMethod(m_ModelNode3DImageViewRootItem, "createViewForObject",
+ Q_ARG(QVariant, objectToVariant(instanceObj)),
+ Q_ARG(QVariant, QVariant::fromValue(renderSize.width())),
+ Q_ARG(QVariant, QVariant::fromValue(renderSize.height())));
+
+
+ bool ready = false;
+ int count = 0; // Ensure we don't ever get stuck in an infinite loop
+ while (!ready && ++count < 10) {
+ updateNodesRecursive(m_ModelNode3DImageViewContentItem);
+#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
+ if (Internal::QuickItemNodeInstance::unifiedRenderPath()) {
+ renderImage = m_ModelNode3DImageView->grabWindow();
+ } else {
+ // Fake render loop signaling to update things like QML items as 3D textures
+ m_ModelNode3DImageView->beforeSynchronizing();
+ m_ModelNode3DImageView->beforeRendering();
+
+ QSizeF size = qobject_cast<QQuickItem *>(m_ModelNode3DImageViewContentItem)->size();
+ QRectF renderRect(QPointF(0., 0.), size);
+ renderImage = designerSupport()->renderImageForItem(m_ModelNode3DImageViewContentItem,
+ renderRect, size.toSize());
+
+ m_ModelNode3DImageView->afterRendering();
+ }
+#else
+ renderImage = m_ModelNode3DImageView->grabWindow();
+#endif
+ QMetaObject::invokeMethod(m_ModelNode3DImageViewRootItem, "afterRender");
+ ready = QQmlProperty::read(m_ModelNode3DImageViewRootItem, "ready").value<bool>();
+ }
+ QMetaObject::invokeMethod(m_ModelNode3DImageViewRootItem, "destroyView");
+ if (!m_modelNodePreviewImageCommand.componentPath().isEmpty()) {
+ // If component changes, puppet will need a reset anyway, so we can cache the image
+ m_modelNodePreviewImageCache.insert(m_modelNodePreviewImageCommand.componentPath(), renderImage);
+ delete instanceObj;
+ }
+ }
+
+ if (!renderImage.isNull()) {
+ imgContainer.setImage(renderImage);
+
+ // send the rendered image to creator process
+ nodeInstanceClient()->handlePuppetToCreatorCommand({PuppetToCreatorCommand::RenderModelNodePreviewImage,
+ QVariant::fromValue(imgContainer)});
+ }
+ }
+#endif
+}
+
+static QRectF itemBoundingRect(QQuickItem *item)
+{
+ QRectF itemRect;
+ if (item) {
+ itemRect = item->boundingRect();
+ if (item->clip()) {
+ return itemRect;
+ } else {
+ const auto childItems = item->childItems();
+ for (const auto &childItem : childItems) {
+ QRectF mappedRect = childItem->mapRectToItem(item, itemBoundingRect(childItem));
+ // Sanity check for size
+ if (mappedRect.isValid() && (mappedRect.width() < 10000) && (mappedRect.height() < 10000))
+ itemRect = itemRect.united(mappedRect);
+ }
+ }
+ }
+ return itemRect;
+}
+
+void Qt5InformationNodeInstanceServer::doRenderModelNode2DImageView()
+{
+ if (m_ModelNode2DImageViewRootItem) {
+ if (!m_ModelNode2DImageViewContentItem)
+ m_ModelNode2DImageViewContentItem = getContentItemForRendering(m_ModelNode2DImageViewRootItem);
+
+ // Key number is the same as in 3D case as they produce image for same purpose
+ auto imgContainer = ImageContainer(m_modelNodePreviewImageCommand.instanceId(), {}, 2100000001);
+ QImage renderImage;
+ if (m_modelNodePreviewImageCache.contains(m_modelNodePreviewImageCommand.componentPath())) {
+ renderImage = m_modelNodePreviewImageCache[m_modelNodePreviewImageCommand.componentPath()];
+ } else {
+ QQuickItem *instanceItem = nullptr;
+
+ if (!m_modelNodePreviewImageCommand.componentPath().isEmpty()) {
+ QQmlComponent component(engine());
+ component.loadUrl(QUrl::fromLocalFile(m_modelNodePreviewImageCommand.componentPath()));
+ instanceItem = qobject_cast<QQuickItem *>(component.create());
+ if (!instanceItem) {
+ qWarning() << "Could not create preview component: " << component.errors();
+ return;
+ }
+ } else {
+ qWarning() << "2D image preview is not supported for non-components.";
+ return;
+ }
+
+ instanceItem->setParentItem(m_ModelNode2DImageViewContentItem);
+
+ // Some component may expect to always be shown at certain size, so their layouts may
+ // not support scaling, so let's always render at the default size if item has one and
+ // scale the resulting image instead.
+ QSize finalSize = m_modelNodePreviewImageCommand.size();
+ QRectF renderRect = itemBoundingRect(instanceItem);
+ QSize renderSize = renderRect.size().toSize();
+ if (renderSize.isEmpty()) {
+ renderSize = finalSize;
+ renderRect = QRectF(QPointF(0., 0.), QSizeF(renderSize));
+ }
+ m_ModelNode2DImageView->resize(renderSize);
+ m_ModelNode2DImageViewRootItem->setSize(renderSize);
+ m_ModelNode2DImageViewContentItem->setPosition(QPointF(-renderRect.x(), -renderRect.y()));
+
+ updateNodesRecursive(m_ModelNode2DImageViewContentItem);
+
+#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
+ if (Internal::QuickItemNodeInstance::unifiedRenderPath()) {
+ renderImage = m_ModelNode2DImageView->grabWindow();
+ } else {
+ renderImage = designerSupport()->renderImageForItem(m_ModelNode2DImageViewContentItem,
+ renderRect, renderSize);
+ }
+#else
+ renderImage = m_ModelNode2DImageView->grabWindow();
+#endif
+
+ if (!imageHasContent(renderImage))
+ renderImage = nonVisualComponentPreviewImage();
+
+ if (renderSize != finalSize)
+ renderImage = renderImage.scaled(finalSize, Qt::KeepAspectRatio);
+
+ delete instanceItem;
+
+ // If component changes, puppet will need a reset anyway, so we can cache the image
+ m_modelNodePreviewImageCache.insert(m_modelNodePreviewImageCommand.componentPath(), renderImage);
+ }
+
+ if (!renderImage.isNull()) {
+ imgContainer.setImage(renderImage);
+
+ // send the rendered image to creator process
+ nodeInstanceClient()->handlePuppetToCreatorCommand({PuppetToCreatorCommand::RenderModelNodePreviewImage,
+ QVariant::fromValue(imgContainer)});
}
}
}
@@ -499,7 +785,14 @@ Qt5InformationNodeInstanceServer::Qt5InformationNodeInstanceServer(NodeInstanceC
m_propertyChangeTimer.setInterval(100);
m_propertyChangeTimer.setSingleShot(true);
m_selectionChangeTimer.setSingleShot(true);
- m_renderTimer.setSingleShot(true);
+ m_render3DEditViewTimer.setSingleShot(true);
+ m_renderModelNodeImageViewTimer.setSingleShot(true);
+}
+
+Qt5InformationNodeInstanceServer::~Qt5InformationNodeInstanceServer()
+{
+ for (auto view : qAsConst(m_view3Ds))
+ QObject::disconnect(view, nullptr, this, nullptr);
}
void Qt5InformationNodeInstanceServer::sendTokenBack()
@@ -576,7 +869,7 @@ QList<ServerNodeInstance> Qt5InformationNodeInstanceServer::createInstances(
{
const auto createdInstances = NodeInstanceServer::createInstances(container);
- if (m_editView3DRootItem) {
+ if (m_editView3DSetupDone) {
add3DViewPorts(createdInstances);
add3DScenes(createdInstances);
createCameraAndLightGizmos(createdInstances);
@@ -587,6 +880,36 @@ QList<ServerNodeInstance> Qt5InformationNodeInstanceServer::createInstances(
return createdInstances;
}
+void Qt5InformationNodeInstanceServer::initializeAuxiliaryViews()
+{
+#ifdef QUICK3D_MODULE
+ if (isQuick3DMode())
+ createEditView3D();
+ m_ModelNode3DImageView = createAuxiliaryQuickView(QUrl("qrc:/qtquickplugin/mockfiles/ModelNode3DImageView.qml"),
+ m_ModelNode3DImageViewRootItem);
+#endif
+
+ m_ModelNode2DImageView = createAuxiliaryQuickView(QUrl("qrc:/qtquickplugin/mockfiles/ModelNode2DImageView.qml"),
+ m_ModelNode2DImageViewRootItem);
+ m_ModelNode2DImageView->setDefaultAlphaBuffer(true);
+ m_ModelNode2DImageView->setColor(Qt::transparent);
+
+#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
+ if (!m_editView3D.isNull()) {
+ m_editView3D->show();
+ m_editView3D->lower();
+ }
+ if (!m_ModelNode3DImageView.isNull()) {
+ m_ModelNode3DImageView->show();
+ m_ModelNode3DImageView->lower();
+ }
+ if (!m_ModelNode2DImageView.isNull()) {
+ m_ModelNode2DImageView->show();
+ m_ModelNode2DImageView->lower();
+ }
+#endif
+}
+
void Qt5InformationNodeInstanceServer::handleObjectPropertyChangeTimeout()
{
modifyVariantValue(m_changedNode, m_changedProperty,
@@ -809,12 +1132,28 @@ void Qt5InformationNodeInstanceServer::setup3DEditView(const QList<ServerNodeIns
const QHash<QString, QVariantMap> &toolStates)
{
#ifdef QUICK3D_MODULE
+ if (!m_editView3DRootItem)
+ return;
+
ServerNodeInstance root = rootNodeInstance();
add3DViewPorts(instanceList);
add3DScenes(instanceList);
- createEditView3D();
+ QObject::connect(m_editView3DRootItem, SIGNAL(selectionChanged(QVariant)),
+ this, SLOT(handleSelectionChanged(QVariant)));
+ QObject::connect(m_editView3DRootItem, SIGNAL(commitObjectProperty(QVariant, QVariant)),
+ this, SLOT(handleObjectPropertyCommit(QVariant, QVariant)));
+ QObject::connect(m_editView3DRootItem, SIGNAL(changeObjectProperty(QVariant, QVariant)),
+ this, SLOT(handleObjectPropertyChange(QVariant, QVariant)));
+ QObject::connect(m_editView3DRootItem, SIGNAL(notifyActiveSceneChange()),
+ this, SLOT(handleActiveSceneChange()));
+ QObject::connect(&m_propertyChangeTimer, &QTimer::timeout,
+ this, &Qt5InformationNodeInstanceServer::handleObjectPropertyChangeTimeout);
+ QObject::connect(&m_selectionChangeTimer, &QTimer::timeout,
+ this, &Qt5InformationNodeInstanceServer::handleSelectionChangeTimeout);
+ QObject::connect(&m_render3DEditViewTimer, &QTimer::timeout,
+ this, &Qt5InformationNodeInstanceServer::doRender3DEditView);
QString lastSceneId;
auto helper = qobject_cast<QmlDesigner::Internal::GeneralHelper *>(m_3dHelper);
@@ -835,7 +1174,7 @@ void Qt5InformationNodeInstanceServer::setup3DEditView(const QList<ServerNodeIns
// Find a scene to show
m_active3DScene = nullptr;
m_active3DView = nullptr;
- if (m_editView3DRootItem && !m_3DSceneMap.isEmpty()) {
+ if (!m_3DSceneMap.isEmpty()) {
// Restore the previous scene if possible
if (!lastSceneId.isEmpty()) {
const auto keys = m_3DSceneMap.uniqueKeys();
@@ -852,6 +1191,8 @@ void Qt5InformationNodeInstanceServer::setup3DEditView(const QList<ServerNodeIns
}
}
+ m_editView3DSetupDone = true;
+
if (toolStates.contains({})) {
// Update tool state to an existing no-scene state before updating the active scene to
// ensure the previous state is inherited properly in all cases.
@@ -924,6 +1265,7 @@ void Qt5InformationNodeInstanceServer::collectItemChangesAndSendChangeCommands()
if (!m_parentChangedSet.isEmpty()) {
sendChildrenChangedCommand(QtHelpers::toList(m_parentChangedSet));
+ updateLockedAndHiddenStates(m_parentChangedSet);
m_parentChangedSet.clear();
}
@@ -954,7 +1296,7 @@ void Qt5InformationNodeInstanceServer::reparentInstances(const ReparentInstances
Qt5NodeInstanceServer::reparentInstances(command);
- if (m_editView3DRootItem)
+ if (m_editView3DSetupDone)
resolveSceneRoots();
// Make sure selection is in sync after all reparentings are done
@@ -974,12 +1316,11 @@ void Qt5InformationNodeInstanceServer::createScene(const CreateSceneCommand &com
Qt5NodeInstanceServer::createScene(command);
QList<ServerNodeInstance> instanceList;
- foreach (const InstanceContainer &container, command.instances()) {
+ for (const InstanceContainer &container : std::as_const(command.instances)) {
if (hasInstanceForId(container.instanceId())) {
ServerNodeInstance instance = instanceForId(container.instanceId());
- if (instance.isValid()) {
+ if (instance.isValid())
instanceList.append(instance);
- }
}
}
@@ -988,8 +1329,11 @@ void Qt5InformationNodeInstanceServer::createScene(const CreateSceneCommand &com
sendChildrenChangedCommand(instanceList);
nodeInstanceClient()->componentCompleted(createComponentCompletedCommand(instanceList));
- if (qEnvironmentVariableIsSet("QMLDESIGNER_QUICK3D_MODE"))
- setup3DEditView(instanceList, command.edit3dToolStates());
+ if (isQuick3DMode())
+ setup3DEditView(instanceList, command.edit3dToolStates);
+
+ QObject::connect(&m_renderModelNodeImageViewTimer, &QTimer::timeout,
+ this, &Qt5InformationNodeInstanceServer::doRenderModelNodeImageView);
}
void Qt5InformationNodeInstanceServer::sendChildrenChangedCommand(const QList<ServerNodeInstance> &childList)
@@ -1048,7 +1392,7 @@ void QmlDesigner::Qt5InformationNodeInstanceServer::removeSharedMemory(const Qml
void Qt5InformationNodeInstanceServer::changeSelection(const ChangeSelectionCommand &command)
{
- if (!m_editView3DRootItem)
+ if (!m_editView3DSetupDone)
return;
m_lastSelectionChangeCommand = command;
@@ -1154,7 +1498,7 @@ void Qt5InformationNodeInstanceServer::removeInstances(const RemoveInstancesComm
resolveSceneRoots();
}
- if (m_editView3DRootItem && (!m_active3DScene || !m_active3DView)) {
+ if (m_editView3DSetupDone && (!m_active3DScene || !m_active3DView)) {
if (!m_active3DScene && !m_3DSceneMap.isEmpty())
m_active3DScene = m_3DSceneMap.begin().key();
m_active3DView = findView3DForSceneRoot(m_active3DScene);
@@ -1191,6 +1535,9 @@ void Qt5InformationNodeInstanceServer::inputEvent(const InputEventCommand &comma
void Qt5InformationNodeInstanceServer::view3DAction(const View3DActionCommand &command)
{
+ if (!m_editView3DSetupDone)
+ return;
+
QVariantMap updatedState;
int renderCount = 1;
@@ -1237,6 +1584,12 @@ void Qt5InformationNodeInstanceServer::view3DAction(const View3DActionCommand &c
render3DEditView(renderCount);
}
+void Qt5InformationNodeInstanceServer::requestModelNodePreviewImage(const RequestModelNodePreviewImageCommand &command)
+{
+ m_modelNodePreviewImageCommand = command;
+ renderModelNodeImageView();
+}
+
void Qt5InformationNodeInstanceServer::changeAuxiliaryValues(const ChangeAuxiliaryCommand &command)
{
Qt5NodeInstanceServer::changeAuxiliaryValues(command);
@@ -1254,20 +1607,22 @@ void Qt5InformationNodeInstanceServer::changeIds(const ChangeIdsCommand &command
Qt5NodeInstanceServer::changeIds(command);
#ifdef QUICK3D_MODULE
- ServerNodeInstance sceneInstance = active3DSceneInstance();
- if (m_active3DSceneUpdatePending) {
- const QString sceneId = sceneInstance.id();
- if (!sceneId.isEmpty())
- updateActiveSceneToEditView3D();
- } else {
- qint32 sceneInstanceId = sceneInstance.instanceId();
- for (const auto &id : command.ids) {
- if (sceneInstanceId == id.instanceId()) {
- QMetaObject::invokeMethod(m_editView3DRootItem, "handleActiveSceneIdChange",
- Qt::QueuedConnection,
- Q_ARG(QVariant, QVariant(sceneInstance.id())));
- render3DEditView();
- break;
+ if (m_editView3DSetupDone) {
+ ServerNodeInstance sceneInstance = active3DSceneInstance();
+ if (m_active3DSceneUpdatePending) {
+ const QString sceneId = sceneInstance.id();
+ if (!sceneId.isEmpty())
+ updateActiveSceneToEditView3D();
+ } else {
+ qint32 sceneInstanceId = sceneInstance.instanceId();
+ for (const auto &id : command.ids) {
+ if (sceneInstanceId == id.instanceId()) {
+ QMetaObject::invokeMethod(m_editView3DRootItem, "handleActiveSceneIdChange",
+ Qt::QueuedConnection,
+ Q_ARG(QVariant, QVariant(sceneInstance.id())));
+ render3DEditView();
+ break;
+ }
}
}
}
@@ -1281,12 +1636,123 @@ void Qt5InformationNodeInstanceServer::changeState(const ChangeStateCommand &com
render3DEditView();
}
+void Qt5InformationNodeInstanceServer::removeProperties(const RemovePropertiesCommand &command)
+{
+ Qt5NodeInstanceServer::removeProperties(command);
+
+ render3DEditView();
+}
+
+void Qt5InformationNodeInstanceServer::handleInstanceLocked(const ServerNodeInstance &instance,
+ bool enable, bool checkAncestors)
+{
+#ifdef QUICK3D_MODULE
+ if (!isQuick3DMode())
+ return;
+
+ bool edit3dLocked = enable;
+ if (!edit3dLocked || checkAncestors) {
+ auto parentInst = instance.parent();
+ while (!edit3dLocked && parentInst.isValid()) {
+ edit3dLocked = parentInst.internalInstance()->isLockedInEditor();
+ parentInst = parentInst.parent();
+ }
+ }
+
+ QObject *obj = instance.internalObject();
+ auto node = qobject_cast<QQuick3DNode *>(obj);
+ if (node)
+ node->setProperty("_edit3dLocked", edit3dLocked);
+ const auto children = obj->children();
+ for (auto child : children) {
+ if (hasInstanceForObject(child)) {
+ const ServerNodeInstance childInstance = instanceForObject(child);
+ if (childInstance.isValid()) {
+ auto objInstance = childInstance.internalInstance();
+ // Don't override explicit lock on children
+ handleInstanceLocked(childInstance, edit3dLocked || objInstance->isLockedInEditor(), false);
+ }
+ }
+ }
+#endif
+}
+
+void Qt5InformationNodeInstanceServer::handleInstanceHidden(const ServerNodeInstance &instance,
+ bool enable, bool checkAncestors)
+{
+#ifdef QUICK3D_MODULE
+ if (!isQuick3DMode())
+ return;
+
+ bool edit3dHidden = enable;
+ if (!edit3dHidden || checkAncestors) {
+ // We do not care about hidden status of non-3D ancestor nodes, as the 3D scene
+ // can be considered a separate visual entity in the whole scene.
+ auto parentInst = instance.parent();
+ while (!edit3dHidden && parentInst.isValid() && qobject_cast<QQuick3DNode *>(parentInst.internalObject())) {
+ edit3dHidden = parentInst.internalInstance()->isHiddenInEditor();
+ parentInst = parentInst.parent();
+ }
+ }
+
+ auto node = qobject_cast<QQuick3DNode *>(instance.internalObject());
+ if (node) {
+ bool isInstanceHidden = false;
+ auto getQuick3DInstanceAndHidden = [this, &isInstanceHidden](QQuick3DObject *obj) -> ServerNodeInstance {
+ if (hasInstanceForObject(obj)) {
+ const ServerNodeInstance instance = instanceForObject(obj);
+ if (instance.isValid() && qobject_cast<QQuick3DNode *>(instance.internalObject())) {
+ auto objInstance = instance.internalInstance();
+ isInstanceHidden = objInstance->isHiddenInEditor();
+ return instance;
+ }
+ }
+ return {};
+ };
+ // Always make sure the hide status is correct on the node tree from this point on,
+ // as changes in the node tree (reparenting, adding new nodes) can make the previously set
+ // hide status based on ancestor unreliable.
+ node->setProperty("_edit3dHidden", edit3dHidden);
+ if (auto model = qobject_cast<QQuick3DModel *>(node))
+ model->setPickable(!edit3dHidden); // allow 3D objects to receive mouse clicks
+ const auto childItems = node->childItems();
+ for (auto childItem : childItems) {
+ const ServerNodeInstance quick3dInstance = getQuick3DInstanceAndHidden(childItem);
+ if (quick3dInstance.isValid()) {
+ // Don't override explicit hide in children
+ handleInstanceHidden(quick3dInstance, edit3dHidden || isInstanceHidden, false);
+ } else {
+ // Children of components do not have instances, but will still need to be pickable
+ std::function<void(QQuick3DNode *)> checkChildren;
+ checkChildren = [&](QQuick3DNode *checkNode) {
+ const auto childItems = checkNode->childItems();
+ for (auto child : childItems) {
+ if (auto childNode = qobject_cast<QQuick3DNode *>(child))
+ checkChildren(childNode);
+ }
+ if (auto checkModel = qobject_cast<QQuick3DModel *>(checkNode)) {
+ QVariant value;
+ if (!edit3dHidden)
+ value = QVariant::fromValue(node);
+ // Specify the actual pick target with dynamic property
+ checkModel->setProperty("_pickTarget", value);
+ checkModel->setPickable(!edit3dHidden);
+ }
+ };
+ if (auto childNode = qobject_cast<QQuick3DNode *>(childItem))
+ checkChildren(childNode);
+ }
+ }
+ }
+#endif
+}
+
// update 3D view size when it changes in creator side
void Qt5InformationNodeInstanceServer::update3DViewState(const Update3dViewStateCommand &command)
{
#ifdef QUICK3D_MODULE
if (command.type() == Update3dViewStateCommand::SizeChange) {
- if (m_editView3DRootItem) {
+ if (m_editView3DSetupDone) {
m_editView3DRootItem->setSize(command.size());
auto helper = qobject_cast<QmlDesigner::Internal::GeneralHelper *>(m_3dHelper);
if (helper)
diff --git a/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/qt5informationnodeinstanceserver.h b/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/qt5informationnodeinstanceserver.h
index 40668da55d..f703e9fcb8 100644
--- a/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/qt5informationnodeinstanceserver.h
+++ b/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/qt5informationnodeinstanceserver.h
@@ -29,10 +29,13 @@
#include "tokencommand.h"
#include "valueschangedcommand.h"
#include "changeselectioncommand.h"
+#include "requestmodelnodepreviewimagecommand.h"
#include <QTimer>
#include <QVariant>
#include <QPointer>
+#include <QImage>
+#include <QUrl>
QT_BEGIN_NAMESPACE
class QDragMoveEvent;
@@ -46,6 +49,7 @@ class Qt5InformationNodeInstanceServer : public Qt5NodeInstanceServer
public:
explicit Qt5InformationNodeInstanceServer(NodeInstanceClientInterface *nodeInstanceClient);
+ ~Qt5InformationNodeInstanceServer() override;
void reparentInstances(const ReparentInstancesCommand &command) override;
void clearScene(const ClearSceneCommand &command) override;
@@ -59,10 +63,15 @@ public:
void removeInstances(const RemoveInstancesCommand &command) override;
void inputEvent(const InputEventCommand &command) override;
void view3DAction(const View3DActionCommand &command) override;
+ void requestModelNodePreviewImage(const RequestModelNodePreviewImageCommand &command) override;
void changeAuxiliaryValues(const ChangeAuxiliaryCommand &command) override;
void changePropertyBindings(const ChangeBindingsCommand &command) override;
void changeIds(const ChangeIdsCommand &command) override;
void changeState(const ChangeStateCommand &command) override;
+ void removeProperties(const RemovePropertiesCommand &command) override;
+
+ void handleInstanceLocked(const ServerNodeInstance &instance, bool enable, bool checkAncestors) override;
+ void handleInstanceHidden(const ServerNodeInstance &instance, bool enable, bool checkAncestors) override;
private slots:
void handleSelectionChanged(const QVariant &objs);
@@ -84,11 +93,13 @@ protected:
void selectInstances(const QList<ServerNodeInstance> &instanceList);
void modifyProperties(const QVector<InstancePropertyValueTriple> &properties);
QList<ServerNodeInstance> createInstances(const QVector<InstanceContainer> &container) override;
+ void initializeAuxiliaryViews() override;
private:
void handleObjectPropertyChangeTimeout();
void handleSelectionChangeTimeout();
void createEditView3D();
+ void create3DPreviewView();
void setup3DEditView(const QList<ServerNodeInstance> &instanceList,
const QHash<QString, QVariantMap> &toolStates);
void createCameraAndLightGizmos(const QList<ServerNodeInstance> &instanceList) const;
@@ -110,12 +121,29 @@ private:
void removeNode3D(QObject *node);
void resolveSceneRoots();
ServerNodeInstance active3DSceneInstance() const;
+ void updateNodesRecursive(QQuickItem *item);
+ QQuickItem *getContentItemForRendering(QQuickItem *rootItem);
void render3DEditView(int count = 1);
void doRender3DEditView();
+ void renderModelNodeImageView();
+ void doRenderModelNodeImageView();
+ void doRenderModelNode3DImageView();
+ void doRenderModelNode2DImageView();
+ QQuickView *createAuxiliaryQuickView(const QUrl &url, QQuickItem *&rootItem);
+ void updateLockedAndHiddenStates(const QSet<ServerNodeInstance> &instances);
QPointer<QQuickView> m_editView3D;
QQuickItem *m_editView3DRootItem = nullptr;
QQuickItem *m_editView3DContentItem = nullptr;
+ bool m_editView3DSetupDone = false;
+ QPointer<QQuickView> m_ModelNode3DImageView;
+ QQuickItem *m_ModelNode3DImageViewRootItem = nullptr;
+ QQuickItem *m_ModelNode3DImageViewContentItem = nullptr;
+ QPointer<QQuickView> m_ModelNode2DImageView;
+ QQuickItem *m_ModelNode2DImageViewRootItem = nullptr;
+ QQuickItem *m_ModelNode2DImageViewContentItem = nullptr;
+ RequestModelNodePreviewImageCommand m_modelNodePreviewImageCommand;
+ QHash<QString, QImage> m_modelNodePreviewImageCache;
QSet<QObject *> m_view3Ds;
QMultiHash<QObject *, QObject *> m_3DSceneMap; // key: scene root, value: node
QObject *m_active3DView = nullptr;
@@ -126,12 +154,13 @@ private:
QList<TokenCommand> m_tokenList;
QTimer m_propertyChangeTimer;
QTimer m_selectionChangeTimer;
- QTimer m_renderTimer;
+ QTimer m_render3DEditViewTimer;
+ QTimer m_renderModelNodeImageViewTimer;
QVariant m_changedNode;
PropertyName m_changedProperty;
ChangeSelectionCommand m_lastSelectionChangeCommand;
QObject *m_3dHelper = nullptr;
- int m_needRender = 0;
+ int m_need3DEditViewRender = 0;
};
} // namespace QmlDesigner
diff --git a/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/qt5nodeinstanceclientproxy.cpp b/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/qt5nodeinstanceclientproxy.cpp
index defbf5614a..93e6e786cd 100644
--- a/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/qt5nodeinstanceclientproxy.cpp
+++ b/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/qt5nodeinstanceclientproxy.cpp
@@ -28,11 +28,13 @@
#include <QCoreApplication>
#include "capturenodeinstanceserverdispatcher.h"
+#include "qt5captureimagenodeinstanceserver.h"
#include "qt5capturepreviewnodeinstanceserver.h"
#include "qt5informationnodeinstanceserver.h"
#include "qt5previewnodeinstanceserver.h"
#include "qt5rendernodeinstanceserver.h"
#include "qt5testnodeinstanceserver.h"
+#include "quickitemnodeinstance.h"
#include <designersupportdelegate.h>
@@ -56,7 +58,19 @@ Qt5NodeInstanceClientProxy::Qt5NodeInstanceClientProxy(QObject *parent) :
NodeInstanceClientProxy(parent)
{
prioritizeDown();
- DesignerSupport::activateDesignerWindowManager();
+#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
+ const bool qt6 = false;
+#else
+ const bool qt6 = true;
+#endif
+
+ const bool unifiedRenderPath = qt6 || qEnvironmentVariableIsSet("QMLPUPPET_UNIFIED_RENDER_PATH");
+
+ if (unifiedRenderPath)
+ Internal::QuickItemNodeInstance::enableUnifiedRenderPath(true);
+ else
+ DesignerSupport::activateDesignerWindowManager();
+
if (QCoreApplication::arguments().at(1) == QLatin1String("--readcapturedstream")) {
qputenv("DESIGNER_DONT_USE_SHARED_MEMORY", "1");
setNodeInstanceServer(std::make_unique<Qt5TestNodeInstanceServer>(this));
@@ -79,6 +93,9 @@ Qt5NodeInstanceClientProxy::Qt5NodeInstanceClientProxy(QObject *parent) :
} else if (QCoreApplication::arguments().at(2) == QLatin1String("capturemode")) {
setNodeInstanceServer(std::make_unique<Qt5CapturePreviewNodeInstanceServer>(this));
initializeSocket();
+ } else if (QCoreApplication::arguments().at(2) == QLatin1String("captureiconmode")) {
+ setNodeInstanceServer(std::make_unique<Qt5CaptureImageNodeInstanceServer>(this));
+ initializeSocket();
}
}
diff --git a/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/qt5nodeinstanceserver.cpp b/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/qt5nodeinstanceserver.cpp
index 8a4b086aa5..8ea68bd231 100644
--- a/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/qt5nodeinstanceserver.cpp
+++ b/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/qt5nodeinstanceserver.cpp
@@ -64,6 +64,8 @@ void Qt5NodeInstanceServer::initializeView()
m_quickView = new QQuickView;
+#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
+ /* enables grab window without show */
QSurfaceFormat surfaceFormat = m_quickView->requestedFormat();
surfaceFormat.setVersion(4, 1);
surfaceFormat.setProfile(QSurfaceFormat::CoreProfile);
@@ -72,12 +74,21 @@ void Qt5NodeInstanceServer::initializeView()
m_quickView->setFormat(surfaceFormat);
DesignerSupport::createOpenGLContext(m_quickView.data());
+#endif
if (qEnvironmentVariableIsSet("QML_FILE_SELECTORS")) {
QQmlFileSelector *fileSelector = new QQmlFileSelector(engine(), engine());
QStringList customSelectors = QString::fromUtf8(qgetenv("QML_FILE_SELECTORS")).split(',');
fileSelector->setExtraSelectors(customSelectors);
}
+
+#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
+ // View needs to be shown for all puppets before any instances are created in case there is a View3D
+ quickView()->show();
+ quickView()->lower();
+#endif
+
+ initializeAuxiliaryViews();
}
QQmlView *Qt5NodeInstanceServer::declarativeView() const
@@ -105,11 +116,10 @@ void Qt5NodeInstanceServer::resetAllItems()
void Qt5NodeInstanceServer::setupScene(const CreateSceneCommand &command)
{
-
- setupMockupTypes(command.mockupTypes());
- setupFileUrl(command.fileUrl());
- setupImports(command.imports());
- setupDummyData(command.fileUrl());
+ setupMockupTypes(command.mockupTypes);
+ setupFileUrl(command.fileUrl);
+ setupImports(command.imports);
+ setupDummyData(command.fileUrl);
setupInstances(command);
quickView()->resize(rootNodeInstance().boundingRect().size().toSize());
diff --git a/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/qt5previewnodeinstanceserver.cpp b/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/qt5previewnodeinstanceserver.cpp
index 810c8f0dcf..ae167ad6ca 100644
--- a/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/qt5previewnodeinstanceserver.cpp
+++ b/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/qt5previewnodeinstanceserver.cpp
@@ -46,7 +46,7 @@ Qt5PreviewNodeInstanceServer::Qt5PreviewNodeInstanceServer(NodeInstanceClientInt
void Qt5PreviewNodeInstanceServer::createScene(const CreateSceneCommand &command)
{
- setTranslationLanguage(command.language());
+ setTranslationLanguage(command.language);
initializeView();
setupScene(command);
startRenderTimer();
diff --git a/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/qt5rendernodeinstanceserver.cpp b/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/qt5rendernodeinstanceserver.cpp
index 08b20ccd22..4a45c626be 100644
--- a/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/qt5rendernodeinstanceserver.cpp
+++ b/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/qt5rendernodeinstanceserver.cpp
@@ -87,17 +87,27 @@ void Qt5RenderNodeInstanceServer::collectItemChangesAndSendChangeCommands()
if (ancestorInstance.isValid())
m_dirtyInstanceSet.insert(ancestorInstance);
}
- DesignerSupport::updateDirtyNode(item);
+ Internal::QuickItemNodeInstance::updateDirtyNode(item);
}
}
clearChangedPropertyList();
- if (!m_dirtyInstanceSet.isEmpty()) {
- nodeInstanceClient()->pixmapChanged(createPixmapChangedCommand(QtHelpers::toList(m_dirtyInstanceSet)));
- m_dirtyInstanceSet.clear();
+ if (Internal::QuickItemNodeInstance::unifiedRenderPath()) {
+ /* QQuickItem::grabToImage render path */
+ /* TODO implement QQuickItem::grabToImage based rendering */
+ /* sheduleRootItemRender(); */
+ nodeInstanceClient()->pixmapChanged(createPixmapChangedCommand({rootNodeInstance()}));
+ } else {
+ if (!m_dirtyInstanceSet.isEmpty()) {
+ nodeInstanceClient()->pixmapChanged(
+ createPixmapChangedCommand(QtHelpers::toList(m_dirtyInstanceSet)));
+ m_dirtyInstanceSet.clear();
+ }
}
+ m_dirtyInstanceSet.clear();
+
resetAllItems();
slowDownRenderTimer();
@@ -127,7 +137,7 @@ void Qt5RenderNodeInstanceServer::createScene(const CreateSceneCommand &command)
Qt5NodeInstanceServer::createScene(command);
QList<ServerNodeInstance> instanceList;
- foreach (const InstanceContainer &container, command.instances()) {
+ for (const InstanceContainer &container : std::as_const(command.instances)) {
if (hasInstanceForId(container.instanceId())) {
ServerNodeInstance instance = instanceForId(container.instanceId());
if (instance.isValid()) {
diff --git a/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/quick3dnodeinstance.cpp b/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/quick3dnodeinstance.cpp
index 907896cdd4..c8bbc46ddb 100644
--- a/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/quick3dnodeinstance.cpp
+++ b/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/quick3dnodeinstance.cpp
@@ -57,7 +57,6 @@ void Quick3DNodeInstance::initialize(const ObjectNodeInstance::Pointer &objectNo
InstanceContainer::NodeFlags flags)
{
ObjectNodeInstance::initialize(objectNodeInstance, flags);
- setPickable(true, true, false);
}
Qt5NodeInstanceServer *Quick3DNodeInstance::qt5NodeInstanceServer() const
@@ -74,71 +73,6 @@ QQuick3DNode *Quick3DNodeInstance::quick3DNode() const
#endif
}
-void Quick3DNodeInstance::setPickable(bool enable, bool checkParent, bool applyToChildInstances)
-{
-#ifdef QUICK3D_MODULE
- auto node = quick3DNode();
- if (node) {
- bool parentHidden = false;
- if (checkParent) {
- // First check if any parent node is already hidden. Never set pickable on that case.
- auto parentNode = node->parentNode();
- while (parentNode && !parentHidden) {
- parentHidden = QQuick3DNodePrivate::get(parentNode)->m_isHiddenInEditor;
- parentNode = parentNode->parentNode();
- }
-
- }
- if (!parentHidden) {
- auto getQuick3DInstance = [this](QQuick3DObject *obj) -> Quick3DNodeInstance * {
- if (nodeInstanceServer()->hasInstanceForObject(obj)) {
- ServerNodeInstance instance = nodeInstanceServer()->instanceForObject(obj);
- if (instance.isValid() && qobject_cast<QQuick3DNode *>(instance.internalObject()))
- return static_cast<Quick3DNodeInstance *>(instance.internalInstance().data());
- }
- return nullptr;
- };
- const auto childItems = node->childItems();
- for (auto childItem : childItems) {
- if (auto quick3dInstance = getQuick3DInstance(childItem)) {
- if (applyToChildInstances) {
- // Don't override explicit block in children
- if (!QQuick3DNodePrivate::get(quick3dInstance->quick3DNode())->m_isHiddenInEditor)
- quick3dInstance->setPickable(enable, false, true);
- }
- } else {
- // Children of components do not have instances, but will still need to be
- // pickable. These need to be set even if applyToChildInstances is false.
- std::function<void(QQuick3DNode *)> checkChildren;
- checkChildren = [&](QQuick3DNode *checkNode) {
- const auto childItems = checkNode->childItems();
- for (auto child : childItems) {
- if (auto childNode = qobject_cast<QQuick3DNode *>(child))
- checkChildren(childNode);
- }
- if (auto checkModel = qobject_cast<QQuick3DModel *>(checkNode)) {
- QVariant value;
- if (enable)
- value = QVariant::fromValue(node);
- // Specify the actual pick target with dynamic property
- checkModel->setProperty("_pickTarget", value);
- checkModel->setPickable(enable);
- }
- };
- checkChildren(node);
- }
- }
- if (qobject_cast<QQuick3DModel *>(node))
- setPropertyVariant("pickable", enable); // allow 3D objects to receive mouse clicks
- }
- }
-#else
- Q_UNUSED(enable)
- Q_UNUSED(checkParent)
- Q_UNUSED(applyToChildInstances)
-#endif
-}
-
Quick3DNodeInstance::Pointer Quick3DNodeInstance::create(QObject *object)
{
Pointer instance(new Quick3DNodeInstance(object));
@@ -146,18 +80,13 @@ Quick3DNodeInstance::Pointer Quick3DNodeInstance::create(QObject *object)
return instance;
}
-void Quick3DNodeInstance::setHideInEditor(bool b)
+void Quick3DNodeInstance::setHiddenInEditor(bool b)
{
+ ObjectNodeInstance::setHiddenInEditor(b);
#ifdef QUICK3D_MODULE
QQuick3DNodePrivate *privateNode = QQuick3DNodePrivate::get(quick3DNode());
- if (privateNode) {
+ if (privateNode)
privateNode->setIsHiddenInEditor(b);
-
- // Hidden objects should not be pickable
- setPickable(!b, true, true);
- }
-#else
- Q_UNUSED(b)
#endif
}
diff --git a/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/quick3dnodeinstance.h b/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/quick3dnodeinstance.h
index 7b48ea9193..892946ee1f 100644
--- a/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/quick3dnodeinstance.h
+++ b/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/quick3dnodeinstance.h
@@ -43,7 +43,7 @@ public:
~Quick3DNodeInstance() override;
static Pointer create(QObject *objectToBeWrapped);
- void setHideInEditor(bool b) override;
+ void setHiddenInEditor(bool b) override;
void initialize(const ObjectNodeInstance::Pointer &objectNodeInstance,
InstanceContainer::NodeFlags flags) override;
@@ -53,7 +53,6 @@ protected:
private:
Qt5NodeInstanceServer *qt5NodeInstanceServer() const;
QQuick3DNode *quick3DNode() const;
- void setPickable(bool enable, bool checkParent, bool applyToChildInstances);
};
} // namespace Internal
diff --git a/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/quickitemnodeinstance.cpp b/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/quickitemnodeinstance.cpp
index 6e67d58b92..1c08b408e6 100644
--- a/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/quickitemnodeinstance.cpp
+++ b/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/quickitemnodeinstance.cpp
@@ -41,6 +41,7 @@ namespace QmlDesigner {
namespace Internal {
bool QuickItemNodeInstance::s_createEffectItem = false;
+bool QuickItemNodeInstance::s_unifiedRenderPath = false;
QuickItemNodeInstance::QuickItemNodeInstance(QQuickItem *item)
: ObjectNodeInstance(item),
@@ -58,7 +59,7 @@ QuickItemNodeInstance::QuickItemNodeInstance(QQuickItem *item)
QuickItemNodeInstance::~QuickItemNodeInstance()
{
- if (quickItem())
+ if (quickItem() && checkIfRefFromEffect(instanceId()))
designerSupport()->derefFromEffectItem(quickItem());
}
@@ -156,6 +157,19 @@ void QuickItemNodeInstance::createEffectItem(bool createEffectItem)
s_createEffectItem = createEffectItem;
}
+void QuickItemNodeInstance::enableUnifiedRenderPath(bool unifiedRenderPath)
+{
+ s_unifiedRenderPath = unifiedRenderPath;
+}
+
+bool QuickItemNodeInstance::checkIfRefFromEffect(qint32 id)
+{
+ if (s_unifiedRenderPath)
+ return false;
+
+ return (s_createEffectItem || id == 0);
+}
+
void QuickItemNodeInstance::initialize(const ObjectNodeInstance::Pointer &objectNodeInstance,
InstanceContainer::NodeFlags flags)
{
@@ -166,10 +180,10 @@ void QuickItemNodeInstance::initialize(const ObjectNodeInstance::Pointer &object
quickItem()->setParentItem(qobject_cast<QQuickItem*>(nodeInstanceServer()->quickView()->rootObject()));
}
- if (quickItem()->window()) {
- if (s_createEffectItem || instanceId() == 0)
- designerSupport()->refFromEffectItem(quickItem(),
- !flags.testFlag(InstanceContainer::ParentTakesOverRendering));
+ if (quickItem()->window() && checkIfRefFromEffect(instanceId())) {
+ designerSupport()->refFromEffectItem(quickItem(),
+ !flags.testFlag(
+ InstanceContainer::ParentTakesOverRendering));
}
ObjectNodeInstance::initialize(objectNodeInstance, flags);
@@ -246,6 +260,18 @@ QStringList QuickItemNodeInstance::allStates() const
return list;
}
+void QuickItemNodeInstance::updateDirtyNode(QQuickItem *item)
+{
+ if (s_unifiedRenderPath)
+ return;
+ DesignerSupport::updateDirtyNode(item);
+}
+
+bool QuickItemNodeInstance::unifiedRenderPath()
+{
+ return s_unifiedRenderPath;
+}
+
QRectF QuickItemNodeInstance::contentItemBoundingBox() const
{
if (contentItem()) {
@@ -378,6 +404,9 @@ double QuickItemNodeInstance::y() const
QImage QuickItemNodeInstance::renderImage() const
{
+ if (s_unifiedRenderPath && !isRootNodeInstance())
+ return {};
+
updateDirtyNodesRecursive(quickItem());
QRectF renderBoundingRect = boundingRect();
@@ -386,13 +415,23 @@ QImage QuickItemNodeInstance::renderImage() const
static double devicePixelRatio = qgetenv("FORMEDITOR_DEVICE_PIXEL_RATIO").toDouble();
size *= devicePixelRatio;
- // Fake render loop signaling to update things like QML items as 3D textures
- nodeInstanceServer()->quickView()->beforeSynchronizing();
- nodeInstanceServer()->quickView()->beforeRendering();
+ QImage renderImage;
+
+#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
+ if (s_unifiedRenderPath) {
+ renderImage = nodeInstanceServer()->quickView()->grabWindow();
+ } else {
+ // Fake render loop signaling to update things like QML items as 3D textures
+ nodeInstanceServer()->quickView()->beforeSynchronizing();
+ nodeInstanceServer()->quickView()->beforeRendering();
- QImage renderImage = designerSupport()->renderImageForItem(quickItem(), renderBoundingRect, size);
+ renderImage = designerSupport()->renderImageForItem(quickItem(), renderBoundingRect, size);
- nodeInstanceServer()->quickView()->afterRendering();
+ nodeInstanceServer()->quickView()->afterRendering();
+ }
+#else
+ renderImage = nodeInstanceServer()->quickView()->grabWindow();
+#endif
renderImage.setDevicePixelRatio(devicePixelRatio);
@@ -407,13 +446,26 @@ QImage QuickItemNodeInstance::renderPreviewImage(const QSize &previewImageSize)
static double devicePixelRatio = qgetenv("FORMEDITOR_DEVICE_PIXEL_RATIO").toDouble();
const QSize size = previewImageSize * devicePixelRatio;
if (quickItem()->isVisible()) {
- // Fake render loop signaling to update things like QML items as 3D textures
- nodeInstanceServer()->quickView()->beforeSynchronizing();
- nodeInstanceServer()->quickView()->beforeRendering();
+ QImage image;
+#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
+ if (s_unifiedRenderPath) {
+ image = nodeInstanceServer()->quickView()->grabWindow();
+ } else {
+ // Fake render loop signaling to update things like QML items as 3D textures
+ nodeInstanceServer()->quickView()->beforeSynchronizing();
+ nodeInstanceServer()->quickView()->beforeRendering();
+
+ image = designerSupport()->renderImageForItem(quickItem(),
+ previewItemBoundingRect,
+ size);
- QImage image = designerSupport()->renderImageForItem(quickItem(), previewItemBoundingRect, size);
+ nodeInstanceServer()->quickView()->afterRendering();
+ }
+#else
+ image = nodeInstanceServer()->quickView()->grabWindow();
+#endif
- nodeInstanceServer()->quickView()->afterRendering();
+ image = image.scaledToWidth(size.width());
return image;
} else {
@@ -426,6 +478,11 @@ QImage QuickItemNodeInstance::renderPreviewImage(const QSize &previewImageSize)
return QImage();
}
+QSharedPointer<QQuickItemGrabResult> QuickItemNodeInstance::createGrabResult() const
+{
+ return quickItem()->grabToImage(size().toSize());
+}
+
void QuickItemNodeInstance::updateAllDirtyNodesRecursive()
{
updateAllDirtyNodesRecursive(quickItem());
@@ -490,10 +547,11 @@ void QuickItemNodeInstance::updateDirtyNodesRecursive(QQuickItem *parentItem) co
void QuickItemNodeInstance::updateAllDirtyNodesRecursive(QQuickItem *parentItem) const
{
- foreach (QQuickItem *childItem, parentItem->childItems())
- updateAllDirtyNodesRecursive(childItem);
+ const QList<QQuickItem *> children = parentItem->childItems();
+ for (QQuickItem *childItem : children)
+ updateAllDirtyNodesRecursive(childItem);
- DesignerSupport::updateDirtyNode(parentItem);
+ updateDirtyNode(parentItem);
}
static inline bool isRectangleSane(const QRectF &rect)
@@ -507,7 +565,7 @@ QRectF QuickItemNodeInstance::boundingRectWithStepChilds(QQuickItem *parentItem)
boundingRect = boundingRect.united(QRectF(QPointF(0, 0), size()));
- foreach (QQuickItem *childItem, parentItem->childItems()) {
+ for (QQuickItem *childItem : parentItem->childItems()) {
if (!nodeInstanceServer()->hasInstanceForObject(childItem)) {
QRectF transformedRect = childItem->mapRectToItem(parentItem, boundingRectWithStepChilds(childItem));
if (isRectangleSane(transformedRect))
@@ -515,6 +573,9 @@ QRectF QuickItemNodeInstance::boundingRectWithStepChilds(QQuickItem *parentItem)
}
}
+ if (boundingRect.isEmpty())
+ QRectF{0, 0, 640, 480};
+
return boundingRect;
}
@@ -624,7 +685,8 @@ void QuickItemNodeInstance::reparent(const ObjectNodeInstance::Pointer &oldParen
if (quickItem()->parentItem()) {
refresh();
- DesignerSupport::updateDirtyNode(quickItem());
+
+ updateDirtyNode(quickItem());
if (instanceIsValidLayoutable(oldParentInstance, oldParentProperty))
oldParentInstance->refreshLayoutable();
diff --git a/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/quickitemnodeinstance.h b/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/quickitemnodeinstance.h
index f42e45a8ff..2c68fe7974 100644
--- a/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/quickitemnodeinstance.h
+++ b/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/quickitemnodeinstance.h
@@ -45,6 +45,7 @@ public:
static Pointer create(QObject *objectToBeWrapped);
static void createEffectItem(bool createEffectItem);
+ static void enableUnifiedRenderPath(bool createEffectItem);
void initialize(const ObjectNodeInstance::Pointer &objectNodeInstance,
InstanceContainer::NodeFlags flags) override;
@@ -70,6 +71,8 @@ public:
QImage renderImage() const override;
QImage renderPreviewImage(const QSize &previewImageSize) const override;
+ QSharedPointer<QQuickItemGrabResult> createGrabResult() const override;
+
void updateAllDirtyNodesRecursive() override;
@@ -98,6 +101,9 @@ public:
QList<QQuickItem*> allItemsRecursive() const override;
QStringList allStates() const override;
+ static void updateDirtyNode(QQuickItem *item);
+ static bool unifiedRenderPath();
+
protected:
explicit QuickItemNodeInstance(QQuickItem*);
QQuickItem *quickItem() const;
@@ -118,6 +124,7 @@ protected:
double x() const;
double y() const;
+ bool checkIfRefFromEffect(qint32 id);
private: //variables
QPointer<QQuickItem> m_contentItem;
@@ -131,6 +138,7 @@ private: //variables
double m_width;
double m_height;
static bool s_createEffectItem;
+ static bool s_unifiedRenderPath;
};
} // namespace Internal
diff --git a/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/servernodeinstance.cpp b/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/servernodeinstance.cpp
index 69c854f3e9..f53e31b49f 100644
--- a/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/servernodeinstance.cpp
+++ b/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/servernodeinstance.cpp
@@ -120,6 +120,11 @@ QImage ServerNodeInstance::renderPreviewImage(const QSize &previewImageSize) con
return m_nodeInstance->renderPreviewImage(previewImageSize);
}
+QSharedPointer<QQuickItemGrabResult> ServerNodeInstance::createGrabResult() const
+{
+ return m_nodeInstance->createGrabResult();
+}
+
bool ServerNodeInstance::isRootNodeInstance() const
{
return isValid() && m_nodeInstance->isRootNodeInstance();
@@ -265,6 +270,9 @@ ServerNodeInstance ServerNodeInstance::create(NodeInstanceServer *nodeInstanceSe
instance.internalInstance()->initialize(instance.m_nodeInstance, instanceContainer.metaFlags());
+ // Handle hidden state to initialize pickable state
+ nodeInstanceServer->handleInstanceHidden(instance, false, false);
+
return instance;
}
@@ -341,9 +349,16 @@ void ServerNodeInstance::setPropertyBinding(const PropertyName &name, const QStr
m_nodeInstance->setPropertyBinding(name, expression);
}
-void ServerNodeInstance::setHideInEditor(bool b)
+void ServerNodeInstance::setHiddenInEditor(bool b)
+{
+ m_nodeInstance->setHiddenInEditor(b);
+ m_nodeInstance->nodeInstanceServer()->handleInstanceHidden(*this, b, true);
+}
+
+void ServerNodeInstance::setLockedInEditor(bool b)
{
- m_nodeInstance->setHideInEditor(b);
+ m_nodeInstance->setLockedInEditor(b);
+ m_nodeInstance->nodeInstanceServer()->handleInstanceLocked(*this, b, true);
}
void ServerNodeInstance::resetProperty(const PropertyName &name)
diff --git a/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/servernodeinstance.h b/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/servernodeinstance.h
index 975d0e8c37..786a09fd47 100644
--- a/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/servernodeinstance.h
+++ b/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/servernodeinstance.h
@@ -40,6 +40,7 @@ class QGraphicsItem;
class QGraphicsTransform;
#if (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0))
class QQuickItem;
+class QQuickItemGrabResult;
#endif
QT_END_NAMESPACE
@@ -102,6 +103,8 @@ public:
QImage renderImage() const;
QImage renderPreviewImage(const QSize &previewImageSize) const;
+ QSharedPointer<QQuickItemGrabResult> createGrabResult() const;
+
ServerNodeInstance parent() const;
bool hasParent() const;
@@ -182,7 +185,8 @@ private: // functions
void setPropertyBinding(const PropertyName &name, const QString &expression);
- void setHideInEditor(bool b);
+ void setHiddenInEditor(bool b);
+ void setLockedInEditor(bool b);
void resetProperty(const PropertyName &name);
void refreshProperty(const PropertyName &name);
diff --git a/share/qtcreator/qml/qmlpuppet/qml2puppet/qml2puppet.pri b/share/qtcreator/qml/qmlpuppet/qml2puppet/qml2puppet.pri
index f772fd8a55..1f4714d4d2 100644
--- a/share/qtcreator/qml/qmlpuppet/qml2puppet/qml2puppet.pri
+++ b/share/qtcreator/qml/qmlpuppet/qml2puppet/qml2puppet.pri
@@ -1,7 +1,7 @@
QT += core gui widgets qml quick network
QT += core-private qml-private quick-private gui-private
-CONFIG += c++11
+CONFIG += c++17
DEFINES -= QT_CREATOR
diff --git a/share/qtcreator/qml/qmlpuppet/qml2puppet/qml2puppetmain.cpp b/share/qtcreator/qml/qmlpuppet/qml2puppet/qml2puppetmain.cpp
index ee2f5bac59..cd2877a4f5 100644
--- a/share/qtcreator/qml/qmlpuppet/qml2puppet/qml2puppetmain.cpp
+++ b/share/qtcreator/qml/qmlpuppet/qml2puppet/qml2puppetmain.cpp
@@ -31,8 +31,11 @@
#include <iostream>
-#include <qt5nodeinstanceclientproxy.h>
+#include <stdio.h>
+#include <stdlib.h>
+
#include "iconrenderer/iconrenderer.h"
+#include <qt5nodeinstanceclientproxy.h>
#include <QQmlComponent>
#include <QQmlEngine>
@@ -42,7 +45,57 @@
#endif
#ifdef Q_OS_WIN
-#include <windows.h>
+#include <Windows.h>
+#endif
+
+namespace {
+#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
+void myMessageOutput(QtMsgType type, const QMessageLogContext &context, const QString &msg)
+{
+ QByteArray localMsg = msg.toLocal8Bit();
+ switch (type) {
+ case QtDebugMsg:
+ fprintf(stderr,
+ "Debug: %s (%s:%u, %s)\n",
+ localMsg.constData(),
+ context.file,
+ context.line,
+ context.function);
+ break;
+ case QtInfoMsg:
+ fprintf(stderr,
+ "Info: %s (%s:%u, %s)\n",
+ localMsg.constData(),
+ context.file,
+ context.line,
+ context.function);
+ break;
+ case QtWarningMsg:
+ fprintf(stderr,
+ "Warning: %s (%s:%u, %s)\n",
+ localMsg.constData(),
+ context.file,
+ context.line,
+ context.function);
+ break;
+ case QtCriticalMsg:
+ fprintf(stderr,
+ "Critical: %s (%s:%u, %s)\n",
+ localMsg.constData(),
+ context.file,
+ context.line,
+ context.function);
+ break;
+ case QtFatalMsg:
+ fprintf(stderr,
+ "Fatal: %s (%s:%u, %s)\n",
+ localMsg.constData(),
+ context.file,
+ context.line,
+ context.function);
+ abort();
+ }
+}
#endif
int internalMain(QGuiApplication *application)
@@ -138,9 +191,13 @@ int internalMain(QGuiApplication *application)
return application->exec();
}
+} // namespace
int main(int argc, char *argv[])
{
+#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
+ qInstallMessageHandler(myMessageOutput);
+#endif
// Since we always render text into an FBO, we need to globally disable
// subpixel antialiasing and instead use gray.
qputenv("QSG_DISTANCEFIELD_ANTIALIASING", "gray");
@@ -149,7 +206,9 @@ int main(int argc, char *argv[])
#endif
//If a style different from Desktop is set we have to use QGuiApplication
- bool useGuiApplication = qEnvironmentVariableIsSet("QT_QUICK_CONTROLS_STYLE")
+ bool useGuiApplication = (!qEnvironmentVariableIsSet("QMLDESIGNER_FORCE_QAPPLICATION")
+ || qgetenv("QMLDESIGNER_FORCE_QAPPLICATION") != "true")
+ && qEnvironmentVariableIsSet("QT_QUICK_CONTROLS_STYLE")
&& qgetenv("QT_QUICK_CONTROLS_STYLE") != "Desktop";
if (useGuiApplication) {
diff --git a/share/qtcreator/qml/qmlpuppet/qmlprivategate/qmlprivategate_56.cpp b/share/qtcreator/qml/qmlpuppet/qmlprivategate/qmlprivategate_56.cpp
index d41323e310..d5701d7fc9 100644
--- a/share/qtcreator/qml/qmlpuppet/qmlprivategate/qmlprivategate_56.cpp
+++ b/share/qtcreator/qml/qmlpuppet/qmlprivategate/qmlprivategate_56.cpp
@@ -87,9 +87,14 @@ void registerNodeInstanceMetaObject(QObject *object, QQmlEngine *engine)
QQuickDesignerSupportProperties::registerNodeInstanceMetaObject(object, engine);
}
+// This is used in share/qtcreator/qml/qmlpuppet/qml2puppet/instances/objectnodeinstance.cpp
QObject *createPrimitive(const QString &typeName, int majorNumber, int minorNumber, QQmlContext *context)
{
+#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
+ return QQuickDesignerSupportItems::createPrimitive(typeName, QTypeRevision::fromVersion(majorNumber, minorNumber), context);
+#else
return QQuickDesignerSupportItems::createPrimitive(typeName, majorNumber, minorNumber, context);
+#endif
}
static QString qmlDesignerRCPath()
@@ -225,13 +230,21 @@ void emitComponentComplete(QObject *item)
QQmlData *data = QQmlData::get(item);
if (data && data->context) {
+#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
QQmlComponentAttached *componentAttached = data->context->componentAttached;
+#else
+ QQmlComponentAttached *componentAttached = data->context->componentAttacheds();
+#endif
while (componentAttached) {
if (componentAttached->parent())
if (componentAttached->parent() == item)
emit componentAttached->completed();
+#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
componentAttached = componentAttached->next;
+#else
+ componentAttached = componentAttached->next();
+#endif
}
}
}
diff --git a/share/qtcreator/qml/qmlpuppet/qmlpuppet.qrc b/share/qtcreator/qml/qmlpuppet/qmlpuppet.qrc
index f1af244e38..e094303014 100644
--- a/share/qtcreator/qml/qmlpuppet/qmlpuppet.qrc
+++ b/share/qtcreator/qml/qmlpuppet/qmlpuppet.qrc
@@ -3,6 +3,8 @@
<file>images/template_image.png</file>
<file>html/welcome.html</file>
<file>images/webkit.png</file>
+ <file>images/non-visual-component.png</file>
+ <file>images/non-visual-component@2x.png</file>
<file>mockfiles/Window.qml</file>
<file>mockfiles/SwipeView.qml</file>
<file>mockfiles/GenericBackend.qml</file>
@@ -40,6 +42,12 @@
<file>mockfiles/AxisHelper.qml</file>
<file>mockfiles/AxisHelperArm.qml</file>
<file>mockfiles/Line3D.qml</file>
+ <file>mockfiles/ModelNode3DImageView.qml</file>
+ <file>mockfiles/ModelNode2DImageView.qml</file>
+ <file>mockfiles/MaterialNodeView.qml</file>
+ <file>mockfiles/EffectNodeView.qml</file>
+ <file>mockfiles/ModelNodeView.qml</file>
+ <file>mockfiles/NodeNodeView.qml</file>
<file>mockfiles/meshes/arrow.mesh</file>
<file>mockfiles/meshes/scalerod.mesh</file>
<file>mockfiles/meshes/ring.mesh</file>
diff --git a/share/qtcreator/qmldesigner/itemLibraryQmlSources/ItemDelegate.qml b/share/qtcreator/qmldesigner/itemLibraryQmlSources/ItemDelegate.qml
index 1cbec5d802..b7bc9b0b58 100644
--- a/share/qtcreator/qmldesigner/itemLibraryQmlSources/ItemDelegate.qml
+++ b/share/qtcreator/qmldesigner/itemLibraryQmlSources/ItemDelegate.qml
@@ -46,8 +46,6 @@ Item {
width: itemLibraryIconWidth // to be set in Qml context
height: itemLibraryIconHeight // to be set in Qml context
source: itemLibraryIconPath // to be set by model
-
- cache: false // Allow thumbnail to be dynamically updated
}
Text {
@@ -71,10 +69,11 @@ Item {
renderType: Text.NativeRendering
}
- ToolTipArea {
+ ImagePreviewTooltipArea {
id: mouseRegion
+
anchors.fill: parent
- tooltip: itemName
+
onPressed: {
rootView.startDragAndDrop(mouseRegion, itemLibraryEntry)
}
diff --git a/share/qtcreator/qmldesigner/propertyEditorQmlSources/PropertyTemplates/ColorEditorTemplate.template b/share/qtcreator/qmldesigner/propertyEditorQmlSources/PropertyTemplates/ColorEditorTemplate.template
index 2f61a2bfa6..66e3ece1c9 100644
--- a/share/qtcreator/qmldesigner/propertyEditorQmlSources/PropertyTemplates/ColorEditorTemplate.template
+++ b/share/qtcreator/qmldesigner/propertyEditorQmlSources/PropertyTemplates/ColorEditorTemplate.template
@@ -1,11 +1,14 @@
+// Dummy comment to consume the first argument and suppress warnings %1
Section {
anchors.left: parent.left
anchors.right: parent.right
- caption: "%1"
+ caption: qsTr("Color")
+ expanded: false
+ level: 2
-ColorEditor {
- backendValue: backendValues.%2
- supportGradient: false
-}
+ ColorEditor {
+ backendValue: backendValues.%2
+ supportGradient: false
+ }
}
diff --git a/share/qtcreator/qmldesigner/propertyEditorQmlSources/PropertyTemplates/FontEditorTemplate.template b/share/qtcreator/qmldesigner/propertyEditorQmlSources/PropertyTemplates/FontEditorTemplate.template
index 8f12d7fff7..1f56bfc5a4 100644
--- a/share/qtcreator/qmldesigner/propertyEditorQmlSources/PropertyTemplates/FontEditorTemplate.template
+++ b/share/qtcreator/qmldesigner/propertyEditorQmlSources/PropertyTemplates/FontEditorTemplate.template
@@ -1,7 +1,10 @@
+// Dummy comment to consume the first argument and suppress warnings %1
FontSection {
anchors.left: parent.left
anchors.right: parent.right
- caption: "%1"
+ caption: qsTr("Font")
fontName: "%2"
+ expanded: false
+ level: 2
}
diff --git a/share/qtcreator/qmldesigner/propertyEditorQmlSources/PropertyTemplates/ImageEditorTemplate.template b/share/qtcreator/qmldesigner/propertyEditorQmlSources/PropertyTemplates/ImageEditorTemplate.template
new file mode 100644
index 0000000000..d1ffbf9dd0
--- /dev/null
+++ b/share/qtcreator/qmldesigner/propertyEditorQmlSources/PropertyTemplates/ImageEditorTemplate.template
@@ -0,0 +1,215 @@
+// Dummy comment to consume the first argument and suppress warnings %1
+
+Section {
+ anchors.left: parent.left
+ anchors.right: parent.right
+ caption: qsTr("Image")
+ expanded: false
+ level: 2
+
+ SectionLayout {
+ Label {
+ text: qsTr("Source")
+ }
+
+ SecondColumnLayout {
+ UrlChooser {
+ Layout.fillWidth: true
+ backendValue: backendValues.%2_source
+ }
+
+ ExpandingSpacer {
+ }
+ }
+
+ Label {
+ text: qsTr("Fill mode")
+ }
+
+ SecondColumnLayout {
+ ComboBox {
+ scope: "Image"
+ model: ["Stretch", "PreserveAspectFit", "PreserveAspectCrop", "Tile", "TileVertically", "TileHorizontally", "Pad"]
+ backendValue: backendValues.%2_fillMode
+ implicitWidth: 180
+ Layout.fillWidth: true
+ }
+
+ ExpandingSpacer {
+ }
+ }
+
+ Label {
+ text: qsTr("Source size")
+ disabledState: !backendValues.%2_sourceSize.isAvailable
+ }
+
+ SecondColumnLayout {
+ Label {
+ text: "W"
+ width: 12
+ disabledStateSoft: !backendValues.%2_sourceSize_width.isAvailable
+ }
+
+ SpinBox {
+ backendValue: backendValues.%2_sourceSize_width
+ minimumValue: 0
+ maximumValue: 8192
+ decimals: 0
+ enabled: backendValue.isAvailable
+ }
+
+ Item {
+ width: 4
+ height: 4
+ }
+
+ Label {
+ text: "H"
+ width: 12
+ disabledStateSoft: !backendValues.%2_sourceSize_height.isAvailable
+ }
+
+ SpinBox {
+ backendValue: backendValues.%2_sourceSize_height
+ minimumValue: 0
+ maximumValue: 8192
+ decimals: 0
+ enabled: backendValue.isAvailable
+ }
+
+ ExpandingSpacer {
+ }
+ }
+
+ Label {
+ text: qsTr("Horizontal alignment")
+ }
+
+ SecondColumnLayout {
+ ComboBox {
+ scope: "Image"
+ model: ["AlignLeft", "AlignRight", "AlignHCenter"]
+ backendValue: backendValues.%2_horizontalAlignment
+ implicitWidth: 180
+ Layout.fillWidth: true
+ }
+
+ ExpandingSpacer {
+ }
+ }
+
+ Label {
+ text: qsTr("Vertical alignment")
+ }
+
+ SecondColumnLayout {
+ ComboBox {
+ scope: "Image"
+ model: ["AlignTop", "AlignBottom", "AlignVCenter"]
+ backendValue: backendValues.%2_verticalAlignment
+ implicitWidth: 180
+ Layout.fillWidth: true
+ }
+
+ ExpandingSpacer {
+ }
+ }
+
+ Label {
+ text: qsTr("Asynchronous")
+ tooltip: qsTr("Loads images on the local filesystem asynchronously in a separate thread.")
+ disabledState: !backendValues.%2_asynchronous.isAvailable
+ }
+
+ SecondColumnLayout {
+ CheckBox {
+ enabled: backendValues.%2_asynchronous.isAvailable
+ text: backendValues.%2_asynchronous.valueToString
+ backendValue: backendValues.%2_asynchronous
+ implicitWidth: 180
+ }
+ ExpandingSpacer {}
+ }
+
+ Label {
+ text: qsTr("Auto transform")
+ tooltip: qsTr("Automatically applies image transformation metadata such as EXIF orientation.")
+ disabledState: !backendValues.%2_autoTransform.isAvailable
+ }
+
+ SecondColumnLayout {
+ CheckBox {
+ enabled: backendValues.%2_autoTransform.isAvailable
+ text: backendValues.%2_autoTransform.valueToString
+ backendValue: backendValues.%2_autoTransform
+ implicitWidth: 180
+ }
+ ExpandingSpacer {}
+ }
+
+ Label {
+ text: qsTr("Cache")
+ tooltip: qsTr("Caches the image.")
+ disabledState: !backendValues.%2_cache.isAvailable
+ }
+
+ SecondColumnLayout {
+ CheckBox {
+ enabled: backendValues.%2_cache.isAvailable
+ text: backendValues.%2_cache.valueToString
+ backendValue: backendValues.%2_cache
+ implicitWidth: 180
+ }
+ ExpandingSpacer {}
+ }
+
+ Label {
+ text: qsTr("Mipmap")
+ tooltip: qsTr("Uses mipmap filtering when the image is scaled or transformed.")
+ disabledState: !backendValues.%2_mipmap.isAvailable
+ }
+
+ SecondColumnLayout {
+ CheckBox {
+ enabled: backendValues.%2_mipmap.isAvailable
+ text: backendValues.%2_mipmap.valueToString
+ backendValue: backendValues.%2_mipmap
+ implicitWidth: 180
+ }
+ ExpandingSpacer {}
+ }
+
+ Label {
+ text: qsTr("Mirror")
+ tooltip: qsTr("Inverts the image horizontally.")
+ disabledState: !backendValues.%2_mirror.isAvailable
+ }
+
+ SecondColumnLayout {
+ CheckBox {
+ enabled: backendValues.%2_mirror.isAvailable
+ text: backendValues.%2_mirror.valueToString
+ backendValue: backendValues.%2_mirror
+ implicitWidth: 180
+ }
+ ExpandingSpacer {}
+ }
+
+ Label {
+ text: qsTr("Smooth")
+ tooltip: qsTr("Smoothly filters the image when it is scaled or transformed.")
+ disabledState: !backendValues.%2_smooth.isAvailable
+ }
+
+ SecondColumnLayout {
+ CheckBox {
+ enabled: backendValues.%2_smooth.isAvailable
+ text: backendValues.%2_smooth.valueToString
+ backendValue: backendValues.%2_smooth
+ implicitWidth: 180
+ }
+ ExpandingSpacer {}
+ }
+ }
+}
diff --git a/share/qtcreator/qmldesigner/propertyEditorQmlSources/PropertyTemplates/RectangleEditorTemplate.template b/share/qtcreator/qmldesigner/propertyEditorQmlSources/PropertyTemplates/RectangleEditorTemplate.template
index bfa9790b59..87451c11b1 100644
--- a/share/qtcreator/qmldesigner/propertyEditorQmlSources/PropertyTemplates/RectangleEditorTemplate.template
+++ b/share/qtcreator/qmldesigner/propertyEditorQmlSources/PropertyTemplates/RectangleEditorTemplate.template
@@ -1,21 +1,25 @@
+// Dummy comment to consume the first argument and suppress warnings %1
+
Section {
anchors.left: parent.left
anchors.right: parent.right
- caption: qsTr("%2 Color")
+ caption: qsTr("Color")
+ expanded: false
+ level: 2
ColorEditor {
caption: qsTr("Color")
backendValue: backendValues.%2_color
supportGradient: true
}
-
-
}
Section {
anchors.left: parent.left
anchors.right: parent.right
- caption: qsTr("%2 Border Color")
+ caption: qsTr("Border Color")
+ expanded: false
+ level: 2
ColorEditor {
caption: qsTr("Border Color")
@@ -24,11 +28,12 @@ Section {
}
}
-
Section {
anchors.left: parent.left
anchors.right: parent.right
- caption: "%2 Rectangle"
+ caption: qsTr("Rectangle")
+ expanded: false
+ level: 2
SectionLayout {
rows: 2
diff --git a/share/qtcreator/qmldesigner/propertyEditorQmlSources/PropertyTemplates/TemplateTypes.qml b/share/qtcreator/qmldesigner/propertyEditorQmlSources/PropertyTemplates/TemplateTypes.qml
index 8917e81d5e..d5a4923201 100644
--- a/share/qtcreator/qmldesigner/propertyEditorQmlSources/PropertyTemplates/TemplateTypes.qml
+++ b/share/qtcreator/qmldesigner/propertyEditorQmlSources/PropertyTemplates/TemplateTypes.qml
@@ -24,7 +24,7 @@
****************************************************************************/
AutoTypes {
- imports: [ "import HelperWidgets 2.0", "import QtQuick 2.1", "import QtQuick.Layouts 1.1" ]
+ imports: [ "import HelperWidgets 2.0", "import QtQuick 2.15", "import QtQuick.Layouts 1.15" ]
Type {
typeNames: ["int"]
@@ -65,10 +65,15 @@ AutoTypes {
separateSection: true
}
- Type {
+ Type {
typeNames: ["Rectangle"]
sourceFile: "RectangleEditorTemplate.template"
separateSection: true
}
+ Type {
+ typeNames: ["Image"]
+ sourceFile: "ImageEditorTemplate.template"
+ separateSection: true
+ }
}
diff --git a/share/qtcreator/qmldesigner/propertyEditorQmlSources/PropertyTemplates/TextEditorTemplate.template b/share/qtcreator/qmldesigner/propertyEditorQmlSources/PropertyTemplates/TextEditorTemplate.template
index e9e8787f75..903e971a83 100644
--- a/share/qtcreator/qmldesigner/propertyEditorQmlSources/PropertyTemplates/TextEditorTemplate.template
+++ b/share/qtcreator/qmldesigner/propertyEditorQmlSources/PropertyTemplates/TextEditorTemplate.template
@@ -1,7 +1,9 @@
Section {
anchors.left: parent.left
anchors.right: parent.right
- caption: "%1"
+ caption: qsTr("Text")
+ expanded: false
+ level: 2
SectionLayout {
columns: 2
diff --git a/share/qtcreator/qmldesigner/propertyEditorQmlSources/QtQuick/AdvancedSection.qml b/share/qtcreator/qmldesigner/propertyEditorQmlSources/QtQuick/AdvancedSection.qml
index 22a14efa53..f5a51b7383 100644
--- a/share/qtcreator/qmldesigner/propertyEditorQmlSources/QtQuick/AdvancedSection.qml
+++ b/share/qtcreator/qmldesigner/propertyEditorQmlSources/QtQuick/AdvancedSection.qml
@@ -163,7 +163,7 @@ Section {
Label {
text: qsTr("Focus")
- tooltip: qsTr("Holds whether the item has focus within the enclosing FocusScope.")
+ tooltip: qsTr("Sets focus on the item within the enclosing focus scope.")
disabledState: !backendValues.focus.isAvailable
}
SecondColumnLayout {
@@ -178,7 +178,7 @@ Section {
Label {
text: qsTr("Active focus on tab")
- tooltip: qsTr("Holds whether the item wants to be in the tab focus chain.")
+ tooltip: qsTr("Adds the item to the tab focus chain.")
disabledState: !backendValues.activeFocusOnTab.isAvailable
}
SecondColumnLayout {
@@ -193,7 +193,7 @@ Section {
Label {
text: qsTr("Baseline offset")
- tooltip: qsTr("Specifies the position of the item's baseline in local coordinates.")
+ tooltip: qsTr("Position of the item's baseline in local coordinates.")
disabledState: !backendValues.baselineOffset.isAvailable
}
SecondColumnLayout {
diff --git a/share/qtcreator/qmldesigner/propertyEditorQmlSources/QtQuick/AnimatedImageSpecifics.qml b/share/qtcreator/qmldesigner/propertyEditorQmlSources/QtQuick/AnimatedImageSpecifics.qml
index 787e390cbd..84640f5014 100644
--- a/share/qtcreator/qmldesigner/propertyEditorQmlSources/QtQuick/AnimatedImageSpecifics.qml
+++ b/share/qtcreator/qmldesigner/propertyEditorQmlSources/QtQuick/AnimatedImageSpecifics.qml
@@ -61,7 +61,7 @@ Column {
Label {
text: qsTr("Paused")
- tooltip: qsTr("Holds whether the animated image is paused.")
+ tooltip: qsTr("Whether the animated image is paused.")
disabledState: !backendValues.paused.isAvailable
}
@@ -77,7 +77,7 @@ Column {
Label {
text: qsTr("Playing")
- tooltip: qsTr("Holds whether the animated image is playing.")
+ tooltip: qsTr("Whether the animated image is playing.")
disabledState: !backendValues.playing.isAvailable
}
diff --git a/share/qtcreator/qmldesigner/propertyEditorQmlSources/QtQuick/AnimationSection.qml b/share/qtcreator/qmldesigner/propertyEditorQmlSources/QtQuick/AnimationSection.qml
index b117eeb7f9..31ad4081d6 100644
--- a/share/qtcreator/qmldesigner/propertyEditorQmlSources/QtQuick/AnimationSection.qml
+++ b/share/qtcreator/qmldesigner/propertyEditorQmlSources/QtQuick/AnimationSection.qml
@@ -40,7 +40,7 @@ Section {
SectionLayout {
Label {
text: qsTr("Running")
- tooltip: qsTr("Sets whether the animation is currently running.")
+ tooltip: qsTr("Whether the animation is running.")
}
CheckBox {
@@ -50,7 +50,7 @@ Section {
Label {
text: qsTr("Paused")
- tooltip: qsTr("Sets whether the animation is currently paused.")
+ tooltip: qsTr("Whether the animation is paused.")
disabledState: !backendValues.paused.isAvailable
}
@@ -61,7 +61,7 @@ Section {
}
Label {
text: qsTr("Loops")
- tooltip: qsTr("Sets the number of times the animation should play.")
+ tooltip: qsTr("Number of times the animation should play.")
}
SecondColumnLayout {
@@ -80,7 +80,7 @@ Section {
Label {
visible: section.showDuration
text: qsTr("Duration")
- tooltip: qsTr("Sets the duration of the animation, in milliseconds.")
+ tooltip: qsTr("Duration of the animation in milliseconds.")
}
SecondColumnLayout {
@@ -97,8 +97,8 @@ Section {
}
}
Label {
- text: qsTr("Always Run To End")
- tooltip: qsTr("Sets whether the animation should run to completion when it is stopped.")
+ text: qsTr("Always run to end")
+ tooltip: qsTr("Runs the animation to completion when it is stopped.")
}
CheckBox {
@@ -108,8 +108,8 @@ Section {
Label {
visible: section.showEasingCurve
- text: qsTr("Easing Curve")
- tooltip: qsTr("Define custom easing curve")
+ text: qsTr("Easing curve")
+ tooltip: qsTr("Defines a custom easing curve.")
}
BoolButtonRowButton {
diff --git a/share/qtcreator/qmldesigner/propertyEditorQmlSources/QtQuick/AnimationTargetSection.qml b/share/qtcreator/qmldesigner/propertyEditorQmlSources/QtQuick/AnimationTargetSection.qml
index e1b347679a..87801f9050 100644
--- a/share/qtcreator/qmldesigner/propertyEditorQmlSources/QtQuick/AnimationTargetSection.qml
+++ b/share/qtcreator/qmldesigner/propertyEditorQmlSources/QtQuick/AnimationTargetSection.qml
@@ -35,7 +35,7 @@ Section {
SectionLayout {
Label {
text: qsTr("Target")
- tooltip: qsTr("Sets the target to animate the properties of.")
+ tooltip: qsTr("Target to animate the properties of.")
}
SecondColumnLayout {
ItemFilterComboBox {
@@ -51,7 +51,7 @@ Section {
Label {
text: qsTr("Property")
- tooltip: qsTr("Sets the property to animate.")
+ tooltip: qsTr("Property to animate.")
}
LineEdit {
backendValue: backendValues.property
@@ -60,7 +60,7 @@ Section {
}
Label {
text: qsTr("Properties")
- tooltip: qsTr("Sets the properties to animate.")
+ tooltip: qsTr("Properties to animate.")
}
LineEdit {
backendValue: backendValues.properties
diff --git a/share/qtcreator/qmldesigner/propertyEditorQmlSources/QtQuick/BorderImageSpecifics.qml b/share/qtcreator/qmldesigner/propertyEditorQmlSources/QtQuick/BorderImageSpecifics.qml
index 362ba144c5..2f35517968 100644
--- a/share/qtcreator/qmldesigner/propertyEditorQmlSources/QtQuick/BorderImageSpecifics.qml
+++ b/share/qtcreator/qmldesigner/propertyEditorQmlSources/QtQuick/BorderImageSpecifics.qml
@@ -52,7 +52,7 @@ Column {
}
Label {
- text: qsTr("Border Left")
+ text: qsTr("Border left")
}
SecondColumnLayout {
@@ -70,7 +70,7 @@ Column {
}
Label {
- text: qsTr("Border Right")
+ text: qsTr("Border right")
}
SecondColumnLayout {
@@ -88,7 +88,7 @@ Column {
}
Label {
- text: qsTr("Border Top")
+ text: qsTr("Border top")
}
SecondColumnLayout {
@@ -106,7 +106,7 @@ Column {
}
Label {
- text: qsTr("Border Bottom")
+ text: qsTr("Border bottom")
}
SecondColumnLayout {
@@ -124,7 +124,7 @@ Column {
}
Label {
- text: qsTr("Horizontal Tile mode")
+ text: qsTr("Horizontal tile mode")
}
SecondColumnLayout {
@@ -138,7 +138,7 @@ Column {
}
Label {
- text: qsTr("Vertical Tile mode")
+ text: qsTr("Vertical tile mode")
}
SecondColumnLayout {
diff --git a/share/qtcreator/qmldesigner/propertyEditorQmlSources/QtQuick/FlowSpecifics.qml b/share/qtcreator/qmldesigner/propertyEditorQmlSources/QtQuick/FlowSpecifics.qml
index dcee957665..54766ce78b 100644
--- a/share/qtcreator/qmldesigner/propertyEditorQmlSources/QtQuick/FlowSpecifics.qml
+++ b/share/qtcreator/qmldesigner/propertyEditorQmlSources/QtQuick/FlowSpecifics.qml
@@ -53,7 +53,7 @@ Column {
}
Label {
- text: qsTr("Layout Direction")
+ text: qsTr("Layout direction")
}
SecondColumnLayout {
diff --git a/share/qtcreator/qmldesigner/propertyEditorQmlSources/QtQuick/GridSpecifics.qml b/share/qtcreator/qmldesigner/propertyEditorQmlSources/QtQuick/GridSpecifics.qml
index 284849a415..68a062dbaa 100644
--- a/share/qtcreator/qmldesigner/propertyEditorQmlSources/QtQuick/GridSpecifics.qml
+++ b/share/qtcreator/qmldesigner/propertyEditorQmlSources/QtQuick/GridSpecifics.qml
@@ -85,7 +85,7 @@ Column {
}
Label {
- text: qsTr("Layout Direction")
+ text: qsTr("Layout direction")
}
SecondColumnLayout {
diff --git a/share/qtcreator/qmldesigner/propertyEditorQmlSources/QtQuick/GridViewSpecifics.qml b/share/qtcreator/qmldesigner/propertyEditorQmlSources/QtQuick/GridViewSpecifics.qml
index dd032acc12..be8628b0f2 100644
--- a/share/qtcreator/qmldesigner/propertyEditorQmlSources/QtQuick/GridViewSpecifics.qml
+++ b/share/qtcreator/qmldesigner/propertyEditorQmlSources/QtQuick/GridViewSpecifics.qml
@@ -60,7 +60,7 @@ Column {
}
Label {
- text: qsTr("Cell Size")
+ text: qsTr("Cell size")
}
SecondColumnLayout {
@@ -111,7 +111,7 @@ Column {
Label {
text: qsTr("Navigation wraps")
- tooltip: qsTr("Determines whether the grid wraps key navigation.")
+ tooltip: qsTr("Whether the grid wraps key navigation.")
}
SectionLayout {
@@ -125,7 +125,7 @@ Column {
}
Label {
- text: qsTr("Layout Direction")
+ text: qsTr("Layout direction")
}
SecondColumnLayout {
@@ -231,7 +231,7 @@ Column {
Label {
text: qsTr("Follows current")
- tooltip: qsTr("Determines whether the highlight is managed by the view.")
+ tooltip: qsTr("Whether the highlight is managed by the view.")
}
SectionLayout {
diff --git a/share/qtcreator/qmldesigner/propertyEditorQmlSources/QtQuick/ImageSpecifics.qml b/share/qtcreator/qmldesigner/propertyEditorQmlSources/QtQuick/ImageSpecifics.qml
index 1db91045c4..41637e4b1c 100644
--- a/share/qtcreator/qmldesigner/propertyEditorQmlSources/QtQuick/ImageSpecifics.qml
+++ b/share/qtcreator/qmldesigner/propertyEditorQmlSources/QtQuick/ImageSpecifics.qml
@@ -147,7 +147,7 @@ Column {
Label {
text: qsTr("Asynchronous")
- tooltip: qsTr("Specifies that images on the local filesystem should be loaded asynchronously in a separate thread.")
+ tooltip: qsTr("Loads images on the local filesystem asynchronously in a separate thread.")
disabledState: !backendValues.asynchronous.isAvailable
}
@@ -163,7 +163,7 @@ Column {
Label {
text: qsTr("Auto transform")
- tooltip: qsTr("Specifies whether the image should automatically apply image transformation metadata such as EXIF orientation.")
+ tooltip: qsTr("Automatically applies image transformation metadata such as EXIF orientation.")
disabledState: !backendValues.autoTransform.isAvailable
}
@@ -179,7 +179,7 @@ Column {
Label {
text: qsTr("Cache")
- tooltip: qsTr("Specifies whether the image should be cached.")
+ tooltip: qsTr("Caches the image.")
disabledState: !backendValues.cache.isAvailable
}
@@ -195,7 +195,7 @@ Column {
Label {
text: qsTr("Mipmap")
- tooltip: qsTr("Specifies whether the image uses mipmap filtering when scaled or transformed.")
+ tooltip: qsTr("Uses mipmap filtering when the image is scaled or transformed.")
disabledState: !backendValues.mipmap.isAvailable
}
@@ -211,7 +211,7 @@ Column {
Label {
text: qsTr("Mirror")
- tooltip: qsTr("Specifies whether the image should be horizontally inverted.")
+ tooltip: qsTr("Inverts the image horizontally.")
disabledState: !backendValues.mirror.isAvailable
}
@@ -227,7 +227,7 @@ Column {
Label {
text: qsTr("Smooth")
- tooltip: qsTr("Specifies whether the image is smoothly filtered when scaled or transformed.")
+ tooltip: qsTr("Smoothly filters the image when it is scaled or transformed.")
disabledState: !backendValues.smooth.isAvailable
}
diff --git a/share/qtcreator/qmldesigner/propertyEditorQmlSources/QtQuick/ItemPane.qml b/share/qtcreator/qmldesigner/propertyEditorQmlSources/QtQuick/ItemPane.qml
index 9118cae9be..fd39b0bd2d 100644
--- a/share/qtcreator/qmldesigner/propertyEditorQmlSources/QtQuick/ItemPane.qml
+++ b/share/qtcreator/qmldesigner/propertyEditorQmlSources/QtQuick/ItemPane.qml
@@ -80,7 +80,7 @@ Rectangle {
typeLineEdit.visible = ! typeLineEdit.visible
typeLineEdit.forceActiveFocus()
}
- tooltip: qsTr("Change the type of this item.")
+ tooltip: qsTr("Changes the type of this item.")
enabled: !modelNodeBackend.multiSelection
}
@@ -190,7 +190,7 @@ Rectangle {
enabled: !modelNodeBackend.multiSelection
anchors.fill: parent
onClicked: toogleExportAlias()
- tooltip: qsTr("Toggles whether this item is exported as an alias property of the root item.")
+ tooltip: qsTr("Exports this item as an alias property of the root item.")
}
}
}
@@ -314,7 +314,7 @@ Rectangle {
SecondColumnLayout {
CheckBox {
- text: qsTr("Is Visible")
+ text: qsTr("Is visible")
backendValue: backendValues.visible
}
diff --git a/share/qtcreator/qmldesigner/propertyEditorQmlSources/QtQuick/LayerSection.qml b/share/qtcreator/qmldesigner/propertyEditorQmlSources/QtQuick/LayerSection.qml
index b95312f148..305fd9d9e2 100644
--- a/share/qtcreator/qmldesigner/propertyEditorQmlSources/QtQuick/LayerSection.qml
+++ b/share/qtcreator/qmldesigner/propertyEditorQmlSources/QtQuick/LayerSection.qml
@@ -38,7 +38,7 @@ Section {
Label {
text: qsTr("Effect")
- tooltip: qsTr("Sets the effect that is applied to this layer.")
+ tooltip: qsTr("Applies the effect to this layer.")
}
SecondColumnLayout {
ItemFilterComboBox {
@@ -54,7 +54,7 @@ Section {
Label {
text: qsTr("Enabled")
- tooltip: qsTr("Sets whether the item is layered or not.")
+ tooltip: qsTr("Whether the item is layered or not.")
}
SecondColumnLayout {
CheckBox {
@@ -69,7 +69,7 @@ Section {
Label {
text: qsTr("Format")
- tooltip: qsTr("Defines the internal OpenGL format of the texture.")
+ tooltip: qsTr("Internal OpenGL format of the texture.")
}
SecondColumnLayout {
ComboBox {
@@ -85,7 +85,7 @@ Section {
Label {
text: qsTr("Mipmap")
- tooltip: qsTr("Enables the generation of mipmaps for the texture.")
+ tooltip: qsTr("Generates mipmaps for the texture.")
}
SecondColumnLayout {
CheckBox {
@@ -100,7 +100,7 @@ Section {
Label {
text: qsTr("Sampler name")
- tooltip: qsTr("Sets the name of the effect's source texture property.")
+ tooltip: qsTr("Name of the effect's source texture property.")
}
SecondColumnLayout {
LineEdit {
@@ -156,7 +156,7 @@ Section {
Label {
text: qsTr("Smooth")
- tooltip: qsTr("Sets whether the layer is smoothly transformed.")
+ tooltip: qsTr("Transforms the layer smoothly.")
}
SecondColumnLayout {
CheckBox {
@@ -251,7 +251,7 @@ Section {
Label {
text: qsTr("Texture mirroring")
- tooltip: qsTr("Defines how the generated OpenGL texture should be mirrored.")
+ tooltip: qsTr("Sets how the generated OpenGL texture should be mirrored.")
}
SecondColumnLayout {
ComboBox {
@@ -267,7 +267,7 @@ Section {
Label {
text: qsTr("Texture size")
- tooltip: qsTr("Sets the requested pixel size of the layers texture.")
+ tooltip: qsTr("Requested pixel size of the layer's texture.")
}
SecondColumnLayout {
Label {
@@ -303,7 +303,7 @@ Section {
Label {
text: qsTr("Wrap mode")
- tooltip: qsTr("Defines the OpenGL wrap modes associated with the texture.")
+ tooltip: qsTr("OpenGL wrap modes associated with the texture.")
}
SecondColumnLayout {
ComboBox {
diff --git a/share/qtcreator/qmldesigner/propertyEditorQmlSources/QtQuick/LayoutPoperties.qml b/share/qtcreator/qmldesigner/propertyEditorQmlSources/QtQuick/LayoutPoperties.qml
index a15d77d21a..8002a4daf4 100644
--- a/share/qtcreator/qmldesigner/propertyEditorQmlSources/QtQuick/LayoutPoperties.qml
+++ b/share/qtcreator/qmldesigner/propertyEditorQmlSources/QtQuick/LayoutPoperties.qml
@@ -201,7 +201,7 @@ SectionLayout {
Label {
text: qsTr("Fill layout")
- tooltip: qsTr("The item will expand as much as possible while respecting the given constraints if true.")
+ tooltip: qsTr("Expands the item as much as possible within the given constraints.")
}
SecondColumnLayout {
@@ -340,7 +340,7 @@ SectionLayout {
Label {
text: qsTr("Row span")
- tooltip: qsTr("Row span of an item in a GridLayout.")
+ tooltip: qsTr("Row span of an item in a Grid Layout.")
}
SecondColumnLayout {
@@ -362,7 +362,7 @@ SectionLayout {
Label {
text: qsTr("Column span")
- tooltip: qsTr("Column span of an item in a GridLayout.")
+ tooltip: qsTr("Column span of an item in a Grid Layout.")
}
SecondColumnLayout {
diff --git a/share/qtcreator/qmldesigner/propertyEditorQmlSources/QtQuick/ListViewSpecifics.qml b/share/qtcreator/qmldesigner/propertyEditorQmlSources/QtQuick/ListViewSpecifics.qml
index f132cc4b59..98c8be0c4c 100644
--- a/share/qtcreator/qmldesigner/propertyEditorQmlSources/QtQuick/ListViewSpecifics.qml
+++ b/share/qtcreator/qmldesigner/propertyEditorQmlSources/QtQuick/ListViewSpecifics.qml
@@ -64,7 +64,7 @@ Column {
Label {
text: qsTr("Navigation wraps")
- tooltip: qsTr("Determines whether the grid wraps key navigation.")
+ tooltip: qsTr("Whether the grid wraps key navigation.")
disabledState: !backendValues.keyNavigationWraps.isAvailable
}
@@ -96,7 +96,7 @@ Column {
}
Label {
- text: qsTr("Layout Direction")
+ text: qsTr("Layout direction")
disabledState: !backendValues.layoutDirection.isAvailable
}
@@ -285,7 +285,7 @@ Column {
Label {
text: qsTr("Follows current")
- tooltip: qsTr("Determines whether the highlight is managed by the view.")
+ tooltip: qsTr("Whether the highlight is managed by the view.")
disabledState: !backendValues.highlightFollowsCurrentItem.isAvailable
}
diff --git a/share/qtcreator/qmldesigner/propertyEditorQmlSources/QtQuick/MouseAreaSpecifics.qml b/share/qtcreator/qmldesigner/propertyEditorQmlSources/QtQuick/MouseAreaSpecifics.qml
index dd42326fe0..7390dec275 100644
--- a/share/qtcreator/qmldesigner/propertyEditorQmlSources/QtQuick/MouseAreaSpecifics.qml
+++ b/share/qtcreator/qmldesigner/propertyEditorQmlSources/QtQuick/MouseAreaSpecifics.qml
@@ -39,7 +39,7 @@ Column {
SectionLayout {
Label {
text: qsTr("Enabled")
- tooltip: qsTr("This property holds whether the item accepts mouse events.")
+ tooltip: qsTr("Accepts mouse events.")
disabledState: !backendValues.enabled.isAvailable
}
@@ -57,7 +57,7 @@ Column {
Label {
text: qsTr("Hover enabled")
- tooltip: qsTr("This property holds whether hover events are handled.")
+ tooltip: qsTr("Handles hover events.")
disabledState: !backendValues.hoverEnabled.isAvailable
}
@@ -75,7 +75,7 @@ Column {
Label {
text: qsTr("Accepted buttons")
- tooltip: qsTr("This property holds the mouse buttons that the mouse area reacts to.")
+ tooltip: qsTr("Mouse buttons that the mouse area reacts to.")
disabledState: !backendValues.acceptedButtons.isAvailable
}
@@ -93,7 +93,7 @@ Column {
Label {
text: qsTr("Press and hold interval")
- tooltip: qsTr("This property overrides the elapsed time in milliseconds before pressAndHold is emitted.")
+ tooltip: qsTr("Overrides the elapsed time in milliseconds before pressAndHold signal is emitted.")
}
SecondColumnLayout {
@@ -109,7 +109,7 @@ Column {
Label {
text: qsTr("Scroll gesture enabled")
- tooltip: qsTr("This property controls whether this MouseArea responds to scroll gestures from non-mouse devices.")
+ tooltip: qsTr("Responds to scroll gestures from non-mouse devices.")
disabledState: !backendValues.scrollGestureEnabled.isAvailable
}
@@ -127,7 +127,7 @@ Column {
Label {
text: qsTr("Cursor shape")
- tooltip: qsTr("This property holds the cursor shape for this mouse area.")
+ tooltip: qsTr("Cursor shape for this mouse area.")
disabledState: !backendValues.cursorShape.isAvailable
}
@@ -150,7 +150,7 @@ Column {
Label {
text: qsTr("Prevent stealing")
- tooltip: qsTr("This property controls whether the mouse events may be stolen from this MouseArea.")
+ tooltip: qsTr("Stops mouse events from being stolen from this mouse area.")
disabledState: !backendValues.preventStealing.isAvailable
}
@@ -168,7 +168,7 @@ Column {
Label {
text: qsTr("Propagate composed events")
- tooltip: qsTr("This property controls whether composed mouse events will automatically propagate to other MouseAreas.")
+ tooltip: qsTr("Automatically propagates composed mouse events to other mouse areas.")
disabledState: !backendValues.propagateComposedEvents.isAvailable
}
@@ -195,7 +195,7 @@ Column {
SectionLayout {
Label {
text: qsTr("Target")
- tooltip: qsTr("Sets the id of the item to drag.")
+ tooltip: qsTr("Id of the item to drag.")
}
SecondColumnLayout {
ItemFilterComboBox {
@@ -211,7 +211,7 @@ Column {
Label {
text: qsTr("Axis")
- tooltip: qsTr("Specifies whether dragging can be done horizontally, vertically, or both.")
+ tooltip: qsTr("Whether dragging can be done horizontally, vertically, or both.")
}
SecondColumnLayout {
ComboBox {
@@ -227,7 +227,7 @@ Column {
Label {
text: qsTr("Filter children")
- tooltip: qsTr("Specifies whether a drag overrides descendant MouseAreas.")
+ tooltip: qsTr("Whether dragging overrides descendant mouse areas.")
}
SecondColumnLayout {
@@ -243,7 +243,7 @@ Column {
Label {
text: qsTr("Threshold")
- tooltip: qsTr("Determines the threshold in pixels of when the drag operation should start.")
+ tooltip: qsTr("Threshold in pixels of when the drag operation should start.")
}
SecondColumnLayout {
@@ -260,8 +260,8 @@ Column {
Label {
text: qsTr("Smoothed")
- tooltip: qsTr("If set to true, the target will be moved only after the drag operation has started.\n"
- + "If set to false, the target will be moved straight to the current mouse position.")
+ tooltip: qsTr("Moves targets only after the drag operation has started.\n"
+ + "When disabled, moves targets straight to the current mouse position.")
}
SecondColumnLayout {
diff --git a/share/qtcreator/qmldesigner/propertyEditorQmlSources/QtQuick/NumberAnimationSpecifics.qml b/share/qtcreator/qmldesigner/propertyEditorQmlSources/QtQuick/NumberAnimationSpecifics.qml
index f6cbab67db..fa0029a167 100644
--- a/share/qtcreator/qmldesigner/propertyEditorQmlSources/QtQuick/NumberAnimationSpecifics.qml
+++ b/share/qtcreator/qmldesigner/propertyEditorQmlSources/QtQuick/NumberAnimationSpecifics.qml
@@ -38,7 +38,7 @@ Column {
SectionLayout {
Label {
text: qsTr("From")
- tooltip: qsTr("Sets the starting value for the animation.")
+ tooltip: qsTr("Start value for the animation.")
}
SecondColumnLayout {
@@ -56,7 +56,7 @@ Column {
Label {
text: qsTr("To")
- tooltip: qsTr("Sets the end value for the animation.")
+ tooltip: qsTr("End value for the animation.")
}
SecondColumnLayout {
diff --git a/share/qtcreator/qmldesigner/propertyEditorQmlSources/QtQuick/PathViewSpecifics.qml b/share/qtcreator/qmldesigner/propertyEditorQmlSources/QtQuick/PathViewSpecifics.qml
index b2d48045ec..82b2763ece 100644
--- a/share/qtcreator/qmldesigner/propertyEditorQmlSources/QtQuick/PathViewSpecifics.qml
+++ b/share/qtcreator/qmldesigner/propertyEditorQmlSources/QtQuick/PathViewSpecifics.qml
@@ -71,7 +71,7 @@ Column {
Label {
text: qsTr("Interactive")
- tooltip: qsTr("A user cannot drag or flick a PathView that is not interactive.")
+ tooltip: qsTr("Allows users to drag or flick a path view.")
}
SecondColumnLayout {
@@ -102,7 +102,7 @@ Column {
Label {
text: qsTr("Item count")
- tooltip: qsTr("pathItemCount: number of items visible on the path at any one time.")
+ tooltip: qsTr("Number of items visible on the path at any one time.")
}
SecondColumnLayout {
diff --git a/share/qtcreator/qmldesigner/propertyEditorQmlSources/QtQuick/PropertyActionSpecifics.qml b/share/qtcreator/qmldesigner/propertyEditorQmlSources/QtQuick/PropertyActionSpecifics.qml
index 7d64f22612..44dce1a9b1 100644
--- a/share/qtcreator/qmldesigner/propertyEditorQmlSources/QtQuick/PropertyActionSpecifics.qml
+++ b/share/qtcreator/qmldesigner/propertyEditorQmlSources/QtQuick/PropertyActionSpecifics.qml
@@ -39,7 +39,7 @@ Column {
SectionLayout {
Label {
text: qsTr("Value")
- tooltip: qsTr("Sets the value of the property.")
+ tooltip: qsTr("Value of the property.")
}
LineEdit {
backendValue: backendValues.value
diff --git a/share/qtcreator/qmldesigner/propertyEditorQmlSources/QtQuick/QtObjectPane.qml b/share/qtcreator/qmldesigner/propertyEditorQmlSources/QtQuick/QtObjectPane.qml
index 78d99f4d28..96d22e5a7b 100644
--- a/share/qtcreator/qmldesigner/propertyEditorQmlSources/QtQuick/QtObjectPane.qml
+++ b/share/qtcreator/qmldesigner/propertyEditorQmlSources/QtQuick/QtObjectPane.qml
@@ -77,7 +77,7 @@ Rectangle {
typeLineEdit.visible = ! typeLineEdit.visible
typeLineEdit.forceActiveFocus()
}
- tooltip: qsTr("Change the type of this item.")
+ tooltip: qsTr("Changes the type of this item.")
enabled: !modelNodeBackend.multiSelection
}
@@ -187,7 +187,7 @@ Rectangle {
enabled: !modelNodeBackend.multiSelection
anchors.fill: parent
onClicked: toogleExportAlias()
- tooltip: qsTr("Toggles whether this item is exported as an alias property of the root item.")
+ tooltip: qsTr("Exports this item as an alias property of the root item.")
}
}
}
diff --git a/share/qtcreator/qmldesigner/propertyEditorQmlSources/QtQuick/RectangleSpecifics.qml b/share/qtcreator/qmldesigner/propertyEditorQmlSources/QtQuick/RectangleSpecifics.qml
index f743af96e0..deca79ed00 100644
--- a/share/qtcreator/qmldesigner/propertyEditorQmlSources/QtQuick/RectangleSpecifics.qml
+++ b/share/qtcreator/qmldesigner/propertyEditorQmlSources/QtQuick/RectangleSpecifics.qml
@@ -63,7 +63,7 @@ Column {
Section {
anchors.left: parent.left
anchors.right: parent.right
- caption: "Rectangle"
+ caption: qsTr("Rectangle")
SectionLayout {
rows: 2
diff --git a/share/qtcreator/qmldesigner/propertyEditorQmlSources/QtQuick/RowSpecifics.qml b/share/qtcreator/qmldesigner/propertyEditorQmlSources/QtQuick/RowSpecifics.qml
index 93e9fdbee9..c1f927f58b 100644
--- a/share/qtcreator/qmldesigner/propertyEditorQmlSources/QtQuick/RowSpecifics.qml
+++ b/share/qtcreator/qmldesigner/propertyEditorQmlSources/QtQuick/RowSpecifics.qml
@@ -38,7 +38,7 @@ Column {
SectionLayout {
Label {
- text: qsTr("Layout Direction")
+ text: qsTr("Layout direction")
disabledState: !backendValues.layoutDirection.isAvailable
}
diff --git a/share/qtcreator/qmldesigner/propertyEditorQmlSources/QtQuick/TextInputSection.qml b/share/qtcreator/qmldesigner/propertyEditorQmlSources/QtQuick/TextInputSection.qml
index 5c0e84d039..10197e851e 100644
--- a/share/qtcreator/qmldesigner/propertyEditorQmlSources/QtQuick/TextInputSection.qml
+++ b/share/qtcreator/qmldesigner/propertyEditorQmlSources/QtQuick/TextInputSection.qml
@@ -90,7 +90,7 @@ Section {
Label {
visible: !textInputSection.isTextInput
text: qsTr("Tab stop distance")
- tooltip: qsTr("Sets the default distance, in device units, between tab stops.")
+ tooltip: qsTr("Default distance between tab stops in device units.")
}
SpinBox {
visible: !textInputSection.isTextInput
@@ -103,7 +103,7 @@ Section {
Label {
visible: !textInputSection.isTextInput
text: qsTr("Text margin")
- tooltip: qsTr("Sets the margin, in pixels, around the text in the Text Edit.")
+ tooltip: qsTr("Margin around the text in the Text Edit in pixels.")
}
SpinBox {
visible: !textInputSection.isTextInput
@@ -116,7 +116,7 @@ Section {
Label {
visible: textInputSection.isTextInput
text: qsTr("Maximum length")
- tooltip: qsTr("Sets the maximum permitted length of the text in the TextInput.")
+ tooltip: qsTr("Maximum permitted length of the text in the TextInput.")
}
SpinBox {
visible: textInputSection.isTextInput
diff --git a/share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/HelperWidgets/ColorButton.qml b/share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/HelperWidgets/ColorButton.qml
index e609297149..afba6def0c 100644
--- a/share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/HelperWidgets/ColorButton.qml
+++ b/share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/HelperWidgets/ColorButton.qml
@@ -201,6 +201,7 @@ Item {
MouseArea {
id: mapMouseArea
anchors.fill: parent
+ preventStealing: true
onPositionChanged: {
if (pressed && mouse.buttons === Qt.LeftButton) {
var xx = Math.max(0, Math.min(mouse.x, parent.width))
diff --git a/share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/HelperWidgets/ComponentButton.qml b/share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/HelperWidgets/ComponentButton.qml
new file mode 100644
index 0000000000..601f4afc05
--- /dev/null
+++ b/share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/HelperWidgets/ComponentButton.qml
@@ -0,0 +1,52 @@
+/****************************************************************************
+**
+** Copyright (C) 2020 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of Qt Creator.
+**
+** 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 General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3 as published by the Free Software
+** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
+** 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-3.0.html.
+**
+****************************************************************************/
+
+import QtQuick 2.15
+import StudioControls 1.0 as StudioControls
+import StudioTheme 1.0 as StudioTheme
+
+Column {
+ id: column
+ width: parent.width
+ spacing: 10
+ padding: 10
+
+ Label {
+ text: qsTr("This item is an instance of a Component")
+ anchors.horizontalCenter: parent.horizontalCenter
+ width: 220
+ }
+
+ StudioControls.AbstractButton {
+ id: testtest
+ anchors.horizontalCenter: parent.horizontalCenter
+ width: 180
+
+ buttonIcon: qsTr("Edit Master Component")
+ iconFont: StudioTheme.Constants.font
+
+ onClicked: goIntoComponent()
+ }
+}
diff --git a/share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/HelperWidgets/DoubleSpinBox.qml b/share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/HelperWidgets/DoubleSpinBox.qml
index eb2f43e5af..c2abefca43 100644
--- a/share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/HelperWidgets/DoubleSpinBox.qml
+++ b/share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/HelperWidgets/DoubleSpinBox.qml
@@ -46,11 +46,14 @@ Item {
width: 90
implicitHeight: spinBox.height
+ onFocusChanged: restoreCursor();
+
StudioControls.RealSpinBox {
id: spinBox
onDragStarted: hideCursor();
onDragEnded: restoreCursor();
+ onDragging: holdCursorInPlace();
property bool hasSlider: spinBox.sliderIndicatorVisible
diff --git a/share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/HelperWidgets/FlickableSection.qml b/share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/HelperWidgets/FlickableSection.qml
index a6e218861b..b031023a2a 100644
--- a/share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/HelperWidgets/FlickableSection.qml
+++ b/share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/HelperWidgets/FlickableSection.qml
@@ -59,7 +59,7 @@ Section {
Label {
text: qsTr("Behavior")
- tooltip: qsTr("Determines whether the surface may be dragged beyond the Flickable's boundaries, or overshoot the Flickable's boundaries when flicked.")
+ tooltip: qsTr("Whether the surface may be dragged beyond the Flickable's boundaries, or overshoot the Flickable's boundaries when flicked.")
disabledState: !backendValues.boundsBehavior.isAvailable
}
@@ -78,7 +78,7 @@ Section {
Label {
text: qsTr("Movement")
- tooltip: qsTr("Determines whether the Flickable will give a feeling that the edges of the view are soft, rather than a hard physical boundary.")
+ tooltip: qsTr("Whether the Flickable will give a feeling that the edges of the view are soft, rather than a hard physical boundary.")
disabledState: !backendValues.boundsMovement.isAvailable
}
@@ -96,7 +96,7 @@ Section {
Label {
text: qsTr("Interactive")
- tooltip: qsTr("Describes whether the user can interact with the Flickable. A user cannot drag or flick a Flickable that is not interactive.")
+ tooltip: qsTr("Allows users to drag or flick a flickable item.")
}
SecondColumnLayout {
@@ -111,7 +111,7 @@ Section {
Label {
text: qsTr("Max. velocity")
- tooltip: qsTr("Maximum flick velocity")
+ tooltip: qsTr("Maximum flick velocity.")
}
SecondColumnLayout {
@@ -127,7 +127,7 @@ Section {
Label {
text: qsTr("Deceleration")
- tooltip: qsTr("Flick deceleration")
+ tooltip: qsTr("Flick deceleration.")
disabledState: !backendValues.flickDeceleration.isAvailable
}
@@ -145,7 +145,7 @@ Section {
Label {
text: qsTr("Press delay")
- tooltip: qsTr("Holds the time to delay (ms) delivering a press to children of the Flickable.")
+ tooltip: qsTr("Time to delay delivering a press to children of the Flickable in milliseconds.")
disabledState: !backendValues.pressDelay.isAvailable
}
diff --git a/share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/HelperWidgets/FontComboBox.qml b/share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/HelperWidgets/FontComboBox.qml
index 76a030f81e..49f53c7998 100644
--- a/share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/HelperWidgets/FontComboBox.qml
+++ b/share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/HelperWidgets/FontComboBox.qml
@@ -49,21 +49,20 @@ StudioControls.ComboBox {
id: fileModel
}
- function fontUrlToName(url) {
- var fontLoader = Qt.createQmlObject('import QtQuick 2.0; FontLoader { source: \"' + url + '\"; }',
- comboBox,
- "dynamicFontLoader");
- return fontLoader.name
+ function createFontLoader(fontUrl)
+ {
+ return Qt.createQmlObject('import QtQuick 2.0; FontLoader { source: "' + fontUrl + '"; }',
+ comboBox, "dynamicFontLoader");
}
- function setupModel() {
- var files = fileModel.fileModel
- var familyNames = ["Arial", "Times New Roman", "Courier", "Verdana", "Tahoma"]
+ function setupModel()
+ {
+ var familyNames = ["Arial", "Times New Roman", "Courier", "Verdana", "Tahoma"] // default fonts
- files.forEach(function (item, index) {
- var name = fontUrlToName(fileModel.dirPath + "/" + item)
- familyNames.push(name)
- });
+ for (var i = 0; i < fileModel.fullPathModel.length; ++i) { // add custom fonts
+ var fontLoader = createFontLoader(fileModel.dirPath + "/" + fileModel.fullPathModel[i]);
+ familyNames.push(fontLoader.name);
+ }
familyNames.sort()
comboBox.model = familyNames
diff --git a/share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/HelperWidgets/FontSection.qml b/share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/HelperWidgets/FontSection.qml
index 712958c848..7e86c24d2c 100644
--- a/share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/HelperWidgets/FontSection.qml
+++ b/share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/HelperWidgets/FontSection.qml
@@ -158,7 +158,7 @@ Section {
Label {
text: qsTr("Font capitalization")
- toolTip: qsTr("Sets the capitalization for the text.")
+ toolTip: qsTr("Capitalization for the text.")
disabledState: !getBackendValue("capitalization").isAvailable
}
@@ -172,7 +172,7 @@ Section {
Label {
text: qsTr("Font weight")
- toolTip: qsTr("Sets the font's weight.")
+ toolTip: qsTr("Font's weight.")
}
ComboBox {
@@ -185,7 +185,7 @@ Section {
Label {
text: qsTr("Style name")
- toolTip: qsTr("Sets the font's style.")
+ toolTip: qsTr("Font's style.")
disabledState: !styleNameComboBox.enabled
}
@@ -235,7 +235,7 @@ Section {
}
Label {
text: qsTr("Word")
- tooltip: qsTr("Sets the word spacing for the font.")
+ tooltip: qsTr("Word spacing for the font.")
width: 42
disabledStateSoft: !getBackendValue("wordSpacing").isAvailable
}
@@ -256,7 +256,7 @@ Section {
}
Label {
text: qsTr("Letter")
- tooltip: qsTr("Sets the letter spacing for the font.")
+ tooltip: qsTr("Letter spacing for the font.")
width: 42
disabledStateSoft: !getBackendValue("letterSpacing").isAvailable
}
@@ -277,7 +277,7 @@ Section {
Layout.fillWidth: true
backendValue: getBackendValue("kerning")
tooltip: qsTr("Enables or disables the kerning OpenType feature when shaping the text. Disabling this may " +
- "improve performance when creating or changing the text, at the expense of some cosmetic features. The default value is true.")
+ "improve performance when creating or changing the text, at the expense of some cosmetic features.")
enabled: backendValue.isAvailable
}
@@ -294,7 +294,7 @@ Section {
Label {
text: qsTr("Hinting preference")
- toolTip: qsTr("Sets the preferred hinting on the text.")
+ toolTip: qsTr("Preferred hinting on the text.")
disabledState: !getBackendValue("hintingPreference").isAvailable
}
diff --git a/share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/HelperWidgets/ImagePreviewTooltipArea.qml b/share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/HelperWidgets/ImagePreviewTooltipArea.qml
new file mode 100644
index 0000000000..51194cc3cb
--- /dev/null
+++ b/share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/HelperWidgets/ImagePreviewTooltipArea.qml
@@ -0,0 +1,48 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of Qt Creator.
+**
+** 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 General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3 as published by the Free Software
+** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
+** 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-3.0.html.
+**
+****************************************************************************/
+
+import QtQuick 2.1
+import HelperWidgets 2.0
+import QtQuick.Layouts 1.0
+
+MouseArea {
+ id: mouseArea
+
+ onExited: tooltipBackend.hideTooltip()
+ onCanceled: tooltipBackend.hideTooltip()
+ onClicked: forceActiveFocus()
+
+ hoverEnabled: true
+
+ Timer {
+ interval: 1000
+ running: mouseArea.containsMouse
+ onTriggered: {
+ tooltipBackend.componentName = itemName
+ tooltipBackend.componentPath = componentPath
+ tooltipBackend.showTooltip()
+ }
+ }
+}
diff --git a/share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/HelperWidgets/Section.qml b/share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/HelperWidgets/Section.qml
index 583b11ee9a..58fe3cf3d0 100644
--- a/share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/HelperWidgets/Section.qml
+++ b/share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/HelperWidgets/Section.qml
@@ -23,9 +23,9 @@
**
****************************************************************************/
-import QtQuick 2.1
+import QtQuick 2.15
import QtQuick.Controls 2.12 as Controls
-import QtQuick.Layouts 1.0
+import QtQuick.Layouts 1.15
import QtQuickDesignerTheme 1.0
import StudioTheme 1.0 as StudioTheme
@@ -35,28 +35,22 @@ Item {
property int leftPadding: 8
property int topPadding: 4
property int rightPadding: 0
+ property int bottomPadding: 4
property int animationDuration: 0
property bool expanded: true
+ property int level: 0
+ property int levelShift: 10
clip: true
Rectangle {
id: header
height: 20
-
anchors.left: parent.left
anchors.right: parent.right
-
- Controls.Label {
- id: label
- anchors.verticalCenter: parent.verticalCenter
- color: StudioTheme.Values.themeTextColor
- x: 22
- font.bold: true
- font.pixelSize: StudioTheme.Values.myFontSize
- }
+ color: Qt.lighter(StudioTheme.Values.themeSectionHeadBackground, 1.0 + (0.2 * level))
Image {
id: arrow
@@ -64,35 +58,27 @@ Item {
height: 4
source: "image://icons/down-arrow"
anchors.left: parent.left
- anchors.leftMargin: 4
+ anchors.leftMargin: 4 + (level * levelShift)
anchors.verticalCenter: parent.verticalCenter
Behavior on rotation {
NumberAnimation {
easing.type: Easing.OutCubic
- duration: animationDuration
+ duration: section.animationDuration
}
}
-
}
- color: StudioTheme.Values.themeSectionHeadBackground
-
- Rectangle {
- visible: false
- color:"#333"
- width: parent.width
- height: 1
- }
-
- Rectangle {
- visible: false
- color: "#333"
- anchors.bottom: parent.bottom
- width: parent.width
- height: 1
+ Controls.Label {
+ id: label
+ anchors.verticalCenter: parent.verticalCenter
+ color: StudioTheme.Values.themeTextColor
+ x: 22 + (level * levelShift)
+ font.bold: true
+ font.pixelSize: StudioTheme.Values.myFontSize
}
MouseArea {
+ id: mouseArea
anchors.fill: parent
onClicked: {
section.animationDuration = 120
@@ -105,22 +91,23 @@ Item {
readonly property alias contentItem: row
- implicitHeight: Math.round(row.height + header.height + 8)
+ implicitHeight: Math.round(row.height + header.height
+ + section.topPadding + section.bottomPadding)
Row {
+ id: row
anchors.left: parent.left
- anchors.leftMargin: leftPadding
+ anchors.leftMargin: section.leftPadding
anchors.right: parent.right
- anchors.rightMargin: rightPadding
+ anchors.rightMargin: section.rightPadding
anchors.top: header.bottom
- anchors.topMargin: topPadding
- id: row
+ anchors.topMargin: section.topPadding
}
Behavior on implicitHeight {
NumberAnimation {
easing.type: Easing.OutCubic
- duration: animationDuration
+ duration: section.animationDuration
}
}
diff --git a/share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/HelperWidgets/SpinBox.qml b/share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/HelperWidgets/SpinBox.qml
index 3f70547692..916bfc29d9 100644
--- a/share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/HelperWidgets/SpinBox.qml
+++ b/share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/HelperWidgets/SpinBox.qml
@@ -45,7 +45,10 @@ Item {
width: 96
implicitHeight: spinBox.height
- onFocusChanged: transaction.end();
+ onFocusChanged: {
+ restoreCursor();
+ transaction.end();
+ }
StudioControls.RealSpinBox {
id: spinBox
@@ -60,6 +63,8 @@ Item {
transaction.end();
}
+ onDragging: holdCursorInPlace();
+
onRealValueModified: {
if (transaction.active())
commitValue();
diff --git a/share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/HelperWidgets/StandardTextSection.qml b/share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/HelperWidgets/StandardTextSection.qml
index 4ff60966f8..c15f126811 100644
--- a/share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/HelperWidgets/StandardTextSection.qml
+++ b/share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/HelperWidgets/StandardTextSection.qml
@@ -154,7 +154,7 @@ Section {
Label {
text: qsTr("Render type")
- toolTip: qsTr("Override the default rendering type for this item.")
+ toolTip: qsTr("Overrides the default rendering type for this item.")
disabledState: !backendValues.renderType.isAvailable
}
ComboBox {
@@ -201,7 +201,7 @@ Section {
}
Label {
text: qsTr("Pixel")
- tooltip: qsTr("Specifies the minimum font pixel size of scaled text.")
+ tooltip: qsTr("Minimum font pixel size of scaled text.")
width: 42
disabledStateSoft: !backendValues.minimumPixelSize.isAvailable
}
@@ -222,7 +222,7 @@ Section {
}
Label {
text: qsTr("Point")
- tooltip: qsTr("Specifies the minimum font point size of scaled text.")
+ tooltip: qsTr("Minimum font point size of scaled text.")
width: 42
disabledStateSoft: !backendValues.minimumPointSize.isAvailable
}
@@ -231,7 +231,7 @@ Section {
Label {
visible: showLineHeight
text: qsTr("Line height")
- tooltip: qsTr("Sets the line height for the text.")
+ tooltip: qsTr("Line height for the text.")
disabledState: !lineHeightSpinBox.enabled
}
diff --git a/share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/HelperWidgets/UrlChooser.qml b/share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/HelperWidgets/UrlChooser.qml
index f505d9fc50..3c51254337 100644
--- a/share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/HelperWidgets/UrlChooser.qml
+++ b/share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/HelperWidgets/UrlChooser.qml
@@ -27,7 +27,9 @@ import QtQuick 2.1
import HelperWidgets 2.0
import StudioControls 1.0 as StudioControls
import StudioTheme 1.0 as StudioTheme
+import QtQuickDesignerTheme 1.0
import QtQuick.Layouts 1.0
+import QtQuick.Controls 2.5
RowLayout {
id: urlChooser
@@ -50,6 +52,58 @@ RowLayout {
StudioControls.ComboBox {
id: comboBox
+ // Note: highlightedIndex property isn't used because it has no setter and it doesn't reset
+ // when the combobox is closed by focusing on some other control.
+ property int hoverIndex: -1
+
+ ToolTip {
+ visible: comboBox.hovered
+ text: urlChooser.backendValue.valueToString
+ delay: 1000
+ }
+
+ delegate: ItemDelegate {
+ id: delegateItem
+ width: parent.width
+ height: 20
+ highlighted: comboBox.hoverIndex === index
+
+ indicator: Label { // selected item check mark
+ padding: 5
+ y: (parent.height - height) / 2
+ text: StudioTheme.Constants.tickIcon
+ font.pixelSize: 10
+ font.family: StudioTheme.Constants.iconFont.family
+ color: Theme.color(comboBox.hoverIndex === index ? Theme.PanelTextColorLight
+ : Theme.QmlDesigner_HighlightColor)
+ visible: comboBox.currentIndex === index
+ }
+
+ contentItem: Label {
+ leftPadding: 10
+ text: modelData
+ anchors.top: parent.top
+ color: Theme.color(Theme.PanelTextColorLight)
+ font.pixelSize: 13
+ }
+
+ background: Rectangle {
+ anchors.fill: parent
+ color: parent.highlighted ? Theme.color(Theme.QmlDesigner_HighlightColor) : "transparent"
+ }
+
+ ToolTip {
+ visible: delegateItem.hovered && comboBox.highlightedIndex === index
+ text: fileModel.fullPathModel[index]
+ delay: 1000
+ }
+
+ onHoveredChanged: {
+ if (hovered)
+ comboBox.hoverIndex = index
+ }
+ }
+
actionIndicator.icon.color: extFuncLogic.color
actionIndicator.icon.text: extFuncLogic.glyph
actionIndicator.onClicked: extFuncLogic.show()
@@ -78,7 +132,9 @@ RowLayout {
if (urlChooser.backendValue.isBound)
return urlChooser.backendValue.expression
- return urlChooser.backendValue.valueToString
+ var fullPath = urlChooser.backendValue.valueToString;
+ var fileName = fullPath.substr(fullPath.lastIndexOf('/') + 1);
+ return fileName;
}
onTextValueChanged: comboBox.setCurrentText(comboBox.textValue)
@@ -87,7 +143,7 @@ RowLayout {
editable: true
- model: fileModel.fileModel
+ model: fileModel.fileNameModel
onModelChanged: {
if (!comboBox.isComplete)
@@ -115,19 +171,17 @@ RowLayout {
function handleActivate(index)
{
- var cText = comboBox.textAt(index)
-
- if (index === -1)
- cText = comboBox.editText
-
if (urlChooser.backendValue === undefined)
return
if (!comboBox.isComplete)
return
- if (urlChooser.backendValue.value !== cText)
- urlChooser.backendValue.value = cText
+ if (index === -1) // select first item if index is invalid
+ index = 0
+
+ if (urlChooser.backendValue.value !== fileModel.fullPathModel[index])
+ urlChooser.backendValue.value = fileModel.fullPathModel[index]
comboBox.dirty = false
}
@@ -145,12 +199,28 @@ RowLayout {
}
}
+ Connections {
+ target: comboBox
+ function onStateChanged(state)
+ {
+ // update currentIndex when the popup opens to override the default behavior in super classes
+ // that selects currentIndex based on values in the combo box.
+ if (comboBox.popup.opened) {
+ var index = fileModel.fullPathModel.indexOf(urlChooser.backendValue.value)
+ if (index !== -1) {
+ comboBox.currentIndex = index
+ comboBox.hoverIndex = index
+ }
+ }
+ }
+ }
+
StudioControls.AbstractButton {
buttonIcon: StudioTheme.Constants.addFile
iconColor: urlChooser.textColor
onClicked: {
fileModel.openFileDialog()
- if (fileModel.fileName !== "")
+ if (fileModel.path !== "")
urlChooser.backendValue.value = fileModel.fileName
}
}
diff --git a/share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/HelperWidgets/qmldir b/share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/HelperWidgets/qmldir
index 59573217c5..459d40da0d 100644
--- a/share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/HelperWidgets/qmldir
+++ b/share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/HelperWidgets/qmldir
@@ -14,6 +14,7 @@ ColorEditor 2.0 ColorEditor.qml
ColorLine 2.0 ColorLine.qml
ColorLogic 2.0 ColorLogic.qml
ComboBox 2.0 ComboBox.qml
+ComponentButton 2.0 ComponentButton.qml
EditableListView 2.0 EditableListView.qml
ExpandingSpacer 2.0 ExpandingSpacer.qml
ExtendedFunctionLogic 2.0 ExtendedFunctionLogic.qml
@@ -47,3 +48,4 @@ ExpressionTextField 2.0 ExpressionTextField.qml
MarginSection 2.0 MarginSection.qml
HorizontalScrollBar 2.0 HorizontalScrollBar.qml
VerticalScrollBar 2.0 VerticalScrollBar.qml
+ImagePreviewTooltipArea 2.0 ImagePreviewTooltipArea.qml
diff --git a/share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/StudioControls/ActionIndicator.qml b/share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/StudioControls/ActionIndicator.qml
index a055447d96..cde5beedc1 100644
--- a/share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/StudioControls/ActionIndicator.qml
+++ b/share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/StudioControls/ActionIndicator.qml
@@ -55,7 +55,8 @@ Rectangle {
visible: text !== StudioTheme.Constants.actionIcon || actionIndicator.forceVisible
|| (myControl !== undefined &&
((myControl.edit !== undefined && myControl.edit)
- || (myControl.hover !== undefined && myControl.hover)))
+ || (myControl.hover !== undefined && myControl.hover)
+ || (myControl.drag !== undefined && myControl.drag)))
color: StudioTheme.Values.themeTextColor
font.family: StudioTheme.Constants.iconFont.family
font.pixelSize: StudioTheme.Values.myIconFontSize
diff --git a/share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/StudioControls/RealSpinBox.qml b/share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/StudioControls/RealSpinBox.qml
index 85e21735de..0da5776d40 100644
--- a/share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/StudioControls/RealSpinBox.qml
+++ b/share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/StudioControls/RealSpinBox.qml
@@ -55,6 +55,7 @@ T.SpinBox {
property bool dirty: false // user modification flag
+ // TODO Not used anymore. Will be removed when all dependencies were removed.
property real realDragRange: mySpinBox.realTo - mySpinBox.realFrom
property alias actionIndicatorVisible: actionIndicator.visible
@@ -77,6 +78,7 @@ T.SpinBox {
signal compressedRealValueModified
signal dragStarted
signal dragEnded
+ signal dragging
// Use custom wheel handling due to bugs
property bool __wheelEnabled: false
@@ -274,6 +276,7 @@ T.SpinBox {
}
onRealValueChanged: {
+ mySpinBox.setRealValue(mySpinBox.realValue) // sanitize and clamp realValue
spinBoxInput.text = mySpinBox.textFromValue(mySpinBox.realValue, mySpinBox.locale)
mySpinBox.value = 0 // Without setting value back to 0, it can happen that one of
// the indicator will be disabled due to range logic.
diff --git a/share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/StudioControls/RealSpinBoxInput.qml b/share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/StudioControls/RealSpinBoxInput.qml
index edeeaf9fd2..9749757392 100644
--- a/share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/StudioControls/RealSpinBoxInput.qml
+++ b/share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/StudioControls/RealSpinBoxInput.qml
@@ -70,61 +70,25 @@ TextInput {
height: StudioTheme.Values.height
}
- DragHandler {
- id: dragHandler
- target: null
- acceptedDevices: PointerDevice.Mouse
- enabled: true
-
- property real initialValue: myControl.realValue
- property real multiplier: 1.0
-
- onActiveChanged: {
- if (dragHandler.active) {
- dragHandler.initialValue = myControl.realValue
- mouseArea.cursorShape = Qt.ClosedHandCursor // TODO
- myControl.drag = true
- myControl.dragStarted()
- // Force focus on the non visible component to receive key events
- dragModifierWorkaround.forceActiveFocus()
- } else {
- if (myControl.compressedValueTimer.running) {
- myControl.compressedValueTimer.stop()
- calcValue(myControl.compressedRealValueModified)
- }
- mouseArea.cursorShape = Qt.PointingHandCursor // TODO
- myControl.drag = false
- myControl.dragEnded()
- // Avoid active focus on the component after dragging
- dragModifierWorkaround.focus = false
- textInput.focus = false
- myControl.focus = false
- }
- }
- onTranslationChanged: calcValue(myControl.realValueModified)
- onMultiplierChanged: calcValue(myControl.realValueModified)
-
- function calcValue(callback) {
- var tmp = myControl.realDragRange / StudioTheme.Values.dragLength
- myControl.setRealValue(dragHandler.initialValue + (tmp * dragHandler.translation.x * dragHandler.multiplier))
- callback()
- }
- }
-
Item {
id: dragModifierWorkaround
Keys.onPressed: {
event.accepted = true
- if (event.modifiers & Qt.ControlModifier)
- dragHandler.multiplier = 0.1
+ if (event.modifiers & Qt.ControlModifier) {
+ mouseArea.stepSize = myControl.minStepSize
+ mouseArea.calcValue(myControl.realValueModified)
+ }
- if (event.modifiers & Qt.ShiftModifier)
- dragHandler.multiplier = 10.0
+ if (event.modifiers & Qt.ShiftModifier) {
+ mouseArea.stepSize = myControl.maxStepSize
+ mouseArea.calcValue(myControl.realValueModified)
+ }
}
Keys.onReleased: {
event.accepted = true
- dragHandler.multiplier = 1.0
+ mouseArea.stepSize = myControl.realStepSize
+ mouseArea.calcValue(myControl.realValueModified)
}
}
@@ -133,21 +97,21 @@ TextInput {
event.accepted = (event.key === Qt.Key_Up || event.key === Qt.Key_Down)
}
- TapHandler {
- id: tapHandler
- acceptedDevices: PointerDevice.Mouse
- enabled: true
- onTapped: {
- textInput.forceActiveFocus()
- textInput.deselect() // QTBUG-75862
- }
- }
-
MouseArea {
id: mouseArea
property real stepSize: myControl.realStepSize
+ property bool dragging: false
+ property bool wasDragging: false
+ property bool potentialDragStart: false
+
+ property real initialValue: myControl.realValue
+
+ property real pressStartX: 0.0
+ property real dragStartX: 0.0
+ property real translationX: 0.0
+
anchors.fill: parent
enabled: true
hoverEnabled: true
@@ -156,7 +120,90 @@ TextInput {
cursorShape: Qt.PointingHandCursor
// Sets the global hover
onContainsMouseChanged: myControl.hover = containsMouse
- onPressed: mouse.accepted = false
+
+ onPositionChanged: {
+ if (!mouseArea.dragging
+ && !myControl.edit
+ && Math.abs(mouseArea.pressStartX - mouse.x) > StudioTheme.Values.dragThreshold
+ && mouse.buttons === 1
+ && mouseArea.potentialDragStart) {
+ mouseArea.dragging = true
+ mouseArea.potentialDragStart = false
+ mouseArea.initialValue = myControl.realValue
+ mouseArea.cursorShape = Qt.ClosedHandCursor
+ mouseArea.dragStartX = mouseArea.mouseX
+
+ myControl.drag = true
+ myControl.dragStarted()
+ // Force focus on the non visible component to receive key events
+ dragModifierWorkaround.forceActiveFocus()
+ textInput.deselect()
+ }
+
+ if (!mouseArea.dragging)
+ return
+
+ mouse.accepted = true
+
+ mouseArea.translationX += (mouseArea.mouseX - mouseArea.dragStartX)
+ mouseArea.calcValue(myControl.realValueModified)
+ }
+
+ onCanceled: mouseArea.endDrag()
+
+ onClicked: {
+ if (mouseArea.wasDragging) {
+ mouseArea.wasDragging = false
+ return
+ }
+
+ textInput.forceActiveFocus()
+ textInput.deselect() // QTBUG-75862
+ }
+
+ onPressed: {
+ mouseArea.potentialDragStart = true
+ mouseArea.pressStartX = mouseArea.mouseX
+ }
+
+ onReleased: mouseArea.endDrag()
+
+ function endDrag() {
+ if (!mouseArea.dragging)
+ return
+
+ mouseArea.dragging = false
+ mouseArea.wasDragging = true
+
+ if (myControl.compressedValueTimer.running) {
+ myControl.compressedValueTimer.stop()
+ mouseArea.calcValue(myControl.compressedRealValueModified)
+ }
+ mouseArea.cursorShape = Qt.PointingHandCursor
+ myControl.drag = false
+ myControl.dragEnded()
+ // Avoid active focus on the component after dragging
+ dragModifierWorkaround.focus = false
+ textInput.focus = false
+ myControl.focus = false
+
+ mouseArea.translationX = 0
+ }
+
+ function calcValue(callback) {
+ var minTranslation = (myControl.realFrom - mouseArea.initialValue) / mouseArea.stepSize
+ var maxTranslation = (myControl.realTo - mouseArea.initialValue) / mouseArea.stepSize
+
+ mouseArea.translationX = Math.min(Math.max(mouseArea.translationX, minTranslation), maxTranslation)
+
+ myControl.setRealValue(mouseArea.initialValue + (mouseArea.translationX * mouseArea.stepSize))
+
+ if (mouseArea.dragging)
+ myControl.dragging()
+
+ callback()
+ }
+
onWheel: {
if (!myControl.__wheelEnabled)
return
@@ -188,16 +235,9 @@ TextInput {
border.color: StudioTheme.Values.themeControlOutline
}
PropertyChanges {
- target: dragHandler
- enabled: true
- }
- PropertyChanges {
- target: tapHandler
- enabled: true
- }
- PropertyChanges {
target: mouseArea
cursorShape: Qt.PointingHandCursor
+ enabled: true
}
},
State {
@@ -218,16 +258,9 @@ TextInput {
border.color: StudioTheme.Values.themeInteraction
}
PropertyChanges {
- target: dragHandler
- enabled: false
- }
- PropertyChanges {
- target: tapHandler
- enabled: false
- }
- PropertyChanges {
target: mouseArea
cursorShape: Qt.IBeamCursor
+ enabled: false
}
},
State {
diff --git a/share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/StudioTheme/InternalConstants.qml b/share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/StudioTheme/InternalConstants.qml
index 808da702d5..bb7f96f787 100644
--- a/share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/StudioTheme/InternalConstants.qml
+++ b/share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/StudioTheme/InternalConstants.qml
@@ -98,33 +98,40 @@ QtObject {
readonly property string idAliasOff: "\u005B"
readonly property string idAliasOn: "\u005C"
readonly property string listView: "\u005D"
- readonly property string mergeCells: "\u005E"
- readonly property string minus: "\u005F"
- readonly property string plus: "\u0060"
- readonly property string redo: "\u0061"
- readonly property string splitColumns: "\u0062"
- readonly property string splitRows: "\u0063"
- readonly property string startNode: "\u0064"
- readonly property string testIcon: "\u0065"
- readonly property string textAlignBottom: "\u0066"
- readonly property string textAlignCenter: "\u0067"
- readonly property string textAlignLeft: "\u0068"
- readonly property string textAlignMiddle: "\u0069"
- readonly property string textAlignRight: "\u006A"
- readonly property string textAlignTop: "\u006B"
- readonly property string textBulletList: "\u006C"
- readonly property string textFullJustification: "\u006D"
- readonly property string textNumberedList: "\u006E"
- readonly property string tickIcon: "\u006F"
- readonly property string triState: "\u0070"
- readonly property string undo: "\u0071"
- readonly property string upDownIcon: "\u0072"
- readonly property string upDownSquare2: "\u0073"
- readonly property string wildcard: "\u0074"
- readonly property string zoomAll: "\u0075"
- readonly property string zoomIn: "\u0076"
- readonly property string zoomOut: "\u0077"
- readonly property string zoomSelection: "\u0078"
+ readonly property string lockOff: "\u005E"
+ readonly property string lockOn: "\u005F"
+ readonly property string mergeCells: "\u0060"
+ readonly property string minus: "\u0061"
+ readonly property string pin: "\u0062"
+ readonly property string plus: "\u0063"
+ readonly property string redo: "\u0064"
+ readonly property string rotation: "\u0065"
+ readonly property string splitColumns: "\u0066"
+ readonly property string splitRows: "\u0067"
+ readonly property string startNode: "\u0068"
+ readonly property string testIcon: "\u0069"
+ readonly property string textAlignBottom: "\u006A"
+ readonly property string textAlignCenter: "\u006B"
+ readonly property string textAlignLeft: "\u006C"
+ readonly property string textAlignMiddle: "\u006D"
+ readonly property string textAlignRight: "\u006E"
+ readonly property string textAlignTop: "\u006F"
+ readonly property string textBulletList: "\u0070"
+ readonly property string textFullJustification: "\u0071"
+ readonly property string textNumberedList: "\u0072"
+ readonly property string tickIcon: "\u0073"
+ readonly property string triState: "\u0074"
+ readonly property string undo: "\u0075"
+ readonly property string unpin: "\u0076"
+ readonly property string upDownIcon: "\u0077"
+ readonly property string upDownSquare2: "\u0078"
+ readonly property string visibilityOff: "\u0079"
+ readonly property string visibilityOn: "\u007A"
+ readonly property string wildcard: "\u007B"
+ readonly property string zoomAll: "\u007C"
+ readonly property string zoomIn: "\u007D"
+ readonly property string zoomOut: "\u007E"
+ readonly property string zoomSelection: "\u007F"
readonly property font iconFont: Qt.font({
"family": controlIcons.name,
diff --git a/share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/StudioTheme/Values.qml b/share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/StudioTheme/Values.qml
index 22f0ff872e..3d504302a7 100644
--- a/share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/StudioTheme/Values.qml
+++ b/share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/StudioTheme/Values.qml
@@ -50,7 +50,7 @@ QtObject {
property real sliderControlSize: 12
property real sliderControlSizeMulti: values.sliderControlSize * values.scaleFactor
- property int dragLength: 400 // px
+ property int dragThreshold: 10 // px
property real spinControlIconSize: 8
property real spinControlIconSizeMulti: values.spinControlIconSize * values.scaleFactor
diff --git a/share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/StudioTheme/icons.ttf b/share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/StudioTheme/icons.ttf
index e548392747..0c4d237c0e 100644
--- a/share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/StudioTheme/icons.ttf
+++ b/share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/StudioTheme/icons.ttf
Binary files differ
diff --git a/share/qtcreator/qmldesigner/qt4mcu/metadata.qml b/share/qtcreator/qmldesigner/qt4mcu/metadata.qml
new file mode 100644
index 0000000000..09c612ab40
--- /dev/null
+++ b/share/qtcreator/qmldesigner/qt4mcu/metadata.qml
@@ -0,0 +1,37 @@
+/****************************************************************************
+**
+** Copyright (C) 2020 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of Qt Creator.
+**
+** 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 General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3 as published by the Free Software
+** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
+** 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-3.0.html.
+**
+****************************************************************************/
+
+//list of files in the current system
+Metadata {
+ id: metadataFile
+
+ defaultVersion: v14
+
+ VersionData {
+ id: v14
+ name: "QUL 1.4"
+ path: "qul-14.qml"
+ }
+}
diff --git a/share/qtcreator/qmldesigner/qt4mcu/qul-14.qml b/share/qtcreator/qmldesigner/qt4mcu/qul-14.qml
new file mode 100644
index 0000000000..8b9ffed3b8
--- /dev/null
+++ b/share/qtcreator/qmldesigner/qt4mcu/qul-14.qml
@@ -0,0 +1,156 @@
+/****************************************************************************
+**
+** Copyright (C) 2020 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of Qt Creator.
+**
+** 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 General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3 as published by the Free Software
+** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
+** 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-3.0.html.
+**
+****************************************************************************/
+
+VersionData {
+ name: "QUL 1.4"
+
+ bannedItems: ["QtQuick.AnimatedImage",
+ "QtQuick.BorderImage",
+ "QtQuick.FocusScope",
+ "QtQuick.TextInput",
+ "QtQuick.TextEdit",
+ "QtQuick.Flow",
+ "QtQuick.Grid",
+ "QtQuick.GridView",
+ "QtQuick.PathView",
+ "QtQuick.Controls",
+ "QtQuick.Controls.BusyIndicator",
+ "QtQuick.Controls.ButtonGroup",
+ "QtQuick.Controls.CheckDelegate",
+ "QtQuick.Controls.Container",
+ "QtQuick.Controls.ComboBox",
+ "QtQuick.Controls.DelayButton",
+ "QtQuick.Controls.Frame",
+ "QtQuick.Controls.GroupBox",
+ "QtQuick.Controls.ItemDelegate",
+ "QtQuick.Controls.Label",
+ "QtQuick.Controls.Page",
+ "QtQuick.Controls.PageIndicator",
+ "QtQuick.Controls.Pane",
+ "QtQuick.Controls.RadioDelegate",
+ "QtQuick.Controls.RangeSlider",
+ "QtQuick.Controls.RoundButton",
+ "QtQuick.Controls.ScrollView",
+ "QtQuick.Controls.SpinBox",
+ "QtQuick.Controls.StackView",
+ "QtQuick.Controls.SwipeDelegate",
+ "QtQuick.Controls.SwitchDelegate",
+ "QtQuick.Controls.ToolBar",
+ "QtQuick.Controls.ToolButton",
+ "QtQuick.Controls.TabBar",
+ "QtQuick.Controls.TabButton",
+ "QtQuick.Controls.TextArea",
+ "QtQuick.Controls.TextField",
+ "QtQuick.Controls.ToolSeparator",
+ "QtQuick.Controls.Tumbler"]
+
+ allowedImports: ["QtQuick",
+ "QtQuick.Controls",
+ "QtQuick.Timeline"]
+
+ bannedImports: ["FlowView"]
+
+ //ComplexProperty is not a type, it's just a way to handle bigger props
+ ComplexProperty {
+ prefix: "font"
+ bannedProperties: ["wordSpacing", "letterSpacing", "hintingPreference",
+ "kerning", "preferShaping", "capitalization",
+ "strikeout", "underline", "styleName"]
+ }
+
+ QtQuick.Item {
+ bannedProperties: ["layer", "opacity", "gradient", "smooth", "antialiasing",
+ "border", "baselineOffset", "focus", "activeFocusOnTab",
+ "rotation", "scale", "transformOrigin"]
+ }
+
+ QtQuick.Flickable {
+ bannedProperties: ["boundsBehavior", "boundsMovement", "flickDeceleration",
+ "flickableDirection", "leftMargin", "rightMargin", "bottomMargin", "topMargin",
+ "originX", "originY", "pixelAligned", "pressDelay", "synchronousDrag"]
+ }
+
+ QtQuick.MouseArea {
+ bannedProperties: ["propagateComposedEvents", "preventStealing", "cursorShape",
+ "scrollGestureEnabled", "drag", "acceptedButtons", "hoverEnabled"]
+ }
+
+ QtQuick.Image {
+ allowChildren: false
+ allowedProperties: ["rotation", "scale", "transformOrigin"]
+ bannedProperties: ["mirror", "mipmap", "cache", "autoTransform", "asynchronous",
+ "sourceSize", "smooth"]
+ }
+
+ QtQuick.Text {
+ allowChildren: false
+ allowedProperties: ["rotation", "scale", "transformOrigin"]
+ bannedProperties: ["elide", "lineHeight", "lineHeightMode", "wrapMode", "style",
+ "styleColor", "minimumPointSize", "minimumPixelSize", "styleColor",
+ "fontSizeMode", "renderType", "textFormat", "maximumLineCount"]
+ }
+
+ //Padding is not an actual item, but rather set of properties in Text
+ Padding {
+ bannedProperties: ["bottomPadding", "topPadding", "leftPadding", "rightPadding"]
+ }
+
+ QtQuick.Column {
+ bannedProperties: ["layoutDirection"]
+ }
+
+ QtQuick.Row {
+ bannedProperties: ["layoutDirection"]
+ }
+
+ QtQuick.ListView {
+ bannedProperties: ["cacheBuffer", "highlightRangeMode", "highlightMoveDuration",
+ "highlightResizeDuration", "preferredHighlightBegin", "layoutDirection",
+ "preferredHighlightEnd", "highlightFollowsCurrentItem", "keyNavigationWraps",
+ "snapMode", "highlightMoveVelocity", "highlightResizeVelocity"]
+ }
+
+ QtQuick.Animation {
+ bannedProperties: ["paused"]
+ }
+
+ //Quick Controls2 Items and properties:
+
+ QtQuick.Controls.Control {
+ bannedProperties: ["focusPolicy", "hoverEnabled", "wheelEnabled"]
+ }
+
+ QtQuick.Controls.AbstractButton {
+ bannedProperties: ["display", "autoExclusive"]
+ }
+
+ QtQuick.Controls.ProgressBar {
+ bannedProperties: ["indeterminate"]
+ }
+
+ QtQuick.Controls.Slider {
+ bannedProperties: ["live", "snapMode", "touchDragThreshold"]
+ }
+}
diff --git a/share/qtcreator/snippets/cpp.xml b/share/qtcreator/snippets/cpp.xml
index 17cf2ebf1c..82a62b36e6 100644
--- a/share/qtcreator/snippets/cpp.xml
+++ b/share/qtcreator/snippets/cpp.xml
@@ -59,8 +59,8 @@ public:
<snippet group="C++" trigger="lic" id="license-configured" complement="" removed="false" modified="false">%{Cpp:LicenseTemplate}
$$</snippet>
<snippet group="C++" trigger="licbsd" id="license-bsd" complement="" removed="false" modified="false">/**
-@if ('%{CurrentProject:Name}' !== '')
- ** This file is part of the %{CurrentProject:Name} project.
+@if ('%{CurrentDocument:Project:Name}' !== '')
+ ** This file is part of the %{CurrentDocument:Project:Name} project.
@endif
@if ('%{Env:QTC_COPYRIGHT_USER}' === '' || '%{Env:QTC_COPYRIGHT_EMAIL}' === '')
** Copyright %{CurrentDate:yyyy} $copyright_user$ &lt;$copyright_email$&gt;.
@@ -95,8 +95,8 @@ $$</snippet>
$$</snippet>
<snippet group="C++" trigger="licgpl" id="license-gpl" complement="" removed="false" modified="false">/**
-@if ('%{CurrentProject:Name}' !== '')
- ** This file is part of the %{CurrentProject:Name} project.
+@if ('%{CurrentDocument:Project:Name}' !== '')
+ ** This file is part of the %{CurrentDocument:Project:Name} project.
@endif
@if ('%{Env:QTC_COPYRIGHT_USER}' === '' || '%{Env:QTC_COPYRIGHT_EMAIL}' === '')
** Copyright %{CurrentDate:yyyy} $copyright_user$ &lt;$copyright_email$&gt;.
@@ -120,8 +120,8 @@ $$</snippet>
$$</snippet>
<snippet group="C++" trigger="liclgpl" id="license-lgpl" complement="" removed="false" modified="false">/**
-@if ('%{CurrentProject:Name}' !== '')
- ** This file is part of the %{CurrentProject:Name} project.
+@if ('%{CurrentDocument:Project:Name}' !== '')
+ ** This file is part of the %{CurrentDocument:Project:Name} project.
@endif
@if ('%{Env:QTC_COPYRIGHT_USER}' === '' || '%{Env:QTC_COPYRIGHT_EMAIL}' === '')
** Copyright %{CurrentDate:yyyy} $copyright_user$ &lt;$copyright_email$&gt;.
@@ -153,7 +153,7 @@ $$</snippet>
@endif
** Contact: https://www.qt.io/licensing/
**
-** This file is part of %{CurrentProject:Name}
+** This file is part of %{CurrentDocument:Project:Name}
**
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
diff --git a/share/qtcreator/static.pro b/share/qtcreator/static.pro
index d3fdfdd281..53946861cf 100644
--- a/share/qtcreator/static.pro
+++ b/share/qtcreator/static.pro
@@ -30,7 +30,7 @@ macx: DATA_DIRS += scripts
for(data_dir, DATA_DIRS) {
files = $$files($$PWD/$$data_dir/*, true)
# Info.plist.in are handled below
- for(file, files):!contains(file, ".*/Info\\.plist\\.in$"):!exists($$file/*): \
+ for(file, files):!contains(file, ".*/Info\\.plist\\.in$"):!contains(file, ".*__pycache__.*"):!exists($$file/*): \
STATIC_FILES += $$file
}
diff --git a/share/qtcreator/styles/creator-dark.xml b/share/qtcreator/styles/creator-dark.xml
index d5bd74a7fb..45c372494e 100644
--- a/share/qtcreator/styles/creator-dark.xml
+++ b/share/qtcreator/styles/creator-dark.xml
@@ -5,6 +5,8 @@
<style name="Selection" foreground="#bec0c2" background="#1d545c"/>
<style name="LineNumber" foreground="#bec0c2" background="#404244"/>
<style name="SearchResult" background="#8a7f2c"/>
+ <style name="SearchResultAlt1" background="#8a402c"/>
+ <style name="SearchResultAlt2" foreground="#ffaaaa" background="#553636"/>
<style name="SearchScope" background="#8a602c"/>
<style name="Parentheses" foreground="#bec0c2" background="#1d545c"/>
<style name="ParenthesesMismatch" background="#ff6aad"/>
diff --git a/share/qtcreator/styles/dark.xml b/share/qtcreator/styles/dark.xml
index 86aedfa433..a10e0f54b6 100644
--- a/share/qtcreator/styles/dark.xml
+++ b/share/qtcreator/styles/dark.xml
@@ -33,6 +33,8 @@
<style name="AutoComplete" foreground="#a0a0ff" background="#333333"/>
<style name="Preprocessor" foreground="#5555ff"/>
<style name="SearchResult" background="#555500"/>
+ <style name="SearchResultAlt1" background="#363636"/>
+ <style name="SearchResultAlt2" foreground="#ffaaaa" background="#553636"/>
<style name="SearchScope" background="#222200"/>
<style name="Selection" foreground="#000000" background="#aaaaaa"/>
<style name="Static" foreground="#55ff55" italic="true"/>
diff --git a/share/qtcreator/styles/default_classic.xml b/share/qtcreator/styles/default_classic.xml
index 04939c7032..bcc297f55c 100644
--- a/share/qtcreator/styles/default_classic.xml
+++ b/share/qtcreator/styles/default_classic.xml
@@ -5,6 +5,8 @@
<style name="Selection" foreground="#ffffff" background="#308cc6"/>
<style name="LineNumber" foreground="#9f9d9a" background="#efebe7"/>
<style name="SearchResult" background="#ffef0b"/>
+ <style name="SearchResultAlt1" background="#b4b4b4"/>
+ <style name="SearchResultAlt2" background="#ff6464"/>
<style name="SearchScope" background="#f5fafd"/>
<style name="Parentheses" foreground="#ff0000" background="#b4eeb4"/>
<style name="ParenthesesMismatch" background="#ff00ff"/>
diff --git a/share/qtcreator/styles/inkpot.xml b/share/qtcreator/styles/inkpot.xml
index 252052bb1d..8ebad736e4 100644
--- a/share/qtcreator/styles/inkpot.xml
+++ b/share/qtcreator/styles/inkpot.xml
@@ -40,6 +40,8 @@
<style name="Preprocessor" foreground="#409090"/>
<style name="RemovedLine" foreground="#ff0000"/>
<style name="SearchResult" foreground="#000000" background="#ffef0b"/>
+ <style name="SearchResultAlt1" foreground="#000000" background="#616161"/>
+ <style name="SearchResultAlt2" foreground="#000000" background="#ff6464"/>
<style name="SearchScope" foreground="#000000" background="#f8fafc"/>
<style name="Selection" foreground="#ffffff" background="#4e4e8f"/>
<style name="Static" foreground="#cb6ecb"/>
diff --git a/share/qtcreator/styles/modnokai_night_shift_v2.xml b/share/qtcreator/styles/modnokai_night_shift_v2.xml
index f585658313..d49b655754 100644
--- a/share/qtcreator/styles/modnokai_night_shift_v2.xml
+++ b/share/qtcreator/styles/modnokai_night_shift_v2.xml
@@ -14,6 +14,8 @@
<style name="Selection" background="#11404c"/>
<style name="LineNumber" foreground="#888888" background="#272822"/>
<style name="SearchResult" background="#555500"/>
+ <style name="SearchResultAlt1" background="#aa0000"/>
+ <style name="SearchResultAlt2" foreground="#ffaaaa" background="#553636"/>
<style name="SearchScope" background="#222200"/>
<style name="Parentheses" foreground="#ffffff" background="#11404c"/>
<style name="CurrentLine" background="#373737"/>
diff --git a/share/qtcreator/styles/solarized-dark.xml b/share/qtcreator/styles/solarized-dark.xml
index ee51df82ba..15104b6158 100644
--- a/share/qtcreator/styles/solarized-dark.xml
+++ b/share/qtcreator/styles/solarized-dark.xml
@@ -11,6 +11,8 @@
<style name="Selection" foreground="#002b36" background="#586e75"/>
<style name="LineNumber" foreground="#586e75" background="#073642"/>
<style name="SearchResult" background="#073642"/>
+ <style name="SearchResultAlt1" background="#586e75"/>
+ <style name="SearchResultAlt2" background="#073642"/>
<style name="SearchScope" background="#073642"/>
<style name="Parentheses" foreground="#dc322f" background="#586e75" bold="true"/>
<style name="ParenthesesMismatch" foreground="#fdff2c" background="#d33682" bold="true"/>
diff --git a/share/qtcreator/styles/solarized-light.xml b/share/qtcreator/styles/solarized-light.xml
index cb5b25319d..4344e94d64 100644
--- a/share/qtcreator/styles/solarized-light.xml
+++ b/share/qtcreator/styles/solarized-light.xml
@@ -11,6 +11,8 @@
<style name="Selection" foreground="#eee8d5" background="#93a1a1"/>
<style name="LineNumber" foreground="#93a1a1" background="#eee8d5"/>
<style name="SearchResult" background="#eee8d5"/>
+ <style name="SearchResultAlt1" background="#93a1a1"/>
+ <style name="SearchResultAlt2" background="#e0dbcb"/>
<style name="SearchScope" background="#073642"/>
<style name="Parentheses" foreground="#dc322f" background="#93a1a1" bold="true"/>
<style name="ParenthesesMismatch" foreground="#ffff00" background="#ff00ff" bold="true"/>
diff --git a/share/qtcreator/templates/wizards/autotest/files/tst.txt b/share/qtcreator/templates/wizards/autotest/files/tst.txt
index 569bf4d01d..161fd0ff26 100644
--- a/share/qtcreator/templates/wizards/autotest/files/tst.txt
+++ b/share/qtcreator/templates/wizards/autotest/files/tst.txt
@@ -3,10 +3,12 @@ cmake_minimum_required(VERSION 3.5)
project(%{TestCaseName} LANGUAGES CXX)
@if "%{TestFrameWork}" == "QtTest"
-
-find_package(Qt5Test REQUIRED)
@if "%{RequireGUI}" == "true"
-find_package(Qt5Gui REQUIRED)
+find_package(QT NAMES Qt5 Qt6 COMPONENTS Gui Test REQUIRED)
+find_package(Qt${QT_VERSION_MAJOR} COMPONENTS Gui Test REQUIRED)
+@else
+find_package(QT NAMES Qt5 Qt6 COMPONENTS Test REQUIRED)
+find_package(Qt${QT_VERSION_MAJOR} COMPONENTS Test REQUIRED)
@endif
set(CMAKE_INCLUDE_CURRENT_DIR ON)
@@ -23,14 +25,15 @@ add_executable(%{TestCaseName} %{TestCaseFileWithCppSuffix})
add_test(NAME %{TestCaseName} COMMAND %{TestCaseName})
@if "%{RequireGUI}" == "true"
-target_link_libraries(%{TestCaseName} PRIVATE Qt5::Gui Qt5::Test)
+target_link_libraries(%{TestCaseName} PRIVATE Qt${QT_VERSION_MAJOR}::Gui Qt${QT_VERSION_MAJOR}::Test)
@else
-target_link_libraries(%{TestCaseName} PRIVATE Qt5::Test)
+target_link_libraries(%{TestCaseName} PRIVATE Qt${QT_VERSION_MAJOR}::Test)
@endif
@endif
@if "%{TestFrameWork}" == "QtQuickTest"
-find_package(Qt5QuickTest REQUIRED)
+find_package(QT NAMES Qt5 Qt6 COMPONENTS QuickTest REQUIRED)
+find_package(Qt${QT_VERSION_MAJOR} COMPONENTS QuickTest REQUIRED)
set(CMAKE_INCLUDE_CURRENT_DIR ON)
@@ -48,7 +51,7 @@ add_definitions(-DQUICK_TEST_SOURCE_DIR="${CMAKE_CURRENT_SOURCE_DIR}")
add_executable(%{TestCaseName} %{MainCppName})
add_test(NAME %{TestCaseName} COMMAND %{TestCaseName})
-target_link_libraries(%{TestCaseName} PRIVATE Qt5::QuickTest)
+target_link_libraries(%{TestCaseName} PRIVATE Qt${QT_VERSION_MAJOR}::QuickTest)
@endif
@if "%{TestFrameWork}" == "GTest"
@@ -120,13 +123,14 @@ endif ()
SET(CMAKE_CXX_STANDARD 11)
@if "%{Catch2NeedsQt}" == "true"
-find_package(Qt5Gui REQUIRED)
+find_package(QT NAMES Qt5 Qt6 COMPONENTS Gui REQUIRED)
+find_package(Qt${QT_VERSION_MAJOR} COMPONENTS Gui REQUIRED)
@endif
add_executable(${PROJECT_NAME} %{TestCaseFileWithCppSuffix} main.cpp)
@if "%{Catch2NeedsQt}" == "true"
-target_link_libraries(%{TestCaseName} PRIVATE Qt5::Gui)
+target_link_libraries(%{TestCaseName} PRIVATE Qt${QT_VERSION_MAJOR}::Gui)
@endif
if (DEFINED ENV{CATCH_INCLUDE_DIR})
diff --git a/share/qtcreator/templates/wizards/classes/cpp/wizard.json b/share/qtcreator/templates/wizards/classes/cpp/wizard.json
index 117139ed82..b66a7b34ba 100644
--- a/share/qtcreator/templates/wizards/classes/cpp/wizard.json
+++ b/share/qtcreator/templates/wizards/classes/cpp/wizard.json
@@ -35,7 +35,10 @@
"trDisplayName": "Class name:",
"mandatory": true,
"type": "LineEdit",
- "data": { "validator": "(?:(?:[a-zA-Z_][a-zA-Z_0-9]*::)*[a-zA-Z_][a-zA-Z_0-9]*|)" }
+ "data": {
+ "validator": "(?:(?:[a-zA-Z_][a-zA-Z_0-9]*::)*[a-zA-Z_][a-zA-Z_0-9]*|)",
+ "completion": "namespaces"
+ }
},
{
"name": "BaseCB",
@@ -55,7 +58,8 @@
"data":
{
"trText": "%{BaseCB}",
- "trDisabledText": "%{BaseCB}"
+ "trDisabledText": "%{BaseCB}",
+ "completion": "classes"
}
},
diff --git a/share/qtcreator/templates/wizards/projects/consoleapp/CMakeLists.txt b/share/qtcreator/templates/wizards/projects/consoleapp/CMakeLists.txt
index 12653a1671..6e134b6489 100644
--- a/share/qtcreator/templates/wizards/projects/consoleapp/CMakeLists.txt
+++ b/share/qtcreator/templates/wizards/projects/consoleapp/CMakeLists.txt
@@ -17,7 +17,8 @@ find_package(Qt${QT_VERSION_MAJOR} COMPONENTS Core LinguistTools REQUIRED)
set(TS_FILES %{TsFileName})
@else
-find_package(Qt5Core)
+find_package(QT NAMES Qt6 Qt5 COMPONENTS Core REQUIRED)
+find_package(Qt${QT_VERSION_MAJOR} COMPONENTS Core REQUIRED)
@endif
add_executable(%{ProjectName}
diff --git a/share/qtcreator/templates/wizards/projects/qtquickapplication/CMakeLists.txt b/share/qtcreator/templates/wizards/projects/qtquickapplication/CMakeLists.txt
index 3b479a595c..95426d9498 100644
--- a/share/qtcreator/templates/wizards/projects/qtquickapplication/CMakeLists.txt
+++ b/share/qtcreator/templates/wizards/projects/qtquickapplication/CMakeLists.txt
@@ -34,22 +34,28 @@ find_package(QT NAMES Qt6 Qt5 COMPONENTS Core Quick REQUIRED)
find_package(Qt${QT_VERSION_MAJOR} COMPONENTS Core Quick REQUIRED)
@endif
-if(ANDROID)
- add_library(%{ProjectName} SHARED
- %{MainCppFileName}
- qml.qrc
-@if %{HasTranslation}
- ${TS_FILES}
-@endif
+set(PROJECT_SOURCES
+ %{MainCppFileName}
+ qml.qrc
+ @if %{HasTranslation}
+ ${TS_FILES}
+ @endif
+)
+
+if(${QT_VERSION_MAJOR} GREATER_EQUAL 6)
+ qt_add_executable(%{ProjectName}
+ ${PROJECT_SOURCES}
)
else()
- add_executable(%{ProjectName}
- %{MainCppFileName}
- qml.qrc
-@if %{HasTranslation}
- ${TS_FILES}
-@endif
- )
+ if(ANDROID)
+ add_library(%{ProjectName} SHARED
+ ${PROJECT_SOURCES}
+ )
+ else()
+ add_executable(%{ProjectName}
+ ${PROJECT_SOURCES}
+ )
+ endif()
endif()
target_compile_definitions(%{ProjectName}
diff --git a/share/qtcreator/templates/wizards/projects/qtwidgetsapplication/CMakeLists.txt b/share/qtcreator/templates/wizards/projects/qtwidgetsapplication/CMakeLists.txt
index 21fec5e47b..391da14052 100644
--- a/share/qtcreator/templates/wizards/projects/qtwidgetsapplication/CMakeLists.txt
+++ b/share/qtcreator/templates/wizards/projects/qtwidgetsapplication/CMakeLists.txt
@@ -34,30 +34,32 @@ find_package(QT NAMES Qt6 Qt5 COMPONENTS Widgets REQUIRED)
find_package(Qt${QT_VERSION_MAJOR} COMPONENTS Widgets REQUIRED)
@endif
-if(ANDROID)
- add_library(%{ProjectName} SHARED
- %{MainFileName}
- %{SrcFileName}
- %{HdrFileName}
- @if %{GenerateForm}
- %{FormFileName}
- @endif
- @if %{HasTranslation}
- ${TS_FILES}
- @endif
- )
+set(PROJECT_SOURCES
+ %{MainFileName}
+ %{SrcFileName}
+ %{HdrFileName}
+ @if %{GenerateForm}
+ %{FormFileName}
+ @endif
+ @if %{HasTranslation}
+ ${TS_FILES}
+ @endif
+)
+
+if(${QT_VERSION_MAJOR} GREATER_EQUAL 6)
+ qt_add_executable(%{ProjectName}
+ ${PROJECT_SOURCES}
+ )
else()
- add_executable(%{ProjectName}
- %{MainFileName}
- %{SrcFileName}
- %{HdrFileName}
- @if %{GenerateForm}
- %{FormFileName}
- @endif
- @if %{HasTranslation}
- ${TS_FILES}
- @endif
- )
+ if(ANDROID)
+ add_library(%{ProjectName} SHARED
+ ${PROJECT_SOURCES}
+ )
+ else()
+ add_executable(%{ProjectName}
+ ${PROJECT_SOURCES}
+ )
+ endif()
endif()
target_link_libraries(%{ProjectName} PRIVATE Qt${QT_VERSION_MAJOR}::Widgets)
diff --git a/share/qtcreator/templates/wizards/projects/qtwidgetsapplication/widget.cpp b/share/qtcreator/templates/wizards/projects/qtwidgetsapplication/widget.cpp
index 356e2444f6..990f98dee4 100644
--- a/share/qtcreator/templates/wizards/projects/qtwidgetsapplication/widget.cpp
+++ b/share/qtcreator/templates/wizards/projects/qtwidgetsapplication/widget.cpp
@@ -1,24 +1,30 @@
%{Cpp:LicenseTemplate}\
#include "%{JS: Util.relativeFilePath('%{Path}/%{HdrFileName}', '%{Path}' + '/' + Util.path('%{SrcFileName}'))}"
-@if %{GenerateForm}
+@if %{GenerateForm} && %{JS: QtSupport.uiAsPointer() }
#include "%{UiHdrFileName}"
@endif
%{JS: Cpp.openNamespaces('%{Class}')}\
%{CN}::%{CN}(QWidget *parent)
: %{BaseClass}(parent)
-@if %{GenerateForm}
+@if %{GenerateForm} && %{JS: QtSupport.uiAsPointer() }
, ui(new Ui::%{CN})
@endif
{
@if %{GenerateForm}
+@if %{JS: QtSupport.uiAsPointer() }
ui->setupUi(this);
+@elsif %{JS: QtSupport.uiAsMember() }
+ ui.setupUi(this);
+@else
+ setupUi(this);
+@endif
@endif
}
%{CN}::~%{CN}()
{
-@if %{GenerateForm}
+@if %{GenerateForm} && %{JS: QtSupport.uiAsPointer() }
delete ui;
@endif
}
diff --git a/share/qtcreator/templates/wizards/projects/qtwidgetsapplication/widget.h b/share/qtcreator/templates/wizards/projects/qtwidgetsapplication/widget.h
index dca6171267..f69879b70f 100644
--- a/share/qtcreator/templates/wizards/projects/qtwidgetsapplication/widget.h
+++ b/share/qtcreator/templates/wizards/projects/qtwidgetsapplication/widget.h
@@ -6,9 +6,13 @@
#define %{GUARD}
@endif
+@if %{GenerateForm} && ! %{JS: QtSupport.uiAsPointer() }
+#include "%{UiHdrFileName}"
+
+@endif
%{JS: QtSupport.qtIncludes([ 'QtGui/%{BaseClass}' ], [ 'QtWidgets/%{BaseClass}' ]) }\
%{JS: Cpp.openNamespaces('%{Class}')}\
-@if %{GenerateForm}
+@if %{GenerateForm} && %{JS: QtSupport.uiAsPointer() }
@if ! %{JS: Cpp.hasNamespaces('%{Class}')}
QT_BEGIN_NAMESPACE
@@ -19,7 +23,12 @@ QT_END_NAMESPACE
@endif
@endif
-class %{CN} : public %{BaseClass}
+class %{CN} : public %{BaseClass}\
+@if %{GenerateForm} && %{JS: QtSupport.uiAsInheritance() }
+, private Ui::%{CN}
+@else
+
+@endif
{
Q_OBJECT
@@ -27,9 +36,15 @@ public:
%{CN}(QWidget *parent = nullptr);
~%{CN}();
@if %{GenerateForm}
+@if %{JS: QtSupport.uiAsPointer() }
private:
Ui::%{CN} *ui;
+@elsif %{JS: QtSupport.uiAsMember() }
+
+private:
+ Ui::%{CN} ui;
+@endif
@endif
};
%{JS: Cpp.closeNamespaces('%{Class}')}\
diff --git a/share/qtcreator/templates/wizards/qtcreatorplugin/CMakeLists.txt b/share/qtcreator/templates/wizards/qtcreatorplugin/CMakeLists.txt
new file mode 100644
index 0000000000..214dcfc221
--- /dev/null
+++ b/share/qtcreator/templates/wizards/qtcreatorplugin/CMakeLists.txt
@@ -0,0 +1,32 @@
+cmake_minimum_required(VERSION 3.9)
+
+# Remove when sharing with others.
+list(APPEND CMAKE_PREFIX_PATH "%{QtCreatorBuild}")
+
+project(%{PluginName})
+
+set(CMAKE_AUTOMOC ON)
+set(CMAKE_AUTORCC ON)
+set(CMAKE_AUTOUIC ON)
+set(CMAKE_CXX_STANDARD 17)
+
+find_package(QtCreator COMPONENTS Core REQUIRED)
+find_package(QT NAMES Qt6 Qt5 COMPONENTS Widgets REQUIRED)
+set(QtX Qt${QT_VERSION_MAJOR})
+
+add_qtc_plugin(%{PluginName}
+ PLUGIN_DEPENDS
+ QtCreator::Core
+ DEPENDS
+ ${QtX}::Widgets
+ QtCreator::ExtensionSystem
+ QtCreator::Utils
+ SOURCES
+ .github/workflows/build_cmake.yml
+ .github/workflows/README.md
+ README.md
+ %{SrcFileName}
+ %{HdrFileName}
+ %{GlobalHdrFileName}
+ %{ConstantsHdrFileName}
+)
diff --git a/share/qtcreator/templates/wizards/qtcreatorplugin/README.md b/share/qtcreator/templates/wizards/qtcreatorplugin/README.md
new file mode 100644
index 0000000000..bdd9b8a67d
--- /dev/null
+++ b/share/qtcreator/templates/wizards/qtcreatorplugin/README.md
@@ -0,0 +1,35 @@
+# %{PluginName}
+
+## How to Build
+
+Create a build directory and run
+
+ cmake -DCMAKE_PREFIX_PATH=<path_to_qtcreator> -DCMAKE_BUILD_TYPE=RelWithDebInfo <path_to_plugin_source>
+ cmake --build .
+
+where `<path_to_qtcreator>` is the relative or absolute path to a Qt Creator build directory, or to
+a combined binary and development package, and `<path_to_plugin_source>` is the relative or absolute
+path to this plugin directory.
+
+## How to Run
+
+Run a compatible Qt Creator with the additional command line argument
+
+ -pluginpath <path_to_plugin>
+
+where `<path_to_plugin>` is the path to the resulting plugin library in the build directory
+(`<plugin_build>/lib/qtcreator/plugins` on Windows and Linux,
+`<plugin_build>/Qt Creator.app/Contents/PlugIns` on macOS).
+
+You might want to add `-temporarycleansettings` (or `-tcs`) to ensure that the opened Qt Creator
+instance cannot mess with your user-global Qt Creator settings.
+
+When building and running the plugin from Qt Creator, you can use
+
+ -pluginpath "%{buildDir}/lib/qtcreator/plugins" -tcs
+
+on Windows and Linux, or
+
+ -pluginpath "%{buildDir}/Qt Creator.app/Contents/PlugIns" -tcs
+
+for the `Command line arguments` field in the run settings.
diff --git a/share/qtcreator/templates/wizards/qtcreatorplugin/github_workflows_README.md b/share/qtcreator/templates/wizards/qtcreatorplugin/github_workflows_README.md
index 8481ed15ae..107410c6ec 100644
--- a/share/qtcreator/templates/wizards/qtcreatorplugin/github_workflows_README.md
+++ b/share/qtcreator/templates/wizards/qtcreatorplugin/github_workflows_README.md
@@ -1,6 +1,6 @@
# GitHub Actions & Workflows
-The `build_qmake.yml` in this directory adds a [GitHub action][1] and workflow that builds
+The `build_cmake.yml` in this directory adds a [GitHub action][1] and workflow that builds
your plugin anytime you push commits to GitHub on Windows, Linux and macOS.
The build artifacts can be downloaded from GitHub and be installed into an existing Qt Creator
diff --git a/share/qtcreator/templates/wizards/qtcreatorplugin/github_workflows_build_qmake.yml b/share/qtcreator/templates/wizards/qtcreatorplugin/github_workflows_build_cmake.yml
index 5326dfeb9d..bd5571b1d0 100644
--- a/share/qtcreator/templates/wizards/qtcreatorplugin/github_workflows_build_qmake.yml
+++ b/share/qtcreator/templates/wizards/qtcreatorplugin/github_workflows_build_cmake.yml
@@ -3,11 +3,12 @@ name: Build plugin
on: [push]
env:
+ PLUGIN_NAME: %{PluginName}
QT_VERSION: %{JS: Util.qtVersion()}
QT_CREATOR_VERSION: %{JS: Util.qtCreatorVersion()}
QT_CREATOR_SNAPSHOT: NO
- PLUGIN_PRO: %{ProFile}
- PLUGIN_NAME: %{PluginName}
+ CMAKE_VERSION: 3.18.3
+ NINJA_VERSION: 1.10.1
jobs:
build:
@@ -17,82 +18,114 @@ jobs:
matrix:
config:
- {
- name: "Windows Latest x64", artifact: "Windows-x64.zip",
- os: windows-latest,
- environment_script: "C:/Program Files (x86)/Microsoft Visual Studio/2019/Enterprise/VC/Auxiliary/Build/vcvars64.bat"
- }
- - {
- name: "Windows Latest x86", artifact: "Windows-x86.zip",
+ name: "Windows Latest MSVC", artifact: "Windows-x64",
os: windows-latest,
- environment_script: "C:/Program Files (x86)/Microsoft Visual Studio/2019/Enterprise/VC/Auxiliary/Build/vcvars32.bat"
+ cc: "cl", cxx: "cl",
+ environment_script: "C:/Program Files (x86)/Microsoft Visual Studio/2019/Enterprise/VC/Auxiliary/Build/vcvars64.bat",
}
- {
- name: "Linux Latest x64", artifact: "Linux-x64.zip",
- os: ubuntu-latest
+ name: "Ubuntu Latest GCC", artifact: "Linux-x64",
+ os: ubuntu-latest,
+ cc: "gcc", cxx: "g++"
}
- {
- name: "macOS Latest x64", artifact: "macOS-x64.zip",
- os: macos-latest
+ name: "macOS Latest Clang", artifact: "macOS-x64",
+ os: macos-latest,
+ cc: "clang", cxx: "clang++"
}
steps:
- uses: actions/checkout@v1
- - name: Installing system libs
+ - name: Download Ninja and CMake
+ shell: cmake -P {0}
+ run: |
+ set(cmake_version "$ENV{CMAKE_VERSION}")
+ set(ninja_version "$ENV{NINJA_VERSION}")
+
+ if ("${{ runner.os }}" STREQUAL "Windows")
+ set(ninja_suffix "win.zip")
+ set(cmake_suffix "win64-x64.zip")
+ set(cmake_dir "cmake-${cmake_version}-win64-x64/bin")
+ elseif ("${{ runner.os }}" STREQUAL "Linux")
+ set(ninja_suffix "linux.zip")
+ set(cmake_suffix "Linux-x86_64.tar.gz")
+ set(cmake_dir "cmake-${cmake_version}-Linux-x86_64/bin")
+ elseif ("${{ runner.os }}" STREQUAL "macOS")
+ set(ninja_suffix "mac.zip")
+ set(cmake_suffix "Darwin-x86_64.tar.gz")
+ set(cmake_dir "cmake-${cmake_version}-Darwin-x86_64/CMake.app/Contents/bin")
+ endif()
+
+ set(ninja_url "https://github.com/ninja-build/ninja/releases/download/v${ninja_version}/ninja-${ninja_suffix}")
+ file(DOWNLOAD "${ninja_url}" ./ninja.zip SHOW_PROGRESS)
+ execute_process(COMMAND ${CMAKE_COMMAND} -E tar xvf ./ninja.zip)
+
+ set(cmake_url "https://github.com/Kitware/CMake/releases/download/v${cmake_version}/cmake-${cmake_version}-${cmake_suffix}")
+ file(DOWNLOAD "${cmake_url}" ./cmake.zip SHOW_PROGRESS)
+ execute_process(COMMAND ${CMAKE_COMMAND} -E tar xvf ./cmake.zip)
+
+ # Add to PATH environment variable
+ file(TO_CMAKE_PATH "$ENV{GITHUB_WORKSPACE}/${cmake_dir}" cmake_dir)
+ set(path_separator ":")
+ if ("${{ runner.os }}" STREQUAL "Windows")
+ set(path_separator ";")
+ endif()
+ file(APPEND "$ENV{GITHUB_PATH}" "$ENV{GITHUB_WORKSPACE}${path_separator}${cmake_dir}")
+
+ if (NOT "${{ runner.os }}" STREQUAL "Windows")
+ execute_process(
+ COMMAND chmod +x ninja
+ COMMAND chmod +x ${cmake_dir}/cmake
+ )
+ endif()
+
+ - name: Install system libs
shell: cmake -P {0}
run: |
if ("${{ runner.os }}" STREQUAL "Linux")
execute_process(
+ COMMAND sudo apt update
+ )
+ execute_process(
COMMAND sudo apt install libgl1-mesa-dev
+ RESULT_VARIABLE result
)
- elseif ("${{ runner.os }}" STREQUAL "Windows")
- # get JOM
- file(DOWNLOAD "https://download.qt.io/official_releases/jom/jom.zip" ./jom.zip SHOW_PROGRESS)
- file(MAKE_DIRECTORY ./jom)
- execute_process(COMMAND ${CMAKE_COMMAND} -E tar xvf ../jom.zip WORKING_DIRECTORY ./jom)
+ if (NOT result EQUAL 0)
+ message(FATAL_ERROR "Failed to install dependencies")
+ endif()
endif()
- name: Download Qt
id: qt
shell: cmake -P {0}
run: |
- set(qt_version $ENV{QT_VERSION})
+ set(qt_version "$ENV{QT_VERSION}")
string(REPLACE "." "" qt_version_dotless "${qt_version}")
if ("${{ runner.os }}" STREQUAL "Windows")
set(url_os "windows_x86")
- if ("${{ matrix.config.environment_script }}" MATCHES "vcvars64.bat")
- set(qt_package_name "qt.qt5.${qt_version_dotless}.win64_msvc2019_64")
- set(qt_dir_prefix "${qt_version}/msvc2019_64")
- elseif ("${{ matrix.config.environment_script }}" MATCHES "vcvars32.bat")
- set(qt_package_name "qt.qt5.${qt_version_dotless}.win32_msvc2019")
- set(qt_dir_prefix "${qt_version}/msvc2019")
- else()
- endif()
+ set(qt_package_arch_suffix "win64_msvc2019_64")
+ set(qt_dir_prefix "${qt_version}/msvc2019_64")
+ set(qt_package_suffix "-Windows-Windows_10-MSVC2019-Windows-Windows_10-X86_64")
elseif ("${{ runner.os }}" STREQUAL "Linux")
set(url_os "linux_x64")
- set(qt_package_name "qt.qt5.${qt_version_dotless}.gcc_64")
+ set(qt_package_arch_suffix "gcc_64")
set(qt_dir_prefix "${qt_version}/gcc_64")
+ set(qt_package_suffix "-Linux-RHEL_7_6-GCC-Linux-RHEL_7_6-X86_64")
elseif ("${{ runner.os }}" STREQUAL "macOS")
set(url_os "mac_x64")
- set(qt_package_name "qt.qt5.${qt_version_dotless}.clang_64")
+ set(qt_package_arch_suffix "clang_64")
set(qt_dir_prefix "${qt_version}/clang_64")
+ set(qt_package_suffix "-MacOS-MacOS_10_13-Clang-MacOS-MacOS_10_13-X86_64")
endif()
set(qt_base_url "https://download.qt.io/online/qtsdkrepository/${url_os}/desktop/qt5_${qt_version_dotless}")
file(DOWNLOAD "${qt_base_url}/Updates.xml" ./Updates.xml SHOW_PROGRESS)
file(READ ./Updates.xml updates_xml)
- string(REGEX MATCH "<Name>${qt_package_name}.*<Version>([0-9+-.]+)</Version>.*<DownloadableArchives>qtbase([a-zA-Z0-9_-]+).7z"
- updates_xml_output "${updates_xml}")
- set(package_version ${CMAKE_MATCH_1})
- set(package_suffix ${CMAKE_MATCH_2})
- string(REPLACE "-debug-symbols" "" package_suffix "${package_suffix}")
-
- # Workaround for CMake's greedy regex
- if ("${{ matrix.config.environment_script }}" MATCHES "vcvars32.bat")
- string(REPLACE "X86_64" "X86" package_suffix "${package_suffix}")
- endif()
+ string(REGEX MATCH "<Name>qt.qt5.*<Version>([0-9+-.]+)</Version>" updates_xml_output "${updates_xml}")
+ set(qt_package_version ${CMAKE_MATCH_1})
file(MAKE_DIRECTORY qt5)
@@ -100,20 +133,27 @@ jobs:
file(TO_CMAKE_PATH "$ENV{GITHUB_WORKSPACE}/qt5/${qt_dir_prefix}" qt_dir)
message("::set-output name=qt_dir::${qt_dir}")
- foreach(package qtbase qtdeclarative qttools qtsvg)
- file(DOWNLOAD
- "${qt_base_url}/${qt_package_name}/${package_version}${package}${package_suffix}.7z" ./${package}.7z
- SHOW_PROGRESS
+ message("Downloading Qt to ${qt_dir}")
+ function(downloadAndExtract url archive)
+ message("Downloading ${url}")
+ file(DOWNLOAD "${url}" ./${archive} SHOW_PROGRESS)
+ execute_process(COMMAND ${CMAKE_COMMAND} -E tar xvf ../${archive} WORKING_DIRECTORY qt5)
+ endfunction()
+
+ foreach(package qtbase qtdeclarative)
+ downloadAndExtract(
+ "${qt_base_url}/qt.qt5.${qt_version_dotless}.${qt_package_arch_suffix}/${qt_package_version}${package}${qt_package_suffix}.7z"
+ ${package}.7z
)
- execute_process(COMMAND ${CMAKE_COMMAND} -E tar xvf ../${package}.7z WORKING_DIRECTORY qt5)
endforeach()
- file(READ "qt5/${qt_dir_prefix}/mkspecs/qconfig.pri" qtconfig)
- string(REPLACE "Enterprise" "OpenSource" qtconfig "${qtconfig}")
- string(REPLACE "licheck.exe" "" qtconfig "${qtconfig}")
- string(REPLACE "licheck64" "" qtconfig "${qtconfig}")
- string(REPLACE "licheck_mac" "" qtconfig "${qtconfig}")
- file(WRITE "qt5/${qt_dir_prefix}/mkspecs/qconfig.pri" "${qtconfig}")
+ # uic depends on libicu56.so
+ if ("${{ runner.os }}" STREQUAL "Linux")
+ downloadAndExtract(
+ "${qt_base_url}/qt.qt5.${qt_version_dotless}.${qt_package_arch_suffix}/${qt_package_version}icu-linux-Rhel7.2-x64.7z"
+ icu.7z
+ )
+ endif()
- name: Download Qt Creator
id: qt_creator
@@ -128,29 +168,21 @@ jobs:
endif()
if ("${{ runner.os }}" STREQUAL "Windows")
- set(qtc_output_directory "qtcreator/lib/qtcreator/plugins")
- set(qtc_binary_name "$ENV{PLUGIN_NAME}4.dll")
- if ("${{ matrix.config.environment_script }}" MATCHES "vcvars64.bat")
- set(qtc_platform "windows_x64")
- elseif ("${{ matrix.config.environment_script }}" MATCHES "vcvars32.bat")
- set(qtc_platform "windows_x86")
- endif()
+ set(qtc_platform "windows_x64")
elseif ("${{ runner.os }}" STREQUAL "Linux")
- set(qtc_output_directory "qtcreator/lib/qtcreator/plugins")
- set(qtc_binary_name "lib$ENV{PLUGIN_NAME}.so")
set(qtc_platform "linux_x64")
elseif ("${{ runner.os }}" STREQUAL "macOS")
- set(qtc_output_directory "qtcreator/bin/Qt Creator.app/Contents/PlugIns")
- set(qtc_binary_name "lib$ENV{PLUGIN_NAME}.dylib")
set(qtc_platform "mac_x64")
endif()
+ file(TO_CMAKE_PATH "$ENV{GITHUB_WORKSPACE}/qtcreator" qtc_dir)
# Save the path for other steps
- message("::set-output name=qtc_binary_name::${qtc_binary_name}")
- message("::set-output name=qtc_output_directory::${qtc_output_directory}")
+ message("::set-output name=qtc_dir::${qtc_dir}")
file(MAKE_DIRECTORY qtcreator)
+ message("Downloading Qt Creator from ${qtc_base_url}/${qtc_platform}")
+
foreach(package qtcreator qtcreator_dev)
file(DOWNLOAD
"${qtc_base_url}/${qtc_platform}/${package}.7z" ./${package}.7z SHOW_PROGRESS)
@@ -158,18 +190,13 @@ jobs:
${CMAKE_COMMAND} -E tar xvf ../${package}.7z WORKING_DIRECTORY qtcreator)
endforeach()
- if ("${{ runner.os }}" STREQUAL "macOS")
- execute_process(
- COMMAND ${CMAKE_COMMAND} -E make_directory qtcreator/bin
- COMMAND ${CMAKE_COMMAND} -E create_symlink
- "$ENV{GITHUB_WORKSPACE}/qtcreator/Qt Creator.app"
- "$ENV{GITHUB_WORKSPACE}/qtcreator/bin/Qt Creator.app"
- )
- endif()
-
- name: Build
shell: cmake -P {0}
run: |
+ set(ENV{CC} ${{ matrix.config.cc }})
+ set(ENV{CXX} ${{ matrix.config.cxx }})
+ set(ENV{MACOSX_DEPLOYMENT_TARGET} "10.13")
+
if ("${{ runner.os }}" STREQUAL "Windows" AND NOT "x${{ matrix.config.environment_script }}" STREQUAL "x")
execute_process(
COMMAND "${{ matrix.config.environment_script }}" && set
@@ -183,55 +210,32 @@ jobs:
endforeach()
endif()
- file(TO_CMAKE_PATH "$ENV{GITHUB_WORKSPACE}/qtcreator" qtcreator_dir)
-
- execute_process(
- COMMAND ${{ steps.qt.outputs.qt_dir }}/bin/qmake
- $ENV{PLUGIN_PRO}
- CONFIG+=release
- IDE_SOURCE_TREE="${qtcreator_dir}"
- IDE_BUILD_TREE="${qtcreator_dir}"
- RESULT_VARIABLE result
- )
- if (NOT result EQUAL 0)
- message(FATAL_ERROR "Bad exit status")
- endif()
-
- if ("${{ runner.os }}" STREQUAL "Windows")
- set(ENV{PATH} "${{ steps.qt.outputs.qt_dir }}/bin/;$ENV{PATH}")
- else()
- set(ENV{PATH} "${{ steps.qt.outputs.qt_dir }}/bin/:$ENV{PATH}")
- set(ENV{LD_LIBRARY_PATH} "qtcreator/lib/Qt/lib:$ENV{LD_LIBRARY_PATH}")
- endif()
-
- include(ProcessorCount)
- ProcessorCount(N)
-
- set(make_program make -j ${N})
- if ("${{ runner.os }}" STREQUAL "Windows")
- set(make_program "jom/jom")
- endif()
+ set(ENV{NINJA_STATUS} "[%f/%t %o/sec] ")
execute_process(
- COMMAND ${make_program}
+ COMMAND python
+ -u
+ ${{ steps.qt_creator.outputs.qtc_dir }}/scripts/build_plugin.py
+ --name "$ENV{PLUGIN_NAME}-$ENV{QT_CREATOR_VERSION}-${{ matrix.config.artifact }}"
+ --src .
+ --build build
+ --qt-path "${{ steps.qt.outputs.qt_dir }}"
+ --qtc-path "${{ steps.qt_creator.outputs.qtc_dir }}"
+ --output-path "$ENV{GITHUB_WORKSPACE}"
RESULT_VARIABLE result
)
if (NOT result EQUAL 0)
- message(FATAL_ERROR "Bad exit status")
+ string(REGEX MATCH "FAILED:.*$" error_message "${output}")
+ string(REPLACE "\\n" "%0A" error_message "${error_message}")
+ message("::error::${error_message}")
+ message(FATAL_ERROR "Build failed")
endif()
- file(TO_CMAKE_PATH "$ENV{GITHUB_WORKSPACE}/$ENV{PLUGIN_NAME}-$ENV{QT_CREATOR_VERSION}-${{ matrix.config.artifact }}" artifact)
-
- execute_process(COMMAND
- ${CMAKE_COMMAND} -E tar cvf ${artifact} --format=zip "${{ steps.qt_creator.outputs.qtc_binary_name }}"
- WORKING_DIRECTORY "${{ steps.qt_creator.outputs.qtc_output_directory }}"
- )
-
- - uses: actions/upload-artifact@v1
+ - uses: actions/upload-artifact@v2
id: upload_artifact
with:
- path: ./${{ env.PLUGIN_NAME }}-${{ env.QT_CREATOR_VERSION }}-${{ matrix.config.artifact }}
- name: ${{ env.PLUGIN_NAME}}-${{ env.QT_CREATOR_VERSION }}-${{ matrix.config.artifact }}
+ path: ./${{ env.PLUGIN_NAME }}-${{ env.QT_CREATOR_VERSION }}-${{ matrix.config.artifact }}.7z
+ name: ${{ env.PLUGIN_NAME}}-${{ env.QT_CREATOR_VERSION }}-${{ matrix.config.artifact }}.7z
release:
if: contains(github.ref, 'tags/v')
@@ -268,19 +272,15 @@ jobs:
matrix:
config:
- {
- name: "Windows Latest x64", artifact: "Windows-x64.zip",
- os: ubuntu-latest
- }
- - {
- name: "Windows Latest x86", artifact: "Windows-x86.zip",
+ name: "Windows Latest x64", artifact: "Windows-x64.7z",
os: ubuntu-latest
}
- {
- name: "Linux Latest x64", artifact: "Linux-x64.zip",
+ name: "Linux Latest x64", artifact: "Linux-x64.7z",
os: ubuntu-latest
}
- {
- name: "macOS Latest x64", artifact: "macOS-x64.zip",
+ name: "macOS Latest x64", artifact: "macOS-x64.7z",
os: macos-latest
}
needs: release
@@ -311,4 +311,4 @@ jobs:
upload_url: ${{ steps.set_upload_url.outputs.upload_url }}
asset_path: ./${{ env.PLUGIN_NAME }}-${{ env.QT_CREATOR_VERSION }}-${{ matrix.config.artifact }}
asset_name: ${{ env.PLUGIN_NAME }}-${{ env.QT_CREATOR_VERSION }}-${{ matrix.config.artifact }}
- asset_content_type: application/zip
+ asset_content_type: application/x-7z-compressed
diff --git a/share/qtcreator/templates/wizards/qtcreatorplugin/myplugin.pro b/share/qtcreator/templates/wizards/qtcreatorplugin/myplugin.pro
deleted file mode 100644
index 34eed0aeea..0000000000
--- a/share/qtcreator/templates/wizards/qtcreatorplugin/myplugin.pro
+++ /dev/null
@@ -1,53 +0,0 @@
-DEFINES += %{LibraryDefine}
-
-# %{PluginName} files
-
-SOURCES += \\
- %{SrcFileName}
-
-HEADERS += \\
- %{HdrFileName} \\
- %{GlobalHdrFileName} \\
- %{ConstantsHdrFileName}
-
-DISTFILES += \\
- .github/workflows/build_qmake.yml \\
- .github/workflows/README.md
-
-# Qt Creator linking
-
-## Either set the IDE_SOURCE_TREE when running qmake,
-## or set the QTC_SOURCE environment variable, to override the default setting
-isEmpty(IDE_SOURCE_TREE): IDE_SOURCE_TREE = $$(QTC_SOURCE)
-isEmpty(IDE_SOURCE_TREE): IDE_SOURCE_TREE = "%{QtCreatorSources}"
-
-## Either set the IDE_BUILD_TREE when running qmake,
-## or set the QTC_BUILD environment variable, to override the default setting
-isEmpty(IDE_BUILD_TREE): IDE_BUILD_TREE = $$(QTC_BUILD)
-isEmpty(IDE_BUILD_TREE): IDE_BUILD_TREE = "%{QtCreatorBuild}"
-
-## uncomment to build plugin into user config directory
-## <localappdata>/plugins/<ideversion>
-## where <localappdata> is e.g.
-## "%LOCALAPPDATA%\QtProject\qtcreator" on Windows Vista and later
-## "$XDG_DATA_HOME/data/QtProject/qtcreator" or "~/.local/share/data/QtProject/qtcreator" on Linux
-## "~/Library/Application Support/QtProject/Qt Creator" on OS X
-%{DestDir}USE_USER_DESTDIR = yes
-
-###### If the plugin can be depended upon by other plugins, this code needs to be outsourced to
-###### <dirname>_dependencies.pri, where <dirname> is the name of the directory containing the
-###### plugin's sources.
-
-QTC_PLUGIN_NAME = %{PluginName}
-QTC_LIB_DEPENDS += \\
- # nothing here at this time
-
-QTC_PLUGIN_DEPENDS += \\
- coreplugin
-
-QTC_PLUGIN_RECOMMENDS += \\
- # optional plugin dependencies. nothing here at this time
-
-###### End _dependencies.pri contents ######
-
-include($$IDE_SOURCE_TREE/src/qtcreatorplugin.pri)
diff --git a/share/qtcreator/templates/wizards/qtcreatorplugin/wizard.json b/share/qtcreator/templates/wizards/qtcreatorplugin/wizard.json
index 443fa25c25..6a629f0d05 100644
--- a/share/qtcreator/templates/wizards/qtcreatorplugin/wizard.json
+++ b/share/qtcreator/templates/wizards/qtcreatorplugin/wizard.json
@@ -8,13 +8,12 @@
"trDisplayCategory": "Library",
"icon": "qtcreatorplugin.png",
"featuresRequired": [ "QtSupport.Wizards.FeatureQt", "QtSupport.Wizards.FeatureDesktop" ],
- "enabled": "%{JS: value('Plugins').indexOf('QmakeProjectManager') >= 0}",
+ "enabled": "%{JS: value('Plugins').indexOf('CMakeProjectManager') >= 0}",
"options":
[
- { "key": "ProjectFile", "value": "%{ProFile}" },
+ { "key": "ProjectFile", "value": "%{ProjectDirectory}/CMakeLists.txt" },
{ "key": "PluginNameLower", "value": "%{JS: value('PluginName').toLowerCase()}"},
- { "key": "ProFile", "value": "%{JS: Util.fileName(value('PluginNameLower'), 'pro')}" },
{ "key": "PluginJsonFile", "value": "%{JS: Util.fileName(value('PluginName'), 'json.in')}" },
{ "key": "LibraryDefine", "value": "%{JS: Cpp.headerGuard(value('PluginName')) + '_LIBRARY'}" },
{ "key": "LibraryExport", "value": "%{JS: Cpp.headerGuard(value('PluginName')) + '_EXPORT'}" },
@@ -116,17 +115,6 @@
}
},
{
- "name": "QtCreatorSources",
- "persistenceKey": "QtCreatorSources",
- "trDisplayName": "Qt Creator sources:",
- "mandatory": true,
- "type": "PathChooser",
- "data":
- {
- "kind": "existingDirectory"
- }
- },
- {
"name": "QtCreatorBuild",
"persistenceKey": "QtCreatorBuild",
"trDisplayName": "Qt Creator build:",
@@ -136,27 +124,6 @@
{
"kind": "existingDirectory"
}
- },
- {
- "name": "DestDir",
- "persistenceKey": "QtCreatorPluginDestDir",
- "trDisplayName": "Deploy into:",
- "type": "ComboBox",
- "data":
- {
- "index": 0,
- "items":
- [
- {
- "trKey": "Qt Creator Build",
- "value": "# "
- },
- {
- "trKey": "Local User Settings",
- "value": ""
- }
- ]
- }
}
]
},
@@ -185,13 +152,16 @@
"data":
[
{
- "source": "myplugin.pro",
- "target": "%{ProFile}",
+ "source": "CMakeLists.txt",
"openAsProject": true
},
{
- "source": "github_workflows_build_qmake.yml",
- "target": ".github/workflows/build_qmake.yml"
+ "source": "README.md",
+ "openInEditor": true
+ },
+ {
+ "source": "github_workflows_build_cmake.yml",
+ "target": ".github/workflows/build_cmake.yml"
},
{
"source": "github_workflows_README.md",
@@ -199,8 +169,7 @@
},
{
"source": "myplugin.cpp",
- "target": "%{SrcFileName}",
- "openInEditor": true
+ "target": "%{SrcFileName}"
},
{
"source": "myplugin.h",
diff --git a/share/qtcreator/translations/README b/share/qtcreator/translations/README
deleted file mode 100644
index 2c38a2d07e..0000000000
--- a/share/qtcreator/translations/README
+++ /dev/null
@@ -1,48 +0,0 @@
-How To add translations to Qt Creator
-=====================================
-
-- Coordinate over the mailing list to avoid duplicate work.
-
-- Read the instructions at http://wiki.qt.io/Qt_Localization
-
-- Add your language to the LANGUAGES line in translations.pro.
- Don't qualify it with a country unless it is reasonable to expect
- country-specific variants.
- Skip this step if updating an existing translation, obviously.
-
-- Run "make ts-<lang>".
-
- If your Qt version is too old, you may create a template by running
- lconvert --drop-translations qtcreator_de.ts -o qtcreator_<yours>.ts
- and adjusting the language attribute in the new .ts file. The downside
- of this method is obviously that you will not be translating the newest
- Creator sources (unless qtcreator_de.ts was completely up-to-date).
- Of course, this method is not applicable if you are updating an existing
- translation.
-
- You may also request an up-to-date template from us.
-
-- Fire up linguist and do the translation.
-
-- Create a commit:
- - Discard the modifications to any .ts files except yours
- - Run "make commit-ts" to create a commit with a cleaned .ts file
- - If needed, amend the commit with the modified .pro file
-
-- Follow http://wiki.qt.io/Qt_Contribution_Guidelines to post the
- change for review.
-
-- .qm files are generated as part of the regular build.
-
-Note: QmlDesigner contains code from the Gradient Editor of Qt Designer.
-If an official translation of Qt for your language exists, you can
-re-use the translation of those messages by merging Qt Creator's and
-Qt Designer's translation using lconvert:
-
-lconvert qtcreator_<LANG>.ts $QTDIR/translations/designer_<LANG>.ts > temp.ts
-
-Move the temporary file back to qtcreator_<LANG>.ts, complete the
-Gradient Editor's translations and update the file, passing the
-additional option -noobsolete to lupdate (by temporarily modifying
-translations.pro). This will remove the now redundant messages originating
-from Qt Designer.
diff --git a/share/qtcreator/translations/README.md b/share/qtcreator/translations/README.md
new file mode 100644
index 0000000000..4b16088d30
--- /dev/null
+++ b/share/qtcreator/translations/README.md
@@ -0,0 +1,48 @@
+How To add translations to Qt Creator
+=====================================
+
+- Coordinate over the mailing list to avoid duplicate work.
+
+- Read the instructions at http://wiki.qt.io/Qt_Localization
+
+- Add your language to the `set(languages ...` line in `CMakeLists.txt`. Don't
+ qualify it with a country unless it is reasonable to expect country-specific
+ variants. Skip this step if updating an existing translation.
+
+- Configure a Qt Creator build directory with CMake.
+
+- Run `cmake --build . --target ts_<lang>`.
+
+ If your Qt version is too old, you may create a template by running `lconvert
+ --drop-translations qtcreator_de.ts -o qtcreator_<yours>.ts` and adjusting the
+ language attribute in the new .ts file. The downside of this method is
+ that you will not be translating the newest Creator sources (unless
+ qtcreator_de.ts was completely up-to-date). Of course, this method is not
+ applicable if you are updating an existing translation.
+
+ You may also request an up-to-date template from us.
+
+- Start Qt Linguist and translate the strings.
+
+- Create a commit:
+ - Discard the modifications to any `.ts` files except yours
+ - Create a commit with your file
+ - If needed, amend the commit with the modified `CMakeLists.txt` file
+
+- Follow http://wiki.qt.io/Qt_Contribution_Guidelines to post the change for
+ review.
+
+- .qm files are generated as part of the regular build.
+
+_Note:_ QmlDesigner contains code from the Gradient Editor of Qt Designer. If an
+official translation of Qt for your language exists, you can re-use the
+translation of those messages by merging Qt Creator's and Qt Designer's
+translation using `lconvert`:
+
+ lconvert qtcreator_<LANG>.ts $QTDIR/translations/designer_<LANG>.ts > temp.ts
+
+Move the temporary file back to `qtcreator_<LANG>.ts`, complete the Gradient
+Editor's translations and update the file, passing the additional option
+`-noobsolete` to `lupdate` (by temporarily modifying
+`<qtcreator>/cmake/QtCreatorTranslations.cmake`). This will remove the now
+redundant messages originating from Qt Designer.
diff --git a/share/qtcreator/translations/qtcreator_ru.ts b/share/qtcreator/translations/qtcreator_ru.ts
index 50a2531f9f..343f1c468e 100644
--- a/share/qtcreator/translations/qtcreator_ru.ts
+++ b/share/qtcreator/translations/qtcreator_ru.ts
@@ -2555,13 +2555,6 @@ To hide a sticky splash screen, invoke QtAndroid::hideSplashScreen().</source>
</message>
</context>
<context>
- <name>AnnotationToolAction</name>
- <message>
- <source>Edit Annotation</source>
- <translation>Изменить аннотацию</translation>
- </message>
-</context>
-<context>
<name>Application</name>
<message>
<source>Failed to load core: %1</source>
@@ -39441,13 +39434,6 @@ Neither the path to the library nor the path to its includes is added to the .pr
</message>
</context>
<context>
- <name>QmlDesigner::AnnotationTool</name>
- <message>
- <source>Annotation Tool</source>
- <translation>Аннотация</translation>
- </message>
-</context>
-<context>
<name>QmlDesigner::AssetExportDialog</name>
<message>
<source>Choose Export Path</source>
diff --git a/share/share.qbs b/share/share.qbs
index 17a680b202..9a1db42cff 100644
--- a/share/share.qbs
+++ b/share/share.qbs
@@ -32,6 +32,7 @@ Product {
excludeFiles: [
"qml-type-descriptions/qbs-bundle.json",
"qml-type-descriptions/qbs.qmltypes",
+ "debugger/**/__pycache__/*",
]
}