Merge remote-tracking branch 'origin/5.0'

Conflicts:
	cmake/QtCreatorIDEBranding.cmake
	qbs/modules/qtc/qtc.qbs
	qtcreator_ide_branding.pri
	src/plugins/android/createandroidmanifestwizard.cpp

Change-Id: Ibd06a254f52c2c96d8c6ddd6b1d27483fcc29a17
This commit is contained in:
Eike Ziller
2021-08-16 10:51:50 +02:00
47 changed files with 435 additions and 194 deletions

View File

@@ -7,6 +7,8 @@
<file>mockfiles/meshes/axishelper.mesh</file>
<file>mockfiles/images/editor_camera.png</file>
<file>mockfiles/images/editor_camera@2x.png</file>
<file>mockfiles/images/editor_particlesystem.png</file>
<file>mockfiles/images/editor_particlesystem@2x.png</file>
<file>mockfiles/images/area.png</file>
<file>mockfiles/images/area@2x.png</file>
<file>mockfiles/images/directional.png</file>
@@ -33,6 +35,7 @@
<file>mockfiles/qt6/LightGizmo.qml</file>
<file>mockfiles/qt6/LightIconGizmo.qml</file>
<file>mockfiles/qt6/LightModel.qml</file>
<file>mockfiles/qt6/ParticleSystemGizmo.qml</file>
<file>mockfiles/qt6/Line3D.qml</file>
<file>mockfiles/qt6/MaterialNodeView.qml</file>
<file>mockfiles/qt6/ModelNode2DImageView.qml</file>

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.9 KiB

View File

@@ -54,6 +54,7 @@ Item {
property var lightIconGizmos: []
property var cameraGizmos: []
property var particleSystemIconGizmos: []
property var selectionBoxes: []
property rect viewPortRect: Qt.rect(0, 0, 1000, 1000)
@@ -400,6 +401,45 @@ Item {
}
}
function addParticleSystemGizmo(scene, obj)
{
// Insert into first available gizmo if we don't already have gizmo for this object
var slotFound = -1;
for (var i = 0; i < particleSystemIconGizmos.length; ++i) {
if (!particleSystemIconGizmos[i].targetNode) {
slotFound = i;
} else if (particleSystemIconGizmos[i].targetNode === obj) {
particleSystemIconGizmos[i].scene = scene;
return;
}
}
if (slotFound !== -1) {
particleSystemIconGizmos[slotFound].scene = scene;
particleSystemIconGizmos[slotFound].targetNode = obj;
particleSystemIconGizmos[slotFound].locked = _generalHelper.isLocked(obj);
particleSystemIconGizmos[slotFound].hidden = _generalHelper.isHidden(obj);
_generalHelper.registerGizmoTarget(obj);
return;
}
// No free gizmos available, create a new one
var gizmoComponent = Qt.createComponent("ParticleSystemGizmo.qml");
if (gizmoComponent.status === Component.Ready) {
_generalHelper.registerGizmoTarget(obj);
var gizmo = gizmoComponent.createObject(overlayView,
{"view3D": overlayView, "targetNode": obj,
"selectedNodes": selectedNodes, "scene": scene,
"activeScene": activeScene,
"locked": _generalHelper.isLocked(obj),
"hidden": _generalHelper.isHidden(obj)});
particleSystemIconGizmos[particleSystemIconGizmos.length] = gizmo;
gizmo.clicked.connect(handleObjectClicked);
gizmo.selectedNodes = Qt.binding(function() {return selectedNodes;});
gizmo.activeScene = Qt.binding(function() {return activeScene;});
}
}
function releaseLightGizmo(obj)
{
for (var i = 0; i < lightIconGizmos.length; ++i) {
@@ -424,6 +464,18 @@ Item {
}
}
function releaseParticleSystemGizmo(obj)
{
for (var i = 0; i < particleSystemIconGizmos.length; ++i) {
if (particleSystemIconGizmos[i].targetNode === obj) {
particleSystemIconGizmos[i].scene = null;
particleSystemIconGizmos[i].targetNode = null;
_generalHelper.unregisterGizmoTarget(obj);
return;
}
}
}
function updateLightGizmoScene(scene, obj)
{
for (var i = 0; i < lightIconGizmos.length; ++i) {
@@ -444,6 +496,16 @@ Item {
}
}
function updateParticleSystemGizmoScene(scene, obj)
{
for (var i = 0; i < particleSystemIconGizmos.length; ++i) {
if (particleSystemIconGizmos[i].targetNode === obj) {
particleSystemIconGizmos[i].scene = scene;
return;
}
}
}
Component.onCompleted: {
createEditView();
selectObjects([]);
@@ -471,6 +533,13 @@ Item {
return;
}
}
for (var i = 0; i < particleSystemIconGizmos.length; ++i) {
if (particleSystemIconGizmos[i].targetNode === node) {
particleSystemIconGizmos[i].locked = _generalHelper.isLocked(node);
return;
}
}
}
function onHiddenStateChanged(node)
{
@@ -486,6 +555,12 @@ Item {
return;
}
}
for (var i = 0; i < particleSystemIconGizmos.length; ++i) {
if (particleSystemIconGizmos[i].targetNode === node) {
particleSystemIconGizmos[i].hidden = _generalHelper.isHidden(node);
return;
}
}
}
}

View File

@@ -0,0 +1,32 @@
/****************************************************************************
**
** Copyright (C) 2021 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of Qt Creator.
**
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
** and conditions see https://www.qt.io/terms-conditions. For further
** information use the contact form at https://www.qt.io/contact-us.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
** General Public License version 3 as published by the Free Software
** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
** included in the packaging of this file. Please review the following
** information to ensure the GNU General Public License requirements will
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
**
****************************************************************************/
import QtQuick 6.0
import QtQuick3D 6.0
IconGizmo {
id: particleSystemGizmo
iconSource: "qrc:///qtquickplugin/mockfiles/images/editor_particlesystem.png"
}

View File

@@ -9,6 +9,10 @@ versionAtLeast(QT_VERSION, 5.15.0) {
QT *= quick3dassetimport-private
DEFINES *= IMPORT_QUICK3D_ASSETS
}
qtHaveModule(quick3dparticles) {
QT *= quick3dparticles-private
DEFINES *= QUICK3D_PARTICLES_MODULE
}
}
HEADERS += $$PWD/qt5nodeinstanceserver.h \

View File

@@ -103,6 +103,10 @@
#endif
#endif
#ifdef QUICK3D_PARTICLES_MODULE
#include <QtQuick3DParticles/private/qquick3dparticlesystem_p.h>
#endif
#ifdef IMPORT_QUICK3D_ASSETS
#include <QtQuick3DAssetImport/private/qssgassetimportmanager_p.h>
#endif
@@ -618,6 +622,11 @@ void Qt5InformationNodeInstanceServer::handleNode3DDestroyed(QObject *obj)
} else if (qobject_cast<QQuick3DAbstractLight *>(obj)) {
QMetaObject::invokeMethod(m_editView3DData.rootItem, "releaseLightGizmo",
Q_ARG(QVariant, objectToVariant(obj)));
#ifdef QUICK3D_PARTICLES_MODULE
} else if (qobject_cast<QQuick3DParticleSystem *>(obj)) {
QMetaObject::invokeMethod(m_editView3DData.rootItem, "releaseParticleSystemGizmo",
Q_ARG(QVariant, objectToVariant(obj)));
#endif
}
removeNode3D(obj);
#else
@@ -720,6 +729,12 @@ void Qt5InformationNodeInstanceServer::resolveSceneRoots()
QMetaObject::invokeMethod(m_editView3DData.rootItem, "updateLightGizmoScene",
Q_ARG(QVariant, objectToVariant(newRoot)),
Q_ARG(QVariant, objectToVariant(node)));
#ifdef QUICK3D_PARTICLES_MODULE
} else if (qobject_cast<QQuick3DParticleSystem *>(node)) {
QMetaObject::invokeMethod(m_editView3DData.rootItem, "updateParticleSystemGizmoScene",
Q_ARG(QVariant, objectToVariant(newRoot)),
Q_ARG(QVariant, objectToVariant(node)));
#endif
}
}
++it;
@@ -1231,12 +1246,16 @@ void Qt5InformationNodeInstanceServer::createCameraAndLightGizmos(
{
QHash<QObject *, QObjectList> cameras;
QHash<QObject *, QObjectList> lights;
QHash<QObject *, QObjectList> particleSystems;
for (const ServerNodeInstance &instance : instanceList) {
if (instance.isSubclassOf("QQuick3DCamera"))
cameras[find3DSceneRoot(instance)] << instance.internalObject();
else if (instance.isSubclassOf("QQuick3DAbstractLight"))
lights[find3DSceneRoot(instance)] << instance.internalObject();
else if (instance.isSubclassOf("QQuick3DParticleSystem"))
particleSystems[find3DSceneRoot(instance)] << instance.internalObject();
}
auto cameraIt = cameras.constBegin();
@@ -1259,6 +1278,16 @@ void Qt5InformationNodeInstanceServer::createCameraAndLightGizmos(
}
++lightIt;
}
auto particleIt = particleSystems.constBegin();
while (particleIt != particleSystems.constEnd()) {
const auto particleObjs = particleIt.value();
for (auto &obj : particleObjs) {
QMetaObject::invokeMethod(m_editView3DData.rootItem, "addParticleSystemGizmo",
Q_ARG(QVariant, objectToVariant(particleIt.key())),
Q_ARG(QVariant, objectToVariant(obj)));
}
++particleIt;
}
}
void Qt5InformationNodeInstanceServer::add3DViewPorts(const QList<ServerNodeInstance> &instanceList)
@@ -1740,6 +1769,9 @@ void Qt5InformationNodeInstanceServer::changeSelection(const ChangeSelectionComm
#ifdef QUICK3D_MODULE
if (qobject_cast<QQuick3DModel *>(object)
|| qobject_cast<QQuick3DCamera *>(object)
#ifdef QUICK3D_PARTICLES_MODULE
|| qobject_cast<QQuick3DParticleSystem *>(object)
#endif
|| qobject_cast<QQuick3DAbstractLight *>(object)) {
return true;
}

View File

@@ -32,6 +32,8 @@ StudioControls.AbstractButton {
property alias tooltip: toolTipArea.tooltip
hover: toolTipArea.containsMouse
ToolTipArea {
id: toolTipArea
anchors.fill: parent

View File

@@ -478,7 +478,7 @@ SecondColumnLayout {
icon: StudioTheme.Constants.eyeDropper
pixelSize: StudioTheme.Values.myIconFontSize * 1.4
tooltip: qsTr("Eye Dropper")
onClicked: ColorPaletteSingleton.eyeDropper()
onClicked: ColorPaletteBackend.eyeDropper()
}
IconIndicator {
@@ -700,7 +700,7 @@ SecondColumnLayout {
StudioControls.MenuItem {
text: qsTr("Add to Favorites")
onTriggered: ColorPaletteSingleton.addFavoriteColor(
onTriggered: ColorPaletteBackend.addFavoriteColor(
contextMenuFavorite.currentColor)
}
}

View File

@@ -41,12 +41,12 @@ Column {
spacing: 10
function addColorToPalette(colorStr) {
ColorPaletteSingleton.addRecentColor(colorStr)
ColorPaletteBackend.addRecentColor(colorStr)
}
function showColorDialog(color) {
root.oldColor = color
ColorPaletteSingleton.showDialog(color)
ColorPaletteBackend.showDialog(color)
}
signal dialogColorChanged
@@ -92,14 +92,14 @@ Column {
StudioControls.MenuItem {
visible: colorMode.currentText === "Favorite"
text: qsTr("Remove from Favorites")
onTriggered: ColorPaletteSingleton.removeFavoriteColor(index)
onTriggered: ColorPaletteBackend.removeFavoriteColor(index)
height: visible ? implicitHeight : 0
}
StudioControls.MenuItem {
visible: colorMode.currentText !== "Favorite"
text: qsTr("Add to Favorites")
onTriggered: ColorPaletteSingleton.addFavoriteColor(modelData)
onTriggered: ColorPaletteBackend.addFavoriteColor(modelData)
height: visible ? implicitHeight : 0
}
}
@@ -108,7 +108,7 @@ Column {
Connections {
id: singletonConnection
target: ColorPaletteSingleton
target: ColorPaletteBackend
function onCurrentColorChanged(color) {
root.selectedColor = color
@@ -132,18 +132,18 @@ Column {
+ 4 * StudioTheme.Values.colorEditorPopupSpinBoxWidth
width: implicitWidth
actionIndicatorVisible: false
model: ColorPaletteSingleton.palettes
currentIndex: colorMode.find(ColorPaletteSingleton.currentPalette)
model: ColorPaletteBackend.palettes
currentIndex: colorMode.find(ColorPaletteBackend.currentPalette)
onActivated: ColorPaletteSingleton.currentPalette = colorMode.currentText
onActivated: ColorPaletteBackend.currentPalette = colorMode.currentText
Component.onCompleted: colorMode.currentIndex = colorMode.find(ColorPaletteSingleton.currentPalette)
Component.onCompleted: colorMode.currentIndex = colorMode.find(ColorPaletteBackend.currentPalette)
}
}
GridView {
id: colorPaletteView
model: ColorPaletteSingleton.currentPaletteColors
model: ColorPaletteBackend.currentPaletteColors
delegate: colorItemDelegate
cellWidth: StudioTheme.Values.colorEditorPopupSpinBoxWidth
+ StudioTheme.Values.controlGap

View File

@@ -31,6 +31,7 @@ T.AbstractButton {
id: myButton
property bool globalHover: false
property bool hover: myButton.hovered
property alias buttonIcon: buttonIcon.text
property alias iconColor: buttonIcon.color
@@ -51,7 +52,7 @@ T.AbstractButton {
z: myButton.checked ? 10 : 3
activeFocusOnTab: false
onHoveredChanged: {
onHoverChanged: {
if (parent !== undefined && parent.hoverCallback !== undefined && myButton.enabled)
parent.hoverCallback()
}
@@ -119,7 +120,7 @@ T.AbstractButton {
states: [
State {
name: "default"
when: myButton.enabled && !myButton.globalHover && !myButton.hovered
when: myButton.enabled && !myButton.globalHover && !myButton.hover
&& !myButton.pressed && !myButton.checked
PropertyChanges {
target: buttonBackground
@@ -132,7 +133,7 @@ T.AbstractButton {
},
State {
name: "globalHover"
when: myButton.globalHover && !myButton.hovered && !myButton.pressed && myButton.enabled
when: myButton.globalHover && !myButton.hover && !myButton.pressed && myButton.enabled
PropertyChanges {
target: buttonBackground
color: StudioTheme.Values.themeControlBackgroundGlobalHover
@@ -140,7 +141,7 @@ T.AbstractButton {
},
State {
name: "hover"
when: myButton.hovered && !myButton.pressed && myButton.enabled
when: myButton.hover && !myButton.pressed && myButton.enabled
PropertyChanges {
target: buttonBackground
color: StudioTheme.Values.themeControlBackgroundHover
@@ -148,7 +149,7 @@ T.AbstractButton {
},
State {
name: "press"
when: myButton.hovered && myButton.pressed
when: myButton.hover && myButton.pressed
PropertyChanges {
target: buttonBackground
color: StudioTheme.Values.themeControlBackgroundInteraction

View File

@@ -56,8 +56,8 @@ Row {
var hover = false
for (var i = 0; i < children.length; ++i) {
if (children[i].hovered !== undefined)
hover = hover || children[i].hovered
if (children[i].hover !== undefined)
hover = hover || children[i].hover
}
myButtonRow.childHover = hover

View File

@@ -236,7 +236,7 @@ public:
Utils::optional<Result> result() const
{
const QJsonValue &result = m_jsonObject.value("result");
const QJsonValue &result = m_jsonObject.value(resultKey);
if (result.isUndefined())
return Utils::nullopt;
return Utils::make_optional(Result(result));
@@ -259,6 +259,41 @@ public:
{ return JsonRpcMessage::isValid(errorMessage) && id().isValid(); }
};
template<typename ErrorDataType>
class Response<std::nullptr_t, ErrorDataType> : public JsonRpcMessage
{
public:
explicit Response(const MessageId &id) { setId(id); }
using JsonRpcMessage::JsonRpcMessage;
MessageId id() const
{ return MessageId(m_jsonObject.value(idKey)); }
void setId(MessageId id)
{ this->m_jsonObject.insert(idKey, id); }
Utils::optional<std::nullptr_t> result() const
{
return m_jsonObject.value(resultKey).isNull() ? Utils::make_optional(nullptr)
: Utils::nullopt;
}
void setResult(const std::nullptr_t &) { m_jsonObject.insert(resultKey, QJsonValue::Null); }
void clearResult() { m_jsonObject.remove(resultKey); }
using Error = ResponseError<ErrorDataType>;
Utils::optional<Error> error() const
{
const QJsonValue &val = m_jsonObject.value(errorKey);
return val.isUndefined() ? Utils::nullopt
: Utils::make_optional(fromJsonValue<Error>(val));
}
void setError(const Error &error)
{ m_jsonObject.insert(errorKey, QJsonValue(error)); }
void clearError() { m_jsonObject.remove(errorKey); }
bool isValid(QString *errorMessage) const override
{ return JsonRpcMessage::isValid(errorMessage) && id().isValid(); }
};
template <typename Result, typename ErrorDataType, typename Params>
class Request : public Notification<Params>
{

View File

@@ -227,7 +227,7 @@ void AndroidConfig::load(const QSettings &settings)
// user settings
m_emulatorArgs = settings.value(EmulatorArgsKey,
QStringList({"-netdelay", "none", "-netspeed", "full"})).toStringList();
m_sdkLocation = FilePath::fromString(settings.value(SDKLocationKey).toString());
m_sdkLocation = FilePath::fromUserInput(settings.value(SDKLocationKey).toString()).cleanPath();
m_customNdkList = settings.value(CustomNdkLocationsKey).toStringList();
m_sdkManagerToolArgs = settings.value(SDKManagerToolArgsKey).toStringList();
m_openJDKLocation = FilePath::fromString(settings.value(OpenJDKLocationKey).toString());
@@ -239,7 +239,7 @@ void AndroidConfig::load(const QSettings &settings)
if (reader.load(FilePath::fromString(sdkSettingsFileName()))
&& settings.value(changeTimeStamp).toInt() != QFileInfo(sdkSettingsFileName()).lastModified().toMSecsSinceEpoch() / 1000) {
// persisten settings
m_sdkLocation = FilePath::fromString(reader.restoreValue(SDKLocationKey, m_sdkLocation.toString()).toString());
m_sdkLocation = FilePath::fromUserInput(reader.restoreValue(SDKLocationKey, m_sdkLocation.toString()).toString()).cleanPath();
m_customNdkList = reader.restoreValue(CustomNdkLocationsKey).toStringList();
m_sdkManagerToolArgs = reader.restoreValue(SDKManagerToolArgsKey, m_sdkManagerToolArgs).toStringList();
m_openJDKLocation = FilePath::fromString(reader.restoreValue(OpenJDKLocationKey, m_openJDKLocation.toString()).toString());
@@ -1024,7 +1024,7 @@ FilePath AndroidConfig::defaultSdkPath()
{
QString sdkFromEnvVar = QString::fromLocal8Bit(getenv("ANDROID_SDK_ROOT"));
if (!sdkFromEnvVar.isEmpty())
return Utils::FilePath::fromString(sdkFromEnvVar);
return FilePath::fromUserInput(sdkFromEnvVar).cleanPath();
// Set default path of SDK as used by Android Studio
if (Utils::HostOsInfo::isMacHost()) {

View File

@@ -213,13 +213,13 @@ QJsonObject AndroidManager::deploymentSettings(const Target *target)
const QStringList abis = applicationAbis(target);
QTC_ASSERT(abis.size() == 1, return {});
settings["stdcpp-path"] = (AndroidConfigurations::currentConfig().toolchainPath(qt)
/ "sysroot/usr/lib/"
/ "sysroot/usr/lib"
/ archTriplet(abis.first())
/ "libc++_shared.so").toString();
} else {
settings["stdcpp-path"] = AndroidConfigurations::currentConfig()
.toolchainPath(qt)
.pathAppended("sysroot/usr/lib/")
.pathAppended("sysroot/usr/lib")
.toString();
}
settings["toolchain-prefix"] = "llvm";

View File

@@ -596,7 +596,7 @@ void AndroidSettingsWidget::validateOpenSsl()
void AndroidSettingsWidget::onSdkPathChanged()
{
const FilePath sdkPath = m_ui.SDKLocationPathChooser->filePath();
const FilePath sdkPath = m_ui.SDKLocationPathChooser->filePath().cleanPath();
m_androidConfig.setSdkLocation(sdkPath);
FilePath currentOpenSslPath = m_androidConfig.openSslLocation();
if (currentOpenSslPath.isEmpty() || !currentOpenSslPath.exists())
@@ -608,7 +608,7 @@ void AndroidSettingsWidget::onSdkPathChanged()
void AndroidSettingsWidget::validateSdk()
{
const FilePath sdkPath = m_ui.SDKLocationPathChooser->filePath();
const FilePath sdkPath = m_ui.SDKLocationPathChooser->filePath().cleanPath();
m_androidConfig.setSdkLocation(sdkPath);
m_androidSummary->setPointValid(SdkPathExistsRow, m_androidConfig.sdkLocation().exists());
@@ -865,14 +865,15 @@ void AndroidSettingsWidget::downloadSdk()
}
const QString message = tr("Download and install Android SDK Tools to: %1?")
.arg(m_ui.SDKLocationPathChooser->filePath().toUserOutput());
.arg(m_ui.SDKLocationPathChooser->filePath().cleanPath().toUserOutput());
auto userInput = QMessageBox::information(this, AndroidSdkDownloader::dialogTitle(),
message, QMessageBox::Yes | QMessageBox::No);
if (userInput == QMessageBox::Yes) {
if (m_javaSummary->allRowsOk()) {
auto javaPath = m_ui.OpenJDKLocationPathChooser->filePath();
m_sdkDownloader.downloadAndExtractSdk(javaPath.toString(),
m_ui.SDKLocationPathChooser->filePath().toString());
m_sdkDownloader.downloadAndExtractSdk(
javaPath.toString(),
m_ui.SDKLocationPathChooser->filePath().cleanPath().toString());
}
}
}

View File

@@ -315,7 +315,7 @@ void CreateAndroidManifestWizard::createAndroidTemplateFiles()
if (m_copyGradle) {
FilePath gradlePath = version->prefix() / "src/3rdparty/gradle";
if (!gradlePath.exists())
gradlePath = AndroidConfigurations::currentConfig().sdkLocation() / "/tools/templates/gradle/wrapper";
gradlePath = AndroidConfigurations::currentConfig().sdkLocation() / "tools/templates/gradle/wrapper";
FileUtils::copyRecursively(gradlePath, m_directory, nullptr, copy);
}

View File

@@ -669,7 +669,7 @@ void CMakeBuildSystem::updateProjectData()
QList<QByteArray> moduleMappings;
for (const RawProjectPart &rpp : qAsConst(rpps)) {
FilePath moduleMapFile = cmakeBuildConfiguration()->buildDirectory()
.pathAppended("/qml_module_mappings/" + rpp.buildSystemTarget);
.pathAppended("qml_module_mappings/" + rpp.buildSystemTarget);
if (moduleMapFile.exists()) {
QFile mmf(moduleMapFile.toString());
if (mmf.open(QFile::ReadOnly)) {

View File

@@ -185,22 +185,25 @@ static QString defaultCommand()
return "locate";
}
static QString defaultArguments()
{
if (HostOsInfo::isMacHost())
return "\"kMDItemFSName = '*%{Query:Escaped}*'c\"";
if (HostOsInfo::isWindowsHost())
return "-n 10000 -r \"%{Query:Regex}\"";
return "-i -l 10000 -r \"%{Query:Regex}\"";
}
/*!
For the tools es [1] and locate [2], interpret space as AND operator.
static QString defaultCaseSensitiveArguments()
Currently doesn't support fine picking a file with a space in the path by escaped space.
[1]: https://www.voidtools.com/support/everything/command_line_interface/
[2]: https://www.gnu.org/software/findutils/manual/html_node/find_html/Invoking-locate.html
*/
static QString defaultArguments(Qt::CaseSensitivity sens = Qt::CaseInsensitive)
{
if (HostOsInfo::isMacHost())
return "\"kMDItemFSName = '*%{Query:Escaped}*'\"";
return QString("\"kMDItemFSName = '*%{Query:Escaped}*'%1\"")
.arg(sens == Qt::CaseInsensitive ? QString("c") : "");
if (HostOsInfo::isWindowsHost())
return "-i -n 10000 -r \"%{Query:Regex}\"";
return "-l 10000 -r \"%{Query:Regex}\"";
return QString("%1 -n 10000 %{Query:Escaped}")
.arg(sens == Qt::CaseInsensitive ? QString() : "-i ");
return QString("%1 -A -l 10000 %{Query:Escaped}")
.arg(sens == Qt::CaseInsensitive ? QString() : "-i ");
}
const char kCommandKey[] = "command";
@@ -229,6 +232,7 @@ static MacroExpander *createMacroExpander(const QString &query)
[query] {
QString regex = query;
regex = regex.replace('*', ".*");
regex = regex.replace(' ', ".*");
return regex;
});
return expander;
@@ -305,7 +309,7 @@ void SpotlightLocatorFilter::saveState(QJsonObject &obj) const
obj.insert(kCommandKey, m_command);
if (m_arguments != defaultArguments())
obj.insert(kArgumentsKey, m_arguments);
if (m_caseSensitiveArguments != defaultCaseSensitiveArguments())
if (m_caseSensitiveArguments != defaultArguments(Qt::CaseSensitive))
obj.insert(kCaseSensitiveKey, m_caseSensitiveArguments);
}
@@ -313,14 +317,14 @@ void SpotlightLocatorFilter::restoreState(const QJsonObject &obj)
{
m_command = obj.value(kCommandKey).toString(defaultCommand());
m_arguments = obj.value(kArgumentsKey).toString(defaultArguments());
m_caseSensitiveArguments = obj.value(kCaseSensitiveKey).toString(defaultCaseSensitiveArguments());
m_caseSensitiveArguments = obj.value(kCaseSensitiveKey).toString(defaultArguments(Qt::CaseSensitive));
}
void SpotlightLocatorFilter::reset()
{
m_command = defaultCommand();
m_arguments = defaultArguments();
m_caseSensitiveArguments = defaultCaseSensitiveArguments();
m_caseSensitiveArguments = defaultArguments(Qt::CaseSensitive);
}
} // Internal

View File

@@ -155,6 +155,10 @@ OutputWindow::OutputWindow(Context context, const QString &settingsKey, QWidget
connect(verticalScrollBar(), &QAbstractSlider::actionTriggered,
this, &OutputWindow::updateAutoScroll);
// For when "Find" changes the position; see QTCREATORBUG-26100.
connect(this, &QPlainTextEdit::selectionChanged, this, &OutputWindow::updateAutoScroll,
Qt::QueuedConnection);
undoAction->setEnabled(false);
redoAction->setEnabled(false);
cutAction->setEnabled(false);
@@ -252,7 +256,7 @@ void OutputWindow::showEvent(QShowEvent *e)
{
QPlainTextEdit::showEvent(e);
if (d->scrollToBottom)
verticalScrollBar()->setValue(verticalScrollBar()->maximum());
scrollToBottom();
}
void OutputWindow::wheelEvent(QWheelEvent *e)

View File

@@ -1293,8 +1293,10 @@ void Client::handleMethod(const QString &method, const MessageId &id, const ICon
response.setResult(result);
sendContent(response);
} else if (method == WorkDoneProgressCreateRequest::methodName) {
sendContent(WorkDoneProgressCreateRequest::Response(
dynamic_cast<const WorkDoneProgressCreateRequest *>(content)->id()));
WorkDoneProgressCreateRequest::Response response(
dynamic_cast<const WorkDoneProgressCreateRequest *>(content)->id());
response.setResult(nullptr);
sendContent(response);
} else if (method == ProgressNotification::methodName) {
if (Utils::optional<ProgressParams> params
= dynamic_cast<const ProgressNotification *>(content)->params()) {

View File

@@ -110,8 +110,9 @@ void LanguageClientManager::clientStarted(Client *client)
clientFinished(client);
return;
}
if (!managerInstance->m_clients.contains(client)) {
if (!managerInstance->m_clients.contains(client))
managerInstance->m_clients << client;
connect(client, &Client::finished, managerInstance, [client]() { clientFinished(client); });
connect(client,
&Client::initialized,
@@ -126,7 +127,6 @@ void LanguageClientManager::clientStarted(Client *client)
[client](const DynamicCapabilities &capabilities) {
managerInstance->m_inspector.updateCapabilities(client->name(), capabilities);
});
}
client->initialize();
}

View File

@@ -353,7 +353,7 @@ extend_qtc_plugin(QmlDesigner
SOURCES_PREFIX components/propertyeditor
SOURCES
aligndistribute.cpp aligndistribute.h
colorpalettesingleton.cpp colorpalettesingleton.h
colorpalettebackend.cpp colorpalettebackend.h
designerpropertymap.cpp designerpropertymap.h
fileresourcesmodel.cpp fileresourcesmodel.h
itemfiltermodel.cpp itemfiltermodel.h

View File

@@ -1,6 +1,6 @@
/****************************************************************************
**
** Copyright (C) 2020 The Qt Company Ltd.
** Copyright (C) 2021 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of Qt Creator.
@@ -24,18 +24,17 @@
****************************************************************************/
#include "annotationcommenttab.h"
#include "defaultannotations.h"
#include "ui_annotationcommenttab.h"
#include "richtexteditor/richtexteditor.h"
#include "defaultannotations.h"
#include <qmldesignerplugin.h>
#include <richtexteditor/richtexteditor.h>
#include <projectexplorer/target.h>
#include <qmlprojectmanager/qmlproject.h>
#include <QCryptographicHash>
#include "projectexplorer/session.h"
#include "projectexplorer/target.h"
#include "qmldesignerplugin.h"
#include "qmlprojectmanager/qmlproject.h"
namespace QmlDesigner {
AnnotationCommentTab::AnnotationCommentTab(QWidget *parent)
@@ -50,10 +49,27 @@ AnnotationCommentTab::AnnotationCommentTab(QWidget *parent)
filePath = backupFile(filePath);
});
Utils::FilePath projPath = ProjectExplorer::SessionManager::startupProject()->projectFilePath();
m_editor->setImageActionVisible(false);
m_editor->setDocumentBaseUrl(QUrl::fromLocalFile(projPath.toString()));
const QmlDesigner::DesignDocument *designDocument = QmlDesigner::QmlDesignerPlugin::instance()
->documentManager().currentDesignDocument();
Utils::FilePath projectPath;
Q_ASSERT(designDocument);
if (designDocument) {
if (designDocument->currentTarget() && designDocument->currentTarget()->project()) {
projectPath = designDocument->currentTarget()->project()->projectFilePath();
m_editor->setImageActionVisible(true);
}
if (projectPath.isEmpty()) {
projectPath = designDocument->fileName();
m_editor->setImageActionVisible(false);
}
m_editor->setDocumentBaseUrl(QUrl::fromLocalFile(projectPath.toString()));
}
ui->formLayout->setWidget(3, QFormLayout::FieldRole, m_editor);
@@ -124,14 +140,35 @@ void AnnotationCommentTab::setDefaultAnnotations(DefaultAnnotationsModel *defaul
QString AnnotationCommentTab::backupFile(const QString &filePath)
{
const QDir projDir(
ProjectExplorer::SessionManager::startupProject()->projectDirectory().toString());
const QmlDesigner::DesignDocument *designDocument = QmlDesigner::QmlDesignerPlugin::instance()
->documentManager().currentDesignDocument();
Utils::FilePath projectFolderPath;
Q_ASSERT(designDocument);
if (designDocument) {
if (designDocument->hasProject())
projectFolderPath = designDocument->projectFolder();
if (projectFolderPath.isEmpty())
projectFolderPath = designDocument->fileName().parentDir();
}
else
return {};
const QDir projDir(projectFolderPath.toDir());
if (!projDir.exists())
return {};
const QString imageSubDir(".AnnotationImages");
const QDir imgDir(projDir.absolutePath() + QDir::separator() + imageSubDir);
ensureDir(imgDir);
Q_ASSERT(imgDir.exists());
if (!imgDir.exists())
return {};
const QFileInfo oldFile(filePath);
QFileInfo newFile(imgDir, oldFile.fileName());

View File

@@ -1,6 +1,6 @@
/****************************************************************************
**
** Copyright (C) 2020 The Qt Company Ltd.
** Copyright (C) 2021 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of Qt Creator.
@@ -25,7 +25,7 @@
#pragma once
#include "annotation.h"
#include <annotation.h>
#include <QWidget>
#include <QPointer>
@@ -67,16 +67,17 @@ public:
signals:
void titleChanged(const QString &text, QWidget *widget);
private:
QString backupFile(const QString &filePath);
void ensureDir(const QDir &dir);
int compareFileChecksum(const QString &firstFile, const QString &secondFile);
private:
std::unique_ptr<Ui::AnnotationCommentTab> ui;
RichTextEditor *m_editor;
Comment m_comment;
QPointer<DefaultAnnotationsModel> m_defaults;
QString backupFile(const QString &filePath);
void ensureDir(const QDir &dir);
int compareFileChecksum(const QString &firstFile, const QString &secondFile);
};
} //namespace QmlDesigner

View File

@@ -357,14 +357,16 @@ QVector<Comment> AnnotationTableView::fetchComments() const
Comment AnnotationTableView::fetchComment(int row) const
{
auto *item = m_model->item(row, ColumnId::Title);
if (item->text().isEmpty())
const auto *item = m_model->item(row, ColumnId::Title);
Comment comment = item->data().value<Comment>();
if (comment.isEmpty())
return {};
Comment comment = item->data().value<Comment>();
comment.setTitle(item->text());
comment.setAuthor(m_model->item(row, ColumnId::Author)->text());
comment.setText(dataToCommentText(m_model->item(row, ColumnId::Value)->data(Qt::DisplayRole)));
return comment;
}

View File

@@ -127,9 +127,9 @@ QString Theme::replaceCssColors(const QString &input)
void Theme::setupTheme(QQmlEngine *engine)
{
static const int typeIndex = qmlRegisterSingletonType<Utils::Theme>("QtQuickDesignerTheme", 1, 0,
"Theme", [](QQmlEngine *, QJSEngine *) {
return qobject_cast<QObject*>(new Theme(Utils::creatorTheme(), nullptr));
static const int typeIndex = qmlRegisterSingletonType<Theme>(
"QtQuickDesignerTheme", 1, 0, "Theme", [](QQmlEngine *engine, QJSEngine *) {
return new Theme(Utils::creatorTheme(), nullptr);
});
Q_UNUSED(typeIndex)

View File

@@ -288,6 +288,11 @@ Utils::FilePath DesignDocument::projectFolder() const
return {};
}
bool DesignDocument::hasProject() const
{
return ProjectExplorer::SessionManager::projectForFile(fileName());
}
void DesignDocument::changeToInFileComponentModel(ComponentTextModifier *textModifer)
{
m_inFileComponentTextModifier.reset(textModifer);

View File

@@ -101,6 +101,7 @@ public:
bool isQtForMCUsProject() const;
Utils::FilePath projectFolder() const;
bool hasProject() const;
signals:
void displayNameChanged(const QString &newFileName);

View File

@@ -23,7 +23,7 @@
**
****************************************************************************/
#include "colorpalettesingleton.h"
#include "colorpalettebackend.h"
#include <QDebug>
#include <QSettings>
@@ -36,9 +36,9 @@
namespace QmlDesigner {
QPointer<ColorPaletteSingleton> ColorPaletteSingleton::m_instance = nullptr;
QPointer<ColorPaletteBackend> ColorPaletteBackend::m_instance = nullptr;
ColorPaletteSingleton::ColorPaletteSingleton()
ColorPaletteBackend::ColorPaletteBackend()
: m_currentPalette()
, m_data()
, m_colorPickingEventFilter(nullptr)
@@ -58,24 +58,16 @@ ColorPaletteSingleton::ColorPaletteSingleton()
dummyTransparentWindow.resize(1, 1);
dummyTransparentWindow.setFlags(Qt::Tool | Qt::FramelessWindowHint);
updateTimer = new QTimer(this);
connect(updateTimer, &QTimer::timeout, this, &ColorPaletteSingleton::updateEyeDropper);
connect(updateTimer, &QTimer::timeout, this, &ColorPaletteBackend::updateEyeDropper);
#endif
}
ColorPaletteSingleton::~ColorPaletteSingleton()
ColorPaletteBackend::~ColorPaletteBackend()
{
//writePalettes(); // TODO crash on QtDS close
}
ColorPaletteSingleton *ColorPaletteSingleton::instance()
{
if (m_instance == nullptr)
m_instance = new ColorPaletteSingleton();
return m_instance;
}
void ColorPaletteSingleton::readPalettes()
void ColorPaletteBackend::readPalettes()
{
QHash<QString, Palette>::iterator i = m_data.begin();
while (i != m_data.end()) {
@@ -84,7 +76,7 @@ void ColorPaletteSingleton::readPalettes()
}
}
void ColorPaletteSingleton::writePalettes()
void ColorPaletteBackend::writePalettes()
{
QHash<QString, Palette>::iterator i = m_data.begin();
while (i != m_data.end()) {
@@ -93,10 +85,10 @@ void ColorPaletteSingleton::writePalettes()
}
}
void ColorPaletteSingleton::addColor(const QString &color, const QString &palette)
void ColorPaletteBackend::addColor(const QString &color, const QString &palette)
{
if (!m_data.contains(palette)) {
qWarning() << "TODO";
qWarning() << Q_FUNC_INFO << "Unknown palette: " << palette;
return;
}
@@ -116,15 +108,15 @@ void ColorPaletteSingleton::addColor(const QString &color, const QString &palett
m_data[palette].write();
}
void ColorPaletteSingleton::removeColor(int id, const QString &palette)
void ColorPaletteBackend::removeColor(int id, const QString &palette)
{
if (!m_data.contains(palette)) {
qWarning() << "TODO";
qWarning() << Q_FUNC_INFO << "Unknown palette: " << palette;
return;
}
if (id >= m_data[palette].m_colors.size()) {
qWarning() << "TODO";
qWarning() << Q_FUNC_INFO << "Id(" << id << ") is out of bounds for palette " << palette;
return;
}
@@ -143,7 +135,7 @@ void ColorPaletteSingleton::removeColor(int id, const QString &palette)
m_data[palette].write();
}
void ColorPaletteSingleton::addRecentColor(const QString &item)
void ColorPaletteBackend::addRecentColor(const QString &item)
{
if (m_data[g_recent].m_colors.isEmpty()) {
addColor(item, g_recent);
@@ -155,30 +147,30 @@ void ColorPaletteSingleton::addRecentColor(const QString &item)
addColor(item, g_recent);
}
void ColorPaletteSingleton::addFavoriteColor(const QString &item)
void ColorPaletteBackend::addFavoriteColor(const QString &item)
{
addColor(item, g_favorite);
}
void ColorPaletteSingleton::removeFavoriteColor(int id)
void ColorPaletteBackend::removeFavoriteColor(int id)
{
removeColor(id, g_favorite);
}
QStringList ColorPaletteSingleton::palettes() const
QStringList ColorPaletteBackend::palettes() const
{
return m_data.keys();
}
const QString &ColorPaletteSingleton::currentPalette() const
const QString &ColorPaletteBackend::currentPalette() const
{
return m_currentPalette;
}
void ColorPaletteSingleton::setCurrentPalette(const QString &palette)
void ColorPaletteBackend::setCurrentPalette(const QString &palette)
{
if (!m_data.contains(palette)) {
qWarning() << "TODO";
qWarning() << Q_FUNC_INFO << "Unknown palette: " << palette;
return;
}
@@ -207,35 +199,35 @@ void ColorPaletteSingleton::setCurrentPalette(const QString &palette)
emit currentPaletteColorsChanged();
}
const QStringList &ColorPaletteSingleton::currentPaletteColors() const
const QStringList &ColorPaletteBackend::currentPaletteColors() const
{
return m_currentPaletteColors;
}
void ColorPaletteSingleton::registerDeclarativeType()
void ColorPaletteBackend::registerDeclarativeType()
{
static const int typeIndex = qmlRegisterSingletonType<ColorPaletteSingleton>(
"QtQuickDesignerColorPalette", 1, 0, "ColorPaletteSingleton", [](QQmlEngine *, QJSEngine *) {
return ColorPaletteSingleton::instance();
static const int typeIndex = qmlRegisterSingletonType<ColorPaletteBackend>(
"QtQuickDesignerColorPalette", 1, 0, "ColorPaletteBackend", [](QQmlEngine *, QJSEngine *) {
return new ColorPaletteBackend();
});
Q_UNUSED(typeIndex)
}
void ColorPaletteSingleton::showDialog(QColor color)
void ColorPaletteBackend::showDialog(QColor color)
{
auto colorDialog = new QColorDialog(Core::ICore::dialogParent());
colorDialog->setCurrentColor(color);
colorDialog->setAttribute(Qt::WA_DeleteOnClose);
connect(colorDialog, &QDialog::rejected,
this, &ColorPaletteSingleton::colorDialogRejected);
this, &ColorPaletteBackend::colorDialogRejected);
connect(colorDialog, &QColorDialog::currentColorChanged,
this, &ColorPaletteSingleton::currentColorChanged);
this, &ColorPaletteBackend::currentColorChanged);
QTimer::singleShot(0, [colorDialog](){ colorDialog->exec(); });
}
void ColorPaletteSingleton::eyeDropper()
void ColorPaletteBackend::eyeDropper()
{
QWidget *widget = QApplication::activeWindow();
if (!widget)
@@ -274,12 +266,12 @@ const int g_screenGrabHeight = 7;
const int g_pixelX = 3;
const int g_pixelY = 3;
QColor ColorPaletteSingleton::grabScreenColor(const QPoint &p)
QColor ColorPaletteBackend::grabScreenColor(const QPoint &p)
{
return grabScreenRect(p).pixel(g_pixelX, g_pixelY);
}
QImage ColorPaletteSingleton::grabScreenRect(const QPoint &p)
QImage ColorPaletteBackend::grabScreenRect(const QPoint &p)
{
QScreen *screen = QGuiApplication::screenAt(p);
if (!screen)
@@ -289,7 +281,7 @@ QImage ColorPaletteSingleton::grabScreenRect(const QPoint &p)
return pixmap.toImage();
}
void ColorPaletteSingleton::updateEyeDropper()
void ColorPaletteBackend::updateEyeDropper()
{
#ifndef QT_NO_CURSOR
static QPoint lastGlobalPos;
@@ -306,12 +298,12 @@ void ColorPaletteSingleton::updateEyeDropper()
#endif // ! QT_NO_CURSOR
}
void ColorPaletteSingleton::updateEyeDropperPosition(const QPoint &globalPos)
void ColorPaletteBackend::updateEyeDropperPosition(const QPoint &globalPos)
{
updateCursor(grabScreenRect(globalPos));
}
void ColorPaletteSingleton::updateCursor(const QImage &image)
void ColorPaletteBackend::updateCursor(const QImage &image)
{
QWidget *widget = QApplication::activeWindow();
if (!widget)
@@ -351,7 +343,7 @@ void ColorPaletteSingleton::updateCursor(const QImage &image)
widget->setCursor(cursor);
}
void ColorPaletteSingleton::releaseEyeDropper()
void ColorPaletteBackend::releaseEyeDropper()
{
QWidget *widget = QApplication::activeWindow();
if (!widget)
@@ -369,13 +361,13 @@ void ColorPaletteSingleton::releaseEyeDropper()
widget->unsetCursor();
}
bool ColorPaletteSingleton::handleEyeDropperMouseMove(QMouseEvent *e)
bool ColorPaletteBackend::handleEyeDropperMouseMove(QMouseEvent *e)
{
updateEyeDropperPosition(e->globalPos());
return true;
}
bool ColorPaletteSingleton::handleEyeDropperMouseButtonRelease(QMouseEvent *e)
bool ColorPaletteBackend::handleEyeDropperMouseButtonRelease(QMouseEvent *e)
{
if (e->button() == Qt::LeftButton)
emit currentColorChanged(grabScreenColor(e->globalPos()));
@@ -386,7 +378,7 @@ bool ColorPaletteSingleton::handleEyeDropperMouseButtonRelease(QMouseEvent *e)
return true;
}
bool ColorPaletteSingleton::handleEyeDropperKeyPress(QKeyEvent *e)
bool ColorPaletteBackend::handleEyeDropperKeyPress(QKeyEvent *e)
{
#if QT_CONFIG(shortcut)
if (e->matches(QKeySequence::Cancel)) {

View File

@@ -78,7 +78,7 @@ struct Palette
QStringList m_colors;
};
class ColorPaletteSingleton : public QObject
class ColorPaletteBackend : public QObject
{
Q_OBJECT
@@ -94,9 +94,7 @@ class ColorPaletteSingleton : public QObject
NOTIFY palettesChanged)
public:
static ColorPaletteSingleton *instance();
~ColorPaletteSingleton();
~ColorPaletteBackend();
void readPalettes();
void writePalettes();
@@ -140,8 +138,8 @@ public:
bool handleEyeDropperKeyPress(QKeyEvent *e);
ColorPaletteSingleton(const ColorPaletteSingleton &) = delete;
void operator=(const ColorPaletteSingleton &) = delete;
ColorPaletteBackend(const ColorPaletteBackend &) = delete;
void operator=(const ColorPaletteBackend &) = delete;
signals:
void currentPaletteChanged(const QString &palette);
@@ -154,10 +152,10 @@ signals:
void eyeDropperRejected();
private:
ColorPaletteSingleton();
ColorPaletteBackend();
private:
static QPointer<ColorPaletteSingleton> m_instance;
static QPointer<ColorPaletteBackend> m_instance;
QString m_currentPalette;
QStringList m_currentPaletteColors;
QHash<QString, Palette> m_data;
@@ -171,29 +169,33 @@ private:
class QColorPickingEventFilter : public QObject {
public:
explicit QColorPickingEventFilter(QObject *parent = 0)
: QObject(parent)
explicit QColorPickingEventFilter(ColorPaletteBackend *colorPalette)
: QObject(colorPalette)
, m_colorPalette(colorPalette)
{}
bool eventFilter(QObject *, QEvent *event) override
{
switch (event->type()) {
case QEvent::MouseMove:
return ColorPaletteSingleton::instance()->handleEyeDropperMouseMove(
return m_colorPalette->handleEyeDropperMouseMove(
static_cast<QMouseEvent *>(event));
case QEvent::MouseButtonRelease:
return ColorPaletteSingleton::instance()->handleEyeDropperMouseButtonRelease(
return m_colorPalette->handleEyeDropperMouseButtonRelease(
static_cast<QMouseEvent *>(event));
case QEvent::KeyPress:
return ColorPaletteSingleton::instance()->handleEyeDropperKeyPress(
return m_colorPalette->handleEyeDropperKeyPress(
static_cast<QKeyEvent *>(event));
default:
break;
}
return false;
}
private:
ColorPaletteBackend *m_colorPalette;
};
} // namespace QmlDesigner
QML_DECLARE_TYPE(QmlDesigner::ColorPaletteSingleton)
QML_DECLARE_TYPE(QmlDesigner::ColorPaletteBackend)

View File

@@ -16,7 +16,7 @@ SOURCES += propertyeditorview.cpp \
gradientpresetlistmodel.cpp \
gradientpresetdefaultlistmodel.cpp \
gradientpresetcustomlistmodel.cpp \
colorpalettesingleton.cpp \
colorpalettebackend.cpp \
itemfiltermodel.cpp \
aligndistribute.cpp \
tooltip.cpp
@@ -37,7 +37,7 @@ HEADERS += propertyeditorview.h \
gradientpresetlistmodel.h \
gradientpresetdefaultlistmodel.h \
gradientpresetcustomlistmodel.h \
colorpalettesingleton.h \
colorpalettebackend.h \
itemfiltermodel.h \
aligndistribute.h \
tooltip.h

View File

@@ -29,7 +29,7 @@
#include "annotationeditor/annotationeditor.h"
#include "bindingeditor/actioneditor.h"
#include "bindingeditor/bindingeditor.h"
#include "colorpalettesingleton.h"
#include "colorpalettebackend.h"
#include "fileresourcesmodel.h"
#include "gradientmodel.h"
#include "gradientpresetcustomlistmodel.h"
@@ -63,7 +63,7 @@ void Quick2PropertyEditorView::registerQmlTypes()
GradientPresetDefaultListModel::registerDeclarativeType();
GradientPresetCustomListModel::registerDeclarativeType();
ItemFilterModel::registerDeclarativeType();
ColorPaletteSingleton::registerDeclarativeType();
ColorPaletteBackend::registerDeclarativeType();
Internal::QmlAnchorBindingProxy::registerDeclarativeType();
BindingEditor::registerDeclarativeType();
ActionEditor::registerDeclarativeType();

View File

@@ -47,22 +47,6 @@ MetaInfo {
}
}
Type {
name: "QtQuick.Controls.SplitView"
icon: ":/componentsplugin/images/splitview-layouts-icon-16px.png"
ItemLibraryEntry {
name: "SplitView"
category: "Qt Quick - Layouts"
libraryIcon: ":/componentsplugin/images/splitview-layouts-icon.png"
version: "1.0"
requiredImport: "QtQuick.Controls"
Property { name: "width"; type: "int"; value: 100; }
Property { name: "height"; type: "int"; value: 100; }
}
}
Type {
name: "QtQuick.Layouts.StackLayout"
icon: ":/componentsplugin/images/stack-layouts-icon-16px.png"

View File

@@ -535,6 +535,7 @@ QProcessEnvironment PuppetCreator::processEnvironment() const
import = QmlDesigner::Import::createLibraryImport("QtCharts", "2.0");
if (m_model->hasImport(import, true, true))
environment.set("QMLDESIGNER_FORCE_QAPPLICATION", "true");
environment.set("QT_QUICK3D_DISABLE_PARTICLE_SYSTEMS", "1");
#endif
QStringList importPaths = m_model->importPaths();

View File

@@ -677,8 +677,8 @@ Project {
"navigator/previewtooltip.ui",
"propertyeditor/aligndistribute.cpp",
"propertyeditor/aligndistribute.h",
"propertyeditor/colorpalettesingleton.cpp",
"propertyeditor/colorpalettesingleton.h",
"propertyeditor/colorpalettebackend.cpp",
"propertyeditor/colorpalettebackend.h",
"propertyeditor/designerpropertymap.cpp",
"propertyeditor/designerpropertymap.h",
"propertyeditor/fileresourcesmodel.cpp",

View File

@@ -160,6 +160,14 @@ extend_qtc_executable(qml2puppet
DEFINES IMPORT_QUICK3D_ASSETS
)
find_package(Qt5 5.15.0 COMPONENTS Quick3DParticles QUIET)
extend_qtc_executable(qml2puppet
CONDITION TARGET Qt5::Quick3DParticles
FEATURE_INFO "Qt Quick 3D particles"
DEPENDS Qt5::Quick3DParticles Qt5::Quick3DParticlesPrivate
DEFINES QUICK3D_PARTICLES_MODULE
)
extend_qtc_executable(qml2puppet
CONDITION Qt5_VERSION VERSION_GREATER_EQUAL 6.0.0

View File

@@ -18,11 +18,15 @@ QtcTool {
Depends { name: "Qt.quick3d-private"; required: false }
property bool useQuick3d: Utilities.versionCompare(Qt.core.version, "5.15") >= 0
&& Qt["quick3d-private"].present
property bool useParticle3d: Utilities.versionCompare(Qt.core.version, "6.2") >= 0
&& Qt["quick3dparticles-private"].present
cpp.defines: {
var defines = base.filter(function(d) { return d != "QT_CREATOR"; });
if (useQuick3d)
defines.push("QUICK3D_MODULE");
if (useParticle3d)
defines.push("QUICK3D_PARTICLES_MODULE");
return defines;
}
Properties {

View File

@@ -23,7 +23,10 @@
#
############################################################################
import __builtin__
try:
import __builtin__ # Python 2
except ImportError:
import builtins as __builtin__ # Python 3
# for easier re-usage (because Python hasn't an enum type)
class Targets:

View File

@@ -99,7 +99,7 @@ def __createProjectOrFileSelectType__(category, template, fromWelcome = False, i
def __createProjectSetNameAndPath__(path, projectName = None, checks = True):
directoryEdit = waitForObject("{type='Utils::FancyLineEdit' unnamed='1' visible='1' "
"toolTip?='Full path: *'}")
"toolTip~='Full path: .*'}")
replaceEditorContent(directoryEdit, path)
projectNameEdit = waitForObject("{name='nameLineEdit' visible='1' "
"type='Utils::FancyLineEdit'}")
@@ -177,8 +177,7 @@ def __selectQtVersionDesktop__(checks, available=None, withoutQt4=False):
def __createProjectHandleLastPage__(expectedFiles=[], addToVersionControl="<None>", addToProject=None):
if len(expectedFiles):
summary = waitForObject("{name='filesLabel' text?='<qt>Files to be added in<pre>*</pre>' "
"type='QLabel' visible='1'}").text
summary = waitForObject("{name='filesLabel' type='QLabel'}").text
verifyItemOrder(expectedFiles, summary)
if addToProject:
selectFromCombo(":projectComboBox_QComboBox", addToProject)

View File

@@ -34,7 +34,10 @@ import subprocess;
import sys
import errno;
from datetime import datetime,timedelta;
import __builtin__
try:
import __builtin__ # Python 2
except ImportError:
import builtins as __builtin__ # Python 3
srcPath = ''
SettingsPath = []
@@ -120,7 +123,7 @@ def waitForCleanShutdown(timeOut=10):
while not shutdownDone:
try:
os.kill(appCtxt.pid,0)
except OSError, err:
except OSError as err:
if err.errno == errno.EPERM or err.errno == errno.ESRCH:
shutdownDone=True
if not shutdownDone and datetime.utcnow() > endtime:
@@ -208,7 +211,7 @@ def substituteCdb(settingsDir):
try:
serverIni = readFile(os.path.join(os.getenv("APPDATA"), "froglogic",
"Squish", "ver1", "server.ini"))
autLine = filter(lambda line: "AUT/qtcreator" in line, serverIni.splitlines())[0]
autLine = list(filter(lambda line: "AUT/qtcreator" in line, serverIni.splitlines()))[0]
autPath = autLine.split("\"")[1]
return os.path.exists(os.path.join(autPath, "..", "lib", "qtcreatorcdbext64"))
except:

View File

@@ -23,8 +23,6 @@
#
############################################################################
import __builtin__
# appends to line, by typing <typeWhat> after <insertAfterLine> text into <codeArea> widget
def appendToLine(codeArea, insertAfterLine, typeWhat):
if not placeCursorToLine(codeArea, insertAfterLine):

View File

@@ -23,7 +23,10 @@
#
############################################################################
import urllib2
try:
from urllib2 import ProxyHandler, build_opener, install_opener, urlopen # Python 2
except ImportError:
from urllib.request import ProxyHandler, build_opener, install_opener, urlopen # Python 3
################ workarounds for issues tracked inside jira #################
@@ -43,7 +46,7 @@ class JIRA:
def __init__(self, number, bugType=Bug.CREATOR):
if JIRA.__instance__ == None:
JIRA.__instance__ = JIRA.__impl(number, bugType)
JIRA.__dict__['_JIRA__instance__'] = JIRA.__instance__
setattr(JIRA, '__instance__', JIRA.__instance__)
else:
JIRA.__instance__._bugType = bugType
JIRA.__instance__._number = number
@@ -102,10 +105,10 @@ class JIRA:
proxy = os.getenv("SYSTEST_PROXY", None)
try:
if proxy:
proxy = urllib2.ProxyHandler({'https': proxy})
opener = urllib2.build_opener(proxy)
urllib2.install_opener(opener)
bugReport = urllib2.urlopen('%s/%s' % (JIRA_URL, bug))
proxy = ProxyHandler({'https': proxy})
opener = build_opener(proxy)
install_opener(opener)
bugReport = urlopen('%s/%s' % (JIRA_URL, bug))
data = bugReport.read()
except:
data = self.__tryExternalTools__(proxy)
@@ -118,6 +121,8 @@ class JIRA:
test.fatal("No resolution info for %s" % bug)
self._resolution = 'Done'
else:
if isinstance(data, (bytes)):
data = str(data)
data = data.replace("\r", "").replace("\n", "")
resPattern = re.compile('<span\s+id="resolution-val".*?>(?P<resolution>.*?)</span>')
resolution = resPattern.search(data)

View File

@@ -28,7 +28,7 @@ source("../../shared/qtcreator.py")
# test Qt Creator version information from file and dialog
def getQtCreatorVersionFromDialog():
chk = re.search("(?<=Qt Creator)\s\d+.\d+.\d+[-\w]*",
str(waitForObject("{text?='*Qt Creator*' type='QLabel' unnamed='1' visible='1' "
str(waitForObject("{text~='.*Qt Creator.*' type='QLabel' unnamed='1' visible='1' "
"window=':About Qt Creator_Core::Internal::VersionDialog'}").text))
try:
ver = chk.group(0).strip()

View File

@@ -117,10 +117,12 @@ def performTest(workingDir, projectName, availableConfigs):
% (selfPercent, totalPercent))
if str(model.index(row, colCalls).data()) == "1":
for col in [colMedian, colLongest, colShortest]:
test.compare(model.index(row, colMean).data(), model.index(row, col).data(),
test.compare(str(model.index(row, colMean).data()),
str(model.index(row, col).data()),
"For just one call, no differences in execution time may be shown.")
elif str(model.index(row, colCalls).data()) == "2":
test.compare(model.index(row, colMedian).data(), model.index(row, colMean).data(),
test.compare(str(model.index(row, colMedian).data()),
str(model.index(row, colMean).data()),
"For two calls, median and mean time must be the same.")
progressBarWait(15000, False) # wait for "Build" progressbar to disappear
clickButton(waitForObject(":Analyzer Toolbar.Clear_QToolButton"))

View File

@@ -24,7 +24,6 @@
############################################################################
source("../../shared/qtcreator.py")
import __builtin__
cppEditorStr = ":Qt Creator_CppEditor::Internal::CPPEditorWidget"
originalSources = os.path.abspath(os.path.join(os.getcwd(), "..", "shared", "simplePlainCPP"))

View File

@@ -239,7 +239,7 @@ def main():
clickButton(waitForObject(":*Qt Creator.Clear_QToolButton"))
continue
test.compare(filenameCombo.currentText, "%s: %s" % (protocol, pasteId), "Verify title of editor")
if protocol in (NAME_DPCOM) and pastedText.endswith("\n"):
if protocol in (NAME_DPCOM, NAME_PBCOM) and pastedText.endswith("\n"):
pastedText = pastedText[:-1]
test.compare(editor.plainText, pastedText, "Verify that pasted and fetched texts are the same")