From 93d2e3352c3969a77465ed08b337860474819b13 Mon Sep 17 00:00:00 2001 From: hjk Date: Tue, 9 Apr 2019 15:26:47 +0200 Subject: [PATCH 01/33] Debugger: Improve QObject dumper Don't use two lookups for parent types and act on known null pointers. While the machinery is robust enough to handle the result it's a needless deviation in regular code path. Change-Id: I6e50629cf554870a3ffb9f488f654e6ae557e5b3 Reviewed-by: Christian Stenger --- share/qtcreator/debugger/dumper.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/share/qtcreator/debugger/dumper.py b/share/qtcreator/debugger/dumper.py index 2c66f39a5d1..586df832c07 100644 --- a/share/qtcreator/debugger/dumper.py +++ b/share/qtcreator/debugger/dumper.py @@ -1895,10 +1895,14 @@ class DumperBase: if qobjectPtr: qobjectType = self.createType('QObject') - qobjectPtrType = self.createType('QObject') # FIXME. with SubItem(self, '[parent]'): self.putField('sortgroup', 9) - self.putItem(self.createValue(parentPtr, qobjectPtrType)) + if parentPtr: + self.putItem(self.createValue(parentPtr, qobjectType)) + else: + self.putValue('0x0') + self.putType('QObject *') + self.putNumChild(0) with SubItem(self, '[children]'): self.putField('sortgroup', 8) base = self.extractPointer(dd + 3 * ptrSize) # It's a QList From 29668d633e7f2ac18782d19ea419881e27deae24 Mon Sep 17 00:00:00 2001 From: Robert Loehning Date: Thu, 13 Jun 2019 17:30:11 +0200 Subject: [PATCH 02/33] Squish: Update tst_HELP02 Change-Id: Ia45e06bbf6df2e8b80f42824bc1b8bff34843538 Reviewed-by: Christian Stenger --- tests/system/suite_HELP/tst_HELP02/test.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/system/suite_HELP/tst_HELP02/test.py b/tests/system/suite_HELP/tst_HELP02/test.py index 988657cd3b6..a1755679d7f 100755 --- a/tests/system/suite_HELP/tst_HELP02/test.py +++ b/tests/system/suite_HELP/tst_HELP02/test.py @@ -38,7 +38,7 @@ def getQtCreatorVersionFromDialog(): return "" def getQtCreatorVersionFromFile(): - qtCreatorPriFileName = "../../../../qtcreator.pri" + qtCreatorPriFileName = "../../../../qtcreator_ide_branding.pri" # open file and read version fileText = readFile(qtCreatorPriFileName) chk = re.search("(?<=QTCREATOR_DISPLAY_VERSION =)\s\d+.\d+.\d+\S*", fileText) From 4d073fb67d47567ad8934b60ab16fc29fc96bcac Mon Sep 17 00:00:00 2001 From: Leena Miettinen Date: Tue, 18 Jun 2019 09:57:33 +0200 Subject: [PATCH 03/33] Doc: Describe adding the import path Also add the import path to the example main.cpp file. Task-number: QDS-805 Change-Id: I990e5dc364d610a4cef5697b3355147f9e5fcde1 Reviewed-by: Thomas Hartmann --- doc/examples/progressbar/main.cpp | 1 + doc/src/qtquick/qtquick-from-qmlproject-to-pro.qdoc | 5 +++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/doc/examples/progressbar/main.cpp b/doc/examples/progressbar/main.cpp index f8f4c584aa5..d8275e35c29 100644 --- a/doc/examples/progressbar/main.cpp +++ b/doc/examples/progressbar/main.cpp @@ -9,6 +9,7 @@ int main(int argc, char *argv[]) QGuiApplication app(argc, argv); QQuickView view; + view.engine->addImportPath("qrc:/qml/imports"); view.setSource(QUrl("qrc:/qml/ProgressBar.ui.qml")); if (!view.errors().isEmpty()) return -1; diff --git a/doc/src/qtquick/qtquick-from-qmlproject-to-pro.qdoc b/doc/src/qtquick/qtquick-from-qmlproject-to-pro.qdoc index 174b6c3c934..9e1fe9919ed 100644 --- a/doc/src/qtquick/qtquick-from-qmlproject-to-pro.qdoc +++ b/doc/src/qtquick/qtquick-from-qmlproject-to-pro.qdoc @@ -99,8 +99,9 @@ \quotefromfile progressbar/main.cpp \skipto QQuickView view; \printuntil view.show() - Where \c {qml\main.qml} is the path to and the name of the main QML - file in the Qt Quick UI project. + Where \c {qrc:/qml/imports} is the import path and + \c {qrc:qml/ProgressBar.ui.qml} is the path to and the + name of the main QML file in the Qt Quick UI project. \li Select \uicontrol Build > \uicontrol Run to build and run your project. \endlist From b278d2a2fdf4c528cc290aebb7d9c5d3e5cd780a Mon Sep 17 00:00:00 2001 From: Christian Stenger Date: Tue, 18 Jun 2019 12:47:38 +0200 Subject: [PATCH 04/33] PE: Avoid possible nullptr access Change-Id: Ib96ce9763dd9710cc4365978241d5d1d3ac1c0db Reviewed-by: Christian Kandeler --- src/plugins/projectexplorer/targetsettingspanel.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/plugins/projectexplorer/targetsettingspanel.cpp b/src/plugins/projectexplorer/targetsettingspanel.cpp index 91dee3dd6d6..adaba34842a 100644 --- a/src/plugins/projectexplorer/targetsettingspanel.cpp +++ b/src/plugins/projectexplorer/targetsettingspanel.cpp @@ -161,6 +161,9 @@ TargetSetupPageWrapper::TargetSetupPageWrapper(Project *project) void TargetSetupPageWrapper::updateNoteText() { + if (!m_targetSetupPage) + return; + Kit *k = KitManager::defaultKit(); QString text; From 09b9aa98a8a1ddb2e058def737a3a3ec565f827d Mon Sep 17 00:00:00 2001 From: David Schulz Date: Mon, 17 Jun 2019 14:24:56 +0200 Subject: [PATCH 05/33] TextEditor: fix low contrast of hovered folding markers When using the 'windowsvista' style the folding markers are blue when hovered. This color is almost invisible on the default folding range background color. Use the tested folding markers of the fusion style, because it is already used when device pixel ratio != 1.0 Change-Id: I23659cce71a2eb101692597a1d256d43f6426920 Fixes: QTCREATORBUG-21702 Reviewed-by: Eike Ziller Reviewed-by: Christian Stenger --- src/plugins/texteditor/texteditor.cpp | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/src/plugins/texteditor/texteditor.cpp b/src/plugins/texteditor/texteditor.cpp index 197eb5ddcf1..2250b6fb5b2 100644 --- a/src/plugins/texteditor/texteditor.cpp +++ b/src/plugins/texteditor/texteditor.cpp @@ -106,6 +106,7 @@ #include #include #include +#include #include #include #include @@ -5363,7 +5364,19 @@ void TextEditorWidgetPrivate::drawFoldingMarker(QPainter *painter, const QPalett if (hovered) opt.palette.setBrush(QPalette::Window, pal.highlight()); - const char* const className = s->metaObject()->className(); + const char *className = s->metaObject()->className(); + + // Do not use the windows folding marker since we cannot style them and the default hover color + // is a blue which does not guarantee an high contrast on all themes. + static QPointer fusionStyleOverwrite = nullptr; + if (!qstrcmp(className, "QWindowsVistaStyle")) { + if (fusionStyleOverwrite.isNull()) + fusionStyleOverwrite = QStyleFactory::create("fusion"); + if (!fusionStyleOverwrite.isNull()) { + s = fusionStyleOverwrite.data(); + className = s->metaObject()->className(); + } + } if (!qstrcmp(className, "OxygenStyle")) { const QStyle::PrimitiveElement direction = expanded ? QStyle::PE_IndicatorArrowDown From f841a9e4622388bbb3f5312ef64fe69f61ef3b9a Mon Sep 17 00:00:00 2001 From: Eike Ziller Date: Mon, 17 Jun 2019 09:42:12 +0200 Subject: [PATCH 06/33] Avoid overloading superclass method IOutputPane has an updateFilter method now, so rename the one in the TODO output pane. Change-Id: I0e6291372c83373b82d0d9911feffe032df8af5e Reviewed-by: Christian Kandeler --- src/plugins/todo/todooutputpane.cpp | 10 +++++----- src/plugins/todo/todooutputpane.h | 4 ++-- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/plugins/todo/todooutputpane.cpp b/src/plugins/todo/todooutputpane.cpp index 8abab12696d..9f8a528124a 100644 --- a/src/plugins/todo/todooutputpane.cpp +++ b/src/plugins/todo/todooutputpane.cpp @@ -91,7 +91,7 @@ int TodoOutputPane::priorityInStatusBar() const void TodoOutputPane::clearContents() { - clearFilter(); + clearKeywordFilter(); } void TodoOutputPane::visibilityChanged(bool visible) @@ -190,7 +190,7 @@ void TodoOutputPane::updateTodoCount() emit setBadgeNumber(m_todoTreeView->model()->rowCount()); } -void TodoOutputPane::updateFilter() +void TodoOutputPane::updateKeywordFilter() { QStringList keywords; for (const QToolButton *btn: qAsConst(m_filterButtons)) { @@ -208,12 +208,12 @@ void TodoOutputPane::updateFilter() updateTodoCount(); } -void TodoOutputPane::clearFilter() +void TodoOutputPane::clearKeywordFilter() { for (QToolButton *btn: qAsConst(m_filterButtons)) btn->setChecked(false); - updateFilter(); + updateKeywordFilter(); } void TodoOutputPane::createTreeView() @@ -282,7 +282,7 @@ void TodoOutputPane::createScopeButtons() QToolButton *button = createCheckableToolButton(keyword.name, tooltip.arg(keyword.name), toolBarIcon(keyword.iconType)); button->setProperty(Constants::FILTER_KEYWORD_NAME, keyword.name); button->setToolButtonStyle(Qt::ToolButtonIconOnly); - connect(button, &QToolButton::clicked, this, &TodoOutputPane::updateFilter); + connect(button, &QToolButton::clicked, this, &TodoOutputPane::updateKeywordFilter); m_filterButtons.append(button); } diff --git a/src/plugins/todo/todooutputpane.h b/src/plugins/todo/todooutputpane.h index 0c99d0a04af..78b0aff45d4 100644 --- a/src/plugins/todo/todooutputpane.h +++ b/src/plugins/todo/todooutputpane.h @@ -80,8 +80,8 @@ private: void scopeButtonClicked(QAbstractButton *button); void todoTreeViewClicked(const QModelIndex &index); void updateTodoCount(); - void updateFilter(); - void clearFilter(); + void updateKeywordFilter(); + void clearKeywordFilter(); void createTreeView(); void freeTreeView(); From 4fd7cff51eb14b276ed80b1416619f9f1886a644 Mon Sep 17 00:00:00 2001 From: Eike Ziller Date: Mon, 17 Jun 2019 15:16:09 +0200 Subject: [PATCH 07/33] Change log 4.10 Change-Id: Iae913e670946bb7db0553a6cdb4929b2ca64cf13 Reviewed-by: Leena Miettinen --- dist/changes-4.10.0.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dist/changes-4.10.0.md b/dist/changes-4.10.0.md index 9a03649d44f..baece64d4f4 100644 --- a/dist/changes-4.10.0.md +++ b/dist/changes-4.10.0.md @@ -22,7 +22,7 @@ you can check out from the public Git repository. For example: * Added support for `workspace/workspaceFolders` server request * Added Locator filter for current document (`.`) * Added Locator filters for symbols in workspace (`:`, `c`, and `m`) (QTCREATORBUG-21915) -* Added hover information +* Added support for showing tooltip information from server * Made client settings expand variables for executable and arguments * Improved completion item tooltip (QTCREATORBUG-22429) From 26ca8f08490106c6ad322330f603fccfb7898fc3 Mon Sep 17 00:00:00 2001 From: Christian Kandeler Date: Tue, 18 Jun 2019 13:40:18 +0200 Subject: [PATCH 08/33] Utils: Fix default argument of ConsoleProcess::Start The default meta character mode needs to be "Abort" to retain previous behavior. Amends acfe45c4348. Change-Id: I1e0c752eddccb0d4821203573241308e56dfb2d3 Reviewed-by: Eike Ziller --- src/libs/utils/consoleprocess.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libs/utils/consoleprocess.h b/src/libs/utils/consoleprocess.h index 82d0a5d8bb7..3dec9838c34 100644 --- a/src/libs/utils/consoleprocess.h +++ b/src/libs/utils/consoleprocess.h @@ -72,7 +72,7 @@ public: enum class MetaCharMode { Abort, Ignore }; bool start(const QString &program, const QString &args, - MetaCharMode metaCharMode = MetaCharMode::Ignore); + MetaCharMode metaCharMode = MetaCharMode::Abort); public slots: void stop(); From 9a2bc34776f54ab4b32a7618de4707a8a9b630ac Mon Sep 17 00:00:00 2001 From: Eike Ziller Date: Tue, 18 Jun 2019 14:57:47 +0200 Subject: [PATCH 09/33] Fix wrong default value for "Automatically manage signing" In iOS build configurations. When setting the default value after creating the "BoolAspect", also the value must be changed to that default. The original code only used the default value when restoring the aspect from settings. Task-number: QTCREATORBUG-22529 Change-Id: Icee0887e02d2b6d83273492a45f20c0263bb68cc Reviewed-by: Vikas Pachdha Reviewed-by: hjk --- src/plugins/projectexplorer/projectconfigurationaspects.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/plugins/projectexplorer/projectconfigurationaspects.cpp b/src/plugins/projectexplorer/projectconfigurationaspects.cpp index d9ad7c43346..a4cec91d287 100644 --- a/src/plugins/projectexplorer/projectconfigurationaspects.cpp +++ b/src/plugins/projectexplorer/projectconfigurationaspects.cpp @@ -372,6 +372,7 @@ bool BaseBoolAspect::defaultValue() const void BaseBoolAspect::setDefaultValue(bool defaultValue) { d->m_defaultValue = defaultValue; + d->m_value = defaultValue; } bool BaseBoolAspect::value() const From 85603cd84fd0dfab60f88cb3267d076cdf1404d8 Mon Sep 17 00:00:00 2001 From: Leena Miettinen Date: Tue, 18 Jun 2019 15:08:21 +0200 Subject: [PATCH 10/33] Doc: Adjust \previouspage command value ... because a topic was added to the Qt Design Studio Manual Change-Id: Ib974724ff38248ad90aab72a34ee0c4a80d5ed4f Reviewed-by: Thomas Hartmann --- doc/src/howto/creator-keyboard-shortcuts.qdoc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/src/howto/creator-keyboard-shortcuts.qdoc b/doc/src/howto/creator-keyboard-shortcuts.qdoc index bf47b2dabf3..0d2045b7f4d 100644 --- a/doc/src/howto/creator-keyboard-shortcuts.qdoc +++ b/doc/src/howto/creator-keyboard-shortcuts.qdoc @@ -33,7 +33,7 @@ \contentspage index.html \page creator-keyboard-shortcuts.html \if defined(qtdesignstudio) - \previouspage studio-advanced.html + \previouspage studio-platforms.html \nextpage creator-coding.html \else \previouspage creator-cli.html From bd74dc220f7f78988c1b8a3997cfc9b77dec6559 Mon Sep 17 00:00:00 2001 From: Nikolai Kosjar Date: Tue, 18 Jun 2019 16:20:25 +0200 Subject: [PATCH 11/33] README: Remove outdated bullet point about clang code model Change-Id: I0f7a94d276d9b32ba00ae43d574cc6f18fdd2d63 Reviewed-by: Cristian Adam Reviewed-by: Robert Loehning --- README.md | 2 -- 1 file changed, 2 deletions(-) diff --git a/README.md b/README.md index db773ed5ff8..b39870db5ad 100644 --- a/README.md +++ b/README.md @@ -155,8 +155,6 @@ For detailed information on the supported compilers, see * Before you launch Qt Creator you may prepend the PATH with the location of libclang.dll/.so that you want to be used. See more info in the section "Prebuilt LLVM/Clang packages". - * When you launch Qt Creator, activate the Clang Code Model plugin as - described in doc/src/editors/creator-only/creator-clang-codemodel.qdoc. 11. You are now ready to configure and build Qt and Qt Creator. Please see for From ad6dd3fa76add553381ce070a7c3d9c058d1b282 Mon Sep 17 00:00:00 2001 From: Eike Ziller Date: Tue, 18 Jun 2019 16:38:58 +0200 Subject: [PATCH 12/33] Fix restoring Android build steps from ealier Qt Creator versions Revert the IDs back to what they were. Amends 26463a22190a941a6b1ba2965dfe296747beb0d5 Fixes: QTCREATORBUG-22564 Change-Id: I220e362793d525ee8f01ff9649feb2cdfc37bba3 Reviewed-by: BogDan Vatra --- src/plugins/android/androidconstants.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/plugins/android/androidconstants.h b/src/plugins/android/androidconstants.h index affcd85d574..f34da07f4e8 100644 --- a/src/plugins/android/androidconstants.h +++ b/src/plugins/android/androidconstants.h @@ -74,8 +74,9 @@ const char ANDROID_PACKAGE_SOURCE_DIR[] = "AndroidPackageSourceDir"; const char ANDROID_EXTRA_LIBS[] = "AndroidExtraLibs"; const char ANDROID_PACKAGENAME[] = "Android.PackageName"; -const char ANDROID_PACKAGE_INSTALLATION_STEP_ID[] = "Android.PackageInstallationStep"; -const char ANDROID_BUILD_APK_ID[] = "Android.BuildApkStep"; +const char ANDROID_PACKAGE_INSTALLATION_STEP_ID[] + = "Qt4ProjectManager.AndroidPackageInstallationStep"; +const char ANDROID_BUILD_APK_ID[] = "QmakeProjectManager.AndroidBuildApkStep"; const char AndroidPackageSourceDir[] = "AndroidPackageSourceDir"; // QString const char AndroidDeploySettingsFile[] = "AndroidDeploySettingsFile"; // QString From 02fd678cfe663105327536cd395fb8e34b8df471 Mon Sep 17 00:00:00 2001 From: Leena Miettinen Date: Tue, 18 Jun 2019 16:46:28 +0200 Subject: [PATCH 13/33] Doc: Describe options for running qmake when building projects Task-number: QTCREATORBUG-20888 Change-Id: I7096730880505c63b1ff581c2e1b5626d3af68f2 Reviewed-by: Christian Kandeler --- .../creator-only/creator-projects-building.qdoc | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/doc/src/projects/creator-only/creator-projects-building.qdoc b/doc/src/projects/creator-only/creator-projects-building.qdoc index c5a9ae001ed..740096f0cf0 100644 --- a/doc/src/projects/creator-only/creator-projects-building.qdoc +++ b/doc/src/projects/creator-only/creator-projects-building.qdoc @@ -79,8 +79,9 @@ subproject. To remove all build artifacts, select \uicontrol Build > \uicontrol {Clean All} or - \uicontrol {Clean Project}. To clean the build directory and then build the - project, select \uicontrol Build > \uicontrol {Rebuild All} or \uicontrol {Rebuild Project}. + \uicontrol {Clean Project}. To clean the build directory, run qmake, and + then build the project, select \uicontrol Build > \uicontrol {Rebuild All} + or \uicontrol {Rebuild Project}. To build and clean projects without dependencies, select the \uicontrol {Build Without Dependencies}, @@ -88,6 +89,10 @@ \uicontrol {Clean Without Dependencies} options in the context menu in the \uicontrol Projects view. - To run qmake to generate new Makefiles, select \uicontrol Build > \uicontrol qmake. - + To run qmake to generate new Makefiles, select \uicontrol Build > + \uicontrol qmake. To prevent failures on incremental builds, it might make + sense to always run qmake before building, even though it means that + building will take more time. To enable this option, select \uicontrol Tools + > \uicontrol Options > \uicontrol {Build & Run} > \uicontrol qmake > + \uicontrol {Run qmake on every build}. */ From 75a2cae723d960b7ad43d2e350a77d2dbd2633d8 Mon Sep 17 00:00:00 2001 From: Leena Miettinen Date: Tue, 18 Jun 2019 16:00:57 +0200 Subject: [PATCH 14/33] Doc: Describe adding existing projects as subprojects Task-number: QTCREATORBUG-5837 Change-Id: Idf2de084b6e53e48fdc919d05b209b39ae0a8e8e Reviewed-by: Christian Kandeler --- .../projects/creator-only/creator-projects-creating.qdoc | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/doc/src/projects/creator-only/creator-projects-creating.qdoc b/doc/src/projects/creator-only/creator-projects-creating.qdoc index 43b2e39f700..37b3224cd6e 100644 --- a/doc/src/projects/creator-only/creator-projects-creating.qdoc +++ b/doc/src/projects/creator-only/creator-projects-creating.qdoc @@ -472,8 +472,10 @@ and the subproject that you add as a value of the \l{Variables#subdirs} {SUBDIRS variable}. It also adds all the necessary files for the subproject. - To add more subprojects, right-click the project name in the \uicontrol Projects - pane, and select \uicontrol {New Subproject} in the context menu. + To create more subprojects, right-click the project name in the + \uicontrol Projects pane, and select \uicontrol {New Subproject} in the + context menu. To add an existing project as a subproject, select + \uicontrol {Add Existing Projects}. To remove subprojects, right-click the project name in the \uicontrol Projects pane, and select \uicontrol {Remove Subproject} in the context menu. From 1dae4593cc38062f1649a6b1bbb8cfb8d4601c17 Mon Sep 17 00:00:00 2001 From: Thomas Hartmann Date: Fri, 14 Jun 2019 13:16:13 +0200 Subject: [PATCH 15/33] QmlDesigner: Use MenuItem instead of Action This avoids conflicts with shortcuts. Task-number: QDS-803 Change-Id: I9269729cf2cb4a6bba9493d768c595748af3392d Reviewed-by: Tim Jenssen --- .../imports/StudioControls/ContextMenu.qml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/StudioControls/ContextMenu.qml b/share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/StudioControls/ContextMenu.qml index 3365751ab61..c80d53ef3d3 100644 --- a/share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/StudioControls/ContextMenu.qml +++ b/share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/StudioControls/ContextMenu.qml @@ -47,32 +47,32 @@ Menu { MenuSeparator { } - Controls2.Action { + Controls2.MenuItem { text: "Copy" enabled: myTextEdit.selectedText !== "" onTriggered: myTextEdit.copy() /* shortcut: StandardKey.Copy Shortcuts in QQC2 seem to override global shortcuts */ } - Controls2.Action { + Controls2.MenuItem { text: "Cut" enabled: myTextEdit.selectedText !== "" && !myTextEdit.readOnly onTriggered: myTextEdit.cut() /* shortcut: StandardKey.Cut Shortcuts in QQC2 seem to override global shortcuts */ } - Controls2.Action { + Controls2.MenuItem { text: "Paste" enabled: myTextEdit.canPaste onTriggered: myTextEdit.paste() /* shortcut: StandardKey.Paste Shortcuts in QQC2 seem to override global shortcuts */ } - Controls2.Action { + Controls2.MenuItem { text: "Delete" enabled: myTextEdit.selectedText !== "" onTriggered: myTextEdit.remove(myTextEdit.selectionStart, myTextEdit.selectionEnd) /* shortcut: StandardKey.Delete Shortcuts in QQC2 seem to override global shortcuts */ } - Controls2.Action { + Controls2.MenuItem { text: "Clear" enabled: myTextEdit.text !== "" onTriggered: myTextEdit.clear() From 25e5dfe53ff588a449d8b74e6e5d918b565113c4 Mon Sep 17 00:00:00 2001 From: Thomas Hartmann Date: Fri, 14 Jun 2019 14:27:53 +0200 Subject: [PATCH 16/33] QmlDesigner: Do nothing if new and old index are the same Change-Id: If552fad81479a4cd404d2d2966905eb9da8d479d Reviewed-by: Tim Jenssen --- .../qmldesigner/components/navigator/navigatorview.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/plugins/qmldesigner/components/navigator/navigatorview.cpp b/src/plugins/qmldesigner/components/navigator/navigatorview.cpp index f43081f14b2..57578d866f3 100644 --- a/src/plugins/qmldesigner/components/navigator/navigatorview.cpp +++ b/src/plugins/qmldesigner/components/navigator/navigatorview.cpp @@ -394,7 +394,8 @@ void NavigatorView::upButtonClicked() index--; if (index < 0) index = node.parentProperty().count() - 1; //wrap around - node.parentProperty().toNodeListProperty().slide(oldIndex, index); + if (oldIndex != index) + node.parentProperty().toNodeListProperty().slide(oldIndex, index); } } updateItemSelection(); @@ -411,7 +412,8 @@ void NavigatorView::downButtonClicked() index++; if (index >= node.parentProperty().count()) index = 0; //wrap around - node.parentProperty().toNodeListProperty().slide(oldIndex, index); + if (oldIndex != index) + node.parentProperty().toNodeListProperty().slide(oldIndex, index); } } updateItemSelection(); From 9da6c2f43bafe9adcb26c1e4247b33230a956074 Mon Sep 17 00:00:00 2001 From: Thomas Hartmann Date: Wed, 19 Jun 2019 09:16:46 +0200 Subject: [PATCH 17/33] QmlDesigner: Add alias export to QtObject Change-Id: If1a78463d4f1625105ab1fad7e179e645be08c9e Reviewed-by: Thomas Hartmann --- .../QtQuick/QtObjectPane.qml | 21 +++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/share/qtcreator/qmldesigner/propertyEditorQmlSources/QtQuick/QtObjectPane.qml b/share/qtcreator/qmldesigner/propertyEditorQmlSources/QtQuick/QtObjectPane.qml index c7e978a53ff..67e0cff45a4 100644 --- a/share/qtcreator/qmldesigner/propertyEditorQmlSources/QtQuick/QtObjectPane.qml +++ b/share/qtcreator/qmldesigner/propertyEditorQmlSources/QtQuick/QtObjectPane.qml @@ -67,19 +67,28 @@ Rectangle { SecondColumnLayout { LineEdit { id: lineEdit - enabled: isBaseState + backendValue: backendValues.id placeholderText: qsTr("id") text: backendValues.id.value Layout.fillWidth: true + width: 240 showTranslateCheckBox: false showExtendedFunctionButton: false + enabled: !modelNodeBackend.multiSelection } - // workaround: without this item the lineedit does not shrink to the - // right size after resizing to a wider width - Item { - width: 0 - height: 1 + + Image { + visible: !modelNodeBackend.multiSelection + Layout.preferredWidth: 16 + Layout.preferredHeight: 16 + source: hasAliasExport ? "image://icons/alias-export-checked" : "image://icons/alias-export-unchecked" + ToolTipArea { + enabled: !modelNodeBackend.multiSelection + anchors.fill: parent + onClicked: toogleExportAlias() + tooltip: qsTr("Toggles whether this item is exported as an alias property of the root item.") + } } } } From 2101c2b992341633df0077f61262f503154a57fa Mon Sep 17 00:00:00 2001 From: hjk Date: Wed, 19 Jun 2019 09:46:56 +0200 Subject: [PATCH 18/33] QmlDesiger: Avoid a QTime deprecation warning Change-Id: I468ffc231eb7dd4d4957cab5009d35425304a04d Reviewed-by: Thomas Hartmann --- .../designercore/instances/nodeinstanceserverproxy.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/plugins/qmldesigner/designercore/instances/nodeinstanceserverproxy.h b/src/plugins/qmldesigner/designercore/instances/nodeinstanceserverproxy.h index d0309aacaae..60565261d27 100644 --- a/src/plugins/qmldesigner/designercore/instances/nodeinstanceserverproxy.h +++ b/src/plugins/qmldesigner/designercore/instances/nodeinstanceserverproxy.h @@ -29,8 +29,8 @@ #include #include +#include #include -#include #include QT_BEGIN_NAMESPACE @@ -127,7 +127,7 @@ private: quint32 m_thirdLastReadCommandCounter = 0; RunModus m_runModus; int m_synchronizeId = -1; - QTime m_benchmarkTimer; + QElapsedTimer m_benchmarkTimer; bool m_destructing = false; }; From c22e9cea13a681fe9cb4b2a377ab29bbb387776f Mon Sep 17 00:00:00 2001 From: Nikolai Kosjar Date: Wed, 19 Jun 2019 10:20:30 +0200 Subject: [PATCH 19/33] CppTools: Stop printing "Skipping file X" We already put it into "General Messages". Change-Id: I9756fbe5c5f641cd83ab39c8ef0fff83ad63a85d Reviewed-by: David Schulz --- src/plugins/cpptools/cpptoolsreuse.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/src/plugins/cpptools/cpptoolsreuse.cpp b/src/plugins/cpptools/cpptoolsreuse.cpp index da1c79b4c01..0d186f84216 100644 --- a/src/plugins/cpptools/cpptoolsreuse.cpp +++ b/src/plugins/cpptools/cpptoolsreuse.cpp @@ -327,7 +327,6 @@ bool fileSizeExceedsLimit(const QFileInfo &fileInfo, int sizeLimitInMb) Core::MessageManager::write(msg, Core::MessageManager::Silent); }); - qWarning().noquote() << msg; return true; } From a0852cf62ba5d3e79c91a5878cb2eaa5633ccbc4 Mon Sep 17 00:00:00 2001 From: Nikolai Kosjar Date: Tue, 18 Jun 2019 16:21:02 +0200 Subject: [PATCH 20/33] README: Update "Prebuilt LLVM/Clang packages" section Fixes: QTCREATORBUG-22563 Change-Id: I651d0308bd5ac7efcb22f30488e08b3f3ffa16a6 Reviewed-by: Orgad Shaneh Reviewed-by: Robert Loehning --- README.md | 24 ++++-------------------- 1 file changed, 4 insertions(+), 20 deletions(-) diff --git a/README.md b/README.md index b39870db5ad..8a6fcbf0883 100644 --- a/README.md +++ b/README.md @@ -235,9 +235,10 @@ Prebuilt packages of LLVM/Clang can be downloaded from https://download.qt.io/development_releases/prebuilt/libclang/ This should be your preferred option because you will use the version that is -shipped together with Qt Creator. In addition, MinGW packages for Windows are -faster due to profile-guided optimization. If the prebuilt packages do not -match your configuration, you need to build LLVM/Clang manually. +shipped together with Qt Creator (with backported/additional patches). In +addition, MinGW packages for Windows are faster due to profile-guided +optimization. If the prebuilt packages do not match your configuration, you +need to build LLVM/Clang manually. If you use the MSVC compiler to build Qt Creator the suggested way is: 1. Download both MSVC and MinGW packages of libclang. @@ -245,23 +246,6 @@ If you use the MSVC compiler to build Qt Creator the suggested way is: 3. Prepend PATH variable used for the run time with the location of MinGW version of libclang.dll. 4. Launch Qt Creator. -If you use GCC 5 or higher on Linux, please do not use our LLVM package, but get -the package for your distribution. Our LLVM package is compiled with GCC 4, so -you get linking errors, because GCC 5 is using a C++ 11 conforming string -implementation, which is not used by GCC 4. To sum it up, do not mix GCC 5 and -GCC 4 binaries. On Ubuntu, you can download the package from -http://apt.llvm.org/ with: - - wget -O - http://apt.llvm.org/llvm-snapshot.gpg.key | sudo apt-key add - - sudo apt-add-repository "deb http://apt.llvm.org/`lsb_release -cs`/ llvm-toolchain-`lsb_release -cs`-8.0 main" - sudo apt-get update - sudo apt-get install llvm-8.0 libclang-8.0-dev - -There is a workaround to set _GLIBCXX_USE_CXX11_ABI to 1 or 0, but we recommend -to download the package from http://apt.llvm.org/. - - https://gcc.gnu.org/onlinedocs/libstdc++/manual/using_dual_abi.html - ### Building LLVM/Clang manually You need to install CMake in order to build LLVM/Clang. From 376c6b9d59cef608448acc6cec30c32e3836c4dd Mon Sep 17 00:00:00 2001 From: Knud Dollereder Date: Tue, 18 Jun 2019 15:12:21 +0200 Subject: [PATCH 21/33] Add curve editor Moved qmldesignerextension into component Updated build systems Change-Id: I8d2d0757a1639a472d426b66c0c8ae6fb84cc3d2 Reviewed-by: Thomas Hartmann --- src/plugins/qmldesigner/CMakeLists.txt | 40 +- .../colortool/colortool.cpp | 0 .../colortool/colortool.h | 0 .../colortool/colortool.pri | 0 .../connectioneditor/addnewbackenddialog.cpp | 0 .../connectioneditor/addnewbackenddialog.h | 0 .../connectioneditor/addnewbackenddialog.ui | 0 .../connectioneditor/backendmodel.cpp | 0 .../connectioneditor/backendmodel.h | 0 .../connectioneditor/bindingmodel.cpp | 0 .../connectioneditor/bindingmodel.h | 0 .../connectioneditor/connectioneditor.pri | 0 .../connectioneditor/connectioneditor.qrc | 0 .../connectioneditor/connectionmodel.cpp | 0 .../connectioneditor/connectionmodel.h | 0 .../connectioneditor/connectionview.cpp | 0 .../connectioneditor/connectionview.h | 0 .../connectioneditor/connectionviewwidget.cpp | 0 .../connectioneditor/connectionviewwidget.h | 0 .../connectioneditor/connectionviewwidget.ui | 0 .../connectioneditor/delegates.cpp | 0 .../connectioneditor/delegates.h | 0 .../dynamicpropertiesmodel.cpp | 0 .../connectioneditor/dynamicpropertiesmodel.h | 0 .../connectioneditor/stylesheet.css | 0 .../components/curveeditor/animationcurve.cpp | 187 +++++++ .../components/curveeditor/animationcurve.h | 69 +++ .../components/curveeditor/curveeditor.cpp | 64 +++ .../curveeditor/curveeditor.h} | 34 +- .../components/curveeditor/curveeditor.pri | 46 ++ .../curveeditor/curveeditormodel.cpp | 70 +++ .../components/curveeditor/curveeditormodel.h | 70 +++ .../components/curveeditor/curveeditorstyle.h | 125 +++++ .../curveeditor/detail/colorcontrol.cpp | 101 ++++ .../curveeditor/detail/colorcontrol.h | 63 +++ .../detail/curveeditorstyledialog.cpp | 267 +++++++++ .../detail/curveeditorstyledialog.h | 125 +++++ .../curveeditor/detail/curveitem.cpp | 224 ++++++++ .../components/curveeditor/detail/curveitem.h | 98 ++++ .../curveeditor/detail/curvesegment.cpp | 277 ++++++++++ .../curveeditor/detail/curvesegment.h | 63 +++ .../curveeditor/detail/graphicsscene.cpp | 225 ++++++++ .../curveeditor/detail/graphicsscene.h | 89 +++ .../curveeditor/detail/graphicsview.cpp | 523 ++++++++++++++++++ .../curveeditor/detail/graphicsview.h | 157 ++++++ .../curveeditor/detail/handleitem.cpp | 104 ++++ .../curveeditor/detail/handleitem.h | 56 ++ .../curveeditor/detail/keyframeitem.cpp | 251 +++++++++ .../curveeditor/detail/keyframeitem.h | 98 ++++ .../curveeditor/detail/playhead.cpp | 187 +++++++ .../components/curveeditor/detail/playhead.h | 70 +++ .../curveeditor/detail/selectableitem.cpp | 112 ++++ .../curveeditor/detail/selectableitem.h | 85 +++ .../curveeditor/detail/selector.cpp | 219 ++++++++ .../components/curveeditor/detail/selector.h | 86 +++ .../curveeditor/detail/shortcut.cpp | 81 +++ .../components/curveeditor/detail/shortcut.h | 61 ++ .../curveeditor/detail/treeitemdelegate.cpp | 146 +++++ .../curveeditor/detail/treeitemdelegate.h | 63 +++ .../curveeditor/detail/treemodel.cpp | 156 ++++++ .../components/curveeditor/detail/treemodel.h | 75 +++ .../curveeditor/detail/treeview.cpp | 127 +++++ .../components/curveeditor/detail/treeview.h | 61 ++ .../components/curveeditor/detail/utils.cpp | 107 ++++ .../curveeditor/detail/utils.h} | 32 +- .../components/curveeditor/keyframe.cpp | 88 +++ .../components/curveeditor/keyframe.h | 65 +++ .../components/curveeditor/treeitem.cpp | 227 ++++++++ .../components/curveeditor/treeitem.h | 135 +++++ .../pathtool/controlpoint.cpp | 0 .../pathtool/controlpoint.h | 0 .../pathtool/cubicsegment.cpp | 0 .../pathtool/cubicsegment.h | 0 .../pathtool/pathitem.cpp | 0 .../pathtool/pathitem.h | 0 .../pathtool/pathselectionmanipulator.cpp | 0 .../pathtool/pathselectionmanipulator.h | 0 .../pathtool/pathtool.cpp | 0 .../pathtool/pathtool.h | 0 .../pathtool/pathtool.pri | 0 .../pathtool/pathtoolview.cpp | 0 .../pathtool/pathtoolview.h | 0 .../sourcetool/sourcetool.cpp | 0 .../sourcetool/sourcetool.h | 0 .../sourcetool/sourcetool.pri | 0 .../texttool/textedititem.cpp | 0 .../texttool/textedititem.h | 0 .../texttool/textedititemwidget.cpp | 0 .../texttool/textedititemwidget.h | 0 .../texttool/texttool.cpp | 0 .../texttool/texttool.h | 0 .../texttool/texttool.pri | 0 .../timelineeditor/canvas.cpp | 0 .../timelineeditor/canvas.h | 0 .../timelineeditor/canvasstyledialog.cpp | 0 .../timelineeditor/canvasstyledialog.h | 0 .../timelineeditor/easingcurve.cpp | 0 .../timelineeditor/easingcurve.h | 0 .../timelineeditor/easingcurvedialog.cpp | 0 .../timelineeditor/easingcurvedialog.h | 0 .../timelineeditor/images/add_timeline.png | Bin .../timelineeditor/images/add_timeline@2x.png | Bin .../timelineeditor/images/animation.png | Bin .../timelineeditor/images/animation@2x.png | Bin .../timelineeditor/images/back_one_frame.png | Bin .../images/back_one_frame@2x.png | Bin .../timelineeditor/images/curve_editor.png | Bin .../timelineeditor/images/curve_editor@2x.png | Bin .../timelineeditor/images/curve_picker.png | Bin .../timelineeditor/images/curve_picker@2x.png | Bin .../images/forward_one_frame.png | Bin .../images/forward_one_frame@2x.png | Bin .../images/global_record_keyframes.png | Bin .../images/global_record_keyframes@2x.png | Bin .../timelineeditor/images/is_keyframe.png | Bin .../timelineeditor/images/is_keyframe@2x.png | Bin .../timelineeditor/images/keyframe-16px.png | Bin .../timelineeditor/images/keyframe.png | Bin .../timelineeditor/images/keyframe@2x.png | Bin .../images/keyframe_autobezier_active.png | Bin .../images/keyframe_autobezier_active@2x.png | Bin .../images/keyframe_autobezier_inactive.png | Bin .../keyframe_autobezier_inactive@2x.png | Bin .../images/keyframe_autobezier_selected.png | Bin .../keyframe_autobezier_selected@2x.png | Bin .../images/keyframe_linear_active.png | Bin .../images/keyframe_linear_active@2x.png | Bin .../images/keyframe_linear_inactive.png | Bin .../images/keyframe_linear_inactive@2x.png | Bin .../images/keyframe_linear_selected.png | Bin .../images/keyframe_linear_selected@2x.png | Bin .../images/keyframe_lineartobezier_active.png | Bin .../keyframe_lineartobezier_active@2x.png | Bin .../keyframe_lineartobezier_inactive.png | Bin .../keyframe_lineartobezier_inactive@2x.png | Bin .../keyframe_lineartobezier_selected.png | Bin .../keyframe_lineartobezier_selected@2x.png | Bin .../images/keyframe_manualbezier_active.png | Bin .../keyframe_manualbezier_active@2x.png | Bin .../images/keyframe_manualbezier_inactive.png | Bin .../keyframe_manualbezier_inactive@2x.png | Bin .../images/keyframe_manualbezier_selected.png | Bin .../keyframe_manualbezier_selected@2x.png | Bin .../images/local_record_keyframes.png | Bin .../images/local_record_keyframes@2x.png | Bin .../timelineeditor/images/loop_playback.png | Bin .../images/loop_playback@2x.png | Bin .../timelineeditor/images/next_keyframe.png | Bin .../images/next_keyframe@2x.png | Bin .../timelineeditor/images/pause_playback.png | Bin .../images/pause_playback@2x.png | Bin .../timelineeditor/images/playhead.png | Bin .../timelineeditor/images/playhead@2x.png | Bin .../images/previous_keyframe.png | Bin .../images/previous_keyframe@2x.png | Bin .../timelineeditor/images/remove_timeline.png | Bin .../images/remove_timeline@2x.png | Bin .../timelineeditor/images/start_playback.png | Bin .../images/start_playback@2x.png | Bin .../timelineeditor/images/timeline-16px.png | Bin .../timelineeditor/images/to_first_frame.png | Bin .../images/to_first_frame@2x.png | Bin .../timelineeditor/images/to_last_frame.png | Bin .../images/to_last_frame@2x.png | Bin .../images/work_area_handle_left.png | Bin .../images/work_area_handle_left@2x.png | Bin .../images/work_area_handle_right.png | Bin .../images/work_area_handle_right@2x.png | Bin .../timelineeditor/images/zoom_big.png | Bin .../timelineeditor/images/zoom_big@2x.png | Bin .../timelineeditor/images/zoom_small.png | Bin .../timelineeditor/images/zoom_small@2x.png | Bin .../timelineeditor/preseteditor.cpp | 0 .../timelineeditor/preseteditor.h | 0 .../timelineeditor/setframevaluedialog.cpp | 0 .../timelineeditor/setframevaluedialog.h | 0 .../timelineeditor/setframevaluedialog.ui | 0 .../timelineeditor/splineeditor.cpp | 0 .../timelineeditor/splineeditor.h | 0 .../timelineeditor/timeline.metainfo | 0 .../timelineeditor/timeline.qrc | 0 .../timelineeditor/timelineabstracttool.cpp | 0 .../timelineeditor/timelineabstracttool.h | 0 .../timelineeditor/timelineactions.cpp | 0 .../timelineeditor/timelineactions.h | 0 .../timelineeditor/timelineanimationform.cpp | 0 .../timelineeditor/timelineanimationform.h | 0 .../timelineeditor/timelineanimationform.ui | 0 .../timelineeditor/timelineconstants.h | 0 .../timelineeditor/timelinecontext.cpp | 0 .../timelineeditor/timelinecontext.h | 0 .../timelineeditor/timelinecontrols.cpp | 0 .../timelineeditor/timelinecontrols.h | 0 .../timelineeditor/timelineeditor.pri | 0 .../timelineeditor/timelineform.cpp | 0 .../timelineeditor/timelineform.h | 0 .../timelineeditor/timelineform.ui | 0 .../timelineeditor/timelinegraphicslayout.cpp | 0 .../timelineeditor/timelinegraphicslayout.h | 0 .../timelineeditor/timelinegraphicsscene.cpp | 0 .../timelineeditor/timelinegraphicsscene.h | 0 .../timelineeditor/timelineicons.h | 0 .../timelineeditor/timelineitem.cpp | 0 .../timelineeditor/timelineitem.h | 0 .../timelinemovableabstractitem.cpp | 0 .../timelinemovableabstractitem.h | 0 .../timelineeditor/timelinemovetool.cpp | 0 .../timelineeditor/timelinemovetool.h | 0 .../timelineeditor/timelineplaceholder.cpp | 0 .../timelineeditor/timelineplaceholder.h | 0 .../timelineeditor/timelinepropertyitem.cpp | 0 .../timelineeditor/timelinepropertyitem.h | 0 .../timelineeditor/timelinesectionitem.cpp | 0 .../timelineeditor/timelinesectionitem.h | 0 .../timelineeditor/timelineselectiontool.cpp | 0 .../timelineeditor/timelineselectiontool.h | 0 .../timelineeditor/timelinesettingsdialog.cpp | 0 .../timelineeditor/timelinesettingsdialog.h | 0 .../timelineeditor/timelinesettingsdialog.ui | 0 .../timelineeditor/timelinesettingsmodel.cpp | 0 .../timelineeditor/timelinesettingsmodel.h | 0 .../timelineeditor/timelinetoolbar.cpp | 0 .../timelineeditor/timelinetoolbar.h | 0 .../timelineeditor/timelinetoolbutton.cpp | 0 .../timelineeditor/timelinetoolbutton.h | 0 .../timelineeditor/timelinetooldelegate.cpp | 0 .../timelineeditor/timelinetooldelegate.h | 0 .../timelineeditor/timelineutils.cpp | 0 .../timelineeditor/timelineutils.h | 0 .../timelineeditor/timelineview.cpp | 0 .../timelineeditor/timelineview.h | 0 .../timelineeditor/timelinewidget.cpp | 0 .../timelineeditor/timelinewidget.h | 0 .../qmldesignerextension.pri | 12 - src/plugins/qmldesigner/qmldesignerplugin.pro | 9 +- src/plugins/qmldesigner/qmldesignerplugin.qbs | 57 +- 236 files changed, 5642 insertions(+), 45 deletions(-) rename src/plugins/qmldesigner/{qmldesignerextension => components}/colortool/colortool.cpp (100%) rename src/plugins/qmldesigner/{qmldesignerextension => components}/colortool/colortool.h (100%) rename src/plugins/qmldesigner/{qmldesignerextension => components}/colortool/colortool.pri (100%) rename src/plugins/qmldesigner/{qmldesignerextension => components}/connectioneditor/addnewbackenddialog.cpp (100%) rename src/plugins/qmldesigner/{qmldesignerextension => components}/connectioneditor/addnewbackenddialog.h (100%) rename src/plugins/qmldesigner/{qmldesignerextension => components}/connectioneditor/addnewbackenddialog.ui (100%) rename src/plugins/qmldesigner/{qmldesignerextension => components}/connectioneditor/backendmodel.cpp (100%) rename src/plugins/qmldesigner/{qmldesignerextension => components}/connectioneditor/backendmodel.h (100%) rename src/plugins/qmldesigner/{qmldesignerextension => components}/connectioneditor/bindingmodel.cpp (100%) rename src/plugins/qmldesigner/{qmldesignerextension => components}/connectioneditor/bindingmodel.h (100%) rename src/plugins/qmldesigner/{qmldesignerextension => components}/connectioneditor/connectioneditor.pri (100%) rename src/plugins/qmldesigner/{qmldesignerextension => components}/connectioneditor/connectioneditor.qrc (100%) rename src/plugins/qmldesigner/{qmldesignerextension => components}/connectioneditor/connectionmodel.cpp (100%) rename src/plugins/qmldesigner/{qmldesignerextension => components}/connectioneditor/connectionmodel.h (100%) rename src/plugins/qmldesigner/{qmldesignerextension => components}/connectioneditor/connectionview.cpp (100%) rename src/plugins/qmldesigner/{qmldesignerextension => components}/connectioneditor/connectionview.h (100%) rename src/plugins/qmldesigner/{qmldesignerextension => components}/connectioneditor/connectionviewwidget.cpp (100%) rename src/plugins/qmldesigner/{qmldesignerextension => components}/connectioneditor/connectionviewwidget.h (100%) rename src/plugins/qmldesigner/{qmldesignerextension => components}/connectioneditor/connectionviewwidget.ui (100%) rename src/plugins/qmldesigner/{qmldesignerextension => components}/connectioneditor/delegates.cpp (100%) rename src/plugins/qmldesigner/{qmldesignerextension => components}/connectioneditor/delegates.h (100%) rename src/plugins/qmldesigner/{qmldesignerextension => components}/connectioneditor/dynamicpropertiesmodel.cpp (100%) rename src/plugins/qmldesigner/{qmldesignerextension => components}/connectioneditor/dynamicpropertiesmodel.h (100%) rename src/plugins/qmldesigner/{qmldesignerextension => components}/connectioneditor/stylesheet.css (100%) create mode 100644 src/plugins/qmldesigner/components/curveeditor/animationcurve.cpp create mode 100644 src/plugins/qmldesigner/components/curveeditor/animationcurve.h create mode 100644 src/plugins/qmldesigner/components/curveeditor/curveeditor.cpp rename src/plugins/qmldesigner/{qmldesignerextension/qmldesignerextensionconstants.h => components/curveeditor/curveeditor.h} (70%) create mode 100644 src/plugins/qmldesigner/components/curveeditor/curveeditor.pri create mode 100644 src/plugins/qmldesigner/components/curveeditor/curveeditormodel.cpp create mode 100644 src/plugins/qmldesigner/components/curveeditor/curveeditormodel.h create mode 100644 src/plugins/qmldesigner/components/curveeditor/curveeditorstyle.h create mode 100644 src/plugins/qmldesigner/components/curveeditor/detail/colorcontrol.cpp create mode 100644 src/plugins/qmldesigner/components/curveeditor/detail/colorcontrol.h create mode 100644 src/plugins/qmldesigner/components/curveeditor/detail/curveeditorstyledialog.cpp create mode 100644 src/plugins/qmldesigner/components/curveeditor/detail/curveeditorstyledialog.h create mode 100644 src/plugins/qmldesigner/components/curveeditor/detail/curveitem.cpp create mode 100644 src/plugins/qmldesigner/components/curveeditor/detail/curveitem.h create mode 100644 src/plugins/qmldesigner/components/curveeditor/detail/curvesegment.cpp create mode 100644 src/plugins/qmldesigner/components/curveeditor/detail/curvesegment.h create mode 100644 src/plugins/qmldesigner/components/curveeditor/detail/graphicsscene.cpp create mode 100644 src/plugins/qmldesigner/components/curveeditor/detail/graphicsscene.h create mode 100644 src/plugins/qmldesigner/components/curveeditor/detail/graphicsview.cpp create mode 100644 src/plugins/qmldesigner/components/curveeditor/detail/graphicsview.h create mode 100644 src/plugins/qmldesigner/components/curveeditor/detail/handleitem.cpp create mode 100644 src/plugins/qmldesigner/components/curveeditor/detail/handleitem.h create mode 100644 src/plugins/qmldesigner/components/curveeditor/detail/keyframeitem.cpp create mode 100644 src/plugins/qmldesigner/components/curveeditor/detail/keyframeitem.h create mode 100644 src/plugins/qmldesigner/components/curveeditor/detail/playhead.cpp create mode 100644 src/plugins/qmldesigner/components/curveeditor/detail/playhead.h create mode 100644 src/plugins/qmldesigner/components/curveeditor/detail/selectableitem.cpp create mode 100644 src/plugins/qmldesigner/components/curveeditor/detail/selectableitem.h create mode 100644 src/plugins/qmldesigner/components/curveeditor/detail/selector.cpp create mode 100644 src/plugins/qmldesigner/components/curveeditor/detail/selector.h create mode 100644 src/plugins/qmldesigner/components/curveeditor/detail/shortcut.cpp create mode 100644 src/plugins/qmldesigner/components/curveeditor/detail/shortcut.h create mode 100644 src/plugins/qmldesigner/components/curveeditor/detail/treeitemdelegate.cpp create mode 100644 src/plugins/qmldesigner/components/curveeditor/detail/treeitemdelegate.h create mode 100644 src/plugins/qmldesigner/components/curveeditor/detail/treemodel.cpp create mode 100644 src/plugins/qmldesigner/components/curveeditor/detail/treemodel.h create mode 100644 src/plugins/qmldesigner/components/curveeditor/detail/treeview.cpp create mode 100644 src/plugins/qmldesigner/components/curveeditor/detail/treeview.h create mode 100644 src/plugins/qmldesigner/components/curveeditor/detail/utils.cpp rename src/plugins/qmldesigner/{qmldesignerextension/qmldesignerextension_global.h => components/curveeditor/detail/utils.h} (66%) create mode 100644 src/plugins/qmldesigner/components/curveeditor/keyframe.cpp create mode 100644 src/plugins/qmldesigner/components/curveeditor/keyframe.h create mode 100644 src/plugins/qmldesigner/components/curveeditor/treeitem.cpp create mode 100644 src/plugins/qmldesigner/components/curveeditor/treeitem.h rename src/plugins/qmldesigner/{qmldesignerextension => components}/pathtool/controlpoint.cpp (100%) rename src/plugins/qmldesigner/{qmldesignerextension => components}/pathtool/controlpoint.h (100%) rename src/plugins/qmldesigner/{qmldesignerextension => components}/pathtool/cubicsegment.cpp (100%) rename src/plugins/qmldesigner/{qmldesignerextension => components}/pathtool/cubicsegment.h (100%) rename src/plugins/qmldesigner/{qmldesignerextension => components}/pathtool/pathitem.cpp (100%) rename src/plugins/qmldesigner/{qmldesignerextension => components}/pathtool/pathitem.h (100%) rename src/plugins/qmldesigner/{qmldesignerextension => components}/pathtool/pathselectionmanipulator.cpp (100%) rename src/plugins/qmldesigner/{qmldesignerextension => components}/pathtool/pathselectionmanipulator.h (100%) rename src/plugins/qmldesigner/{qmldesignerextension => components}/pathtool/pathtool.cpp (100%) rename src/plugins/qmldesigner/{qmldesignerextension => components}/pathtool/pathtool.h (100%) rename src/plugins/qmldesigner/{qmldesignerextension => components}/pathtool/pathtool.pri (100%) rename src/plugins/qmldesigner/{qmldesignerextension => components}/pathtool/pathtoolview.cpp (100%) rename src/plugins/qmldesigner/{qmldesignerextension => components}/pathtool/pathtoolview.h (100%) rename src/plugins/qmldesigner/{qmldesignerextension => components}/sourcetool/sourcetool.cpp (100%) rename src/plugins/qmldesigner/{qmldesignerextension => components}/sourcetool/sourcetool.h (100%) rename src/plugins/qmldesigner/{qmldesignerextension => components}/sourcetool/sourcetool.pri (100%) rename src/plugins/qmldesigner/{qmldesignerextension => components}/texttool/textedititem.cpp (100%) rename src/plugins/qmldesigner/{qmldesignerextension => components}/texttool/textedititem.h (100%) rename src/plugins/qmldesigner/{qmldesignerextension => components}/texttool/textedititemwidget.cpp (100%) rename src/plugins/qmldesigner/{qmldesignerextension => components}/texttool/textedititemwidget.h (100%) rename src/plugins/qmldesigner/{qmldesignerextension => components}/texttool/texttool.cpp (100%) rename src/plugins/qmldesigner/{qmldesignerextension => components}/texttool/texttool.h (100%) rename src/plugins/qmldesigner/{qmldesignerextension => components}/texttool/texttool.pri (100%) rename src/plugins/qmldesigner/{qmldesignerextension => components}/timelineeditor/canvas.cpp (100%) rename src/plugins/qmldesigner/{qmldesignerextension => components}/timelineeditor/canvas.h (100%) rename src/plugins/qmldesigner/{qmldesignerextension => components}/timelineeditor/canvasstyledialog.cpp (100%) rename src/plugins/qmldesigner/{qmldesignerextension => components}/timelineeditor/canvasstyledialog.h (100%) rename src/plugins/qmldesigner/{qmldesignerextension => components}/timelineeditor/easingcurve.cpp (100%) rename src/plugins/qmldesigner/{qmldesignerextension => components}/timelineeditor/easingcurve.h (100%) rename src/plugins/qmldesigner/{qmldesignerextension => components}/timelineeditor/easingcurvedialog.cpp (100%) rename src/plugins/qmldesigner/{qmldesignerextension => components}/timelineeditor/easingcurvedialog.h (100%) rename src/plugins/qmldesigner/{qmldesignerextension => components}/timelineeditor/images/add_timeline.png (100%) rename src/plugins/qmldesigner/{qmldesignerextension => components}/timelineeditor/images/add_timeline@2x.png (100%) rename src/plugins/qmldesigner/{qmldesignerextension => components}/timelineeditor/images/animation.png (100%) rename src/plugins/qmldesigner/{qmldesignerextension => components}/timelineeditor/images/animation@2x.png (100%) rename src/plugins/qmldesigner/{qmldesignerextension => components}/timelineeditor/images/back_one_frame.png (100%) rename src/plugins/qmldesigner/{qmldesignerextension => components}/timelineeditor/images/back_one_frame@2x.png (100%) rename src/plugins/qmldesigner/{qmldesignerextension => components}/timelineeditor/images/curve_editor.png (100%) rename src/plugins/qmldesigner/{qmldesignerextension => components}/timelineeditor/images/curve_editor@2x.png (100%) rename src/plugins/qmldesigner/{qmldesignerextension => components}/timelineeditor/images/curve_picker.png (100%) rename src/plugins/qmldesigner/{qmldesignerextension => components}/timelineeditor/images/curve_picker@2x.png (100%) rename src/plugins/qmldesigner/{qmldesignerextension => components}/timelineeditor/images/forward_one_frame.png (100%) rename src/plugins/qmldesigner/{qmldesignerextension => components}/timelineeditor/images/forward_one_frame@2x.png (100%) rename src/plugins/qmldesigner/{qmldesignerextension => components}/timelineeditor/images/global_record_keyframes.png (100%) rename src/plugins/qmldesigner/{qmldesignerextension => components}/timelineeditor/images/global_record_keyframes@2x.png (100%) rename src/plugins/qmldesigner/{qmldesignerextension => components}/timelineeditor/images/is_keyframe.png (100%) rename src/plugins/qmldesigner/{qmldesignerextension => components}/timelineeditor/images/is_keyframe@2x.png (100%) rename src/plugins/qmldesigner/{qmldesignerextension => components}/timelineeditor/images/keyframe-16px.png (100%) rename src/plugins/qmldesigner/{qmldesignerextension => components}/timelineeditor/images/keyframe.png (100%) rename src/plugins/qmldesigner/{qmldesignerextension => components}/timelineeditor/images/keyframe@2x.png (100%) rename src/plugins/qmldesigner/{qmldesignerextension => components}/timelineeditor/images/keyframe_autobezier_active.png (100%) rename src/plugins/qmldesigner/{qmldesignerextension => components}/timelineeditor/images/keyframe_autobezier_active@2x.png (100%) rename src/plugins/qmldesigner/{qmldesignerextension => components}/timelineeditor/images/keyframe_autobezier_inactive.png (100%) rename src/plugins/qmldesigner/{qmldesignerextension => components}/timelineeditor/images/keyframe_autobezier_inactive@2x.png (100%) rename src/plugins/qmldesigner/{qmldesignerextension => components}/timelineeditor/images/keyframe_autobezier_selected.png (100%) rename src/plugins/qmldesigner/{qmldesignerextension => components}/timelineeditor/images/keyframe_autobezier_selected@2x.png (100%) rename src/plugins/qmldesigner/{qmldesignerextension => components}/timelineeditor/images/keyframe_linear_active.png (100%) rename src/plugins/qmldesigner/{qmldesignerextension => components}/timelineeditor/images/keyframe_linear_active@2x.png (100%) rename src/plugins/qmldesigner/{qmldesignerextension => components}/timelineeditor/images/keyframe_linear_inactive.png (100%) rename src/plugins/qmldesigner/{qmldesignerextension => components}/timelineeditor/images/keyframe_linear_inactive@2x.png (100%) rename src/plugins/qmldesigner/{qmldesignerextension => components}/timelineeditor/images/keyframe_linear_selected.png (100%) rename src/plugins/qmldesigner/{qmldesignerextension => components}/timelineeditor/images/keyframe_linear_selected@2x.png (100%) rename src/plugins/qmldesigner/{qmldesignerextension => components}/timelineeditor/images/keyframe_lineartobezier_active.png (100%) rename src/plugins/qmldesigner/{qmldesignerextension => components}/timelineeditor/images/keyframe_lineartobezier_active@2x.png (100%) rename src/plugins/qmldesigner/{qmldesignerextension => components}/timelineeditor/images/keyframe_lineartobezier_inactive.png (100%) rename src/plugins/qmldesigner/{qmldesignerextension => components}/timelineeditor/images/keyframe_lineartobezier_inactive@2x.png (100%) rename src/plugins/qmldesigner/{qmldesignerextension => components}/timelineeditor/images/keyframe_lineartobezier_selected.png (100%) rename src/plugins/qmldesigner/{qmldesignerextension => components}/timelineeditor/images/keyframe_lineartobezier_selected@2x.png (100%) rename src/plugins/qmldesigner/{qmldesignerextension => components}/timelineeditor/images/keyframe_manualbezier_active.png (100%) rename src/plugins/qmldesigner/{qmldesignerextension => components}/timelineeditor/images/keyframe_manualbezier_active@2x.png (100%) rename src/plugins/qmldesigner/{qmldesignerextension => components}/timelineeditor/images/keyframe_manualbezier_inactive.png (100%) rename src/plugins/qmldesigner/{qmldesignerextension => components}/timelineeditor/images/keyframe_manualbezier_inactive@2x.png (100%) rename src/plugins/qmldesigner/{qmldesignerextension => components}/timelineeditor/images/keyframe_manualbezier_selected.png (100%) rename src/plugins/qmldesigner/{qmldesignerextension => components}/timelineeditor/images/keyframe_manualbezier_selected@2x.png (100%) rename src/plugins/qmldesigner/{qmldesignerextension => components}/timelineeditor/images/local_record_keyframes.png (100%) rename src/plugins/qmldesigner/{qmldesignerextension => components}/timelineeditor/images/local_record_keyframes@2x.png (100%) rename src/plugins/qmldesigner/{qmldesignerextension => components}/timelineeditor/images/loop_playback.png (100%) rename src/plugins/qmldesigner/{qmldesignerextension => components}/timelineeditor/images/loop_playback@2x.png (100%) rename src/plugins/qmldesigner/{qmldesignerextension => components}/timelineeditor/images/next_keyframe.png (100%) rename src/plugins/qmldesigner/{qmldesignerextension => components}/timelineeditor/images/next_keyframe@2x.png (100%) rename src/plugins/qmldesigner/{qmldesignerextension => components}/timelineeditor/images/pause_playback.png (100%) rename src/plugins/qmldesigner/{qmldesignerextension => components}/timelineeditor/images/pause_playback@2x.png (100%) rename src/plugins/qmldesigner/{qmldesignerextension => components}/timelineeditor/images/playhead.png (100%) rename src/plugins/qmldesigner/{qmldesignerextension => components}/timelineeditor/images/playhead@2x.png (100%) rename src/plugins/qmldesigner/{qmldesignerextension => components}/timelineeditor/images/previous_keyframe.png (100%) rename src/plugins/qmldesigner/{qmldesignerextension => components}/timelineeditor/images/previous_keyframe@2x.png (100%) rename src/plugins/qmldesigner/{qmldesignerextension => components}/timelineeditor/images/remove_timeline.png (100%) rename src/plugins/qmldesigner/{qmldesignerextension => components}/timelineeditor/images/remove_timeline@2x.png (100%) rename src/plugins/qmldesigner/{qmldesignerextension => components}/timelineeditor/images/start_playback.png (100%) rename src/plugins/qmldesigner/{qmldesignerextension => components}/timelineeditor/images/start_playback@2x.png (100%) rename src/plugins/qmldesigner/{qmldesignerextension => components}/timelineeditor/images/timeline-16px.png (100%) rename src/plugins/qmldesigner/{qmldesignerextension => components}/timelineeditor/images/to_first_frame.png (100%) rename src/plugins/qmldesigner/{qmldesignerextension => components}/timelineeditor/images/to_first_frame@2x.png (100%) rename src/plugins/qmldesigner/{qmldesignerextension => components}/timelineeditor/images/to_last_frame.png (100%) rename src/plugins/qmldesigner/{qmldesignerextension => components}/timelineeditor/images/to_last_frame@2x.png (100%) rename src/plugins/qmldesigner/{qmldesignerextension => components}/timelineeditor/images/work_area_handle_left.png (100%) rename src/plugins/qmldesigner/{qmldesignerextension => components}/timelineeditor/images/work_area_handle_left@2x.png (100%) rename src/plugins/qmldesigner/{qmldesignerextension => components}/timelineeditor/images/work_area_handle_right.png (100%) rename src/plugins/qmldesigner/{qmldesignerextension => components}/timelineeditor/images/work_area_handle_right@2x.png (100%) rename src/plugins/qmldesigner/{qmldesignerextension => components}/timelineeditor/images/zoom_big.png (100%) rename src/plugins/qmldesigner/{qmldesignerextension => components}/timelineeditor/images/zoom_big@2x.png (100%) rename src/plugins/qmldesigner/{qmldesignerextension => components}/timelineeditor/images/zoom_small.png (100%) rename src/plugins/qmldesigner/{qmldesignerextension => components}/timelineeditor/images/zoom_small@2x.png (100%) rename src/plugins/qmldesigner/{qmldesignerextension => components}/timelineeditor/preseteditor.cpp (100%) rename src/plugins/qmldesigner/{qmldesignerextension => components}/timelineeditor/preseteditor.h (100%) rename src/plugins/qmldesigner/{qmldesignerextension => components}/timelineeditor/setframevaluedialog.cpp (100%) rename src/plugins/qmldesigner/{qmldesignerextension => components}/timelineeditor/setframevaluedialog.h (100%) rename src/plugins/qmldesigner/{qmldesignerextension => components}/timelineeditor/setframevaluedialog.ui (100%) rename src/plugins/qmldesigner/{qmldesignerextension => components}/timelineeditor/splineeditor.cpp (100%) rename src/plugins/qmldesigner/{qmldesignerextension => components}/timelineeditor/splineeditor.h (100%) rename src/plugins/qmldesigner/{qmldesignerextension => components}/timelineeditor/timeline.metainfo (100%) rename src/plugins/qmldesigner/{qmldesignerextension => components}/timelineeditor/timeline.qrc (100%) rename src/plugins/qmldesigner/{qmldesignerextension => components}/timelineeditor/timelineabstracttool.cpp (100%) rename src/plugins/qmldesigner/{qmldesignerextension => components}/timelineeditor/timelineabstracttool.h (100%) rename src/plugins/qmldesigner/{qmldesignerextension => components}/timelineeditor/timelineactions.cpp (100%) rename src/plugins/qmldesigner/{qmldesignerextension => components}/timelineeditor/timelineactions.h (100%) rename src/plugins/qmldesigner/{qmldesignerextension => components}/timelineeditor/timelineanimationform.cpp (100%) rename src/plugins/qmldesigner/{qmldesignerextension => components}/timelineeditor/timelineanimationform.h (100%) rename src/plugins/qmldesigner/{qmldesignerextension => components}/timelineeditor/timelineanimationform.ui (100%) rename src/plugins/qmldesigner/{qmldesignerextension => components}/timelineeditor/timelineconstants.h (100%) rename src/plugins/qmldesigner/{qmldesignerextension => components}/timelineeditor/timelinecontext.cpp (100%) rename src/plugins/qmldesigner/{qmldesignerextension => components}/timelineeditor/timelinecontext.h (100%) rename src/plugins/qmldesigner/{qmldesignerextension => components}/timelineeditor/timelinecontrols.cpp (100%) rename src/plugins/qmldesigner/{qmldesignerextension => components}/timelineeditor/timelinecontrols.h (100%) rename src/plugins/qmldesigner/{qmldesignerextension => components}/timelineeditor/timelineeditor.pri (100%) rename src/plugins/qmldesigner/{qmldesignerextension => components}/timelineeditor/timelineform.cpp (100%) rename src/plugins/qmldesigner/{qmldesignerextension => components}/timelineeditor/timelineform.h (100%) rename src/plugins/qmldesigner/{qmldesignerextension => components}/timelineeditor/timelineform.ui (100%) rename src/plugins/qmldesigner/{qmldesignerextension => components}/timelineeditor/timelinegraphicslayout.cpp (100%) rename src/plugins/qmldesigner/{qmldesignerextension => components}/timelineeditor/timelinegraphicslayout.h (100%) rename src/plugins/qmldesigner/{qmldesignerextension => components}/timelineeditor/timelinegraphicsscene.cpp (100%) rename src/plugins/qmldesigner/{qmldesignerextension => components}/timelineeditor/timelinegraphicsscene.h (100%) rename src/plugins/qmldesigner/{qmldesignerextension => components}/timelineeditor/timelineicons.h (100%) rename src/plugins/qmldesigner/{qmldesignerextension => components}/timelineeditor/timelineitem.cpp (100%) rename src/plugins/qmldesigner/{qmldesignerextension => components}/timelineeditor/timelineitem.h (100%) rename src/plugins/qmldesigner/{qmldesignerextension => components}/timelineeditor/timelinemovableabstractitem.cpp (100%) rename src/plugins/qmldesigner/{qmldesignerextension => components}/timelineeditor/timelinemovableabstractitem.h (100%) rename src/plugins/qmldesigner/{qmldesignerextension => components}/timelineeditor/timelinemovetool.cpp (100%) rename src/plugins/qmldesigner/{qmldesignerextension => components}/timelineeditor/timelinemovetool.h (100%) rename src/plugins/qmldesigner/{qmldesignerextension => components}/timelineeditor/timelineplaceholder.cpp (100%) rename src/plugins/qmldesigner/{qmldesignerextension => components}/timelineeditor/timelineplaceholder.h (100%) rename src/plugins/qmldesigner/{qmldesignerextension => components}/timelineeditor/timelinepropertyitem.cpp (100%) rename src/plugins/qmldesigner/{qmldesignerextension => components}/timelineeditor/timelinepropertyitem.h (100%) rename src/plugins/qmldesigner/{qmldesignerextension => components}/timelineeditor/timelinesectionitem.cpp (100%) rename src/plugins/qmldesigner/{qmldesignerextension => components}/timelineeditor/timelinesectionitem.h (100%) rename src/plugins/qmldesigner/{qmldesignerextension => components}/timelineeditor/timelineselectiontool.cpp (100%) rename src/plugins/qmldesigner/{qmldesignerextension => components}/timelineeditor/timelineselectiontool.h (100%) rename src/plugins/qmldesigner/{qmldesignerextension => components}/timelineeditor/timelinesettingsdialog.cpp (100%) rename src/plugins/qmldesigner/{qmldesignerextension => components}/timelineeditor/timelinesettingsdialog.h (100%) rename src/plugins/qmldesigner/{qmldesignerextension => components}/timelineeditor/timelinesettingsdialog.ui (100%) rename src/plugins/qmldesigner/{qmldesignerextension => components}/timelineeditor/timelinesettingsmodel.cpp (100%) rename src/plugins/qmldesigner/{qmldesignerextension => components}/timelineeditor/timelinesettingsmodel.h (100%) rename src/plugins/qmldesigner/{qmldesignerextension => components}/timelineeditor/timelinetoolbar.cpp (100%) rename src/plugins/qmldesigner/{qmldesignerextension => components}/timelineeditor/timelinetoolbar.h (100%) rename src/plugins/qmldesigner/{qmldesignerextension => components}/timelineeditor/timelinetoolbutton.cpp (100%) rename src/plugins/qmldesigner/{qmldesignerextension => components}/timelineeditor/timelinetoolbutton.h (100%) rename src/plugins/qmldesigner/{qmldesignerextension => components}/timelineeditor/timelinetooldelegate.cpp (100%) rename src/plugins/qmldesigner/{qmldesignerextension => components}/timelineeditor/timelinetooldelegate.h (100%) rename src/plugins/qmldesigner/{qmldesignerextension => components}/timelineeditor/timelineutils.cpp (100%) rename src/plugins/qmldesigner/{qmldesignerextension => components}/timelineeditor/timelineutils.h (100%) rename src/plugins/qmldesigner/{qmldesignerextension => components}/timelineeditor/timelineview.cpp (100%) rename src/plugins/qmldesigner/{qmldesignerextension => components}/timelineeditor/timelineview.h (100%) rename src/plugins/qmldesigner/{qmldesignerextension => components}/timelineeditor/timelinewidget.cpp (100%) rename src/plugins/qmldesigner/{qmldesignerextension => components}/timelineeditor/timelinewidget.h (100%) delete mode 100644 src/plugins/qmldesigner/qmldesignerextension/qmldesignerextension.pri diff --git a/src/plugins/qmldesigner/CMakeLists.txt b/src/plugins/qmldesigner/CMakeLists.txt index 31b26645835..2a26bb8e7bd 100644 --- a/src/plugins/qmldesigner/CMakeLists.txt +++ b/src/plugins/qmldesigner/CMakeLists.txt @@ -25,7 +25,7 @@ add_qtc_plugin(QmlDesigner switchsplittabwidget.cpp switchsplittabwidget.h EXPLICIT_MOC components/propertyeditor/propertyeditorvalue.h - qmldesignerextension/connectioneditor/connectionviewwidget.h + components/connectioneditor/connectionviewwidget.h SKIP_DEBUG_CMAKE_FILE_CHECK ) @@ -499,12 +499,12 @@ extend_qtc_plugin(QmlDesigner ) extend_qtc_plugin(QmlDesigner - SOURCES_PREFIX qmldesignerextension/colortool + SOURCES_PREFIX components/colortool SOURCES colortool.cpp colortool.h ) extend_qtc_plugin(QmlDesigner - SOURCES_PREFIX qmldesignerextension/connectioneditor + SOURCES_PREFIX components/connectioneditor SOURCES addnewbackenddialog.cpp addnewbackenddialog.h addnewbackenddialog.ui backendmodel.cpp backendmodel.h @@ -518,7 +518,7 @@ extend_qtc_plugin(QmlDesigner ) extend_qtc_plugin(QmlDesigner - SOURCES_PREFIX qmldesignerextension + SOURCES_PREFIX components SOURCES pathtool/controlpoint.cpp pathtool/controlpoint.h pathtool/cubicsegment.cpp pathtool/cubicsegment.h @@ -527,9 +527,6 @@ extend_qtc_plugin(QmlDesigner pathtool/pathtool.cpp pathtool/pathtool.h pathtool/pathtoolview.cpp pathtool/pathtoolview.h - qmldesignerextensionconstants.h - qmldesignerextension_global.h - sourcetool/sourcetool.cpp sourcetool/sourcetool.h texttool/textedititem.cpp texttool/textedititem.h @@ -538,7 +535,7 @@ extend_qtc_plugin(QmlDesigner ) extend_qtc_plugin(QmlDesigner - SOURCES_PREFIX qmldesignerextension/timelineeditor + SOURCES_PREFIX components/timelineeditor SOURCES canvas.cpp canvas.h canvasstyledialog.cpp canvasstyledialog.h @@ -576,6 +573,33 @@ extend_qtc_plugin(QmlDesigner timelinewidget.cpp timelinewidget.h ) +extend_qtc_plugin(QmlDesigner + SOURCES_PREFIX components/curveeditor + SOURCES + animationcurve.cpp animationcurve.h + curveeditor.cpp curveeditor.h + curveeditormodel.cpp curveeditormodel.h + curveeditorstyle.h + keyframe.cpp keyframe.h + treeitem.cpp treeitem.h + detail/colorcontrol.cpp detail/colorcontrol.h + detail/curveeditorstyledialog.cpp detail/curveeditorstyledialog.h + detail/curveitem.cpp detail/curveitem.h + detail/curvesegment.cpp detail/curvesegment.h + detail/graphicsscene.cpp detail/graphicsscene.h + detail/graphicsview.cpp detail/graphicsview.h + detail/handleitem.cpp detail/handleitem.h + detail/keyframeitem.cpp detail/keyframeitem.h + detail/playhead.cpp detail/playhead.h + detail/selectableitem.cpp detail/selectableitem.h + detail/selector.cpp detail/selector.h + detail/shortcut.cpp detail/shortcut.h + detail/treeitemdelegate.cpp detail/treeitemdelegate.h + detail/treemodel.cpp detail/treemodel.h + detail/treeview.cpp detail/treeview.h + detail/utils.cpp detail/utils.h +) + # Do the file comparison at the end, due to all the extend_qtc_plugin calls if (WITH_DEBUG_CMAKE) foreach(plugin QmlDesigner componentsplugin qtquickplugin) diff --git a/src/plugins/qmldesigner/qmldesignerextension/colortool/colortool.cpp b/src/plugins/qmldesigner/components/colortool/colortool.cpp similarity index 100% rename from src/plugins/qmldesigner/qmldesignerextension/colortool/colortool.cpp rename to src/plugins/qmldesigner/components/colortool/colortool.cpp diff --git a/src/plugins/qmldesigner/qmldesignerextension/colortool/colortool.h b/src/plugins/qmldesigner/components/colortool/colortool.h similarity index 100% rename from src/plugins/qmldesigner/qmldesignerextension/colortool/colortool.h rename to src/plugins/qmldesigner/components/colortool/colortool.h diff --git a/src/plugins/qmldesigner/qmldesignerextension/colortool/colortool.pri b/src/plugins/qmldesigner/components/colortool/colortool.pri similarity index 100% rename from src/plugins/qmldesigner/qmldesignerextension/colortool/colortool.pri rename to src/plugins/qmldesigner/components/colortool/colortool.pri diff --git a/src/plugins/qmldesigner/qmldesignerextension/connectioneditor/addnewbackenddialog.cpp b/src/plugins/qmldesigner/components/connectioneditor/addnewbackenddialog.cpp similarity index 100% rename from src/plugins/qmldesigner/qmldesignerextension/connectioneditor/addnewbackenddialog.cpp rename to src/plugins/qmldesigner/components/connectioneditor/addnewbackenddialog.cpp diff --git a/src/plugins/qmldesigner/qmldesignerextension/connectioneditor/addnewbackenddialog.h b/src/plugins/qmldesigner/components/connectioneditor/addnewbackenddialog.h similarity index 100% rename from src/plugins/qmldesigner/qmldesignerextension/connectioneditor/addnewbackenddialog.h rename to src/plugins/qmldesigner/components/connectioneditor/addnewbackenddialog.h diff --git a/src/plugins/qmldesigner/qmldesignerextension/connectioneditor/addnewbackenddialog.ui b/src/plugins/qmldesigner/components/connectioneditor/addnewbackenddialog.ui similarity index 100% rename from src/plugins/qmldesigner/qmldesignerextension/connectioneditor/addnewbackenddialog.ui rename to src/plugins/qmldesigner/components/connectioneditor/addnewbackenddialog.ui diff --git a/src/plugins/qmldesigner/qmldesignerextension/connectioneditor/backendmodel.cpp b/src/plugins/qmldesigner/components/connectioneditor/backendmodel.cpp similarity index 100% rename from src/plugins/qmldesigner/qmldesignerextension/connectioneditor/backendmodel.cpp rename to src/plugins/qmldesigner/components/connectioneditor/backendmodel.cpp diff --git a/src/plugins/qmldesigner/qmldesignerextension/connectioneditor/backendmodel.h b/src/plugins/qmldesigner/components/connectioneditor/backendmodel.h similarity index 100% rename from src/plugins/qmldesigner/qmldesignerextension/connectioneditor/backendmodel.h rename to src/plugins/qmldesigner/components/connectioneditor/backendmodel.h diff --git a/src/plugins/qmldesigner/qmldesignerextension/connectioneditor/bindingmodel.cpp b/src/plugins/qmldesigner/components/connectioneditor/bindingmodel.cpp similarity index 100% rename from src/plugins/qmldesigner/qmldesignerextension/connectioneditor/bindingmodel.cpp rename to src/plugins/qmldesigner/components/connectioneditor/bindingmodel.cpp diff --git a/src/plugins/qmldesigner/qmldesignerextension/connectioneditor/bindingmodel.h b/src/plugins/qmldesigner/components/connectioneditor/bindingmodel.h similarity index 100% rename from src/plugins/qmldesigner/qmldesignerextension/connectioneditor/bindingmodel.h rename to src/plugins/qmldesigner/components/connectioneditor/bindingmodel.h diff --git a/src/plugins/qmldesigner/qmldesignerextension/connectioneditor/connectioneditor.pri b/src/plugins/qmldesigner/components/connectioneditor/connectioneditor.pri similarity index 100% rename from src/plugins/qmldesigner/qmldesignerextension/connectioneditor/connectioneditor.pri rename to src/plugins/qmldesigner/components/connectioneditor/connectioneditor.pri diff --git a/src/plugins/qmldesigner/qmldesignerextension/connectioneditor/connectioneditor.qrc b/src/plugins/qmldesigner/components/connectioneditor/connectioneditor.qrc similarity index 100% rename from src/plugins/qmldesigner/qmldesignerextension/connectioneditor/connectioneditor.qrc rename to src/plugins/qmldesigner/components/connectioneditor/connectioneditor.qrc diff --git a/src/plugins/qmldesigner/qmldesignerextension/connectioneditor/connectionmodel.cpp b/src/plugins/qmldesigner/components/connectioneditor/connectionmodel.cpp similarity index 100% rename from src/plugins/qmldesigner/qmldesignerextension/connectioneditor/connectionmodel.cpp rename to src/plugins/qmldesigner/components/connectioneditor/connectionmodel.cpp diff --git a/src/plugins/qmldesigner/qmldesignerextension/connectioneditor/connectionmodel.h b/src/plugins/qmldesigner/components/connectioneditor/connectionmodel.h similarity index 100% rename from src/plugins/qmldesigner/qmldesignerextension/connectioneditor/connectionmodel.h rename to src/plugins/qmldesigner/components/connectioneditor/connectionmodel.h diff --git a/src/plugins/qmldesigner/qmldesignerextension/connectioneditor/connectionview.cpp b/src/plugins/qmldesigner/components/connectioneditor/connectionview.cpp similarity index 100% rename from src/plugins/qmldesigner/qmldesignerextension/connectioneditor/connectionview.cpp rename to src/plugins/qmldesigner/components/connectioneditor/connectionview.cpp diff --git a/src/plugins/qmldesigner/qmldesignerextension/connectioneditor/connectionview.h b/src/plugins/qmldesigner/components/connectioneditor/connectionview.h similarity index 100% rename from src/plugins/qmldesigner/qmldesignerextension/connectioneditor/connectionview.h rename to src/plugins/qmldesigner/components/connectioneditor/connectionview.h diff --git a/src/plugins/qmldesigner/qmldesignerextension/connectioneditor/connectionviewwidget.cpp b/src/plugins/qmldesigner/components/connectioneditor/connectionviewwidget.cpp similarity index 100% rename from src/plugins/qmldesigner/qmldesignerextension/connectioneditor/connectionviewwidget.cpp rename to src/plugins/qmldesigner/components/connectioneditor/connectionviewwidget.cpp diff --git a/src/plugins/qmldesigner/qmldesignerextension/connectioneditor/connectionviewwidget.h b/src/plugins/qmldesigner/components/connectioneditor/connectionviewwidget.h similarity index 100% rename from src/plugins/qmldesigner/qmldesignerextension/connectioneditor/connectionviewwidget.h rename to src/plugins/qmldesigner/components/connectioneditor/connectionviewwidget.h diff --git a/src/plugins/qmldesigner/qmldesignerextension/connectioneditor/connectionviewwidget.ui b/src/plugins/qmldesigner/components/connectioneditor/connectionviewwidget.ui similarity index 100% rename from src/plugins/qmldesigner/qmldesignerextension/connectioneditor/connectionviewwidget.ui rename to src/plugins/qmldesigner/components/connectioneditor/connectionviewwidget.ui diff --git a/src/plugins/qmldesigner/qmldesignerextension/connectioneditor/delegates.cpp b/src/plugins/qmldesigner/components/connectioneditor/delegates.cpp similarity index 100% rename from src/plugins/qmldesigner/qmldesignerextension/connectioneditor/delegates.cpp rename to src/plugins/qmldesigner/components/connectioneditor/delegates.cpp diff --git a/src/plugins/qmldesigner/qmldesignerextension/connectioneditor/delegates.h b/src/plugins/qmldesigner/components/connectioneditor/delegates.h similarity index 100% rename from src/plugins/qmldesigner/qmldesignerextension/connectioneditor/delegates.h rename to src/plugins/qmldesigner/components/connectioneditor/delegates.h diff --git a/src/plugins/qmldesigner/qmldesignerextension/connectioneditor/dynamicpropertiesmodel.cpp b/src/plugins/qmldesigner/components/connectioneditor/dynamicpropertiesmodel.cpp similarity index 100% rename from src/plugins/qmldesigner/qmldesignerextension/connectioneditor/dynamicpropertiesmodel.cpp rename to src/plugins/qmldesigner/components/connectioneditor/dynamicpropertiesmodel.cpp diff --git a/src/plugins/qmldesigner/qmldesignerextension/connectioneditor/dynamicpropertiesmodel.h b/src/plugins/qmldesigner/components/connectioneditor/dynamicpropertiesmodel.h similarity index 100% rename from src/plugins/qmldesigner/qmldesignerextension/connectioneditor/dynamicpropertiesmodel.h rename to src/plugins/qmldesigner/components/connectioneditor/dynamicpropertiesmodel.h diff --git a/src/plugins/qmldesigner/qmldesignerextension/connectioneditor/stylesheet.css b/src/plugins/qmldesigner/components/connectioneditor/stylesheet.css similarity index 100% rename from src/plugins/qmldesigner/qmldesignerextension/connectioneditor/stylesheet.css rename to src/plugins/qmldesigner/components/connectioneditor/stylesheet.css diff --git a/src/plugins/qmldesigner/components/curveeditor/animationcurve.cpp b/src/plugins/qmldesigner/components/curveeditor/animationcurve.cpp new file mode 100644 index 00000000000..8e2d5224e10 --- /dev/null +++ b/src/plugins/qmldesigner/components/curveeditor/animationcurve.cpp @@ -0,0 +1,187 @@ +/**************************************************************************** +** +** Copyright (C) 2019 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the Qt Design Tooling +** +** 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 "animationcurve.h" +#include "detail/curvesegment.h" + +#include + +namespace DesignTools { + +AnimationCurve::AnimationCurve() + : m_frames() +{} + +AnimationCurve::AnimationCurve(const std::vector &frames) + : m_frames(frames) + , m_minY(std::numeric_limits::max()) + , m_maxY(std::numeric_limits::lowest()) +{ + if (isValid()) { + + for (auto e : extrema()) { + + if (m_minY > e.y()) + m_minY = e.y(); + + if (m_maxY < e.y()) + m_maxY = e.y(); + } + + for (auto &frame : qAsConst(m_frames)) { + if (frame.position().y() < m_minY) + m_minY = frame.position().y(); + + if (frame.position().y() > m_maxY) + m_maxY = frame.position().y(); + } + } +} + +bool AnimationCurve::isValid() const +{ + return m_frames.size() >= 2; +} + +double AnimationCurve::minimumTime() const +{ + if (!m_frames.empty()) + return m_frames.front().position().x(); + + return std::numeric_limits::max(); +} + +double AnimationCurve::maximumTime() const +{ + if (!m_frames.empty()) + return m_frames.back().position().x(); + + return std::numeric_limits::lowest(); +} + +double AnimationCurve::minimumValue() const +{ + return m_minY; +} + +double AnimationCurve::maximumValue() const +{ + return m_maxY; +} + +std::vector AnimationCurve::keyframes() const +{ + return m_frames; +} + +std::vector AnimationCurve::extrema() const +{ + std::vector out; + + CurveSegment segment; + segment.setLeft(m_frames.at(0)); + + for (size_t i = 1; i < m_frames.size(); ++i) { + + segment.setRight(m_frames[i]); + + const auto es = segment.extrema(); + out.insert(std::end(out), std::begin(es), std::end(es)); + + segment.setLeft(m_frames[i]); + } + + return out; +} + +std::vector AnimationCurve::yForX(double x) const +{ + if (m_frames.front().position().x() > x) + return std::vector(); + + CurveSegment segment; + for (auto &frame : m_frames) { + if (frame.position().x() > x) { + segment.setRight(frame); + return segment.yForX(x); + } + segment.setLeft(frame); + } + return std::vector(); +} + +std::vector AnimationCurve::xForY(double y, uint segment) const +{ + if (m_frames.size() > segment + 1) { + CurveSegment seg(m_frames[segment], m_frames[segment + 1]); + return seg.xForY(y); + } + return std::vector(); +} + +bool AnimationCurve::intersects(const QPointF &coord, double radius) +{ + if (m_frames.size() < 2) + return false; + + std::vector influencer; + + CurveSegment current; + current.setLeft(m_frames.at(0)); + + for (size_t i = 1; i < m_frames.size(); ++i) { + Keyframe &frame = m_frames.at(i); + + current.setRight(frame); + + if (current.containsX(coord.x() - radius) || + current.containsX(coord.x()) || + current.containsX(coord.x() + radius)) { + influencer.push_back(current); + } + + if (frame.position().x() > coord.x() + radius) + break; + + current.setLeft(frame); + } + + for (auto &segment : influencer) { + for (auto &y : segment.yForX(coord.x())) { + QLineF line(coord.x(), y, coord.x(), coord.y()); + if (line.length() < radius) + return true; + } + + for (auto &x : segment.xForY(coord.y())) { + QLineF line(x, coord.y(), coord.x(), coord.y()); + if (line.length() < radius) + return true; + } + } + return false; +} + +} // End namespace DesignTools. diff --git a/src/plugins/qmldesigner/components/curveeditor/animationcurve.h b/src/plugins/qmldesigner/components/curveeditor/animationcurve.h new file mode 100644 index 00000000000..0533e479a16 --- /dev/null +++ b/src/plugins/qmldesigner/components/curveeditor/animationcurve.h @@ -0,0 +1,69 @@ +/**************************************************************************** +** +** Copyright (C) 2019 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the Qt Design Tooling +** +** 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 "keyframe.h" + +#include + +namespace DesignTools { + +class AnimationCurve +{ +public: + AnimationCurve(); + + AnimationCurve(const std::vector &frames); + + bool isValid() const; + + double minimumTime() const; + + double maximumTime() const; + + double minimumValue() const; + + double maximumValue() const; + + std::vector keyframes() const; + + std::vector extrema() const; + + std::vector yForX(double x) const; + + std::vector xForY(double y, uint segment) const; + + bool intersects(const QPointF &coord, double radius); + +private: + std::vector m_frames; + + double m_minY; + + double m_maxY; +}; + +} // End namespace DesignTools. diff --git a/src/plugins/qmldesigner/components/curveeditor/curveeditor.cpp b/src/plugins/qmldesigner/components/curveeditor/curveeditor.cpp new file mode 100644 index 00000000000..4eba31c6bd1 --- /dev/null +++ b/src/plugins/qmldesigner/components/curveeditor/curveeditor.cpp @@ -0,0 +1,64 @@ +/**************************************************************************** +** +** Copyright (C) 2019 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the Qt Design Tooling +** +** 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 "curveeditor.h" +#include "curveeditormodel.h" +#include "detail/curveitem.h" +#include "detail/graphicsview.h" +#include "detail/treeview.h" + +#include +#include + +namespace DesignTools { + +CurveEditor::CurveEditor(CurveEditorModel *model, QWidget *parent) + : QWidget(parent) + , m_tree(new TreeView(model, this)) + , m_view(new GraphicsView(model)) +{ + QSplitter *splitter = new QSplitter; + splitter->addWidget(m_tree); + splitter->addWidget(m_view); + splitter->setStretchFactor(1, 2); + + QHBoxLayout *box = new QHBoxLayout; + box->addWidget(splitter); + setLayout(box); + + connect(m_tree, &TreeView::curvesSelected, m_view, &GraphicsView::reset); +} + +void CurveEditor::zoomX(double zoom) +{ + m_view->setZoomX(zoom); +} + +void CurveEditor::zoomY(double zoom) +{ + m_view->setZoomY(zoom); +} + +} // End namespace DesignTools. diff --git a/src/plugins/qmldesigner/qmldesignerextension/qmldesignerextensionconstants.h b/src/plugins/qmldesigner/components/curveeditor/curveeditor.h similarity index 70% rename from src/plugins/qmldesigner/qmldesignerextension/qmldesignerextensionconstants.h rename to src/plugins/qmldesigner/components/curveeditor/curveeditor.h index 9bf41a2f54f..a2c5873be0c 100644 --- a/src/plugins/qmldesigner/qmldesignerextension/qmldesignerextensionconstants.h +++ b/src/plugins/qmldesigner/components/curveeditor/curveeditor.h @@ -1,9 +1,9 @@ /**************************************************************************** ** -** Copyright (C) 2016 The Qt Company Ltd. +** Copyright (C) 2019 The Qt Company Ltd. ** Contact: https://www.qt.io/licensing/ ** -** This file is part of Qt Creator. +** This file is part of the Qt Design Tooling ** ** Commercial License Usage ** Licensees holding valid commercial Qt licenses may use this file in @@ -25,11 +25,29 @@ #pragma once -namespace QmlDesignerExtension { -namespace Constants { +#include -const char ACTION_ID[] = "QmlDesignerExtension.Action"; -const char MENU_ID[] = "QmlDesignerExtension.Menu"; +namespace DesignTools { -} // namespace QmlDesignerExtension -} // namespace Constants +class CurveEditorModel; +class GraphicsView; +class TreeView; + +class CurveEditor : public QWidget +{ + Q_OBJECT + +public: + CurveEditor(CurveEditorModel *model, QWidget *parent = nullptr); + + void zoomX(double zoom); + + void zoomY(double zoom); + +private: + TreeView *m_tree; + + GraphicsView *m_view; +}; + +} // End namespace DesignTools. diff --git a/src/plugins/qmldesigner/components/curveeditor/curveeditor.pri b/src/plugins/qmldesigner/components/curveeditor/curveeditor.pri new file mode 100644 index 00000000000..31ffe5d8183 --- /dev/null +++ b/src/plugins/qmldesigner/components/curveeditor/curveeditor.pri @@ -0,0 +1,46 @@ +INCLUDEPATH += $$PWD + +HEADERS += \ + $$PWD/animationcurve.h \ + $$PWD/curveeditor.h \ + $$PWD/curveeditormodel.h \ + $$PWD/detail/colorcontrol.h \ + $$PWD/detail/curveeditorstyledialog.h \ + $$PWD/detail/curveitem.h \ + $$PWD/detail/curvesegment.h \ + $$PWD/detail/graphicsscene.h \ + $$PWD/detail/graphicsview.h \ + $$PWD/detail/handleitem.h \ + $$PWD/detail/keyframeitem.h \ + $$PWD/detail/playhead.h \ + $$PWD/detail/selectableitem.h \ + $$PWD/detail/selector.h \ + $$PWD/detail/shortcut.h \ + $$PWD/detail/treeitemdelegate.h \ + $$PWD/detail/treemodel.h \ + $$PWD/detail/treeview.h \ + $$PWD/keyframe.h \ + $$PWD/treeitem.h + +SOURCES += \ + $$PWD/animationcurve.cpp \ + $$PWD/curveeditor.cpp \ + $$PWD/curveeditormodel.cpp \ + $$PWD/detail/colorcontrol.cpp \ + $$PWD/detail/curveeditorstyledialog.cpp \ + $$PWD/detail/curveitem.cpp \ + $$PWD/detail/curvesegment.cpp \ + $$PWD/detail/graphicsscene.cpp \ + $$PWD/detail/graphicsview.cpp \ + $$PWD/detail/handleitem.cpp \ + $$PWD/detail/keyframeitem.cpp \ + $$PWD/detail/playhead.cpp \ + $$PWD/detail/selectableitem.cpp \ + $$PWD/detail/selector.cpp \ + $$PWD/detail/shortcut.cpp \ + $$PWD/detail/treeitemdelegate.cpp \ + $$PWD/detail/treemodel.cpp \ + $$PWD/detail/treeview.cpp \ + $$PWD/detail/utils.cpp \ + $$PWD/keyframe.cpp \ + $$PWD/treeitem.cpp diff --git a/src/plugins/qmldesigner/components/curveeditor/curveeditormodel.cpp b/src/plugins/qmldesigner/components/curveeditor/curveeditormodel.cpp new file mode 100644 index 00000000000..3b8b26b763c --- /dev/null +++ b/src/plugins/qmldesigner/components/curveeditor/curveeditormodel.cpp @@ -0,0 +1,70 @@ +/**************************************************************************** +** +** Copyright (C) 2019 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the Qt Design Tooling +** +** 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 "curveeditormodel.h" +#include "treeitem.h" +#include "detail/graphicsview.h" + +namespace DesignTools { + +CurveEditorModel::CurveEditorModel(QObject *parent) + : TreeModel(parent) +{} + +CurveEditorModel::~CurveEditorModel() {} + + +void CurveEditorModel::setCurrentFrame(int frame) +{ + if (graphicsView()) + graphicsView()->setCurrentFrame(frame); +} + +void CurveEditorModel::setCurve(unsigned int id, const AnimationCurve &curve) +{ + if (TreeItem *item = find(id)) { + if (PropertyTreeItem *propertyItem = item->asPropertyItem()) { + propertyItem->setCurve(curve); + emit curveChanged(propertyItem); + } + } +} + +void CurveEditorModel::reset(const std::vector &items) +{ + beginResetModel(); + + initialize(); + + unsigned int counter = 0; + for (auto *item : items) { + item->setId(++counter); + root()->addChild(item); + } + + endResetModel(); +} + +} // End namespace DesignTools. diff --git a/src/plugins/qmldesigner/components/curveeditor/curveeditormodel.h b/src/plugins/qmldesigner/components/curveeditor/curveeditormodel.h new file mode 100644 index 00000000000..840107ced5d --- /dev/null +++ b/src/plugins/qmldesigner/components/curveeditor/curveeditormodel.h @@ -0,0 +1,70 @@ +/**************************************************************************** +** +** Copyright (C) 2019 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the Qt Design Tooling +** +** 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 "detail/treemodel.h" + +#include + +class QPointF; + +namespace DesignTools { + +struct CurveEditorStyle; + +class AnimationCurve; +class PropertyTreeItem; +class TreeItem; + +class CurveEditorModel : public TreeModel +{ + Q_OBJECT + +signals: + void currentFrameChanged(int frame); + + void curveChanged(PropertyTreeItem *item); + +public: + virtual double minimumTime() const = 0; + + virtual double maximumTime() const = 0; + + virtual CurveEditorStyle style() const = 0; + +public: + CurveEditorModel(QObject *parent = nullptr); + + ~CurveEditorModel() override; + + void setCurrentFrame(int frame); + + void setCurve(unsigned int id, const AnimationCurve &curve); + + void reset(const std::vector &items); +}; + +} // End namespace DesignTools. diff --git a/src/plugins/qmldesigner/components/curveeditor/curveeditorstyle.h b/src/plugins/qmldesigner/components/curveeditor/curveeditorstyle.h new file mode 100644 index 00000000000..03ea11c8c1f --- /dev/null +++ b/src/plugins/qmldesigner/components/curveeditor/curveeditorstyle.h @@ -0,0 +1,125 @@ +/**************************************************************************** +** +** Copyright (C) 2019 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the Qt Design Tooling +** +** 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 "detail/shortcut.h" + +#include +#include +#include +#include +#include +#include + +namespace DesignTools { + +struct TreeItemStyleOption +{ + double margins; + QIcon pinnedIcon = QIcon(":/ICON_PINNED"); + QIcon unpinnedIcon = QIcon(":/ICON_UNPINNED"); + QIcon lockedIcon = QIcon(":/ICON_LOCKED"); + QIcon unlockedIcon = QIcon(":/ICON_UNLOCKED"); +}; + +struct HandleItemStyleOption +{ + double size = 10.0; + double lineWidth = 1.0; + QColor color = QColor(200, 0, 0); + QColor selectionColor = QColor(200, 200, 200); +}; + +struct KeyframeItemStyleOption +{ + double size = 10.0; + QColor color = QColor(200, 200, 0); + QColor selectionColor = QColor(200, 200, 200); +}; + +struct CurveItemStyleOption +{ + double width = 1.0; + QColor color = QColor(0, 200, 0); + QColor selectionColor = QColor(200, 200, 200); +}; + +struct PlayheadStyleOption +{ + double width = 20.0; + double radius = 4.0; + QColor color = QColor(200, 200, 0); +}; + +struct Shortcuts +{ + Shortcut newSelection = Shortcut(Qt::LeftButton); + Shortcut addToSelection = Shortcut(Qt::LeftButton, Qt::ControlModifier | Qt::ShiftModifier); + Shortcut removeFromSelection = Shortcut(Qt::LeftButton, Qt::ShiftModifier); + Shortcut toggleSelection = Shortcut(Qt::LeftButton, Qt::ControlModifier); + + Shortcut zoom = Shortcut(Qt::RightButton, Qt::AltModifier); + Shortcut pan = Shortcut(Qt::MiddleButton, Qt::AltModifier); + Shortcut frameAll = Shortcut(Qt::NoModifier, Qt::Key_A); +}; + +struct CurveEditorStyle +{ + Shortcuts shortcuts; + + QBrush backgroundBrush = QBrush(QColor(5, 0, 100)); + QBrush backgroundAlternateBrush = QBrush(QColor(0, 0, 50)); + QColor fontColor = QColor(200, 200, 200); + QColor gridColor = QColor(128, 128, 128); + double canvasMargin = 5.0; + int zoomInWidth = 100; + int zoomInHeight = 100; + double timeAxisHeight = 40.0; + double timeOffsetLeft = 10.0; + double timeOffsetRight = 10.0; + QColor rangeBarColor = QColor(128, 128, 128); + QColor rangeBarCapsColor = QColor(50, 50, 255); + double valueAxisWidth = 60.0; + double valueOffsetTop = 10.0; + double valueOffsetBottom = 10.0; + + HandleItemStyleOption handleStyle; + KeyframeItemStyleOption keyframeStyle; + CurveItemStyleOption curveStyle; + TreeItemStyleOption treeItemStyle; + PlayheadStyleOption playhead; +}; + +inline QPixmap pixmapFromIcon(const QIcon &icon, const QSize &size, const QColor &color) +{ + QPixmap pixmap = icon.pixmap(size); + QPixmap mask(pixmap.size()); + mask.fill(color); + mask.setMask(pixmap.createMaskFromColor(Qt::transparent)); + return mask; +} + +} // End namespace DesignTools. diff --git a/src/plugins/qmldesigner/components/curveeditor/detail/colorcontrol.cpp b/src/plugins/qmldesigner/components/curveeditor/detail/colorcontrol.cpp new file mode 100644 index 00000000000..a833a4c6ff3 --- /dev/null +++ b/src/plugins/qmldesigner/components/curveeditor/detail/colorcontrol.cpp @@ -0,0 +1,101 @@ +/**************************************************************************** +** +** Copyright (C) 2019 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the Qt Design Tooling +** +** 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 "colorcontrol.h" + +#include +#include +#include +#include +#include + +namespace DesignTools { + +ColorControl::ColorControl() + : QWidget(nullptr) + , m_color(Qt::black) +{ + setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed); + setFixedHeight(20); +} + +ColorControl::ColorControl(const QColor &color, QWidget *parent) + : QWidget(parent) + , m_color(color) +{ + setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed); + setFixedHeight(20); +} + +ColorControl::~ColorControl() = default; + +QColor ColorControl::value() const +{ + return m_color; +} + +void ColorControl::setValue(const QColor &val) +{ + m_color = val; +} + +bool ColorControl::event(QEvent *event) +{ + if (event->type() == QEvent::ToolTip) { + if (auto helpEvent = static_cast(event)) { + QToolTip::showText(helpEvent->globalPos(), m_color.name()); + return true; + } + } + return QWidget::event(event); +} + +void ColorControl::paintEvent(QPaintEvent *event) +{ + QPainter painter(this); + painter.fillRect(event->rect(), m_color); +} + +void ColorControl::mouseReleaseEvent(QMouseEvent *event) +{ + QColor color = QColorDialog::getColor(m_color, this); + + event->accept(); + + if (color != m_color) { + m_color = color; + update(); + emit valueChanged(); + } +} + +void ColorControl::mousePressEvent(QMouseEvent *event) +{ + // Required if embedded in a QGraphicsProxywidget + // in order to call mouseRelease properly. + QWidget::mousePressEvent(event); + event->accept(); +} + +} // End namespace DesignTools. diff --git a/src/plugins/qmldesigner/components/curveeditor/detail/colorcontrol.h b/src/plugins/qmldesigner/components/curveeditor/detail/colorcontrol.h new file mode 100644 index 00000000000..54dfe194f88 --- /dev/null +++ b/src/plugins/qmldesigner/components/curveeditor/detail/colorcontrol.h @@ -0,0 +1,63 @@ +/**************************************************************************** +** +** Copyright (C) 2019 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the Qt Design Tooling +** +** 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 + +namespace DesignTools { + +class ColorControl : public QWidget +{ + Q_OBJECT + +public: + ColorControl(); + + ColorControl(const QColor &color, QWidget *parent = nullptr); + + ~ColorControl() override; + + QColor value() const; + + void setValue(const QColor &val); + +protected: + bool event(QEvent *event) override; + + void paintEvent(QPaintEvent *event) override; + + void mouseReleaseEvent(QMouseEvent *event) override; + + void mousePressEvent(QMouseEvent *event) override; + +signals: + void valueChanged(); + +private: + QColor m_color; +}; + +} // End namespace DesignTools. diff --git a/src/plugins/qmldesigner/components/curveeditor/detail/curveeditorstyledialog.cpp b/src/plugins/qmldesigner/components/curveeditor/detail/curveeditorstyledialog.cpp new file mode 100644 index 00000000000..a8b653a74d9 --- /dev/null +++ b/src/plugins/qmldesigner/components/curveeditor/detail/curveeditorstyledialog.cpp @@ -0,0 +1,267 @@ +/**************************************************************************** +** +** Copyright (C) 2019 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the Qt Design Tooling +** +** 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 "curveeditorstyledialog.h" +#include "colorcontrol.h" +#include "curveeditorstyle.h" + +#include +#include +#include +#include +#include +#include + +namespace DesignTools { + +QHBoxLayout *createRow(const QString &title, QWidget *widget) +{ + auto *label = new QLabel(title); + label->setFixedWidth(200); + label->setAlignment(Qt::AlignRight); + + auto *box = new QHBoxLayout; + box->addWidget(label); + box->addWidget(widget); + return box; +} + +CurveEditorStyleDialog::CurveEditorStyleDialog(CurveEditorStyle &style, QWidget *parent) + : QDialog(parent) + , m_printButton(new QPushButton("Print")) + , m_background(new ColorControl(style.backgroundBrush.color())) + , m_backgroundAlternate(new ColorControl(style.backgroundAlternateBrush.color())) + , m_fontColor(new ColorControl(style.fontColor)) + , m_gridColor(new ColorControl(style.gridColor)) + , m_canvasMargin(new QDoubleSpinBox()) + , m_zoomInWidth(new QSpinBox()) + , m_zoomInHeight(new QSpinBox()) + , m_timeAxisHeight(new QDoubleSpinBox()) + , m_timeOffsetLeft(new QDoubleSpinBox()) + , m_timeOffsetRight(new QDoubleSpinBox()) + , m_rangeBarColor(new ColorControl(style.rangeBarCapsColor)) + , m_rangeBarCapsColor(new ColorControl(style.rangeBarCapsColor)) + , m_valueAxisWidth(new QDoubleSpinBox()) + , m_valueOffsetTop(new QDoubleSpinBox()) + , m_valueOffsetBottom(new QDoubleSpinBox()) + , m_handleSize(new QDoubleSpinBox()) + , m_handleLineWidth(new QDoubleSpinBox()) + , m_handleColor(new ColorControl(style.handleStyle.color)) + , m_handleSelectionColor(new ColorControl(style.handleStyle.selectionColor)) + , m_keyframeSize(new QDoubleSpinBox()) + , m_keyframeColor(new ColorControl(style.keyframeStyle.color)) + , m_keyframeSelectionColor(new ColorControl(style.keyframeStyle.selectionColor)) + , m_curveWidth(new QDoubleSpinBox()) + , m_curveColor(new ColorControl(style.curveStyle.color)) + , m_curveSelectionColor(new ColorControl(style.curveStyle.selectionColor)) + , m_treeMargins(new QDoubleSpinBox()) + , m_playheadWidth(new QDoubleSpinBox()) + , m_playheadRadius(new QDoubleSpinBox()) + , m_playheadColor(new ColorControl(style.playhead.color)) + +{ + m_canvasMargin->setValue(style.canvasMargin); + m_zoomInWidth->setValue(style.zoomInWidth); + m_zoomInHeight->setValue(style.zoomInHeight); + m_zoomInHeight->setMaximum(9000); + + m_timeAxisHeight->setValue(style.timeAxisHeight); + m_timeOffsetLeft->setValue(style.timeOffsetLeft); + m_timeOffsetRight->setValue(style.timeOffsetRight); + m_valueAxisWidth->setValue(style.valueAxisWidth); + m_valueOffsetTop->setValue(style.valueOffsetTop); + m_valueOffsetBottom->setValue(style.valueOffsetBottom); + m_handleSize->setValue(style.handleStyle.size); + m_handleLineWidth->setValue(style.handleStyle.lineWidth); + m_keyframeSize->setValue(style.keyframeStyle.size); + m_curveWidth->setValue(style.curveStyle.width); + m_treeMargins->setValue(style.treeItemStyle.margins); + m_playheadWidth->setValue(style.playhead.width); + m_playheadRadius->setValue(style.playhead.radius); + + connect(m_printButton, &QPushButton::released, this, &CurveEditorStyleDialog::printStyle); + + auto intChanged = [this](int) { emitStyleChanged(); }; + auto doubleChanged = [this](double) { emitStyleChanged(); }; + auto colorChanged = [this]() { emitStyleChanged(); }; + + auto intSignal = static_cast(&QSpinBox::valueChanged); + auto doubleSignal = static_cast(&QDoubleSpinBox::valueChanged); + + connect(m_background, &ColorControl::valueChanged, colorChanged); + connect(m_backgroundAlternate, &ColorControl::valueChanged, colorChanged); + connect(m_fontColor, &ColorControl::valueChanged, colorChanged); + connect(m_gridColor, &ColorControl::valueChanged, colorChanged); + connect(m_canvasMargin, doubleSignal, doubleChanged); + connect(m_zoomInWidth, intSignal, intChanged); + connect(m_zoomInHeight, intSignal, intChanged); + connect(m_timeAxisHeight, doubleSignal, doubleChanged); + connect(m_timeOffsetLeft, doubleSignal, doubleChanged); + connect(m_timeOffsetRight, doubleSignal, doubleChanged); + connect(m_rangeBarColor, &ColorControl::valueChanged, colorChanged); + connect(m_rangeBarCapsColor, &ColorControl::valueChanged, colorChanged); + connect(m_valueAxisWidth, doubleSignal, doubleChanged); + connect(m_valueOffsetTop, doubleSignal, doubleChanged); + connect(m_valueOffsetBottom, doubleSignal, doubleChanged); + connect(m_handleSize, doubleSignal, doubleChanged); + connect(m_handleLineWidth, doubleSignal, doubleChanged); + connect(m_handleColor, &ColorControl::valueChanged, colorChanged); + connect(m_handleSelectionColor, &ColorControl::valueChanged, colorChanged); + connect(m_keyframeSize, doubleSignal, doubleChanged); + connect(m_keyframeColor, &ColorControl::valueChanged, colorChanged); + connect(m_keyframeSelectionColor, &ColorControl::valueChanged, colorChanged); + connect(m_curveWidth, doubleSignal, doubleChanged); + connect(m_curveColor, &ColorControl::valueChanged, colorChanged); + connect(m_curveSelectionColor, &ColorControl::valueChanged, colorChanged); + connect(m_treeMargins, doubleSignal, doubleChanged); + connect(m_playheadWidth, doubleSignal, doubleChanged); + connect(m_playheadRadius, doubleSignal, doubleChanged); + connect(m_playheadColor, &ColorControl::valueChanged, colorChanged); + + auto *box = new QVBoxLayout; + box->addLayout(createRow("Background Color", m_background)); + box->addLayout(createRow("Alternate Background Color", m_backgroundAlternate)); + box->addLayout(createRow("Font Color", m_fontColor)); + box->addLayout(createRow("Grid Color", m_gridColor)); + box->addLayout(createRow("Canvas Margin", m_canvasMargin)); + box->addLayout(createRow("Zoom In Width", m_zoomInWidth)); + box->addLayout(createRow("Zoom In Height", m_zoomInHeight)); + box->addLayout(createRow("Time Axis Height", m_timeAxisHeight)); + box->addLayout(createRow("Time Axis Left Offset", m_timeOffsetLeft)); + box->addLayout(createRow("Time Axis Right Offset", m_timeOffsetRight)); + box->addLayout(createRow("Range Bar Color", m_rangeBarColor)); + box->addLayout(createRow("Range Bar Caps Color", m_rangeBarCapsColor)); + box->addLayout(createRow("Value Axis Width", m_valueAxisWidth)); + box->addLayout(createRow("Value Axis Top Offset", m_valueOffsetTop)); + box->addLayout(createRow("Value Axis Bottom Offset", m_valueOffsetBottom)); + box->addLayout(createRow("Handle Size", m_handleSize)); + box->addLayout(createRow("Handle Line Width", m_handleLineWidth)); + box->addLayout(createRow("Handle Color", m_handleColor)); + box->addLayout(createRow("Handle Selection Color", m_handleSelectionColor)); + box->addLayout(createRow("Keyframe Size", m_keyframeSize)); + box->addLayout(createRow("Keyframe Color", m_keyframeColor)); + box->addLayout(createRow("Keyframe Selection Color", m_keyframeSelectionColor)); + box->addLayout(createRow("Curve Width", m_curveWidth)); + box->addLayout(createRow("Curve Color", m_curveColor)); + box->addLayout(createRow("Curve Selection Color", m_curveSelectionColor)); + box->addLayout(createRow("Treeview margins", m_treeMargins)); + box->addLayout(createRow("Playhead width", m_playheadWidth)); + box->addLayout(createRow("Playhead radius", m_playheadRadius)); + box->addLayout(createRow("Playhead color", m_playheadColor)); + + box->addWidget(m_printButton); + setLayout(box); +} + +CurveEditorStyle CurveEditorStyleDialog::style() const +{ + CurveEditorStyle style; + style.backgroundBrush = QBrush(m_background->value()); + style.backgroundAlternateBrush = QBrush(m_backgroundAlternate->value()); + style.fontColor = m_fontColor->value(); + style.gridColor = m_gridColor->value(); + style.canvasMargin = m_canvasMargin->value(); + style.zoomInWidth = m_zoomInWidth->value(); + style.zoomInHeight = m_zoomInHeight->value(); + style.timeAxisHeight = m_timeAxisHeight->value(); + style.timeOffsetLeft = m_timeOffsetLeft->value(); + style.timeOffsetRight = m_timeOffsetRight->value(); + style.rangeBarColor = m_rangeBarColor->value(); + style.rangeBarCapsColor = m_rangeBarCapsColor->value(); + style.valueAxisWidth = m_valueAxisWidth->value(); + style.valueOffsetTop = m_valueOffsetTop->value(); + style.valueOffsetBottom = m_valueOffsetBottom->value(); + style.handleStyle.size = m_handleSize->value(); + style.handleStyle.lineWidth = m_handleLineWidth->value(); + style.handleStyle.color = m_handleColor->value(); + style.handleStyle.selectionColor = m_handleSelectionColor->value(); + style.keyframeStyle.size = m_keyframeSize->value(); + style.keyframeStyle.color = m_keyframeColor->value(); + style.keyframeStyle.selectionColor = m_keyframeSelectionColor->value(); + style.curveStyle.width = m_curveWidth->value(); + style.curveStyle.color = m_curveColor->value(); + style.curveStyle.selectionColor = m_curveSelectionColor->value(); + style.treeItemStyle.margins = m_treeMargins->value(); + style.playhead.width = m_playheadWidth->value(); + style.playhead.radius = m_playheadRadius->value(); + style.playhead.color = m_playheadColor->value(); + + return style; +} + +void CurveEditorStyleDialog::emitStyleChanged() +{ + emit styleChanged(style()); +} + +void CurveEditorStyleDialog::printStyle() +{ + auto toString = [](const QColor &color) { + QString tmp + = QString("QColor(%1, %2, %3)").arg(color.red()).arg(color.green()).arg(color.blue()); + return qPrintable(tmp); + }; + + CurveEditorStyle s = style(); + qDebug() << ""; + qDebug().nospace() << "CurveEditorStyle out;"; + qDebug().nospace() << "out.backgroundBrush = QBrush(" << toString(s.backgroundBrush.color()) + << ");"; + qDebug().nospace() << "out.backgroundAlternateBrush = QBrush(" + << toString(s.backgroundAlternateBrush.color()) << ");"; + qDebug().nospace() << "out.fontColor = " << toString(s.fontColor) << ";"; + qDebug().nospace() << "out.gridColor = " << toString(s.gridColor) << ";"; + qDebug().nospace() << "out.canvasMargin = " << s.canvasMargin << ";"; + qDebug().nospace() << "out.zoomInWidth = " << s.zoomInWidth << ";"; + qDebug().nospace() << "out.zoomInHeight = " << s.zoomInHeight << ";"; + qDebug().nospace() << "out.timeAxisHeight = " << s.timeAxisHeight << ";"; + qDebug().nospace() << "out.timeOffsetLeft = " << s.timeOffsetLeft << ";"; + qDebug().nospace() << "out.timeOffsetRight = " << s.timeOffsetRight << ";"; + qDebug().nospace() << "out.rangeBarColor = " << toString(s.rangeBarColor) << ";"; + qDebug().nospace() << "out.rangeBarCapsColor = " << toString(s.rangeBarCapsColor) << ";"; + qDebug().nospace() << "out.valueAxisWidth = " << s.valueAxisWidth << ";"; + qDebug().nospace() << "out.valueOffsetTop = " << s.valueOffsetTop << ";"; + qDebug().nospace() << "out.valueOffsetBottom = " << s.valueOffsetBottom << ";"; + qDebug().nospace() << "out.handleStyle.size = " << s.handleStyle.size << ";"; + qDebug().nospace() << "out.handleStyle.lineWidth = " << s.handleStyle.lineWidth << ";"; + qDebug().nospace() << "out.handleStyle.color = " << toString(s.handleStyle.color) << ";"; + qDebug().nospace() << "out.handleStyle.selectionColor = " + << toString(s.handleStyle.selectionColor) << ";"; + qDebug().nospace() << "out.keyframeStyle.size = " << s.keyframeStyle.size << ";"; + qDebug().nospace() << "out.keyframeStyle.color = " << toString(s.keyframeStyle.color) << ";"; + qDebug().nospace() << "out.keyframeStyle.selectionColor = " + << toString(s.keyframeStyle.selectionColor) << ";"; + qDebug().nospace() << "out.curveStyle.width = " << s.curveStyle.width << ";"; + qDebug().nospace() << "out.curveStyle.color = " << toString(s.curveStyle.color) << ";"; + qDebug().nospace() << "out.curveStyle.selectionColor = " + << toString(s.curveStyle.selectionColor) << ";"; + qDebug().nospace() << "out.treeItemStyle.margins = " << s.treeItemStyle.margins << ";"; + qDebug().nospace() << "out.playheadStyle.width = " << s.playhead.width << ";"; + qDebug().nospace() << "out.playheadStyle.radius = " << s.playhead.radius << ";"; + qDebug().nospace() << "out.playheadStyle.color = " << toString(s.playhead.color) << ";"; + qDebug().nospace() << "return out;"; + qDebug() << ""; +} + +} // End namespace DesignTools. diff --git a/src/plugins/qmldesigner/components/curveeditor/detail/curveeditorstyledialog.h b/src/plugins/qmldesigner/components/curveeditor/detail/curveeditorstyledialog.h new file mode 100644 index 00000000000..ad5a28e2e13 --- /dev/null +++ b/src/plugins/qmldesigner/components/curveeditor/detail/curveeditorstyledialog.h @@ -0,0 +1,125 @@ + +/**************************************************************************** +** +** Copyright (C) 2019 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the Qt Design Tooling +** +** 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 + +class QPushButton; +class QSpinBox; +class QDoubleSpinBox; + +namespace DesignTools { + +class ColorControl; + +struct CurveEditorStyle; + +class CurveEditorStyleDialog : public QDialog +{ + Q_OBJECT + +signals: + void styleChanged(const CurveEditorStyle &style); + +public: + CurveEditorStyleDialog(CurveEditorStyle &style, QWidget *parent = nullptr); + + CurveEditorStyle style() const; + +private: + void emitStyleChanged(); + + void printStyle(); + +private: + QPushButton *m_printButton; + + ColorControl *m_background; + + ColorControl *m_backgroundAlternate; + + ColorControl *m_fontColor; + + ColorControl *m_gridColor; + + QDoubleSpinBox *m_canvasMargin; + + QSpinBox *m_zoomInWidth; + + QSpinBox *m_zoomInHeight; + + QDoubleSpinBox *m_timeAxisHeight; + + QDoubleSpinBox *m_timeOffsetLeft; + + QDoubleSpinBox *m_timeOffsetRight; + + ColorControl *m_rangeBarColor; + + ColorControl *m_rangeBarCapsColor; + + QDoubleSpinBox *m_valueAxisWidth; + + QDoubleSpinBox *m_valueOffsetTop; + + QDoubleSpinBox *m_valueOffsetBottom; + + // HandleItem + QDoubleSpinBox *m_handleSize; + + QDoubleSpinBox *m_handleLineWidth; + + ColorControl *m_handleColor; + + ColorControl *m_handleSelectionColor; + + // KeyframeItem + QDoubleSpinBox *m_keyframeSize; + + ColorControl *m_keyframeColor; + + ColorControl *m_keyframeSelectionColor; + + // CurveItem + QDoubleSpinBox *m_curveWidth; + + ColorControl *m_curveColor; + + ColorControl *m_curveSelectionColor; + + // TreeItem + QDoubleSpinBox *m_treeMargins; + + // Playhead + QDoubleSpinBox *m_playheadWidth; + + QDoubleSpinBox *m_playheadRadius; + + ColorControl *m_playheadColor; +}; + +} // End namespace DesignTools. diff --git a/src/plugins/qmldesigner/components/curveeditor/detail/curveitem.cpp b/src/plugins/qmldesigner/components/curveeditor/detail/curveitem.cpp new file mode 100644 index 00000000000..5973e709bbb --- /dev/null +++ b/src/plugins/qmldesigner/components/curveeditor/detail/curveitem.cpp @@ -0,0 +1,224 @@ +/**************************************************************************** +** +** Copyright (C) 2019 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the Qt Design Tooling +** +** 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 "curveitem.h" +#include "animationcurve.h" +#include "graphicsscene.h" +#include "keyframeitem.h" +#include "utils.h" + +#include +#include + +namespace DesignTools { + +CurveItem::CurveItem(QGraphicsItem *parent) + : QGraphicsObject(parent) + , m_id(0) + , m_style() + , m_transform() + , m_keyframes() + , m_underMouse(false) + , m_itemDirty(false) + , m_pathDirty(true) +{} + +CurveItem::CurveItem(unsigned int id, const AnimationCurve &curve, QGraphicsItem *parent) + : QGraphicsObject(parent) + , m_id(id) + , m_style() + , m_transform() + , m_keyframes() + , m_underMouse(false) + , m_itemDirty(false) + , m_pathDirty(true) +{ + setAcceptHoverEvents(true); + + setFlag(QGraphicsItem::ItemIsMovable, false); + + auto emitCurveChanged = [this]() { + m_itemDirty = true; + m_pathDirty = true; + update(); + }; + + for (auto frame : curve.keyframes()) { + auto *item = new KeyframeItem(frame, this); + QObject::connect(item, &KeyframeItem::redrawCurve, emitCurveChanged); + m_keyframes.push_back(item); + } +} + +CurveItem::~CurveItem() {} + +int CurveItem::type() const +{ + return Type; +} + +QRectF CurveItem::boundingRect() const +{ + auto bbox = [](QRectF &bounds, const Keyframe &frame) { + grow(bounds, frame.position()); + grow(bounds, frame.leftHandle()); + grow(bounds, frame.rightHandle()); + }; + + QRectF bounds; + for (auto *item : m_keyframes) + bbox(bounds, item->keyframe()); + + return m_transform.mapRect(bounds); +} + +bool CurveItem::contains(const QPointF &point) const +{ + bool valid = false; + QPointF transformed(m_transform.inverted(&valid).map(point)); + + double width = abs(20.0 / scaleY(m_transform)); + + if (valid) + return curve().intersects(transformed, width); + + return false; +} + +void CurveItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *, QWidget *) +{ + if (m_keyframes.size() > 1) { + QPen pen = painter->pen(); + QColor col = m_underMouse ? Qt::red : m_style.color; + + pen.setWidthF(m_style.width); + pen.setColor(hasSelection() ? m_style.selectionColor : col); + + painter->save(); + painter->setPen(pen); + painter->drawPath(path()); + + painter->restore(); + } +} + +bool CurveItem::isDirty() const +{ + return m_itemDirty; +} + +bool CurveItem::hasSelection() const +{ + for (auto *frame : m_keyframes) { + if (frame->selected()) + return true; + } + + return false; +} + +unsigned int CurveItem::id() const +{ + return m_id; +} + +QPainterPath CurveItem::path() const +{ + if (m_pathDirty) { + Keyframe previous = m_keyframes.front()->keyframe(); + Keyframe current; + + m_path = QPainterPath(m_transform.map(previous.position())); + for (size_t i = 1; i < m_keyframes.size(); ++i) { + current = m_keyframes[i]->keyframe(); + + if (previous.rightHandle().isNull() || current.leftHandle().isNull()) { + m_path.lineTo(m_transform.map(current.position())); + } else { + m_path.cubicTo( + m_transform.map(previous.rightHandle()), + m_transform.map(current.leftHandle()), + m_transform.map(current.position())); + } + + previous = current; + } + m_pathDirty = false; + } + + return m_path; +} + +AnimationCurve CurveItem::curve() const +{ + std::vector out; + out.reserve(m_keyframes.size()); + for (auto item : m_keyframes) + out.push_back(item->keyframe()); + + return out; +} + +void CurveItem::setDirty(bool dirty) +{ + m_itemDirty = dirty; +} + +QRectF CurveItem::setComponentTransform(const QTransform &transform) +{ + m_pathDirty = true; + + prepareGeometryChange(); + m_transform = transform; + for (auto frame : m_keyframes) + frame->setComponentTransform(transform); + + return boundingRect(); +} + +void CurveItem::setStyle(const CurveEditorStyle &style) +{ + m_style = style.curveStyle; + + for (auto *frame : m_keyframes) + frame->setStyle(style); +} + +void CurveItem::connect(GraphicsScene *scene) +{ + for (auto *frame : m_keyframes) { + QObject::connect(frame, &KeyframeItem::keyframeMoved, scene, &GraphicsScene::keyframeMoved); + QObject::connect(frame, &KeyframeItem::handleMoved, scene, &GraphicsScene::handleMoved); + } +} + +void CurveItem::setIsUnderMouse(bool under) +{ + if (under != m_underMouse) { + m_underMouse = under; + update(); + } +} + +} // End namespace DesignTools. diff --git a/src/plugins/qmldesigner/components/curveeditor/detail/curveitem.h b/src/plugins/qmldesigner/components/curveeditor/detail/curveitem.h new file mode 100644 index 00000000000..90e68e20f1c --- /dev/null +++ b/src/plugins/qmldesigner/components/curveeditor/detail/curveitem.h @@ -0,0 +1,98 @@ +/**************************************************************************** +** +** Copyright (C) 2019 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the Qt Design Tooling +** +** 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 "curveeditorstyle.h" +#include "selectableitem.h" + +#include + +namespace DesignTools { + +class AnimationCurve; +class KeyframeItem; +class GraphicsScene; + +class CurveItem : public QGraphicsObject +{ + Q_OBJECT + +public: + CurveItem(QGraphicsItem *parent = nullptr); + + CurveItem(unsigned int id, const AnimationCurve &curve, QGraphicsItem *parent = nullptr); + + ~CurveItem() override; + + enum { Type = ItemTypeCurve }; + + int type() const override; + + QRectF boundingRect() const override; + + bool contains(const QPointF &point) const override; + + void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) override; + + bool isDirty() const; + + bool hasSelection() const; + + unsigned int id() const; + + AnimationCurve curve() const; + + void setDirty(bool dirty); + + QRectF setComponentTransform(const QTransform &transform); + + void setStyle(const CurveEditorStyle &style); + + void connect(GraphicsScene *scene); + + void setIsUnderMouse(bool under); + +private: + QPainterPath path() const; + + unsigned int m_id; + + CurveItemStyleOption m_style; + + QTransform m_transform; + + std::vector m_keyframes; + + bool m_underMouse; + + bool m_itemDirty; + + mutable bool m_pathDirty; + + mutable QPainterPath m_path; +}; + +} // End namespace DesignTools. diff --git a/src/plugins/qmldesigner/components/curveeditor/detail/curvesegment.cpp b/src/plugins/qmldesigner/components/curveeditor/detail/curvesegment.cpp new file mode 100644 index 00000000000..40f675f3ecb --- /dev/null +++ b/src/plugins/qmldesigner/components/curveeditor/detail/curvesegment.cpp @@ -0,0 +1,277 @@ +/**************************************************************************** +** +** Copyright (C) 2019 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the Qt Design Tooling +** +** 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 "curvesegment.h" +#include "utils.h" + +#include + +#include + +namespace DesignTools { + +class CubicPolynomial +{ +public: + CubicPolynomial(double p0, double p1, double p2, double p3); + + std::vector extrema() const; + + std::vector roots() const; + +private: + double m_a; + double m_b; + double m_c; + double m_d; +}; + +CubicPolynomial::CubicPolynomial(double p0, double p1, double p2, double p3) + : m_a(p3 - 3.0 * p2 + 3.0 * p1 - p0) + , m_b(3.0 * p2 - 6.0 * p1 + 3.0 * p0) + , m_c(3.0 * p1 - 3.0 * p0) + , m_d(p0) +{} + +std::vector CubicPolynomial::extrema() const +{ + std::vector out; + + auto addValidValue = [&out](double value) { + if (!std::isnan(value) && !std::isinf(value)) + out.push_back(clamp(value, 0.0, 1.0)); + }; + + // Find the roots of the first derivative of y. + auto pd2 = (2.0 * m_b) / (3.0 * m_a) / 2.0; + auto q = m_c / (3.0 * m_a); + + auto radi = std::pow(pd2, 2.0) - q; + + auto x1 = -pd2 + std::sqrt(radi); + auto x2 = -pd2 - std::sqrt(radi); + + addValidValue(x1); + addValidValue(x2); + + return out; +} + +std::vector CubicPolynomial::roots() const +{ + std::vector out; + + auto addValidValue = [&out](double value) { + if (!(std::isnan(value) || std::isinf(value))) + out.push_back(value); + }; + + if (m_a == 0.0) { + // Linear + if (m_b == 0.0) { + if (m_c != 0.0) + out.push_back(-m_d / m_c); + // Quadratic + } else { + const double p = m_c / m_b / 2.0; + const double q = m_d / m_b; + addValidValue(-p + std::sqrt(std::pow(p, 2.0) - q)); + addValidValue(-p - std::sqrt(std::pow(p, 2.0) - q)); + } + // Cubic + } else { + const double p = 3.0 * m_a * m_c - std::pow(m_b, 2.0); + const double q = 2.0 * std::pow(m_b, 3.0) - 9.0 * m_a * m_b * m_c + + 27.0 * std::pow(m_a, 2.0) * m_d; + + auto disc = std::pow(q, 2.0) + 4.0 * std::pow(p, 3.0); + + auto toX = [&](double y) { return (y - m_b) / (3.0 * m_a); }; + + // One real solution. + if (disc >= 0) { + auto u = (1.0 / 2.0) + * std::cbrt(-4.0 * q + + 4.0 * std::sqrt(std::pow(q, 2.0) + 4.0 * std::pow(p, 3.0))); + auto v = (1.0 / 2.0) + * std::cbrt(-4.0 * q + - 4.0 * std::sqrt(std::pow(q, 2.0) + 4.0 * std::pow(p, 3.0))); + + addValidValue(toX(u + v)); + // Three real solutions. + } else { + auto phi = acos(-q / (2 * std::sqrt(-std::pow(p, 3.0)))); + auto y1 = std::sqrt(-p) * 2.0 * cos(phi / 3.0); + auto y2 = std::sqrt(-p) * 2.0 * cos((phi / 3.0) + (2.0 * M_PI / 3.0)); + auto y3 = std::sqrt(-p) * 2.0 * cos((phi / 3.0) + (4.0 * M_PI / 3.0)); + + addValidValue(toX(y1)); + addValidValue(toX(y2)); + addValidValue(toX(y3)); + } + } + return out; +} + +CurveSegment::CurveSegment() + : m_left() + , m_right() +{} + +CurveSegment::CurveSegment(const Keyframe &left, const Keyframe &right) + : m_left(left) + , m_right(right) +{} + +bool CurveSegment::containsX(double x) const +{ + return m_left.position().x() <= x && m_right.position().x() >= x; +} + +double evaluateForT(double t, double p0, double p1, double p2, double p3) +{ + assert(t >= 0. && t <= 1.); + + const double it = 1.0 - t; + + return p0 * std::pow(it, 3.0) + p1 * 3.0 * std::pow(it, 2.0) * t + + p2 * 3.0 * it * std::pow(t, 2.0) + p3 * std::pow(t, 3.0); +} + +QPointF CurveSegment::evaluate(double t) const +{ + const double x = evaluateForT( + t, + m_left.position().x(), + m_left.rightHandle().x(), + m_right.leftHandle().x(), + m_right.position().x()); + + const double y = evaluateForT( + t, + m_left.position().y(), + m_left.rightHandle().y(), + m_right.leftHandle().y(), + m_right.position().y()); + + return QPointF(x, y); +} + +std::vector CurveSegment::extrema() const +{ + std::vector out; + + auto polynomial = CubicPolynomial( + m_left.position().y(), + m_left.rightHandle().y(), + m_right.leftHandle().y(), + m_right.position().y()); + + for (double t : polynomial.extrema()) { + + const double x = evaluateForT( + t, + m_left.position().x(), + m_left.rightHandle().x(), + m_right.leftHandle().x(), + m_right.position().x()); + + const double y = evaluateForT( + t, + m_left.position().y(), + m_left.rightHandle().y(), + m_right.leftHandle().y(), + m_right.position().y()); + + out.push_back(QPointF(x, y)); + } + return out; +} + +std::vector CurveSegment::yForX(double x) const +{ + std::vector out; + + auto polynomial = CubicPolynomial( + m_left.position().x() - x, + m_left.rightHandle().x() - x, + m_right.leftHandle().x() - x, + m_right.position().x() - x); + + for (double t : polynomial.roots()) { + if (t < 0.0 || t > 1.0) + continue; + + const double y = evaluateForT( + t, + m_left.position().y(), + m_left.rightHandle().y(), + m_right.leftHandle().y(), + m_right.position().y()); + + out.push_back(y); + } + + return out; +} + +std::vector CurveSegment::xForY(double y) const +{ + std::vector out; + + auto polynomial = CubicPolynomial( + m_left.position().y() - y, + m_left.rightHandle().y() - y, + m_right.leftHandle().y() - y, + m_right.position().y() - y); + + for (double t : polynomial.roots()) { + if (t < 0.0 || t > 1.0) + continue; + + const double x = evaluateForT( + t, + m_left.position().x(), + m_left.rightHandle().x(), + m_right.leftHandle().x(), + m_right.position().x()); + + out.push_back(x); + } + + return out; +} + +void CurveSegment::setLeft(const Keyframe &frame) +{ + m_left = frame; +} + +void CurveSegment::setRight(const Keyframe &frame) +{ + m_right = frame; +} + +} // End namespace DesignTools. diff --git a/src/plugins/qmldesigner/components/curveeditor/detail/curvesegment.h b/src/plugins/qmldesigner/components/curveeditor/detail/curvesegment.h new file mode 100644 index 00000000000..ce2d700f891 --- /dev/null +++ b/src/plugins/qmldesigner/components/curveeditor/detail/curvesegment.h @@ -0,0 +1,63 @@ +/**************************************************************************** +** +** Copyright (C) 2019 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the Qt Design Tooling +** +** 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 "keyframe.h" + +#include + +class QPointF; + +namespace DesignTools { + +class CurveSegment +{ +public: + CurveSegment(); + + CurveSegment(const Keyframe &first, const Keyframe &last); + + bool containsX(double x) const; + + QPointF evaluate(double t) const; + + std::vector extrema() const; + + std::vector yForX(double x) const; + + std::vector xForY(double y) const; + + void setLeft(const Keyframe &frame); + + void setRight(const Keyframe &frame); + +private: + Keyframe m_left; + + Keyframe m_right; +}; + +} // End namespace DesignTools. diff --git a/src/plugins/qmldesigner/components/curveeditor/detail/graphicsscene.cpp b/src/plugins/qmldesigner/components/curveeditor/detail/graphicsscene.cpp new file mode 100644 index 00000000000..096e57aafab --- /dev/null +++ b/src/plugins/qmldesigner/components/curveeditor/detail/graphicsscene.cpp @@ -0,0 +1,225 @@ +/**************************************************************************** +** +** Copyright (C) 2019 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the Qt Design Tooling +** +** 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 "graphicsscene.h" +#include "animationcurve.h" +#include "curveitem.h" +#include "graphicsview.h" +#include "handleitem.h" + +#include + +namespace DesignTools { + +GraphicsScene::GraphicsScene(QObject *parent) + : QGraphicsScene(parent) + , m_dirty(true) + , m_limits() +{} + +bool GraphicsScene::empty() const +{ + return items().empty(); +} + +double GraphicsScene::minimumTime() const +{ + return limits().left(); +} + +double GraphicsScene::maximumTime() const +{ + return limits().right(); +} + +double GraphicsScene::minimumValue() const +{ + return limits().bottom(); +} + +double GraphicsScene::maximumValue() const +{ + return limits().top(); +} + +void GraphicsScene::addCurveItem(CurveItem *item) +{ + m_dirty = true; + addItem(item); + item->connect(this); +} + +void GraphicsScene::setComponentTransform(const QTransform &transform) +{ + QRectF bounds; + const auto itemList = items(); + for (auto *item : itemList) { + if (auto *curveItem = qgraphicsitem_cast(item)) + bounds = bounds.united(curveItem->setComponentTransform(transform)); + } + + if (bounds.isNull()) { + if (GraphicsView *gview = graphicsView()) + bounds = gview->defaultRasterRect(); + } + + if (bounds.isValid()) + setSceneRect(bounds); +} + +void GraphicsScene::keyframeMoved(KeyframeItem *movedItem, const QPointF &direction) +{ + const auto itemList = items(); + for (auto *item : itemList) { + if (item == movedItem) + continue; + + if (auto *frameItem = qgraphicsitem_cast(item)) { + if (frameItem->selected()) + frameItem->moveKeyframe(direction); + } + } +} + +void GraphicsScene::handleMoved(KeyframeItem *frame, + HandleSlot handle, + double angle, + double deltaLength) +{ + const auto itemList = items(); + for (auto *item : itemList) { + if (item == frame) + continue; + + if (auto *frameItem = qgraphicsitem_cast(item)) { + if (frameItem->selected()) + frameItem->moveHandle(handle, angle, deltaLength); + } + } +} + +void GraphicsScene::mouseMoveEvent(QGraphicsSceneMouseEvent *mouseEvent) +{ + QGraphicsScene::mouseMoveEvent(mouseEvent); + + if (hasActiveItem()) + return; + + const auto itemList = items(); + for (auto *item : itemList) { + if (auto *curveItem = qgraphicsitem_cast(item)) + curveItem->setIsUnderMouse(curveItem->contains(mouseEvent->scenePos())); + } +} + +void GraphicsScene::mouseReleaseEvent(QGraphicsSceneMouseEvent *mouseEvent) +{ + QGraphicsScene::mouseReleaseEvent(mouseEvent); + + const auto itemList = items(); + for (auto *item : itemList) { + if (auto *curveItem = qgraphicsitem_cast(item)) { + if (curveItem->contains(mouseEvent->scenePos())) + curveItem->setSelected(true); + + if (curveItem->isDirty()) { + emit curveChanged(curveItem->id(), curveItem->curve()); + curveItem->setDirty(false); + m_dirty = true; + } + } + } +} + +bool GraphicsScene::hasActiveKeyframe() const +{ + const auto itemList = items(); + for (auto *item : itemList) { + if (auto *kitem = qgraphicsitem_cast(item)) { + if (kitem->activated()) + return true; + } + } + return false; +} + +bool GraphicsScene::hasActiveHandle() const +{ + const auto itemList = items(); + for (auto *item : itemList) { + if (auto *hitem = qgraphicsitem_cast(item)) { + if (hitem->activated()) + return true; + } + } + return false; +} + +bool GraphicsScene::hasActiveItem() const +{ + return hasActiveKeyframe() || hasActiveHandle(); +} + +GraphicsView *GraphicsScene::graphicsView() const +{ + const QList viewList = views(); + for (auto &&view : viewList) { + if (GraphicsView *gview = qobject_cast(view)) + return gview; + } + return nullptr; +} + +QRectF GraphicsScene::limits() const +{ + if (m_dirty) { + QPointF min(std::numeric_limits::max(), std::numeric_limits::max()); + QPointF max(std::numeric_limits::lowest(), std::numeric_limits::lowest()); + + const auto itemList = items(); + for (auto *item : itemList) { + if (auto *curveItem = qgraphicsitem_cast(item)) { + auto curve = curveItem->curve(); + if (min.x() > curve.minimumTime()) + min.rx() = curve.minimumTime(); + + if (min.y() > curve.minimumValue()) + min.ry() = curve.minimumValue(); + + if (max.x() < curve.maximumTime()) + max.rx() = curve.maximumTime(); + + if (max.y() < curve.maximumValue()) + max.ry() = curve.maximumValue(); + } + } + + m_limits = QRectF(QPointF(min.x(), max.y()), QPointF(max.x(), min.y())); + m_dirty = false; + } + return m_limits; +} + +} // End namespace DesignTools. diff --git a/src/plugins/qmldesigner/components/curveeditor/detail/graphicsscene.h b/src/plugins/qmldesigner/components/curveeditor/detail/graphicsscene.h new file mode 100644 index 00000000000..981c326b5a0 --- /dev/null +++ b/src/plugins/qmldesigner/components/curveeditor/detail/graphicsscene.h @@ -0,0 +1,89 @@ +/**************************************************************************** +** +** Copyright (C) 2019 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the Qt Design Tooling +** +** 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 "keyframeitem.h" + +#include + +namespace DesignTools { + +class AnimationCurve; +class CurveItem; +class GraphicsView; + +class GraphicsScene : public QGraphicsScene +{ + Q_OBJECT + +signals: + void curveChanged(unsigned int id, const AnimationCurve &curve); + +public: + GraphicsScene(QObject *parent = nullptr); + + bool empty() const; + + bool hasActiveKeyframe() const; + + bool hasActiveHandle() const; + + bool hasActiveItem() const; + + double minimumTime() const; + + double maximumTime() const; + + double minimumValue() const; + + double maximumValue() const; + + void addCurveItem(CurveItem *item); + + void setComponentTransform(const QTransform &transform); + + void keyframeMoved(KeyframeItem *item, const QPointF &direction); + + void handleMoved(KeyframeItem *frame, HandleSlot handle, double angle, double deltaLength); + +protected: + void mouseMoveEvent(QGraphicsSceneMouseEvent *mouseEvent) override; + + void mouseReleaseEvent(QGraphicsSceneMouseEvent *mouseEvent) override; + +private: + using QGraphicsScene::addItem; + + GraphicsView *graphicsView() const; + + QRectF limits() const; + + mutable bool m_dirty; + + mutable QRectF m_limits; +}; + +} // End namespace DesignTools. diff --git a/src/plugins/qmldesigner/components/curveeditor/detail/graphicsview.cpp b/src/plugins/qmldesigner/components/curveeditor/detail/graphicsview.cpp new file mode 100644 index 00000000000..ae60888d1f7 --- /dev/null +++ b/src/plugins/qmldesigner/components/curveeditor/detail/graphicsview.cpp @@ -0,0 +1,523 @@ +/**************************************************************************** +** +** Copyright (C) 2019 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the Qt Design Tooling +** +** 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 "graphicsview.h" +#include "curveeditormodel.h" +#include "curveitem.h" +#include "utils.h" + +#include +#include +#include +#include + +#include + +namespace DesignTools { + +GraphicsView::GraphicsView(CurveEditorModel *model, QWidget *parent) + : QGraphicsView(parent) + , m_zoomX(0.0) + , m_zoomY(0.0) + , m_transform() + , m_scene() + , m_model(model) + , m_playhead(this) + , m_selector() + , m_style(model->style()) + , m_dialog(m_style) +{ + model->setGraphicsView(this); + + setScene(&m_scene); + setAlignment(Qt::AlignLeft | Qt::AlignVCenter); + setResizeAnchor(QGraphicsView::NoAnchor); + setTransformationAnchor(QGraphicsView::NoAnchor); + setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOn); + setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOn); + setViewportUpdateMode(QGraphicsView::FullViewportUpdate); + + connect(&m_dialog, &CurveEditorStyleDialog::styleChanged, this, &GraphicsView::setStyle); + + auto itemSlot = [this](unsigned int id, const AnimationCurve &curve) { + applyZoom(m_zoomX, m_zoomY); + m_model->setCurve(id, curve); + }; + + connect(&m_scene, &GraphicsScene::curveChanged, itemSlot); + + applyZoom(m_zoomX, m_zoomY); + update(); +} + +CurveEditorModel *GraphicsView::model() const +{ + return m_model; +} + +CurveEditorStyle GraphicsView::editorStyle() const +{ + return m_style; +} + +bool GraphicsView::hasActiveItem() const +{ + return m_scene.hasActiveItem(); +} + +bool GraphicsView::hasActiveHandle() const +{ + return m_scene.hasActiveHandle(); +} + +double GraphicsView::minimumTime() const +{ + bool check = m_model->minimumTime() < m_scene.minimumTime(); + return check ? m_model->minimumTime() : m_scene.minimumTime(); +} + +double GraphicsView::maximumTime() const +{ + bool check = m_model->maximumTime() > m_scene.maximumTime(); + return check ? m_model->maximumTime() : m_scene.maximumTime(); +} + +double GraphicsView::minimumValue() const +{ + return m_scene.empty() ? -1.0 : m_scene.minimumValue(); +} + +double GraphicsView::maximumValue() const +{ + return m_scene.empty() ? 1.0 : m_scene.maximumValue(); +} + +double GraphicsView::zoomX() const +{ + return m_zoomX; +} + +double GraphicsView::zoomY() const +{ + return m_zoomY; +} + +QRectF GraphicsView::canvasRect() const +{ + QRect r = viewport()->rect().adjusted( + m_style.valueAxisWidth + m_style.canvasMargin, + m_style.timeAxisHeight + m_style.canvasMargin, + -m_style.canvasMargin, + -m_style.canvasMargin); + + return mapToScene(r).boundingRect(); +} + +QRectF GraphicsView::timeScaleRect() const +{ + QRect vp(viewport()->rect()); + QPoint tl = vp.topLeft() + QPoint(m_style.valueAxisWidth, 0); + QPoint br = vp.topRight() + QPoint(0, m_style.timeAxisHeight); + return mapToScene(QRect(tl, br)).boundingRect(); +} + +QRectF GraphicsView::valueScaleRect() const +{ + QRect vp(viewport()->rect()); + QPoint tl = vp.topLeft() + QPoint(0, m_style.timeAxisHeight); + QPoint br = vp.bottomLeft() + QPoint(m_style.valueAxisWidth, 0); + return mapToScene(QRect(tl, br)).boundingRect(); +} + +QRectF GraphicsView::defaultRasterRect() const +{ + QPointF topLeft(mapTimeToX(minimumTime()), mapValueToY(maximumValue())); + QPointF bottomRight(mapTimeToX(maximumTime()), mapValueToY(minimumValue())); + return QRectF(topLeft, bottomRight); +} + +void GraphicsView::setStyle(const CurveEditorStyle &style) +{ + m_style = style; + + const auto itemList = items(); + for (auto *item : itemList) { + if (auto *curveItem = qgraphicsitem_cast(item)) + curveItem->setStyle(style); + } + + applyZoom(m_zoomX, m_zoomY); + viewport()->update(); +} + +void GraphicsView::setZoomX(double zoom, const QPoint &pivot) +{ + applyZoom(zoom, m_zoomY, pivot); + viewport()->update(); +} + +void GraphicsView::setZoomY(double zoom, const QPoint &pivot) +{ + applyZoom(m_zoomX, zoom, pivot); + viewport()->update(); +} + +void GraphicsView::setCurrentFrame(int frame) +{ + int clampedFrame = clamp(frame, m_model->minimumTime(), m_model->maximumTime()); + m_playhead.moveToFrame(clampedFrame, this); + viewport()->update(); +} + +void GraphicsView::scrollContent(double x, double y) +{ + QScrollBar *hs = horizontalScrollBar(); + QScrollBar *vs = verticalScrollBar(); + hs->setValue(hs->value() + x); + vs->setValue(vs->value() + y); +} + +void GraphicsView::reset(const std::vector &items) +{ + m_scene.clear(); + for (auto *item : items) + m_scene.addCurveItem(item); + + applyZoom(m_zoomX, m_zoomY); + viewport()->update(); +} + +void GraphicsView::resizeEvent(QResizeEvent *event) +{ + QGraphicsView::resizeEvent(event); + applyZoom(m_zoomX, m_zoomY); +} + +void GraphicsView::keyPressEvent(QKeyEvent *event) +{ + Shortcut shortcut(event->modifiers(), static_cast(event->key())); + if (shortcut == m_style.shortcuts.frameAll) + applyZoom(0.0, 0.0); +} + +void GraphicsView::mousePressEvent(QMouseEvent *event) +{ + if (m_playhead.mousePress(globalToScene(event->globalPos()))) + return; + + Shortcut shortcut(event); + if (shortcut == Shortcut(Qt::LeftButton)) { + QPointF pos = mapToScene(event->pos()); + if (timeScaleRect().contains(pos)) { + setCurrentFrame(std::round(mapXtoTime(pos.x()))); + event->accept(); + return; + } + } + + QGraphicsView::mousePressEvent(event); + + m_selector.mousePress(event, this); +} + +void GraphicsView::mouseMoveEvent(QMouseEvent *event) +{ + if (m_playhead.mouseMove(globalToScene(event->globalPos()), this)) + return; + + QGraphicsView::mouseMoveEvent(event); + + m_selector.mouseMove(event, this, m_playhead); +} + +void GraphicsView::mouseReleaseEvent(QMouseEvent *event) +{ + QGraphicsView::mouseReleaseEvent(event); + + m_playhead.mouseRelease(this); + m_selector.mouseRelease(event, this); + this->viewport()->update(); +} + +void GraphicsView::wheelEvent(QWheelEvent *event) +{ + if (event->modifiers().testFlag(Qt::AltModifier)) + return; + + QGraphicsView::wheelEvent(event); +} + +void GraphicsView::contextMenuEvent(QContextMenuEvent *event) +{ + if (event->modifiers() != Qt::NoModifier) + return; + + auto openStyleEditor = [this]() { m_dialog.show(); }; + + QMenu menu; + QAction *openEditorAction = menu.addAction(tr("Open Style Editor")); + connect(openEditorAction, &QAction::triggered, openStyleEditor); + + menu.exec(event->globalPos()); +} + +void GraphicsView::drawForeground(QPainter *painter, const QRectF &rect) +{ + QRectF abscissa = timeScaleRect(); + if (abscissa.isValid()) + drawTimeScale(painter, abscissa); + + auto ordinate = valueScaleRect(); + if (ordinate.isValid()) + drawValueScale(painter, ordinate); + + m_playhead.paint(painter, this); + + painter->fillRect(QRectF(rect.topLeft(), abscissa.bottomLeft()), + m_style.backgroundAlternateBrush); + + m_selector.paint(painter); +} + +void GraphicsView::drawBackground(QPainter *painter, const QRectF &rect) +{ + painter->fillRect(rect, m_style.backgroundBrush); + painter->fillRect(scene()->sceneRect(), m_style.backgroundAlternateBrush); + + drawGrid(painter, rect); + drawExtremaX(painter, rect); + drawExtremaY(painter, rect); +} + +int GraphicsView::mapTimeToX(double time) const +{ + return std::round(time * scaleX(m_transform)); +} + +int GraphicsView::mapValueToY(double y) const +{ + return std::round(y * scaleY(m_transform)); +} + +double GraphicsView::mapXtoTime(int x) const +{ + return static_cast(x) / scaleX(m_transform); +} + +double GraphicsView::mapYtoValue(int y) const +{ + return static_cast(y) / scaleY(m_transform); +} + +QPointF GraphicsView::globalToScene(const QPoint &point) const +{ + return mapToScene(viewport()->mapFromGlobal(point)); +} + +QPointF GraphicsView::globalToRaster(const QPoint &point) const +{ + QPointF scene = globalToScene(point); + return QPointF(mapXtoTime(scene.x()), mapYtoValue(scene.y())); +} + +void GraphicsView::applyZoom(double x, double y, const QPoint &pivot) +{ + QPointF pivotRaster(globalToRaster(pivot)); + + m_zoomX = clamp(x, 0.0, 1.0); + m_zoomY = clamp(y, 0.0, 1.0); + + double minTime = minimumTime(); + double maxTime = maximumTime(); + + double minValue = minimumValue(); + double maxValue = maximumValue(); + + QRectF canvas = canvasRect(); + + double xZoomedOut = canvas.width() / (maxTime - minTime); + double xZoomedIn = m_style.zoomInWidth; + double scaleX = lerp(clamp(m_zoomX, 0.0, 1.0), xZoomedOut, xZoomedIn); + + double yZoomedOut = canvas.height() / (maxValue - minValue); + double yZoomedIn = m_style.zoomInHeight; + double scaleY = lerp(clamp(m_zoomY, 0.0, 1.0), -yZoomedOut, -yZoomedIn); + + m_transform = QTransform::fromScale(scaleX, scaleY); + + m_scene.setComponentTransform(m_transform); + + QRectF sr = m_scene.sceneRect().adjusted( + -m_style.valueAxisWidth - m_style.canvasMargin, + -m_style.timeAxisHeight - m_style.canvasMargin, + m_style.canvasMargin, + m_style.canvasMargin); + + setSceneRect(sr); + + m_playhead.resize(this); + + if (!pivot.isNull()) { + QPointF deltaTransformed = pivotRaster - globalToRaster(pivot); + scrollContent(mapTimeToX(deltaTransformed.x()), mapValueToY(deltaTransformed.y())); + } +} + +void GraphicsView::drawGrid(QPainter *painter, const QRectF &rect) +{ + QRectF gridRect = rect.adjusted( + m_style.valueAxisWidth + m_style.canvasMargin, + m_style.timeAxisHeight + m_style.canvasMargin, + -m_style.canvasMargin, + -m_style.canvasMargin); + + if (!gridRect.isValid()) + return; + + auto drawVerticalLine = [painter, gridRect](double position) { + painter->drawLine(position, gridRect.top(), position, gridRect.bottom()); + }; + + painter->save(); + painter->setPen(m_style.gridColor); + + double timeIncrement = timeLabelInterval(painter, m_model->maximumTime()); + for (double i = minimumTime(); i <= maximumTime(); i += timeIncrement) + drawVerticalLine(mapTimeToX(i)); + + painter->restore(); +} + +void GraphicsView::drawExtremaX(QPainter *painter, const QRectF &rect) +{ + auto drawVerticalLine = [rect, painter](double position) { + painter->drawLine(position, rect.top(), position, rect.bottom()); + }; + + painter->save(); + painter->setPen(Qt::red); + drawVerticalLine(mapTimeToX(m_model->minimumTime())); + drawVerticalLine(mapTimeToX(m_model->maximumTime())); + painter->restore(); +} + +void GraphicsView::drawExtremaY(QPainter *painter, const QRectF &rect) +{ + if (m_scene.empty()) + return; + + auto drawHorizontalLine = [rect, painter](double position) { + painter->drawLine(rect.left(), position, rect.right(), position); + }; + + painter->save(); + painter->setPen(Qt::blue); + drawHorizontalLine(mapValueToY(m_scene.minimumValue())); + drawHorizontalLine(mapValueToY(m_scene.maximumValue())); + + drawHorizontalLine(mapValueToY(0.0)); + + painter->restore(); +} + +void GraphicsView::drawTimeScale(QPainter *painter, const QRectF &rect) +{ + painter->save(); + painter->setPen(m_style.fontColor); + painter->fillRect(rect, m_style.backgroundAlternateBrush); + + QFontMetrics fm(painter->font()); + + auto paintLabeledTick = [this, painter, rect, fm](double time) { + QString timeText = QString("%1").arg(time); + + int position = mapTimeToX(time); + + QRect textRect = fm.boundingRect(timeText); + textRect.moveCenter(QPoint(position, rect.center().y())); + + painter->drawText(textRect, Qt::AlignCenter, timeText); + painter->drawLine(position, rect.bottom() - 2, position, textRect.bottom() + 2); + }; + + double timeIncrement = timeLabelInterval(painter, maximumTime()); + for (double i = minimumTime(); i <= maximumTime(); i += timeIncrement) + paintLabeledTick(i); + + painter->restore(); +} + +void GraphicsView::drawValueScale(QPainter *painter, const QRectF &rect) +{ + painter->save(); + painter->setPen(m_style.fontColor); + painter->fillRect(rect, m_style.backgroundAlternateBrush); + + QFontMetrics fm(painter->font()); + auto paintLabeledTick = [this, painter, rect, fm](double value) { + QString valueText = QString("%1").arg(value); + + int position = mapValueToY(value); + + QRect textRect = fm.boundingRect(valueText); + textRect.moveCenter(QPoint(rect.center().x(), position)); + painter->drawText(textRect, Qt::AlignCenter, valueText); + }; + + paintLabeledTick(minimumValue()); + paintLabeledTick(maximumValue()); + painter->restore(); +} + +double GraphicsView::timeLabelInterval(QPainter *painter, double maxTime) +{ + QFontMetrics fm(painter->font()); + int minTextSpacing = fm.width(QString("X%1X").arg(maxTime)); + + int deltaTime = 1; + int nextFactor = 5; + + double tickDistance = mapTimeToX(deltaTime); + + while (true) { + if (tickDistance == 0 && deltaTime > maxTime) + return maxTime; + + if (tickDistance > minTextSpacing) + break; + + deltaTime *= nextFactor; + tickDistance = mapTimeToX(deltaTime); + + if (nextFactor == 5) + nextFactor = 2; + else + nextFactor = 5; + } + + return deltaTime; +} + +} // End namespace DesignTools. diff --git a/src/plugins/qmldesigner/components/curveeditor/detail/graphicsview.h b/src/plugins/qmldesigner/components/curveeditor/detail/graphicsview.h new file mode 100644 index 00000000000..1975e3696db --- /dev/null +++ b/src/plugins/qmldesigner/components/curveeditor/detail/graphicsview.h @@ -0,0 +1,157 @@ +/**************************************************************************** +** +** Copyright (C) 2019 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the Qt Design Tooling +** +** 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 "curveeditorstyle.h" +#include "curveeditorstyledialog.h" +#include "graphicsscene.h" +#include "playhead.h" +#include "selector.h" + +#include + +namespace DesignTools { + +class CurveItem; +class CurveEditorModel; +class Playhead; + +class GraphicsView : public QGraphicsView +{ + Q_OBJECT + + friend class Playhead; + +public: + GraphicsView(CurveEditorModel *model, QWidget *parent = nullptr); + + CurveEditorModel *model() const; + + CurveEditorStyle editorStyle() const; + + bool hasActiveItem() const; + + bool hasActiveHandle() const; + + int mapTimeToX(double time) const; + + int mapValueToY(double value) const; + + double mapXtoTime(int x) const; + + double mapYtoValue(int y) const; + + QPointF globalToScene(const QPoint &point) const; + + QPointF globalToRaster(const QPoint &point) const; + + double minimumTime() const; + + double maximumTime() const; + + double minimumValue() const; + + double maximumValue() const; + + double zoomX() const; + + double zoomY() const; + + QRectF canvasRect() const; + + QRectF timeScaleRect() const; + + QRectF valueScaleRect() const; + + QRectF defaultRasterRect() const; + + void setStyle(const CurveEditorStyle &style); + + void setZoomX(double zoom, const QPoint &pivot = QPoint()); + + void setZoomY(double zoom, const QPoint &pivot = QPoint()); + + void setCurrentFrame(int frame); + + void scrollContent(double x, double y); + + void reset(const std::vector &items); + +protected: + void resizeEvent(QResizeEvent *event) override; + + void keyPressEvent(QKeyEvent *event) override; + + void mousePressEvent(QMouseEvent *event) override; + + void mouseMoveEvent(QMouseEvent *event) override; + + void mouseReleaseEvent(QMouseEvent *event) override; + + void wheelEvent(QWheelEvent *event) override; + + void contextMenuEvent(QContextMenuEvent *event) override; + + void drawForeground(QPainter *painter, const QRectF &rect) override; + + void drawBackground(QPainter *painter, const QRectF &rect) override; + +private: + void applyZoom(double x, double y, const QPoint &pivot = QPoint()); + + void drawGrid(QPainter *painter, const QRectF &rect); + + void drawExtremaX(QPainter *painter, const QRectF &rect); + + void drawExtremaY(QPainter *painter, const QRectF &rect); + + void drawTimeScale(QPainter *painter, const QRectF &rect); + + void drawValueScale(QPainter *painter, const QRectF &rect); + + double timeLabelInterval(QPainter *painter, double maxTime); + +private: + double m_zoomX; + + double m_zoomY; + + QTransform m_transform; + + GraphicsScene m_scene; + + CurveEditorModel *m_model; + + Playhead m_playhead; + + Selector m_selector; + + CurveEditorStyle m_style; + + CurveEditorStyleDialog m_dialog; +}; + +} // End namespace DesignTools. diff --git a/src/plugins/qmldesigner/components/curveeditor/detail/handleitem.cpp b/src/plugins/qmldesigner/components/curveeditor/detail/handleitem.cpp new file mode 100644 index 00000000000..c54b26e2795 --- /dev/null +++ b/src/plugins/qmldesigner/components/curveeditor/detail/handleitem.cpp @@ -0,0 +1,104 @@ +/**************************************************************************** +** +** Copyright (C) 2019 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the Qt Design Tooling +** +** 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 "handleitem.h" +#include "utils.h" + +#include + +namespace DesignTools { + +struct HandleGeometry +{ + HandleGeometry(const QPointF &pos, const HandleItemStyleOption &style) + { + QPointF topLeft(-style.size / 2.0, -style.size / 2.0); + handle = QRectF(topLeft, -topLeft); + toKeyframe = QLineF(QPointF(0.0, 0.0), -pos); + angle = -toKeyframe.angle() + 45.0; + } + + QRectF handle; + + QLineF toKeyframe; + + double angle; +}; + +HandleItem::HandleItem(QGraphicsItem *parent) + : SelectableItem(parent) + , m_style() +{ + setFlag(QGraphicsItem::ItemStacksBehindParent, true); +} + +HandleItem::~HandleItem() {} + +int HandleItem::type() const +{ + return Type; +} + +QRectF HandleItem::boundingRect() const +{ + HandleGeometry geom(pos(), m_style); + + QTransform transform; + transform.rotate(geom.angle); + + QRectF bounds = bbox(geom.handle, transform); + grow(bounds, -pos()); + return bounds; +} + +void HandleItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) +{ + Q_UNUSED(option); + Q_UNUSED(widget); + + QColor handleColor(isSelected() ? m_style.selectionColor : m_style.color); + + HandleGeometry geom(pos(), m_style); + + QPen pen = painter->pen(); + pen.setWidthF(m_style.lineWidth); + pen.setColor(handleColor); + + painter->save(); + painter->setPen(pen); + + painter->drawLine(geom.toKeyframe); + painter->rotate(geom.angle); + painter->fillRect(geom.handle, handleColor); + + painter->restore(); +} + +void HandleItem::setStyle(const CurveEditorStyle &style) +{ + m_style = style.handleStyle; +} + +} // End namespace DesignTools. diff --git a/src/plugins/qmldesigner/components/curveeditor/detail/handleitem.h b/src/plugins/qmldesigner/components/curveeditor/detail/handleitem.h new file mode 100644 index 00000000000..4c9126c629d --- /dev/null +++ b/src/plugins/qmldesigner/components/curveeditor/detail/handleitem.h @@ -0,0 +1,56 @@ +/**************************************************************************** +** +** Copyright (C) 2019 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the Qt Design Tooling +** +** 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 "curveeditorstyle.h" +#include "selectableitem.h" + +namespace DesignTools { + +class HandleItem : public SelectableItem +{ + Q_OBJECT + +public: + HandleItem(QGraphicsItem *parent); + + ~HandleItem() override; + + enum { Type = ItemTypeHandle }; + + int type() const override; + + QRectF boundingRect() const override; + + void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) override; + + void setStyle(const CurveEditorStyle &style); + +private: + HandleItemStyleOption m_style; +}; + +} // End namespace DesignTools. diff --git a/src/plugins/qmldesigner/components/curveeditor/detail/keyframeitem.cpp b/src/plugins/qmldesigner/components/curveeditor/detail/keyframeitem.cpp new file mode 100644 index 00000000000..94cdbbcbb16 --- /dev/null +++ b/src/plugins/qmldesigner/components/curveeditor/detail/keyframeitem.cpp @@ -0,0 +1,251 @@ +/**************************************************************************** +** +** Copyright (C) 2019 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the Qt Design Tooling +** +** 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 "keyframeitem.h" +#include "handleitem.h" + +#include + +#include + +namespace DesignTools { + +KeyframeItem::KeyframeItem(QGraphicsItem *parent) + : SelectableItem(parent) + , m_frame() +{} + +KeyframeItem::KeyframeItem(const Keyframe &keyframe, QGraphicsItem *parent) + : SelectableItem(parent) + , m_transform() + , m_frame(keyframe) + , m_left(keyframe.hasLeftHandle() ? new HandleItem(this) : nullptr) + , m_right(keyframe.hasRightHandle() ? new HandleItem(this) : nullptr) +{ + auto updatePosition = [this]() { this->updatePosition(true); }; + connect(this, &QGraphicsObject::xChanged, updatePosition); + connect(this, &QGraphicsObject::yChanged, updatePosition); + + if (m_left) { + m_left->setPos(m_frame.leftHandle() - m_frame.position()); + auto updateLeftHandle = [this]() { updateHandle(m_left); }; + connect(m_left, &QGraphicsObject::xChanged, updateLeftHandle); + connect(m_left, &QGraphicsObject::yChanged, updateLeftHandle); + m_left->hide(); + } + + if (m_right) { + m_right->setPos(m_frame.rightHandle() - m_frame.position()); + auto updateRightHandle = [this]() { updateHandle(m_right); }; + connect(m_right, &QGraphicsObject::xChanged, updateRightHandle); + connect(m_right, &QGraphicsObject::yChanged, updateRightHandle); + m_right->hide(); + } + + setPos(m_frame.position()); +} + +int KeyframeItem::type() const +{ + return Type; +} + +QRectF KeyframeItem::boundingRect() const +{ + QPointF topLeft(-m_style.size / 2.0, -m_style.size / 2.0); + return QRectF(topLeft, -topLeft); +} + +void KeyframeItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) +{ + Q_UNUSED(option); + Q_UNUSED(widget); + + QPen pen = painter->pen(); + pen.setColor(Qt::black); + + painter->save(); + painter->setPen(pen); + painter->setBrush(selected() ? Qt::red : m_style.color); + painter->drawEllipse(boundingRect()); + + painter->restore(); +} + +KeyframeItem::~KeyframeItem() {} + +Keyframe KeyframeItem::keyframe() const +{ + return m_frame; +} + +void KeyframeItem::setComponentTransform(const QTransform &transform) +{ + m_transform = transform; + + if (m_left) + m_left->setPos(m_transform.map(m_frame.leftHandle() - m_frame.position())); + + if (m_right) + m_right->setPos(m_transform.map(m_frame.rightHandle() - m_frame.position())); + + setPos(m_transform.map(m_frame.position())); +} + +void KeyframeItem::setStyle(const CurveEditorStyle &style) +{ + m_style = style.keyframeStyle; + + if (m_left) + m_left->setStyle(style); + + if (m_right) + m_right->setStyle(style); +} + +void KeyframeItem::updatePosition(bool update) +{ + bool ok = false; + QPointF position = m_transform.inverted(&ok).map(pos()); + + if (!ok) + return; + + QPointF oldPosition = m_frame.position(); + m_frame.setPosition(position); + + if (m_left) + updateHandle(m_left, false); + + if (m_right) + updateHandle(m_right, false); + + if (update) { + emit redrawCurve(); + emit keyframeMoved(this, position - oldPosition); + } +} + +void KeyframeItem::moveKeyframe(const QPointF &direction) +{ + this->blockSignals(true); + setPos(m_transform.map(m_frame.position() + direction)); + updatePosition(false); + this->blockSignals(false); + emit redrawCurve(); +} + +void KeyframeItem::moveHandle(HandleSlot handle, double deltaAngle, double deltaLength) +{ + auto move = [this, deltaAngle, deltaLength](HandleItem *item) { + QLineF current(QPointF(0.0, 0.0), item->pos()); + current.setAngle(current.angle() + deltaAngle); + current.setLength(current.length() + deltaLength); + item->setPos(current.p2()); + updateHandle(item, false); + }; + + this->blockSignals(true); + + if (handle == HandleSlot::Left) + move(m_left); + else if (handle == HandleSlot::Right) + move(m_right); + + this->blockSignals(false); + + emit redrawCurve(); +} + +void KeyframeItem::updateHandle(HandleItem *handle, bool emitChanged) +{ + bool ok = false; + + QPointF handlePosition = m_transform.inverted(&ok).map(handle->pos()); + + if (!ok) + return; + + QPointF oldPosition; + QPointF newPosition; + HandleSlot slot = HandleSlot::Undefined; + if (handle == m_left) { + slot = HandleSlot::Left; + oldPosition = m_frame.leftHandle(); + m_frame.setLeftHandle(m_frame.position() + handlePosition); + newPosition = m_frame.leftHandle(); + } else { + slot = HandleSlot::Right; + oldPosition = m_frame.rightHandle(); + m_frame.setRightHandle(m_frame.position() + handlePosition); + newPosition = m_frame.rightHandle(); + } + + if (emitChanged) { + QLineF oldLine(m_frame.position(), oldPosition); + QLineF newLine(m_frame.position(), newPosition); + + QLineF mappedOld = m_transform.map(oldLine); + QLineF mappedNew = m_transform.map(newLine); + + auto angle = mappedOld.angleTo(mappedNew); + auto deltaLength = mappedNew.length() - mappedOld.length(); + + emit redrawCurve(); + emit handleMoved(this, slot, angle, deltaLength); + } +} + +QVariant KeyframeItem::itemChange(QGraphicsItem::GraphicsItemChange change, const QVariant &value) +{ + if (change == ItemPositionChange) { + bool ok; + QPointF position = m_transform.inverted(&ok).map(value.toPointF()); + if (ok) { + position.setX(std::round(position.x())); + return QVariant(m_transform.map(position)); + } + } + + return QGraphicsItem::itemChange(change, value); +} + +void KeyframeItem::selectionCallback() +{ + auto setHandleVisibility = [](HandleItem *handle, bool visible) { + if (handle) + handle->setVisible(visible); + }; + + if (selected()) { + setHandleVisibility(m_left, true); + setHandleVisibility(m_right, true); + } else { + setHandleVisibility(m_left, false); + setHandleVisibility(m_right, false); + } +} + +} // End namespace DesignTools. diff --git a/src/plugins/qmldesigner/components/curveeditor/detail/keyframeitem.h b/src/plugins/qmldesigner/components/curveeditor/detail/keyframeitem.h new file mode 100644 index 00000000000..ae65be1e9bf --- /dev/null +++ b/src/plugins/qmldesigner/components/curveeditor/detail/keyframeitem.h @@ -0,0 +1,98 @@ +/**************************************************************************** +** +** Copyright (C) 2019 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the Qt Design Tooling +** +** 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 "curveeditorstyle.h" +#include "keyframe.h" +#include "selectableitem.h" + +#include + +namespace DesignTools { + +class HandleItem; + +enum class HandleSlot { Undefined, Left, Right }; + +class KeyframeItem : public SelectableItem +{ + Q_OBJECT + +signals: + void redrawCurve(); + + void keyframeMoved(KeyframeItem *item, const QPointF &direction); + + void handleMoved(KeyframeItem *frame, HandleSlot handle, double angle, double deltaLength); + +public: + KeyframeItem(QGraphicsItem *parent = nullptr); + + KeyframeItem(const Keyframe &keyframe, QGraphicsItem *parent = nullptr); + + ~KeyframeItem() override; + + enum { Type = ItemTypeKeyframe }; + + int type() const override; + + QRectF boundingRect() const override; + + void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) override; + + Keyframe keyframe() const; + + void setComponentTransform(const QTransform &transform); + + void setStyle(const CurveEditorStyle &style); + + void moveKeyframe(const QPointF &direction); + + void moveHandle(HandleSlot handle, double deltaAngle, double deltaLength); + +protected: + QVariant itemChange(QGraphicsItem::GraphicsItemChange change, const QVariant &value) override; + + void selectionCallback() override; + +private: + void updatePosition(bool emit = true); + + void updateHandle(HandleItem *handle, bool emit = true); + +private: + QTransform m_transform; + + KeyframeItemStyleOption m_style; + + Keyframe m_frame; + + HandleItem *m_left; + + HandleItem *m_right; +}; + +} // End namespace DesignTools. diff --git a/src/plugins/qmldesigner/components/curveeditor/detail/playhead.cpp b/src/plugins/qmldesigner/components/curveeditor/detail/playhead.cpp new file mode 100644 index 00000000000..e2e6d212746 --- /dev/null +++ b/src/plugins/qmldesigner/components/curveeditor/detail/playhead.cpp @@ -0,0 +1,187 @@ +/**************************************************************************** +** +** Copyright (C) 2019 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the Qt Design Tooling +** +** 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 "playhead.h" +#include "curveeditormodel.h" +#include "graphicsview.h" + +#include +#include +#include + +#include + +namespace DesignTools { + +constexpr double g_playheadMargin = 5.0; + +Playhead::Playhead(GraphicsView *view) + : m_frame(0) + , m_moving(false) + , m_rect() + , m_timer() +{ + m_timer.setSingleShot(true); + m_timer.setInterval(30); + QObject::connect(&m_timer, &QTimer::timeout, view, [this, view]() { + if (QApplication::mouseButtons() == Qt::LeftButton) + mouseMoveOutOfBounds(view); + }); +} + +int Playhead::currentFrame() const +{ + return m_frame; +} + +void Playhead::moveToFrame(int frame, GraphicsView *view) +{ + m_frame = frame; + m_rect.moveCenter(QPointF(view->mapTimeToX(m_frame), m_rect.center().y())); +} + +void Playhead::resize(GraphicsView *view) +{ + QRectF viewRect = view->mapToScene(view->viewport()->rect()).boundingRect(); + + CurveEditorStyle style = view->editorStyle(); + + QPointF tlr(style.valueAxisWidth, style.timeAxisHeight - style.playhead.width); + QPointF brr(style.valueAxisWidth + style.playhead.width, -g_playheadMargin); + + QPointF tl = viewRect.topLeft() + tlr; + QPointF br = viewRect.bottomLeft() + brr; + + m_rect = QRectF(tl, br); + + moveToFrame(m_frame, view); +} + +bool Playhead::mousePress(const QPointF &pos) +{ + QRectF hitRect = m_rect; + hitRect.setBottom(hitRect.top() + hitRect.width()); + + m_moving = hitRect.contains(pos); + + return m_moving; +} + +bool Playhead::mouseMove(const QPointF &pos, GraphicsView *view) +{ + if (m_moving) { + CurveEditorStyle style = view->editorStyle(); + + QRectF canvas = view->canvasRect().adjusted(0.0, -style.timeAxisHeight, 0.0, 0.0); + + if (canvas.contains(pos)) + view->setCurrentFrame(std::round(view->mapXtoTime(pos.x()))); + else if (!m_timer.isActive()) + m_timer.start(); + } + + return m_moving; +} + +void Playhead::mouseMoveOutOfBounds(GraphicsView *view) +{ + if (QApplication::mouseButtons() != Qt::LeftButton) + return; + + CurveEditorStyle style = view->editorStyle(); + QRectF canvas = view->canvasRect(); + QPointF pos = view->globalToScene(QCursor::pos()); + + if (pos.x() > canvas.right()) { + double speed = (pos.x() - canvas.right()); + double nextCenter = m_rect.center().x() + speed; + double frame = std::round(view->mapXtoTime(nextCenter)); + view->setCurrentFrame(frame); + + double framePosition = view->mapTimeToX(frame); + double rightSideOut = framePosition + style.playhead.width / 2.0 + style.canvasMargin; + double overshoot = rightSideOut - canvas.right(); + view->scrollContent(overshoot, 0.0); + + } else if (pos.x() < canvas.left()) { + double speed = (canvas.left() - pos.x()); + double nextCenter = m_rect.center().x() - speed; + double frame = std::round(view->mapXtoTime(nextCenter)); + view->setCurrentFrame(frame); + + double framePosition = view->mapTimeToX(frame); + double leftSideOut = framePosition - style.playhead.width / 2.0 - style.canvasMargin; + double undershoot = canvas.left() - leftSideOut; + view->scrollContent(-undershoot, 0.0); + } + + m_timer.start(); +} + +void Playhead::mouseRelease(GraphicsView *view) +{ + if (m_moving) + emit view->model()->currentFrameChanged(m_frame); + + m_moving = false; +} + +void Playhead::paint(QPainter *painter, GraphicsView *view) const +{ + CurveEditorStyle style = view->editorStyle(); + + painter->save(); + painter->setPen(style.playhead.color); + painter->setRenderHint(QPainter::Antialiasing, true); + + QRectF rect = m_rect; + rect.setBottom(m_rect.top() + m_rect.width()); + + QPointF top(rect.center().x(), rect.top()); + QPointF right(rect.right(), rect.top()); + QPointF bottom(rect.center().x(), rect.bottom()); + QPointF left(rect.left(), rect.top()); + + QLineF rightToBottom(right, bottom); + rightToBottom.setLength(style.playhead.radius); + + QLineF leftToBottom(left, bottom); + leftToBottom.setLength(style.playhead.radius); + + QPainterPath path(top); + path.lineTo(right - QPointF(style.playhead.radius, 0.)); + path.quadTo(right, rightToBottom.p2()); + path.lineTo(bottom); + path.lineTo(leftToBottom.p2()); + path.quadTo(left, left + QPointF(style.playhead.radius, 0.)); + path.closeSubpath(); + + painter->fillPath(path, style.playhead.color); + painter->drawLine(top + QPointF(0., 5.), QPointF(m_rect.center().x(), m_rect.bottom())); + + painter->restore(); +} + +} // End namespace DesignTools. diff --git a/src/plugins/qmldesigner/components/curveeditor/detail/playhead.h b/src/plugins/qmldesigner/components/curveeditor/detail/playhead.h new file mode 100644 index 00000000000..ffb4da4cfdc --- /dev/null +++ b/src/plugins/qmldesigner/components/curveeditor/detail/playhead.h @@ -0,0 +1,70 @@ +/**************************************************************************** +** +** Copyright (C) 2019 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the Qt Design Tooling +** +** 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 +#include + +class QPainter; + +namespace DesignTools { + +class GraphicsView; + +class Playhead +{ +public: + Playhead(GraphicsView *view); + + int currentFrame() const; + + void paint(QPainter *painter, GraphicsView *view) const; + + void moveToFrame(int frame, GraphicsView *view); + + void resize(GraphicsView *view); + + bool mousePress(const QPointF &pos); + + bool mouseMove(const QPointF &pos, GraphicsView *view); + + void mouseRelease(GraphicsView *view); + +private: + void mouseMoveOutOfBounds(GraphicsView *view); + + int m_frame; + + bool m_moving; + + QRectF m_rect; + + QTimer m_timer; + + GraphicsView *m_view; +}; + +} // End namespace DesignTools. diff --git a/src/plugins/qmldesigner/components/curveeditor/detail/selectableitem.cpp b/src/plugins/qmldesigner/components/curveeditor/detail/selectableitem.cpp new file mode 100644 index 00000000000..fb616820906 --- /dev/null +++ b/src/plugins/qmldesigner/components/curveeditor/detail/selectableitem.cpp @@ -0,0 +1,112 @@ +/**************************************************************************** +** +** Copyright (C) 2019 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the Qt Design Tooling +** +** 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 "selectableitem.h" +#include "keyframeitem.h" + +#include + +namespace DesignTools { + +SelectableItem::SelectableItem(QGraphicsItem *parent) + : QGraphicsObject(parent) + , m_active(false) + , m_selected(false) + , m_preSelected(SelectionMode::Undefined) +{ + setFlag(QGraphicsItem::ItemIsSelectable, false); + + setFlag(QGraphicsItem::ItemIsMovable, true); + setFlag(QGraphicsItem::ItemIgnoresTransformations, true); + setFlag(QGraphicsItem::ItemSendsGeometryChanges, true); +} + +SelectableItem::~SelectableItem() {} + +bool SelectableItem::activated() const +{ + return m_active; +} + +bool SelectableItem::selected() const +{ + switch (m_preSelected) { + case SelectionMode::Clear: + return false; + case SelectionMode::New: + return true; + case SelectionMode::Add: + return true; + case SelectionMode::Remove: + return false; + case SelectionMode::Toggle: + return !m_selected; + default: + return m_selected; + } + + return false; +} + +void SelectableItem::setActivated(bool active) +{ + m_active = active; +} + +void SelectableItem::setPreselected(SelectionMode mode) +{ + m_preSelected = mode; + selectionCallback(); +} + +void SelectableItem::applyPreselection() +{ + m_selected = selected(); + m_preSelected = SelectionMode::Undefined; +} + +void SelectableItem::selectionCallback() {} + +void SelectableItem::mousePressEvent(QGraphicsSceneMouseEvent *event) +{ + m_active = true; + QGraphicsObject::mousePressEvent(event); +} + +void SelectableItem::mouseMoveEvent(QGraphicsSceneMouseEvent *event) +{ + if (type() == KeyframeItem::Type && !selected()) + return; + + QGraphicsObject::mouseMoveEvent(event); +} + +void SelectableItem::mouseReleaseEvent(QGraphicsSceneMouseEvent *event) +{ + m_active = false; + QGraphicsObject::mouseReleaseEvent(event); +} + +} // End namespace DesignTools. diff --git a/src/plugins/qmldesigner/components/curveeditor/detail/selectableitem.h b/src/plugins/qmldesigner/components/curveeditor/detail/selectableitem.h new file mode 100644 index 00000000000..0a2a4898a13 --- /dev/null +++ b/src/plugins/qmldesigner/components/curveeditor/detail/selectableitem.h @@ -0,0 +1,85 @@ +/**************************************************************************** +** +** Copyright (C) 2019 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the Qt Design Tooling +** +** 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 + +namespace DesignTools { + +enum ItemType +{ + ItemTypeKeyframe = QGraphicsItem::UserType + 1, + ItemTypeHandle = QGraphicsItem::UserType + 2, + ItemTypeCurve = QGraphicsItem::UserType + 3 +}; + +enum class SelectionMode : unsigned int +{ + Undefined, + Clear, + New, + Add, + Remove, + Toggle +}; + +class SelectableItem : public QGraphicsObject +{ + Q_OBJECT + +public: + SelectableItem(QGraphicsItem *parent = nullptr); + + ~SelectableItem() override; + + bool activated() const; + + bool selected() const; + + void setActivated(bool active); + + void setPreselected(SelectionMode mode); + + void applyPreselection(); + +protected: + virtual void selectionCallback(); + + void mousePressEvent(QGraphicsSceneMouseEvent *event) override; + + void mouseMoveEvent(QGraphicsSceneMouseEvent *event) override; + + void mouseReleaseEvent(QGraphicsSceneMouseEvent *event) override; + +private: + bool m_active; + + bool m_selected; + + SelectionMode m_preSelected; +}; + +} // End namespace DesignTools. diff --git a/src/plugins/qmldesigner/components/curveeditor/detail/selector.cpp b/src/plugins/qmldesigner/components/curveeditor/detail/selector.cpp new file mode 100644 index 00000000000..b6e7a8fee25 --- /dev/null +++ b/src/plugins/qmldesigner/components/curveeditor/detail/selector.cpp @@ -0,0 +1,219 @@ +/**************************************************************************** +** +** Copyright (C) 2019 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the Qt Design Tooling +** +** 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 "selector.h" +#include "graphicsview.h" +#include "keyframeitem.h" +#include "playhead.h" + +#include + +namespace DesignTools { + +Selector::Selector() {} + +void Selector::paint(QPainter *painter) +{ + QPen pen(Qt::white); + + painter->save(); + painter->setPen(pen); + + if (!m_lasso.isEmpty()) + painter->drawPath(m_lasso); + + if (!m_rect.isNull()) + painter->drawRect(m_rect); + + painter->restore(); +} + +void Selector::mousePress(QMouseEvent *event, GraphicsView *view) +{ + m_shortcut = Shortcut(event); + + if (view->hasActiveHandle()) + return; + + if (select(SelectionTool::Undefined, view->globalToScene(event->globalPos()), view)) + applyPreSelection(view); + + m_mouseInit = event->globalPos(); + m_mouseCurr = event->globalPos(); + + QPointF click = view->globalToScene(m_mouseInit); + + m_lasso = QPainterPath(click); + m_lasso.closeSubpath(); + + m_rect = QRectF(click, click); +} + +void Selector::mouseMove(QMouseEvent *event, GraphicsView *view, Playhead &playhead) +{ + if (m_mouseInit.isNull()) + return; + + QPointF delta = event->globalPos() - m_mouseInit; + if (delta.manhattanLength() < QApplication::startDragDistance()) + return; + + if (m_shortcut == m_shortcuts.newSelection || m_shortcut == m_shortcuts.addToSelection + || m_shortcut == m_shortcuts.removeFromSelection + || m_shortcut == m_shortcuts.toggleSelection) { + if (view->hasActiveItem()) + return; + + select(m_tool, view->globalToScene(event->globalPos()), view); + + event->accept(); + view->viewport()->update(); + + } else if (m_shortcut == m_shortcuts.zoom) { + double bigger = std::abs(delta.x()) > std::abs(delta.y()) ? delta.x() : delta.y(); + double factor = bigger / view->width(); + view->setZoomX(view->zoomX() + factor, m_mouseInit); + m_mouseCurr = event->globalPos(); + event->accept(); + + } else if (m_shortcut == m_shortcuts.pan) { + view->scrollContent(-delta.x(), -delta.y()); + playhead.resize(view); + m_mouseCurr = event->globalPos(); + } +} + +void Selector::mouseRelease(QMouseEvent *event, GraphicsView *view) +{ + Q_UNUSED(event); + + applyPreSelection(view); + + m_shortcut = Shortcut(); + m_mouseInit = QPoint(); + m_mouseCurr = QPoint(); + m_lasso = QPainterPath(); + m_rect = QRectF(); +} + +bool Selector::select(const SelectionTool &tool, const QPointF &pos, GraphicsView *view) +{ + auto selectWidthTool = [this, tool](SelectionMode mode, const QPointF &pos, GraphicsView *view) { + switch (tool) { + case SelectionTool::Lasso: + return lassoSelection(mode, pos, view); + case SelectionTool::Rectangle: + return rectangleSelection(mode, pos, view); + default: + return pressSelection(mode, pos, view); + } + }; + + if (m_shortcut == m_shortcuts.newSelection) { + clearSelection(view); + return selectWidthTool(SelectionMode::New, pos, view); + } else if (m_shortcut == m_shortcuts.addToSelection) { + return selectWidthTool(SelectionMode::Add, pos, view); + } else if (m_shortcut == m_shortcuts.removeFromSelection) { + return selectWidthTool(SelectionMode::Remove, pos, view); + } else if (m_shortcut == m_shortcuts.toggleSelection) { + return selectWidthTool(SelectionMode::Toggle, pos, view); + } + + return false; +} + +bool Selector::pressSelection(SelectionMode mode, const QPointF &pos, GraphicsView *view) +{ + bool out = false; + const auto itemList = view->items(); + for (auto *item : itemList) { + if (auto *frame = qgraphicsitem_cast(item)) { + QRectF itemRect = frame->mapRectToScene(frame->boundingRect()); + if (itemRect.contains(pos)) { + frame->setPreselected(mode); + out = true; + } + } + } + return out; +} + +bool Selector::rectangleSelection(SelectionMode mode, const QPointF &pos, GraphicsView *view) +{ + bool out = false; + m_rect.setBottomRight(pos); + const auto itemList = view->items(); + for (auto *item : itemList) { + if (auto *keyframeItem = qgraphicsitem_cast(item)) { + if (m_rect.contains(keyframeItem->pos())) { + keyframeItem->setPreselected(mode); + out = true; + } else { + keyframeItem->setPreselected(SelectionMode::Undefined); + } + } + } + return out; +} + +bool Selector::lassoSelection(SelectionMode mode, const QPointF &pos, GraphicsView *view) +{ + bool out = false; + m_lasso.lineTo(pos); + const auto itemList = view->items(); + for (auto *item : itemList) { + if (auto *keyframeItem = qgraphicsitem_cast(item)) { + if (m_lasso.contains(keyframeItem->pos())) { + keyframeItem->setPreselected(mode); + out = true; + } else { + keyframeItem->setPreselected(SelectionMode::Undefined); + } + } + } + return out; +} + +void Selector::clearSelection(GraphicsView *view) +{ + const auto itemList = view->items(); + for (auto *item : itemList) { + if (auto *frameItem = qgraphicsitem_cast(item)) { + frameItem->setPreselected(SelectionMode::Clear); + frameItem->applyPreselection(); + } + } +} + +void Selector::applyPreSelection(GraphicsView *view) +{ + const auto itemList = view->items(); + for (auto *item : itemList) { + if (auto *keyframeItem = qgraphicsitem_cast(item)) + keyframeItem->applyPreselection(); + } +} + +} // End namespace DesignTools. diff --git a/src/plugins/qmldesigner/components/curveeditor/detail/selector.h b/src/plugins/qmldesigner/components/curveeditor/detail/selector.h new file mode 100644 index 00000000000..e8f53d9d599 --- /dev/null +++ b/src/plugins/qmldesigner/components/curveeditor/detail/selector.h @@ -0,0 +1,86 @@ +/**************************************************************************** +** +** Copyright (C) 2019 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the Qt Design Tooling +** +** 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 "curveeditorstyle.h" +#include "selectableitem.h" + +#include +#include +#include +#include + +namespace DesignTools { + +class GraphicsView; +class Playhead; + +enum class SelectionTool { Undefined, Lasso, Rectangle }; + +class Selector +{ +public: + Selector(); + + void paint(QPainter *painter); + + void mousePress(QMouseEvent *event, GraphicsView *view); + + void mouseMove(QMouseEvent *event, GraphicsView *view, Playhead &playhead); + + void mouseRelease(QMouseEvent *event, GraphicsView *view); + +private: + bool select(const SelectionTool &tool, const QPointF &pos, GraphicsView *view); + + bool pressSelection(SelectionMode mode, const QPointF &pos, GraphicsView *view); + + bool rectangleSelection(SelectionMode mode, const QPointF &pos, GraphicsView *view); + + bool lassoSelection(SelectionMode mode, const QPointF &pos, GraphicsView *view); + + void clearSelection(GraphicsView *view); + + void applyPreSelection(GraphicsView *view); + + Shortcuts m_shortcuts = Shortcuts(); + + Shortcut m_shortcut; + + SelectionMode m_mode = SelectionMode::Undefined; + + SelectionTool m_tool = SelectionTool::Rectangle; + + QPoint m_mouseInit = QPoint(); + + QPoint m_mouseCurr = QPoint(); + + QPainterPath m_lasso = QPainterPath(); + + QRectF m_rect = QRectF(); +}; + +} // End namespace DesignTools. diff --git a/src/plugins/qmldesigner/components/curveeditor/detail/shortcut.cpp b/src/plugins/qmldesigner/components/curveeditor/detail/shortcut.cpp new file mode 100644 index 00000000000..d6d04dbbae8 --- /dev/null +++ b/src/plugins/qmldesigner/components/curveeditor/detail/shortcut.cpp @@ -0,0 +1,81 @@ +/**************************************************************************** +** +** Copyright (C) 2019 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the Qt Design Tooling +** +** 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 "shortcut.h" + +namespace DesignTools { + +Shortcut::Shortcut() + : m_key() + , m_buttons() + , m_modifiers() +{} + +Shortcut::Shortcut(QMouseEvent *event) + : m_key() + , m_buttons(event->buttons()) + , m_modifiers(event->modifiers()) +{} + +Shortcut::Shortcut(const Qt::KeyboardModifiers &mods, const Qt::Key &key) + : m_key(key) + , m_buttons() + , m_modifiers(mods) +{} + +Shortcut::Shortcut(const Qt::MouseButtons &buttons, const Qt::KeyboardModifiers &mods) + : m_key() + , m_buttons(buttons) + , m_modifiers(mods) +{} + +Shortcut::Shortcut(const Qt::MouseButtons &buttons, + const Qt::KeyboardModifiers &mods, + const Qt::Key &key) + : m_key(key) + , m_buttons(buttons) + , m_modifiers(mods) +{} + +bool Shortcut::exactMatch(const Qt::Key &key) const +{ + return m_key == key; +} + +bool Shortcut::exactMatch(const Qt::MouseButton &button) const +{ + return static_cast(m_buttons) == static_cast(button); +} + +bool Shortcut::exactMatch(const Qt::KeyboardModifier &modifier) const +{ + return static_cast(m_modifiers) == static_cast(modifier); +} + +bool Shortcut::operator==(const Shortcut &other) const +{ + return m_key == other.m_key && m_buttons == other.m_buttons && m_modifiers == other.m_modifiers; +} + +} // End namespace DesignTools. diff --git a/src/plugins/qmldesigner/components/curveeditor/detail/shortcut.h b/src/plugins/qmldesigner/components/curveeditor/detail/shortcut.h new file mode 100644 index 00000000000..a9e075bd8b7 --- /dev/null +++ b/src/plugins/qmldesigner/components/curveeditor/detail/shortcut.h @@ -0,0 +1,61 @@ +/**************************************************************************** +** +** Copyright (C) 2019 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the Qt Design Tooling +** +** 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 + +namespace DesignTools { + +class Shortcut +{ +public: + Shortcut(); + + Shortcut(QMouseEvent *event); + + Shortcut(const Qt::KeyboardModifiers &mods, const Qt::Key &key); + + Shortcut(const Qt::MouseButtons &buttons, const Qt::KeyboardModifiers &mods = Qt::NoModifier); + + Shortcut(const Qt::MouseButtons &buttons, const Qt::KeyboardModifiers &mods, const Qt::Key &key); + + bool exactMatch(const Qt::Key &key) const; + + bool exactMatch(const Qt::MouseButton &button) const; + + bool exactMatch(const Qt::KeyboardModifier &modifier) const; + + bool operator==(const Shortcut &other) const; + +private: + Qt::Key m_key; + + Qt::MouseButtons m_buttons; + + Qt::KeyboardModifiers m_modifiers; +}; + +} // End namespace DesignTools. diff --git a/src/plugins/qmldesigner/components/curveeditor/detail/treeitemdelegate.cpp b/src/plugins/qmldesigner/components/curveeditor/detail/treeitemdelegate.cpp new file mode 100644 index 00000000000..21633ddce1e --- /dev/null +++ b/src/plugins/qmldesigner/components/curveeditor/detail/treeitemdelegate.cpp @@ -0,0 +1,146 @@ +/**************************************************************************** +** +** Copyright (C) 2019 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the Qt Design Tooling +** +** 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 "treeitemdelegate.h" +#include "treeitem.h" + +#include +#include +#include + +namespace DesignTools { + +TreeItemDelegate::TreeItemDelegate(const CurveEditorStyle &style, QObject *parent) + : QStyledItemDelegate(parent) + , m_style(style) +{} + +QSize TreeItemDelegate::sizeHint(const QStyleOptionViewItem &option, const QModelIndex &index) const +{ + return QStyledItemDelegate::sizeHint(option, index); +} + +void TreeItemDelegate::paint(QPainter *painter, + const QStyleOptionViewItem &option, + const QModelIndex &index) const +{ + if (index.column() == 1 || index.column() == 2) { + + int height = option.rect.size().height(); + QRect iconRect(QPoint(0, 0), QSize(height, height)); + iconRect.moveCenter(option.rect.center()); + + auto *treeItem = static_cast(index.internalPointer()); + if (option.state & QStyle::State_MouseOver && iconRect.contains(m_mousePos)) { + + painter->fillRect(option.rect, option.backgroundBrush); + + if (index.column() == 1) { + + if (treeItem->locked()) { + + QPixmap pixmap = pixmapFromIcon( + m_style.treeItemStyle.unlockedIcon, + iconRect.size(), + m_style.fontColor); + + painter->drawPixmap(iconRect, pixmap); + + } else { + + QPixmap pixmap = pixmapFromIcon( + m_style.treeItemStyle.lockedIcon, + iconRect.size(), + m_style.fontColor); + + painter->drawPixmap(iconRect, pixmap); + } + + } else if (index.column() == 2) { + + if (treeItem->pinned()) { + + QPixmap pixmap = pixmapFromIcon( + m_style.treeItemStyle.unpinnedIcon, + iconRect.size(), + m_style.fontColor); + + painter->drawPixmap(iconRect, pixmap); + + } else { + + QPixmap pixmap = pixmapFromIcon( + m_style.treeItemStyle.pinnedIcon, + iconRect.size(), + m_style.fontColor); + + painter->drawPixmap(iconRect, pixmap); + + } + } + + } else { + + if (treeItem->locked() && index.column() == 1) { + + QPixmap pixmap = pixmapFromIcon( + m_style.treeItemStyle.lockedIcon, + iconRect.size(), + m_style.fontColor); + + painter->drawPixmap(iconRect, pixmap); + + } else if (treeItem->pinned() && index.column() == 2) { + + QPixmap pixmap = pixmapFromIcon( + m_style.treeItemStyle.pinnedIcon, + iconRect.size(), + m_style.fontColor); + + painter->drawPixmap(iconRect, pixmap); + + } + } + } else { + QStyledItemDelegate::paint(painter, option, index); + } +} + +void TreeItemDelegate::setStyle(const CurveEditorStyle &style) +{ + m_style = style; +} + +bool TreeItemDelegate::editorEvent(QEvent *event, + QAbstractItemModel *model, + const QStyleOptionViewItem &option, + const QModelIndex &index) +{ + if (event->type() == QEvent::MouseMove) + m_mousePos = static_cast(event)->pos(); + + return QStyledItemDelegate::editorEvent(event, model, option, index); +} + +} // End namespace DesignTools. diff --git a/src/plugins/qmldesigner/components/curveeditor/detail/treeitemdelegate.h b/src/plugins/qmldesigner/components/curveeditor/detail/treeitemdelegate.h new file mode 100644 index 00000000000..6479f48942b --- /dev/null +++ b/src/plugins/qmldesigner/components/curveeditor/detail/treeitemdelegate.h @@ -0,0 +1,63 @@ +/**************************************************************************** +** +** Copyright (C) 2019 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the Qt Design Tooling +** +** 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 "curveeditorstyle.h" + +#include + +namespace DesignTools { + +class TreeItemDelegate : public QStyledItemDelegate +{ + Q_OBJECT + +public: + TreeItemDelegate(const CurveEditorStyle &style, QObject *parent = nullptr); + + QSize sizeHint(const QStyleOptionViewItem &option, const QModelIndex &index) const override; + + void paint( + QPainter *painter, + const QStyleOptionViewItem &option, + const QModelIndex &index) const override; + + void setStyle(const CurveEditorStyle &style); + +protected: + bool editorEvent( + QEvent *event, + QAbstractItemModel *model, + const QStyleOptionViewItem &option, + const QModelIndex &index) override; + +private: + CurveEditorStyle m_style; + + QPoint m_mousePos; +}; + +} // End namespace DesignTools. diff --git a/src/plugins/qmldesigner/components/curveeditor/detail/treemodel.cpp b/src/plugins/qmldesigner/components/curveeditor/detail/treemodel.cpp new file mode 100644 index 00000000000..1ea037091d6 --- /dev/null +++ b/src/plugins/qmldesigner/components/curveeditor/detail/treemodel.cpp @@ -0,0 +1,156 @@ +/**************************************************************************** +** +** Copyright (C) 2019 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the Qt Design Tooling +** +** 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 "treemodel.h" +#include "treeitem.h" +#include "detail/graphicsview.h" + +#include + +namespace DesignTools { + +TreeModel::TreeModel(QObject *parent) + : QAbstractItemModel(parent) + , m_view(nullptr) + , m_root(new TreeItem("Root")) +{} + +TreeModel::~TreeModel() +{ + if (m_root) { + delete m_root; + m_root = nullptr; + } + + m_view = nullptr; +} + +QVariant TreeModel::data(const QModelIndex &index, int role) const +{ + if (!index.isValid()) + return QVariant(); + + TreeItem *item = static_cast(index.internalPointer()); + + if (role == Qt::DecorationRole && index.column() == 0) + return item->icon(); + + if (role != Qt::DisplayRole) + return QVariant(); + + return item->data(index.column()); +} + +QVariant TreeModel::headerData(int section, Qt::Orientation orientation, int role) const +{ + if (role != Qt::DisplayRole) + return QVariant(); + + if (orientation == Qt::Horizontal) + return m_root->headerData(section); + + return QVariant(); +} + +QModelIndex TreeModel::index(int row, int column, const QModelIndex &parent) const +{ + if (!hasIndex(row, column, parent)) + return QModelIndex(); + + TreeItem *parentItem = m_root; + + if (parent.isValid()) + parentItem = static_cast(parent.internalPointer()); + + if (TreeItem *childItem = parentItem->child(row)) + return createIndex(row, column, childItem); + + return QModelIndex(); +} + +QModelIndex TreeModel::parent(const QModelIndex &index) const +{ + if (!index.isValid()) + return QModelIndex(); + + TreeItem *childItem = static_cast(index.internalPointer()); + + if (TreeItem *parentItem = childItem->parent()) { + if (parentItem == m_root) + return QModelIndex(); + + return createIndex(parentItem->row(), 0, parentItem); + } + return QModelIndex(); +} + +int TreeModel::rowCount(const QModelIndex &parent) const +{ + if (parent.column() > 0) + return 0; + + TreeItem *parentItem = m_root; + + if (parent.isValid()) + parentItem = static_cast(parent.internalPointer()); + + return parentItem->rowCount(); +} + +int TreeModel::columnCount(const QModelIndex &parent) const +{ + Q_UNUSED(parent); + return m_root->columnCount(); +} + +void TreeModel::setGraphicsView(GraphicsView *view) +{ + m_view = view; +} + +GraphicsView *TreeModel::graphicsView() const +{ + return m_view; +} + +void TreeModel::initialize() +{ + if (m_root) + delete m_root; + + m_root = new TreeItem("Root"); +} + +TreeItem *TreeModel::root() +{ + return m_root; +} + +TreeItem *TreeModel::find(unsigned int id) +{ + return m_root->find(id); +} + +} // End namespace DesignTools. diff --git a/src/plugins/qmldesigner/components/curveeditor/detail/treemodel.h b/src/plugins/qmldesigner/components/curveeditor/detail/treemodel.h new file mode 100644 index 00000000000..209b2ee506a --- /dev/null +++ b/src/plugins/qmldesigner/components/curveeditor/detail/treemodel.h @@ -0,0 +1,75 @@ +/**************************************************************************** +** +** Copyright (C) 2019 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the Qt Design Tooling +** +** 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 + +#include + +namespace DesignTools { + +class GraphicsView; +class TreeItem; + +class TreeModel : public QAbstractItemModel +{ + Q_OBJECT + +public: + TreeModel(QObject *parent = nullptr); + + ~TreeModel() override; + + QVariant data(const QModelIndex &index, int role) const override; + + QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const override; + + QModelIndex index(int row, int column, const QModelIndex &parent = QModelIndex()) const override; + + QModelIndex parent(const QModelIndex &index) const override; + + int rowCount(const QModelIndex &parent = QModelIndex()) const override; + + int columnCount(const QModelIndex &parent = QModelIndex()) const override; + + void setGraphicsView(GraphicsView *view); + +protected: + GraphicsView *graphicsView() const; + + void initialize(); + + TreeItem *root(); + + TreeItem *find(unsigned int id); + +private: + GraphicsView *m_view; + + TreeItem *m_root; +}; + +} // End namespace DesignTools. diff --git a/src/plugins/qmldesigner/components/curveeditor/detail/treeview.cpp b/src/plugins/qmldesigner/components/curveeditor/detail/treeview.cpp new file mode 100644 index 00000000000..3b9a4ef7c5d --- /dev/null +++ b/src/plugins/qmldesigner/components/curveeditor/detail/treeview.cpp @@ -0,0 +1,127 @@ +/**************************************************************************** +** +** Copyright (C) 2019 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the Qt Design Tooling +** +** 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 "treeview.h" +#include "curveeditormodel.h" +#include "curveitem.h" +#include "treeitem.h" +#include "treeitemdelegate.h" + +#include +#include + +namespace DesignTools { + +TreeView::TreeView(CurveEditorModel *model, QWidget *parent) + : QTreeView(parent) +{ + setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding); + setUniformRowHeights(true); + setRootIsDecorated(false); + setMouseTracking(true); + setHeaderHidden(true); + + model->setParent(this); + setModel(model); + + auto expandItems = [this]() { expandAll(); }; + connect(model, &QAbstractItemModel::modelReset, expandItems); + + auto *delegate = new TreeItemDelegate(model->style(), this); + setItemDelegate(delegate); + + setSelectionBehavior(QAbstractItemView::SelectRows); + setSelectionMode(QAbstractItemView::ExtendedSelection); + + connect(selectionModel(), &QItemSelectionModel::selectionChanged, this, &TreeView::changeSelection); + setStyle(model->style()); + + header()->setSectionResizeMode(0, QHeaderView::Stretch); + header()->setSectionResizeMode(1, QHeaderView::Fixed); + header()->setSectionResizeMode(2, QHeaderView::Fixed); + + header()->setStretchLastSection(false); + header()->resizeSection(1, 20); + header()->resizeSection(2, 20); +} + +void TreeView::setStyle(const CurveEditorStyle &style) +{ + QPalette pal = palette(); + pal.setBrush(QPalette::Base, style.backgroundBrush); + pal.setBrush(QPalette::Button, style.backgroundAlternateBrush); + pal.setBrush(QPalette::Text, style.fontColor); + + // Tmp to see what happens on windows/macOS. + pal.setBrush(backgroundRole(), Qt::white); + pal.setBrush(foregroundRole(), Qt::white); + + setPalette(pal); + + if (auto *delegate = qobject_cast(itemDelegate())) + delegate->setStyle(style); +} + +void TreeView::changeCurve(unsigned int id, const AnimationCurve &curve) +{ + if (auto *curveModel = qobject_cast(model())) + curveModel->setCurve(id, curve); +} + +void TreeView::changeSelection(const QItemSelection &selected, const QItemSelection &deselected) +{ + Q_UNUSED(selected); + Q_UNUSED(deselected); + + std::vector curves; + for (auto index : selectedIndexes()) { + if (index.isValid() && index.column() == 0) { + auto *treeItem = static_cast(index.internalPointer()); + if (auto *propertyItem = treeItem->asPropertyItem()) + curves.push_back(new CurveItem(treeItem->id(), propertyItem->curve())); + } + } + + emit curvesSelected(curves); +} + +QSize TreeView::sizeHint() const +{ + return QSize(170, 300); +} + +void TreeView::mousePressEvent(QMouseEvent *event) +{ + QModelIndex index = indexAt(event->pos()); + if (index.isValid()) { + auto *treeItem = static_cast(index.internalPointer()); + if (index.column() == 1) + treeItem->setLocked(!treeItem->locked()); + else if (index.column() == 2) + treeItem->setPinned(!treeItem->pinned()); + } + QTreeView::mousePressEvent(event); +} + +} // End namespace DesignTools. diff --git a/src/plugins/qmldesigner/components/curveeditor/detail/treeview.h b/src/plugins/qmldesigner/components/curveeditor/detail/treeview.h new file mode 100644 index 00000000000..9d3af647ad2 --- /dev/null +++ b/src/plugins/qmldesigner/components/curveeditor/detail/treeview.h @@ -0,0 +1,61 @@ +/**************************************************************************** +** +** Copyright (C) 2019 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the Qt Design Tooling +** +** 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 + +namespace DesignTools { + +class AnimationCurve; +class CurveEditorModel; +class CurveItem; + +struct CurveEditorStyle; + +class TreeView : public QTreeView +{ + Q_OBJECT + +signals: + void curvesSelected(const std::vector &curves); + +public: + TreeView(CurveEditorModel *model, QWidget *parent = nullptr); + + void changeCurve(unsigned int id, const AnimationCurve &curve); + + void setStyle(const CurveEditorStyle &style); + +protected: + QSize sizeHint() const override; + + void mousePressEvent(QMouseEvent *event) override; + +private: + void changeSelection(const QItemSelection &selected, const QItemSelection &deselected); +}; + +} // End namespace DesignTools. diff --git a/src/plugins/qmldesigner/components/curveeditor/detail/utils.cpp b/src/plugins/qmldesigner/components/curveeditor/detail/utils.cpp new file mode 100644 index 00000000000..4933bcbe88f --- /dev/null +++ b/src/plugins/qmldesigner/components/curveeditor/detail/utils.cpp @@ -0,0 +1,107 @@ + +/**************************************************************************** +** +** Copyright (C) 2019 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the Qt Design Tooling +** +** 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 +#include +#include +#include + +namespace DesignTools { + +double clamp(double val, double lo, double hi) +{ + return val < lo ? lo : (val > hi ? hi : val); +} + +double lerp(double blend, double a, double b) +{ + return (1.0 - blend) * a + blend * b; +} + +double scaleX(const QTransform &transform) +{ + return transform.m11(); +} + +double scaleY(const QTransform &transform) +{ + return transform.m22(); +} + +void grow(QRectF &rect, const QPointF &point) +{ + if (rect.left() > point.x()) + rect.setLeft(point.x()); + + if (rect.right() < point.x()) + rect.setRight(point.x()); + + if (rect.top() > point.y()) + rect.setTop(point.y()); + + if (rect.bottom() < point.y()) + rect.setBottom(point.y()); +} + +QRectF bbox(const QRectF &rect, const QTransform &transform) +{ + QRectF out = rect; + grow(out, transform.map(rect.topLeft())); + grow(out, transform.map(rect.topRight())); + grow(out, transform.map(rect.bottomLeft())); + grow(out, transform.map(rect.bottomRight())); + return out; +} + +QPalette singleColorPalette(const QColor &color) +{ + QPalette palette; + palette.setColor(QPalette::Window, color); + palette.setColor(QPalette::Background, color); + palette.setColor(QPalette::WindowText, color); + palette.setColor(QPalette::Foreground, color); + palette.setColor(QPalette::Base, color); + palette.setColor(QPalette::AlternateBase, color); + palette.setColor(QPalette::ToolTipBase, color); + palette.setColor(QPalette::ToolTipText, color); + palette.setColor(QPalette::Text, color); + + palette.setColor(QPalette::Button, color); + palette.setColor(QPalette::ButtonText, color); + palette.setColor(QPalette::BrightText, color); + palette.setColor(QPalette::Light, color); + palette.setColor(QPalette::Midlight, color); + palette.setColor(QPalette::Dark, color); + palette.setColor(QPalette::Mid, color); + palette.setColor(QPalette::Shadow, color); + palette.setColor(QPalette::Highlight, color); + palette.setColor(QPalette::HighlightedText, color); + palette.setColor(QPalette::Link, color); + palette.setColor(QPalette::LinkVisited, color); + return palette; +} + +} // End namespace DesignTools. diff --git a/src/plugins/qmldesigner/qmldesignerextension/qmldesignerextension_global.h b/src/plugins/qmldesigner/components/curveeditor/detail/utils.h similarity index 66% rename from src/plugins/qmldesigner/qmldesignerextension/qmldesignerextension_global.h rename to src/plugins/qmldesigner/components/curveeditor/detail/utils.h index 82ed1b076c9..812c5d083ac 100644 --- a/src/plugins/qmldesigner/qmldesignerextension/qmldesignerextension_global.h +++ b/src/plugins/qmldesigner/components/curveeditor/detail/utils.h @@ -1,9 +1,9 @@ /**************************************************************************** ** -** Copyright (C) 2016 The Qt Company Ltd. +** Copyright (C) 2019 The Qt Company Ltd. ** Contact: https://www.qt.io/licensing/ ** -** This file is part of Qt Creator. +** This file is part of the Qt Design Tooling ** ** Commercial License Usage ** Licensees holding valid commercial Qt licenses may use this file in @@ -25,10 +25,26 @@ #pragma once -#include +class QColor; +class QPalette; +class QPointF; +class QRectF; +class QTransform; -#if defined(QMLDESIGNEREXTENSION_LIBRARY) -# define QMLDESIGNEREXTENSIONSHARED_EXPORT Q_DECL_EXPORT -#else -# define QMLDESIGNEREXTENSIONSHARED_EXPORT Q_DECL_IMPORT -#endif +namespace DesignTools { + +double clamp(double val, double lo, double hi); + +double lerp(double blend, double a, double b); + +double scaleX(const QTransform &transform); + +double scaleY(const QTransform &transform); + +void grow(QRectF &rect, const QPointF &point); + +QRectF bbox(const QRectF &rect, const QTransform &transform); + +QPalette singleColorPalette(const QColor &color); + +} // End namespace DesignTools. diff --git a/src/plugins/qmldesigner/components/curveeditor/keyframe.cpp b/src/plugins/qmldesigner/components/curveeditor/keyframe.cpp new file mode 100644 index 00000000000..8ff577c0a5f --- /dev/null +++ b/src/plugins/qmldesigner/components/curveeditor/keyframe.cpp @@ -0,0 +1,88 @@ +/**************************************************************************** +** +** Copyright (C) 2019 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the Qt Design Tooling +** +** 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 "keyframe.h" + +namespace DesignTools { + +Keyframe::Keyframe() + : m_position() + , m_leftHandle() + , m_rightHandle() +{} + +Keyframe::Keyframe(const QPointF &position) + : m_position(position) + , m_leftHandle() + , m_rightHandle() +{} + +Keyframe::Keyframe(const QPointF &position, const QPointF &leftHandle, const QPointF &rightHandle) + : m_position(position) + , m_leftHandle(leftHandle) + , m_rightHandle(rightHandle) +{} + +bool Keyframe::hasLeftHandle() const +{ + return !m_leftHandle.isNull(); +} + +bool Keyframe::hasRightHandle() const +{ + return !m_rightHandle.isNull(); +} + +QPointF Keyframe::position() const +{ + return m_position; +} + +QPointF Keyframe::leftHandle() const +{ + return m_leftHandle; +} + +QPointF Keyframe::rightHandle() const +{ + return m_rightHandle; +} + +void Keyframe::setPosition(const QPointF &pos) +{ + m_position = pos; +} + +void Keyframe::setLeftHandle(const QPointF &pos) +{ + m_leftHandle = pos; +} + +void Keyframe::setRightHandle(const QPointF &pos) +{ + m_rightHandle = pos; +} + +} // End namespace DesignTools. diff --git a/src/plugins/qmldesigner/components/curveeditor/keyframe.h b/src/plugins/qmldesigner/components/curveeditor/keyframe.h new file mode 100644 index 00000000000..5e6042531b0 --- /dev/null +++ b/src/plugins/qmldesigner/components/curveeditor/keyframe.h @@ -0,0 +1,65 @@ +/**************************************************************************** +** +** Copyright (C) 2019 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the Qt Design Tooling +** +** 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 + +namespace DesignTools { + +class Keyframe +{ +public: + Keyframe(); + + Keyframe(const QPointF &position); + + Keyframe(const QPointF &position, const QPointF &leftHandle, const QPointF &rightHandle); + + bool hasLeftHandle() const; + + bool hasRightHandle() const; + + QPointF position() const; + + QPointF leftHandle() const; + + QPointF rightHandle() const; + + void setPosition(const QPointF &pos); + + void setLeftHandle(const QPointF &pos); + + void setRightHandle(const QPointF &pos); + +private: + QPointF m_position; + + QPointF m_leftHandle; + + QPointF m_rightHandle; +}; + +} // End namespace DesignTools. diff --git a/src/plugins/qmldesigner/components/curveeditor/treeitem.cpp b/src/plugins/qmldesigner/components/curveeditor/treeitem.cpp new file mode 100644 index 00000000000..beed419e547 --- /dev/null +++ b/src/plugins/qmldesigner/components/curveeditor/treeitem.cpp @@ -0,0 +1,227 @@ +/**************************************************************************** +** +** Copyright (C) 2019 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the Qt Design Tooling +** +** 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 "treeitem.h" + +#include +#include + +namespace DesignTools { + +TreeItem::TreeItem(const QString &name) + : m_name(name) + , m_id(0) + , m_locked(false) + , m_pinned(false) + , m_parent(nullptr) + , m_children() +{} + +TreeItem::~TreeItem() +{ + m_parent = nullptr; + + qDeleteAll(m_children); +} + +QIcon TreeItem::icon() const +{ + return QIcon(); +} + +NodeTreeItem *TreeItem::asNodeItem() +{ + return nullptr; +} + +PropertyTreeItem *TreeItem::asPropertyItem() +{ + return nullptr; +} + +unsigned int TreeItem::id() const +{ + return m_id; +} + +bool TreeItem::locked() const +{ + return m_locked; +} + +bool TreeItem::pinned() const +{ + return m_pinned; +} + +int TreeItem::row() const +{ + if (m_parent) { + for (size_t i = 0; i < m_parent->m_children.size(); ++i) { + if (m_parent->m_children[i] == this) + return i; + } + } + + return 0; +} + +int TreeItem::column() const +{ + return 0; +} + +int TreeItem::rowCount() const +{ + return m_children.size(); +} + +int TreeItem::columnCount() const +{ + return 3; +} + +TreeItem *TreeItem::parent() const +{ + return m_parent; +} + +TreeItem *TreeItem::child(int row) const +{ + if (row < 0 || row >= static_cast(m_children.size())) + return nullptr; + + return m_children.at(row); +} + +TreeItem *TreeItem::find(unsigned int id) const +{ + for (auto *child : m_children) { + if (child->id() == id) + return child; + + if (auto *childsChild = child->find(id)) + return childsChild; + } + + return nullptr; +} + +QVariant TreeItem::data(int column) const +{ + switch (column) { + case 0: + return QVariant(m_name); + case 1: + return QVariant(m_locked); + case 2: + return QVariant(m_pinned); + case 3: + return QVariant(m_id); + default: + return QVariant(); + } +} + +QVariant TreeItem::headerData(int column) const +{ + switch (column) { + case 0: + return QString("Name"); + case 1: + return QString("L"); + case 2: + return QString("P"); + case 3: + return QString("Id"); + default: + return QVariant(); + } +} + +void TreeItem::setId(unsigned int &id) +{ + m_id = id; + + for (auto *child : m_children) + child->setId(++id); +} + +void TreeItem::addChild(TreeItem *child) +{ + child->m_parent = this; + m_children.push_back(child); +} + +void TreeItem::setLocked(bool locked) +{ + m_locked = locked; +} + +void TreeItem::setPinned(bool pinned) +{ + m_pinned = pinned; +} + + +NodeTreeItem::NodeTreeItem(const QString &name, const QIcon &icon) + : TreeItem(name) + , m_icon(icon) +{ + Q_UNUSED(icon); +} + +NodeTreeItem *NodeTreeItem::asNodeItem() +{ + return this; +} + +QIcon NodeTreeItem::icon() const +{ + return m_icon; +} + + +PropertyTreeItem::PropertyTreeItem(const QString &name, const AnimationCurve &curve) + : TreeItem(name) + , m_curve(curve) +{} + +PropertyTreeItem *PropertyTreeItem::asPropertyItem() +{ + return this; +} + +AnimationCurve PropertyTreeItem::curve() const +{ + return m_curve; +} + +void PropertyTreeItem::setCurve(const AnimationCurve &curve) +{ + m_curve = curve; +} + +} // End namespace DesignTools. diff --git a/src/plugins/qmldesigner/components/curveeditor/treeitem.h b/src/plugins/qmldesigner/components/curveeditor/treeitem.h new file mode 100644 index 00000000000..e5004834b8e --- /dev/null +++ b/src/plugins/qmldesigner/components/curveeditor/treeitem.h @@ -0,0 +1,135 @@ + +/**************************************************************************** +** +** Copyright (C) 2019 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the Qt Design Tooling +** +** 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 "animationcurve.h" + +#include +#include + +#include + +class QIcon; +class QVariant; + +namespace DesignTools { + +class NodeTreeItem; +class PropertyTreeItem; + +class TreeItem +{ +public: + TreeItem(const QString &name); + + virtual ~TreeItem(); + + virtual QIcon icon() const; + + virtual NodeTreeItem *asNodeItem(); + + virtual PropertyTreeItem *asPropertyItem(); + + unsigned int id() const; + + bool locked() const; + + bool pinned() const; + + int row() const; + + int column() const; + + int rowCount() const; + + int columnCount() const; + + TreeItem *parent() const; + + TreeItem *child(int row) const; + + TreeItem *find(unsigned int row) const; + + QVariant data(int column) const; + + QVariant headerData(int column) const; + + void setId(unsigned int &id); + + void addChild(TreeItem *child); + + void setLocked(bool locked); + + void setPinned(bool pinned); + +protected: + QString m_name; + + unsigned int m_id; + + bool m_locked; + + bool m_pinned; + + TreeItem *m_parent; + + std::vector m_children; +}; + + +class NodeTreeItem : public TreeItem +{ +public: + NodeTreeItem(const QString &name, const QIcon &icon); + + NodeTreeItem *asNodeItem() override; + + QIcon icon() const override; + +private: + QIcon m_icon; +}; + + +class PropertyTreeItem : public TreeItem +{ +public: + PropertyTreeItem(const QString &name, const AnimationCurve &curve); + + PropertyTreeItem *asPropertyItem() override; + + AnimationCurve curve() const; + + void setCurve(const AnimationCurve &curve); + +private: + using TreeItem::addChild; + + AnimationCurve m_curve; +}; + +} // End namespace DesignTools. diff --git a/src/plugins/qmldesigner/qmldesignerextension/pathtool/controlpoint.cpp b/src/plugins/qmldesigner/components/pathtool/controlpoint.cpp similarity index 100% rename from src/plugins/qmldesigner/qmldesignerextension/pathtool/controlpoint.cpp rename to src/plugins/qmldesigner/components/pathtool/controlpoint.cpp diff --git a/src/plugins/qmldesigner/qmldesignerextension/pathtool/controlpoint.h b/src/plugins/qmldesigner/components/pathtool/controlpoint.h similarity index 100% rename from src/plugins/qmldesigner/qmldesignerextension/pathtool/controlpoint.h rename to src/plugins/qmldesigner/components/pathtool/controlpoint.h diff --git a/src/plugins/qmldesigner/qmldesignerextension/pathtool/cubicsegment.cpp b/src/plugins/qmldesigner/components/pathtool/cubicsegment.cpp similarity index 100% rename from src/plugins/qmldesigner/qmldesignerextension/pathtool/cubicsegment.cpp rename to src/plugins/qmldesigner/components/pathtool/cubicsegment.cpp diff --git a/src/plugins/qmldesigner/qmldesignerextension/pathtool/cubicsegment.h b/src/plugins/qmldesigner/components/pathtool/cubicsegment.h similarity index 100% rename from src/plugins/qmldesigner/qmldesignerextension/pathtool/cubicsegment.h rename to src/plugins/qmldesigner/components/pathtool/cubicsegment.h diff --git a/src/plugins/qmldesigner/qmldesignerextension/pathtool/pathitem.cpp b/src/plugins/qmldesigner/components/pathtool/pathitem.cpp similarity index 100% rename from src/plugins/qmldesigner/qmldesignerextension/pathtool/pathitem.cpp rename to src/plugins/qmldesigner/components/pathtool/pathitem.cpp diff --git a/src/plugins/qmldesigner/qmldesignerextension/pathtool/pathitem.h b/src/plugins/qmldesigner/components/pathtool/pathitem.h similarity index 100% rename from src/plugins/qmldesigner/qmldesignerextension/pathtool/pathitem.h rename to src/plugins/qmldesigner/components/pathtool/pathitem.h diff --git a/src/plugins/qmldesigner/qmldesignerextension/pathtool/pathselectionmanipulator.cpp b/src/plugins/qmldesigner/components/pathtool/pathselectionmanipulator.cpp similarity index 100% rename from src/plugins/qmldesigner/qmldesignerextension/pathtool/pathselectionmanipulator.cpp rename to src/plugins/qmldesigner/components/pathtool/pathselectionmanipulator.cpp diff --git a/src/plugins/qmldesigner/qmldesignerextension/pathtool/pathselectionmanipulator.h b/src/plugins/qmldesigner/components/pathtool/pathselectionmanipulator.h similarity index 100% rename from src/plugins/qmldesigner/qmldesignerextension/pathtool/pathselectionmanipulator.h rename to src/plugins/qmldesigner/components/pathtool/pathselectionmanipulator.h diff --git a/src/plugins/qmldesigner/qmldesignerextension/pathtool/pathtool.cpp b/src/plugins/qmldesigner/components/pathtool/pathtool.cpp similarity index 100% rename from src/plugins/qmldesigner/qmldesignerextension/pathtool/pathtool.cpp rename to src/plugins/qmldesigner/components/pathtool/pathtool.cpp diff --git a/src/plugins/qmldesigner/qmldesignerextension/pathtool/pathtool.h b/src/plugins/qmldesigner/components/pathtool/pathtool.h similarity index 100% rename from src/plugins/qmldesigner/qmldesignerextension/pathtool/pathtool.h rename to src/plugins/qmldesigner/components/pathtool/pathtool.h diff --git a/src/plugins/qmldesigner/qmldesignerextension/pathtool/pathtool.pri b/src/plugins/qmldesigner/components/pathtool/pathtool.pri similarity index 100% rename from src/plugins/qmldesigner/qmldesignerextension/pathtool/pathtool.pri rename to src/plugins/qmldesigner/components/pathtool/pathtool.pri diff --git a/src/plugins/qmldesigner/qmldesignerextension/pathtool/pathtoolview.cpp b/src/plugins/qmldesigner/components/pathtool/pathtoolview.cpp similarity index 100% rename from src/plugins/qmldesigner/qmldesignerextension/pathtool/pathtoolview.cpp rename to src/plugins/qmldesigner/components/pathtool/pathtoolview.cpp diff --git a/src/plugins/qmldesigner/qmldesignerextension/pathtool/pathtoolview.h b/src/plugins/qmldesigner/components/pathtool/pathtoolview.h similarity index 100% rename from src/plugins/qmldesigner/qmldesignerextension/pathtool/pathtoolview.h rename to src/plugins/qmldesigner/components/pathtool/pathtoolview.h diff --git a/src/plugins/qmldesigner/qmldesignerextension/sourcetool/sourcetool.cpp b/src/plugins/qmldesigner/components/sourcetool/sourcetool.cpp similarity index 100% rename from src/plugins/qmldesigner/qmldesignerextension/sourcetool/sourcetool.cpp rename to src/plugins/qmldesigner/components/sourcetool/sourcetool.cpp diff --git a/src/plugins/qmldesigner/qmldesignerextension/sourcetool/sourcetool.h b/src/plugins/qmldesigner/components/sourcetool/sourcetool.h similarity index 100% rename from src/plugins/qmldesigner/qmldesignerextension/sourcetool/sourcetool.h rename to src/plugins/qmldesigner/components/sourcetool/sourcetool.h diff --git a/src/plugins/qmldesigner/qmldesignerextension/sourcetool/sourcetool.pri b/src/plugins/qmldesigner/components/sourcetool/sourcetool.pri similarity index 100% rename from src/plugins/qmldesigner/qmldesignerextension/sourcetool/sourcetool.pri rename to src/plugins/qmldesigner/components/sourcetool/sourcetool.pri diff --git a/src/plugins/qmldesigner/qmldesignerextension/texttool/textedititem.cpp b/src/plugins/qmldesigner/components/texttool/textedititem.cpp similarity index 100% rename from src/plugins/qmldesigner/qmldesignerextension/texttool/textedititem.cpp rename to src/plugins/qmldesigner/components/texttool/textedititem.cpp diff --git a/src/plugins/qmldesigner/qmldesignerextension/texttool/textedititem.h b/src/plugins/qmldesigner/components/texttool/textedititem.h similarity index 100% rename from src/plugins/qmldesigner/qmldesignerextension/texttool/textedititem.h rename to src/plugins/qmldesigner/components/texttool/textedititem.h diff --git a/src/plugins/qmldesigner/qmldesignerextension/texttool/textedititemwidget.cpp b/src/plugins/qmldesigner/components/texttool/textedititemwidget.cpp similarity index 100% rename from src/plugins/qmldesigner/qmldesignerextension/texttool/textedititemwidget.cpp rename to src/plugins/qmldesigner/components/texttool/textedititemwidget.cpp diff --git a/src/plugins/qmldesigner/qmldesignerextension/texttool/textedititemwidget.h b/src/plugins/qmldesigner/components/texttool/textedititemwidget.h similarity index 100% rename from src/plugins/qmldesigner/qmldesignerextension/texttool/textedititemwidget.h rename to src/plugins/qmldesigner/components/texttool/textedititemwidget.h diff --git a/src/plugins/qmldesigner/qmldesignerextension/texttool/texttool.cpp b/src/plugins/qmldesigner/components/texttool/texttool.cpp similarity index 100% rename from src/plugins/qmldesigner/qmldesignerextension/texttool/texttool.cpp rename to src/plugins/qmldesigner/components/texttool/texttool.cpp diff --git a/src/plugins/qmldesigner/qmldesignerextension/texttool/texttool.h b/src/plugins/qmldesigner/components/texttool/texttool.h similarity index 100% rename from src/plugins/qmldesigner/qmldesignerextension/texttool/texttool.h rename to src/plugins/qmldesigner/components/texttool/texttool.h diff --git a/src/plugins/qmldesigner/qmldesignerextension/texttool/texttool.pri b/src/plugins/qmldesigner/components/texttool/texttool.pri similarity index 100% rename from src/plugins/qmldesigner/qmldesignerextension/texttool/texttool.pri rename to src/plugins/qmldesigner/components/texttool/texttool.pri diff --git a/src/plugins/qmldesigner/qmldesignerextension/timelineeditor/canvas.cpp b/src/plugins/qmldesigner/components/timelineeditor/canvas.cpp similarity index 100% rename from src/plugins/qmldesigner/qmldesignerextension/timelineeditor/canvas.cpp rename to src/plugins/qmldesigner/components/timelineeditor/canvas.cpp diff --git a/src/plugins/qmldesigner/qmldesignerextension/timelineeditor/canvas.h b/src/plugins/qmldesigner/components/timelineeditor/canvas.h similarity index 100% rename from src/plugins/qmldesigner/qmldesignerextension/timelineeditor/canvas.h rename to src/plugins/qmldesigner/components/timelineeditor/canvas.h diff --git a/src/plugins/qmldesigner/qmldesignerextension/timelineeditor/canvasstyledialog.cpp b/src/plugins/qmldesigner/components/timelineeditor/canvasstyledialog.cpp similarity index 100% rename from src/plugins/qmldesigner/qmldesignerextension/timelineeditor/canvasstyledialog.cpp rename to src/plugins/qmldesigner/components/timelineeditor/canvasstyledialog.cpp diff --git a/src/plugins/qmldesigner/qmldesignerextension/timelineeditor/canvasstyledialog.h b/src/plugins/qmldesigner/components/timelineeditor/canvasstyledialog.h similarity index 100% rename from src/plugins/qmldesigner/qmldesignerextension/timelineeditor/canvasstyledialog.h rename to src/plugins/qmldesigner/components/timelineeditor/canvasstyledialog.h diff --git a/src/plugins/qmldesigner/qmldesignerextension/timelineeditor/easingcurve.cpp b/src/plugins/qmldesigner/components/timelineeditor/easingcurve.cpp similarity index 100% rename from src/plugins/qmldesigner/qmldesignerextension/timelineeditor/easingcurve.cpp rename to src/plugins/qmldesigner/components/timelineeditor/easingcurve.cpp diff --git a/src/plugins/qmldesigner/qmldesignerextension/timelineeditor/easingcurve.h b/src/plugins/qmldesigner/components/timelineeditor/easingcurve.h similarity index 100% rename from src/plugins/qmldesigner/qmldesignerextension/timelineeditor/easingcurve.h rename to src/plugins/qmldesigner/components/timelineeditor/easingcurve.h diff --git a/src/plugins/qmldesigner/qmldesignerextension/timelineeditor/easingcurvedialog.cpp b/src/plugins/qmldesigner/components/timelineeditor/easingcurvedialog.cpp similarity index 100% rename from src/plugins/qmldesigner/qmldesignerextension/timelineeditor/easingcurvedialog.cpp rename to src/plugins/qmldesigner/components/timelineeditor/easingcurvedialog.cpp diff --git a/src/plugins/qmldesigner/qmldesignerextension/timelineeditor/easingcurvedialog.h b/src/plugins/qmldesigner/components/timelineeditor/easingcurvedialog.h similarity index 100% rename from src/plugins/qmldesigner/qmldesignerextension/timelineeditor/easingcurvedialog.h rename to src/plugins/qmldesigner/components/timelineeditor/easingcurvedialog.h diff --git a/src/plugins/qmldesigner/qmldesignerextension/timelineeditor/images/add_timeline.png b/src/plugins/qmldesigner/components/timelineeditor/images/add_timeline.png similarity index 100% rename from src/plugins/qmldesigner/qmldesignerextension/timelineeditor/images/add_timeline.png rename to src/plugins/qmldesigner/components/timelineeditor/images/add_timeline.png diff --git a/src/plugins/qmldesigner/qmldesignerextension/timelineeditor/images/add_timeline@2x.png b/src/plugins/qmldesigner/components/timelineeditor/images/add_timeline@2x.png similarity index 100% rename from src/plugins/qmldesigner/qmldesignerextension/timelineeditor/images/add_timeline@2x.png rename to src/plugins/qmldesigner/components/timelineeditor/images/add_timeline@2x.png diff --git a/src/plugins/qmldesigner/qmldesignerextension/timelineeditor/images/animation.png b/src/plugins/qmldesigner/components/timelineeditor/images/animation.png similarity index 100% rename from src/plugins/qmldesigner/qmldesignerextension/timelineeditor/images/animation.png rename to src/plugins/qmldesigner/components/timelineeditor/images/animation.png diff --git a/src/plugins/qmldesigner/qmldesignerextension/timelineeditor/images/animation@2x.png b/src/plugins/qmldesigner/components/timelineeditor/images/animation@2x.png similarity index 100% rename from src/plugins/qmldesigner/qmldesignerextension/timelineeditor/images/animation@2x.png rename to src/plugins/qmldesigner/components/timelineeditor/images/animation@2x.png diff --git a/src/plugins/qmldesigner/qmldesignerextension/timelineeditor/images/back_one_frame.png b/src/plugins/qmldesigner/components/timelineeditor/images/back_one_frame.png similarity index 100% rename from src/plugins/qmldesigner/qmldesignerextension/timelineeditor/images/back_one_frame.png rename to src/plugins/qmldesigner/components/timelineeditor/images/back_one_frame.png diff --git a/src/plugins/qmldesigner/qmldesignerextension/timelineeditor/images/back_one_frame@2x.png b/src/plugins/qmldesigner/components/timelineeditor/images/back_one_frame@2x.png similarity index 100% rename from src/plugins/qmldesigner/qmldesignerextension/timelineeditor/images/back_one_frame@2x.png rename to src/plugins/qmldesigner/components/timelineeditor/images/back_one_frame@2x.png diff --git a/src/plugins/qmldesigner/qmldesignerextension/timelineeditor/images/curve_editor.png b/src/plugins/qmldesigner/components/timelineeditor/images/curve_editor.png similarity index 100% rename from src/plugins/qmldesigner/qmldesignerextension/timelineeditor/images/curve_editor.png rename to src/plugins/qmldesigner/components/timelineeditor/images/curve_editor.png diff --git a/src/plugins/qmldesigner/qmldesignerextension/timelineeditor/images/curve_editor@2x.png b/src/plugins/qmldesigner/components/timelineeditor/images/curve_editor@2x.png similarity index 100% rename from src/plugins/qmldesigner/qmldesignerextension/timelineeditor/images/curve_editor@2x.png rename to src/plugins/qmldesigner/components/timelineeditor/images/curve_editor@2x.png diff --git a/src/plugins/qmldesigner/qmldesignerextension/timelineeditor/images/curve_picker.png b/src/plugins/qmldesigner/components/timelineeditor/images/curve_picker.png similarity index 100% rename from src/plugins/qmldesigner/qmldesignerextension/timelineeditor/images/curve_picker.png rename to src/plugins/qmldesigner/components/timelineeditor/images/curve_picker.png diff --git a/src/plugins/qmldesigner/qmldesignerextension/timelineeditor/images/curve_picker@2x.png b/src/plugins/qmldesigner/components/timelineeditor/images/curve_picker@2x.png similarity index 100% rename from src/plugins/qmldesigner/qmldesignerextension/timelineeditor/images/curve_picker@2x.png rename to src/plugins/qmldesigner/components/timelineeditor/images/curve_picker@2x.png diff --git a/src/plugins/qmldesigner/qmldesignerextension/timelineeditor/images/forward_one_frame.png b/src/plugins/qmldesigner/components/timelineeditor/images/forward_one_frame.png similarity index 100% rename from src/plugins/qmldesigner/qmldesignerextension/timelineeditor/images/forward_one_frame.png rename to src/plugins/qmldesigner/components/timelineeditor/images/forward_one_frame.png diff --git a/src/plugins/qmldesigner/qmldesignerextension/timelineeditor/images/forward_one_frame@2x.png b/src/plugins/qmldesigner/components/timelineeditor/images/forward_one_frame@2x.png similarity index 100% rename from src/plugins/qmldesigner/qmldesignerextension/timelineeditor/images/forward_one_frame@2x.png rename to src/plugins/qmldesigner/components/timelineeditor/images/forward_one_frame@2x.png diff --git a/src/plugins/qmldesigner/qmldesignerextension/timelineeditor/images/global_record_keyframes.png b/src/plugins/qmldesigner/components/timelineeditor/images/global_record_keyframes.png similarity index 100% rename from src/plugins/qmldesigner/qmldesignerextension/timelineeditor/images/global_record_keyframes.png rename to src/plugins/qmldesigner/components/timelineeditor/images/global_record_keyframes.png diff --git a/src/plugins/qmldesigner/qmldesignerextension/timelineeditor/images/global_record_keyframes@2x.png b/src/plugins/qmldesigner/components/timelineeditor/images/global_record_keyframes@2x.png similarity index 100% rename from src/plugins/qmldesigner/qmldesignerextension/timelineeditor/images/global_record_keyframes@2x.png rename to src/plugins/qmldesigner/components/timelineeditor/images/global_record_keyframes@2x.png diff --git a/src/plugins/qmldesigner/qmldesignerextension/timelineeditor/images/is_keyframe.png b/src/plugins/qmldesigner/components/timelineeditor/images/is_keyframe.png similarity index 100% rename from src/plugins/qmldesigner/qmldesignerextension/timelineeditor/images/is_keyframe.png rename to src/plugins/qmldesigner/components/timelineeditor/images/is_keyframe.png diff --git a/src/plugins/qmldesigner/qmldesignerextension/timelineeditor/images/is_keyframe@2x.png b/src/plugins/qmldesigner/components/timelineeditor/images/is_keyframe@2x.png similarity index 100% rename from src/plugins/qmldesigner/qmldesignerextension/timelineeditor/images/is_keyframe@2x.png rename to src/plugins/qmldesigner/components/timelineeditor/images/is_keyframe@2x.png diff --git a/src/plugins/qmldesigner/qmldesignerextension/timelineeditor/images/keyframe-16px.png b/src/plugins/qmldesigner/components/timelineeditor/images/keyframe-16px.png similarity index 100% rename from src/plugins/qmldesigner/qmldesignerextension/timelineeditor/images/keyframe-16px.png rename to src/plugins/qmldesigner/components/timelineeditor/images/keyframe-16px.png diff --git a/src/plugins/qmldesigner/qmldesignerextension/timelineeditor/images/keyframe.png b/src/plugins/qmldesigner/components/timelineeditor/images/keyframe.png similarity index 100% rename from src/plugins/qmldesigner/qmldesignerextension/timelineeditor/images/keyframe.png rename to src/plugins/qmldesigner/components/timelineeditor/images/keyframe.png diff --git a/src/plugins/qmldesigner/qmldesignerextension/timelineeditor/images/keyframe@2x.png b/src/plugins/qmldesigner/components/timelineeditor/images/keyframe@2x.png similarity index 100% rename from src/plugins/qmldesigner/qmldesignerextension/timelineeditor/images/keyframe@2x.png rename to src/plugins/qmldesigner/components/timelineeditor/images/keyframe@2x.png diff --git a/src/plugins/qmldesigner/qmldesignerextension/timelineeditor/images/keyframe_autobezier_active.png b/src/plugins/qmldesigner/components/timelineeditor/images/keyframe_autobezier_active.png similarity index 100% rename from src/plugins/qmldesigner/qmldesignerextension/timelineeditor/images/keyframe_autobezier_active.png rename to src/plugins/qmldesigner/components/timelineeditor/images/keyframe_autobezier_active.png diff --git a/src/plugins/qmldesigner/qmldesignerextension/timelineeditor/images/keyframe_autobezier_active@2x.png b/src/plugins/qmldesigner/components/timelineeditor/images/keyframe_autobezier_active@2x.png similarity index 100% rename from src/plugins/qmldesigner/qmldesignerextension/timelineeditor/images/keyframe_autobezier_active@2x.png rename to src/plugins/qmldesigner/components/timelineeditor/images/keyframe_autobezier_active@2x.png diff --git a/src/plugins/qmldesigner/qmldesignerextension/timelineeditor/images/keyframe_autobezier_inactive.png b/src/plugins/qmldesigner/components/timelineeditor/images/keyframe_autobezier_inactive.png similarity index 100% rename from src/plugins/qmldesigner/qmldesignerextension/timelineeditor/images/keyframe_autobezier_inactive.png rename to src/plugins/qmldesigner/components/timelineeditor/images/keyframe_autobezier_inactive.png diff --git a/src/plugins/qmldesigner/qmldesignerextension/timelineeditor/images/keyframe_autobezier_inactive@2x.png b/src/plugins/qmldesigner/components/timelineeditor/images/keyframe_autobezier_inactive@2x.png similarity index 100% rename from src/plugins/qmldesigner/qmldesignerextension/timelineeditor/images/keyframe_autobezier_inactive@2x.png rename to src/plugins/qmldesigner/components/timelineeditor/images/keyframe_autobezier_inactive@2x.png diff --git a/src/plugins/qmldesigner/qmldesignerextension/timelineeditor/images/keyframe_autobezier_selected.png b/src/plugins/qmldesigner/components/timelineeditor/images/keyframe_autobezier_selected.png similarity index 100% rename from src/plugins/qmldesigner/qmldesignerextension/timelineeditor/images/keyframe_autobezier_selected.png rename to src/plugins/qmldesigner/components/timelineeditor/images/keyframe_autobezier_selected.png diff --git a/src/plugins/qmldesigner/qmldesignerextension/timelineeditor/images/keyframe_autobezier_selected@2x.png b/src/plugins/qmldesigner/components/timelineeditor/images/keyframe_autobezier_selected@2x.png similarity index 100% rename from src/plugins/qmldesigner/qmldesignerextension/timelineeditor/images/keyframe_autobezier_selected@2x.png rename to src/plugins/qmldesigner/components/timelineeditor/images/keyframe_autobezier_selected@2x.png diff --git a/src/plugins/qmldesigner/qmldesignerextension/timelineeditor/images/keyframe_linear_active.png b/src/plugins/qmldesigner/components/timelineeditor/images/keyframe_linear_active.png similarity index 100% rename from src/plugins/qmldesigner/qmldesignerextension/timelineeditor/images/keyframe_linear_active.png rename to src/plugins/qmldesigner/components/timelineeditor/images/keyframe_linear_active.png diff --git a/src/plugins/qmldesigner/qmldesignerextension/timelineeditor/images/keyframe_linear_active@2x.png b/src/plugins/qmldesigner/components/timelineeditor/images/keyframe_linear_active@2x.png similarity index 100% rename from src/plugins/qmldesigner/qmldesignerextension/timelineeditor/images/keyframe_linear_active@2x.png rename to src/plugins/qmldesigner/components/timelineeditor/images/keyframe_linear_active@2x.png diff --git a/src/plugins/qmldesigner/qmldesignerextension/timelineeditor/images/keyframe_linear_inactive.png b/src/plugins/qmldesigner/components/timelineeditor/images/keyframe_linear_inactive.png similarity index 100% rename from src/plugins/qmldesigner/qmldesignerextension/timelineeditor/images/keyframe_linear_inactive.png rename to src/plugins/qmldesigner/components/timelineeditor/images/keyframe_linear_inactive.png diff --git a/src/plugins/qmldesigner/qmldesignerextension/timelineeditor/images/keyframe_linear_inactive@2x.png b/src/plugins/qmldesigner/components/timelineeditor/images/keyframe_linear_inactive@2x.png similarity index 100% rename from src/plugins/qmldesigner/qmldesignerextension/timelineeditor/images/keyframe_linear_inactive@2x.png rename to src/plugins/qmldesigner/components/timelineeditor/images/keyframe_linear_inactive@2x.png diff --git a/src/plugins/qmldesigner/qmldesignerextension/timelineeditor/images/keyframe_linear_selected.png b/src/plugins/qmldesigner/components/timelineeditor/images/keyframe_linear_selected.png similarity index 100% rename from src/plugins/qmldesigner/qmldesignerextension/timelineeditor/images/keyframe_linear_selected.png rename to src/plugins/qmldesigner/components/timelineeditor/images/keyframe_linear_selected.png diff --git a/src/plugins/qmldesigner/qmldesignerextension/timelineeditor/images/keyframe_linear_selected@2x.png b/src/plugins/qmldesigner/components/timelineeditor/images/keyframe_linear_selected@2x.png similarity index 100% rename from src/plugins/qmldesigner/qmldesignerextension/timelineeditor/images/keyframe_linear_selected@2x.png rename to src/plugins/qmldesigner/components/timelineeditor/images/keyframe_linear_selected@2x.png diff --git a/src/plugins/qmldesigner/qmldesignerextension/timelineeditor/images/keyframe_lineartobezier_active.png b/src/plugins/qmldesigner/components/timelineeditor/images/keyframe_lineartobezier_active.png similarity index 100% rename from src/plugins/qmldesigner/qmldesignerextension/timelineeditor/images/keyframe_lineartobezier_active.png rename to src/plugins/qmldesigner/components/timelineeditor/images/keyframe_lineartobezier_active.png diff --git a/src/plugins/qmldesigner/qmldesignerextension/timelineeditor/images/keyframe_lineartobezier_active@2x.png b/src/plugins/qmldesigner/components/timelineeditor/images/keyframe_lineartobezier_active@2x.png similarity index 100% rename from src/plugins/qmldesigner/qmldesignerextension/timelineeditor/images/keyframe_lineartobezier_active@2x.png rename to src/plugins/qmldesigner/components/timelineeditor/images/keyframe_lineartobezier_active@2x.png diff --git a/src/plugins/qmldesigner/qmldesignerextension/timelineeditor/images/keyframe_lineartobezier_inactive.png b/src/plugins/qmldesigner/components/timelineeditor/images/keyframe_lineartobezier_inactive.png similarity index 100% rename from src/plugins/qmldesigner/qmldesignerextension/timelineeditor/images/keyframe_lineartobezier_inactive.png rename to src/plugins/qmldesigner/components/timelineeditor/images/keyframe_lineartobezier_inactive.png diff --git a/src/plugins/qmldesigner/qmldesignerextension/timelineeditor/images/keyframe_lineartobezier_inactive@2x.png b/src/plugins/qmldesigner/components/timelineeditor/images/keyframe_lineartobezier_inactive@2x.png similarity index 100% rename from src/plugins/qmldesigner/qmldesignerextension/timelineeditor/images/keyframe_lineartobezier_inactive@2x.png rename to src/plugins/qmldesigner/components/timelineeditor/images/keyframe_lineartobezier_inactive@2x.png diff --git a/src/plugins/qmldesigner/qmldesignerextension/timelineeditor/images/keyframe_lineartobezier_selected.png b/src/plugins/qmldesigner/components/timelineeditor/images/keyframe_lineartobezier_selected.png similarity index 100% rename from src/plugins/qmldesigner/qmldesignerextension/timelineeditor/images/keyframe_lineartobezier_selected.png rename to src/plugins/qmldesigner/components/timelineeditor/images/keyframe_lineartobezier_selected.png diff --git a/src/plugins/qmldesigner/qmldesignerextension/timelineeditor/images/keyframe_lineartobezier_selected@2x.png b/src/plugins/qmldesigner/components/timelineeditor/images/keyframe_lineartobezier_selected@2x.png similarity index 100% rename from src/plugins/qmldesigner/qmldesignerextension/timelineeditor/images/keyframe_lineartobezier_selected@2x.png rename to src/plugins/qmldesigner/components/timelineeditor/images/keyframe_lineartobezier_selected@2x.png diff --git a/src/plugins/qmldesigner/qmldesignerextension/timelineeditor/images/keyframe_manualbezier_active.png b/src/plugins/qmldesigner/components/timelineeditor/images/keyframe_manualbezier_active.png similarity index 100% rename from src/plugins/qmldesigner/qmldesignerextension/timelineeditor/images/keyframe_manualbezier_active.png rename to src/plugins/qmldesigner/components/timelineeditor/images/keyframe_manualbezier_active.png diff --git a/src/plugins/qmldesigner/qmldesignerextension/timelineeditor/images/keyframe_manualbezier_active@2x.png b/src/plugins/qmldesigner/components/timelineeditor/images/keyframe_manualbezier_active@2x.png similarity index 100% rename from src/plugins/qmldesigner/qmldesignerextension/timelineeditor/images/keyframe_manualbezier_active@2x.png rename to src/plugins/qmldesigner/components/timelineeditor/images/keyframe_manualbezier_active@2x.png diff --git a/src/plugins/qmldesigner/qmldesignerextension/timelineeditor/images/keyframe_manualbezier_inactive.png b/src/plugins/qmldesigner/components/timelineeditor/images/keyframe_manualbezier_inactive.png similarity index 100% rename from src/plugins/qmldesigner/qmldesignerextension/timelineeditor/images/keyframe_manualbezier_inactive.png rename to src/plugins/qmldesigner/components/timelineeditor/images/keyframe_manualbezier_inactive.png diff --git a/src/plugins/qmldesigner/qmldesignerextension/timelineeditor/images/keyframe_manualbezier_inactive@2x.png b/src/plugins/qmldesigner/components/timelineeditor/images/keyframe_manualbezier_inactive@2x.png similarity index 100% rename from src/plugins/qmldesigner/qmldesignerextension/timelineeditor/images/keyframe_manualbezier_inactive@2x.png rename to src/plugins/qmldesigner/components/timelineeditor/images/keyframe_manualbezier_inactive@2x.png diff --git a/src/plugins/qmldesigner/qmldesignerextension/timelineeditor/images/keyframe_manualbezier_selected.png b/src/plugins/qmldesigner/components/timelineeditor/images/keyframe_manualbezier_selected.png similarity index 100% rename from src/plugins/qmldesigner/qmldesignerextension/timelineeditor/images/keyframe_manualbezier_selected.png rename to src/plugins/qmldesigner/components/timelineeditor/images/keyframe_manualbezier_selected.png diff --git a/src/plugins/qmldesigner/qmldesignerextension/timelineeditor/images/keyframe_manualbezier_selected@2x.png b/src/plugins/qmldesigner/components/timelineeditor/images/keyframe_manualbezier_selected@2x.png similarity index 100% rename from src/plugins/qmldesigner/qmldesignerextension/timelineeditor/images/keyframe_manualbezier_selected@2x.png rename to src/plugins/qmldesigner/components/timelineeditor/images/keyframe_manualbezier_selected@2x.png diff --git a/src/plugins/qmldesigner/qmldesignerextension/timelineeditor/images/local_record_keyframes.png b/src/plugins/qmldesigner/components/timelineeditor/images/local_record_keyframes.png similarity index 100% rename from src/plugins/qmldesigner/qmldesignerextension/timelineeditor/images/local_record_keyframes.png rename to src/plugins/qmldesigner/components/timelineeditor/images/local_record_keyframes.png diff --git a/src/plugins/qmldesigner/qmldesignerextension/timelineeditor/images/local_record_keyframes@2x.png b/src/plugins/qmldesigner/components/timelineeditor/images/local_record_keyframes@2x.png similarity index 100% rename from src/plugins/qmldesigner/qmldesignerextension/timelineeditor/images/local_record_keyframes@2x.png rename to src/plugins/qmldesigner/components/timelineeditor/images/local_record_keyframes@2x.png diff --git a/src/plugins/qmldesigner/qmldesignerextension/timelineeditor/images/loop_playback.png b/src/plugins/qmldesigner/components/timelineeditor/images/loop_playback.png similarity index 100% rename from src/plugins/qmldesigner/qmldesignerextension/timelineeditor/images/loop_playback.png rename to src/plugins/qmldesigner/components/timelineeditor/images/loop_playback.png diff --git a/src/plugins/qmldesigner/qmldesignerextension/timelineeditor/images/loop_playback@2x.png b/src/plugins/qmldesigner/components/timelineeditor/images/loop_playback@2x.png similarity index 100% rename from src/plugins/qmldesigner/qmldesignerextension/timelineeditor/images/loop_playback@2x.png rename to src/plugins/qmldesigner/components/timelineeditor/images/loop_playback@2x.png diff --git a/src/plugins/qmldesigner/qmldesignerextension/timelineeditor/images/next_keyframe.png b/src/plugins/qmldesigner/components/timelineeditor/images/next_keyframe.png similarity index 100% rename from src/plugins/qmldesigner/qmldesignerextension/timelineeditor/images/next_keyframe.png rename to src/plugins/qmldesigner/components/timelineeditor/images/next_keyframe.png diff --git a/src/plugins/qmldesigner/qmldesignerextension/timelineeditor/images/next_keyframe@2x.png b/src/plugins/qmldesigner/components/timelineeditor/images/next_keyframe@2x.png similarity index 100% rename from src/plugins/qmldesigner/qmldesignerextension/timelineeditor/images/next_keyframe@2x.png rename to src/plugins/qmldesigner/components/timelineeditor/images/next_keyframe@2x.png diff --git a/src/plugins/qmldesigner/qmldesignerextension/timelineeditor/images/pause_playback.png b/src/plugins/qmldesigner/components/timelineeditor/images/pause_playback.png similarity index 100% rename from src/plugins/qmldesigner/qmldesignerextension/timelineeditor/images/pause_playback.png rename to src/plugins/qmldesigner/components/timelineeditor/images/pause_playback.png diff --git a/src/plugins/qmldesigner/qmldesignerextension/timelineeditor/images/pause_playback@2x.png b/src/plugins/qmldesigner/components/timelineeditor/images/pause_playback@2x.png similarity index 100% rename from src/plugins/qmldesigner/qmldesignerextension/timelineeditor/images/pause_playback@2x.png rename to src/plugins/qmldesigner/components/timelineeditor/images/pause_playback@2x.png diff --git a/src/plugins/qmldesigner/qmldesignerextension/timelineeditor/images/playhead.png b/src/plugins/qmldesigner/components/timelineeditor/images/playhead.png similarity index 100% rename from src/plugins/qmldesigner/qmldesignerextension/timelineeditor/images/playhead.png rename to src/plugins/qmldesigner/components/timelineeditor/images/playhead.png diff --git a/src/plugins/qmldesigner/qmldesignerextension/timelineeditor/images/playhead@2x.png b/src/plugins/qmldesigner/components/timelineeditor/images/playhead@2x.png similarity index 100% rename from src/plugins/qmldesigner/qmldesignerextension/timelineeditor/images/playhead@2x.png rename to src/plugins/qmldesigner/components/timelineeditor/images/playhead@2x.png diff --git a/src/plugins/qmldesigner/qmldesignerextension/timelineeditor/images/previous_keyframe.png b/src/plugins/qmldesigner/components/timelineeditor/images/previous_keyframe.png similarity index 100% rename from src/plugins/qmldesigner/qmldesignerextension/timelineeditor/images/previous_keyframe.png rename to src/plugins/qmldesigner/components/timelineeditor/images/previous_keyframe.png diff --git a/src/plugins/qmldesigner/qmldesignerextension/timelineeditor/images/previous_keyframe@2x.png b/src/plugins/qmldesigner/components/timelineeditor/images/previous_keyframe@2x.png similarity index 100% rename from src/plugins/qmldesigner/qmldesignerextension/timelineeditor/images/previous_keyframe@2x.png rename to src/plugins/qmldesigner/components/timelineeditor/images/previous_keyframe@2x.png diff --git a/src/plugins/qmldesigner/qmldesignerextension/timelineeditor/images/remove_timeline.png b/src/plugins/qmldesigner/components/timelineeditor/images/remove_timeline.png similarity index 100% rename from src/plugins/qmldesigner/qmldesignerextension/timelineeditor/images/remove_timeline.png rename to src/plugins/qmldesigner/components/timelineeditor/images/remove_timeline.png diff --git a/src/plugins/qmldesigner/qmldesignerextension/timelineeditor/images/remove_timeline@2x.png b/src/plugins/qmldesigner/components/timelineeditor/images/remove_timeline@2x.png similarity index 100% rename from src/plugins/qmldesigner/qmldesignerextension/timelineeditor/images/remove_timeline@2x.png rename to src/plugins/qmldesigner/components/timelineeditor/images/remove_timeline@2x.png diff --git a/src/plugins/qmldesigner/qmldesignerextension/timelineeditor/images/start_playback.png b/src/plugins/qmldesigner/components/timelineeditor/images/start_playback.png similarity index 100% rename from src/plugins/qmldesigner/qmldesignerextension/timelineeditor/images/start_playback.png rename to src/plugins/qmldesigner/components/timelineeditor/images/start_playback.png diff --git a/src/plugins/qmldesigner/qmldesignerextension/timelineeditor/images/start_playback@2x.png b/src/plugins/qmldesigner/components/timelineeditor/images/start_playback@2x.png similarity index 100% rename from src/plugins/qmldesigner/qmldesignerextension/timelineeditor/images/start_playback@2x.png rename to src/plugins/qmldesigner/components/timelineeditor/images/start_playback@2x.png diff --git a/src/plugins/qmldesigner/qmldesignerextension/timelineeditor/images/timeline-16px.png b/src/plugins/qmldesigner/components/timelineeditor/images/timeline-16px.png similarity index 100% rename from src/plugins/qmldesigner/qmldesignerextension/timelineeditor/images/timeline-16px.png rename to src/plugins/qmldesigner/components/timelineeditor/images/timeline-16px.png diff --git a/src/plugins/qmldesigner/qmldesignerextension/timelineeditor/images/to_first_frame.png b/src/plugins/qmldesigner/components/timelineeditor/images/to_first_frame.png similarity index 100% rename from src/plugins/qmldesigner/qmldesignerextension/timelineeditor/images/to_first_frame.png rename to src/plugins/qmldesigner/components/timelineeditor/images/to_first_frame.png diff --git a/src/plugins/qmldesigner/qmldesignerextension/timelineeditor/images/to_first_frame@2x.png b/src/plugins/qmldesigner/components/timelineeditor/images/to_first_frame@2x.png similarity index 100% rename from src/plugins/qmldesigner/qmldesignerextension/timelineeditor/images/to_first_frame@2x.png rename to src/plugins/qmldesigner/components/timelineeditor/images/to_first_frame@2x.png diff --git a/src/plugins/qmldesigner/qmldesignerextension/timelineeditor/images/to_last_frame.png b/src/plugins/qmldesigner/components/timelineeditor/images/to_last_frame.png similarity index 100% rename from src/plugins/qmldesigner/qmldesignerextension/timelineeditor/images/to_last_frame.png rename to src/plugins/qmldesigner/components/timelineeditor/images/to_last_frame.png diff --git a/src/plugins/qmldesigner/qmldesignerextension/timelineeditor/images/to_last_frame@2x.png b/src/plugins/qmldesigner/components/timelineeditor/images/to_last_frame@2x.png similarity index 100% rename from src/plugins/qmldesigner/qmldesignerextension/timelineeditor/images/to_last_frame@2x.png rename to src/plugins/qmldesigner/components/timelineeditor/images/to_last_frame@2x.png diff --git a/src/plugins/qmldesigner/qmldesignerextension/timelineeditor/images/work_area_handle_left.png b/src/plugins/qmldesigner/components/timelineeditor/images/work_area_handle_left.png similarity index 100% rename from src/plugins/qmldesigner/qmldesignerextension/timelineeditor/images/work_area_handle_left.png rename to src/plugins/qmldesigner/components/timelineeditor/images/work_area_handle_left.png diff --git a/src/plugins/qmldesigner/qmldesignerextension/timelineeditor/images/work_area_handle_left@2x.png b/src/plugins/qmldesigner/components/timelineeditor/images/work_area_handle_left@2x.png similarity index 100% rename from src/plugins/qmldesigner/qmldesignerextension/timelineeditor/images/work_area_handle_left@2x.png rename to src/plugins/qmldesigner/components/timelineeditor/images/work_area_handle_left@2x.png diff --git a/src/plugins/qmldesigner/qmldesignerextension/timelineeditor/images/work_area_handle_right.png b/src/plugins/qmldesigner/components/timelineeditor/images/work_area_handle_right.png similarity index 100% rename from src/plugins/qmldesigner/qmldesignerextension/timelineeditor/images/work_area_handle_right.png rename to src/plugins/qmldesigner/components/timelineeditor/images/work_area_handle_right.png diff --git a/src/plugins/qmldesigner/qmldesignerextension/timelineeditor/images/work_area_handle_right@2x.png b/src/plugins/qmldesigner/components/timelineeditor/images/work_area_handle_right@2x.png similarity index 100% rename from src/plugins/qmldesigner/qmldesignerextension/timelineeditor/images/work_area_handle_right@2x.png rename to src/plugins/qmldesigner/components/timelineeditor/images/work_area_handle_right@2x.png diff --git a/src/plugins/qmldesigner/qmldesignerextension/timelineeditor/images/zoom_big.png b/src/plugins/qmldesigner/components/timelineeditor/images/zoom_big.png similarity index 100% rename from src/plugins/qmldesigner/qmldesignerextension/timelineeditor/images/zoom_big.png rename to src/plugins/qmldesigner/components/timelineeditor/images/zoom_big.png diff --git a/src/plugins/qmldesigner/qmldesignerextension/timelineeditor/images/zoom_big@2x.png b/src/plugins/qmldesigner/components/timelineeditor/images/zoom_big@2x.png similarity index 100% rename from src/plugins/qmldesigner/qmldesignerextension/timelineeditor/images/zoom_big@2x.png rename to src/plugins/qmldesigner/components/timelineeditor/images/zoom_big@2x.png diff --git a/src/plugins/qmldesigner/qmldesignerextension/timelineeditor/images/zoom_small.png b/src/plugins/qmldesigner/components/timelineeditor/images/zoom_small.png similarity index 100% rename from src/plugins/qmldesigner/qmldesignerextension/timelineeditor/images/zoom_small.png rename to src/plugins/qmldesigner/components/timelineeditor/images/zoom_small.png diff --git a/src/plugins/qmldesigner/qmldesignerextension/timelineeditor/images/zoom_small@2x.png b/src/plugins/qmldesigner/components/timelineeditor/images/zoom_small@2x.png similarity index 100% rename from src/plugins/qmldesigner/qmldesignerextension/timelineeditor/images/zoom_small@2x.png rename to src/plugins/qmldesigner/components/timelineeditor/images/zoom_small@2x.png diff --git a/src/plugins/qmldesigner/qmldesignerextension/timelineeditor/preseteditor.cpp b/src/plugins/qmldesigner/components/timelineeditor/preseteditor.cpp similarity index 100% rename from src/plugins/qmldesigner/qmldesignerextension/timelineeditor/preseteditor.cpp rename to src/plugins/qmldesigner/components/timelineeditor/preseteditor.cpp diff --git a/src/plugins/qmldesigner/qmldesignerextension/timelineeditor/preseteditor.h b/src/plugins/qmldesigner/components/timelineeditor/preseteditor.h similarity index 100% rename from src/plugins/qmldesigner/qmldesignerextension/timelineeditor/preseteditor.h rename to src/plugins/qmldesigner/components/timelineeditor/preseteditor.h diff --git a/src/plugins/qmldesigner/qmldesignerextension/timelineeditor/setframevaluedialog.cpp b/src/plugins/qmldesigner/components/timelineeditor/setframevaluedialog.cpp similarity index 100% rename from src/plugins/qmldesigner/qmldesignerextension/timelineeditor/setframevaluedialog.cpp rename to src/plugins/qmldesigner/components/timelineeditor/setframevaluedialog.cpp diff --git a/src/plugins/qmldesigner/qmldesignerextension/timelineeditor/setframevaluedialog.h b/src/plugins/qmldesigner/components/timelineeditor/setframevaluedialog.h similarity index 100% rename from src/plugins/qmldesigner/qmldesignerextension/timelineeditor/setframevaluedialog.h rename to src/plugins/qmldesigner/components/timelineeditor/setframevaluedialog.h diff --git a/src/plugins/qmldesigner/qmldesignerextension/timelineeditor/setframevaluedialog.ui b/src/plugins/qmldesigner/components/timelineeditor/setframevaluedialog.ui similarity index 100% rename from src/plugins/qmldesigner/qmldesignerextension/timelineeditor/setframevaluedialog.ui rename to src/plugins/qmldesigner/components/timelineeditor/setframevaluedialog.ui diff --git a/src/plugins/qmldesigner/qmldesignerextension/timelineeditor/splineeditor.cpp b/src/plugins/qmldesigner/components/timelineeditor/splineeditor.cpp similarity index 100% rename from src/plugins/qmldesigner/qmldesignerextension/timelineeditor/splineeditor.cpp rename to src/plugins/qmldesigner/components/timelineeditor/splineeditor.cpp diff --git a/src/plugins/qmldesigner/qmldesignerextension/timelineeditor/splineeditor.h b/src/plugins/qmldesigner/components/timelineeditor/splineeditor.h similarity index 100% rename from src/plugins/qmldesigner/qmldesignerextension/timelineeditor/splineeditor.h rename to src/plugins/qmldesigner/components/timelineeditor/splineeditor.h diff --git a/src/plugins/qmldesigner/qmldesignerextension/timelineeditor/timeline.metainfo b/src/plugins/qmldesigner/components/timelineeditor/timeline.metainfo similarity index 100% rename from src/plugins/qmldesigner/qmldesignerextension/timelineeditor/timeline.metainfo rename to src/plugins/qmldesigner/components/timelineeditor/timeline.metainfo diff --git a/src/plugins/qmldesigner/qmldesignerextension/timelineeditor/timeline.qrc b/src/plugins/qmldesigner/components/timelineeditor/timeline.qrc similarity index 100% rename from src/plugins/qmldesigner/qmldesignerextension/timelineeditor/timeline.qrc rename to src/plugins/qmldesigner/components/timelineeditor/timeline.qrc diff --git a/src/plugins/qmldesigner/qmldesignerextension/timelineeditor/timelineabstracttool.cpp b/src/plugins/qmldesigner/components/timelineeditor/timelineabstracttool.cpp similarity index 100% rename from src/plugins/qmldesigner/qmldesignerextension/timelineeditor/timelineabstracttool.cpp rename to src/plugins/qmldesigner/components/timelineeditor/timelineabstracttool.cpp diff --git a/src/plugins/qmldesigner/qmldesignerextension/timelineeditor/timelineabstracttool.h b/src/plugins/qmldesigner/components/timelineeditor/timelineabstracttool.h similarity index 100% rename from src/plugins/qmldesigner/qmldesignerextension/timelineeditor/timelineabstracttool.h rename to src/plugins/qmldesigner/components/timelineeditor/timelineabstracttool.h diff --git a/src/plugins/qmldesigner/qmldesignerextension/timelineeditor/timelineactions.cpp b/src/plugins/qmldesigner/components/timelineeditor/timelineactions.cpp similarity index 100% rename from src/plugins/qmldesigner/qmldesignerextension/timelineeditor/timelineactions.cpp rename to src/plugins/qmldesigner/components/timelineeditor/timelineactions.cpp diff --git a/src/plugins/qmldesigner/qmldesignerextension/timelineeditor/timelineactions.h b/src/plugins/qmldesigner/components/timelineeditor/timelineactions.h similarity index 100% rename from src/plugins/qmldesigner/qmldesignerextension/timelineeditor/timelineactions.h rename to src/plugins/qmldesigner/components/timelineeditor/timelineactions.h diff --git a/src/plugins/qmldesigner/qmldesignerextension/timelineeditor/timelineanimationform.cpp b/src/plugins/qmldesigner/components/timelineeditor/timelineanimationform.cpp similarity index 100% rename from src/plugins/qmldesigner/qmldesignerextension/timelineeditor/timelineanimationform.cpp rename to src/plugins/qmldesigner/components/timelineeditor/timelineanimationform.cpp diff --git a/src/plugins/qmldesigner/qmldesignerextension/timelineeditor/timelineanimationform.h b/src/plugins/qmldesigner/components/timelineeditor/timelineanimationform.h similarity index 100% rename from src/plugins/qmldesigner/qmldesignerextension/timelineeditor/timelineanimationform.h rename to src/plugins/qmldesigner/components/timelineeditor/timelineanimationform.h diff --git a/src/plugins/qmldesigner/qmldesignerextension/timelineeditor/timelineanimationform.ui b/src/plugins/qmldesigner/components/timelineeditor/timelineanimationform.ui similarity index 100% rename from src/plugins/qmldesigner/qmldesignerextension/timelineeditor/timelineanimationform.ui rename to src/plugins/qmldesigner/components/timelineeditor/timelineanimationform.ui diff --git a/src/plugins/qmldesigner/qmldesignerextension/timelineeditor/timelineconstants.h b/src/plugins/qmldesigner/components/timelineeditor/timelineconstants.h similarity index 100% rename from src/plugins/qmldesigner/qmldesignerextension/timelineeditor/timelineconstants.h rename to src/plugins/qmldesigner/components/timelineeditor/timelineconstants.h diff --git a/src/plugins/qmldesigner/qmldesignerextension/timelineeditor/timelinecontext.cpp b/src/plugins/qmldesigner/components/timelineeditor/timelinecontext.cpp similarity index 100% rename from src/plugins/qmldesigner/qmldesignerextension/timelineeditor/timelinecontext.cpp rename to src/plugins/qmldesigner/components/timelineeditor/timelinecontext.cpp diff --git a/src/plugins/qmldesigner/qmldesignerextension/timelineeditor/timelinecontext.h b/src/plugins/qmldesigner/components/timelineeditor/timelinecontext.h similarity index 100% rename from src/plugins/qmldesigner/qmldesignerextension/timelineeditor/timelinecontext.h rename to src/plugins/qmldesigner/components/timelineeditor/timelinecontext.h diff --git a/src/plugins/qmldesigner/qmldesignerextension/timelineeditor/timelinecontrols.cpp b/src/plugins/qmldesigner/components/timelineeditor/timelinecontrols.cpp similarity index 100% rename from src/plugins/qmldesigner/qmldesignerextension/timelineeditor/timelinecontrols.cpp rename to src/plugins/qmldesigner/components/timelineeditor/timelinecontrols.cpp diff --git a/src/plugins/qmldesigner/qmldesignerextension/timelineeditor/timelinecontrols.h b/src/plugins/qmldesigner/components/timelineeditor/timelinecontrols.h similarity index 100% rename from src/plugins/qmldesigner/qmldesignerextension/timelineeditor/timelinecontrols.h rename to src/plugins/qmldesigner/components/timelineeditor/timelinecontrols.h diff --git a/src/plugins/qmldesigner/qmldesignerextension/timelineeditor/timelineeditor.pri b/src/plugins/qmldesigner/components/timelineeditor/timelineeditor.pri similarity index 100% rename from src/plugins/qmldesigner/qmldesignerextension/timelineeditor/timelineeditor.pri rename to src/plugins/qmldesigner/components/timelineeditor/timelineeditor.pri diff --git a/src/plugins/qmldesigner/qmldesignerextension/timelineeditor/timelineform.cpp b/src/plugins/qmldesigner/components/timelineeditor/timelineform.cpp similarity index 100% rename from src/plugins/qmldesigner/qmldesignerextension/timelineeditor/timelineform.cpp rename to src/plugins/qmldesigner/components/timelineeditor/timelineform.cpp diff --git a/src/plugins/qmldesigner/qmldesignerextension/timelineeditor/timelineform.h b/src/plugins/qmldesigner/components/timelineeditor/timelineform.h similarity index 100% rename from src/plugins/qmldesigner/qmldesignerextension/timelineeditor/timelineform.h rename to src/plugins/qmldesigner/components/timelineeditor/timelineform.h diff --git a/src/plugins/qmldesigner/qmldesignerextension/timelineeditor/timelineform.ui b/src/plugins/qmldesigner/components/timelineeditor/timelineform.ui similarity index 100% rename from src/plugins/qmldesigner/qmldesignerextension/timelineeditor/timelineform.ui rename to src/plugins/qmldesigner/components/timelineeditor/timelineform.ui diff --git a/src/plugins/qmldesigner/qmldesignerextension/timelineeditor/timelinegraphicslayout.cpp b/src/plugins/qmldesigner/components/timelineeditor/timelinegraphicslayout.cpp similarity index 100% rename from src/plugins/qmldesigner/qmldesignerextension/timelineeditor/timelinegraphicslayout.cpp rename to src/plugins/qmldesigner/components/timelineeditor/timelinegraphicslayout.cpp diff --git a/src/plugins/qmldesigner/qmldesignerextension/timelineeditor/timelinegraphicslayout.h b/src/plugins/qmldesigner/components/timelineeditor/timelinegraphicslayout.h similarity index 100% rename from src/plugins/qmldesigner/qmldesignerextension/timelineeditor/timelinegraphicslayout.h rename to src/plugins/qmldesigner/components/timelineeditor/timelinegraphicslayout.h diff --git a/src/plugins/qmldesigner/qmldesignerextension/timelineeditor/timelinegraphicsscene.cpp b/src/plugins/qmldesigner/components/timelineeditor/timelinegraphicsscene.cpp similarity index 100% rename from src/plugins/qmldesigner/qmldesignerextension/timelineeditor/timelinegraphicsscene.cpp rename to src/plugins/qmldesigner/components/timelineeditor/timelinegraphicsscene.cpp diff --git a/src/plugins/qmldesigner/qmldesignerextension/timelineeditor/timelinegraphicsscene.h b/src/plugins/qmldesigner/components/timelineeditor/timelinegraphicsscene.h similarity index 100% rename from src/plugins/qmldesigner/qmldesignerextension/timelineeditor/timelinegraphicsscene.h rename to src/plugins/qmldesigner/components/timelineeditor/timelinegraphicsscene.h diff --git a/src/plugins/qmldesigner/qmldesignerextension/timelineeditor/timelineicons.h b/src/plugins/qmldesigner/components/timelineeditor/timelineicons.h similarity index 100% rename from src/plugins/qmldesigner/qmldesignerextension/timelineeditor/timelineicons.h rename to src/plugins/qmldesigner/components/timelineeditor/timelineicons.h diff --git a/src/plugins/qmldesigner/qmldesignerextension/timelineeditor/timelineitem.cpp b/src/plugins/qmldesigner/components/timelineeditor/timelineitem.cpp similarity index 100% rename from src/plugins/qmldesigner/qmldesignerextension/timelineeditor/timelineitem.cpp rename to src/plugins/qmldesigner/components/timelineeditor/timelineitem.cpp diff --git a/src/plugins/qmldesigner/qmldesignerextension/timelineeditor/timelineitem.h b/src/plugins/qmldesigner/components/timelineeditor/timelineitem.h similarity index 100% rename from src/plugins/qmldesigner/qmldesignerextension/timelineeditor/timelineitem.h rename to src/plugins/qmldesigner/components/timelineeditor/timelineitem.h diff --git a/src/plugins/qmldesigner/qmldesignerextension/timelineeditor/timelinemovableabstractitem.cpp b/src/plugins/qmldesigner/components/timelineeditor/timelinemovableabstractitem.cpp similarity index 100% rename from src/plugins/qmldesigner/qmldesignerextension/timelineeditor/timelinemovableabstractitem.cpp rename to src/plugins/qmldesigner/components/timelineeditor/timelinemovableabstractitem.cpp diff --git a/src/plugins/qmldesigner/qmldesignerextension/timelineeditor/timelinemovableabstractitem.h b/src/plugins/qmldesigner/components/timelineeditor/timelinemovableabstractitem.h similarity index 100% rename from src/plugins/qmldesigner/qmldesignerextension/timelineeditor/timelinemovableabstractitem.h rename to src/plugins/qmldesigner/components/timelineeditor/timelinemovableabstractitem.h diff --git a/src/plugins/qmldesigner/qmldesignerextension/timelineeditor/timelinemovetool.cpp b/src/plugins/qmldesigner/components/timelineeditor/timelinemovetool.cpp similarity index 100% rename from src/plugins/qmldesigner/qmldesignerextension/timelineeditor/timelinemovetool.cpp rename to src/plugins/qmldesigner/components/timelineeditor/timelinemovetool.cpp diff --git a/src/plugins/qmldesigner/qmldesignerextension/timelineeditor/timelinemovetool.h b/src/plugins/qmldesigner/components/timelineeditor/timelinemovetool.h similarity index 100% rename from src/plugins/qmldesigner/qmldesignerextension/timelineeditor/timelinemovetool.h rename to src/plugins/qmldesigner/components/timelineeditor/timelinemovetool.h diff --git a/src/plugins/qmldesigner/qmldesignerextension/timelineeditor/timelineplaceholder.cpp b/src/plugins/qmldesigner/components/timelineeditor/timelineplaceholder.cpp similarity index 100% rename from src/plugins/qmldesigner/qmldesignerextension/timelineeditor/timelineplaceholder.cpp rename to src/plugins/qmldesigner/components/timelineeditor/timelineplaceholder.cpp diff --git a/src/plugins/qmldesigner/qmldesignerextension/timelineeditor/timelineplaceholder.h b/src/plugins/qmldesigner/components/timelineeditor/timelineplaceholder.h similarity index 100% rename from src/plugins/qmldesigner/qmldesignerextension/timelineeditor/timelineplaceholder.h rename to src/plugins/qmldesigner/components/timelineeditor/timelineplaceholder.h diff --git a/src/plugins/qmldesigner/qmldesignerextension/timelineeditor/timelinepropertyitem.cpp b/src/plugins/qmldesigner/components/timelineeditor/timelinepropertyitem.cpp similarity index 100% rename from src/plugins/qmldesigner/qmldesignerextension/timelineeditor/timelinepropertyitem.cpp rename to src/plugins/qmldesigner/components/timelineeditor/timelinepropertyitem.cpp diff --git a/src/plugins/qmldesigner/qmldesignerextension/timelineeditor/timelinepropertyitem.h b/src/plugins/qmldesigner/components/timelineeditor/timelinepropertyitem.h similarity index 100% rename from src/plugins/qmldesigner/qmldesignerextension/timelineeditor/timelinepropertyitem.h rename to src/plugins/qmldesigner/components/timelineeditor/timelinepropertyitem.h diff --git a/src/plugins/qmldesigner/qmldesignerextension/timelineeditor/timelinesectionitem.cpp b/src/plugins/qmldesigner/components/timelineeditor/timelinesectionitem.cpp similarity index 100% rename from src/plugins/qmldesigner/qmldesignerextension/timelineeditor/timelinesectionitem.cpp rename to src/plugins/qmldesigner/components/timelineeditor/timelinesectionitem.cpp diff --git a/src/plugins/qmldesigner/qmldesignerextension/timelineeditor/timelinesectionitem.h b/src/plugins/qmldesigner/components/timelineeditor/timelinesectionitem.h similarity index 100% rename from src/plugins/qmldesigner/qmldesignerextension/timelineeditor/timelinesectionitem.h rename to src/plugins/qmldesigner/components/timelineeditor/timelinesectionitem.h diff --git a/src/plugins/qmldesigner/qmldesignerextension/timelineeditor/timelineselectiontool.cpp b/src/plugins/qmldesigner/components/timelineeditor/timelineselectiontool.cpp similarity index 100% rename from src/plugins/qmldesigner/qmldesignerextension/timelineeditor/timelineselectiontool.cpp rename to src/plugins/qmldesigner/components/timelineeditor/timelineselectiontool.cpp diff --git a/src/plugins/qmldesigner/qmldesignerextension/timelineeditor/timelineselectiontool.h b/src/plugins/qmldesigner/components/timelineeditor/timelineselectiontool.h similarity index 100% rename from src/plugins/qmldesigner/qmldesignerextension/timelineeditor/timelineselectiontool.h rename to src/plugins/qmldesigner/components/timelineeditor/timelineselectiontool.h diff --git a/src/plugins/qmldesigner/qmldesignerextension/timelineeditor/timelinesettingsdialog.cpp b/src/plugins/qmldesigner/components/timelineeditor/timelinesettingsdialog.cpp similarity index 100% rename from src/plugins/qmldesigner/qmldesignerextension/timelineeditor/timelinesettingsdialog.cpp rename to src/plugins/qmldesigner/components/timelineeditor/timelinesettingsdialog.cpp diff --git a/src/plugins/qmldesigner/qmldesignerextension/timelineeditor/timelinesettingsdialog.h b/src/plugins/qmldesigner/components/timelineeditor/timelinesettingsdialog.h similarity index 100% rename from src/plugins/qmldesigner/qmldesignerextension/timelineeditor/timelinesettingsdialog.h rename to src/plugins/qmldesigner/components/timelineeditor/timelinesettingsdialog.h diff --git a/src/plugins/qmldesigner/qmldesignerextension/timelineeditor/timelinesettingsdialog.ui b/src/plugins/qmldesigner/components/timelineeditor/timelinesettingsdialog.ui similarity index 100% rename from src/plugins/qmldesigner/qmldesignerextension/timelineeditor/timelinesettingsdialog.ui rename to src/plugins/qmldesigner/components/timelineeditor/timelinesettingsdialog.ui diff --git a/src/plugins/qmldesigner/qmldesignerextension/timelineeditor/timelinesettingsmodel.cpp b/src/plugins/qmldesigner/components/timelineeditor/timelinesettingsmodel.cpp similarity index 100% rename from src/plugins/qmldesigner/qmldesignerextension/timelineeditor/timelinesettingsmodel.cpp rename to src/plugins/qmldesigner/components/timelineeditor/timelinesettingsmodel.cpp diff --git a/src/plugins/qmldesigner/qmldesignerextension/timelineeditor/timelinesettingsmodel.h b/src/plugins/qmldesigner/components/timelineeditor/timelinesettingsmodel.h similarity index 100% rename from src/plugins/qmldesigner/qmldesignerextension/timelineeditor/timelinesettingsmodel.h rename to src/plugins/qmldesigner/components/timelineeditor/timelinesettingsmodel.h diff --git a/src/plugins/qmldesigner/qmldesignerextension/timelineeditor/timelinetoolbar.cpp b/src/plugins/qmldesigner/components/timelineeditor/timelinetoolbar.cpp similarity index 100% rename from src/plugins/qmldesigner/qmldesignerextension/timelineeditor/timelinetoolbar.cpp rename to src/plugins/qmldesigner/components/timelineeditor/timelinetoolbar.cpp diff --git a/src/plugins/qmldesigner/qmldesignerextension/timelineeditor/timelinetoolbar.h b/src/plugins/qmldesigner/components/timelineeditor/timelinetoolbar.h similarity index 100% rename from src/plugins/qmldesigner/qmldesignerextension/timelineeditor/timelinetoolbar.h rename to src/plugins/qmldesigner/components/timelineeditor/timelinetoolbar.h diff --git a/src/plugins/qmldesigner/qmldesignerextension/timelineeditor/timelinetoolbutton.cpp b/src/plugins/qmldesigner/components/timelineeditor/timelinetoolbutton.cpp similarity index 100% rename from src/plugins/qmldesigner/qmldesignerextension/timelineeditor/timelinetoolbutton.cpp rename to src/plugins/qmldesigner/components/timelineeditor/timelinetoolbutton.cpp diff --git a/src/plugins/qmldesigner/qmldesignerextension/timelineeditor/timelinetoolbutton.h b/src/plugins/qmldesigner/components/timelineeditor/timelinetoolbutton.h similarity index 100% rename from src/plugins/qmldesigner/qmldesignerextension/timelineeditor/timelinetoolbutton.h rename to src/plugins/qmldesigner/components/timelineeditor/timelinetoolbutton.h diff --git a/src/plugins/qmldesigner/qmldesignerextension/timelineeditor/timelinetooldelegate.cpp b/src/plugins/qmldesigner/components/timelineeditor/timelinetooldelegate.cpp similarity index 100% rename from src/plugins/qmldesigner/qmldesignerextension/timelineeditor/timelinetooldelegate.cpp rename to src/plugins/qmldesigner/components/timelineeditor/timelinetooldelegate.cpp diff --git a/src/plugins/qmldesigner/qmldesignerextension/timelineeditor/timelinetooldelegate.h b/src/plugins/qmldesigner/components/timelineeditor/timelinetooldelegate.h similarity index 100% rename from src/plugins/qmldesigner/qmldesignerextension/timelineeditor/timelinetooldelegate.h rename to src/plugins/qmldesigner/components/timelineeditor/timelinetooldelegate.h diff --git a/src/plugins/qmldesigner/qmldesignerextension/timelineeditor/timelineutils.cpp b/src/plugins/qmldesigner/components/timelineeditor/timelineutils.cpp similarity index 100% rename from src/plugins/qmldesigner/qmldesignerextension/timelineeditor/timelineutils.cpp rename to src/plugins/qmldesigner/components/timelineeditor/timelineutils.cpp diff --git a/src/plugins/qmldesigner/qmldesignerextension/timelineeditor/timelineutils.h b/src/plugins/qmldesigner/components/timelineeditor/timelineutils.h similarity index 100% rename from src/plugins/qmldesigner/qmldesignerextension/timelineeditor/timelineutils.h rename to src/plugins/qmldesigner/components/timelineeditor/timelineutils.h diff --git a/src/plugins/qmldesigner/qmldesignerextension/timelineeditor/timelineview.cpp b/src/plugins/qmldesigner/components/timelineeditor/timelineview.cpp similarity index 100% rename from src/plugins/qmldesigner/qmldesignerextension/timelineeditor/timelineview.cpp rename to src/plugins/qmldesigner/components/timelineeditor/timelineview.cpp diff --git a/src/plugins/qmldesigner/qmldesignerextension/timelineeditor/timelineview.h b/src/plugins/qmldesigner/components/timelineeditor/timelineview.h similarity index 100% rename from src/plugins/qmldesigner/qmldesignerextension/timelineeditor/timelineview.h rename to src/plugins/qmldesigner/components/timelineeditor/timelineview.h diff --git a/src/plugins/qmldesigner/qmldesignerextension/timelineeditor/timelinewidget.cpp b/src/plugins/qmldesigner/components/timelineeditor/timelinewidget.cpp similarity index 100% rename from src/plugins/qmldesigner/qmldesignerextension/timelineeditor/timelinewidget.cpp rename to src/plugins/qmldesigner/components/timelineeditor/timelinewidget.cpp diff --git a/src/plugins/qmldesigner/qmldesignerextension/timelineeditor/timelinewidget.h b/src/plugins/qmldesigner/components/timelineeditor/timelinewidget.h similarity index 100% rename from src/plugins/qmldesigner/qmldesignerextension/timelineeditor/timelinewidget.h rename to src/plugins/qmldesigner/components/timelineeditor/timelinewidget.h diff --git a/src/plugins/qmldesigner/qmldesignerextension/qmldesignerextension.pri b/src/plugins/qmldesigner/qmldesignerextension/qmldesignerextension.pri deleted file mode 100644 index 597bd853389..00000000000 --- a/src/plugins/qmldesigner/qmldesignerextension/qmldesignerextension.pri +++ /dev/null @@ -1,12 +0,0 @@ -DEFINES += QMLDESIGNEREXTENSION_LIBRARY - -INCLUDEPATH *= $$PWD - -# QmlDesignerExtension files - -include(sourcetool/sourcetool.pri) -include(colortool/colortool.pri) -include(texttool/texttool.pri) -include(pathtool/pathtool.pri) -include(timelineeditor/timelineeditor.pri) -include(connectioneditor/connectioneditor.pri) diff --git a/src/plugins/qmldesigner/qmldesignerplugin.pro b/src/plugins/qmldesigner/qmldesignerplugin.pro index cc78fdc5db4..52e3e19a44a 100644 --- a/src/plugins/qmldesigner/qmldesignerplugin.pro +++ b/src/plugins/qmldesigner/qmldesignerplugin.pro @@ -2,6 +2,7 @@ QT += quickwidgets core-private CONFIG += exceptions INCLUDEPATH += $$PWD +INCLUDEPATH += $$PWD/components unix:!openbsd:!osx: LIBS += -lrt # posix shared memory @@ -20,7 +21,13 @@ include(components/stateseditor/stateseditor.pri) include(components/resources/resources.pri) include(components/debugview/debugview.pri) include(components/importmanager/importmanager.pri) -include(qmldesignerextension/qmldesignerextension.pri) +include(components/sourcetool/sourcetool.pri) +include(components/colortool/colortool.pri) +include(components/texttool/texttool.pri) +include(components/pathtool/pathtool.pri) +include(components/timelineeditor/timelineeditor.pri) +include(components/connectioneditor/connectioneditor.pri) +include(components/curveeditor/curveeditor.pri) BUILD_PUPPET_IN_CREATOR_BINPATH = $$(BUILD_PUPPET_IN_CREATOR_BINPATH) diff --git a/src/plugins/qmldesigner/qmldesignerplugin.qbs b/src/plugins/qmldesigner/qmldesignerplugin.qbs index 600fcab3fe9..4cba901e20f 100644 --- a/src/plugins/qmldesigner/qmldesignerplugin.qbs +++ b/src/plugins/qmldesigner/qmldesignerplugin.qbs @@ -29,7 +29,7 @@ Project { cpp.defines: base.concat([ "DESIGNER_CORE_LIBRARY", - "TIMELINE_QML_PATH=\"" + FileInfo.joinPaths(path, "qmldesignerextension", + "TIMELINE_QML_PATH=\"" + FileInfo.joinPaths(path, "components", "timelineeditor", "qml") + "\"" ]) cpp.enableExceptions: true @@ -42,7 +42,10 @@ Project { "../../../share/qtcreator/qml/qmlpuppet/container", "../../../share/qtcreator/qml/qmlpuppet/commands", "../../../share/qtcreator/qml/qmlpuppet/types", + "components", "components/componentcore", + "components/curveeditor", + "components/connectioneditor", "components/debugview", "components/importmanager", "components/integration", @@ -52,10 +55,7 @@ Project { "components/navigator", "components/pluginmanager", "components/stateseditor", - "components/texteditor", - "qmldesignerextension", - "qmldesignerextension/connectioneditor", - "qmldesignerextension/timelineeditor", + "components/texteditor" ]) Properties { @@ -608,7 +608,7 @@ Project { Group { name: "extension" - prefix: "qmldesignerextension/" + prefix: "components/" files: [ "colortool/colortool.cpp", "colortool/colortool.h", @@ -632,6 +632,49 @@ Project { "connectioneditor/dynamicpropertiesmodel.cpp", "connectioneditor/dynamicpropertiesmodel.h", "connectioneditor/stylesheet.css", + "curveeditor/animationcurve.cpp", + "curveeditor/animationcurve.h", + "curveeditor/curveeditor.cpp", + "curveeditor/curveeditor.h", + "curveeditor/curveeditormodel.cpp", + "curveeditor/curveeditormodel.h", + "curveeditor/curveeditorstyle.h", + "curveeditor/keyframe.cpp", + "curveeditor/keyframe.h", + "curveeditor/treeitem.cpp", + "curveeditor/treeitem.h", + "curveeditor/detail/colorcontrol.cpp", + "curveeditor/detail/colorcontrol.h", + "curveeditor/detail/curveeditorstyledialog.cpp", + "curveeditor/detail/curveeditorstyledialog.h", + "curveeditor/detail/curveitem.cpp", + "curveeditor/detail/curveitem.h", + "curveeditor/detail/curvesegment.cpp", + "curveeditor/detail/curvesegment.h", + "curveeditor/detail/graphicsscene.cpp", + "curveeditor/detail/graphicsscene.h", + "curveeditor/detail/graphicsview.cpp", + "curveeditor/detail/graphicsview.h", + "curveeditor/detail/handleitem.cpp", + "curveeditor/detail/handleitem.h", + "curveeditor/detail/keyframeitem.cpp", + "curveeditor/detail/keyframeitem.h", + "curveeditor/detail/playhead.cpp", + "curveeditor/detail/playhead.h", + "curveeditor/detail/selectableitem.cpp", + "curveeditor/detail/selectableitem.h", + "curveeditor/detail/selector.cpp", + "curveeditor/detail/selector.h", + "curveeditor/detail/shortcut.cpp", + "curveeditor/detail/shortcut.h", + "curveeditor/detail/treeitemdelegate.cpp", + "curveeditor/detail/treeitemdelegate.h", + "curveeditor/detail/treemodel.cpp", + "curveeditor/detail/treemodel.h", + "curveeditor/detail/treeview.cpp", + "curveeditor/detail/treeview.h", + "curveeditor/detail/utils.cpp", + "curveeditor/detail/utils.h", "pathtool/controlpoint.cpp", "pathtool/controlpoint.h", "pathtool/cubicsegment.cpp", @@ -644,8 +687,6 @@ Project { "pathtool/pathtool.h", "pathtool/pathtoolview.cpp", "pathtool/pathtoolview.h", - "qmldesignerextensionconstants.h", - "qmldesignerextension_global.h", "sourcetool/sourcetool.cpp", "sourcetool/sourcetool.h", "texttool/textedititem.cpp", From e9858abc4305c5f12e61ad23a680d4a4f4c1cae7 Mon Sep 17 00:00:00 2001 From: David Schulz Date: Wed, 19 Jun 2019 11:01:19 +0200 Subject: [PATCH 22/33] Debugger: Use DebugBreak() to interrupt in simple test Change-Id: Ia15fc8c780b53f1b84af16a172af79b3145e9c39 Reviewed-by: hjk Reviewed-by: Cristian Adam --- tests/manual/debugger/simple/simple_test_app.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/tests/manual/debugger/simple/simple_test_app.cpp b/tests/manual/debugger/simple/simple_test_app.cpp index 29286f37e3b..864e20d40a5 100644 --- a/tests/manual/debugger/simple/simple_test_app.cpp +++ b/tests/manual/debugger/simple/simple_test_app.cpp @@ -276,8 +276,7 @@ void dummyStatement(...) {} #if USE_AUTOBREAK # ifdef Q_CC_MSVC -# include -# define BREAK_HERE _CrtDbgReport(_CRT_WARN, NULL, NULL, "simple_test_app", NULL) +# define BREAK_HERE DebugBreak(); # else # define BREAK_HERE asm("int $3; mov %eax, %eax") # endif From 9dac99eac055767ee3d2669b6de3dad673831197 Mon Sep 17 00:00:00 2001 From: Nikolai Kosjar Date: Wed, 19 Jun 2019 09:26:38 +0200 Subject: [PATCH 23/33] README: Update clang instructions for mono repository Change-Id: I0b817e4f245613cbae7c36cd5c36712a2cf1396d Reviewed-by: Orgad Shaneh --- README.md | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-) diff --git a/README.md b/README.md index 8a6fcbf0883..2293ae80156 100644 --- a/README.md +++ b/README.md @@ -253,9 +253,9 @@ You need to install CMake in order to build LLVM/Clang. Build LLVM/Clang by roughly following the instructions at http://llvm.org/docs/GettingStarted.html#git-mirror: - 1. Clone LLVM and checkout a suitable branch + 1. Clone LLVM/Clang and checkout a suitable branch - git clone -b release_80-based --recursive https://code.qt.io/clang/llvm + git clone -b release_80-based --recursive https://code.qt.io/clang/llvm-project.git 2. Build and install LLVM/Clang @@ -264,12 +264,12 @@ http://llvm.org/docs/GettingStarted.html#git-mirror: For Linux/macOS: - cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX= -DLLVM_ENABLE_RTTI=ON ../llvm + cmake -DCMAKE_BUILD_TYPE=Release -DLLVM_ENABLE_RTTI=ON -DLLVM_ENABLE_PROJECTS="clang;clang-tools-extra" -DCMAKE_INSTALL_PREFIX= ../llvm-project/llvm make install For Windows: - cmake -G "NMake Makefiles JOM" -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX= -DLLVM_ENABLE_RTTI=ON ..\llvm + cmake -G "NMake Makefiles JOM" -DCMAKE_BUILD_TYPE=Release -DLLVM_ENABLE_RTTI=ON -DLLVM_ENABLE_PROJECTS="clang;clang-tools-extra" -DCMAKE_INSTALL_PREFIX= ..\llvm-project\llvm jom install ## Third-party Components @@ -328,18 +328,14 @@ we thank the authors who made this possible: ### LLVM/Clang - http://llvm.org/svn/llvm-project/llvm - http://llvm.org/svn/llvm-project/cfe/trunk - http://llvm.org/svn/llvm-project/clang-tools-extra/trunk + https://github.com/llvm/llvm-project.git - Copyright (C) 2003-2018 LLVM Team + Copyright (C) 2003-2019 LLVM Team Distributed under the University of Illinois/NCSA Open Source License (NCSA), - see https://github.com/llvm-mirror/llvm/blob/master/LICENSE.TXT + see https://github.com/llvm/llvm-project/blob/master/llvm/LICENSE.TXT - With backported/additional patches from - http://code.qt.io/cgit/clang/llvm.git/ - http://code.qt.io/cgit/clang/clang.git/ + With backported/additional patches from https://code.qt.io/clang/llvm-project.git ### Reference implementation for std::experimental::optional From c03c77b9c4ebe57f4e01121a246706e811fc2071 Mon Sep 17 00:00:00 2001 From: Knud Dollereder Date: Wed, 19 Jun 2019 13:12:54 +0200 Subject: [PATCH 24/33] Fix build on macOS Change-Id: I605fdbb4e3b866050f5a31fe141beaee1be5536e Reviewed-by: Thomas Hartmann Reviewed-by: Vikas Pachdha --- .../qmldesigner/components/curveeditor/detail/curveitem.cpp | 4 +++- .../qmldesigner/components/curveeditor/detail/selector.cpp | 2 ++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/plugins/qmldesigner/components/curveeditor/detail/curveitem.cpp b/src/plugins/qmldesigner/components/curveeditor/detail/curveitem.cpp index 5973e709bbb..38efd29571b 100644 --- a/src/plugins/qmldesigner/components/curveeditor/detail/curveitem.cpp +++ b/src/plugins/qmldesigner/components/curveeditor/detail/curveitem.cpp @@ -31,6 +31,8 @@ #include #include +#include + namespace DesignTools { CurveItem::CurveItem(QGraphicsItem *parent) @@ -98,7 +100,7 @@ bool CurveItem::contains(const QPointF &point) const bool valid = false; QPointF transformed(m_transform.inverted(&valid).map(point)); - double width = abs(20.0 / scaleY(m_transform)); + double width = std::abs(20.0 / scaleY(m_transform)); if (valid) return curve().intersects(transformed, width); diff --git a/src/plugins/qmldesigner/components/curveeditor/detail/selector.cpp b/src/plugins/qmldesigner/components/curveeditor/detail/selector.cpp index b6e7a8fee25..633c1ddd395 100644 --- a/src/plugins/qmldesigner/components/curveeditor/detail/selector.cpp +++ b/src/plugins/qmldesigner/components/curveeditor/detail/selector.cpp @@ -29,6 +29,8 @@ #include +#include + namespace DesignTools { Selector::Selector() {} From 77c90f0856ca69480c319db25f2bd969808ef74c Mon Sep 17 00:00:00 2001 From: Christian Kandeler Date: Wed, 19 Jun 2019 15:31:07 +0200 Subject: [PATCH 25/33] Project wizards: Fix project node assertion Change-Id: I864139747ee6b5e7cb1ac4d59d2b11219750ddde Reviewed-by: hjk --- src/plugins/projectexplorer/jsonwizard/jsonwizard.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/plugins/projectexplorer/jsonwizard/jsonwizard.cpp b/src/plugins/projectexplorer/jsonwizard/jsonwizard.cpp index a1d9c7d6f0e..7141148ef8a 100644 --- a/src/plugins/projectexplorer/jsonwizard/jsonwizard.cpp +++ b/src/plugins/projectexplorer/jsonwizard/jsonwizard.cpp @@ -499,8 +499,13 @@ void JsonWizard::openProjectForNode(Node *node) { using namespace Utils; - ProjectNode *projNode = node->asProjectNode() ? node->asProjectNode() : node->parentProjectNode(); - + const ProjectNode *projNode = node->asProjectNode(); + if (!projNode) { + if (ContainerNode * const cn = node->asContainerNode()) + projNode = cn->rootProjectNode(); + else + projNode = node->parentProjectNode(); + } QTC_ASSERT(projNode, return); Utils::optional projFilePath = projNode->visibleAfterAddFileAction(); From 60c2aae02350364564599b358d267046417ad472 Mon Sep 17 00:00:00 2001 From: Cristian Adam Date: Wed, 19 Jun 2019 12:46:17 +0200 Subject: [PATCH 26/33] qtcreator: Set thread pool stack size to 2MiB Visual C++ sets 1MiB as stack size, macOSX has 512KiB. Both crash with a specified project. MinGW sets 2MiB as stack size, the specified project loads just fine. Fixes: QTCREATORBUG-22496 Change-Id: I6f19e74a681977e4fe1dceee292ea9c838999a1a Reviewed-by: Nikolai Kosjar Reviewed-by: Eike Ziller --- src/plugins/cpptools/cppmodelmanager.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/plugins/cpptools/cppmodelmanager.cpp b/src/plugins/cpptools/cppmodelmanager.cpp index 99d008aa3d1..c82355b31b0 100644 --- a/src/plugins/cpptools/cppmodelmanager.cpp +++ b/src/plugins/cpptools/cppmodelmanager.cpp @@ -62,6 +62,7 @@ #include #include #include +#include #include #include @@ -513,6 +514,10 @@ CppModelManager::CppModelManager() d->m_indexingSupporter = nullptr; d->m_enableGC = true; + // Visual C++ has 1MiB, macOSX has 512KiB + if (Utils::HostOsInfo::isWindowsHost() || Utils::HostOsInfo::isMacHost()) + d->m_threadPool.setStackSize(2 * 1024 * 1024); + qRegisterMetaType >(); connect(this, &CppModelManager::sourceFilesRefreshed, this, &CppModelManager::onSourceFilesRefreshed); From 39e3294a8c54b3c73d3b8fb5bef67431e97d727d Mon Sep 17 00:00:00 2001 From: Christian Kandeler Date: Tue, 18 Jun 2019 13:52:39 +0200 Subject: [PATCH 27/33] SSH: Log some more information for sftp sessions Change-Id: I9065866920b964a32e9b5b6204a6e42bc15acdfe Reviewed-by: hjk --- src/libs/ssh/sftpsession.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/libs/ssh/sftpsession.cpp b/src/libs/ssh/sftpsession.cpp index efced580c99..528475ed2b9 100644 --- a/src/libs/ssh/sftpsession.cpp +++ b/src/libs/ssh/sftpsession.cpp @@ -83,6 +83,8 @@ struct SftpSession::SftpSessionPrivate SftpJobId queueCommand(CommandType command, const QStringList &paths) { + qCDebug(sshLog) << "queueing command" << int(command) << paths; + const SftpJobId jobId = nextJobId++; pendingCommands.enqueue(Command(command, paths, jobId)); runNextCommand(); @@ -111,6 +113,7 @@ SftpSession::SftpSession(const QStringList &connectionArgs) : d(new SftpSessionP { d->connectionArgs = connectionArgs; connect(&d->sftpProc, &QProcess::started, [this] { + qCDebug(sshLog) << "sftp process started"; d->sftpProc.write("\n"); // Force initial prompt. }); connect(&d->sftpProc, &QProcess::errorOccurred, [this](QProcess::ProcessError error) { @@ -120,6 +123,8 @@ SftpSession::SftpSession(const QStringList &connectionArgs) : d(new SftpSessionP } }); connect(&d->sftpProc, QOverload::of(&QProcess::finished), [this] { + qCDebug(sshLog) << "sftp process finished"; + d->state = State::Inactive; if (d->sftpProc.exitStatus() != QProcess::NormalExit) { emit done(tr("sftp crashed.")); @@ -269,6 +274,8 @@ void SftpSession::start() void SftpSession::quit() { + qCDebug(sshLog) << "quitting sftp session, current state is" << int(state()); + switch (state()) { case State::Starting: case State::Closing: From 3a7a1c5e81ef0f9bd7bb78b53b81afa7438ff3d2 Mon Sep 17 00:00:00 2001 From: Thomas Hartmann Date: Fri, 14 Jun 2019 14:27:17 +0200 Subject: [PATCH 28/33] QmlDesigner: Add createQmlObjectNode() The item library can also create pure QtObjects now. This should be reflected in the API. Change-Id: I58f8306232137c9feecf51d0abb938191c0a113a Reviewed-by: Tim Jenssen --- .../navigator/navigatortreemodel.cpp | 10 ++--- .../designercore/include/qmlitemnode.h | 7 +++- .../designercore/model/qmlitemnode.cpp | 37 +++++++++++-------- 3 files changed, 33 insertions(+), 21 deletions(-) diff --git a/src/plugins/qmldesigner/components/navigator/navigatortreemodel.cpp b/src/plugins/qmldesigner/components/navigator/navigatortreemodel.cpp index 4ceb51e985e..f21a0430a7a 100644 --- a/src/plugins/qmldesigner/components/navigator/navigatortreemodel.cpp +++ b/src/plugins/qmldesigner/components/navigator/navigatortreemodel.cpp @@ -503,17 +503,17 @@ void NavigatorTreeModel::handleItemLibraryItemDrop(const QMimeData *mimeData, in if (!NodeHints::fromItemLibraryEntry(itemLibraryEntry).canBeDroppedInNavigator()) return; - const QmlItemNode newQmlItemNode = QmlItemNode::createQmlItemNode(m_view, itemLibraryEntry, QPointF(), targetProperty); + const QmlObjectNode newQmlObjectNode = QmlItemNode::createQmlObjectNode(m_view, itemLibraryEntry, QPointF(), targetProperty); - if (newQmlItemNode.isValid() && targetProperty.isNodeListProperty()) { + if (newQmlObjectNode.isValid() && targetProperty.isNodeListProperty()) { QList newModelNodeList; - newModelNodeList.append(newQmlItemNode); + newModelNodeList.append(newQmlObjectNode); moveNodesInteractive(targetProperty, newModelNodeList, targetRowNumber); } - if (newQmlItemNode.isValid()) - m_view->selectModelNode(newQmlItemNode.modelNode()); + if (newQmlObjectNode.isValid()) + m_view->selectModelNode(newQmlObjectNode.modelNode()); } } diff --git a/src/plugins/qmldesigner/designercore/include/qmlitemnode.h b/src/plugins/qmldesigner/designercore/include/qmlitemnode.h index f857a36432e..1560ebb3ff4 100644 --- a/src/plugins/qmldesigner/designercore/include/qmlitemnode.h +++ b/src/plugins/qmldesigner/designercore/include/qmlitemnode.h @@ -53,10 +53,15 @@ public: static bool isItemOrWindow(const ModelNode &modelNode); static QmlItemNode createQmlItemNode(AbstractView *view, + const ItemLibraryEntry &itemLibraryEntry, + const QPointF &position, + QmlItemNode parentQmlItemNode); + + static QmlObjectNode createQmlObjectNode(AbstractView *view, const ItemLibraryEntry &itemLibraryEntry, const QPointF &position, QmlItemNode parentQmlItemNode); - static QmlItemNode createQmlItemNode(AbstractView *view, + static QmlObjectNode createQmlObjectNode(AbstractView *view, const ItemLibraryEntry &itemLibraryEntry, const QPointF &position, NodeAbstractProperty parentproperty); diff --git a/src/plugins/qmldesigner/designercore/model/qmlitemnode.cpp b/src/plugins/qmldesigner/designercore/model/qmlitemnode.cpp index ea40b46e8bf..65b34f1de4f 100644 --- a/src/plugins/qmldesigner/designercore/model/qmlitemnode.cpp +++ b/src/plugins/qmldesigner/designercore/model/qmlitemnode.cpp @@ -85,8 +85,15 @@ static QmlItemNode createQmlItemNodeFromSource(AbstractView *view, const QString return QmlItemNode(); } +QmlItemNode QmlItemNode::createQmlItemNode(AbstractView *view, + const ItemLibraryEntry &itemLibraryEntry, + const QPointF &position, + QmlItemNode parentQmlItemNode) +{ + return QmlItemNode(createQmlObjectNode(view, itemLibraryEntry, position, parentQmlItemNode)); +} -QmlItemNode QmlItemNode::createQmlItemNode(AbstractView *view, const ItemLibraryEntry &itemLibraryEntry, const QPointF &position, QmlItemNode parentQmlItemNode) +QmlObjectNode QmlItemNode::createQmlObjectNode(AbstractView *view, const ItemLibraryEntry &itemLibraryEntry, const QPointF &position, QmlItemNode parentQmlItemNode) { if (!parentQmlItemNode.isValid()) parentQmlItemNode = QmlItemNode(view->rootModelNode()); @@ -95,14 +102,14 @@ QmlItemNode QmlItemNode::createQmlItemNode(AbstractView *view, const ItemLibrary NodeAbstractProperty parentProperty = parentQmlItemNode.defaultNodeAbstractProperty(); - return QmlItemNode::createQmlItemNode(view, itemLibraryEntry, position, parentProperty); + return QmlItemNode::createQmlObjectNode(view, itemLibraryEntry, position, parentProperty); } -QmlItemNode QmlItemNode::createQmlItemNode(AbstractView *view, const ItemLibraryEntry &itemLibraryEntry, const QPointF &position, NodeAbstractProperty parentproperty) +QmlObjectNode QmlItemNode::createQmlObjectNode(AbstractView *view, const ItemLibraryEntry &itemLibraryEntry, const QPointF &position, NodeAbstractProperty parentproperty) { - QmlItemNode newQmlItemNode; + QmlObjectNode newQmlObjectNode; - view->executeInTransaction("QmlItemNode::createQmlItemNode", [=, &newQmlItemNode, &parentproperty](){ + view->executeInTransaction("QmlItemNode::createQmlItemNode", [=, &newQmlObjectNode, &parentproperty](){ NodeMetaInfo metaInfo = view->model()->metaInfo(itemLibraryEntry.typeName()); int minorVersion = metaInfo.minorVersion(); @@ -128,31 +135,31 @@ QmlItemNode QmlItemNode::createQmlItemNode(AbstractView *view, const ItemLibrary } } - newQmlItemNode = QmlItemNode(view->createModelNode(itemLibraryEntry.typeName(), majorVersion, minorVersion, propertyPairList)); + newQmlObjectNode = QmlItemNode(view->createModelNode(itemLibraryEntry.typeName(), majorVersion, minorVersion, propertyPairList)); } else { - newQmlItemNode = createQmlItemNodeFromSource(view, itemLibraryEntry.qmlSource(), position); + newQmlObjectNode = createQmlItemNodeFromSource(view, itemLibraryEntry.qmlSource(), position); } if (parentproperty.isValid()) - parentproperty.reparentHere(newQmlItemNode); + parentproperty.reparentHere(newQmlObjectNode); - if (!newQmlItemNode.isValid()) + if (!newQmlObjectNode.isValid()) return; - newQmlItemNode.setId(view->generateNewId(itemLibraryEntry.name())); + newQmlObjectNode.setId(view->generateNewId(itemLibraryEntry.name())); for (const auto &propertyBindingEntry : propertyBindingList) - newQmlItemNode.modelNode().bindingProperty(propertyBindingEntry.first).setExpression(propertyBindingEntry.second); + newQmlObjectNode.modelNode().bindingProperty(propertyBindingEntry.first).setExpression(propertyBindingEntry.second); for (const auto &propertyBindingEntry : propertyEnumList) - newQmlItemNode.modelNode().variantProperty(propertyBindingEntry.first).setEnumeration(propertyBindingEntry.second.toUtf8()); + newQmlObjectNode.modelNode().variantProperty(propertyBindingEntry.first).setEnumeration(propertyBindingEntry.second.toUtf8()); - Q_ASSERT(newQmlItemNode.isValid()); + Q_ASSERT(newQmlObjectNode.isValid()); }); - Q_ASSERT(newQmlItemNode.isValid()); + Q_ASSERT(newQmlObjectNode.isValid()); - return newQmlItemNode; + return newQmlObjectNode; } QmlItemNode QmlItemNode::createQmlItemNodeFromImage(AbstractView *view, const QString &imageName, const QPointF &position, QmlItemNode parentQmlItemNode) From dfc5e76830795d05cfa29ae685c40816f09246bc Mon Sep 17 00:00:00 2001 From: Thomas Hartmann Date: Fri, 14 Jun 2019 14:29:34 +0200 Subject: [PATCH 29/33] QmlDesigner: Some support for non default properties in navigator * Using hints to determine if properties/nodes should be visible, even if they are not in a default property. * Using hints to add items to properties that are not the default property. Change-Id: Iab461287807d0c82a535b7d182b989e42f96d21c Reviewed-by: Tim Jenssen --- .../navigator/navigatortreemodel.cpp | 39 +++++++++++++++---- 1 file changed, 31 insertions(+), 8 deletions(-) diff --git a/src/plugins/qmldesigner/components/navigator/navigatortreemodel.cpp b/src/plugins/qmldesigner/components/navigator/navigatortreemodel.cpp index f21a0430a7a..2a559c73595 100644 --- a/src/plugins/qmldesigner/components/navigator/navigatortreemodel.cpp +++ b/src/plugins/qmldesigner/components/navigator/navigatortreemodel.cpp @@ -246,14 +246,29 @@ Qt::ItemFlags NavigatorTreeModel::flags(const QModelIndex &index) const | Qt::ItemNeverHasChildren; } +void static appendForcedNodes(const NodeListProperty &property, QList &list) +{ + const QStringList visibleProperties = NodeHints::fromModelNode(property.parentModelNode()).visibleNonDefaultProperties(); + for (const ModelNode &node : property.parentModelNode().directSubModelNodes()) { + if (!list.contains(node) && visibleProperties.contains(QString::fromUtf8(node.parentProperty().name()))) + list.append(node); + } +} + QList filteredList(const NodeListProperty &property, bool filter) { if (!filter) return property.toModelNodeList(); - return Utils::filtered(property.toModelNodeList(), [] (const ModelNode &arg) { + QList list; + + list.append(Utils::filtered(property.toModelNodeList(), [] (const ModelNode &arg) { return QmlItemNode::isValidQmlItemNode(arg) || NodeHints::fromModelNode(arg).visibleInNavigator(); - }); + })); + + appendForcedNodes(property, list); + + return list; } QModelIndex NavigatorTreeModel::index(int row, int column, @@ -431,7 +446,8 @@ bool NavigatorTreeModel::dropMimeData(const QMimeData *mimeData, static bool findTargetProperty(const QModelIndex &rowModelIndex, NavigatorTreeModel *navigatorTreeModel, NodeAbstractProperty *targetProperty, - int *targetRowNumber) + int *targetRowNumber, + const QString &propertyName = {}) { QModelIndex targetItemIndex; PropertyName targetPropertyName; @@ -445,7 +461,10 @@ static bool findTargetProperty(const QModelIndex &rowModelIndex, if (!targetNode.metaInfo().hasDefaultProperty()) return false; - targetPropertyName = targetNode.metaInfo().defaultPropertyName(); + if (propertyName.isEmpty()) + targetPropertyName = targetNode.metaInfo().defaultPropertyName(); + else + targetPropertyName = propertyName.toUtf8(); } // Disallow dropping items between properties, which are listed first. @@ -494,12 +513,16 @@ void NavigatorTreeModel::handleItemLibraryItemDrop(const QMimeData *mimeData, in int targetRowNumber = rowNumber; NodeAbstractProperty targetProperty; - bool foundTarget = findTargetProperty(rowModelIndex, this, &targetProperty, &targetRowNumber); + const ItemLibraryEntry itemLibraryEntry = + createItemLibraryEntryFromMimeData(mimeData->data("application/vnd.bauhaus.itemlibraryinfo")); + + const NodeHints hints = NodeHints::fromItemLibraryEntry(itemLibraryEntry); + + const QString targetPropertyName = hints.forceNonDefaultProperty(); + + bool foundTarget = findTargetProperty(rowModelIndex, this, &targetProperty, &targetRowNumber, targetPropertyName); if (foundTarget) { - const ItemLibraryEntry itemLibraryEntry = - createItemLibraryEntryFromMimeData(mimeData->data("application/vnd.bauhaus.itemlibraryinfo")); - if (!NodeHints::fromItemLibraryEntry(itemLibraryEntry).canBeDroppedInNavigator()) return; From 3333f1b8acbafb18cdda3e6548fad7967051ee26 Mon Sep 17 00:00:00 2001 From: Thomas Hartmann Date: Wed, 19 Jun 2019 09:17:36 +0200 Subject: [PATCH 30/33] QmlDesigner: Check if property exists before reparenting Change-Id: I503abbbf8e9312d66567529d0bde66f0090b6f70 Reviewed-by: Tim Jenssen --- .../components/navigator/navigatortreemodel.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/plugins/qmldesigner/components/navigator/navigatortreemodel.cpp b/src/plugins/qmldesigner/components/navigator/navigatortreemodel.cpp index 2a559c73595..8c89acb7c83 100644 --- a/src/plugins/qmldesigner/components/navigator/navigatortreemodel.cpp +++ b/src/plugins/qmldesigner/components/navigator/navigatortreemodel.cpp @@ -447,7 +447,7 @@ static bool findTargetProperty(const QModelIndex &rowModelIndex, NavigatorTreeModel *navigatorTreeModel, NodeAbstractProperty *targetProperty, int *targetRowNumber, - const QString &propertyName = {}) + const PropertyName &propertyName = {}) { QModelIndex targetItemIndex; PropertyName targetPropertyName; @@ -461,10 +461,10 @@ static bool findTargetProperty(const QModelIndex &rowModelIndex, if (!targetNode.metaInfo().hasDefaultProperty()) return false; - if (propertyName.isEmpty()) + if (propertyName.isEmpty() || !targetNode.metaInfo().hasProperty(propertyName)) targetPropertyName = targetNode.metaInfo().defaultPropertyName(); else - targetPropertyName = propertyName.toUtf8(); + targetPropertyName = propertyName; } // Disallow dropping items between properties, which are listed first. @@ -520,7 +520,7 @@ void NavigatorTreeModel::handleItemLibraryItemDrop(const QMimeData *mimeData, in const QString targetPropertyName = hints.forceNonDefaultProperty(); - bool foundTarget = findTargetProperty(rowModelIndex, this, &targetProperty, &targetRowNumber, targetPropertyName); + bool foundTarget = findTargetProperty(rowModelIndex, this, &targetProperty, &targetRowNumber, targetPropertyName.toUtf8()); if (foundTarget) { if (!NodeHints::fromItemLibraryEntry(itemLibraryEntry).canBeDroppedInNavigator()) From 44f1d183077460c3e6fa2e0b533abc68e341337d Mon Sep 17 00:00:00 2001 From: Tim Jenssen Date: Wed, 19 Jun 2019 19:42:15 +0200 Subject: [PATCH 31/33] qmljs: sync parser with current 5.12 state Task-number: QTCREATORBUG-22474 Change-Id: I86d7ee7cc28e95f814f2ba36551a36c8a59e1a79 Reviewed-by: Ulf Hermann --- src/libs/qmljs/parser/qmljslexer.cpp | 67 +++++++++++++++++++--------- src/libs/qmljs/parser/qmljslexer_p.h | 3 ++ 2 files changed, 48 insertions(+), 22 deletions(-) diff --git a/src/libs/qmljs/parser/qmljslexer.cpp b/src/libs/qmljs/parser/qmljslexer.cpp index 19d367be1ba..ab7a33917e0 100644 --- a/src/libs/qmljs/parser/qmljslexer.cpp +++ b/src/libs/qmljs/parser/qmljslexer.cpp @@ -116,6 +116,7 @@ void Lexer::setCode(const QString &code, int lineno, bool qmlMode) _tokenText.reserve(1024); _errorMessage.clear(); _tokenSpell = QStringRef(); + _rawString = QStringRef(); _codePtr = code.unicode(); _endPtr = _codePtr + code.length(); @@ -149,13 +150,20 @@ void Lexer::setCode(const QString &code, int lineno, bool qmlMode) void Lexer::scanChar() { - unsigned sequenceLength = isLineTerminatorSequence(); + if (_skipLinefeed) { + Q_ASSERT(*_codePtr == QLatin1Char('\n')); + ++_codePtr; + _skipLinefeed = false; + } _char = *_codePtr++; - if (sequenceLength == 2) - _char = *_codePtr++; - ++_currentColumnNumber; + if (isLineTerminator()) { + if (_char == QLatin1Char('\r')) { + if (_codePtr < _endPtr && *_codePtr == QLatin1Char('\n')) + _skipLinefeed = true; + _char = QLatin1Char('\n'); + } ++_currentLineNumber; _currentColumnNumber = 0; } @@ -232,6 +240,7 @@ int Lexer::lex() again: _tokenSpell = QStringRef(); + _rawString = QStringRef(); _tokenKind = scanToken(); _tokenLength = _codePtr - _tokenStartPtr - 1; @@ -807,12 +816,15 @@ int Lexer::scanString(ScanStringMode mode) QChar quote = (mode == TemplateContinuation) ? QChar(TemplateHead) : QChar(mode); bool multilineStringLiteral = false; - const QChar *startCode = _codePtr; + const QChar *startCode = _codePtr - 1; + // in case we just parsed a \r, we need to reset this flag to get things working + // correctly in the loop below and afterwards + _skipLinefeed = false; if (_engine) { while (_codePtr <= _endPtr) { - if (isLineTerminator() && quote != QLatin1Char('`')) { - if (qmlMode()) + if (isLineTerminator()) { + if ((quote == QLatin1Char('`') || qmlMode())) break; _errorCode = IllegalCharacter; _errorMessage = QCoreApplication::translate("QmlParser", "Stray newline in string literal"); @@ -822,7 +834,8 @@ int Lexer::scanString(ScanStringMode mode) } else if (_char == '$' && quote == QLatin1Char('`')) { break; } else if (_char == quote) { - _tokenSpell = _engine->midRef(startCode - _code.unicode() - 1, _codePtr - startCode); + _tokenSpell = _engine->midRef(startCode - _code.unicode(), _codePtr - startCode - 1); + _rawString = _tokenSpell; scanChar(); if (quote == QLatin1Char('`')) @@ -835,28 +848,36 @@ int Lexer::scanString(ScanStringMode mode) else return T_STRING_LITERAL; } - scanChar(); + // don't use scanChar() here, that would transform \r sequences and the midRef() call would create the wrong result + _char = *_codePtr++; + ++_currentColumnNumber; } } + // rewind by one char, so things gets scanned correctly + --_codePtr; + _validTokenText = true; - _tokenText.resize(0); - startCode--; - while (startCode != _codePtr - 1) - _tokenText += *startCode++; + _tokenText = QString(startCode, _codePtr - startCode); + + auto setRawString = [&](const QChar *end) { + QString raw(startCode, end - startCode - 1); + raw.replace(QLatin1String("\r\n"), QLatin1String("\n")); + raw.replace(QLatin1Char('\r'), QLatin1Char('\n')); + _rawString = _engine->newStringRef(raw); + }; + + scanChar(); while (_codePtr <= _endPtr) { - if (unsigned sequenceLength = isLineTerminatorSequence()) { - multilineStringLiteral = true; - _tokenText += _char; - if (sequenceLength == 2) - _tokenText += *_codePtr; - scanChar(); - } else if (_char == mode) { + if (_char == quote) { scanChar(); - if (_engine) + if (_engine) { _tokenSpell = _engine->newStringRef(_tokenText); + if (quote == QLatin1Char('`')) + setRawString(_codePtr - 1); + } if (quote == QLatin1Char('`')) _bracesCount = _outerTemplateBraceCount.pop(); @@ -871,8 +892,10 @@ int Lexer::scanString(ScanStringMode mode) scanChar(); scanChar(); _bracesCount = 1; - if (_engine) + if (_engine) { _tokenSpell = _engine->newStringRef(_tokenText); + setRawString(_codePtr - 2); + } return (mode == TemplateHead ? T_TEMPLATE_HEAD : T_TEMPLATE_MIDDLE); } else if (_char == QLatin1Char('\\')) { diff --git a/src/libs/qmljs/parser/qmljslexer_p.h b/src/libs/qmljs/parser/qmljslexer_p.h index 39128b44098..5773606c399 100644 --- a/src/libs/qmljs/parser/qmljslexer_p.h +++ b/src/libs/qmljs/parser/qmljslexer_p.h @@ -146,6 +146,7 @@ public: int tokenStartColumn() const { return _tokenColumn; } inline QStringRef tokenSpell() const { return _tokenSpell; } + inline QStringRef rawString() const { return _rawString; } double tokenValue() const { return _tokenValue; } QString tokenText() const; @@ -198,6 +199,7 @@ private: QString _tokenText; QString _errorMessage; QStringRef _tokenSpell; + QStringRef _rawString; const QChar *_codePtr; const QChar *_endPtr; @@ -233,6 +235,7 @@ private: bool _followsClosingBrace; bool _delimited; bool _qmlMode; + bool _skipLinefeed = false; int _generatorLevel = 0; bool _staticIsKeyword = false; }; From a3fb2051add168a3bc29f0bd4f83f1c4d6fb86a8 Mon Sep 17 00:00:00 2001 From: Tim Jenssen Date: Wed, 19 Jun 2019 20:17:29 +0200 Subject: [PATCH 32/33] QmlJS: Fix code re-formatter for property Fixes: QTCREATORBUG-22515 Change-Id: Ie560f8cf9e43081a37f2210ea2f6df741f14ced6 Reviewed-by: Tim Jenssen Reviewed-by: Ulf Hermann --- src/libs/qmljs/qmljsreformatter.cpp | 7 +++---- tests/auto/qml/reformatter/qmlsyntax.qml | 2 ++ 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/libs/qmljs/qmljsreformatter.cpp b/src/libs/qmljs/qmljsreformatter.cpp index b2bb503d22e..d60d6179f3d 100644 --- a/src/libs/qmljs/qmljsreformatter.cpp +++ b/src/libs/qmljs/qmljsreformatter.cpp @@ -633,10 +633,10 @@ protected: if (!ast->typeModifier.isNull()) { out(ast->typeModifierToken); out("<"); - out(ast->typeToken); + accept(ast->memberType); out(">"); } else { - out(ast->typeToken); + accept(ast->memberType); } out(" "); if (ast->statement) { @@ -1329,9 +1329,8 @@ protected: { for (FormalParameterList *it = ast; it; it = it->next) { out(it->element->bindingIdentifier.toString()); // TODO - if (it->next) { + if (it->next) out(", "); - } } return false; } diff --git a/tests/auto/qml/reformatter/qmlsyntax.qml b/tests/auto/qml/reformatter/qmlsyntax.qml index 8717aba35d5..3e555030490 100644 --- a/tests/auto/qml/reformatter/qmlsyntax.qml +++ b/tests/auto/qml/reformatter/qmlsyntax.qml @@ -9,6 +9,8 @@ Text { property int foo property alias bar: x property list pro + property Part.Particles particles + property list particlesList default property int def property var baz: Rectangle { width: 20 From 3e37a93c2e632d3a13b49339650303d8c25fa378 Mon Sep 17 00:00:00 2001 From: Christian Stenger Date: Thu, 20 Jun 2019 09:09:56 +0200 Subject: [PATCH 33/33] QmlDesigner: Fix compile with namespaced Qt Broke with 376c6b9d59c. Change-Id: If98cb76aa5c68c7c2ada5578ab58c37956617c19 Reviewed-by: Tim Jenssen --- .../qmldesigner/components/curveeditor/curveeditormodel.h | 2 ++ .../components/curveeditor/detail/curveeditorstyledialog.h | 2 ++ .../qmldesigner/components/curveeditor/detail/curvesegment.h | 2 ++ .../qmldesigner/components/curveeditor/detail/playhead.h | 2 ++ src/plugins/qmldesigner/components/curveeditor/detail/utils.h | 2 ++ src/plugins/qmldesigner/components/curveeditor/treeitem.h | 2 ++ 6 files changed, 12 insertions(+) diff --git a/src/plugins/qmldesigner/components/curveeditor/curveeditormodel.h b/src/plugins/qmldesigner/components/curveeditor/curveeditormodel.h index 840107ced5d..6e212d4c6af 100644 --- a/src/plugins/qmldesigner/components/curveeditor/curveeditormodel.h +++ b/src/plugins/qmldesigner/components/curveeditor/curveeditormodel.h @@ -29,7 +29,9 @@ #include +QT_BEGIN_NAMESPACE class QPointF; +QT_END_NAMESPACE namespace DesignTools { diff --git a/src/plugins/qmldesigner/components/curveeditor/detail/curveeditorstyledialog.h b/src/plugins/qmldesigner/components/curveeditor/detail/curveeditorstyledialog.h index ad5a28e2e13..f1dc3bc3728 100644 --- a/src/plugins/qmldesigner/components/curveeditor/detail/curveeditorstyledialog.h +++ b/src/plugins/qmldesigner/components/curveeditor/detail/curveeditorstyledialog.h @@ -28,9 +28,11 @@ #include +QT_BEGIN_NAMESPACE class QPushButton; class QSpinBox; class QDoubleSpinBox; +QT_END_NAMESPACE namespace DesignTools { diff --git a/src/plugins/qmldesigner/components/curveeditor/detail/curvesegment.h b/src/plugins/qmldesigner/components/curveeditor/detail/curvesegment.h index ce2d700f891..5dbce58bccd 100644 --- a/src/plugins/qmldesigner/components/curveeditor/detail/curvesegment.h +++ b/src/plugins/qmldesigner/components/curveeditor/detail/curvesegment.h @@ -29,7 +29,9 @@ #include +QT_BEGIN_NAMESPACE class QPointF; +QT_END_NAMESPACE namespace DesignTools { diff --git a/src/plugins/qmldesigner/components/curveeditor/detail/playhead.h b/src/plugins/qmldesigner/components/curveeditor/detail/playhead.h index ffb4da4cfdc..28d2a21a5c3 100644 --- a/src/plugins/qmldesigner/components/curveeditor/detail/playhead.h +++ b/src/plugins/qmldesigner/components/curveeditor/detail/playhead.h @@ -28,7 +28,9 @@ #include #include +QT_BEGIN_NAMESPACE class QPainter; +QT_END_NAMESPACE namespace DesignTools { diff --git a/src/plugins/qmldesigner/components/curveeditor/detail/utils.h b/src/plugins/qmldesigner/components/curveeditor/detail/utils.h index 812c5d083ac..77cbd2c7bf2 100644 --- a/src/plugins/qmldesigner/components/curveeditor/detail/utils.h +++ b/src/plugins/qmldesigner/components/curveeditor/detail/utils.h @@ -25,11 +25,13 @@ #pragma once +QT_BEGIN_NAMESPACE class QColor; class QPalette; class QPointF; class QRectF; class QTransform; +QT_END_NAMESPACE namespace DesignTools { diff --git a/src/plugins/qmldesigner/components/curveeditor/treeitem.h b/src/plugins/qmldesigner/components/curveeditor/treeitem.h index e5004834b8e..5b31dc2fc8c 100644 --- a/src/plugins/qmldesigner/components/curveeditor/treeitem.h +++ b/src/plugins/qmldesigner/components/curveeditor/treeitem.h @@ -33,8 +33,10 @@ #include +QT_BEGIN_NAMESPACE class QIcon; class QVariant; +QT_END_NAMESPACE namespace DesignTools {