Merge remote-tracking branch 'origin/8.0'

Conflicts:
	cmake/QtCreatorIDEBranding.cmake
	qbs/modules/qtc/qtc.qbs
	qtcreator_ide_branding.pri
	src/plugins/qmldesigner/designercore/model/texttomodelmerger.cpp

Change-Id: I1ed3dd86fe5b4b87e3015c41652f5d0fa16d7070
This commit is contained in:
Eike Ziller
2022-07-25 09:25:00 +02:00
60 changed files with 2211 additions and 1309 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 25 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.9 KiB

View File

@@ -43,19 +43,12 @@
example, when a component should be created on demand or when a component
should not be created unnecessarily for performance reasons.
Add a \uicontrol Loader3D component to your scene by drag-and-dropping it
from \uicontrol Components > \uicontrol {Qt Quick 3D} >
\uicontrol {Qt Quick 3D} to \uicontrol Scene in \uicontrol Navigator.
For more information, see the \l{https://doc.qt.io/qt/qml-qtquick3d-loader3d.html}
{Loader3D QML type} in the \uicontrol {Qt Quick 3D} documentation.
\section1 Loader3D Properties
Select the \uicontrol Loader3D component in \uicontrol Navigator to specify
its properties in \uicontrol Properties > \uicontrol Loader3D.
\image studio-3d-loader3d-properties.png "Loader3D specific properties"
\section2 Active
The \uicontrol Active property is set to \uicontrol true by default, which
makes the \uicontrol Loader3D currently active. Setting \uicontrol Active to
@@ -67,18 +60,24 @@
not affect the files or components defined as \uicontrol Source or
\uicontrol {Source component}.
Use the dropdown menu of the \uicontrol Source property to define the URL of
\section2 Source
The \uicontrol Source property defines the URL of
the 3D component to instantiate. To unload the currently loaded object, set
this property to an empty string or set the \uicontrol {Source component} to
undefined. Setting \uicontrol Source to a new URL will also cause the item
created by the previous URL to be unloaded.
The \uicontrol {Source component} property defines the component for
\section2 Source Component
The \uicontrol {Source Component} property defines the component for
\uicontrol Loader3D to instantiate. Currently, the
\uicontrol {Source component} needs to be defined in code using the
\l {Working in Edit Mode}{Edit} mode or \l {Text Editor}.
Set the \uicontrol Asynchronous property to define whether the component
\section2 Asynchronous
The \uicontrol Asynchronous property defines whether the component
will be instantiated asynchronously. This property is set to \uicontrol false
by default. When used in conjunction with the source property, loading and
compilation will be performed in a background thread. Loading asynchronously
@@ -90,21 +89,53 @@
\uicontrol Loader3D content must be accessed before the asynchronous
loading is completed.
\section1 Setting the Loader3D to Load a QML File
To add a Loader3D component and set it to load a QML file:
\list 1
\li From \uicontrol {Components}, drag a Loader3D component to
\e scene in \uicontrol Navigator or to \uicontrol {3D Editor}.
\li In \uicontrol {Navigator}, select \e{loader3D}.
\image loader3d-navigator.png
\li In \uicontrol {Properties}, select \uicontrol{Source} and select a
QML file.
\image loader3d-select-source.png
\endlist
\section1 Setting the Loader3D to Load a Component3D Component
To add a Loader3D component and set it to load a Component3D component:
\list 1
\li From \uicontrol {Components}, drag a Loader3D Component to
\e scene in \uicontrol Navigator or to \uicontrol {3D Editor}.
\li From \uicontrol {Components}, drag a Component3D component to
\e scene in \uicontrol {Navigator}.
\li In \uicontrol {Navigator}, select the filter icon and clear
\uicontrol {Show Only Visible Components}. This makes the Component3D
component visible in \uicontrol Navigator.
\image navigator-show-all-loader.png
\li In \uicontrol {Navigator}, select \e{loader3D}.
\li In \uicontrol {Properties}, select \uicontrol{Source Component}
and select \e {component3D}.
\image loader3d-select-source-component.png
\endlist
\section1 Setting the Visibility of Loading Components
To avoid seeing the components loading progressively, set the \uicontrol
Visibility property for \uicontrol Loader3D appropriately in
\uicontrol {Binding Editor}:
\list 1
\li In \uicontrol Properties > \uicontrol Loader3D, select the
\uicontrol Asynchronous check box to set the property to
\uicontrol true.
\li In \uicontrol Node > \l {Setting Node Opacity and Visibility}{Visibility},
\uicontrol Asynchronous check box.
\image loader3d-visibility.png
\li In \uicontrol {Visibility},
select \inlineimage icons/action-icon.png
to open the actions menu, and then select \uicontrol {Set Binding}.
\li Type \c {status === Loader3D.Ready} into \uicontrol {Binding Editor},
as shown in the image below.
\li Type \c {status === Loader3D.Ready} into \uicontrol {Binding Editor}.
\image studio-3d-loader3d-binding-editor.png "Setting Visibility in Binding Editor"
\li Select \uicontrol OK.
\endlist
\image studio-3d-loader3d-binding-editor.png "Setting Visibility in Binding Editor"
*/

View File

@@ -34,12 +34,10 @@ Item {
height: StudioTheme.Values.colorEditorPopupLineHeight
property color currentColor
property alias model: repeater.model
property GradientModel model
property GradientModel gradientModel: root.model
property bool hasGradient: gradientModel.hasGradient
property alias gradientPropertyName: gradientModel.gradientPropertyName
property alias gradientTypeName: gradientModel.gradientTypeName
property bool hasGradient: root.model.hasGradient
signal selectedNodeChanged
signal invalidated
@@ -49,38 +47,38 @@ Item {
}
onCurrentColorChanged: {
gradientModel.setColor(colorLine.selectedIndex, root.currentColor)
root.gradientModel.setColor(colorLine.selectedIndex, root.currentColor)
colorLine.invalidate()
}
function addGradient() {
gradientModel.addGradient()
root.gradientModel.addGradient()
colorLine.invalidate()
colorLine.select(0)
}
function deleteGradient() {
gradientModel.deleteGradient()
root.gradientModel.deleteGradient()
}
function setPresetByID(presetID) {
gradientModel.setPresetByID(presetID)
root.gradientModel.setPresetByID(presetID)
colorLine.invalidate()
colorLine.select(0)
}
function setPresetByStops(stopsPositions, stopsColors, stopsCount) {
gradientModel.setPresetByStops(stopsPositions, stopsColors, stopsCount)
root.gradientModel.setPresetByStops(stopsPositions, stopsColors, stopsCount)
colorLine.invalidate()
colorLine.select(0)
}
function savePreset() {
gradientModel.savePreset()
root.gradientModel.savePreset()
}
function updateGradient() {
gradientModel.updateGradient()
root.gradientModel.updateGradient()
}
Connections {
@@ -109,9 +107,9 @@ Item {
repeater.itemAt(index).item.highlighted = true
colorLine.selectedIndex = index
gradientModel.lock()
root.gradientModel.lock()
root.currentColor = repeater.itemAt(index).item.color
gradientModel.unlock()
root.gradientModel.unlock()
root.selectedNodeChanged()
}
@@ -119,19 +117,19 @@ Item {
function invalidate() {
var gradientString = "import QtQuick 2.15; Gradient { orientation: Gradient.Horizontal;"
for (var i = 0; i < gradientModel.count; i++) {
for (var i = 0; i < root.gradientModel.count; i++) {
gradientString += "GradientStop {}"
}
gradientString += "}"
var gradientObject = Qt.createQmlObject(gradientString, gradientRectangle, "test")
for (i = 0; i < gradientModel.count; i++) {
for (i = 0; i < root.gradientModel.count; i++) {
if (repeater.itemAt(i) !== null)
repeater.itemAt(i).item.y = 20 // fixes corner case for dragging overlapped items
gradientObject.stops[i].color = gradientModel.getColor(i)
gradientObject.stops[i].position = gradientModel.getPosition(i)
gradientObject.stops[i].color = root.gradientModel.getColor(i)
gradientObject.stops[i].position = root.gradientModel.getPosition(i)
}
gradientRectangle.gradient = gradientObject
@@ -150,7 +148,7 @@ Item {
onClicked: {
var currentPosition = mouseX / colorLine.effectiveWidth
var newIndex = gradientModel.addStop(currentPosition, root.currentColor)
var newIndex = root.gradientModel.addStop(currentPosition, root.currentColor)
if (newIndex > 0)
colorLine.select(newIndex)
@@ -165,11 +163,7 @@ Item {
Repeater {
id: repeater
model: GradientModel {
id: gradientModel
anchorBackendProperty: anchorBackend
gradientPropertyName: "gradient"
}
model: root.gradientModel
delegate: Loader {
id: loader
@@ -364,14 +358,14 @@ Item {
onReleased: {
if (drag.active) {
gradientModel.setPosition(colorLine.selectedIndex,
root.gradientModel.setPosition(colorLine.selectedIndex,
gradientStopHandle.currentGradiantStopPosition())
gradientStopHandle.refreshToolTip(false)
if (parent.y < 10) {
if (!gradientStopHandle.readOnly) {
colorLine.select(index - 1)
gradientModel.removeStop(index)
root.gradientModel.removeStop(index)
}
}
parent.y = 20

View File

@@ -1,23 +1,50 @@
/******************************************************************************
/****************************************************************************
**
** Copyright (C) 2021 The Qt Company Ltd.
** Copyright (C) 2022 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt Quick Ultralite module.
**
** $QT_BEGIN_LICENSE:COMM$
** This file is part of the examples of the Qt Design Studio.
**
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
** and conditions see http://www.qt.io/terms-conditions. For further
** information use the contact form at http://www.qt.io/contact-us.
** and conditions see https://www.qt.io/terms-conditions. For further
** information use the contact form at https://www.qt.io/contact-us.
**
** $QT_END_LICENSE$
** BSD License Usage
** Alternatively, you may use this file under the terms of the BSD license
** as follows:
**
******************************************************************************/
** "Redistribution and use in source and binary forms, with or without
** modification, are permitted provided that the following conditions are
** met:
** * Redistributions of source code must retain the above copyright
** notice, this list of conditions and the following disclaimer.
** * Redistributions in binary form must reproduce the above copyright
** notice, this list of conditions and the following disclaimer in
** the documentation and/or other materials provided with the
** distribution.
** * Neither the name of The Qt Company Ltd nor the names of its
** contributors may be used to endorse or promote products derived
** from this software without specific prior written permission.
**
**
** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
**
**
****************************************************************************/
import QtQuick 2.15
import QtQuick.Templates 2.15 as T

View File

@@ -1,23 +1,50 @@
/******************************************************************************
/****************************************************************************
**
** Copyright (C) 2021 The Qt Company Ltd.
** Copyright (C) 2022 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt Quick Ultralite module.
**
** $QT_BEGIN_LICENSE:COMM$
** This file is part of the examples of the Qt Design Studio.
**
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
** and conditions see http://www.qt.io/terms-conditions. For further
** information use the contact form at http://www.qt.io/contact-us.
** and conditions see https://www.qt.io/terms-conditions. For further
** information use the contact form at https://www.qt.io/contact-us.
**
** $QT_END_LICENSE$
** BSD License Usage
** Alternatively, you may use this file under the terms of the BSD license
** as follows:
**
******************************************************************************/
** "Redistribution and use in source and binary forms, with or without
** modification, are permitted provided that the following conditions are
** met:
** * Redistributions of source code must retain the above copyright
** notice, this list of conditions and the following disclaimer.
** * Redistributions in binary form must reproduce the above copyright
** notice, this list of conditions and the following disclaimer in
** the documentation and/or other materials provided with the
** distribution.
** * Neither the name of The Qt Company Ltd nor the names of its
** contributors may be used to endorse or promote products derived
** from this software without specific prior written permission.
**
**
** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
**
**
****************************************************************************/
import QtQuick 2.15
import QtQuick.Templates 2.15 as T

View File

@@ -1,23 +1,51 @@
/******************************************************************************
/****************************************************************************
**
** Copyright (C) 2021 The Qt Company Ltd.
** Copyright (C) 2022 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt Quick Ultralite module.
**
** $QT_BEGIN_LICENSE:COMM$
** This file is part of the examples of the Qt Design Studio.
**
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
** and conditions see http://www.qt.io/terms-conditions. For further
** information use the contact form at http://www.qt.io/contact-us.
** and conditions see https://www.qt.io/terms-conditions. For further
** information use the contact form at https://www.qt.io/contact-us.
**
** $QT_END_LICENSE$
** BSD License Usage
** Alternatively, you may use this file under the terms of the BSD license
** as follows:
**
******************************************************************************/
** "Redistribution and use in source and binary forms, with or without
** modification, are permitted provided that the following conditions are
** met:
** * Redistributions of source code must retain the above copyright
** notice, this list of conditions and the following disclaimer.
** * Redistributions in binary form must reproduce the above copyright
** notice, this list of conditions and the following disclaimer in
** the documentation and/or other materials provided with the
** distribution.
** * Neither the name of The Qt Company Ltd nor the names of its
** contributors may be used to endorse or promote products derived
** from this software without specific prior written permission.
**
**
** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
**
**
****************************************************************************/
pragma Singleton
import QtQuick 2.15

View File

@@ -1,23 +1,50 @@
/******************************************************************************
/****************************************************************************
**
** Copyright (C) 2021 The Qt Company Ltd.
** Copyright (C) 2022 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt Quick Ultralight module.
**
** $QT_BEGIN_LICENSE:COMM$
** This file is part of the examples of the Qt Design Studio.
**
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
** and conditions see http://www.qt.io/terms-conditions. For further
** information use the contact form at http://www.qt.io/contact-us.
** and conditions see https://www.qt.io/terms-conditions. For further
** information use the contact form at https://www.qt.io/contact-us.
**
** $QT_END_LICENSE$
** BSD License Usage
** Alternatively, you may use this file under the terms of the BSD license
** as follows:
**
******************************************************************************/
** "Redistribution and use in source and binary forms, with or without
** modification, are permitted provided that the following conditions are
** met:
** * Redistributions of source code must retain the above copyright
** notice, this list of conditions and the following disclaimer.
** * Redistributions in binary form must reproduce the above copyright
** notice, this list of conditions and the following disclaimer in
** the documentation and/or other materials provided with the
** distribution.
** * Neither the name of The Qt Company Ltd nor the names of its
** contributors may be used to endorse or promote products derived
** from this software without specific prior written permission.
**
**
** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
**
**
****************************************************************************/
import QtQuick 2.15
import QtQuick.Templates 2.15 as T

View File

@@ -1,23 +1,50 @@
/******************************************************************************
/****************************************************************************
**
** Copyright (C) 2021 The Qt Company Ltd.
** Copyright (C) 2022 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt Quick Ultralight module.
**
** $QT_BEGIN_LICENSE:COMM$
** This file is part of the examples of the Qt Design Studio.
**
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
** and conditions see http://www.qt.io/terms-conditions. For further
** information use the contact form at http://www.qt.io/contact-us.
** and conditions see https://www.qt.io/terms-conditions. For further
** information use the contact form at https://www.qt.io/contact-us.
**
** $QT_END_LICENSE$
** BSD License Usage
** Alternatively, you may use this file under the terms of the BSD license
** as follows:
**
******************************************************************************/
** "Redistribution and use in source and binary forms, with or without
** modification, are permitted provided that the following conditions are
** met:
** * Redistributions of source code must retain the above copyright
** notice, this list of conditions and the following disclaimer.
** * Redistributions in binary form must reproduce the above copyright
** notice, this list of conditions and the following disclaimer in
** the documentation and/or other materials provided with the
** distribution.
** * Neither the name of The Qt Company Ltd nor the names of its
** contributors may be used to endorse or promote products derived
** from this software without specific prior written permission.
**
**
** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
**
**
****************************************************************************/
import QtQuick 2.15
import QtQuick.Templates 2.15 as T

View File

@@ -1,23 +1,50 @@
/******************************************************************************
/****************************************************************************
**
** Copyright (C) 2021 The Qt Company Ltd.
** Copyright (C) 2022 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt Quick Ultralite module.
**
** $QT_BEGIN_LICENSE:COMM$
** This file is part of the examples of the Qt Design Studio.
**
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
** and conditions see http://www.qt.io/terms-conditions. For further
** information use the contact form at http://www.qt.io/contact-us.
** and conditions see https://www.qt.io/terms-conditions. For further
** information use the contact form at https://www.qt.io/contact-us.
**
** $QT_END_LICENSE$
** BSD License Usage
** Alternatively, you may use this file under the terms of the BSD license
** as follows:
**
******************************************************************************/
** "Redistribution and use in source and binary forms, with or without
** modification, are permitted provided that the following conditions are
** met:
** * Redistributions of source code must retain the above copyright
** notice, this list of conditions and the following disclaimer.
** * Redistributions in binary form must reproduce the above copyright
** notice, this list of conditions and the following disclaimer in
** the documentation and/or other materials provided with the
** distribution.
** * Neither the name of The Qt Company Ltd nor the names of its
** contributors may be used to endorse or promote products derived
** from this software without specific prior written permission.
**
**
** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
**
**
****************************************************************************/
import QtQuick 2.15
import QtQuick.Templates 2.15 as T

View File

@@ -1,23 +1,50 @@
/******************************************************************************
/****************************************************************************
**
** Copyright (C) 2021 The Qt Company Ltd.
** Copyright (C) 2022 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt Quick Ultralite module.
**
** $QT_BEGIN_LICENSE:COMM$
** This file is part of the examples of the Qt Design Studio.
**
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
** and conditions see http://www.qt.io/terms-conditions. For further
** information use the contact form at http://www.qt.io/contact-us.
** and conditions see https://www.qt.io/terms-conditions. For further
** information use the contact form at https://www.qt.io/contact-us.
**
** $QT_END_LICENSE$
** BSD License Usage
** Alternatively, you may use this file under the terms of the BSD license
** as follows:
**
******************************************************************************/
** "Redistribution and use in source and binary forms, with or without
** modification, are permitted provided that the following conditions are
** met:
** * Redistributions of source code must retain the above copyright
** notice, this list of conditions and the following disclaimer.
** * Redistributions in binary form must reproduce the above copyright
** notice, this list of conditions and the following disclaimer in
** the documentation and/or other materials provided with the
** distribution.
** * Neither the name of The Qt Company Ltd nor the names of its
** contributors may be used to endorse or promote products derived
** from this software without specific prior written permission.
**
**
** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
**
**
****************************************************************************/
import QtQuick 2.15
import QtQuick.Templates 2.15 as T

View File

@@ -1,23 +1,50 @@
/******************************************************************************
/****************************************************************************
**
** Copyright (C) 2021 The Qt Company Ltd.
** Copyright (C) 2022 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt Quick Ultralight module.
**
** $QT_BEGIN_LICENSE:COMM$
** This file is part of the examples of the Qt Design Studio.
**
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
** and conditions see http://www.qt.io/terms-conditions. For further
** information use the contact form at http://www.qt.io/contact-us.
** and conditions see https://www.qt.io/terms-conditions. For further
** information use the contact form at https://www.qt.io/contact-us.
**
** $QT_END_LICENSE$
** BSD License Usage
** Alternatively, you may use this file under the terms of the BSD license
** as follows:
**
******************************************************************************/
** "Redistribution and use in source and binary forms, with or without
** modification, are permitted provided that the following conditions are
** met:
** * Redistributions of source code must retain the above copyright
** notice, this list of conditions and the following disclaimer.
** * Redistributions in binary form must reproduce the above copyright
** notice, this list of conditions and the following disclaimer in
** the documentation and/or other materials provided with the
** distribution.
** * Neither the name of The Qt Company Ltd nor the names of its
** contributors may be used to endorse or promote products derived
** from this software without specific prior written permission.
**
**
** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
**
**
****************************************************************************/
import QtQuick 2.15
import QtQuick.Templates 2.15 as T

View File

@@ -1,23 +1,50 @@
/******************************************************************************
/****************************************************************************
**
** Copyright (C) 2021 The Qt Company Ltd.
** Copyright (C) 2022 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt Quick Ultralite module.
**
** $QT_BEGIN_LICENSE:COMM$
** This file is part of the examples of the Qt Design Studio.
**
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
** and conditions see http://www.qt.io/terms-conditions. For further
** information use the contact form at http://www.qt.io/contact-us.
** and conditions see https://www.qt.io/terms-conditions. For further
** information use the contact form at https://www.qt.io/contact-us.
**
** $QT_END_LICENSE$
** BSD License Usage
** Alternatively, you may use this file under the terms of the BSD license
** as follows:
**
******************************************************************************/
** "Redistribution and use in source and binary forms, with or without
** modification, are permitted provided that the following conditions are
** met:
** * Redistributions of source code must retain the above copyright
** notice, this list of conditions and the following disclaimer.
** * Redistributions in binary form must reproduce the above copyright
** notice, this list of conditions and the following disclaimer in
** the documentation and/or other materials provided with the
** distribution.
** * Neither the name of The Qt Company Ltd nor the names of its
** contributors may be used to endorse or promote products derived
** from this software without specific prior written permission.
**
**
** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
**
**
****************************************************************************/
import QtQuick 2.15
import QtQuick.Templates 2.15 as T

View File

@@ -1,6 +1,6 @@
/****************************************************************************
**
** Copyright (C) 2021 The Qt Company Ltd.
** Copyright (C) 2022 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of Qt Creator.

View File

@@ -10,14 +10,62 @@ import QtQuick.Controls %{QtQuickVersion}
import %{ImportModuleName} %{ImportModuleVersion}
Rectangle {
id: rectangle
width: Constants.width
height: Constants.height
color: Constants.backgroundColor
Text {
text: qsTr("Hello %{ProjectName}")
anchors.centerIn: parent
font.family: Constants.font.family
Button {
id: button
text: qsTr("Press me")
anchors.verticalCenter: parent.verticalCenter
checkable: true
anchors.horizontalCenter: parent.horizontalCenter
Connections {
target: button
onClicked: animation.start()
}
}
Text {
id: label
text: qsTr("Hello %{ProjectName}")
anchors.top: button.bottom
font.family: Constants.font.family
anchors.topMargin: 45
anchors.horizontalCenter: parent.horizontalCenter
SequentialAnimation {
id: animation
ColorAnimation {
id: colorAnimation1
target: rectangle
property: "color"
to: "#2294c6"
from: Constants.backgroundColor
}
ColorAnimation {
id: colorAnimation2
target: rectangle
property: "color"
to: Constants.backgroundColor
from: "#2294c6"
}
}
}
states: [
State {
name: "clicked"
when: button.checked
PropertyChanges {
target: label
text: qsTr("Button Checked")
}
}
]
}

View File

@@ -129,12 +129,12 @@ QdbDevice::QdbDevice()
{
setDisplayType(tr("Boot2Qt Device"));
addDeviceAction({tr("Reboot Device"), [this](const IDevice::Ptr &device, QWidget *) {
(void) new DeviceApplicationObserver(device, {filePath("reboot"), {}});
addDeviceAction({tr("Reboot Device"), [](const IDevice::Ptr &device, QWidget *) {
(void) new DeviceApplicationObserver(device, {device->filePath("reboot"), {}});
}});
addDeviceAction({tr("Restore Default App"), [this](const IDevice::Ptr &device, QWidget *) {
(void) new DeviceApplicationObserver(device, {filePath("appcontroller"), {"--remove-default"}});
addDeviceAction({tr("Restore Default App"), [](const IDevice::Ptr &device, QWidget *) {
(void) new DeviceApplicationObserver(device, {device->filePath("appcontroller"), {"--remove-default"}});
}});
}

View File

@@ -27,7 +27,7 @@ SOURCES = \
privateFuncDefCompletion.cpp \
signalCompletion.cpp
QMAKE_CXXFLAGS += -ffoo
QMAKE_CXXFLAGS += -broken
HEADERS = mainwindow.h
FORMS = mainwindow.ui

View File

@@ -2,4 +2,4 @@ TEMPLATE = app
QT = core
HEADERS = defs.h
SOURCES = main.cpp
QMAKE_CXXFLAGS += -ffoo
QMAKE_CXXFLAGS += -broken

View File

@@ -2,4 +2,4 @@ TEMPLATE = app
CONFIG -= qt
HEADERS = cursor.h header.h
SOURCES = cursor.cpp main.cpp
QMAKE_CXXFLAGS += -ffoo
QMAKE_CXXFLAGS += -broken

View File

@@ -1,4 +1,4 @@
TEMPLATE = app
CONFIG -= qt
SOURCES = highlighting.cpp
QMAKE_CXXFLAGS += -ffoo
QMAKE_CXXFLAGS += -broken

View File

@@ -1,4 +1,4 @@
TEMPLATE = app
CONFIG -= qt
SOURCES = references.cpp
QMAKE_CXXFLAGS += -ffoo
QMAKE_CXXFLAGS += -broken

View File

@@ -449,18 +449,14 @@ static QStringList filteredFlags(const QStringList &allFlags, bool considerSysro
|| a == "-gcc-toolchain" || a == "-target" || a == "-mllvm" || a == "-isystem") {
if (++i < allFlags.length())
filtered << a << allFlags.at(i);
} else if (a.startsWith("-m") || a == "-Os" || a == "-O0" || a == "-O1" || a == "-O2"
|| a == "-O3" || a == "-ffinite-math-only" || a == "-fshort-double"
|| a == "-fshort-wchar" || a == "-fsignaling-nans" || a == "-fno-inline"
|| a == "-fno-exceptions" || a == "-fstack-protector"
|| a == "-fstack-protector-all" || a == "-fsanitize=address"
|| a == "-fno-rtti" || a.startsWith("-std=") || a.startsWith("-stdlib=")
} else if (a.startsWith("-m") || a.startsWith("-f") || a.startsWith("-O")
|| a.startsWith("-std=") || a.startsWith("-stdlib=")
|| a.startsWith("-specs=") || a == "-ansi" || a == "-undef"
|| a.startsWith("-D") || a.startsWith("-U") || a == "-fopenmp"
|| a == "-Wno-deprecated" || a == "-fPIC" || a == "-fpic" || a == "-fPIE"
|| a == "-fpie" || a.startsWith("-stdlib=") || a.startsWith("-B")
|| a.startsWith("-D") || a.startsWith("-U")
|| a.startsWith("-stdlib=") || a.startsWith("-B")
|| a.startsWith("--target=")
|| (a.startsWith("-isystem") && a.length() > 8)
|| a == "-Wno-deprecated"
|| a == "-nostdinc" || a == "-nostdinc++") {
filtered << a;
}

View File

@@ -1392,20 +1392,18 @@ void SimpleTargetRunnerPrivate::start()
{
const bool isLocal = !m_command.executable().needsDevice();
CommandLine cmdLine = m_command;
Environment env = m_environment;
m_resultData = {};
QTC_ASSERT(m_state == Inactive, return);
if (isLocal) {
Environment env = m_environment;
if (m_runAsRoot)
RunControl::provideAskPassEntry(env);
m_process.setEnvironment(env);
WinDebugInterface::startIfNeeded();
CommandLine cmdLine = m_command;
if (HostOsInfo::isMacHost()) {
CommandLine disclaim(Core::ICore::libexecPath("disclaim"));
disclaim.addCommandLineAsArgs(cmdLine);
@@ -1413,7 +1411,6 @@ void SimpleTargetRunnerPrivate::start()
}
m_process.setRunAsRoot(m_runAsRoot);
m_process.setCommand(cmdLine);
}
const IDevice::ConstPtr device = DeviceManager::deviceForPath(m_command.executable());
@@ -1427,8 +1424,8 @@ void SimpleTargetRunnerPrivate::start()
m_stopRequested = false;
m_process.setCommand(m_command);
m_process.setEnvironment(m_environment);
m_process.setCommand(cmdLine);
m_process.setEnvironment(env);
m_process.setExtraData(m_extraData);
m_state = Run;

View File

@@ -155,8 +155,14 @@ void AddPropertyVisitor::addInMembers(QmlJS::AST::UiObjectInitializer *initializ
Q_ASSERT(!"unknown property type");
}
if (!m_dynamicTypeName.isEmpty())
newPropertyTemplate.prepend(QStringLiteral("property %1 ").arg(QString::fromUtf8(m_dynamicTypeName)));
if (!m_dynamicTypeName.isEmpty()) {
if (m_dynamicTypeName == "signal") {
newPropertyTemplate = "signal %1%2";
} else {
newPropertyTemplate.prepend(
QStringLiteral("property %1 ").arg(QString::fromUtf8(m_dynamicTypeName)));
}
}
if (isOneLiner) {
if (needsPreceedingSemicolon)

View File

@@ -137,7 +137,14 @@ void ChangePropertyVisitor::replaceMemberValue(UiObjectMember *propertyMember, b
startOffset = arrayBinding->lbracketToken.offset;
endOffset = arrayBinding->rbracketToken.end();
} else if (auto publicMember = AST::cast<UiPublicMember*>(propertyMember)) {
if (publicMember->statement) {
if (publicMember->type == AST::UiPublicMember::Signal) {
startOffset = publicMember->firstSourceLocation().offset;
if (publicMember->semicolonToken.isValid())
endOffset = publicMember->semicolonToken.end();
else
endOffset = publicMember->lastSourceLocation().end();
replacement.prepend(QStringLiteral("signal %1 ").arg(publicMember->name));
} else if (publicMember->statement) {
startOffset = publicMember->statement->firstSourceLocation().offset;
if (publicMember->semicolonToken.isValid())
endOffset = publicMember->semicolonToken.end();

View File

@@ -1,6 +1,6 @@
/****************************************************************************
**
** Copyright (C) 2020 The Qt Company Ltd.
** Copyright (C) 2022 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of Qt Creator.
@@ -13,6 +13,14 @@
** and conditions see https://www.qt.io/terms-conditions. For further
** information use the contact form at https://www.qt.io/contact-us.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
** General Public License version 3 as published by the Free Software
** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
** included in the packaging of this file. Please review the following
** information to ensure the GNU General Public License requirements will
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
**
****************************************************************************/
#include "imagecacheconnectionmanager.h"

View File

@@ -1,6 +1,6 @@
/****************************************************************************
**
** Copyright (C) 2020 The Qt Company Ltd.
** Copyright (C) 2022 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of Qt Creator.
@@ -13,6 +13,14 @@
** and conditions see https://www.qt.io/terms-conditions. For further
** information use the contact form at https://www.qt.io/contact-us.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
** General Public License version 3 as published by the Free Software
** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
** included in the packaging of this file. Please review the following
** information to ensure the GNU General Public License requirements will
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
**
****************************************************************************/
#pragma once

View File

@@ -51,6 +51,7 @@ class QMLDESIGNERCORE_EXPORT NodeAbstractProperty;
class QMLDESIGNERCORE_EXPORT BindingProperty;
class QMLDESIGNERCORE_EXPORT NodeProperty;
class QMLDESIGNERCORE_EXPORT SignalHandlerProperty;
class QMLDESIGNERCORE_EXPORT SignalDeclarationProperty;
class QmlObjectNode;
@@ -88,6 +89,7 @@ public:
BindingProperty toBindingProperty() const;
NodeProperty toNodeProperty() const;
SignalHandlerProperty toSignalHandlerProperty() const;
SignalDeclarationProperty toSignalDeclarationProperty() const;
bool isVariantProperty() const;
bool isNodeListProperty() const;
@@ -95,6 +97,7 @@ public:
bool isBindingProperty() const;
bool isNodeProperty() const;
bool isSignalHandlerProperty() const;
bool isSignalDeclarationProperty() const;
bool isDynamic() const;
TypeName dynamicTypeName() const;

View File

@@ -185,6 +185,7 @@ public:
virtual void bindingPropertiesAboutToBeChanged(const QList<BindingProperty> &propertyList);
virtual void bindingPropertiesChanged(const QList<BindingProperty>& propertyList, PropertyChangeFlags propertyChange);
virtual void signalHandlerPropertiesChanged(const QVector<SignalHandlerProperty>& propertyList, PropertyChangeFlags propertyChange);
virtual void signalDeclarationPropertiesChanged(const QVector<SignalDeclarationProperty>& propertyList, PropertyChangeFlags propertyChange);
virtual void rootNodeTypeChanged(const QString &type, int majorVersion, int minorVersion);
virtual void nodeTypeChanged(const ModelNode& node, const TypeName &type, int majorVersion, int minorVersion);

View File

@@ -51,6 +51,7 @@ class AbstractProperty;
class BindingProperty;
class VariantProperty;
class SignalHandlerProperty;
class SignalDeclarationProperty;
class Model;
class AbstractView;
class NodeListProperty;
@@ -128,6 +129,7 @@ public:
VariantProperty variantProperty(const PropertyName &name) const;
BindingProperty bindingProperty(const PropertyName &name) const;
SignalHandlerProperty signalHandlerProperty(const PropertyName &name) const;
SignalDeclarationProperty signalDeclarationProperty(const PropertyName &name) const;
NodeListProperty nodeListProperty(const PropertyName &name) const;
NodeProperty nodeProperty(const PropertyName &name) const;
NodeAbstractProperty nodeAbstractProperty(const PropertyName &name) const;

View File

@@ -87,6 +87,7 @@ public:
void variantPropertiesChanged(const QList<VariantProperty>& propertyList, PropertyChangeFlags propertyChange) override;
void bindingPropertiesChanged(const QList<BindingProperty>& propertyList, PropertyChangeFlags propertyChange) override;
void signalHandlerPropertiesChanged(const QVector<SignalHandlerProperty>& propertyList,PropertyChangeFlags propertyChange) override;
void signalDeclarationPropertiesChanged(const QVector<SignalDeclarationProperty>& propertyList, PropertyChangeFlags propertyChange) override;
void nodeReparented(const ModelNode &node, const NodeAbstractProperty &newPropertyParent,
const NodeAbstractProperty &oldPropertyParent,
AbstractView::PropertyChangeFlags propertyChange) override;

View File

@@ -30,7 +30,7 @@
namespace QmlDesigner {
class QMLDESIGNERCORE_EXPORT SignalHandlerProperty : public QmlDesigner::AbstractProperty
class QMLDESIGNERCORE_EXPORT SignalHandlerProperty : public AbstractProperty
{
friend ModelNode;
friend Internal::ModelPrivate;
@@ -50,4 +50,21 @@ protected:
SignalHandlerProperty(const PropertyName &propertyName, const Internal::InternalNodePointer &internalNode, Model* model, AbstractView *view);
};
class QMLDESIGNERCORE_EXPORT SignalDeclarationProperty : public AbstractProperty
{
friend ModelNode;
friend Internal::ModelPrivate;
friend AbstractProperty;
public:
void setSignature(const QString &source);
QString signature() const;
SignalDeclarationProperty();
SignalDeclarationProperty(const SignalDeclarationProperty &property, AbstractView *view);
protected:
SignalDeclarationProperty(const PropertyName &propertyName, const Internal::InternalNodePointer &internalNode, Model* model, AbstractView *view);
};
} // namespace QmlDesigner

View File

@@ -203,6 +203,19 @@ SignalHandlerProperty AbstractProperty::toSignalHandlerProperty() const
return SignalHandlerProperty();
}
SignalDeclarationProperty AbstractProperty::toSignalDeclarationProperty() const
{
if (!isValid())
throw InvalidPropertyException(__LINE__, __FUNCTION__, __FILE__, m_propertyName);
SignalDeclarationProperty propertyNode(name(), internalNode(), model(), view());
if (propertyNode.isSignalDeclarationProperty())
return propertyNode;
return SignalDeclarationProperty();
}
NodeListProperty AbstractProperty::toNodeListProperty() const
{
if (!isValid())
@@ -307,6 +320,18 @@ bool AbstractProperty::isSignalHandlerProperty() const
return false;
}
bool AbstractProperty::isSignalDeclarationProperty() const
{
if (!isValid())
throw InvalidPropertyException(__LINE__, __FUNCTION__, __FILE__, m_propertyName);
if (internalNode()->hasProperty(name())) {
Q_ASSERT(internalNode()->property(name()));
return internalNode()->property(name())->isSignalDeclarationProperty();
}
return false;
}
bool AbstractProperty::isBindingProperty() const
{

View File

@@ -351,6 +351,10 @@ void AbstractView::signalHandlerPropertiesChanged(const QVector<SignalHandlerPro
{
}
void AbstractView::signalDeclarationPropertiesChanged(const QVector<SignalDeclarationProperty>& /*propertyList*/, PropertyChangeFlags /*propertyChange*/)
{
}
void AbstractView::rootNodeTypeChanged(const QString &/*type*/, int /*majorVersion*/, int /*minorVersion*/)
{
}

View File

@@ -215,6 +215,15 @@ InternalSignalHandlerProperty::Pointer InternalNode::signalHandlerProperty(const
return InternalSignalHandlerProperty::Pointer();
}
InternalSignalDeclarationProperty::Pointer InternalNode::signalDeclarationProperty(const PropertyName &name) const
{
InternalProperty::Pointer property = m_namePropertyHash.value(name);
if (property->isSignalDeclarationProperty())
return property.staticCast<InternalSignalDeclarationProperty>();
return InternalSignalDeclarationProperty::Pointer();
}
InternalVariantProperty::Pointer InternalNode::variantProperty(const PropertyName &name) const
{
InternalProperty::Pointer property = m_namePropertyHash.value(name);
@@ -236,6 +245,12 @@ void InternalNode::addSignalHandlerProperty(const PropertyName &name)
m_namePropertyHash.insert(name, newProperty);
}
void InternalNode::addSignalDeclarationProperty(const PropertyName &name)
{
InternalProperty::Pointer newProperty(InternalSignalDeclarationProperty::create(name, internalPointer()));
m_namePropertyHash.insert(name, newProperty);
}
InternalNodeListProperty::Pointer InternalNode::nodeListProperty(const PropertyName &name) const
{
InternalProperty::Pointer property = m_namePropertyHash.value(name);

View File

@@ -90,6 +90,7 @@ public:
InternalProperty::Pointer property(const PropertyName &name) const;
InternalBindingProperty::Pointer bindingProperty(const PropertyName &name) const;
InternalSignalHandlerProperty::Pointer signalHandlerProperty(const PropertyName &name) const;
InternalSignalDeclarationProperty::Pointer signalDeclarationProperty(const PropertyName &name) const;
InternalVariantProperty::Pointer variantProperty(const PropertyName &name) const;
InternalNodeListProperty::Pointer nodeListProperty(const PropertyName &name) const;
InternalNodeAbstractProperty::Pointer nodeAbstractProperty(const PropertyName &name) const;
@@ -97,11 +98,11 @@ public:
void addBindingProperty(const PropertyName &name);
void addSignalHandlerProperty(const PropertyName &name);
void addSignalDeclarationProperty(const PropertyName &name);
void addNodeListProperty(const PropertyName &name);
void addVariantProperty(const PropertyName &name);
void addNodeProperty(const PropertyName &name, const TypeName &dynamicTypeName);
PropertyNameList propertyNameList() const;
bool hasProperties() const;

View File

@@ -107,6 +107,11 @@ bool InternalProperty::isSignalHandlerProperty() const
return false;
}
bool InternalProperty::isSignalDeclarationProperty() const
{
return false;
}
QSharedPointer<InternalVariantProperty> InternalProperty::toVariantProperty() const
{
@@ -143,6 +148,12 @@ QSharedPointer<InternalSignalHandlerProperty> InternalProperty::toSignalHandlerP
return internalPointer().staticCast<InternalSignalHandlerProperty>();
}
QSharedPointer<InternalSignalDeclarationProperty> InternalProperty::toSignalDeclarationProperty() const
{
Q_ASSERT(internalPointer().dynamicCast<InternalSignalDeclarationProperty>());
return internalPointer().staticCast<InternalSignalDeclarationProperty>();
}
void InternalProperty::remove()
{
propertyOwner()->removeProperty(name());

View File

@@ -36,6 +36,7 @@ namespace Internal {
class InternalBindingProperty;
class InternalSignalHandlerProperty;
class InternalSignalDeclarationProperty;
class InternalVariantProperty;
class InternalNodeListProperty;
class InternalNodeProperty;
@@ -62,6 +63,7 @@ public:
virtual bool isNodeProperty() const;
virtual bool isNodeAbstractProperty() const;
virtual bool isSignalHandlerProperty() const;
virtual bool isSignalDeclarationProperty() const;
QSharedPointer<InternalBindingProperty> toBindingProperty() const;
QSharedPointer<InternalVariantProperty> toVariantProperty() const;
@@ -69,6 +71,7 @@ public:
QSharedPointer<InternalNodeProperty> toNodeProperty() const;
QSharedPointer<InternalNodeAbstractProperty> toNodeAbstractProperty() const;
QSharedPointer<InternalSignalHandlerProperty> toSignalHandlerProperty() const;
QSharedPointer<InternalSignalDeclarationProperty> toSignalDeclarationProperty() const;
InternalNodePointer propertyOwner() const;

View File

@@ -63,5 +63,42 @@ bool InternalSignalHandlerProperty::isSignalHandlerProperty() const
return true;
}
InternalSignalDeclarationProperty::Pointer InternalSignalDeclarationProperty::create(const PropertyName &name, const InternalNodePointer &propertyOwner)
{
auto newPointer(new InternalSignalDeclarationProperty(name, propertyOwner));
InternalSignalDeclarationProperty::Pointer smartPointer(newPointer);
newPointer->setInternalWeakPointer(smartPointer);
newPointer->setDynamicTypeName("signal");
return smartPointer;
}
bool InternalSignalDeclarationProperty::isValid() const
{
return InternalProperty::isValid() && isSignalDeclarationProperty();
}
QString InternalSignalDeclarationProperty::signature() const
{
return m_signature;
}
void InternalSignalDeclarationProperty::setSignature(const QString &signature)
{
m_signature = signature;
}
bool InternalSignalDeclarationProperty::isSignalDeclarationProperty() const
{
return true;
}
InternalSignalDeclarationProperty::InternalSignalDeclarationProperty(const PropertyName &name, const InternalNodePointer &propertyOwner)
: InternalProperty(name, propertyOwner)
{
}
} // namespace Internal
} // namespace QmlDesigner

View File

@@ -51,5 +51,26 @@ private:
QString m_source;
};
class InternalSignalDeclarationProperty : public InternalProperty
{
public:
using Pointer = QSharedPointer<InternalSignalDeclarationProperty>;
static Pointer create(const PropertyName &name, const InternalNodePointer &propertyOwner);
bool isValid() const override;
QString signature() const;
void setSignature(const QString &source);
bool isSignalDeclarationProperty() const override;
protected:
InternalSignalDeclarationProperty(const PropertyName &name, const InternalNodePointer &propertyOwner);
private:
QString m_signature;
};
} // namespace Internal
} // namespace QmlDesigner

View File

@@ -843,6 +843,22 @@ void ModelPrivate::notifySignalHandlerPropertiesChanged(
});
}
void ModelPrivate::notifySignalDeclarationPropertiesChanged(
const QVector<InternalSignalDeclarationPropertyPointer> &internalPropertyList,
AbstractView::PropertyChangeFlags propertyChange)
{
notifyNodeInstanceViewLast([&](AbstractView *view) {
QVector<SignalDeclarationProperty> propertyList;
for (const InternalSignalDeclarationPropertyPointer &signalHandlerProperty : internalPropertyList) {
propertyList.append(SignalDeclarationProperty(signalHandlerProperty->name(),
signalHandlerProperty->propertyOwner(),
m_model,
view));
}
view->signalDeclarationPropertiesChanged(propertyList, propertyChange);
});
}
void ModelPrivate::notifyScriptFunctionsChanged(const InternalNodePointer &node,
const QStringList &scriptFunctionList)
{
@@ -1100,6 +1116,19 @@ void ModelPrivate::setSignalHandlerProperty(const InternalNodePointer &node, con
notifySignalHandlerPropertiesChanged({signalHandlerProperty}, propertyChange);
}
void ModelPrivate::setSignalDeclarationProperty(const InternalNodePointer &node, const PropertyName &name, const QString &signature)
{
AbstractView::PropertyChangeFlags propertyChange = AbstractView::NoAdditionalChanges;
if (!node->hasProperty(name)) {
node->addSignalDeclarationProperty(name);
propertyChange = AbstractView::PropertiesAdded;
}
InternalSignalDeclarationPropertyPointer signalDeclarationProperty = node->signalDeclarationProperty(name);
signalDeclarationProperty->setSignature(signature);
notifySignalDeclarationPropertiesChanged({signalDeclarationProperty}, propertyChange);
}
void ModelPrivate::setVariantProperty(const InternalNodePointer &node, const PropertyName &name, const QVariant &value)
{
AbstractView::PropertyChangeFlags propertyChange = AbstractView::NoAdditionalChanges;

View File

@@ -54,6 +54,7 @@ class InternalNode;
class InternalProperty;
class InternalBindingProperty;
class InternalSignalHandlerProperty;
class InternalSignalDeclarationProperty;
class InternalVariantProperty;
class InternalNodeAbstractProperty;
class InternalNodeListProperty;
@@ -62,6 +63,7 @@ using InternalNodePointer = QSharedPointer<InternalNode>;
using InternalPropertyPointer = QSharedPointer<InternalProperty>;
using InternalBindingPropertyPointer = QSharedPointer<InternalBindingProperty>;
using InternalSignalHandlerPropertyPointer = QSharedPointer<InternalSignalHandlerProperty>;
using InternalSignalDeclarationPropertyPointer = QSharedPointer<InternalSignalDeclarationProperty>;
using InternalVariantPropertyPointer = QSharedPointer<InternalVariantProperty>;
using InternalNodeAbstractPropertyPointer = QSharedPointer<InternalNodeAbstractProperty>;
using InternalNodeListPropertyPointer = QSharedPointer<InternalNodeListProperty>;
@@ -155,6 +157,7 @@ public:
const QList<InternalBindingPropertyPointer> &internalPropertyList);
void notifyBindingPropertiesChanged(const QList<InternalBindingPropertyPointer> &internalPropertyList, AbstractView::PropertyChangeFlags propertyChange);
void notifySignalHandlerPropertiesChanged(const QVector<InternalSignalHandlerPropertyPointer> &propertyList, AbstractView::PropertyChangeFlags propertyChange);
void notifySignalDeclarationPropertiesChanged(const QVector<InternalSignalDeclarationPropertyPointer> &propertyList, AbstractView::PropertyChangeFlags propertyChange);
void notifyVariantPropertiesChanged(const InternalNodePointer &node, const PropertyNameList &propertyNameList, AbstractView::PropertyChangeFlags propertyChange);
void notifyScriptFunctionsChanged(const InternalNodePointer &node, const QStringList &scriptFunctionList);
@@ -222,6 +225,7 @@ public:
void setBindingProperty(const InternalNodePointer &node, const PropertyName &name, const QString &expression);
void setSignalHandlerProperty(const InternalNodePointer &node, const PropertyName &name, const QString &source);
void setSignalDeclarationProperty(const InternalNodePointer &node, const PropertyName &name, const QString &signature);
void setVariantProperty(const InternalNodePointer &node, const PropertyName &name, const QVariant &value);
void setDynamicVariantProperty(const InternalNodePointer &node, const PropertyName &name, const TypeName &propertyType, const QVariant &value);
void setDynamicBindingProperty(const InternalNodePointer &node, const PropertyName &name, const TypeName &dynamicPropertyType, const QString &expression);

View File

@@ -487,6 +487,13 @@ SignalHandlerProperty ModelNode::signalHandlerProperty(const PropertyName &name)
return SignalHandlerProperty(name, m_internalNode, model(), view());
}
SignalDeclarationProperty ModelNode::signalDeclarationProperty(const PropertyName &name) const
{
if (!isValid())
throw InvalidModelNodeException(__LINE__, __FUNCTION__, __FILE__);
return SignalDeclarationProperty(name, m_internalNode, model(), view());
}
/*!
\brief Returns a NodeProperty

View File

@@ -357,6 +357,8 @@ QmlRefactoring::PropertyType ModelToTextMerger::propertyType(const AbstractPrope
return QmlRefactoring::ObjectBinding;
else if (property.isVariantProperty())
return QmlRefactoring::ScriptBinding;
else if (property.isSignalDeclarationProperty())
return QmlRefactoring::ScriptBinding;
Q_ASSERT(false); //Cannot convert property type
return QmlRefactoring::Invalid;

View File

@@ -101,6 +101,8 @@ QString QmlTextGenerator::toQml(const AbstractProperty &property, int indentDept
return property.toBindingProperty().expression();
} else if (property.isSignalHandlerProperty()) {
return property.toSignalHandlerProperty().source();
} else if (property.isSignalDeclarationProperty()) {
return property.toSignalDeclarationProperty().signature();
} else if (property.isNodeProperty()) {
return toQml(property.toNodeProperty().modelNode(), indentDepth);
} else if (property.isNodeListProperty()) {
@@ -288,6 +290,10 @@ QString QmlTextGenerator::propertyToQml(const AbstractProperty &property, int in
+ QString::fromUtf8(property.name())
+ QStringLiteral(": ")
+ toQml(property, indentDepth);
}
if (property.isSignalDeclarationProperty()) {
result = m_tabSettings.indentationString(0, indentDepth, 0) + "signal" + " "
+ QString::fromUtf8(property.name()) + " " + toQml(property, indentDepth);
} else {
result = m_tabSettings.indentationString(0, indentDepth, 0)
+ QString::fromUtf8(property.name())

View File

@@ -261,6 +261,22 @@ void RewriterView::signalHandlerPropertiesChanged(const QVector<SignalHandlerPro
applyChanges();
}
void RewriterView::signalDeclarationPropertiesChanged(const QVector<SignalDeclarationProperty> &propertyList, PropertyChangeFlags propertyChange)
{
Q_ASSERT(textModifier());
if (textToModelMerger()->isActive())
return;
QList<AbstractProperty> usefulPropertyList;
for (const SignalDeclarationProperty &property : propertyList)
usefulPropertyList.append(property);
modelToTextMerger()->propertiesChanged(usefulPropertyList, propertyChange);
if (!isModificationGroupActive())
applyChanges();
}
void RewriterView::nodeReparented(const ModelNode &node, const NodeAbstractProperty &newPropertyParent, const NodeAbstractProperty &oldPropertyParent, AbstractView::PropertyChangeFlags propertyChange)
{
Q_ASSERT(textModifier());

View File

@@ -107,4 +107,57 @@ PropertyName SignalHandlerProperty::prefixRemoved(const PropertyName &propertyNa
return nameAsString.toLatin1();
}
SignalDeclarationProperty::SignalDeclarationProperty() = default;
SignalDeclarationProperty::SignalDeclarationProperty(const SignalDeclarationProperty &property,
AbstractView *view)
: AbstractProperty(property.name(), property.internalNode(), property.model(), view)
{}
SignalDeclarationProperty::SignalDeclarationProperty(
const PropertyName &propertyName,
const Internal::InternalNodePointer &internalNode,
Model *model,
AbstractView *view)
: AbstractProperty(propertyName, internalNode, model, view)
{
}
void SignalDeclarationProperty::setSignature(const QString &signature)
{
Internal::WriteLocker locker(model());
if (!isValid())
throw InvalidModelNodeException(__LINE__, __FUNCTION__, __FILE__);
if (name() == "id") { // the ID for a node is independent of the state, so it has to be set with ModelNode::setId
throw InvalidPropertyException(__LINE__, __FUNCTION__, __FILE__, name());
}
if (signature.isEmpty())
throw InvalidArgumentException(__LINE__, __FUNCTION__, __FILE__, name());
if (internalNode()->hasProperty(name())) { //check if oldValue != value
Internal::InternalProperty::Pointer internalProperty = internalNode()->property(name());
if (internalProperty->isSignalDeclarationProperty()
&& internalProperty->toSignalDeclarationProperty()->signature() == signature)
return;
}
if (internalNode()->hasProperty(name()) && !internalNode()->property(name())->isSignalDeclarationProperty())
privateModel()->removeProperty(internalNode()->property(name()));
privateModel()->setSignalDeclarationProperty(internalNode(), name(), signature);
}
QString SignalDeclarationProperty::signature() const
{
if (internalNode()->hasProperty(name())
&& internalNode()->property(name())->isSignalDeclarationProperty())
return internalNode()->signalDeclarationProperty(name())->signature();
return QString();
}
} // namespace QmlDesigner

View File

@@ -1362,8 +1362,21 @@ void TextToModelMerger::syncNode(ModelNode &modelNode,
} else if (auto script = AST::cast<AST::UiScriptBinding *>(member)) {
modelPropertyNames.remove(syncScriptBinding(modelNode, QString(), script, context, differenceHandler));
} else if (auto property = AST::cast<AST::UiPublicMember *>(member)) {
if (property->type == AST::UiPublicMember::Signal)
continue; // QML designer doesn't support this yet.
if (property->type == AST::UiPublicMember::Signal) {
const QStringView astName = property->name;
AbstractProperty modelProperty = modelNode.property(astName.toUtf8());
QString signature = "()";
if (property->parameters) {
signature = "("
+ textAt(context->doc(),
property->parameters->firstSourceLocation(),
property->parameters->lastSourceLocation())
+ ")";
}
syncSignalDeclarationProperty(modelProperty, signature, differenceHandler);
continue; // Done
}
const QStringView astName = property->name;
QString astValue;
@@ -1698,6 +1711,19 @@ void TextToModelMerger::syncVariantProperty(AbstractProperty &modelProperty,
}
}
void TextToModelMerger::syncSignalDeclarationProperty(AbstractProperty &modelProperty,
const QString &signature,
DifferenceHandler &differenceHandler)
{
if (modelProperty.isSignalHandlerProperty()) {
SignalDeclarationProperty signalHandlerProperty = modelProperty.toSignalDeclarationProperty();
if (signalHandlerProperty.signature() != signature)
differenceHandler.signalDeclarationSignatureDiffer(signalHandlerProperty, signature);
} else {
differenceHandler.shouldBeSignalDeclarationProperty(modelProperty, signature);
}
}
void TextToModelMerger::syncNodeListProperty(NodeListProperty &modelListProperty,
const QList<AST::UiObjectMember *> arrayMembers,
ReadingContext *context,
@@ -1832,6 +1858,14 @@ void ModelValidator::signalHandlerSourceDiffer([[maybe_unused]] SignalHandlerPro
QTC_ASSERT(compareJavaScriptExpression(modelProperty.source(), javascript), return);
}
void ModelValidator::signalDeclarationSignatureDiffer(SignalDeclarationProperty &modelProperty,
const QString &signature)
{
Q_UNUSED(modelProperty)
Q_UNUSED(signature)
QTC_ASSERT(compareJavaScriptExpression(modelProperty.signature(), signature), return);
}
void ModelValidator::shouldBeSignalHandlerProperty([[maybe_unused]] AbstractProperty &modelProperty,
const QString & /*javascript*/)
{
@@ -1839,6 +1873,14 @@ void ModelValidator::shouldBeSignalHandlerProperty([[maybe_unused]] AbstractProp
Q_ASSERT(0);
}
void ModelValidator::shouldBeSignalDeclarationProperty(AbstractProperty &modelProperty,
const QString & /*javascript*/)
{
Q_UNUSED(modelProperty)
Q_ASSERT(modelProperty.isSignalDeclarationProperty());
Q_ASSERT(0);
}
void ModelValidator::shouldBeNodeListProperty([[maybe_unused]] AbstractProperty &modelProperty,
const QList<AST::UiObjectMember *> /*arrayMembers*/,
ReadingContext * /*context*/)
@@ -1971,6 +2013,11 @@ void ModelAmender::signalHandlerSourceDiffer(SignalHandlerProperty &modelPropert
modelProperty.setSource(javascript);
}
void ModelAmender::signalDeclarationSignatureDiffer(SignalDeclarationProperty &modelProperty, const QString &signature)
{
modelProperty.setSignature(signature);
}
void ModelAmender::shouldBeSignalHandlerProperty(AbstractProperty &modelProperty, const QString &javascript)
{
ModelNode theNode = modelProperty.parentModelNode();
@@ -1978,6 +2025,13 @@ void ModelAmender::shouldBeSignalHandlerProperty(AbstractProperty &modelProperty
newModelProperty.setSource(javascript);
}
void ModelAmender::shouldBeSignalDeclarationProperty(AbstractProperty &modelProperty, const QString &signature)
{
ModelNode theNode = modelProperty.parentModelNode();
SignalDeclarationProperty newModelProperty = theNode.signalDeclarationProperty(modelProperty.name());
newModelProperty.setSignature(signature);
}
void ModelAmender::shouldBeNodeListProperty(AbstractProperty &modelProperty,
const QList<AST::UiObjectMember *> arrayMembers,
ReadingContext *context)

View File

@@ -107,6 +107,9 @@ public:
const QList<QmlJS::AST::UiObjectMember *> &arrayMembers,
ReadingContext *context,
DifferenceHandler &differenceHandler);
void syncSignalDeclarationProperty(AbstractProperty &modelProperty,
const QString &signature,
DifferenceHandler &differenceHandler);
void syncVariantProperty(AbstractProperty &modelProperty,
const QVariant &astValue,
const TypeName &astType,
@@ -187,11 +190,15 @@ public:
const TypeName &astType) = 0;
virtual void signalHandlerSourceDiffer(SignalHandlerProperty &modelProperty,
const QString &javascript) = 0;
virtual void signalDeclarationSignatureDiffer(SignalDeclarationProperty &modelProperty,
const QString &signature) = 0;
virtual void shouldBeBindingProperty(AbstractProperty &modelProperty,
const QString &javascript,
const TypeName &astType) = 0;
virtual void shouldBeSignalHandlerProperty(AbstractProperty &modelProperty,
const QString &javascript) = 0;
virtual void shouldBeSignalDeclarationProperty(AbstractProperty &modelProperty,
const QString &signature) = 0;
virtual void shouldBeNodeListProperty(AbstractProperty &modelProperty,
const QList<QmlJS::AST::UiObjectMember *> arrayMembers,
ReadingContext *context) = 0;
@@ -241,6 +248,10 @@ public:
const TypeName &astType) override;
void signalHandlerSourceDiffer(SignalHandlerProperty &modelProperty,
const QString &javascript) override;
void signalDeclarationSignatureDiffer(SignalDeclarationProperty &modelProperty,
const QString &signature) override;
void shouldBeSignalDeclarationProperty(AbstractProperty &modelProperty,
const QString &signature) override;
void shouldBeSignalHandlerProperty(AbstractProperty &modelProperty,
const QString &javascript) override;
void shouldBeNodeListProperty(AbstractProperty &modelProperty,
@@ -290,6 +301,10 @@ public:
const TypeName &astType) override;
void signalHandlerSourceDiffer(SignalHandlerProperty &modelProperty,
const QString &javascript) override;
void signalDeclarationSignatureDiffer(SignalDeclarationProperty &modelProperty,
const QString &signature) override;
void shouldBeSignalDeclarationProperty(AbstractProperty &modelProperty,
const QString &signature) override;
void shouldBeSignalHandlerProperty(AbstractProperty &modelProperty,
const QString &javascript) override;
void shouldBeNodeListProperty(AbstractProperty &modelProperty,

View File

@@ -613,6 +613,10 @@ Project::RestoreResult QmlProject::fromMap(const QVariantMap &map, QString *erro
auto setKitWithVersion = [&](int qtMajorVersion) {
const QList<Kit *> qtVersionkits
= Utils::filtered(kits, [qtMajorVersion](const Kit *k) {
if (!k->isAutoDetected())
return false;
if (k->isReplacementKit())
return false;
QtSupport::QtVersion *version = QtSupport::QtKitAspect::qtVersion(k);
return (version && version->qtVersion().majorVersion == qtMajorVersion);
});

View File

@@ -123,7 +123,7 @@ void FileDownloader::start()
if (reply->error()) {
if (m_tempFile.exists())
m_tempFile.remove();
qDebug() << Q_FUNC_INFO << m_url << reply->errorString();
qWarning() << Q_FUNC_INFO << m_url << reply->errorString();
emit downloadFailed();
} else {
m_tempFile.flush();

View File

@@ -660,10 +660,12 @@ WelcomeMode::WelcomeMode()
m_dataModelDownloader->start();
/*
connect(Core::ModeManager::instance(), &Core::ModeManager::currentModeChanged, this, [this](Utils::Id mode){
bool active = (mode == Core::Constants::MODE_WELCOME);
m_modeWidget->rootObject()->setProperty("active", active);
});
*/
if (!useNewWelcomePage()) {

View File

@@ -170,7 +170,8 @@ tst_TestCore::tst_TestCore()
: QObject()
{
QLoggingCategory::setFilterRules(QStringLiteral("qtc.qmljs.imports=false"));
QLoggingCategory::setFilterRules(QStringLiteral("*.info=false\n*.debug=false\n*.warning=false"));
//QLoggingCategory::setFilterRules(QStringLiteral("*.info=false\n*.debug=false\n*.warning=false"));
QLoggingCategory::setFilterRules(QStringLiteral("*.warning=false"));
}
void tst_TestCore::initTestCase()
@@ -1273,6 +1274,7 @@ void tst_TestCore::testRewriterBehaivours()
testRewriterView->setTextModifier(&modifier);
model->attachView(testRewriterView.data());
//qDebug() << testRewriterView->errors().first().toString();
QVERIFY(testRewriterView->errors().isEmpty());
ModelNode rootModelNode = testRewriterView->rootModelNode();
@@ -1345,6 +1347,119 @@ void tst_TestCore::testRewriterBehaivours()
QVERIFY(!newBehavior.isValid());
}
void tst_TestCore::testRewriterSignalDefinition()
{
const QLatin1String qmlString("\n"
"import QtQuick 2.1\n"
"\n"
"Rectangle {\n"
" id: root\n"
" x: 10;\n"
" y: 10;\n"
" signal testSignal()\n"
" signal testSignal2(float i)\n"
" Rectangle {\n"
" id: rectangle1\n"
" x: 10;\n"
" y: 10;\n"
" signal testSignal\n"
" }\n"
"}");
QPlainTextEdit textEdit;
textEdit.setPlainText(qmlString);
NotIndentingTextEditModifier modifier(&textEdit);
QScopedPointer<Model> model(Model::create("QtQuick.Text"));
QScopedPointer<TestRewriterView> testRewriterView(new TestRewriterView());
testRewriterView->setTextModifier(&modifier);
model->attachView(testRewriterView.data());
QVERIFY(testRewriterView->errors().isEmpty());
ModelNode rootModelNode = testRewriterView->rootModelNode();
QVERIFY(rootModelNode.isValid());
QVERIFY(rootModelNode.hasProperty("testSignal"));
QVERIFY(rootModelNode.hasProperty("testSignal2"));
QVERIFY(rootModelNode.property("testSignal").isSignalDeclarationProperty());
QVERIFY(rootModelNode.signalDeclarationProperty("testSignal").isValid());
QCOMPARE(rootModelNode.signalDeclarationProperty("testSignal").signature(), "()");
QVERIFY(rootModelNode.property("testSignal2").isSignalDeclarationProperty());
QVERIFY(rootModelNode.signalDeclarationProperty("testSignal2").isValid());
QCOMPARE(rootModelNode.signalDeclarationProperty("testSignal2").signature(), "(float i)");
ModelNode rectangle = testRewriterView->modelNodeForId("rectangle1");
QVERIFY(rectangle.isValid());
QVERIFY(rectangle.hasProperty("testSignal"));
QVERIFY(rectangle.property("testSignal").isSignalDeclarationProperty());
QVERIFY(rectangle.signalDeclarationProperty("testSignal").isValid());
QCOMPARE(rectangle.signalDeclarationProperty("testSignal").signature(), "()");
rootModelNode.signalDeclarationProperty("addedSignal").setSignature("()");
rootModelNode.signalDeclarationProperty("addedSignal").setSignature("(real i)");
const QLatin1String expectedQmlCode(
"\nimport QtQuick 2.1\n\n"
"Rectangle {\n"
" id: root\n"
" x: 10;\n"
" y: 10;\n"
" signal addedSignal (real i)\n"
" signal testSignal()\n"
" signal testSignal2(float i)\n"
" Rectangle {\n"
" id: rectangle1\n"
" x: 10;\n"
" y: 10;\n"
" signal testSignal\n"
" }\n}");
QCOMPARE(textEdit.toPlainText(), expectedQmlCode);
rootModelNode.removeProperty("addedSignal");
const QLatin1String expectedQmlCode2(
"\nimport QtQuick 2.1\n\n"
"Rectangle {\n"
" id: root\n"
" x: 10;\n"
" y: 10;\n"
" signal testSignal()\n"
" signal testSignal2(float i)\n"
" Rectangle {\n"
" id: rectangle1\n"
" x: 10;\n"
" y: 10;\n"
" signal testSignal\n"
" }\n}");
QCOMPARE(textEdit.toPlainText(), expectedQmlCode2);
testRewriterView->executeInTransaction("identifer", [rectangle](){
ModelNode newRectangle = rectangle.view()->createModelNode(rectangle.type(),
rectangle.majorVersion(),
rectangle.minorVersion());
QVERIFY(newRectangle.isValid());
newRectangle.signalDeclarationProperty("newSignal").setSignature("()");
newRectangle.setIdWithoutRefactoring("newRect");
newRectangle.view()->rootModelNode().defaultNodeListProperty().reparentHere(newRectangle);
});
const QString expectedQmlCode3
= expectedQmlCode2.chopped(1)
+ QLatin1String("\n Rectangle {\n id: newRect\n signal newSignal ()\n }\n}");
QCOMPARE(textEdit.toPlainText(), expectedQmlCode3);
}
void tst_TestCore::testRewriterForGradientMagic()
{
const QLatin1String qmlString("\n"
@@ -6901,6 +7016,29 @@ void tst_TestCore::testModelChangeType()
QCOMPARE(textEdit.toPlainText(), expectedQmlCode2);
}
void tst_TestCore::testModelSignalDefinition()
{
QScopedPointer<Model> model(createModel("QtQuick.Rectangle", 2, 0));
QVERIFY(model.data());
QScopedPointer<TestView> view(new TestView(model.data()));
QVERIFY(view.data());
model->attachView(view.data());
ModelNode rootModelNode(view->rootModelNode());
QVERIFY(rootModelNode.isValid());
QVERIFY(!rootModelNode.hasProperty("mySignal"));
rootModelNode.signalDeclarationProperty("mySignal").setSignature("()");
QVERIFY(rootModelNode.hasProperty("mySignal"));
QVERIFY(rootModelNode.signalDeclarationProperty("mySignal").isValid());
QVERIFY(rootModelNode.property("mySignal").isSignalDeclarationProperty());
QCOMPARE(rootModelNode.signalDeclarationProperty("mySignal").signature(), "()");
}
void tst_TestCore::testModelDefaultProperties()
{
QScopedPointer<Model> model(createModel("QtQuick.Rectangle", 2, 0));

View File

@@ -90,6 +90,7 @@ private slots:
void testModelNodeInHierarchy();
void testModelNodeIsAncestorOf();
void testModelChangeType();
void testModelSignalDefinition();
//
// unit tests Rewriter
@@ -146,6 +147,7 @@ private slots:
void testRewriterTransactionAddingAfterReparenting();
void testRewriterReparentToNewNode();
void testRewriterBehaivours();
void testRewriterSignalDefinition();
//
// unit tests QmlModelNodeFacade/QmlModelState