diff --git a/share/qtcreator/qmldesigner/statesEditorQmlSources/StatesDelegate.qml b/share/qtcreator/qmldesigner/statesEditorQmlSources/StatesDelegate.qml index 8c5d85af5d8..43c7b3a7c96 100644 --- a/share/qtcreator/qmldesigner/statesEditorQmlSources/StatesDelegate.qml +++ b/share/qtcreator/qmldesigner/statesEditorQmlSources/StatesDelegate.qml @@ -54,7 +54,11 @@ Rectangle { style: ButtonStyle { background: Rectangle { color: control.hovered ? Qt.lighter(baseColor, 1.2) : "transparent" - radius: 2 + Image { + source: "image://icons/close" + height: 16 + width: 16 + } } } @@ -64,7 +68,6 @@ Rectangle { anchors.verticalCenter: stateNameField.verticalCenter height: 16 width: 16 - iconSource: "images/darkclose.png" visible: !isBaseState onClicked: root.deleteState(internalNodeId) diff --git a/share/qtcreator/qmldesigner/statesEditorQmlSources/StatesList.qml b/share/qtcreator/qmldesigner/statesEditorQmlSources/StatesList.qml index 5a67c536c6d..78ee0aab01e 100644 --- a/share/qtcreator/qmldesigner/statesEditorQmlSources/StatesList.qml +++ b/share/qtcreator/qmldesigner/statesEditorQmlSources/StatesList.qml @@ -104,7 +104,6 @@ FocusScope { anchors.verticalCenter: parent.verticalCenter width: Math.max(parent.height / 2 - 8, 18) height: width - iconSource: "images/plus.png" onClicked: root.createNewState() @@ -113,6 +112,13 @@ FocusScope { property color buttonBaseColor: "#6f6f6f" color: control.hovered ? Qt.lighter(buttonBaseColor, 1.2) : buttonBaseColor border.width: 1 + Image { + source: "image://icons/plus" + width: 16 + height: 16 + anchors.centerIn: parent + smooth: false + } } } } diff --git a/share/qtcreator/qmldesigner/statesEditorQmlSources/images/darkclose.png b/share/qtcreator/qmldesigner/statesEditorQmlSources/images/darkclose.png deleted file mode 100644 index 125078a2aea..00000000000 Binary files a/share/qtcreator/qmldesigner/statesEditorQmlSources/images/darkclose.png and /dev/null differ diff --git a/share/qtcreator/qmldesigner/statesEditorQmlSources/images/plus.png b/share/qtcreator/qmldesigner/statesEditorQmlSources/images/plus.png deleted file mode 100644 index d16329ca450..00000000000 Binary files a/share/qtcreator/qmldesigner/statesEditorQmlSources/images/plus.png and /dev/null differ diff --git a/src/plugins/qmldesigner/components/stateseditor/stateeditorsiconprovider.cpp b/src/plugins/qmldesigner/components/stateseditor/stateeditorsiconprovider.cpp new file mode 100644 index 00000000000..c57462409ce --- /dev/null +++ b/src/plugins/qmldesigner/components/stateseditor/stateeditorsiconprovider.cpp @@ -0,0 +1,55 @@ +/**************************************************************************** +** +** Copyright (C) 2016 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. +** +****************************************************************************/ + +#include "stateseditoriconprovider.h" + +#include + +namespace QmlDesigner { + +StatesEditorIconProvider::StatesEditorIconProvider() + : QQuickImageProvider(Pixmap) +{ + +} + +QPixmap StatesEditorIconProvider::requestPixmap(const QString &id, QSize *size, const QSize &requestedSize) +{ + Q_UNUSED(requestedSize) + + QPixmap result; + + if (id == "close") + result = Core::Icons::CLOSE_TOOLBAR.pixmap(); + + else if (id == "plus") + result = Core::Icons::PLUS.pixmap(); + + if (size) + *size = result.size(); + return result; +} + +} // namespace QmlDesigner diff --git a/src/plugins/qmldesigner/components/stateseditor/stateseditor.pri b/src/plugins/qmldesigner/components/stateseditor/stateseditor.pri index 3054479edba..82308af935c 100644 --- a/src/plugins/qmldesigner/components/stateseditor/stateseditor.pri +++ b/src/plugins/qmldesigner/components/stateseditor/stateseditor.pri @@ -5,8 +5,10 @@ VPATH += $$PWD SOURCES += stateseditorwidget.cpp \ stateseditormodel.cpp \ stateseditorview.cpp \ - stateseditorimageprovider.cpp + stateseditorimageprovider.cpp \ + stateeditorsiconprovider.cpp HEADERS += stateseditorwidget.h \ stateseditormodel.h \ stateseditorview.h \ - stateseditorimageprovider.cpp + stateseditorimageprovider.h \ + stateseditoriconprovider.h diff --git a/src/plugins/qmldesigner/components/stateseditor/stateseditoriconprovider.h b/src/plugins/qmldesigner/components/stateseditor/stateseditoriconprovider.h new file mode 100644 index 00000000000..94fddeef0b9 --- /dev/null +++ b/src/plugins/qmldesigner/components/stateseditor/stateseditoriconprovider.h @@ -0,0 +1,39 @@ +/**************************************************************************** +** +** Copyright (C) 2016 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. +** +****************************************************************************/ + +#pragma once + +#include + +namespace QmlDesigner { + +class StatesEditorIconProvider : public QQuickImageProvider +{ +public: + StatesEditorIconProvider(); + QPixmap requestPixmap(const QString &id, QSize *size, const QSize &requestedSize) override; +}; + +} // namespace QmlDesigner diff --git a/src/plugins/qmldesigner/components/stateseditor/stateseditorwidget.cpp b/src/plugins/qmldesigner/components/stateseditor/stateseditorwidget.cpp index 52b4620d9fe..35567e22a16 100644 --- a/src/plugins/qmldesigner/components/stateseditor/stateseditorwidget.cpp +++ b/src/plugins/qmldesigner/components/stateseditor/stateseditorwidget.cpp @@ -27,10 +27,12 @@ #include "stateseditormodel.h" #include "stateseditorview.h" #include "stateseditorimageprovider.h" +#include "stateseditoriconprovider.h" #include #include + #include #include @@ -95,9 +97,10 @@ StatesEditorWidget::StatesEditorWidget(StatesEditorView *statesEditorView, State rootContext()->setContextProperty(QStringLiteral("statesEditorModel"), statesEditorModel); rootContext()->setContextProperty(QStringLiteral("highlightColor"), Utils::StyleHelper::notTooBrightHighlightColor()); - rootContext()->setContextProperty(QLatin1String("canAddNewStates"), true); + engine()->addImageProvider(QLatin1String("icons"), new StatesEditorIconProvider()); + setWindowTitle(tr("States", "Title of Editor widget")); // init the first load of the QML UI elements diff --git a/src/plugins/qmldesigner/qmldesignerplugin.qbs b/src/plugins/qmldesigner/qmldesignerplugin.qbs index 985112938f2..ebe02c8c32b 100644 --- a/src/plugins/qmldesigner/qmldesignerplugin.qbs +++ b/src/plugins/qmldesigner/qmldesignerplugin.qbs @@ -554,6 +554,7 @@ Project { "propertyeditor/qmlmodelnodeproxy.h", "resources/resources.qrc", "stateseditor/stateseditorimageprovider.cpp", + "stateseditor/stateseditoriconprovider.cpp", "stateseditor/stateseditormodel.cpp", "stateseditor/stateseditormodel.h", "stateseditor/stateseditorview.cpp",