diff --git a/coin/product_dependencies.yaml b/coin/product_dependencies.yaml new file mode 100644 index 00000000000..f853a491917 --- /dev/null +++ b/coin/product_dependencies.yaml @@ -0,0 +1,4 @@ +dependencies: + ../../qt/qt5.git: + ref: "6.1" + diff --git a/doc/qtcreator/images/qmldesigner-bindings.png b/doc/qtcreator/images/qmldesigner-bindings.png index 32ccc569074..ad7dde04b7a 100644 Binary files a/doc/qtcreator/images/qmldesigner-bindings.png and b/doc/qtcreator/images/qmldesigner-bindings.png differ diff --git a/doc/qtcreator/images/qmldesigner-connections.png b/doc/qtcreator/images/qmldesigner-connections.png index 950c804306b..827359bf497 100644 Binary files a/doc/qtcreator/images/qmldesigner-connections.png and b/doc/qtcreator/images/qmldesigner-connections.png differ diff --git a/doc/qtcreator/images/qmldesigner-custom-component-properties.png b/doc/qtcreator/images/qmldesigner-custom-component-properties.png index b935f941325..9fbb8b7901d 100644 Binary files a/doc/qtcreator/images/qmldesigner-custom-component-properties.png and b/doc/qtcreator/images/qmldesigner-custom-component-properties.png differ diff --git a/doc/qtcreator/images/qmldesigner-dynamicprops.png b/doc/qtcreator/images/qmldesigner-dynamicprops.png index 82cd304888b..fc321c4c7e2 100644 Binary files a/doc/qtcreator/images/qmldesigner-dynamicprops.png and b/doc/qtcreator/images/qmldesigner-dynamicprops.png differ diff --git a/doc/qtcreator/images/qmldesigner-editing-components.png b/doc/qtcreator/images/qmldesigner-editing-components.png index 1fe80e23c11..e7a7d21fe7e 100644 Binary files a/doc/qtcreator/images/qmldesigner-editing-components.png and b/doc/qtcreator/images/qmldesigner-editing-components.png differ diff --git a/doc/qtcreator/images/qmldesigner-properties-view.png b/doc/qtcreator/images/qmldesigner-properties-view.png index 36c2e9ca15d..eb9cf6356f3 100644 Binary files a/doc/qtcreator/images/qmldesigner-properties-view.png and b/doc/qtcreator/images/qmldesigner-properties-view.png differ diff --git a/doc/qtcreator/images/qmldesigner-qml-components.png b/doc/qtcreator/images/qmldesigner-qml-components.png index 46918eee924..209d6fe0afe 100644 Binary files a/doc/qtcreator/images/qmldesigner-qml-components.png and b/doc/qtcreator/images/qmldesigner-qml-components.png differ diff --git a/doc/qtcreator/images/qtcreator-move-component-into-separate-file.png b/doc/qtcreator/images/qtcreator-move-component-into-separate-file.png index 3e444ab1bd5..fe946a3303f 100644 Binary files a/doc/qtcreator/images/qtcreator-move-component-into-separate-file.png and b/doc/qtcreator/images/qtcreator-move-component-into-separate-file.png differ diff --git a/doc/qtcreator/images/qtquick-library-context-menu-hide.png b/doc/qtcreator/images/qtquick-library-context-menu-hide.png new file mode 100644 index 00000000000..8c2e87a67b8 Binary files /dev/null and b/doc/qtcreator/images/qtquick-library-context-menu-hide.png differ diff --git a/doc/qtcreator/images/qtquick-library-context-menu.png b/doc/qtcreator/images/qtquick-library-context-menu.png new file mode 100644 index 00000000000..2ceb85234ba Binary files /dev/null and b/doc/qtcreator/images/qtquick-library-context-menu.png differ diff --git a/doc/qtcreator/src/projects/creator-only/creator-projects-build-run-tutorial.qdoc b/doc/qtcreator/src/projects/creator-only/creator-projects-build-run-tutorial.qdoc index 1e2960eca0b..155e30af9ad 100644 --- a/doc/qtcreator/src/projects/creator-only/creator-projects-build-run-tutorial.qdoc +++ b/doc/qtcreator/src/projects/creator-only/creator-projects-build-run-tutorial.qdoc @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2020 The Qt Company Ltd. +** Copyright (C) 2021 The Qt Company Ltd. ** Contact: https://www.qt.io/licensing/ ** ** This file is part of the Qt Creator documentation. @@ -45,9 +45,9 @@ To run an example application on a Boot2Qt device, you must set up Qt for Device Creation on the development host and create connections - between the host and devices. For more information, see the - \l{http://doc.qt.io/QtForDeviceCreation/qtee-installation-guide.html} - {Installation Guide} in the + between the host and devices. For more information, see + \l{https://doc.qt.io/QtForDeviceCreation/b2qt-installation-guides.html} + {Installation Guides} in the \l{http://doc.qt.io/QtForDeviceCreation/index.html}{Qt for Device Creation} documentation. diff --git a/doc/qtcreator/src/projects/creator-only/creator-projects-settings-build-qbs.qdoc b/doc/qtcreator/src/projects/creator-only/creator-projects-settings-build-qbs.qdoc index 0bffb2dffea..8ffef125ea1 100644 --- a/doc/qtcreator/src/projects/creator-only/creator-projects-settings-build-qbs.qdoc +++ b/doc/qtcreator/src/projects/creator-only/creator-projects-settings-build-qbs.qdoc @@ -116,6 +116,10 @@ \endlist + If the \l{glossary-buildandrun-kit}{kit} specifies Qt for Android + version 5.14.0 or later, you can select the ABIs for the Android device + architectures to build the project for in the \uicontrol ABIs field. + The \uicontrol {Equivalent command line} field displays the build command that is constructed based on the selected options. diff --git a/doc/qtcreator/src/qtquick/qtquick-component-context-menu.qdocinc b/doc/qtcreator/src/qtquick/qtquick-component-context-menu.qdocinc index 149077c6497..3132605f1d4 100644 --- a/doc/qtcreator/src/qtquick/qtquick-component-context-menu.qdocinc +++ b/doc/qtcreator/src/qtquick/qtquick-component-context-menu.qdocinc @@ -76,8 +76,8 @@ \li Merge File with Template \li \l{Merging Files with Templates} \row - \li Move Component into Separate File - \li \l{Moving Components into Separate Files} + \li Move Component Instances into Separate Files + \li \l{Moving Component Instances into Separate Files} \row \li Add New Signal Handler \li \l{Adding Signal Handlers} diff --git a/doc/qtcreator/src/qtquick/qtquick-components.qdoc b/doc/qtcreator/src/qtquick/qtquick-components.qdoc index 5e76c0068f2..bce279787bf 100644 --- a/doc/qtcreator/src/qtquick/qtquick-components.qdoc +++ b/doc/qtcreator/src/qtquick/qtquick-components.qdoc @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2020 The Qt Company Ltd. +** Copyright (C) 2021 The Qt Company Ltd. ** Contact: https://www.qt.io/licensing/ ** ** This file is part of the Qt Creator documentation. @@ -42,73 +42,84 @@ A \e component is a reusable building block for a UI. - \QDS comes with \e {preset components} that you can use in your project. - These are similar to \e Symbols in Sketch or \e Prefab in Unity. + \QDS comes with \e {preset components} that you can use in your UI by + creating instances of them. + The preset components are similar to \e Symbols in Sketch or \e Prefab in + Unity. Some of the preset components represent simple shapes, text, or images, while others represent complex UI controls with full functionality, such - as spin boxes or sliders. + as spin boxes or sliders. You can also add instances of preset + \l {Using 3D Components}{3D components} to your UIs. - You can modify the \e properties of the preset components and combine them - to build your own components. + To build your own components, you can modify the \e properties of the + component instances and combine them. A component is specified within one file (with the file extension \e ui.qml or \e .qml). For example, a Button component may be defined in \e Button.ui.qml. Typically, the visual appearance of a component - is defined in a \e {UI file} (ui.qml). + is defined in a \e {UI file} (ui.qml). To create component files, + you can use \l{Creating Components from Scratch}{wizard templates}, or + \l{Moving Component Instances into Separate Files} + {move component instances into separate component files}. - The \l {Library} view \uicontrol Components tab lists the components that - have been added to your project. + Select \l Library > \uicontrol Components to view the preset components that + have been added to your project. If you cannot find the components you need, + add the relevant modules to your project, as described in + \l {Adding and Removing Modules}. - \image qmldesigner-qml-components.png "Components" + \image qtquick-components-tab.png "Components in Library" \note Use as few components as possible. To minimize the number of components, use \l{Adding Property Aliases}{alias properties} and \l{Adding States}{states} to create the differences in your component - instances. We recommend reusing components instead of duplicating them, - so the components do not need to be processed as completely new component - types. This reduces the time needed to load and build the application, - as well as the size of the application package. + instances. Using component instances instead of duplicating the components + reduces the time needed to load and build the application, as well as the + size of the application package. - \section1 Adding Components to Designs + \section1 Creating Component Instances - \image qmldesigner-editing-components.png "Editing components in Form Editor" + \image qmldesigner-editing-components.png "Creating Component Instances" \list 1 - \li Drag and drop components from \uicontrol Library (1) to - \uicontrol Navigator (2) or \uicontrol {Form Editor} (3). - \li Select components in \uicontrol Navigator to edit the + \li Drag-and-drop components from \uicontrol Library (1) to + \uicontrol Navigator (2), \uicontrol {Form Editor} (3), or + \l {3D Editor} (4). This creates instances of the components in the + current component file. + \li Select component instances in \uicontrol Navigator to edit the values of their properties in \uicontrol Properties. \image qmldesigner-properties-view.png "Properties view" For more information, see \l {Specifying Component Properties}. - \li To change the appearance and behavior of your components in ways - that are not supported out of the box, you can define custom - properties for your components in the \uicontrol Connections view, - \uicontrol Properties tab. - \image qmldesigner-dynamicprops.png "Connections view Properties tab" + \li To change the appearance and behavior of the component instances + in ways that are not supported in \QDS by default, you can define + custom properties in \uicontrol {Connection View} > + \uicontrol {Properties}. + \image qmldesigner-dynamicprops.png "Connection View Properties tab" For more information, see \l{Specifying Dynamic Properties}. - \li To enable users to interact with components, connect the components - to signals in the \uicontrol Connections view. For example, you can - specify what happens when a component is clicked. - For more information, see \l{Connecting Components to Signals}. - \image qmldesigner-connections.png "Connections view Connections tab" - \li To dynamically change the behavior of an object when another object - changes, create bindings between components in the - \uicontrol {Connection View}, \uicontrol Bindings tab. + \li To enable users to interact with the component instances, connect + the instances to signals in \uicontrol {Connection View} > + \uicontrol Connections. For example, you can specify what happens + when a component instance is clicked. For more information, see + \l{Connecting Components to Signals}. + \image qmldesigner-connections.png "Connection View Connections tab" + \li To dynamically change the behavior of a component instance when + another component instance changes, create bindings between them in + \uicontrol {Connection View} > \uicontrol Bindings. For more information, see \l{Adding Bindings Between Properties}. - \image qmldesigner-bindings.png "Connections view Bindings tab" + \image qmldesigner-bindings.png "Connection View Bindings tab" \li Add states to apply sets of changes to the property values of one - or several components in the \uicontrol States view. + or several component instances in the \uicontrol States view. For more information, see \l{Adding States}. - \li Animate component properties in the \uicontrol Timeline view. - For more information, see \l{Creating Animations}. + \li Animate the properties of component instances in the \uicontrol + Timeline view. For more information, see \l{Creating Animations}. \endlist \section1 Creating Your Own Components You can either use project wizard templates to create custom components and - controls or \l{Moving Components into Separate Files}{move subcomponents - into separate files} to make them reusable in other components. + controls or move component instances into separate files to turn them into + new components that you can create instances of. You can then use the + instances of the new components in other components. \section2 Creating Components from Scratch @@ -128,27 +139,30 @@ tab in the \uicontrol Library view only if the filename begins with a capital letter. - \li Click \uicontrol Design to open the component file (ui.qml] in + \li Click \uicontrol Design to open the component file (ui.qml) in \uicontrol {Form Editor}. - \li Drag and drop a component from \uicontrol Library to + \li Drag-and-drop a component from \uicontrol Library to \uicontrol Navigator or \uicontrol {Form Editor}. - \li Edit component properties in \uicontrol Properties. - + \li Edit component properties in the \uicontrol Properties view. \image qmldesigner-custom-component-properties.png The available properties depend on the component type. You can \l{Specifying Dynamic Properties}{add properties for - components} in the \uicontrol Properties tab of the - \uicontrol {Connection View}. + components} in \uicontrol {Connection View} > \uicontrol Properties. + + \li To change the appearance and behavior of the component instances + in ways that are not supported in \QDS by default, you can define + custom properties in \uicontrol {Connection View} > + \uicontrol {Properties}. \endlist The following sections contain more information about how to use \uicontrol {Form Editor} to edit 2D content and \uicontrol {3D Editor} to edit 3D scenes, as well as examples of how to create UI controls - using basic components: + using instances of basic components: \list @@ -166,26 +180,26 @@ \include qtdesignstudio-components.qdocinc creating studio components \endif - \section2 Moving Components into Separate Files + \section2 Moving Component Instances into Separate Files - An alternative way of creating reusable components is to move them - into separate component files (.ui.qml). Right-click a component - in \uicontrol Navigator or \uicontrol {Form Editor} and select + An alternative way of creating reusable components is to move component + instances into separate component files (.ui.qml). Right-click a component + instance in \uicontrol Navigator or \uicontrol {Form Editor}, and select \uicontrol {Move Component into Separate File} in the context menu. \image qtcreator-move-component-into-separate-file.png - Give the new component a name and select whether properties are set for + Give the new component a name, and select whether properties are set for the new component or for the original one. - When you select \uicontrol OK, a new component file is created and a - reference to the component is added to the code in the current component - file. The way things look in \uicontrol {Form Editor} does not change. + When you select \uicontrol OK, a new component file is created and an + instance of the component is added to the code in the current component + file. The look of your UI in \uicontrol {Form Editor} does not change. To open the new component file for editing the properties that you want - to change for all instances of the component, right-click the component + to change for all instances of the component, right-click the component, and then select \uicontrol {Go into Component} in the context menu. For - additional ways of opening subcomponents, see \l{Moving Within Components}. + additional ways of opening base components, see \l{Moving Within Components}. For an example of creating a reusable custom component, see \if defined(qtcreator) @@ -194,17 +208,17 @@ \l{Progress Bar}. \endif - Custom components are listed in the \uicontrol {My Components} section - of the \uicontrol Components tab in \uicontrol Library and you can use - them to build more components. + Custom components are listed in \uicontrol Library > \uicontrol Components + > \uicontrol {My Components}, and you can use instances of them to build + more components. \include qtquick-mcu-support.qdocinc mcu qtquick components \section1 Merging Files with Templates You can merge the current component file against an existing second - component file and using the second file in a way similar to using a - CSS stylesheet. + component file using the second file in a way similar to using a CSS + stylesheet. To use this experimental feature, right-click a component in the \uicontrol Navigator or \uicontrol {Form Editor} view and select diff --git a/doc/qtcreator/src/qtquick/qtquick-library.qdoc b/doc/qtcreator/src/qtquick/qtquick-library.qdoc index b83e3b3e816..7d81a1eea9a 100644 --- a/doc/qtcreator/src/qtquick/qtquick-library.qdoc +++ b/doc/qtcreator/src/qtquick/qtquick-library.qdoc @@ -41,9 +41,10 @@ \image qtquick-components-tab.png "Library view Components tab" \uicontrol Components displays modules that have been added to your project. - The modules contain visual components, such as basic shapes, UI controls, - and 3D components, and add functionality to the project. All components have - a type. + In many modules the components have been further organized into different + categories. The modules contain visual components, such as basic shapes, + UI controls, and 3D components, and add functionality to the project. + All components have a type. The UI controls can be styled to have the look and feel of a particular operating system, such as \macOS, Windows, Android, or iOS. @@ -110,4 +111,24 @@ or \uicontrol {Form Editor}, components with a suitable type are automatically created for you. For example, components of the \l{Images}{Image} type will be created for graphics files. + + \section1 Context Menu Commands + + \image qtquick-library-context-menu.png "Context menu commands in Library" + \image qtquick-library-context-menu-hide.png "Context menu command Hide Category" + + To use the context menu commands in Library, right-click on the name of + a module or category and select one of the following commands: + + \list + \li \uicontrol {Remove Module}: removes the component module added to + \uicontrol Library. + \li \uicontrol {Expand All}: expands all the modules. + \li \uicontrol {Collapse All}: collapses all the modules. + \li \uicontrol {Hide Category}: hides the category from the module. + \li \uicontrol {Show Module Hidden Categories}: shows the hidden + categories of the module. + \li \uicontrol {Show All Hidden Categories}: shows the hidden + categories in all of the modules. + \endlist */ diff --git a/doc/qtdesignstudio/src/qtdesignstudio-terms.qdoc b/doc/qtdesignstudio/src/qtdesignstudio-terms.qdoc index dc651b68cba..b4297871abd 100644 --- a/doc/qtdesignstudio/src/qtdesignstudio-terms.qdoc +++ b/doc/qtdesignstudio/src/qtdesignstudio-terms.qdoc @@ -78,7 +78,7 @@ \list \li \l{Creating Components}{Library} \li \l{Component Types}{Preset Components} - \li \l{Adding Components to Designs}{My Components} + \li \l{Creating Component Instances}{My Components} \endlist \section1 Device diff --git a/scripts/build_plugin.py b/scripts/build_plugin.py index c70d6051283..7ba55ef38d5 100755 --- a/scripts/build_plugin.py +++ b/scripts/build_plugin.py @@ -32,6 +32,7 @@ from __future__ import print_function import argparse import collections +import glob import os import common @@ -63,20 +64,24 @@ def get_arguments(): args.with_debug_info = args.build_type == 'RelWithDebInfo' return args +def qtcreator_prefix_path(qt_creator_path): + # on macOS the prefix path must be inside the app bundle, but we want to allow + # simpler values for --qtc-path, so search in some variants of that + candidates = [qt_creator_path, os.path.join(qt_creator_path, 'Contents', 'Resources')] + candidates += [os.path.join(path, 'Contents', 'Resources') + for path in glob.glob(os.path.join(qt_creator_path, '*.app'))] + for path in candidates: + if os.path.exists(os.path.join(path, 'lib', 'cmake')): + return [path] + return [qt_creator_path] + def build(args, paths): if not os.path.exists(paths.build): os.makedirs(paths.build) if not os.path.exists(paths.result): os.makedirs(paths.result) - prefix_paths = [os.path.abspath(fp) for fp in args.prefix_paths] + [paths.qt_creator, paths.qt] - if common.is_mac_platform(): - # --qtc-path may be - # "/path/Qt Creator.app/Contents/Resources", - # "/path/Qt Creator.app", or - # "/path", - # so add some variants to the prefix path - prefix_paths += [os.path.join(paths.qt_creator, 'Contents', 'Resources'), - os.path.join(paths.qt_creator, 'Qt Creator.app', 'Contents', 'Resources')] + prefix_paths = [os.path.abspath(fp) for fp in args.prefix_paths] + [paths.qt] + prefix_paths += qtcreator_prefix_path(paths.qt_creator) prefix_paths = [common.to_posix_path(fp) for fp in prefix_paths] separate_debug_info_option = 'ON' if args.with_debug_info else 'OFF' cmake_args = ['cmake', diff --git a/share/qtcreator/debugger/dumper.py b/share/qtcreator/debugger/dumper.py index d006003fbd7..27b448494c0 100644 --- a/share/qtcreator/debugger/dumper.py +++ b/share/qtcreator/debugger/dumper.py @@ -1782,7 +1782,7 @@ class DumperBase(): def metaString(self, metaObjectPtr, index, revision): ptrSize = self.ptrSize() stringdataOffset = ptrSize - if self.isWindowsTarget(): + if self.isWindowsTarget() and self.qtVersion() >= 0x060000: stringdataOffset += ptrSize # indirect super data member stringdata = self.extractPointer(toInteger(metaObjectPtr) + stringdataOffset) diff --git a/src/libs/clangsupport/projectpartid.h b/src/libs/clangsupport/projectpartid.h index 335a0f0cc55..7887e99a91a 100644 --- a/src/libs/clangsupport/projectpartid.h +++ b/src/libs/clangsupport/projectpartid.h @@ -27,6 +27,8 @@ #include +#include + namespace ClangBackEnd { class ProjectPartId diff --git a/src/libs/utils/qtcolorbutton.cpp b/src/libs/utils/qtcolorbutton.cpp index 4acac27ea84..a8aae375818 100644 --- a/src/libs/utils/qtcolorbutton.cpp +++ b/src/libs/utils/qtcolorbutton.cpp @@ -54,6 +54,7 @@ public: #endif bool m_backgroundCheckered; bool m_alphaAllowed; + bool m_dialogOpen; }; void QtColorButtonPrivate::slotEditColor() @@ -61,9 +62,14 @@ void QtColorButtonPrivate::slotEditColor() QColorDialog::ColorDialogOptions options; if (m_alphaAllowed) options |= QColorDialog::ShowAlphaChannel; + emit q_ptr->colorChangeStarted(); + m_dialogOpen = true; const QColor newColor = QColorDialog::getColor(m_color, q_ptr, QString(), options); - if (!newColor.isValid() || newColor == q_ptr->color()) + m_dialogOpen = false; + if (!newColor.isValid() || newColor == q_ptr->color()) { + emit q_ptr->colorUnchanged(); return; + } q_ptr->setColor(newColor); emit q_ptr->colorChanged(m_color); } @@ -117,6 +123,7 @@ QtColorButton::QtColorButton(QWidget *parent) d_ptr->m_dragging = false; d_ptr->m_backgroundCheckered = true; d_ptr->m_alphaAllowed = true; + d_ptr->m_dialogOpen = false; setAcceptDrops(true); @@ -165,6 +172,11 @@ bool QtColorButton::isAlphaAllowed() const return d_ptr->m_alphaAllowed; } +bool QtColorButton::isDialogOpen() const +{ + return d_ptr->m_dialogOpen; +} + void QtColorButton::paintEvent(QPaintEvent *event) { QToolButton::paintEvent(event); diff --git a/src/libs/utils/qtcolorbutton.h b/src/libs/utils/qtcolorbutton.h index 207c9ebe6b4..bc6c9bad398 100644 --- a/src/libs/utils/qtcolorbutton.h +++ b/src/libs/utils/qtcolorbutton.h @@ -49,11 +49,16 @@ public: QColor color() const; + bool isDialogOpen() const; + public slots: void setColor(const QColor &color); signals: + void colorChangeStarted(); void colorChanged(const QColor &color); + void colorUnchanged(); + protected: void paintEvent(QPaintEvent *event) override; void mousePressEvent(QMouseEvent *event) override; @@ -63,7 +68,7 @@ protected: void dragLeaveEvent(QDragLeaveEvent *event) override; void dropEvent(QDropEvent *event) override; #endif -private: + class QtColorButtonPrivate *d_ptr; friend class QtColorButtonPrivate; }; diff --git a/src/plugins/projectexplorer/project.cpp b/src/plugins/projectexplorer/project.cpp index 065dbacf2e5..908438b8620 100644 --- a/src/plugins/projectexplorer/project.cpp +++ b/src/plugins/projectexplorer/project.cpp @@ -388,6 +388,25 @@ void Project::setExtraProjectFiles(const QSet &projectDocumentP } } +void Project::updateExtraProjectFiles(const QSet &projectDocumentPaths, + const DocUpdater &docUpdater) +{ + for (const Utils::FilePath &fp : projectDocumentPaths) { + for (const auto &doc : d->m_extraProjectDocuments) { + if (doc->filePath() == fp) { + docUpdater(doc.get()); + break; + } + } + } +} + +void Project::updateExtraProjectFiles(const DocUpdater &docUpdater) +{ + for (const auto &doc : qAsConst(d->m_extraProjectDocuments)) + docUpdater(doc.get()); +} + Target *Project::target(Utils::Id id) const { return Utils::findOrDefault(d->m_targets, Utils::equal(&Target::id, id)); diff --git a/src/plugins/projectexplorer/project.h b/src/plugins/projectexplorer/project.h index 64236a39a26..e91fec8e7cf 100644 --- a/src/plugins/projectexplorer/project.h +++ b/src/plugins/projectexplorer/project.h @@ -169,6 +169,9 @@ public: void setExtraProjectFiles(const QSet &projectDocumentPaths, const DocGenerator &docGenerator = {}, const DocUpdater &docUpdater = {}); + void updateExtraProjectFiles(const QSet &projectDocumentPaths, + const DocUpdater &docUpdater); + void updateExtraProjectFiles(const DocUpdater &docUpdater); void setDisplayName(const QString &name); void setProjectLanguage(Utils::Id id, bool enabled); diff --git a/src/plugins/qmakeprojectmanager/qmakeproject.cpp b/src/plugins/qmakeprojectmanager/qmakeproject.cpp index f4ea729c899..387c0688a4b 100644 --- a/src/plugins/qmakeprojectmanager/qmakeproject.cpp +++ b/src/plugins/qmakeprojectmanager/qmakeproject.cpp @@ -122,7 +122,8 @@ public: Q_UNUSED(errorString) Q_UNUSED(flag) Q_UNUSED(type) - m_priFile->scheduleUpdate(); + if (m_priFile) + m_priFile->scheduleUpdate(); return true; } @@ -692,7 +693,26 @@ void QmakeBuildSystem::asyncUpdate() return; } + // Make sure we ignore requests for re-evaluation for files whose QmakePriFile objects + // will get deleted during the parse. + const auto docUpdater = [](Core::IDocument *doc) { + static_cast(doc)->setPriFile(nullptr); + }; + if (m_asyncUpdateState != AsyncFullUpdatePending) { + QSet projectFilePaths; + for (QmakeProFile * const file : qAsConst(m_partialEvaluate)) { + QVector priFiles = file->children(); + for (int i = 0; i < priFiles.count(); ++i) { + const QmakePriFile * const priFile = priFiles.at(i); + projectFilePaths << priFile->filePath(); + priFiles << priFile->children(); + } + } + project()->updateExtraProjectFiles(projectFilePaths, docUpdater); + } + if (m_asyncUpdateState == AsyncFullUpdatePending) { + project()->updateExtraProjectFiles(docUpdater); rootProFile()->asyncUpdate(); } else { foreach (QmakeProFile *file, m_partialEvaluate) diff --git a/src/plugins/qmldesigner/components/annotationeditor/annotationtableview.cpp b/src/plugins/qmldesigner/components/annotationeditor/annotationtableview.cpp index 7dfee67c928..b074a3dc48f 100644 --- a/src/plugins/qmldesigner/components/annotationeditor/annotationtableview.cpp +++ b/src/plugins/qmldesigner/components/annotationeditor/annotationtableview.cpp @@ -187,12 +187,46 @@ void CommentValueDelegate::setEditorData(QWidget *editor, const QModelIndex &ind auto *e = qobject_cast(editor); e->setText(data.toString()); } else if (data.userType() == QMetaType::QColor) { - auto *e = qobject_cast(editor); + auto *e = qobject_cast(editor); e->setColor(data.value()); + e->installEventFilter(e); + connect(e, + &AnnotationTableColorButton::editorFinished, + this, + &CommentValueDelegate::slotEditorFinished, + Qt::UniqueConnection); + connect(e, + &AnnotationTableColorButton::editorCanceled, + this, + &CommentValueDelegate::slotEditorCanceled, + Qt::UniqueConnection); } else QItemDelegate::setEditorData(editor, index); } +bool AnnotationTableColorButton::eventFilter(QObject *object, QEvent *event) +{ + AnnotationTableColorButton *editor = qobject_cast(object); + if (editor && event->type() == QEvent::FocusOut && editor->isDialogOpen()) + return true; + + return QObject::eventFilter(object, event); +} + +void CommentValueDelegate::slotEditorCanceled(QWidget *editor) +{ + emit closeEditor(editor); +} + +void CommentValueDelegate::slotEditorFinished(QWidget *editor) +{ + AnnotationTableColorButton* e = qobject_cast(editor); + if (e) { + emit commitData(editor); + emit closeEditor(editor, QAbstractItemDelegate::SubmitModelCache); + } +} + void CommentValueDelegate::setModelData(QWidget *editor, QAbstractItemModel *model, const QModelIndex &index) const @@ -201,9 +235,11 @@ void CommentValueDelegate::setModelData(QWidget *editor, if (data.userType() == qMetaTypeId()) return; else if (data.userType() == QMetaType::QColor) + { model->setData(index, - qobject_cast(editor)->color(), + qobject_cast(editor)->color(), Qt::DisplayRole); + } else if (data.userType() == QMetaType::QString) model->setData(index, qobject_cast(editor)->text(), Qt::DisplayRole); else @@ -247,6 +283,16 @@ void RichTextCellEditor::mouseReleaseEvent(QMouseEvent *) emit clicked(); } +AnnotationTableColorButton::AnnotationTableColorButton(QWidget *parent) + : Utils::QtColorButton(parent) +{ + connect(this, &Utils::QtColorButton::colorChangeStarted, this, [this](){emit editorStarted(this);}); + connect(this, &Utils::QtColorButton::colorChanged, this, [this](QColor){emit editorFinished(this);}); + connect(this, &Utils::QtColorButton::colorUnchanged, this, [this](){emit editorCanceled(this);}); +} + +AnnotationTableColorButton::~AnnotationTableColorButton() {} + AnnotationTableView::AnnotationTableView(QWidget *parent) : QTableView(parent) , m_model(std::make_unique()) @@ -283,7 +329,7 @@ AnnotationTableView::AnnotationTableView(QWidget *parent) m_editorFactory->registerEditor(qMetaTypeId(), new QItemEditorCreator("richText")); m_editorFactory->registerEditor(QMetaType::QColor, - new QItemEditorCreator("color")); + new QItemEditorCreator("color")); m_valueDelegate.setItemEditorFactory(m_editorFactory.get()); connect(&m_valueDelegate, diff --git a/src/plugins/qmldesigner/components/annotationeditor/annotationtableview.h b/src/plugins/qmldesigner/components/annotationeditor/annotationtableview.h index 6bc6e96c77b..bd3443ee876 100644 --- a/src/plugins/qmldesigner/components/annotationeditor/annotationtableview.h +++ b/src/plugins/qmldesigner/components/annotationeditor/annotationtableview.h @@ -33,12 +33,15 @@ #include "annotation.h" #include "defaultannotations.h" +#include + QT_BEGIN_NAMESPACE class QStandardItemModel; class QCompleter; QT_END_NAMESPACE namespace QmlDesigner { + class CommentDelegate : public QItemDelegate { Q_OBJECT @@ -98,6 +101,11 @@ public: void setModelData(QWidget *editor, QAbstractItemModel *model, const QModelIndex &index) const override; + +public slots: + void slotEditorFinished(QWidget* editor); + void slotEditorCanceled(QWidget* editor); + signals: void richTextEditorRequested(int index, QString const &richText); }; @@ -129,6 +137,21 @@ private: QMetaObject::Connection m_connection; }; +class AnnotationTableColorButton : public Utils::QtColorButton +{ + Q_OBJECT +public: + AnnotationTableColorButton(QWidget* parent); + ~AnnotationTableColorButton(); + + bool eventFilter(QObject *object, QEvent *event) override; + +signals: + void editorStarted(QWidget* editor); + void editorFinished(QWidget* editor); + void editorCanceled(QWidget* editor); +}; + class AnnotationTableView : public QTableView { Q_OBJECT diff --git a/src/plugins/qmldesigner/components/itemlibrary/itemlibrarywidget.cpp b/src/plugins/qmldesigner/components/itemlibrary/itemlibrarywidget.cpp index 818553404d5..5b59284663e 100644 --- a/src/plugins/qmldesigner/components/itemlibrary/itemlibrarywidget.cpp +++ b/src/plugins/qmldesigner/components/itemlibrary/itemlibrarywidget.cpp @@ -292,7 +292,7 @@ void ItemLibraryWidget::handleAddImport(int index) } m_model->changeImports({import}, {}); - QmlDesignerPlugin::instance()->currentDesignDocument()->updateSubcomponentManager(); + m_stackedWidget->setCurrentIndex(0); // switch to the Components view after import is added updateSearch(); } diff --git a/src/plugins/texteditor/texteditor.cpp b/src/plugins/texteditor/texteditor.cpp index 912ad8e2600..0fcfbf02b67 100644 --- a/src/plugins/texteditor/texteditor.cpp +++ b/src/plugins/texteditor/texteditor.cpp @@ -3669,7 +3669,7 @@ void TextEditorWidgetPrivate::highlightSearchResults(const QTextBlock &block, co QString text = block.text(); text.replace(QChar::Nbsp, QLatin1Char(' ')); int idx = -1; - int l = 1; + int l = 0; const int left = data.viewportRect.left() - int(data.offset.x()); const int right = data.viewportRect.right() - int(data.offset.x());