Merge remote-tracking branch 'origin/4.13' into master

Conflicts:
	cmake/QtCreatorIDEBranding.cmake
	qbs/modules/qtc/qtc.qbs
	qtcreator_ide_branding.pri
	src/plugins/clangtools/virtualfilesystemoverlay.h
	src/plugins/mesonprojectmanager/project/buildoptions/mesonbuildstepconfigwidget.ui
	src/plugins/qmldesigner/designercore/model/abstractview.cpp

Change-Id: I5013bd8fdd28d79cdea74380bec01d4c106adfaf
This commit is contained in:
Eike Ziller
2020-08-31 14:49:19 +02:00
89 changed files with 1247 additions and 403 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.2 KiB

After

Width:  |  Height:  |  Size: 5.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 11 KiB

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.9 KiB

View File

@@ -26,7 +26,7 @@
****************************************************************************/ ****************************************************************************/
/*! /*!
\externalpage https://doc.qt.io/QtForMCUs/qtul-environment.html \externalpage https://doc.qt.io/QtForMCUs/qtul-supported-platforms.html
\title Qt for MCUs - Supported Target Platforms \title Qt for MCUs - Supported Target Platforms
*/ */
/*! /*!

View File

@@ -55,7 +55,6 @@
\list \list
\li Qt for MCU SDK (only available for Windows) \li Qt for MCU SDK (only available for Windows)
\li The Bare Metal plugin
\li \l{https://developer.arm.com/tools-and-software/open-source-software/developer-tools/gnu-toolchain/gnu-rm} \li \l{https://developer.arm.com/tools-and-software/open-source-software/developer-tools/gnu-toolchain/gnu-rm}
{GNU ARM Embedded Toolchain} {GNU ARM Embedded Toolchain}
\endlist \endlist
@@ -74,25 +73,11 @@
between \QC and MCUs. The following subsections guide you through the between \QC and MCUs. The following subsections guide you through the
setup process. setup process.
\section2 MCU and Bare Metal Plugins \section2 MCU Plugin
To be able to develop applications for MCUs, you need the MCU plugin at least. To be able to develop applications for MCUs, you need the MCU plugin.
This plugin is enabled automatically by the installer when you install the This plugin is enabled automatically by the Qt online installer when
Qt for MCUs SDK. you install the Qt for MCUs SDK.
The Bare Metal plugin is optional unless you want to configure the
debug server provider settings explicitly. For more information
see \l{Connecting Bare Metal Devices}.
To explicitly disable or enable any of these plugins, follow these
instructions:
\list 1
\li Select \uicontrol Help > \uicontrol {About Plugins} >
\uicontrol {Device Support} > \uicontrol {Bare Metal} and
\uicontrol {MCU Support} to enable the Bare Metal and MCU
plugins.
\li Select \uicontrol {Restart Now} to restart \QC and load the plugins.
\endlist
\section2 Specifying MCU Settings \section2 Specifying MCU Settings
@@ -115,11 +100,14 @@
\list \list
\li The \uicontrol {GNU ARM Embedded Toolchain} path. \li The \uicontrol {GNU ARM Embedded Toolchain} path.
\li The \uicontrol {STM32CubeProgrammer} install path. \li The \uicontrol {STM32CubeProgrammer} install path.
\li The \uicontrol {MCU SDK} for the chosen target.
\endlist \endlist
\li For NXP targets: \li For NXP targets:
\list \list
\li The \uicontrol {GNU ARM Embedded Toolchain} path. \li The \uicontrol {GNU ARM Embedded Toolchain} path.
\li The \uicontrol {MCUXpresso IDE} install path. \li The \uicontrol {MCUXpresso IDE} install path.
\li The \uicontrol {MCU SDK} for the chosen target.
\li The \uicontrol {FreeRTOS Sources} for the chosen target.
\endlist \endlist
\li For Renesas targets: \li For Renesas targets:
\list \list

View File

@@ -162,7 +162,7 @@
To use an emulation layer that is built with the Qt To use an emulation layer that is built with the Qt
configured in the build and run kit for the project, select \uicontrol Tools > configured in the build and run kit for the project, select \uicontrol Tools >
\uicontrol Options > \uicontrol {Qt Quick} > \uicontrol {\QMLD} > \uicontrol Options > \uicontrol {Qt Quick} > \uicontrol {Qt Quick Designer} >
\uicontrol {Use QML emulation layer which is built by the selected Qt} radio button. \uicontrol {Use QML emulation layer which is built by the selected Qt} radio button.
\QC builds the emulation layer when you select the Design mode. \QC builds the emulation layer when you select the Design mode.

View File

@@ -76,16 +76,28 @@
\list 1 \list 1
\li Drag and drop components from \uicontrol Library (1) to \li Drag and drop components from \uicontrol Library (1) to
\uicontrol Navigator (2) or \uicontrol {Form Editor} (3). \uicontrol Navigator (2) or \uicontrol {Form Editor} (3).
\li Select components in \uicontrol Navigator to edit their \li Select components in \uicontrol Navigator to edit the
properties in \uicontrol Properties. values of their properties in \uicontrol Properties.
\image qmldesigner-properties-view.png "Properties view" \image qmldesigner-properties-view.png "Properties view"
For more information, see \l {Specifying Item Properties}. For more information, see \l {Specifying Item Properties}.
\li Connect components to signals or create bindings between components \li To change the appearance and behavior of your components in ways
in the \uicontrol Connections view. 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"
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 Objects 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 Connections view, \uicontrol Bindings tab.
For more information, see \l{Adding Bindings Between Properties}.
\image qmldesigner-bindings.png "Connections view Bindings tab" \image qmldesigner-bindings.png "Connections view Bindings tab"
For more information, see \l{Adding Connections}. \li Add states to apply sets of changes to the property values of one
\li Add states to apply sets of changes to the properties of one or or several components in the \uicontrol States view.
several components in the \uicontrol States view.
For more information, see \l{Adding States}. For more information, see \l{Adding States}.
\li Animate component properties in the \uicontrol Timeline view. \li Animate component properties in the \uicontrol Timeline view.
For more information, see \l{Creating Animations}. For more information, see \l{Creating Animations}.

View File

@@ -65,4 +65,10 @@
\li Double-click the value in the \uicontrol {Source Property} column \li Double-click the value in the \uicontrol {Source Property} column
to select the property to bind the target property to. to select the property to bind the target property to.
\endlist \endlist
Right-click a binding and select \uicontrol {Open Binding Editor} in
the context menu to specify the binding as a JavaScript expression in
\uicontrol {Binding Editor}. For more information, see \l{Setting Bindings}.
\image qmldesigner-binding-editor.png "Binding Editor"
*/ */

View File

@@ -67,6 +67,13 @@
to specify the value of the property. to specify the value of the property.
\endlist \endlist
Right-click a property and select \uicontrol {Open Binding Editor} in
the context menu to bind the value of the property to that of another one
or to data accessible in the application in \uicontrol {Binding Editor}.
For more information, see \l{Setting Bindings}.
\image qmldesigner-binding-editor.png "Binding Editor"
The properties you add for a QML type are displayed in the The properties you add for a QML type are displayed in the
\uicontrol Properties view when you select a component of \uicontrol Properties view when you select a component of
that type in \uicontrol Navigator or \uicontrol {Form Editor}. that type in \uicontrol Navigator or \uicontrol {Form Editor}.

View File

@@ -42,6 +42,16 @@
clicked within the area. Since the signal name is \c clicked, the signal clicked within the area. Since the signal name is \c clicked, the signal
handler for receiving this signal is named \c onClicked. handler for receiving this signal is named \c onClicked.
A signal is automatically emitted when the value of a QML property changes.
This type of signal is a \e{property change signal} and signal handlers
for these signals are written in the form \c on<Property>Changed, where
\e <Property> is the name of the property, with the first letter
capitalized.
For example, the MouseArea type has a \c pressed property. To receive a
notification whenever this property changes, you would use a signal handler
called \c onPressedChanged.
For more information about signals and signal handlers, see For more information about signals and signal handlers, see
\l{Signal and Handler Event System}. \l{Signal and Handler Event System}.
@@ -70,7 +80,43 @@
to specify the actions. to specify the actions.
\endlist \endlist
Right-click a connection and select \uicontrol {Open Connection Editor}
in the context menu to specify the connection in
\uicontrol {Connection Editor}.
\if defined(qtdesignstudio) \if defined(qtdesignstudio)
\section1 Adding Actions and Assignments
You use the \uicontrol {Connection Editor} to create the JavaScript
expressions for \e actions and \e assignments. An \e action connects
an object to a signal, whereas an \e assignment fetches property values
from another object.
For more information about the logical operators that you can use to
construct conditional expressions, see \l {Summary of Logical Operators}.
To create JavaScript expressions for actions:
\image qtquick-connection-editor-action.png
\list 1
\li Select \uicontrol Action as the type of the connections object.
\li Select the object to connect to a signal.
\li Select the action to perform when the signal is emitted.
\endlist
To create JavaScript expressions for assignments:
\image qtquick-connection-editor-assignment.png
\list 1
\li Select \uicontrol Assignment as the type of the connections object.
\li Select the target object for the property assignment.
\li Select the property of the target object to assign a value to.
\li Select the source object for the property assignment.
\li Select the property of the source object to fetch the value from.
\endlist
For an example of connecting the \c clicked signal of a button to a For an example of connecting the \c clicked signal of a button to a
\l{Adding States}{state}, see \l {Log In UI - Part 3}. \l{Adding States}{state}, see \l {Log In UI - Part 3}.
\endif \endif

View File

@@ -63,7 +63,7 @@
button to anchor the item to the items that you snap to. button to anchor the item to the items that you snap to.
Choose \uicontrol Tools > \uicontrol Options > \uicontrol {Qt Quick} > Choose \uicontrol Tools > \uicontrol Options > \uicontrol {Qt Quick} >
\uicontrol {\QMLD} to specify settings for snapping. In the \uicontrol {Qt Quick Designer} to specify settings for snapping. In the
\uicontrol {Parent item padding} field, specify the \uicontrol {Parent item padding} field, specify the
distance in pixels between the parent item and the snapping lines. In the distance in pixels between the parent item and the snapping lines. In the
\uicontrol {Sibling item spacing} field, specify the distance in pixels between \uicontrol {Sibling item spacing} field, specify the distance in pixels between
@@ -99,14 +99,14 @@
\image qmldesigner-preview-size.png "Canvas width and height" \image qmldesigner-preview-size.png "Canvas width and height"
To set the initial size of the root item, select \uicontrol Tools > To set the initial size of the root item, select \uicontrol Tools >
\uicontrol Options > \uicontrol {Qt Quick} > \uicontrol {\QMLD} and \uicontrol Options > \uicontrol {Qt Quick} > \uicontrol {Qt Quick Designer} and
specify the item width and height in the \uicontrol {Root Item Init Size} specify the item width and height in the \uicontrol {Root Item Init Size}
group. group.
\section1 Specifying Canvas Size \section1 Specifying Canvas Size
To change the canvas size, select \uicontrol Tools > \uicontrol Options > To change the canvas size, select \uicontrol Tools > \uicontrol Options >
\uicontrol {Qt Quick} > \uicontrol {\QMLD} and \uicontrol {Qt Quick} > \uicontrol {Qt Quick Designer} and
specify the canvas width and height in the \uicontrol Canvas group. specify the canvas width and height in the \uicontrol Canvas group.
\section1 Refreshing the Form Editor Contents \section1 Refreshing the Form Editor Contents

View File

@@ -185,7 +185,7 @@
If you use text IDs instead of plain text, change the default call to If you use text IDs instead of plain text, change the default call to
\c qsTrId(). Select \uicontrol Tools > \uicontrol Options > \c qsTrId(). Select \uicontrol Tools > \uicontrol Options >
\uicontrol {Qt Quick} > \uicontrol {\QMLD}, and then select the \uicontrol {Qt Quick} > \uicontrol {Qt Quick Designer}, and then select the
\uicontrol {qsTrId()} radio button in the \uicontrol Internationalization \uicontrol {qsTrId()} radio button in the \uicontrol Internationalization
group. For more information about text ID based translations, see group. For more information about text ID based translations, see
\l {Qt Linguist Manual: Text ID Based Translations}. \l {Qt Linguist Manual: Text ID Based Translations}.

View File

@@ -112,6 +112,7 @@ qhp.qtdesignstudio.subprojects.manual.type = manual
# Doxygen compatibility commands # Doxygen compatibility commands
macro.see = "\\sa" macro.see = "\\sa"
macro.function = "\\fn" macro.function = "\\fn"
macro.QMLD = "Qt Design Studio"
navigation.landingpage = "$IDE_DISPLAY_NAME Manual" navigation.landingpage = "$IDE_DISPLAY_NAME Manual"
buildversion = "$IDE_DISPLAY_NAME Manual $QTC_VERSION" buildversion = "$IDE_DISPLAY_NAME Manual $QTC_VERSION"

View File

@@ -30,15 +30,17 @@
\title Exporting Artwork from Design Tools \title Exporting Artwork from Design Tools
You need to use \QB to first export 2D assets from design tools and then use You need to use \QB to first export 2D assets from design tools and then to
\QB to \l{Importing Designs}{import} them into \QDS. \l{Importing Designs}{import} them into \QDS.
When working with 3D assets, you can use the export functions provided by When working with 3D assets, you can use the export functions provided by
the 3D graphics tools to save the assets in widely-used 3D graphics formats, the 3D graphics tools to save the assets in widely-used 3D graphics formats,
and then use \QB to import them into \QDS. and then use \QB to import them into \QDS.
You can use the Qt online installer to install \QB if you have a license, or You can use the Qt online installer to install \QB if you have a commercial
download \QB from the \l{https://marketplace.qt.io/}{Qt Marketplace}. \QDS license. You can also purchase a \QB license separately from the
\l{https://marketplace.qt.io/}{Qt Marketplace} and then install \QB using
the Qt online installer.
For best results when importing assets, follow For best results when importing assets, follow
the guidelines for creating and exporting them. the guidelines for creating and exporting them.

View File

@@ -30,8 +30,12 @@
\title Setting Up \QBPS \title Setting Up \QBPS
You can download \QBPS from the \l{https://marketplace.qt.io/} You can purchase a \QBPS license from the \l{https://marketplace.qt.io/}
{Qt Marketplace}. It is delivered as an Adobe extension (ZXP) {Qt Marketplace}, and then use the Qt online installer to have the \QBPS
installation package copied to the following path in your Qt installation
folder: \c {QtDesignStudio\photoshop_bridge}.
\QBPS is delivered as an Adobe extension (ZXP)
package and requires Adobe Photoshop version 20.0.0, or later package and requires Adobe Photoshop version 20.0.0, or later
to be installed. The \QBPS installation process differs depending to be installed. The \QBPS installation process differs depending
on whether you use ZXPInstaller and whether you are installing on on whether you use ZXPInstaller and whether you are installing on
@@ -44,7 +48,8 @@
\list 1 \list 1
\li Download and install \l{http://zxpinstaller.com/}{ZXPInstaller}. \li Download and install \l{http://zxpinstaller.com/}{ZXPInstaller}.
\li Start ZXPInstaller. \li Start ZXPInstaller.
\li Drag and drop the \QBPS ZXP package to ZXPInstaller. \li Drag and drop the \QBPS ZXP package from
\c {Qt\QtDesignStudio\photoshop_bridge} to ZXPInstaller.
\li Follow the instructions of the installation program. \li Follow the instructions of the installation program.
\endlist \endlist
@@ -58,8 +63,9 @@
To install \QBPS on Windows without using ZXPInstaller: To install \QBPS on Windows without using ZXPInstaller:
\list 1 \list 1
\li Copy the \QBPS ZXP package to the \c Documents directory in your \li Copy the \QBPS ZXP package from
user directory. \c {Qt\QtDesignStudio\photoshop_bridge} to the
\c Documents directory in your user directory.
\li Open Windows PowerShell. \li Open Windows PowerShell.
\li Enter the following commands: \li Enter the following commands:
\badcode \badcode
@@ -75,7 +81,9 @@
To install \QBPS on \macos without using ZXPInstaller: To install \QBPS on \macos without using ZXPInstaller:
\list 1 \list 1
\li Copy the \QBPS ZXP package to your \c Documents directory. \li Copy the \QBPS ZXP package from
\c {Qt/QtDesignStudio/photoshop_bridge}
to your \c Documents directory.
\li Open Terminal. \li Open Terminal.
\li Enter the following commands: \li Enter the following commands:
\badcode \badcode

View File

@@ -30,9 +30,11 @@
\title Setting Up \QBSK \title Setting Up \QBSK
You can download \QBSK from the \l{https://marketplace.qt.io/} You can purchase a \QBSK license from the \l{https://marketplace.qt.io/}
{Qt Marketplace}. It is delivered as a Sketch plugin that you {Qt Marketplace}, and then use the Qt online installer to have the \QBSK
can install to Sketch. installation package copied to the following path in your Qt installation
folder: \c {QtDesignStudio\sketch_bridge}. You can use the installation
package to install the \QBSK plugin to Sketch.
\note Install the Sketch app before installing the plugin. \note Install the Sketch app before installing the plugin.

View File

@@ -53,6 +53,8 @@ Rectangle {
property string typeFilter: "QtQuick3D.Material" property string typeFilter: "QtQuick3D.Material"
property int activatedReason: ComboBox.ActivatedReason.Other
color: "transparent" color: "transparent"
border.color: StudioTheme.Values.themeControlOutline border.color: StudioTheme.Values.themeControlOutline
border.width: StudioTheme.Values.border border.width: StudioTheme.Values.border
@@ -89,11 +91,13 @@ Rectangle {
} }
onCompressedActivated: { onCompressedActivated: {
editableListView.activatedReason = reason
if (itemFilterComboBox.empty && itemFilterComboBox.editText !== "") { if (itemFilterComboBox.empty && itemFilterComboBox.editText !== "") {
myRepeater.dirty = false myRepeater.dirty = false
editableListView.add(itemFilterComboBox.editText) editableListView.add(itemFilterComboBox.editText)
} else { } else {
editableListView.replace(myIndex, itemFilterComboBox.editText) editableListView.replace(itemFilterComboBox.myIndex, itemFilterComboBox.editText)
} }
} }
} }
@@ -156,6 +160,9 @@ Rectangle {
myColumn.currentIndex = lastIndex myColumn.currentIndex = lastIndex
else else
myColumn.currentIndex = myRepeater.localModel.length - 1 myColumn.currentIndex = myRepeater.localModel.length - 1
if (editableListView.activatedReason === ComboBox.ActivatedReason.Other)
myColumn.currentItem.forceActiveFocus()
} }
} }
@@ -181,8 +188,7 @@ Rectangle {
onClicked: extFuncLogic.show() onClicked: extFuncLogic.show()
} }
StudioControls.AbstractButton { StudioControls.AbstractButton {
buttonIcon: "+" buttonIcon: StudioTheme.Constants.plus
iconFont: StudioTheme.Constants.font
enabled: !myRepeater.dirty && !(editableListView.backendValue.isInModel && !editableListView.backendValue.isIdList) enabled: !myRepeater.dirty && !(editableListView.backendValue.isInModel && !editableListView.backendValue.isIdList)
onClicked: { onClicked: {
var idx = myRepeater.localModel.push("") - 1 var idx = myRepeater.localModel.push("") - 1
@@ -193,8 +199,7 @@ Rectangle {
} }
} }
StudioControls.AbstractButton { StudioControls.AbstractButton {
buttonIcon: "-" buttonIcon: StudioTheme.Constants.minus
iconFont: StudioTheme.Constants.font
enabled: myRepeater.model.length && !(editableListView.backendValue.isInModel && !editableListView.backendValue.isIdList) enabled: myRepeater.model.length && !(editableListView.backendValue.isInModel && !editableListView.backendValue.isIdList)
onClicked: { onClicked: {
var lastItem = myColumn.currentIndex === myRepeater.localModel.length - 1 var lastItem = myColumn.currentIndex === myRepeater.localModel.length - 1

View File

@@ -33,6 +33,9 @@ T.AbstractButton {
property alias buttonIcon: buttonIcon.text property alias buttonIcon: buttonIcon.text
property alias iconColor: buttonIcon.color property alias iconColor: buttonIcon.color
property alias iconFont: buttonIcon.font.family property alias iconFont: buttonIcon.font.family
property alias iconSize: buttonIcon.font.pixelSize
property alias iconItalic: buttonIcon.font.italic
property alias iconBold: buttonIcon.font.bold
property alias backgroundVisible: buttonBackground.visible property alias backgroundVisible: buttonBackground.visible
property alias backgroundRadius: buttonBackground.radius property alias backgroundRadius: buttonBackground.radius

View File

@@ -46,7 +46,9 @@ T.ComboBox {
property alias textInput: comboBoxInput property alias textInput: comboBoxInput
signal compressedActivated(int index) signal compressedActivated(int index, int reason)
enum ActivatedReason { EditingFinished, Other }
width: StudioTheme.Values.squareComponentWidth * 5 width: StudioTheme.Values.squareComponentWidth * 5
height: StudioTheme.Values.height height: StudioTheme.Values.height
@@ -81,7 +83,8 @@ T.ComboBox {
if (myComboBox.dirty) { if (myComboBox.dirty) {
myTimer.stop() myTimer.stop()
myComboBox.dirty = false myComboBox.dirty = false
myComboBox.compressedActivated(myComboBox.find(myComboBox.editText)) myComboBox.compressedActivated(myComboBox.find(myComboBox.editText),
ComboBox.ActivatedReason.EditingFinished)
} }
} }
onTextEdited: myComboBox.dirty = true onTextEdited: myComboBox.dirty = true
@@ -114,7 +117,8 @@ T.ComboBox {
repeat: false repeat: false
running: false running: false
interval: 100 interval: 100
onTriggered: myComboBox.compressedActivated(myTimer.activatedIndex) onTriggered: myComboBox.compressedActivated(myTimer.activatedIndex,
ComboBox.ActivatedReason.Other)
} }
onActivated: { onActivated: {

View File

@@ -94,33 +94,37 @@ QtObject {
readonly property string fontStyleItalic: "\u0057" readonly property string fontStyleItalic: "\u0057"
readonly property string fontStyleStrikethrough: "\u0058" readonly property string fontStyleStrikethrough: "\u0058"
readonly property string fontStyleUnderline: "\u0059" readonly property string fontStyleUnderline: "\u0059"
readonly property string idAliasOff: "\u005A" readonly property string gridView: "\u005A"
readonly property string idAliasOn: "\u005B" readonly property string idAliasOff: "\u005B"
readonly property string mergeCells: "\u005C" readonly property string idAliasOn: "\u005C"
readonly property string redo: "\u005D" readonly property string listView: "\u005D"
readonly property string splitColumns: "\u005E" readonly property string mergeCells: "\u005E"
readonly property string splitRows: "\u005F" readonly property string minus: "\u005F"
readonly property string startNode: "\u0060" readonly property string plus: "\u0060"
readonly property string testIcon: "\u0061" readonly property string redo: "\u0061"
readonly property string textAlignBottom: "\u0062" readonly property string splitColumns: "\u0062"
readonly property string textAlignCenter: "\u0063" readonly property string splitRows: "\u0063"
readonly property string textAlignLeft: "\u0064" readonly property string startNode: "\u0064"
readonly property string textAlignMiddle: "\u0065" readonly property string testIcon: "\u0065"
readonly property string textAlignRight: "\u0066" readonly property string textAlignBottom: "\u0066"
readonly property string textAlignTop: "\u0067" readonly property string textAlignCenter: "\u0067"
readonly property string textBulletList: "\u0068" readonly property string textAlignLeft: "\u0068"
readonly property string textFullJustification: "\u0069" readonly property string textAlignMiddle: "\u0069"
readonly property string textNumberedList: "\u006A" readonly property string textAlignRight: "\u006A"
readonly property string tickIcon: "\u006B" readonly property string textAlignTop: "\u006B"
readonly property string triState: "\u006C" readonly property string textBulletList: "\u006C"
readonly property string undo: "\u006D" readonly property string textFullJustification: "\u006D"
readonly property string upDownIcon: "\u006E" readonly property string textNumberedList: "\u006E"
readonly property string upDownSquare2: "\u006F" readonly property string tickIcon: "\u006F"
readonly property string wildcard: "\u0070" readonly property string triState: "\u0070"
readonly property string zoomAll: "\u0071" readonly property string undo: "\u0071"
readonly property string zoomIn: "\u0072" readonly property string upDownIcon: "\u0072"
readonly property string zoomOut: "\u0073" readonly property string upDownSquare2: "\u0073"
readonly property string zoomSelection: "\u0074" readonly property string wildcard: "\u0074"
readonly property string zoomAll: "\u0075"
readonly property string zoomIn: "\u0076"
readonly property string zoomOut: "\u0077"
readonly property string zoomSelection: "\u0078"
readonly property font iconFont: Qt.font({ readonly property font iconFont: Qt.font({
"family": controlIcons.name, "family": controlIcons.name,

View File

@@ -122,6 +122,8 @@ QtObject {
property string themeTabDark: Theme.color(Theme.QmlDesigner_TabDark) property string themeTabDark: Theme.color(Theme.QmlDesigner_TabDark)
property string themeTabLight: Theme.color(Theme.QmlDesigner_TabLight) property string themeTabLight: Theme.color(Theme.QmlDesigner_TabLight)
property string themeStateDefaultHighlight: "#ffe400"
// Taken out of Constants.js // Taken out of Constants.js
property string themeChangedStateText: Theme.color(Theme.DSchangedStateText) property string themeChangedStateText: Theme.color(Theme.DSchangedStateText)

View File

@@ -1,6 +1,6 @@
/**************************************************************************** /****************************************************************************
** **
** Copyright (C) 2016 The Qt Company Ltd. ** Copyright (C) 2020 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/ ** Contact: https://www.qt.io/licensing/
** **
** This file is part of Qt Creator. ** This file is part of Qt Creator.
@@ -24,6 +24,7 @@
****************************************************************************/ ****************************************************************************/
import QtQuick 2.15 import QtQuick 2.15
import QtQuick.Layouts 1.15
import QtQuickDesignerTheme 1.0 import QtQuickDesignerTheme 1.0
import HelperWidgets 2.0 import HelperWidgets 2.0
import StudioControls 1.0 as StudioControls import StudioControls 1.0 as StudioControls
@@ -32,7 +33,8 @@ import StudioTheme 1.0 as StudioTheme
Rectangle { Rectangle {
id: myRoot id: myRoot
border.width: 1 color: baseColor
property bool isBaseState property bool isBaseState
property bool isCurrentState property bool isCurrentState
property color baseColor property color baseColor
@@ -41,22 +43,33 @@ Rectangle {
property int delegateStateImageSize property int delegateStateImageSize
property bool delegateHasWhenCondition property bool delegateHasWhenCondition
property string delegateWhenConditionString property string delegateWhenConditionString
property bool hasAnnotation: checkAnnotation()
property int topAreaHeight
property int bottomAreaHeight
property int stateMargin
property int previewMargin
property int columnSpacing
readonly property bool isDefaultState: isDefault readonly property bool isDefaultState: isDefault
signal delegateInteraction property int closeButtonMargin: 6
property int textFieldMargin: 4
property int highlightBorderWidth: 2
color: baseColor signal delegateInteraction
border.color: Theme.qmlDesignerBorderColor()
function autoComplete(text, pos, explicitComplete, filter) { function autoComplete(text, pos, explicitComplete, filter) {
var stringList = statesEditorModel.autoComplete(text, pos, explicitComplete) var stringList = statesEditorModel.autoComplete(text, pos, explicitComplete)
return stringList return stringList
} }
function checkAnnotation() {
return statesEditorModel.hasAnnotation(internalNodeId)
}
MouseArea { MouseArea {
id: mouseArea id: mouseArea
anchors.fill: parent anchors.fill: parent
acceptedButtons: Qt.LeftButton acceptedButtons: Qt.LeftButton
onClicked: { onClicked: {
focus = true focus = true
@@ -68,11 +81,15 @@ Rectangle {
StudioControls.AbstractButton { StudioControls.AbstractButton {
id: removeStateButton id: removeStateButton
buttonIcon: StudioTheme.Constants.closeCross buttonIcon: StudioTheme.Constants.closeCross
anchors.right: parent.right anchors.right: parent.right
anchors.rightMargin: 4 anchors.rightMargin: myRoot.closeButtonMargin
anchors.verticalCenter: stateNameField.verticalCenter anchors.top: parent.top
visible: !isBaseState anchors.topMargin: myRoot.closeButtonMargin
visible: !isBaseState && isCurrentState
onClicked: { onClicked: {
myRoot.delegateInteraction() myRoot.delegateInteraction()
@@ -120,108 +137,165 @@ Rectangle {
} }
} }
StudioControls.MenuItem {
enabled: !isBaseState
text: (hasAnnotation ? qsTr("Edit Annotation")
: qsTr("Add Annotation"))
onTriggered: {
statesEditorModel.setAnnotation(internalNodeId)
hasAnnotation = checkAnnotation()
}
}
StudioControls.MenuItem {
enabled: !isBaseState && hasAnnotation
text: qsTr("Remove Annotation")
onTriggered: {
statesEditorModel.removeAnnotation(internalNodeId)
hasAnnotation = checkAnnotation()
}
}
onClosed: { onClosed: {
stateNameField.actionIndicator.forceVisible = false stateNameField.actionIndicator.forceVisible = false
} }
onOpened: { onOpened: {
hasAnnotation = checkAnnotation()
myRoot.delegateInteraction() myRoot.delegateInteraction()
} }
} }
StudioControls.TextField { Rectangle {
id: stateNameField anchors.margins: (isDefaultState || (isBaseState && !modelHasDefaultState)) ? -myRoot.highlightBorderWidth : 0
anchors.fill: column
actionIndicator.onClicked: { color: Theme.color(Theme.DSsliderActiveTrackFocus)
stateNameField.actionIndicator.forceVisible = true border.color: StudioTheme.Values.themeStateDefaultHighlight
contextMenu.popup() border.width: (isDefaultState || (isBaseState && !modelHasDefaultState)) ? myRoot.highlightBorderWidth : 0
}
onEditChanged: {
if (contextMenu.open && stateNameField.edit)
contextMenu.dismiss()
}
actionIndicator.icon.text: delegateHasWhenCondition
? StudioTheme.Constants.actionIconBinding : StudioTheme.Constants.actionIcon
translationIndicatorVisible: false
y: 4
anchors.left: parent.left
// use the spacing which the image to the delegate rectangle has
anchors.leftMargin: 4
anchors.right: removeStateButton.left
anchors.rightMargin: 2
readOnly: isBaseState
onActiveFocusChanged: {
if (activeFocus)
root.currentStateInternalId = internalNodeId
}
Component.onCompleted: {
text = delegateStateName
}
property string oldValue
onEditingFinished: {
if (stateNameField.oldValue === stateNameField.text)
return
stateNameField.oldValue = stateNameField.text
if (stateNameField.text !== delegateStateName)
statesEditorModel.renameState(internalNodeId, stateNameField.text)
}
} }
Item {
id: stateImageArea
anchors.topMargin: 2
anchors.horizontalCenter: parent.horizontalCenter
anchors.top: stateNameField.bottom
height: delegateStateImageSize + 2 Column {
width: delegateStateImageSize + 2 id: column
anchors.margins: myRoot.stateMargin
anchors.fill: parent
spacing: expanded ? myRoot.columnSpacing : 0
visible: expanded
Rectangle { Rectangle {
anchors.margins: -1
anchors.fill: stateImage width: myRoot.width - 2 * myRoot.stateMargin
border.width: 1 height: myRoot.topAreaHeight
border.color: Theme.qmlDesignerBackgroundColorDarker()
color: Theme.color(Theme.DShoverHighlight)
StudioControls.TextField {
id: stateNameField
property string oldValue
width: StudioTheme.Values.height * 7
anchors.top: parent.top
anchors.topMargin: myRoot.textFieldMargin
anchors.left: parent.left
anchors.leftMargin: myRoot.textFieldMargin
translationIndicatorVisible: false
readOnly: isBaseState
actionIndicator.icon.text: delegateHasWhenCondition
? StudioTheme.Constants.actionIconBinding
: StudioTheme.Constants.actionIcon
actionIndicator.onClicked: {
stateNameField.actionIndicator.forceVisible = true
contextMenu.popup()
}
onEditChanged: {
if (contextMenu.open && stateNameField.edit)
contextMenu.dismiss()
}
onActiveFocusChanged: {
if (activeFocus)
root.currentStateInternalId = internalNodeId
}
onEditingFinished: {
if (stateNameField.oldValue === stateNameField.text)
return
stateNameField.oldValue = stateNameField.text
if (stateNameField.text !== myRoot.delegateStateName)
statesEditorModel.renameState(internalNodeId, stateNameField.text)
}
Component.onCompleted: {
text = myRoot.delegateStateName
}
}
Text {
id: stateDefaultIndicator
anchors.right: parent.right
anchors.rightMargin: myRoot.previewMargin
anchors.verticalCenter: stateNameField.verticalCenter
color: Theme.color(Theme.DStextColor)
font.italic: true
font.pixelSize: StudioTheme.Values.myFontSize
font.family: StudioTheme.Constants.font
visible: (isDefaultState || (isBaseState && !modelHasDefaultState))
text: qsTr("Default")
}
} }
Image {
id: stateImage
anchors.centerIn: parent Rectangle {
source: delegateStateImageSource id: stateImageArea
sourceSize.width: delegateStateImageSize
sourceSize.height: delegateStateImageSize width: myRoot.width - 2 * myRoot.stateMargin
height: myRoot.bottomAreaHeight
color: Theme.color(Theme.DShoverHighlight)
visible: expanded
Rectangle {
border.width: StudioTheme.Values.border
border.color: Theme.color(Theme.DSsliderActiveTrackFocus)
color: Theme.color(Theme.DSsliderInactiveTrack)
anchors.centerIn: parent
width: Math.round(stateImage.paintedWidth) + 2 * StudioTheme.Values.border
height: Math.round(stateImage.paintedHeight) + 2 * StudioTheme.Values.border
}
Image {
id: stateImage
anchors.margins: myRoot.previewMargin
anchors.centerIn: parent
anchors.fill: parent
source: delegateStateImageSource
sourceSize.width: delegateStateImageSize
sourceSize.height: delegateStateImageSize
fillMode: Image.PreserveAspectFit
}
} }
} }
Text {
id: stateDefaultIndicator
anchors.left: parent.left
anchors.leftMargin: StudioTheme.Values.height
anchors.right: removeStateButton.left
anchors.rightMargin: 4
anchors.bottom: parent.bottom
anchors.bottomMargin: 4
color: Theme.color(Theme.PanelTextColorLight)
font.italic: true
font.pixelSize: Theme.smallFontPixelSize()
visible: expanded && (isDefaultState || (isBaseState && !modelHasDefaultState))
text: ("* " + qsTr("Default"))
}
BindingEditor { BindingEditor {
id: bindingEditor
property string newWhenCondition property string newWhenCondition
property Timer timer: Timer { property Timer timer: Timer {
@@ -232,8 +306,6 @@ Rectangle {
onTriggered: statesEditorModel.setWhenCondition(internalNodeId, bindingEditor.newWhenCondition) onTriggered: statesEditorModel.setWhenCondition(internalNodeId, bindingEditor.newWhenCondition)
} }
id: bindingEditor
stateModelNodeProperty: statesEditorModel.stateModelNode() stateModelNodeProperty: statesEditorModel.stateModelNode()
onRejected: { onRejected: {

View File

@@ -1,6 +1,6 @@
/**************************************************************************** /****************************************************************************
** **
** Copyright (C) 2016 The Qt Company Ltd. ** Copyright (C) 2020 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/ ** Contact: https://www.qt.io/licensing/
** **
** This file is part of Qt Creator. ** This file is part of Qt Creator.
@@ -33,16 +33,29 @@ import StudioTheme 1.0 as StudioTheme
FocusScope { FocusScope {
id: root id: root
height: (root.expanded ? 192 : 40) + StudioTheme.Values.scrollBarThickness property int delegateTopAreaHeight: 30
property int delegateBottomAreaHeight: 200
property int delegateColumnSpacing: 2
property int delegateStateMargin: 16
property int delegatePreviewMargin: 16
height: (root.expanded ? (root.delegateTopAreaHeight + root.delegateBottomAreaHeight + root.delegateColumnSpacing)
: root.delegateTopAreaHeight)
+ StudioTheme.Values.scrollBarThickness
+ 2 * (root.delegateStateMargin + StudioTheme.Values.border + root.padding)
signal createNewState signal createNewState
signal deleteState(int internalNodeId) signal deleteState(int internalNodeId)
signal duplicateCurrentState signal duplicateCurrentState
property int stateImageSize: 180 property int stateImageSize: 200
property int padding: 2 property int padding: 2
property int delegateWidth: root.stateImageSize + 44 property int delegateWidth: root.stateImageSize
property int delegateHeight: root.height - StudioTheme.Values.scrollBarThickness - root.padding * 2 + 1 + 2 * (root.delegateStateMargin + root.delegatePreviewMargin)
property int innerSpacing: 0 property int delegateHeight: root.height
- StudioTheme.Values.scrollBarThickness
- 2 * (root.padding + StudioTheme.Values.border)
property int innerSpacing: 2
property int currentStateInternalId: 0 property int currentStateInternalId: 0
property bool expanded: true property bool expanded: true
@@ -59,7 +72,7 @@ FocusScope {
Rectangle { Rectangle {
id: background id: background
anchors.fill: parent anchors.fill: parent
color: Theme.qmlDesignerBackgroundColorDarkAlternate() color: Theme.color(Theme.QmlDesigner_BackgroundColorDarkAlternate)
} }
MouseArea { MouseArea {
@@ -95,7 +108,7 @@ FocusScope {
Item { Item {
id: addStateItem id: addStateItem
property int buttonLeftSpacing: 8 * (root.expanded ? 1 : 2) property int buttonLeftSpacing: 8 * (root.expanded ? 1 : 2)
anchors.right: parent.right anchors.right: parent.right
width: root.delegateHeight / 2 + buttonLeftSpacing width: root.delegateHeight / 2 + buttonLeftSpacing
@@ -103,37 +116,35 @@ FocusScope {
AbstractButton { AbstractButton {
id: addStateButton id: addStateButton
visible: canAddNewStates
buttonIcon: root.expanded ? qsTr("Create New State") : StudioTheme.Constants.plus
iconFont: root.expanded ? StudioTheme.Constants.font : StudioTheme.Constants.iconFont
iconSize: root.expanded ? StudioTheme.Values.myFontSize : StudioTheme.Values.myIconFontSize
iconItalic: root.expanded ? true : false
tooltip: qsTr("Add a new state.") tooltip: qsTr("Add a new state.")
visible: canAddNewStates
anchors.right: parent.right anchors.right: parent.right
anchors.rightMargin: 8 anchors.rightMargin: 8
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
width: Math.max(parent.height / 2 - 8, 18) width: Math.max(parent.height / 2 - 8, 18)
height: width height: root.expanded ? 80 : width
onClicked: { onClicked: {
root.closeContextMenu() root.closeContextMenu()
root.createNewState() root.createNewState()
} }
background: Rectangle {
property color buttonBaseColor: Qt.darker(Theme.qmlDesignerBackgroundColorDarkAlternate(), 1.1)
color: addStateButton.hovered ? Qt.lighter(buttonBaseColor, 1.2) : buttonBaseColor
border.color: Theme.qmlDesignerBorderColor()
border.width: 1
Image {
source: "image://icons/plus"
width: 16
height: 16
anchors.centerIn: parent
smooth: false
}
}
} }
} }
Rectangle {
color: Theme.color(Theme.DSsliderActiveTrackFocus)
x: root.padding
y: root.padding
width: Math.min((root.delegateWidth * flickable.count) + (2 * (flickable.count - 1)),
flickable.width)
height: root.delegateHeight
}
ListView { ListView {
id: flickable id: flickable
@@ -155,15 +166,21 @@ FocusScope {
id: statesDelegate id: statesDelegate
width: root.delegateWidth width: root.delegateWidth
height: root.delegateHeight height: root.delegateHeight
isBaseState: 0 == internalNodeId isBaseState: 0 === internalNodeId
isCurrentState: root.currentStateInternalId == internalNodeId isCurrentState: root.currentStateInternalId === internalNodeId
baseColor: isCurrentState ? Theme.color(Theme.QmlDesigner_HighlightColor) : background.color baseColor: isCurrentState ? Theme.color(Theme.DSinteraction) : background.color
delegateStateName: stateName delegateStateName: stateName
delegateStateImageSource: stateImageSource delegateStateImageSource: stateImageSource
delegateStateImageSize: stateImageSize delegateStateImageSize: stateImageSize
delegateHasWhenCondition: hasWhenCondition delegateHasWhenCondition: hasWhenCondition
delegateWhenConditionString: whenConditionString delegateWhenConditionString: whenConditionString
onDelegateInteraction: root.closeContextMenu() onDelegateInteraction: root.closeContextMenu()
columnSpacing: root.delegateColumnSpacing
topAreaHeight: root.delegateTopAreaHeight
bottomAreaHeight: root.delegateBottomAreaHeight
stateMargin: root.delegateStateMargin
previewMargin: root.delegatePreviewMargin
} }
property bool bothVisible: horizontal.scrollBarVisible && vertical.scrollBarVisible property bool bothVisible: horizontal.scrollBarVisible && vertical.scrollBarVisible

View File

@@ -29,8 +29,10 @@
#include <QString> #include <QString>
#include <QWidget> #include <QWidget>
QT_BEGIN_NAMESPACE
class QPushButton; class QPushButton;
class QTableView; class QTableView;
QT_END_NAMESPACE
namespace Android { namespace Android {
namespace Internal { namespace Internal {

View File

@@ -2,12 +2,10 @@ DEFINES += CORE_STATIC_LIBRARY
HEADERS += \ HEADERS += \
$$PWD/coreicons.h \ $$PWD/coreicons.h \
$$PWD/id.h \
$$PWD/find/ifindfilter.h \ $$PWD/find/ifindfilter.h \
$$PWD/locator/ilocatorfilter.h $$PWD/locator/ilocatorfilter.h
SOURCES += \ SOURCES += \
$$PWD/coreicons.cpp \ $$PWD/coreicons.cpp \
$$PWD/id.cpp \
$$PWD/find/ifindfilter.cpp \ $$PWD/find/ifindfilter.cpp \
$$PWD/locator/ilocatorfilter.cpp $$PWD/locator/ilocatorfilter.cpp

View File

@@ -27,7 +27,8 @@
#include "core_global.h" #include "core_global.h"
#include "helpitem.h" #include "helpitem.h"
#include "id.h"
#include <utils/id.h>
#include <QList> #include <QList>
#include <QObject> #include <QObject>

View File

@@ -37,25 +37,175 @@
\inheaderfile coreplugin/idocument.h \inheaderfile coreplugin/idocument.h
\inmodule QtCreator \inmodule QtCreator
\brief The IDocument class describes a document that can be saved and reloaded. \brief The IDocument class describes a document that can be saved and
reloaded.
The most common use for implementing an IDocument subclass, is as a document for an IEditor The class has two use cases.
implementation. Multiple editors can work in the same document instance, so the IDocument
subclass should hold all data and functions that are independent from the specific
IEditor instance, for example the content, highlighting information, the name of the
corresponding file, and functions for saving and reloading the file.
Each IDocument subclass works only with the corresponding IEditor subclasses that it \section1 Handling External Modifications
was designed to work with.
You can implement IDocument and register instances in DocumentManager to
let it handle external modifications of a file. When the file specified with
filePath() has changed externally, the DocumentManager asks the
corresponding IDocument instance what to do via reloadBehavior(). If that
returns \c IDocument::BehaviorAsk, the user is asked if the file should be
reloaded from disk. If the user requests the reload or reloadBehavior()
returns \c IDocument::BehaviorSilent, the DocumentManager calls reload()
to initiate a reload of the file from disk.
Core functions: setFilePath(), reload(), reloadBehavior().
If the content of the document can change in \QC, diverging from the
content on disk: isModified(), save(), isSaveAsAllowed(),
fallbackSaveAsPath(), fallbackSaveAsFileName().
\section1 Editor Document
The most common use case for implementing an IDocument subclass is as a
document for an IEditor implementation. Multiple editor instances can work
on the same document instance, for example if the document is visible in
multiple splits simultaneously. So the IDocument subclass should hold all
data that is independent from the specific IEditor instance, for example
the content and highlighting information.
Each IDocument subclass is only required to work with the corresponding
IEditor subclasses that it was designed to work with.
An IDocument can either be backed by a file, or solely represent some data
in memory. Documents backed by a file are automatically added to the
DocumentManager by the EditorManager.
Core functions: setId(), isModified(), contents(), setContents().
If the content of the document is backed by a file: open(), save(),
setFilePath(), mimeType(), shouldAutoSave(), setSuspendAllowed(), and
everything from \l{Handling External Modifications}.
If the content of the document is not backed by a file:
setPreferredDisplayName(), setTemporary().
\ingroup mainclasses \ingroup mainclasses
*/ */
/*! /*!
\fn QString Core::IDocument::filePath() const \enum IDocument::OpenResult
Returns the absolute path of the file that this document refers to. May be empty for
non-file documents. The OpenResult enum describes whether a file was successfully opened.
\sa setFilePath()
\value Success
The file was read successfully and can be handled by this document
type.
\value ReadError
The file could not be opened for reading, either because it does not
exist or because of missing permissions.
\value CannotHandle
This document type could not handle the file content.
*/
/*!
\enum IDocument::ReloadSetting
\internal
*/
/*!
\enum IDocument::ChangeTrigger
The ChangeTrigger enum describes whether a file was changed from \QC
internally or from the outside.
\value TriggerInternal
The file was changed by \QC.
\value TriggerExternal
The file was changed from the outside.
\sa IDocument::reloadBehavior()
*/
/*!
\enum IDocument::ChangeType
The ChangeType enum describes the way in which the file changed.
\value TypeContents
The contents of the file changed.
\value TypePermissions
The file permissions changed.
\value TypeRemoved
The file was removed.
\sa IDocument::reloadBehavior()
\sa IDocument::reload()
*/
/*!
\enum IDocument::ReloadFlag
The ReloadFlag enum describes if a file should be reloaded from disk.
\value FlagReload
The file should be reloaded.
\value FlagIgnore
The file should not be reloaded, but the document state should
reflect the change.
\sa IDocument::reload()
*/
/*!
\fn Core::IDocument::changed()
This signal is emitted when the document's meta data, like file name or
modified state, changes.
\sa isModified()
\sa filePath()
\sa displayName()
*/
/*!
\fn Core::IDocument::contentsChanged()
This signal is emitted when the document's content changes.
\sa contents()
*/
/*!
\fn Core::IDocument::mimeTypeChanged()
This signal is emitted when the document content's MIME type changes.
\sa mimeType()
*/
/*!
\fn Core::IDocument::aboutToReload()
This signal is emitted before the document is reloaded from the backing
file.
\sa reload()
*/
/*!
\fn Core::IDocument::reloadFinished(bool success)
This signal is emitted after the document is reloaded from the backing
file, or if reloading failed.
The success state is passed in \a success.
\sa reload()
*/
/*!
\fn Core::IDocument::filePathChanged(const Utils::FilePath &oldName, const Utils::FilePath &newName)
This signal is emitted after the file path changed from \a oldName to \a
newName.
\sa filePath()
*/ */
using namespace Utils; using namespace Utils;
@@ -86,22 +236,51 @@ public:
} // namespace Internal } // namespace Internal
/*!
Creates an IDocument with \a parent.
\note Using the \a parent for ownership of the document is generally a
bad idea if the IDocument is intended for use with IEditor. It is better to
use shared ownership in that case.
*/
IDocument::IDocument(QObject *parent) : QObject(parent), IDocument::IDocument(QObject *parent) : QObject(parent),
d(new Internal::IDocumentPrivate) d(new Internal::IDocumentPrivate)
{ {
} }
/*!
Destroys the IDocument.
If there was an auto save file for this document, it is removed.
\sa shouldAutoSave()
*/
IDocument::~IDocument() IDocument::~IDocument()
{ {
removeAutoSaveFile(); removeAutoSaveFile();
delete d; delete d;
} }
/*!
\fn void IDocument::setId(Utils::Id id)
Sets the ID for this document type to \a id. This is coupled with the
corresponding IEditor implementation and the \l{IEditorFactory::id()}{id()}
of the IEditorFactory. If the IDocument implementation only works with a
single IEditor type, this is preferably set in the IDocuments's
constructor.
\sa id()
*/
void IDocument::setId(Id id) void IDocument::setId(Id id)
{ {
d->id = id; d->id = id;
} }
/*!
Returns the ID for this document type.
\sa setId()
*/
Id IDocument::id() const Id IDocument::id() const
{ {
QTC_CHECK(d->id.isValid()); QTC_CHECK(d->id.isValid());
@@ -109,30 +288,30 @@ Id IDocument::id() const
} }
/*! /*!
\enum IDocument::OpenResult The open() method is used to load the contents of a file when a document is
The OpenResult enum describes whether a file was successfully opened. opened in an editor.
\value Success If the document is opened from an auto save file, \a realFileName is the
The file was read successfully and can be handled by this document type. name of the auto save file that should be loaded, and \a fileName is the
\value ReadError file name of the resulting file. In that case, the contents of the auto
The file could not be opened for reading, either because it does not exist or save file should be loaded, the file name of the IDocument should be set to
because of missing permissions. \a fileName, and the document state be set to modified.
\value CannotHandle
This document type could not handle the file content. If the editor is opened from a regular file, \a fileName and \a
realFileName are the same.
Use \a errorString to return an error message if this document cannot
handle the file contents.
Returns whether the file was opened and read successfully.
The default implementation does nothing and returns
CannotHandle.
\sa EditorManager::open()
\sa shouldAutoSave()
\sa setFilePath()
*/ */
/*!
* Used to load a file if this document is part of an IEditor implementation, when the editor
* is opened.
* If the editor is opened from an auto save file, \a realFileName is the name of the auto save
* that should be loaded, and \a fileName is the file name of the resulting file.
* In that case, the contents of the auto save file should be loaded, the file name of the
* IDocument should be set to \a fileName, and the document state be set to modified.
* If the editor is opened from a regular file, \a fileName and \a realFileName are the same.
* Use \a errorString to return an error message, if this document cannot handle the
* file contents.
* Returns whether the file was opened and read successfully.
*/
IDocument::OpenResult IDocument::open(QString *errorString, const QString &fileName, const QString &realFileName) IDocument::OpenResult IDocument::open(QString *errorString, const QString &fileName, const QString &realFileName)
{ {
Q_UNUSED(errorString) Q_UNUSED(errorString)
@@ -141,6 +320,21 @@ IDocument::OpenResult IDocument::open(QString *errorString, const QString &fileN
return OpenResult::CannotHandle; return OpenResult::CannotHandle;
} }
/*!
Saves the contents of the document to the \a fileName on disk.
If \a autoSave is \c true, the saving is done for an auto-save, so the
document should avoid cleanups or other operations that it does for
user-requested saves.
Use \a errorString to return an error message if saving failed.
Returns whether saving was successful.
The default implementation does nothing and returns \c false.
\sa shouldAutoSave()
*/
bool IDocument::save(QString *errorString, const QString &fileName, bool autoSave) bool IDocument::save(QString *errorString, const QString &fileName, bool autoSave)
{ {
Q_UNUSED(errorString) Q_UNUSED(errorString)
@@ -150,21 +344,28 @@ bool IDocument::save(QString *errorString, const QString &fileName, bool autoSav
} }
/*! /*!
* Returns the current contents of the document. The base implementation returns an empty Returns the current contents of the document. The default implementation
* QByteArray. returns an empty QByteArray.
*/
\sa setContents()
\sa contentsChanged()
*/
QByteArray IDocument::contents() const QByteArray IDocument::contents() const
{ {
return QByteArray(); return QByteArray();
} }
/*! /*!
Used for example by EditorManager::openEditorWithContents() to set The setContents() method is for example used by
the \a contents of this document. EditorManager::openEditorWithContents() to set the \a contents of this
document.
Returns whether setting the contents was successful. Returns whether setting the contents was successful.
The base implementation does nothing and returns false. The default implementation does nothing and returns false.
\sa contents()
\sa EditorManager::openEditorWithContents()
*/ */
bool IDocument::setContents(const QByteArray &contents) bool IDocument::setContents(const QByteArray &contents)
{ {
@@ -172,20 +373,67 @@ bool IDocument::setContents(const QByteArray &contents)
return false; return false;
} }
/*!
Returns the absolute path of the file that this document refers to. May be
empty for documents that are not backed by a file.
\sa setFilePath()
*/
const Utils::FilePath &IDocument::filePath() const const Utils::FilePath &IDocument::filePath() const
{ {
return d->filePath; return d->filePath;
} }
IDocument::ReloadBehavior IDocument::reloadBehavior(ChangeTrigger state, ChangeType type) const /*!
The reloadBehavior() method is used by the DocumentManager to ask what to
do if the file backing this document has changed on disk.
The \a trigger specifies if the change was triggered by some operation in
\QC. The \a type specifies if the file changed permissions or contents, or
was removed completely.
Returns whether the user should be asked or the document should be
reloaded silently.
The default implementation requests a silent reload if only the permissions
changed or if the contents have changed but the \a trigger is internal and
the document is not modified.
\sa isModified()
*/
IDocument::ReloadBehavior IDocument::reloadBehavior(ChangeTrigger trigger, ChangeType type) const
{ {
if (type == TypePermissions) if (type == TypePermissions)
return BehaviorSilent; return BehaviorSilent;
if (type == TypeContents && state == TriggerInternal && !isModified()) if (type == TypeContents && trigger == TriggerInternal && !isModified())
return BehaviorSilent; return BehaviorSilent;
return BehaviorAsk; return BehaviorAsk;
} }
/*!
Reloads the document from the backing file when that changed on disk.
If \a flag is FlagIgnore the file should not actually be loaded, but the
document should reflect the change in its \l{isModified()}{modified state}.
The \a type specifies whether only the file permissions changed or if the
contents of the file changed.
Use \a errorString to return an error message, if this document cannot
handle the file contents.
Returns if the file was reloaded successfully.
The default implementation does nothing and returns \c true.
Subclasses should emit aboutToReload() before, and reloadFinished() after
reloading the file.
\sa isModified()
\sa aboutToReload()
\sa reloadFinished()
\sa changed()
*/
bool IDocument::reload(QString *errorString, ReloadFlag flag, ChangeType type) bool IDocument::reload(QString *errorString, ReloadFlag flag, ChangeType type)
{ {
Q_UNUSED(errorString) Q_UNUSED(errorString)
@@ -194,35 +442,84 @@ bool IDocument::reload(QString *errorString, ReloadFlag flag, ChangeType type)
return true; return true;
} }
/*!
\internal
*/
void IDocument::checkPermissions() void IDocument::checkPermissions()
{ {
} }
/*!
Returns whether the document should automatically be saved at a user-defined
interval.
The default implementation returns \c false.
*/
bool IDocument::shouldAutoSave() const bool IDocument::shouldAutoSave() const
{ {
return false; return false;
} }
/*!
Returns whether the document has been modified after it was loaded from a
file.
The default implementation returns \c false. Re-implementations should emit
changed() when this property changes.
\sa changed()
*/
bool IDocument::isModified() const bool IDocument::isModified() const
{ {
return false; return false;
} }
/*!
Returns whether the document may be saved under a different file name.
The default implementation returns \c false.
\sa save()
*/
bool IDocument::isSaveAsAllowed() const bool IDocument::isSaveAsAllowed() const
{ {
return false; return false;
} }
/*!
Returns whether the document may be suspended.
The EditorManager can automatically suspend editors and its corresponding
documents if the document is backed by a file, is not modified, and is not
temporary. Suspended IEditor and IDocument instances are deleted and
removed from memory, but are still visually accessible as if the document
was still opened in \QC.
The default is \c false.
\sa setSuspendAllowed()
\sa isModified()
\sa isTemporary()
*/
bool IDocument::isSuspendAllowed() const bool IDocument::isSuspendAllowed() const
{ {
return d->isSuspendAllowed; return d->isSuspendAllowed;
} }
/*!
Sets whether the document may be suspended to \a value.
\sa isSuspendAllowed()
*/
void IDocument::setSuspendAllowed(bool value) void IDocument::setSuspendAllowed(bool value)
{ {
d->isSuspendAllowed = value; d->isSuspendAllowed = value;
} }
/*!
Returns whether the file backing this document is read-only, or \c false if
the document is not backed by a file.
*/
bool IDocument::isFileReadOnly() const bool IDocument::isFileReadOnly() const
{ {
if (filePath().isEmpty()) if (filePath().isEmpty())
@@ -231,8 +528,12 @@ bool IDocument::isFileReadOnly() const
} }
/*! /*!
Returns if the document is a temporary that should for example not be considered Returns if the document is temporary, and should for example not be
when saving/restoring the session state, recent files, etc. Defaults to false. considered when saving or restoring the session state, or added to the recent
files list.
The default is \c false.
\sa setTemporary() \sa setTemporary()
*/ */
bool IDocument::isTemporary() const bool IDocument::isTemporary() const
@@ -241,7 +542,8 @@ bool IDocument::isTemporary() const
} }
/*! /*!
Sets if the document is \a temporary. Sets whether the document is \a temporary.
\sa isTemporary() \sa isTemporary()
*/ */
void IDocument::setTemporary(bool temporary) void IDocument::setTemporary(bool temporary)
@@ -249,21 +551,49 @@ void IDocument::setTemporary(bool temporary)
d->temporary = temporary; d->temporary = temporary;
} }
/*!
Returns a path to use for the \uicontrol{Save As} file dialog in case the
document is not backed by a file.
\sa fallbackSaveAsFileName()
*/
QString IDocument::fallbackSaveAsPath() const QString IDocument::fallbackSaveAsPath() const
{ {
return QString(); return QString();
} }
/*!
Returns a file name to use for the \uicontrol{Save As} file dialog in case
the document is not backed by a file.
\sa fallbackSaveAsPath()
*/
QString IDocument::fallbackSaveAsFileName() const QString IDocument::fallbackSaveAsFileName() const
{ {
return QString(); return QString();
} }
/*!
Returns the MIME type of the document content, if applicable.
Subclasses should set this with setMimeType() after setting or loading
content.
The default MIME type is empty.
\sa setMimeType()
\sa mimeTypeChanged()
*/
QString IDocument::mimeType() const QString IDocument::mimeType() const
{ {
return d->mimeType; return d->mimeType;
} }
/*!
Sets the MIME type of the document content to \a mimeType.
\sa mimeType()
*/
void IDocument::setMimeType(const QString &mimeType) void IDocument::setMimeType(const QString &mimeType)
{ {
if (d->mimeType != mimeType) { if (d->mimeType != mimeType) {
@@ -272,6 +602,9 @@ void IDocument::setMimeType(const QString &mimeType)
} }
} }
/*!
\internal
*/
bool IDocument::autoSave(QString *errorString, const QString &fileName) bool IDocument::autoSave(QString *errorString, const QString &fileName)
{ {
if (!save(errorString, fileName, true)) if (!save(errorString, fileName, true))
@@ -282,6 +615,9 @@ bool IDocument::autoSave(QString *errorString, const QString &fileName)
static const char kRestoredAutoSave[] = "RestoredAutoSave"; static const char kRestoredAutoSave[] = "RestoredAutoSave";
/*!
\internal
*/
void IDocument::setRestoredFrom(const QString &name) void IDocument::setRestoredFrom(const QString &name)
{ {
d->autoSaveName = name; d->autoSaveName = name;
@@ -292,6 +628,9 @@ void IDocument::setRestoredFrom(const QString &name)
infoBar()->addInfo(info); infoBar()->addInfo(info);
} }
/*!
\internal
*/
void IDocument::removeAutoSaveFile() void IDocument::removeAutoSaveFile()
{ {
if (!d->autoSaveName.isEmpty()) { if (!d->autoSaveName.isEmpty()) {
@@ -304,16 +643,26 @@ void IDocument::removeAutoSaveFile()
} }
} }
/*!
\internal
*/
bool IDocument::hasWriteWarning() const bool IDocument::hasWriteWarning() const
{ {
return d->hasWriteWarning; return d->hasWriteWarning;
} }
/*!
\internal
*/
void IDocument::setWriteWarning(bool has) void IDocument::setWriteWarning(bool has)
{ {
d->hasWriteWarning = has; d->hasWriteWarning = has;
} }
/*!
Returns the document's Utils::InfoBar, which is shown at the top of an
editor.
*/
Utils::InfoBar *IDocument::infoBar() Utils::InfoBar *IDocument::infoBar()
{ {
if (!d->infoBar) if (!d->infoBar)
@@ -322,10 +671,13 @@ Utils::InfoBar *IDocument::infoBar()
} }
/*! /*!
Set absolute file path for this file to \a filePath. Can be empty. Sets the absolute \a filePath of the file that backs this document. The
The default implementation sets the file name and sends filePathChanged() and changed() default implementation sets the file name and sends the filePathChanged() and
signals. Can be reimplemented by subclasses to do more. changed() signals.
\sa filePath() \sa filePath()
\sa filePathChanged()
\sa changed()
*/ */
void IDocument::setFilePath(const Utils::FilePath &filePath) void IDocument::setFilePath(const Utils::FilePath &filePath)
{ {
@@ -338,10 +690,10 @@ void IDocument::setFilePath(const Utils::FilePath &filePath)
} }
/*! /*!
Returns the string to display for this document, in the open document combo Returns the string to display for this document, for example in the
box and pane, for example. \uicontrol{Open Documents} view and the documents drop down.
The returned string has the following priority: The display name is one of the following, in order:
\list 1 \list 1
\li Unique display name set by the document model \li Unique display name set by the document model
@@ -350,6 +702,8 @@ void IDocument::setFilePath(const Utils::FilePath &filePath)
\endlist \endlist
\sa setPreferredDisplayName() \sa setPreferredDisplayName()
\sa filePath()
\sa changed()
*/ */
QString IDocument::displayName() const QString IDocument::displayName() const
{ {
@@ -357,11 +711,10 @@ QString IDocument::displayName() const
} }
/*! /*!
Sets the string that is displayed for this document, e.g. in the open document combo box Sets the preferred display \a name for this document.
and pane, to \a name. Defaults to the file name of the file path for this document.
You can reset the display name to the default by passing an empty string. \sa preferredDisplayName()
\sa displayName() \sa displayName()
\sa filePath()
*/ */
void IDocument::setPreferredDisplayName(const QString &name) void IDocument::setPreferredDisplayName(const QString &name)
{ {
@@ -371,6 +724,15 @@ void IDocument::setPreferredDisplayName(const QString &name)
emit changed(); emit changed();
} }
/*!
Returns the preferred display name for this document.
The default preferred display name is empty, which means that the display
name is preferably the file name of the file backing this document.
\sa setPreferredDisplayName()
\sa displayName()
*/
QString IDocument::preferredDisplayName() const QString IDocument::preferredDisplayName() const
{ {
return d->preferredDisplayName; return d->preferredDisplayName;
@@ -394,6 +756,9 @@ void IDocument::setUniqueDisplayName(const QString &name)
d->uniqueDisplayName = name; d->uniqueDisplayName = name;
} }
/*!
\internal
*/
QString IDocument::uniqueDisplayName() const QString IDocument::uniqueDisplayName() const
{ {
return d->uniqueDisplayName; return d->uniqueDisplayName;

View File

@@ -88,7 +88,6 @@ public:
void setId(Utils::Id id); void setId(Utils::Id id);
Utils::Id id() const; Utils::Id id() const;
// required to be re-implemented for documents of IEditors
virtual OpenResult open(QString *errorString, const QString &fileName, const QString &realFileName); virtual OpenResult open(QString *errorString, const QString &fileName, const QString &realFileName);
virtual bool save(QString *errorString, const QString &fileName = QString(), bool autoSave = false); virtual bool save(QString *errorString, const QString &fileName = QString(), bool autoSave = false);

View File

@@ -3801,10 +3801,12 @@ void GdbEngine::setEnvironmentVariables()
// imitate the weird windows gdb behavior of setting the case of the path environment // imitate the weird windows gdb behavior of setting the case of the path environment
// variable name to an all uppercase PATH // variable name to an all uppercase PATH
const QString name = isWindowsPath(item.name) ? "PATH" : item.name; const QString name = isWindowsPath(item.name) ? "PATH" : item.name;
if (item.operation == EnvironmentItem::Unset) if (item.operation == EnvironmentItem::Unset
|| item.operation == EnvironmentItem::SetDisabled) {
runCommand({"unset environment " + name}); runCommand({"unset environment " + name});
else } else {
runCommand({"-gdb-set environment " + name + '=' + item.value}); runCommand({"-gdb-set environment " + name + '=' + item.value});
}
} }
} }

View File

@@ -151,7 +151,7 @@ void LldbEngine::runCommand(const DebuggerCommand &command)
} }
showMessage(msg, LogInput); showMessage(msg, LogInput);
m_commandForToken[currentToken()] = cmd; m_commandForToken[currentToken()] = cmd;
m_lldbProc.write("script theDumper." + function.toUtf8() + "\n"); executeCommand("script theDumper." + function.toUtf8());
} }
void LldbEngine::debugLastCommand() void LldbEngine::debugLastCommand()
@@ -168,6 +168,13 @@ void LldbEngine::handleAttachedToCore()
updateLocals(); updateLocals();
} }
void LldbEngine::executeCommand(const QByteArray &command)
{
// For some reason, sometimes LLDB misses the first character of the next command on Windows
// if passing only 1 LF.
m_lldbProc.write(command + "\n\n");
}
void LldbEngine::shutdownInferior() void LldbEngine::shutdownInferior()
{ {
QTC_ASSERT(state() == InferiorShutdownRequested, qDebug() << state()); QTC_ASSERT(state() == InferiorShutdownRequested, qDebug() << state());
@@ -228,13 +235,13 @@ void LldbEngine::setupEngine()
const QByteArray dumperSourcePath = const QByteArray dumperSourcePath =
ICore::resourcePath().toLocal8Bit() + "/debugger/"; ICore::resourcePath().toLocal8Bit() + "/debugger/";
m_lldbProc.write("script sys.path.insert(1, '" + dumperSourcePath + "')\n"); executeCommand("script sys.path.insert(1, '" + dumperSourcePath + "')");
// This triggers reportState("enginesetupok") or "enginesetupfailed": // This triggers reportState("enginesetupok") or "enginesetupfailed":
m_lldbProc.write("script from lldbbridge import *\n"); executeCommand("script from lldbbridge import *");
QString commands = nativeStartupCommands(); QString commands = nativeStartupCommands();
if (!commands.isEmpty()) if (!commands.isEmpty())
m_lldbProc.write(commands.toLocal8Bit() + '\n'); executeCommand(commands.toLocal8Bit());
const QString path = stringSetting(ExtraDumperFile); const QString path = stringSetting(ExtraDumperFile);

View File

@@ -131,6 +131,7 @@ private:
void runCommand(const DebuggerCommand &cmd) override; void runCommand(const DebuggerCommand &cmd) override;
void debugLastCommand() override; void debugLastCommand() override;
void handleAttachedToCore(); void handleAttachedToCore();
void executeCommand(const QByteArray &command);
private: private:
DebuggerCommand m_lastDebuggableCommand; DebuggerCommand m_lastDebuggableCommand;

View File

@@ -32,7 +32,9 @@
#ifndef HELP_NEW_FILTER_ENGINE #ifndef HELP_NEW_FILTER_ENGINE
#include "ui_filtersettingspage.h" #include "ui_filtersettingspage.h"
#else #else
QT_BEGIN_NAMESPACE
class QHelpFilterSettingsWidget; class QHelpFilterSettingsWidget;
QT_END_NAMESPACE
#endif #endif
namespace Help { namespace Help {

View File

@@ -32,12 +32,12 @@
#include <QTimer> #include <QTimer>
#include <QWidget> #include <QWidget>
namespace Ui {
class MesonBuildSettingsWidget;
}
namespace MesonProjectManager { namespace MesonProjectManager {
namespace Internal { namespace Internal {
namespace Ui { class MesonBuildSettingsWidget; }
class MesonBuildConfiguration; class MesonBuildConfiguration;
class MesonBuildSettingsWidget : public ProjectExplorer::NamedWidget class MesonBuildSettingsWidget : public ProjectExplorer::NamedWidget
{ {

View File

@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0"> <ui version="4.0">
<class>MesonBuildSettingsWidget</class> <class>MesonProjectManager::Internal::MesonBuildSettingsWidget</class>
<widget class="QWidget" name="MesonBuildSettingsWidget"> <widget class="QWidget" name="MesonProjectManager::Internal::MesonBuildSettingsWidget">
<property name="geometry"> <property name="geometry">
<rect> <rect>
<x>0</x> <x>0</x>

View File

@@ -30,12 +30,11 @@
#include <QTabWidget> #include <QTabWidget>
#include <QWidget> #include <QWidget>
namespace Ui {
class GeneralSettingsWidget;
}
namespace MesonProjectManager { namespace MesonProjectManager {
namespace Internal { namespace Internal {
namespace Ui { class GeneralSettingsWidget; }
class GeneralSettingsWidget final : public Core::IOptionsPageWidget class GeneralSettingsWidget final : public Core::IOptionsPageWidget
{ {
Q_DECLARE_TR_FUNCTIONS(MesonProjectManager::Internal::GeneralSettingsWidget) Q_DECLARE_TR_FUNCTIONS(MesonProjectManager::Internal::GeneralSettingsWidget)

View File

@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0"> <ui version="4.0">
<class>GeneralSettingsWidget</class> <class>MesonProjectManager::Internal::GeneralSettingsWidget</class>
<widget class="QWidget" name="GeneralSettingsWidget"> <widget class="QWidget" name="MesonProjectManager::Internal::GeneralSettingsWidget">
<property name="geometry"> <property name="geometry">
<rect> <rect>
<x>0</x> <x>0</x>

View File

@@ -29,13 +29,10 @@
#include "utils/optional.h" #include "utils/optional.h"
#include <QWidget> #include <QWidget>
namespace Ui {
class ToolItemSettings;
}
namespace MesonProjectManager { namespace MesonProjectManager {
namespace Internal { namespace Internal {
namespace Ui { class ToolItemSettings; }
class ToolTreeItem; class ToolTreeItem;
class ToolItemSettings : public QWidget class ToolItemSettings : public QWidget

View File

@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0"> <ui version="4.0">
<class>ToolItemSettings</class> <class>MesonProjectManager::Internal::ToolItemSettings</class>
<widget class="QWidget" name="ToolItemSettings"> <widget class="QWidget" name="MesonProjectManager::Internal::ToolItemSettings">
<property name="geometry"> <property name="geometry">
<rect> <rect>
<x>0</x> <x>0</x>

View File

@@ -34,13 +34,11 @@
#include <QTabWidget> #include <QTabWidget>
#include <QWidget> #include <QWidget>
namespace Ui {
class ToolsSettingsWidget;
}
namespace MesonProjectManager { namespace MesonProjectManager {
namespace Internal { namespace Internal {
namespace Ui { class ToolsSettingsWidget; }
class ToolTreeItem; class ToolTreeItem;
class ToolsSettingsWidget final : public Core::IOptionsPageWidget class ToolsSettingsWidget final : public Core::IOptionsPageWidget
{ {

View File

@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0"> <ui version="4.0">
<class>ToolsSettingsWidget</class> <class>MesonProjectManager::Internal::ToolsSettingsWidget</class>
<widget class="QWidget" name="MesonToolConfigWidget"> <widget class="QWidget" name="MesonProjectManager::Internal::ToolSettingsWidget">
<property name="geometry"> <property name="geometry">
<rect> <rect>
<x>0</x> <x>0</x>

View File

@@ -265,9 +265,11 @@ QString BuildStep::fallbackWorkingDirectory() const
void BuildStep::setupOutputFormatter(OutputFormatter *formatter) void BuildStep::setupOutputFormatter(OutputFormatter *formatter)
{ {
for (const Utils::Id id : buildConfiguration()->customParsers()) { if (qobject_cast<BuildConfiguration *>(parent()->parent())) {
if (Internal::CustomParser * const parser = Internal::CustomParser::createFromId(id)) for (const Utils::Id id : buildConfiguration()->customParsers()) {
formatter->addLineParser(parser); if (Internal::CustomParser * const parser = Internal::CustomParser::createFromId(id))
formatter->addLineParser(parser);
}
} }
Utils::FileInProjectFinder fileFinder; Utils::FileInProjectFinder fileFinder;
fileFinder.setProjectDirectory(project()->projectDirectory()); fileFinder.setProjectDirectory(project()->projectDirectory());

View File

@@ -75,7 +75,7 @@ static FilePath defaultBuildDirectory(const FilePath &projectFilePath, const Kit
// QbsBuildConfiguration: // QbsBuildConfiguration:
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
QbsBuildConfiguration::QbsBuildConfiguration(Target *target, Core::Id id) QbsBuildConfiguration::QbsBuildConfiguration(Target *target, Utils::Id id)
: BuildConfiguration(target, id) : BuildConfiguration(target, id)
{ {
setConfigWidgetHasFrame(true); setConfigWidgetHasFrame(true);

View File

@@ -62,7 +62,7 @@ class QbsBuildConfiguration final : public ProjectExplorer::BuildConfiguration
Q_OBJECT Q_OBJECT
friend class ProjectExplorer::BuildConfigurationFactory; friend class ProjectExplorer::BuildConfigurationFactory;
QbsBuildConfiguration(ProjectExplorer::Target *target, Core::Id id); QbsBuildConfiguration(ProjectExplorer::Target *target, Utils::Id id);
~QbsBuildConfiguration() final; ~QbsBuildConfiguration() final;
public: public:

View File

@@ -136,7 +136,7 @@ private:
// QbsBuildStep: // QbsBuildStep:
// -------------------------------------------------------------------- // --------------------------------------------------------------------
QbsBuildStep::QbsBuildStep(BuildStepList *bsl, Core::Id id) : QbsBuildStep::QbsBuildStep(BuildStepList *bsl, Utils::Id id) :
BuildStep(bsl, id) BuildStep(bsl, id)
{ {
setDisplayName(tr("Qbs Build")); setDisplayName(tr("Qbs Build"));

View File

@@ -51,7 +51,7 @@ public:
ExpandVariables ExpandVariables
}; };
QbsBuildStep(ProjectExplorer::BuildStepList *bsl, Core::Id id); QbsBuildStep(ProjectExplorer::BuildStepList *bsl, Utils::Id id);
~QbsBuildStep() override; ~QbsBuildStep() override;
QVariantMap qbsConfiguration(VariableHandling variableHandling) const; QVariantMap qbsConfiguration(VariableHandling variableHandling) const;

View File

@@ -49,7 +49,7 @@ namespace Internal {
// QbsCleanStep: // QbsCleanStep:
// -------------------------------------------------------------------- // --------------------------------------------------------------------
QbsCleanStep::QbsCleanStep(BuildStepList *bsl, Core::Id id) QbsCleanStep::QbsCleanStep(BuildStepList *bsl, Utils::Id id)
: BuildStep(bsl, id) : BuildStep(bsl, id)
{ {
setDisplayName(tr("Qbs Clean")); setDisplayName(tr("Qbs Clean"));

View File

@@ -41,7 +41,7 @@ class QbsCleanStep : public ProjectExplorer::BuildStep
Q_OBJECT Q_OBJECT
public: public:
QbsCleanStep(ProjectExplorer::BuildStepList *bsl, Core::Id id); QbsCleanStep(ProjectExplorer::BuildStepList *bsl, Utils::Id id);
~QbsCleanStep() override; ~QbsCleanStep() override;
QbsBuildStepData stepData() const; QbsBuildStepData stepData() const;

View File

@@ -61,7 +61,7 @@ const char QBS_KEEP_GOING[] = "Qbs.DryKeepGoing";
// QbsInstallStep: // QbsInstallStep:
// -------------------------------------------------------------------- // --------------------------------------------------------------------
QbsInstallStep::QbsInstallStep(BuildStepList *bsl, Core::Id id) QbsInstallStep::QbsInstallStep(BuildStepList *bsl, Utils::Id id)
: BuildStep(bsl, id) : BuildStep(bsl, id)
{ {
setDisplayName(tr("Qbs Install")); setDisplayName(tr("Qbs Install"));
@@ -89,16 +89,16 @@ QbsInstallStep::~QbsInstallStep()
bool QbsInstallStep::init() bool QbsInstallStep::init()
{ {
QTC_ASSERT(!buildSystem()->isParsing() && !m_session, return false); QTC_ASSERT(!target()->buildSystem()->isParsing() && !m_session, return false);
return true; return true;
} }
void QbsInstallStep::doRun() void QbsInstallStep::doRun()
{ {
m_session = static_cast<QbsBuildSystem *>(buildSystem())->session(); m_session = static_cast<QbsBuildSystem *>(target()->buildSystem())->session();
QJsonObject request; QJsonObject request;
request.insert("type", "install"); request.insert("type", "install-project");
request.insert("install-root", installRoot()); request.insert("install-root", installRoot());
request.insert("clean-install-root", m_cleanInstallRoot->value()); request.insert("clean-install-root", m_cleanInstallRoot->value());
request.insert("keep-going", m_keepGoing->value()); request.insert("keep-going", m_keepGoing->value());
@@ -128,7 +128,7 @@ QString QbsInstallStep::installRoot() const
const QbsBuildConfiguration *QbsInstallStep::buildConfig() const const QbsBuildConfiguration *QbsInstallStep::buildConfig() const
{ {
return static_cast<QbsBuildConfiguration *>(buildConfiguration()); return static_cast<QbsBuildConfiguration *>(target()->activeBuildConfiguration());
} }
void QbsInstallStep::installDone(const ErrorInfo &error) void QbsInstallStep::installDone(const ErrorInfo &error)

View File

@@ -42,7 +42,7 @@ class QbsInstallStep : public ProjectExplorer::BuildStep
Q_OBJECT Q_OBJECT
public: public:
QbsInstallStep(ProjectExplorer::BuildStepList *bsl, Core::Id id); QbsInstallStep(ProjectExplorer::BuildStepList *bsl, Utils::Id id);
~QbsInstallStep() override; ~QbsInstallStep() override;
QString installRoot() const; QString installRoot() const;

View File

@@ -163,9 +163,9 @@ void QbsProfilesSettingsWidget::refreshKitsList()
m_ui.propertiesView->setModel(nullptr); m_ui.propertiesView->setModel(nullptr);
m_model.reload(); m_model.reload();
m_ui.profileValueLabel->clear(); m_ui.profileValueLabel->clear();
Core::Id currentId; Utils::Id currentId;
if (m_ui.kitsComboBox->count() > 0) if (m_ui.kitsComboBox->count() > 0)
currentId = Core::Id::fromSetting(m_ui.kitsComboBox->currentData()); currentId = Utils::Id::fromSetting(m_ui.kitsComboBox->currentData());
m_ui.kitsComboBox->clear(); m_ui.kitsComboBox->clear();
int newCurrentIndex = -1; int newCurrentIndex = -1;
QList<Kit *> validKits = KitManager::kits(); QList<Kit *> validKits = KitManager::kits();
@@ -191,7 +191,7 @@ void QbsProfilesSettingsWidget::displayCurrentProfile()
m_ui.propertiesView->setModel(nullptr); m_ui.propertiesView->setModel(nullptr);
if (m_ui.kitsComboBox->currentIndex() == -1) if (m_ui.kitsComboBox->currentIndex() == -1)
return; return;
const Core::Id kitId = Core::Id::fromSetting(m_ui.kitsComboBox->currentData()); const Utils::Id kitId = Utils::Id::fromSetting(m_ui.kitsComboBox->currentData());
const Kit * const kit = KitManager::kit(kitId); const Kit * const kit = KitManager::kit(kitId);
QTC_ASSERT(kit, return); QTC_ASSERT(kit, return);
const QString profileName = QbsProfileManager::ensureProfileForKit(kit); const QString profileName = QbsProfileManager::ensureProfileForKit(kit);

View File

@@ -40,7 +40,6 @@
#include <coreplugin/documentmanager.h> #include <coreplugin/documentmanager.h>
#include <coreplugin/icontext.h> #include <coreplugin/icontext.h>
#include <coreplugin/icore.h> #include <coreplugin/icore.h>
#include <coreplugin/id.h>
#include <coreplugin/iversioncontrol.h> #include <coreplugin/iversioncontrol.h>
#include <coreplugin/messagemanager.h> #include <coreplugin/messagemanager.h>
#include <coreplugin/progressmanager/progressmanager.h> #include <coreplugin/progressmanager/progressmanager.h>

View File

@@ -35,6 +35,7 @@
#include <projectexplorer/task.h> #include <projectexplorer/task.h>
#include <utils/environment.h> #include <utils/environment.h>
#include <utils/id.h>
#include <QFutureWatcher> #include <QFutureWatcher>
#include <QHash> #include <QHash>
@@ -92,7 +93,7 @@ public:
const QString &filePath, const QString &newFilePath) final; const QString &filePath, const QString &newFilePath) final;
QStringList filesGeneratedFrom(const QString &sourceFile) const final; QStringList filesGeneratedFrom(const QString &sourceFile) const final;
QVariant additionalData(Core::Id id) const final; QVariant additionalData(Utils::Id id) const final;
bool isProjectEditable() const; bool isProjectEditable() const;
bool addFilesToProduct(const QStringList &filePaths, bool addFilesToProduct(const QStringList &filePaths,

View File

@@ -268,7 +268,7 @@ QString QbsSession::errorString(QbsSession::Error error)
case Error::QbsFailedToStart: case Error::QbsFailedToStart:
return tr("The qbs process failed to start."); return tr("The qbs process failed to start.");
case Error::ProtocolError: case Error::ProtocolError:
return tr("The qbs process sent invalid data."); return tr("The qbs process sent unexpected data.");
case Error::VersionMismatch: case Error::VersionMismatch:
return tr("The qbs API level is not compatible with " return tr("The qbs API level is not compatible with "
"what %1 expects.").arg(Core::Constants::IDE_DISPLAY_NAME); "what %1 expects.").arg(Core::Constants::IDE_DISPLAY_NAME);
@@ -536,6 +536,15 @@ void QbsSession::handlePacket(const QJsonObject &packet)
} else if (type == "run-environment") { } else if (type == "run-environment") {
d->reply = packet; d->reply = packet;
d->eventLoop.quit(); d->eventLoop.quit();
} else if (type == "protocol-error") {
const ErrorInfo errorInfo = ErrorInfo(packet.value("error").toObject());
// TODO: This loop occurs a lot. Factor it out.
for (const ErrorInfoItem &item : errorInfo.items) {
TaskHub::addTask(BuildSystemTask(Task::Error, item.description,
item.filePath, item.line));
}
setError(Error::ProtocolError);
} }
} }

View File

@@ -39,9 +39,6 @@ class QListView;
class QPlainTextEdit; class QPlainTextEdit;
QT_END_NAMESPACE QT_END_NAMESPACE
namespace Ui {
class AssetExportDialog;
}
namespace Utils { namespace Utils {
class OutputFormatter; class OutputFormatter;
@@ -52,6 +49,7 @@ class Task;
} }
namespace QmlDesigner { namespace QmlDesigner {
namespace Ui { class AssetExportDialog; }
class FilePathModel; class FilePathModel;
class AssetExportDialog : public QDialog class AssetExportDialog : public QDialog

View File

@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0"> <ui version="4.0">
<class>AssetExportDialog</class> <class>QmlDesigner::AssetExportDialog</class>
<widget class="QDialog" name="AssetExportDialog"> <widget class="QDialog" name="QmlDesigner::AssetExportDialog">
<property name="geometry"> <property name="geometry">
<rect> <rect>
<x>0</x> <x>0</x>

View File

@@ -32,6 +32,8 @@
#include "utils/qtcassert.h" #include "utils/qtcassert.h"
#include "utils/runextensions.h" #include "utils/runextensions.h"
#include "variantproperty.h" #include "variantproperty.h"
#include "projectexplorer/session.h"
#include "projectexplorer/project.h"
#include <QCryptographicHash> #include <QCryptographicHash>
#include <QDir> #include <QDir>
@@ -239,7 +241,10 @@ void AssetExporter::writeMetadata() const
return; return;
} }
Utils::FilePath metadataPath = m_exportPath.pathAppended(m_exportPath.fileName() + ".metadata"); auto const startupProject = ProjectExplorer::SessionManager::startupProject();
QTC_ASSERT(startupProject, return);
const QString projectName = startupProject->displayName();
Utils::FilePath metadataPath = m_exportPath.pathAppended(projectName + ".metadata");
ExportNotification::addInfo(tr("Writing metadata to file %1."). ExportNotification::addInfo(tr("Writing metadata to file %1.").
arg(metadataPath.toUserOutput())); arg(metadataPath.toUserOutput()));
makeParentPath(metadataPath); makeParentPath(metadataPath);

View File

@@ -95,8 +95,10 @@ void AssetExporterPlugin::onExport()
return; return;
FilePathModel model(startupProject); FilePathModel model(startupProject);
QString exportDirName = startupProject->displayName() + "_export"; auto exportDir = startupProject->projectFilePath().parentDir();
auto exportDir = startupProject->projectFilePath().parentDir().pathAppended(exportDirName); if (!exportDir.parentDir().isEmpty())
exportDir = exportDir.parentDir();
exportDir = exportDir.pathAppended(startupProject->displayName() + "_export");
AssetExporter assetExporter(m_view, startupProject); AssetExporter assetExporter(m_view, startupProject);
AssetExportDialog assetExporterDialog(exportDir, assetExporter, model); AssetExportDialog assetExporterDialog(exportDir, assetExporter, model);
assetExporterDialog.exec(); assetExporterDialog.exec();

View File

@@ -62,7 +62,7 @@ bool AssetExporterView::loadQmlFile(const Utils::FilePath &path, uint timeoutSec
setState(LoadState::Busy); setState(LoadState::Busy);
m_retryCount = std::max(MinRetry, static_cast<int>((timeoutSecs * 1000) / RetryIntervalMs)); m_retryCount = std::max(MinRetry, static_cast<int>((timeoutSecs * 1000) / RetryIntervalMs));
m_currentEditor = Core::EditorManager::openEditor(path.toString(), Core::Id(), m_currentEditor = Core::EditorManager::openEditor(path.toString(), Utils::Id(),
Core::EditorManager::DoNotMakeVisible); Core::EditorManager::DoNotMakeVisible);
Core::ModeManager::activateMode(Core::Constants::MODE_DESIGN); Core::ModeManager::activateMode(Core::Constants::MODE_DESIGN);
Core::ModeManager::setFocusToCurrentMode(); Core::ModeManager::setFocusToCurrentMode();
@@ -154,8 +154,10 @@ void AssetExporterView::handleTimerTimeout()
} }
QT_BEGIN_NAMESPACE
QDebug operator<<(QDebug os, const QmlDesigner::AssetExporterView::LoadState &s) QDebug operator<<(QDebug os, const QmlDesigner::AssetExporterView::LoadState &s)
{ {
os << static_cast<std::underlying_type<QmlDesigner::AssetExporterView::LoadState>::type>(s); os << static_cast<std::underlying_type<QmlDesigner::AssetExporterView::LoadState>::type>(s);
return os; return os;
} }
QT_END_NAMESPACE

View File

@@ -83,4 +83,6 @@ private:
} }
QT_BEGIN_NAMESPACE
QDebug operator<<(QDebug os, const QmlDesigner::AssetExporterView::LoadState &s); QDebug operator<<(QDebug os, const QmlDesigner::AssetExporterView::LoadState &s);
QT_END_NAMESPACE

View File

@@ -38,7 +38,8 @@
namespace QmlDesigner { namespace QmlDesigner {
AnnotationEditor::AnnotationEditor(QObject *) AnnotationEditor::AnnotationEditor(QObject *parent)
: QObject(parent)
{ {
} }
@@ -55,9 +56,9 @@ void AnnotationEditor::registerDeclarativeType()
void AnnotationEditor::showWidget() void AnnotationEditor::showWidget()
{ {
m_dialog = new AnnotationEditorDialog(Core::ICore::dialogParent(), m_dialog = new AnnotationEditorDialog(Core::ICore::dialogParent(),
modelNode().validId(), m_modelNode.id(),
modelNode().customId(), m_modelNode.customId(),
modelNode().annotation()); m_modelNode.annotation());
QObject::connect(m_dialog, &AnnotationEditorDialog::accepted, QObject::connect(m_dialog, &AnnotationEditorDialog::accepted,
this, &AnnotationEditor::acceptedClicked); this, &AnnotationEditor::acceptedClicked);

View File

@@ -103,9 +103,13 @@ public:
fontStyleItalic, fontStyleItalic,
fontStyleStrikethrough, fontStyleStrikethrough,
fontStyleUnderline, fontStyleUnderline,
gridView,
idAliasOff, idAliasOff,
idAliasOn, idAliasOn,
listView,
mergeCells, mergeCells,
minus,
plus,
redo, redo,
splitColumns, splitColumns,
splitRows, splitRows,

View File

@@ -268,15 +268,11 @@ ModelNode ConnectionModel::getTargetNodeForConnection(const ModelNode &connectio
const QString bindExpression = bindingProperty.expression(); const QString bindExpression = bindingProperty.expression();
if (bindingProperty.isValid()) { if (bindingProperty.isValid()) {
if (bindExpression == QLatin1String("parent")) { if (bindExpression.contains(".")) {
result = connection.parentProperty().parentModelNode();
} else if (bindExpression.contains(".")) {
QStringList substr = bindExpression.split("."); QStringList substr = bindExpression.split(".");
const QString itemId = substr.constFirst(); const QString itemId = substr.constFirst();
if (substr.size() > 1) { if (substr.size() > 1) {
const ModelNode aliasParent = (itemId == QLatin1String("parent") const ModelNode aliasParent = connectionView()->modelNodeForId(itemId);
? connection.parentProperty().parentModelNode()
: connectionView()->modelNodeForId(itemId));
substr.removeFirst(); //remove id, only alias pieces left substr.removeFirst(); //remove id, only alias pieces left
const QString aliasBody = substr.join("."); const QString aliasBody = substr.join(".");
if (aliasParent.isValid() && aliasParent.hasBindingProperty(aliasBody.toUtf8())) { if (aliasParent.isValid() && aliasParent.hasBindingProperty(aliasBody.toUtf8())) {
@@ -303,7 +299,7 @@ void ConnectionModel::addConnection()
NodeMetaInfo nodeMetaInfo = connectionView()->model()->metaInfo("QtQuick.Connections"); NodeMetaInfo nodeMetaInfo = connectionView()->model()->metaInfo("QtQuick.Connections");
if (nodeMetaInfo.isValid()) { if (nodeMetaInfo.isValid()) {
connectionView()->executeInTransaction("ConnectionModel::addConnection", [=](){ connectionView()->executeInTransaction("ConnectionModel::addConnection", [=, &rootModelNode](){
ModelNode newNode = connectionView()->createModelNode("QtQuick.Connections", ModelNode newNode = connectionView()->createModelNode("QtQuick.Connections",
nodeMetaInfo.majorVersion(), nodeMetaInfo.majorVersion(),
nodeMetaInfo.minorVersion()); nodeMetaInfo.minorVersion());
@@ -316,19 +312,14 @@ void ConnectionModel::addConnection()
else else
rootModelNode.nodeAbstractProperty(rootModelNode.metaInfo().defaultPropertyName()).reparentHere(newNode); rootModelNode.nodeAbstractProperty(rootModelNode.metaInfo().defaultPropertyName()).reparentHere(newNode);
if (QmlItemNode(selectedNode).isFlowActionArea()) if (QmlItemNode(selectedNode).isFlowActionArea() || QmlVisualNode(selectedNode).isFlowTransition())
source = selectedNode.validId() + ".trigger()";
if (QmlVisualNode(selectedNode).isFlowTransition())
source = selectedNode.validId() + ".trigger()"; source = selectedNode.validId() + ".trigger()";
if (!connectionView()->selectedModelNodes().constFirst().id().isEmpty()) if (!connectionView()->selectedModelNodes().constFirst().id().isEmpty())
newNode.bindingProperty("target").setExpression(selectedNode.id()); newNode.bindingProperty("target").setExpression(selectedNode.validId());
else
newNode.bindingProperty("target").setExpression(QLatin1String("parent"));
} else { } else {
rootModelNode.nodeAbstractProperty(rootModelNode.metaInfo().defaultPropertyName()).reparentHere(newNode); rootModelNode.nodeAbstractProperty(rootModelNode.metaInfo().defaultPropertyName()).reparentHere(newNode);
newNode.bindingProperty("target").setExpression(QLatin1String("parent")); newNode.bindingProperty("target").setExpression(rootModelNode.validId());
} }
newNode.signalHandlerProperty("onClicked").setSource(source); newNode.signalHandlerProperty("onClicked").setSource(source);

View File

@@ -234,12 +234,12 @@ void FormEditorView::createFormEditorWidget()
connect(m_formEditorWidget->resetAction(), &QAction::triggered, this, &FormEditorView::resetNodeInstanceView); connect(m_formEditorWidget->resetAction(), &QAction::triggered, this, &FormEditorView::resetNodeInstanceView);
} }
void FormEditorView::temporaryBlockView() void FormEditorView::temporaryBlockView(int duration)
{ {
m_formEditorWidget->graphicsView()->setUpdatesEnabled(false); m_formEditorWidget->graphicsView()->setUpdatesEnabled(false);
static auto timer = new QTimer(qApp); static auto timer = new QTimer(qApp);
timer->setSingleShot(true); timer->setSingleShot(true);
timer->start(1000); timer->start(duration);
connect(timer, &QTimer::timeout, this, [this]() { connect(timer, &QTimer::timeout, this, [this]() {
m_formEditorWidget->graphicsView()->setUpdatesEnabled(true); m_formEditorWidget->graphicsView()->setUpdatesEnabled(true);
@@ -496,6 +496,11 @@ void FormEditorView::customNotification(const AbstractView * /*view*/, const QSt
m_formEditorWidget->zoomAction()->zoomOut(); m_formEditorWidget->zoomAction()->zoomOut();
} }
void FormEditorView::currentStateChanged(const ModelNode & /*node*/)
{
temporaryBlockView(100);
}
AbstractFormEditorTool *FormEditorView::currentTool() const AbstractFormEditorTool *FormEditorView::currentTool() const
{ {
return m_currentTool; return m_currentTool;

View File

@@ -84,7 +84,12 @@ public:
void documentMessagesChanged(const QList<DocumentMessage> &errors, const QList<DocumentMessage> &warnings) override; void documentMessagesChanged(const QList<DocumentMessage> &errors, const QList<DocumentMessage> &warnings) override;
void customNotification(const AbstractView *view, const QString &identifier, const QList<ModelNode> &nodeList, const QList<QVariant> &data) override; void customNotification(const AbstractView *view,
const QString &identifier,
const QList<ModelNode> &nodeList,
const QList<QVariant> &data) override;
void currentStateChanged(const ModelNode &node) override;
// FormEditorView // FormEditorView
WidgetInfo widgetInfo() override; WidgetInfo widgetInfo() override;
@@ -134,7 +139,7 @@ private:
void removeNodeFromScene(const QmlItemNode &qmlItemNode); void removeNodeFromScene(const QmlItemNode &qmlItemNode);
void hideNodeFromScene(const QmlItemNode &qmlItemNode); void hideNodeFromScene(const QmlItemNode &qmlItemNode);
void createFormEditorWidget(); void createFormEditorWidget();
void temporaryBlockView(); void temporaryBlockView(int duration = 1000);
void resetNodeInstanceView(); void resetNodeInstanceView();
QPointer<FormEditorWidget> m_formEditorWidget; QPointer<FormEditorWidget> m_formEditorWidget;

View File

@@ -283,7 +283,7 @@ void FormEditorWidget::changeBackgound(const QColor &color)
} }
} }
void FormEditorWidget::registerActionAsCommand(QAction *action, Core::Id id, const QKeySequence &keysequence) void FormEditorWidget::registerActionAsCommand(QAction *action, Utils::Id id, const QKeySequence &keysequence)
{ {
Core::Context context(Constants::C_QMLFORMEDITOR); Core::Context context(Constants::C_QMLFORMEDITOR);

View File

@@ -97,7 +97,7 @@ private:
void changeRootItemWidth(const QString &widthText); void changeRootItemWidth(const QString &widthText);
void changeRootItemHeight(const QString &heightText); void changeRootItemHeight(const QString &heightText);
void changeBackgound(const QColor &color); void changeBackgound(const QColor &color);
void registerActionAsCommand(QAction *action, Core::Id id, const QKeySequence &keysequence); void registerActionAsCommand(QAction *action, Utils::Id id, const QKeySequence &keysequence);
QPointer<FormEditorView> m_formEditorView; QPointer<FormEditorView> m_formEditorView;
QPointer<FormEditorGraphicsView> m_graphicsView; QPointer<FormEditorGraphicsView> m_graphicsView;

View File

@@ -99,12 +99,16 @@ void ImportsWidget::setPossibleImports(QList<Import> possibleImports)
QList<Import> filteredImports; QList<Import> filteredImports;
const QStringList mcuWhiteList = {"QtQuick", "QtQuick.Controls"}; const QStringList mcuWhiteList = {"QtQuick", "QtQuick.Controls", "QtQuick.Timeline"};
const QStringList mcuBlackList = {"FlowView"};
if (isQtForMCUs) { if (isQtForMCUs) {
filteredImports = Utils::filtered(possibleImports, [mcuWhiteList](const Import &import) { filteredImports = Utils::filtered(possibleImports,
return mcuWhiteList.contains(import.url()) || !import.url().startsWith("Qt"); [mcuWhiteList, mcuBlackList](const Import &import) {
}); return (mcuWhiteList.contains(import.url())
|| !import.url().startsWith("Qt"))
&& !mcuBlackList.contains(import.url());
});
} else { } else {
filteredImports = possibleImports; filteredImports = possibleImports;
} }

View File

@@ -113,6 +113,8 @@ void ItemLibraryView::importsChanged(const QList<Import> &addedImports, const QL
for (ModelNode node : slConnectors) for (ModelNode node : slConnectors)
node.destroy(); node.destroy();
resetPuppet();
} }
} }
} }

View File

@@ -526,6 +526,7 @@ void NavigatorTreeModel::handleItemLibraryItemDrop(const QMimeData *mimeData, in
const QString targetPropertyName = hints.forceNonDefaultProperty(); const QString targetPropertyName = hints.forceNonDefaultProperty();
bool foundTarget = findTargetProperty(rowModelIndex, this, &targetProperty, &targetRowNumber, targetPropertyName.toUtf8()); bool foundTarget = findTargetProperty(rowModelIndex, this, &targetProperty, &targetRowNumber, targetPropertyName.toUtf8());
bool moveNodesAfter = true;
if (foundTarget) { if (foundTarget) {
if (!NodeHints::fromItemLibraryEntry(itemLibraryEntry).canBeDroppedInNavigator()) if (!NodeHints::fromItemLibraryEntry(itemLibraryEntry).canBeDroppedInNavigator())
@@ -569,16 +570,43 @@ void NavigatorTreeModel::handleItemLibraryItemDrop(const QMimeData *mimeData, in
} }
insertIntoList("effects", targetEnv); insertIntoList("effects", targetEnv);
} else if (newModelNode.isSubclassOf("QtQuick3D.Material")) { } else if (newModelNode.isSubclassOf("QtQuick3D.Material")) {
// Insert material dropped to a model node into the materials list of the model if (targetProperty.parentModelNode().isSubclassOf("QtQuick3D.Model")) {
ModelNode targetModel; // Insert material dropped to a model node into the materials list of the model
if (targetProperty.parentModelNode().isSubclassOf("QtQuick3D.Model")) ModelNode targetModel;
targetModel = targetProperty.parentModelNode(); targetModel = targetProperty.parentModelNode();
insertIntoList("materials", targetModel); insertIntoList("materials", targetModel);
}
} else {
const bool isShader = newModelNode.isSubclassOf("QtQuick3D.Shader");
if (isShader || newModelNode.isSubclassOf("QtQuick3D.Command")) {
if (targetProperty.parentModelNode().isSubclassOf("QtQuick3D.Pass")) {
// Shaders and commands inserted into a Pass will be added to proper list.
// They are also moved to the same level as the pass, as passes don't
// allow child nodes (QTBUG-86219).
ModelNode targetModel;
targetModel = targetProperty.parentModelNode();
if (isShader)
insertIntoList("shaders", targetModel);
else
insertIntoList("commands", targetModel);
NodeAbstractProperty parentProp = targetProperty.parentProperty();
if (parentProp.isValid()) {
targetProperty = parentProp;
targetModel = targetProperty.parentModelNode();
targetRowNumber = rowCount(indexForModelNode(targetModel));
// Move node to new parent within the same transaction as we don't
// want undo to place the node under invalid parent
moveNodesAfter = false;
moveNodesInteractive(targetProperty, {newQmlObjectNode}, targetRowNumber, false);
}
}
}
} }
} }
}); });
if (newQmlObjectNode.isValid() && targetProperty.isNodeListProperty()) { if (moveNodesAfter && newQmlObjectNode.isValid() && targetProperty.isNodeListProperty()) {
QList<ModelNode> newModelNodeList; QList<ModelNode> newModelNodeList;
newModelNodeList.append(newQmlObjectNode); newModelNodeList.append(newQmlObjectNode);
@@ -606,9 +634,8 @@ void NavigatorTreeModel::handleItemLibraryImageDrop(const QMimeData *mimeData, i
ModelNode newModelNode; ModelNode newModelNode;
if (targetNode.isSubclassOf("QtQuick3D.DefaultMaterial")) { auto createTextureNode = [&](const NodeAbstractProperty &targetProp) -> bool {
// if dropping an image on a default material, create a texture instead of image if (targetProp.isValid()) {
m_view->executeInTransaction("QmlItemNode::createQmlItemNode", [&] {
// create a texture item lib // create a texture item lib
ItemLibraryEntry itemLibraryEntry; ItemLibraryEntry itemLibraryEntry;
itemLibraryEntry.setName("Texture"); itemLibraryEntry.setName("Texture");
@@ -621,11 +648,33 @@ void NavigatorTreeModel::handleItemLibraryImageDrop(const QMimeData *mimeData, i
itemLibraryEntry.addProperty(prop, type, val); itemLibraryEntry.addProperty(prop, type, val);
// create a texture // create a texture
newModelNode = QmlItemNode::createQmlObjectNode(m_view, itemLibraryEntry, {}, targetProperty, false); newModelNode = QmlItemNode::createQmlObjectNode(m_view, itemLibraryEntry, {}, targetProp, false);
return newModelNode.isValid();
}
return false;
};
// set the texture to parent material's diffuseMap property if (targetNode.isSubclassOf("QtQuick3D.Material")) {
// TODO: allow the user to choose which map property to set the texture for // if dropping an image on a default material, create a texture instead of image
targetNode.bindingProperty("diffuseMap").setExpression(newModelNode.validId()); m_view->executeInTransaction("NavigatorTreeModel::handleItemLibraryImageDrop", [&] {
if (createTextureNode(targetProperty)) {
// Automatically set the texture to default property
// TODO: allow the user to choose which map property to set the texture for (QDS-2326)
if (targetNode.isSubclassOf("QtQuick3D.DefaultMaterial"))
targetNode.bindingProperty("diffuseMap").setExpression(newModelNode.validId());
else if (targetNode.isSubclassOf("QtQuick3D.PrincipledMaterial"))
targetNode.bindingProperty("baseColorMap").setExpression(newModelNode.validId());
}
});
} else if (targetNode.isSubclassOf("QtQuick3D.TextureInput")) {
// If dropping an image on a TextureInput, create a texture on the same level as
// TextureInput, as the TextureInput doesn't support Texture children (QTBUG-86219)
m_view->executeInTransaction("NavigatorTreeModel::handleItemLibraryImageDrop", [&] {
NodeAbstractProperty parentProp = targetProperty.parentProperty();
if (createTextureNode(parentProp)) {
// Automatically set the texture to texture property
targetNode.bindingProperty("texture").setExpression(newModelNode.validId());
}
}); });
} else if (targetNode.isSubclassOf("QtQuick3D.Texture")) { } else if (targetNode.isSubclassOf("QtQuick3D.Texture")) {
// if dropping an image on a texture, set the texture source // if dropping an image on a texture, set the texture source
@@ -643,11 +692,14 @@ void NavigatorTreeModel::handleItemLibraryImageDrop(const QMimeData *mimeData, i
} }
} }
void NavigatorTreeModel::moveNodesInteractive(NodeAbstractProperty &parentProperty, const QList<ModelNode> &modelNodes, int targetIndex) void NavigatorTreeModel::moveNodesInteractive(NodeAbstractProperty &parentProperty,
const QList<ModelNode> &modelNodes,
int targetIndex,
bool executeInTransaction)
{ {
QTC_ASSERT(m_view, return); QTC_ASSERT(m_view, return);
m_view->executeInTransaction("NavigatorTreeModel::moveNodesInteractive",[&parentProperty, modelNodes, targetIndex](){ auto doMoveNodesInteractive = [&parentProperty, modelNodes, targetIndex](){
const TypeName propertyQmlType = parentProperty.parentModelNode().metaInfo().propertyTypeName(parentProperty.name()); const TypeName propertyQmlType = parentProperty.parentModelNode().metaInfo().propertyTypeName(parentProperty.name());
foreach (const ModelNode &modelNode, modelNodes) { foreach (const ModelNode &modelNode, modelNodes) {
if (modelNode.isValid() if (modelNode.isValid()
@@ -665,7 +717,12 @@ void NavigatorTreeModel::moveNodesInteractive(NodeAbstractProperty &parentProper
} }
} }
} }
}); };
if (executeInTransaction)
m_view->executeInTransaction("NavigatorTreeModel::moveNodesInteractive", doMoveNodesInteractive);
else
doMoveNodesInteractive();
} }
Qt::DropActions NavigatorTreeModel::supportedDropActions() const Qt::DropActions NavigatorTreeModel::supportedDropActions() const

View File

@@ -92,7 +92,8 @@ public:
void resetModel() override; void resetModel() override;
private: private:
void moveNodesInteractive(NodeAbstractProperty &parentProperty, const QList<ModelNode> &modelNodes, int targetIndex); void moveNodesInteractive(NodeAbstractProperty &parentProperty, const QList<ModelNode> &modelNodes,
int targetIndex, bool executeInTransaction = true);
void handleInternalDrop(const QMimeData *mimeData, int rowNumber, const QModelIndex &dropModelIndex); void handleInternalDrop(const QMimeData *mimeData, int rowNumber, const QModelIndex &dropModelIndex);
void handleItemLibraryItemDrop(const QMimeData *mimeData, int rowNumber, const QModelIndex &dropModelIndex); void handleItemLibraryItemDrop(const QMimeData *mimeData, int rowNumber, const QModelIndex &dropModelIndex);
void handleItemLibraryImageDrop(const QMimeData *mimeData, int rowNumber, const QModelIndex &dropModelIndex); void handleItemLibraryImageDrop(const QMimeData *mimeData, int rowNumber, const QModelIndex &dropModelIndex);

View File

@@ -321,7 +321,7 @@ void NavigatorView::changeToComponent(const QModelIndex &index)
const ModelNode doubleClickNode = modelNodeForIndex(index); const ModelNode doubleClickNode = modelNodeForIndex(index);
if (doubleClickNode.metaInfo().isFileComponent()) if (doubleClickNode.metaInfo().isFileComponent())
Core::EditorManager::openEditor(doubleClickNode.metaInfo().componentFileName(), Core::EditorManager::openEditor(doubleClickNode.metaInfo().componentFileName(),
Core::Id(), Core::EditorManager::DoNotMakeVisible); Utils::Id(), Core::EditorManager::DoNotMakeVisible);
} }
} }

View File

@@ -261,19 +261,36 @@ bool PropertyEditorValue::isTranslated() const
return false; return false;
} }
static bool itemOrImage(const QmlDesigner::NodeMetaInfo &metaInfo)
{
if (!metaInfo.isValid())
return false;
if (metaInfo.isSubclassOf("QtQuick.Image") || metaInfo.isSubclassOf("QtQuick.Text"))
return true;
return false;
}
bool PropertyEditorValue::isAvailable() const bool PropertyEditorValue::isAvailable() const
{ {
const QList<QByteArray> mcuProperties = {"layer", "opacity", "rotation", "scale", "gradient", const QList<QByteArray> mcuProperties = {"layer", "opacity", "gradient", "smooth", "antialiasing"};
"transformOrigin", "smooth", "antialiasing", "border"};
const QList<QByteArray> mcuTransformProperties = {"rotation", "scale", "transformOrigin"};
const QList<QByteArray> list = name().split('.'); const QList<QByteArray> list = name().split('.');
const QByteArray pureName = list.first(); const QByteArray pureName = list.first();
QmlDesigner::DesignDocument *designDocument = QmlDesigner::DesignDocument *designDocument = QmlDesigner::QmlDesignerPlugin::instance()
QmlDesigner::QmlDesignerPlugin::instance()->documentManager().currentDesignDocument(); ->documentManager()
.currentDesignDocument();
if (designDocument && designDocument->isQtForMCUsProject()) {
if (designDocument && designDocument->isQtForMCUsProject()) if (mcuProperties.contains(pureName))
return !mcuProperties.contains(pureName); return false;
if (mcuTransformProperties.contains(pureName) && !itemOrImage(m_modelNode.metaInfo()))
return false;
}
return true; return true;
} }

View File

@@ -38,6 +38,8 @@
#include <QTextTable> #include <QTextTable>
#include <QScopeGuard> #include <QScopeGuard>
#include <QPointer> #include <QPointer>
#include <QTextTableFormat>
#include <QPainter>
#include <utils/stylehelper.h> #include <utils/stylehelper.h>
@@ -85,6 +87,27 @@ static void cursorEditBlock(QTextCursor& cursor, std::function<void()> f) {
cursor.endEditBlock(); cursor.endEditBlock();
} }
static QPixmap drawColorBox(const QColor& color, const QSize& size, int borderWidth = 4)
{
if (size.isEmpty()) {
return {};
}
QPixmap result(size);
const QColor borderColor = QApplication::palette("QWidget").color(QPalette::Normal,
QPalette::Button);
result.fill(color);
QPainter painter(&result);
QPen pen(borderColor);
pen.setWidth(borderWidth);
painter.setPen(pen);
painter.drawRect(QRect(QPoint(0,0), size));
return result;
}
RichTextEditor::RichTextEditor(QWidget *parent) RichTextEditor::RichTextEditor(QWidget *parent)
: QWidget(parent) : QWidget(parent)
, ui(new Ui::RichTextEditor) , ui(new Ui::RichTextEditor)
@@ -214,8 +237,7 @@ void RichTextEditor::fontChanged(const QFont &f)
void RichTextEditor::colorChanged(const QColor &c) void RichTextEditor::colorChanged(const QColor &c)
{ {
QPixmap colorBox(ui->tableBar->iconSize()); QPixmap colorBox(drawColorBox(c, ui->tableBar->iconSize()));
colorBox.fill(c);
m_actionTextColor->setIcon(colorBox); m_actionTextColor->setIcon(colorBox);
} }
@@ -436,8 +458,7 @@ void RichTextEditor::setupListActions()
void RichTextEditor::setupFontActions() void RichTextEditor::setupFontActions()
{ {
QPixmap colorBox(ui->tableBar->iconSize()); QPixmap colorBox(drawColorBox(ui->textEdit->textColor(), ui->tableBar->iconSize()));
colorBox.fill(ui->textEdit->textColor());
m_actionTextColor = ui->toolBar->addAction(colorBox, tr("&Color..."), [this]() { m_actionTextColor = ui->toolBar->addAction(colorBox, tr("&Color..."), [this]() {
QColor col = QColorDialog::getColor(ui->textEdit->textColor(), this); QColor col = QColorDialog::getColor(ui->textEdit->textColor(), this);
@@ -507,7 +528,20 @@ void RichTextEditor::setupTableActions()
m_actionCreateTable = ui->tableBar->addAction(createTableIcon, tr("Create Table"), [this]() { m_actionCreateTable = ui->tableBar->addAction(createTableIcon, tr("Create Table"), [this]() {
QTextCursor cursor = ui->textEdit->textCursor(); QTextCursor cursor = ui->textEdit->textCursor();
cursorEditBlock(cursor, [&] () { cursorEditBlock(cursor, [&] () {
cursor.insertTable(1,1); //format table cells to look a bit better:
QTextTableFormat tableFormat;
tableFormat.setCellSpacing(2.0);
tableFormat.setCellPadding(2.0);
tableFormat.setBorder(1.0);
#if (QT_VERSION >= QT_VERSION_CHECK(5, 14, 0))
tableFormat.setBorderCollapse(true);
#endif
cursor.insertTable(1, 1, tableFormat);
//move cursor into the first cell of the table:
ui->textEdit->setTextCursor(cursor);
}); });
}); });
m_actionCreateTable->setCheckable(false); m_actionCreateTable->setCheckable(false);

View File

@@ -249,4 +249,19 @@ bool StatesEditorModel::hasDefaultState() const
return m_statesEditorView->hasDefaultState(); return m_statesEditorView->hasDefaultState();
} }
void StatesEditorModel::setAnnotation(int internalNodeId)
{
m_statesEditorView->setAnnotation(internalNodeId);
}
void StatesEditorModel::removeAnnotation(int internalNodeId)
{
m_statesEditorView->removeAnnotation(internalNodeId);
}
bool StatesEditorModel::hasAnnotation(int internalNodeId) const
{
return m_statesEditorView->hasAnnotation(internalNodeId);
}
} // namespace QmlDesigner } // namespace QmlDesigner

View File

@@ -67,6 +67,9 @@ public:
Q_INVOKABLE void setStateAsDefault(int internalNodeId); Q_INVOKABLE void setStateAsDefault(int internalNodeId);
Q_INVOKABLE void resetDefaultState(); Q_INVOKABLE void resetDefaultState();
Q_INVOKABLE bool hasDefaultState() const; Q_INVOKABLE bool hasDefaultState() const;
Q_INVOKABLE void setAnnotation(int internalNodeId);
Q_INVOKABLE void removeAnnotation(int internalNodeId);
Q_INVOKABLE bool hasAnnotation(int internalNodeId) const;
void reset(); void reset();

View File

@@ -31,6 +31,7 @@
#include <QDebug> #include <QDebug>
#include <QRegularExpression> #include <QRegularExpression>
#include <cmath> #include <cmath>
#include <memory>
#include <nodemetainfo.h> #include <nodemetainfo.h>
@@ -40,6 +41,7 @@
#include <qmlitemnode.h> #include <qmlitemnode.h>
#include <qmlstate.h> #include <qmlstate.h>
#include <annotationeditor/annotationeditor.h>
namespace QmlDesigner { namespace QmlDesigner {
@@ -51,7 +53,8 @@ namespace QmlDesigner {
StatesEditorView::StatesEditorView(QObject *parent) : StatesEditorView::StatesEditorView(QObject *parent) :
AbstractView(parent), AbstractView(parent),
m_statesEditorModel(new StatesEditorModel(this)), m_statesEditorModel(new StatesEditorModel(this)),
m_lastIndex(-1) m_lastIndex(-1),
m_editor(nullptr)
{ {
Q_ASSERT(m_statesEditorModel); Q_ASSERT(m_statesEditorModel);
// base state // base state
@@ -59,6 +62,8 @@ StatesEditorView::StatesEditorView(QObject *parent) :
StatesEditorView::~StatesEditorView() StatesEditorView::~StatesEditorView()
{ {
if (m_editor)
delete m_editor;
delete m_statesEditorWidget.data(); delete m_statesEditorWidget.data();
} }
@@ -274,6 +279,8 @@ void StatesEditorView::setWhenCondition(int internalNodeId, const QString &condi
return; return;
m_block = true; m_block = true;
auto guard = [this](int* p) { m_block = false; delete p; };
std::unique_ptr<int, decltype(guard)> scopeGuard(new int, guard);
if (hasModelNodeForInternalId(internalNodeId)) { if (hasModelNodeForInternalId(internalNodeId)) {
QmlModelState state(modelNodeForInternalId(internalNodeId)); QmlModelState state(modelNodeForInternalId(internalNodeId));
@@ -285,8 +292,6 @@ void StatesEditorView::setWhenCondition(int internalNodeId, const QString &condi
e.showException(); e.showException();
} }
} }
m_block = false;
} }
void StatesEditorView::resetWhenCondition(int internalNodeId) void StatesEditorView::resetWhenCondition(int internalNodeId)
@@ -295,6 +300,8 @@ void StatesEditorView::resetWhenCondition(int internalNodeId)
return; return;
m_block = true; m_block = true;
auto guard = [this](int* p) { m_block = false; delete p; };
std::unique_ptr<int, decltype(guard)> scopeGuard(new int, guard);
if (hasModelNodeForInternalId(internalNodeId)) { if (hasModelNodeForInternalId(internalNodeId)) {
QmlModelState state(modelNodeForInternalId(internalNodeId)); QmlModelState state(modelNodeForInternalId(internalNodeId));
@@ -306,8 +313,6 @@ void StatesEditorView::resetWhenCondition(int internalNodeId)
e.showException(); e.showException();
} }
} }
m_block = false;
} }
void StatesEditorView::setStateAsDefault(int internalNodeId) void StatesEditorView::setStateAsDefault(int internalNodeId)
@@ -316,6 +321,8 @@ void StatesEditorView::setStateAsDefault(int internalNodeId)
return; return;
m_block = true; m_block = true;
auto guard = [this](int* p) { m_block = false; delete p; };
std::unique_ptr<int, decltype(guard)> scopeGuard(new int, guard);
if (hasModelNodeForInternalId(internalNodeId)) { if (hasModelNodeForInternalId(internalNodeId)) {
QmlModelState state(modelNodeForInternalId(internalNodeId)); QmlModelState state(modelNodeForInternalId(internalNodeId));
@@ -327,8 +334,6 @@ void StatesEditorView::setStateAsDefault(int internalNodeId)
e.showException(); e.showException();
} }
} }
m_block = false;
} }
void StatesEditorView::resetDefaultState() void StatesEditorView::resetDefaultState()
@@ -337,6 +342,8 @@ void StatesEditorView::resetDefaultState()
return; return;
m_block = true; m_block = true;
auto guard = [this](int* p) { m_block = false; delete p; };
std::unique_ptr<int, decltype(guard)> scopeGuard(new int, guard);
try { try {
if (rootModelNode().hasProperty("state")) if (rootModelNode().hasProperty("state"))
@@ -345,8 +352,6 @@ void StatesEditorView::resetDefaultState()
} catch (const RewritingException &e) { } catch (const RewritingException &e) {
e.showException(); e.showException();
} }
m_block = false;
} }
bool StatesEditorView::hasDefaultState() const bool StatesEditorView::hasDefaultState() const
@@ -354,6 +359,70 @@ bool StatesEditorView::hasDefaultState() const
return rootModelNode().hasProperty("state"); return rootModelNode().hasProperty("state");
} }
void StatesEditorView::setAnnotation(int internalNodeId)
{
if (m_block)
return;
m_block = true;
auto guard = [this](int* p) { m_block = false; delete p; };
std::unique_ptr<int, decltype(guard)> scopeGuard(new int, guard);
if (hasModelNodeForInternalId(internalNodeId)) {
QmlModelState state(modelNodeForInternalId(internalNodeId));
try {
if (state.isValid()) {
ModelNode modelNode = state.modelNode();
if (modelNode.isValid()) {
if (!m_editor)
m_editor = new AnnotationEditor(this);
m_editor->setModelNode(modelNode);
m_editor->showWidget();
}
}
} catch (const RewritingException &e) {
e.showException();
}
}
}
void StatesEditorView::removeAnnotation(int internalNodeId)
{
if (m_block)
return;
m_block = true;
auto guard = [this](int* p) { m_block = false; delete p; };
std::unique_ptr<int, decltype(guard)> scopeGuard(new int, guard);
if (hasModelNodeForInternalId(internalNodeId)) {
QmlModelState state(modelNodeForInternalId(internalNodeId));
try {
if (state.isValid()) {
state.removeAnnotation();
}
} catch (const RewritingException &e) {
e.showException();
}
}
}
bool StatesEditorView::hasAnnotation(int internalNodeId) const
{
if (hasModelNodeForInternalId(internalNodeId)) {
QmlModelState state(modelNodeForInternalId(internalNodeId));
if (state.isValid()) {
return state.hasAnnotation();
}
}
return false;
}
void StatesEditorView::modelAttached(Model *model) void StatesEditorView::modelAttached(Model *model)
{ {
if (model == AbstractView::model()) if (model == AbstractView::model())
@@ -444,7 +513,12 @@ void StatesEditorView::bindingPropertiesChanged(const QList<BindingProperty> &pr
void StatesEditorView::variantPropertiesChanged(const QList<VariantProperty> &propertyList, void StatesEditorView::variantPropertiesChanged(const QList<VariantProperty> &propertyList,
AbstractView::PropertyChangeFlags /*propertyChange*/) AbstractView::PropertyChangeFlags /*propertyChange*/)
{ {
if (m_block)
return;
m_block = true; m_block = true;
auto guard = [this](int* p) { m_block = false; delete p; };
std::unique_ptr<int, decltype(guard)> scopeGuard(new int, guard);
for (const VariantProperty &property : propertyList) { for (const VariantProperty &property : propertyList) {
if (property.name() == "name" && QmlModelState::isValidQmlModelState(property.parentModelNode())) if (property.name() == "name" && QmlModelState::isValidQmlModelState(property.parentModelNode()))
@@ -452,8 +526,6 @@ void StatesEditorView::variantPropertiesChanged(const QList<VariantProperty> &pr
else if (property.name() == "state" && property.parentModelNode().isRootNode()) else if (property.name() == "state" && property.parentModelNode().isRootNode())
resetModel(); resetModel();
} }
m_block = false;
} }
void StatesEditorView::currentStateChanged(const ModelNode &node) void StatesEditorView::currentStateChanged(const ModelNode &node)

View File

@@ -33,6 +33,7 @@ namespace QmlDesigner {
class StatesEditorModel; class StatesEditorModel;
class StatesEditorWidget; class StatesEditorWidget;
class AnnotationEditor;
class StatesEditorView : public AbstractView { class StatesEditorView : public AbstractView {
Q_OBJECT Q_OBJECT
@@ -47,6 +48,9 @@ public:
void setStateAsDefault(int internalNodeId); void setStateAsDefault(int internalNodeId);
void resetDefaultState(); void resetDefaultState();
bool hasDefaultState() const; bool hasDefaultState() const;
void setAnnotation(int internalNodeId);
void removeAnnotation(int internalNodeId);
bool hasAnnotation(int internalNodeId) const;
bool validStateName(const QString &name) const; bool validStateName(const QString &name) const;
QString currentStateName() const; QString currentStateName() const;
void setCurrentState(const QmlModelState &state); void setCurrentState(const QmlModelState &state);
@@ -102,6 +106,7 @@ private:
QPointer<StatesEditorWidget> m_statesEditorWidget; QPointer<StatesEditorWidget> m_statesEditorWidget;
int m_lastIndex; int m_lastIndex;
bool m_block = false; bool m_block = false;
QPointer<AnnotationEditor> m_editor;
}; };
} // namespace QmlDesigner } // namespace QmlDesigner

View File

@@ -84,7 +84,7 @@ static int controlWidth(QToolBar *bar, QObject *control)
return 0; return 0;
} }
static QAction *createAction(const Core::Id &id, static QAction *createAction(const Utils::Id &id,
const QIcon &icon, const QIcon &icon,
const QString &name, const QString &name,
const QKeySequence &shortcut) const QKeySequence &shortcut)

View File

@@ -85,7 +85,7 @@ static int controlWidth(QToolBar *bar, QObject *control)
return 0; return 0;
} }
static QAction *createAction(const Core::Id &id, static QAction *createAction(const Utils::Id &id,
const QIcon &icon, const QIcon &icon,
const QString &name, const QString &name,
const QKeySequence &shortcut) const QKeySequence &shortcut)

View File

@@ -325,7 +325,7 @@ void TransitionEditorWidget::init()
m_graphicsScene->setWidth(m_graphicsView->viewport()->width()); m_graphicsScene->setWidth(m_graphicsView->viewport()->width());
m_toolbar->setScaleFactor(0); m_toolbar->setScaleFactor(40);
m_toolbar->setCurrentTransition(transition); m_toolbar->setCurrentTransition(transition);
@@ -335,7 +335,7 @@ void TransitionEditorWidget::init()
m_toolbar->setDuration(duration); m_toolbar->setDuration(duration);
m_graphicsScene->setRulerScaling(0); m_graphicsScene->setRulerScaling(40);
} }
void TransitionEditorWidget::updateData(const ModelNode &transition) void TransitionEditorWidget::updateData(const ModelNode &transition)

View File

@@ -34,6 +34,8 @@ namespace QmlDesigner {
class AbstractViewAbstractVieweGroup; class AbstractViewAbstractVieweGroup;
class QmlObjectNode; class QmlObjectNode;
class QmlModelStateGroup; class QmlModelStateGroup;
class Annotation;
class AnnotationEditor;
class QMLDESIGNERCORE_EXPORT QmlModelState : public QmlModelNodeFacade class QMLDESIGNERCORE_EXPORT QmlModelState : public QmlModelNodeFacade
{ {
@@ -72,6 +74,12 @@ public:
void setAsDefault(); void setAsDefault();
bool isDefault() const; bool isDefault() const;
void setAnnotation(const Annotation &annotation, const QString &id);
Annotation annotation() const;
QString annotationName() const;
bool hasAnnotation() const;
void removeAnnotation();
protected: protected:
void addChangeSetIfNotExists(const ModelNode &node); void addChangeSetIfNotExists(const ModelNode &node);
static QmlModelState createBaseState(const AbstractView *view); static QmlModelState createBaseState(const AbstractView *view);

View File

@@ -508,9 +508,13 @@ QString AbstractView::generateNewId(const QString &prefixName) const
{ {
QString fixedPrefix = firstCharToLower(prefixName); QString fixedPrefix = firstCharToLower(prefixName);
fixedPrefix.remove(' '); fixedPrefix.remove(' ');
bool forceSuffix = false;
if (!ModelNode::isValidId(fixedPrefix)) if (!ModelNode::isValidId(fixedPrefix))
return generateNewId("element"); forceSuffix = true;
int counter = 1;
int counter = 0;
/* First try just the prefixName without number as postfix, then continue with 2 and further as postfix /* First try just the prefixName without number as postfix, then continue with 2 and further as postfix
* until id does not already exist. * until id does not already exist.
@@ -520,11 +524,14 @@ QString AbstractView::generateNewId(const QString &prefixName) const
*/ */
QString newId = QString(QStringLiteral("%1")).arg(firstCharToLower(prefixName)); QString newId = QString(QStringLiteral("%1")).arg(firstCharToLower(prefixName));
if (forceSuffix)
QString(QStringLiteral("%1%2")).arg(firstCharToLower(prefixName)).arg(1);
newId.remove(QRegularExpression(QStringLiteral("[^a-zA-Z0-9_]"))); newId.remove(QRegularExpression(QStringLiteral("[^a-zA-Z0-9_]")));
while (!ModelNode::isValidId(newId) || hasId(newId) || rootModelNode().hasProperty(newId.toUtf8()) || newId == "item") { while (!ModelNode::isValidId(newId) || hasId(newId) || rootModelNode().hasProperty(newId.toUtf8()) || newId == "item") {
counter += 1; counter += 1;
newId = QString(QStringLiteral("%1%2")).arg(firstCharToLower(prefixName)).arg(counter - 1); newId = QString(QStringLiteral("%1%2")).arg(firstCharToLower(prefixName)).arg(counter);
newId.remove(QRegularExpression(QStringLiteral("[^a-zA-Z0-9_]"))); newId.remove(QRegularExpression(QStringLiteral("[^a-zA-Z0-9_]")));
} }

View File

@@ -32,6 +32,7 @@
#include "bindingproperty.h" #include "bindingproperty.h"
#include "qmlchangeset.h" #include "qmlchangeset.h"
#include "qmlitemnode.h" #include "qmlitemnode.h"
#include "annotation.h"
#include <utils/qtcassert.h> #include <utils/qtcassert.h>
@@ -304,6 +305,43 @@ bool QmlModelState::isDefault() const
return false; return false;
} }
void QmlModelState::setAnnotation(const Annotation &annotation, const QString &id)
{
if (modelNode().isValid()) {
modelNode().setCustomId(id);
modelNode().setAnnotation(annotation);
}
}
Annotation QmlModelState::annotation() const
{
if (modelNode().isValid())
return modelNode().annotation();
return {};
}
QString QmlModelState::annotationName() const
{
if (modelNode().isValid())
return modelNode().customId();
return {};
}
bool QmlModelState::hasAnnotation() const
{
if (modelNode().isValid())
return modelNode().hasAnnotation() || modelNode().hasCustomId();
return false;
}
void QmlModelState::removeAnnotation()
{
if (modelNode().isValid()) {
modelNode().removeCustomId();
modelNode().removeAnnotation();
}
}
QmlModelState QmlModelState::createBaseState(const AbstractView *view) QmlModelState QmlModelState::createBaseState(const AbstractView *view)
{ {
QmlModelState qmlModelState(view->rootModelNode()); QmlModelState qmlModelState(view->rootModelNode());

View File

@@ -246,9 +246,9 @@ void DesignModeWidget::setup()
const QString undockUnicode = Theme::getIconUnicode(Theme::Icon::adsDetach); const QString undockUnicode = Theme::getIconUnicode(Theme::Icon::adsDetach);
const QString fontName = "qtds_propertyIconFont.ttf"; const QString fontName = "qtds_propertyIconFont.ttf";
const QIcon closeIcon = Utils::StyleHelper::getIconFromIconFont(fontName, closeUnicode, 28, 28, buttonColor);
const QIcon menuIcon = Utils::StyleHelper::getIconFromIconFont(fontName, menuUnicode, 28, 28, buttonColor); const QIcon menuIcon = Utils::StyleHelper::getIconFromIconFont(fontName, menuUnicode, 28, 28, buttonColor);
const QIcon undockIcon = Utils::StyleHelper::getIconFromIconFont(fontName, undockUnicode, 28, 28, buttonColor); const QIcon undockIcon = Utils::StyleHelper::getIconFromIconFont(fontName, undockUnicode, 28, 28, buttonColor);
const QIcon closeIcon = Utils::StyleHelper::getIconFromIconFont(fontName, closeUnicode, 28, 28, buttonColor);
auto closeIconNormal = Utils::StyleHelper::IconFontHelper(closeUnicode, auto closeIconNormal = Utils::StyleHelper::IconFontHelper(closeUnicode,
tabColor, tabColor,

View File

@@ -110,7 +110,7 @@ static void openFileComponent(const ModelNode &modelNode)
{ {
QmlDesignerPlugin::instance()->viewManager().nextFileIsCalledInternally(); QmlDesignerPlugin::instance()->viewManager().nextFileIsCalledInternally();
Core::EditorManager::openEditor(modelNode.metaInfo().componentFileName(), Core::EditorManager::openEditor(modelNode.metaInfo().componentFileName(),
Core::Id(), Core::EditorManager::DoNotMakeVisible); Utils::Id(), Core::EditorManager::DoNotMakeVisible);
} }
static void openFileComponentForDelegate(const ModelNode &modelNode) static void openFileComponentForDelegate(const ModelNode &modelNode)
@@ -136,7 +136,7 @@ static void openComponentSourcePropertyOfLoader(const ModelNode &modelNode)
componentModelNode = modelNode.nodeListProperty("component").toModelNodeList().constFirst(); componentModelNode = modelNode.nodeListProperty("component").toModelNodeList().constFirst();
} }
Core::EditorManager::openEditor(componentModelNode.metaInfo().componentFileName(), Core::Id(), Core::EditorManager::DoNotMakeVisible); Core::EditorManager::openEditor(componentModelNode.metaInfo().componentFileName(), Utils::Id(), Core::EditorManager::DoNotMakeVisible);
} }
static void openSourcePropertyOfLoader(const ModelNode &modelNode) static void openSourcePropertyOfLoader(const ModelNode &modelNode)
@@ -146,7 +146,7 @@ static void openSourcePropertyOfLoader(const ModelNode &modelNode)
QString componentFileName = modelNode.variantProperty("source").value().toString(); QString componentFileName = modelNode.variantProperty("source").value().toString();
QFileInfo fileInfo(modelNode.model()->fileUrl().toLocalFile()); QFileInfo fileInfo(modelNode.model()->fileUrl().toLocalFile());
Core::EditorManager::openEditor(fileInfo.absolutePath() + "/" + componentFileName, Core::Id(), Core::EditorManager::DoNotMakeVisible); Core::EditorManager::openEditor(fileInfo.absolutePath() + "/" + componentFileName, Utils::Id(), Core::EditorManager::DoNotMakeVisible);
} }

View File

@@ -225,7 +225,9 @@ bool WinRtPackageDeploymentStep::init()
return false; return false;
} }
params->setCommandLine(windeployqt); params->setCommandLine(windeployqt);
params->setEnvironment(buildEnvironment()); params->setEnvironment(target()->activeBuildConfiguration()
? target()->activeBuildConfiguration()->environment()
: Environment::systemEnvironment());
return AbstractProcessStep::init(); return AbstractProcessStep::init();
} }

View File

@@ -71,8 +71,11 @@ QStringList ProFileEvaluator::values(const QString &variableName) const
const ProStringList &values = d->values(ProKey(variableName)); const ProStringList &values = d->values(ProKey(variableName));
QStringList ret; QStringList ret;
ret.reserve(values.size()); ret.reserve(values.size());
foreach (const ProString &str, values) for (const ProString &str : values) {
ret << d->m_option->expandEnvVars(str.toQString()); const QString expanded = d->m_option->expandEnvVars(str.toQString());
if (!expanded.isEmpty() || str.isEmpty())
ret << expanded;
}
return ret; return ret;
} }