forked from qt-creator/qt-creator
QmlDesigner: Make the IconProvider available anywhere
Now the IconProvider can be used in the property editor. Change-Id: Iaaa2674e7dc0955d91f7699090340c4646e723a0 Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
This commit is contained in:
committed by
Alessandro Portale
parent
cdcdde4dc1
commit
bb162b5a77
@@ -13,6 +13,7 @@ SOURCES += selectioncontext.cpp
|
|||||||
SOURCES += designeractionmanager.cpp
|
SOURCES += designeractionmanager.cpp
|
||||||
SOURCES += modelnodeoperations.cpp
|
SOURCES += modelnodeoperations.cpp
|
||||||
SOURCES += crumblebar.cpp
|
SOURCES += crumblebar.cpp
|
||||||
|
SOURCES += qmldesignericonprovider.cpp
|
||||||
|
|
||||||
HEADERS += modelnodecontextmenu.h
|
HEADERS += modelnodecontextmenu.h
|
||||||
HEADERS += theming.h
|
HEADERS += theming.h
|
||||||
@@ -29,6 +30,7 @@ HEADERS += designeractionmanager.h
|
|||||||
HEADERS += modelnodeoperations.h
|
HEADERS += modelnodeoperations.h
|
||||||
HEADERS += actioninterface.h
|
HEADERS += actioninterface.h
|
||||||
HEADERS += crumblebar.h
|
HEADERS += crumblebar.h
|
||||||
|
HEADERS += qmldesignericonprovider.h
|
||||||
|
|
||||||
FORMS += \
|
FORMS += \
|
||||||
$$PWD/addsignalhandlerdialog.ui
|
$$PWD/addsignalhandlerdialog.ui
|
||||||
|
@@ -23,19 +23,19 @@
|
|||||||
**
|
**
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
#include "stateseditoriconprovider.h"
|
#include "qmldesignericonprovider.h"
|
||||||
|
|
||||||
#include <coreplugin/coreicons.h>
|
#include <coreplugin/coreicons.h>
|
||||||
|
|
||||||
namespace QmlDesigner {
|
namespace QmlDesigner {
|
||||||
|
|
||||||
StatesEditorIconProvider::StatesEditorIconProvider()
|
QmlDesignerIconProvider::QmlDesignerIconProvider()
|
||||||
: QQuickImageProvider(Pixmap)
|
: QQuickImageProvider(Pixmap)
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
QPixmap StatesEditorIconProvider::requestPixmap(const QString &id, QSize *size, const QSize &requestedSize)
|
QPixmap QmlDesignerIconProvider::requestPixmap(const QString &id, QSize *size, const QSize &requestedSize)
|
||||||
{
|
{
|
||||||
Q_UNUSED(requestedSize)
|
Q_UNUSED(requestedSize)
|
||||||
|
|
@@ -29,10 +29,10 @@
|
|||||||
|
|
||||||
namespace QmlDesigner {
|
namespace QmlDesigner {
|
||||||
|
|
||||||
class StatesEditorIconProvider : public QQuickImageProvider
|
class QmlDesignerIconProvider : public QQuickImageProvider
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
StatesEditorIconProvider();
|
QmlDesignerIconProvider();
|
||||||
QPixmap requestPixmap(const QString &id, QSize *size, const QSize &requestedSize) override;
|
QPixmap requestPixmap(const QString &id, QSize *size, const QSize &requestedSize) override;
|
||||||
};
|
};
|
||||||
|
|
@@ -24,6 +24,7 @@
|
|||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
#include "theming.h"
|
#include "theming.h"
|
||||||
|
#include "qmldesignericonprovider.h"
|
||||||
|
|
||||||
#include <utils/theme/theme.h>
|
#include <utils/theme/theme.h>
|
||||||
|
|
||||||
@@ -87,4 +88,9 @@ QString Theming::replaceCssColors(const QString &input)
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Theming::registerIconProvider(QQmlEngine *engine)
|
||||||
|
{
|
||||||
|
engine->addImageProvider(QLatin1String("icons"), new QmlDesignerIconProvider());
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace QmlDesigner
|
} // namespace QmlDesigner
|
||||||
|
@@ -25,6 +25,7 @@
|
|||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
#include <QQmlEngine>
|
||||||
#include <QQmlPropertyMap>
|
#include <QQmlPropertyMap>
|
||||||
|
|
||||||
namespace QmlDesigner {
|
namespace QmlDesigner {
|
||||||
@@ -34,6 +35,7 @@ class Theming
|
|||||||
public:
|
public:
|
||||||
static void insertTheme(QQmlPropertyMap *map);
|
static void insertTheme(QQmlPropertyMap *map);
|
||||||
static QString replaceCssColors(const QString &input);
|
static QString replaceCssColors(const QString &input);
|
||||||
|
static void registerIconProvider(QQmlEngine *engine);
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace QmlDesigner
|
} // namespace QmlDesigner
|
||||||
|
@@ -29,6 +29,7 @@
|
|||||||
#include "fileresourcesmodel.h"
|
#include "fileresourcesmodel.h"
|
||||||
#include "gradientmodel.h"
|
#include "gradientmodel.h"
|
||||||
#include "qmlanchorbindingproxy.h"
|
#include "qmlanchorbindingproxy.h"
|
||||||
|
#include "theming.h"
|
||||||
|
|
||||||
namespace QmlDesigner {
|
namespace QmlDesigner {
|
||||||
|
|
||||||
@@ -36,6 +37,7 @@ Quick2PropertyEditorView::Quick2PropertyEditorView(QWidget *parent) :
|
|||||||
QQuickWidget(parent)
|
QQuickWidget(parent)
|
||||||
{
|
{
|
||||||
setResizeMode(QQuickWidget::SizeRootObjectToView);
|
setResizeMode(QQuickWidget::SizeRootObjectToView);
|
||||||
|
Theming::registerIconProvider(engine());
|
||||||
}
|
}
|
||||||
|
|
||||||
void Quick2PropertyEditorView::registerQmlTypes()
|
void Quick2PropertyEditorView::registerQmlTypes()
|
||||||
|
@@ -5,10 +5,9 @@ VPATH += $$PWD
|
|||||||
SOURCES += stateseditorwidget.cpp \
|
SOURCES += stateseditorwidget.cpp \
|
||||||
stateseditormodel.cpp \
|
stateseditormodel.cpp \
|
||||||
stateseditorview.cpp \
|
stateseditorview.cpp \
|
||||||
stateseditorimageprovider.cpp \
|
stateseditorimageprovider.cpp
|
||||||
stateeditorsiconprovider.cpp
|
|
||||||
HEADERS += stateseditorwidget.h \
|
HEADERS += stateseditorwidget.h \
|
||||||
stateseditormodel.h \
|
stateseditormodel.h \
|
||||||
stateseditorview.h \
|
stateseditorview.h \
|
||||||
stateseditorimageprovider.h \
|
stateseditorimageprovider.h
|
||||||
stateseditoriconprovider.h
|
|
||||||
|
@@ -27,7 +27,6 @@
|
|||||||
#include "stateseditormodel.h"
|
#include "stateseditormodel.h"
|
||||||
#include "stateseditorview.h"
|
#include "stateseditorview.h"
|
||||||
#include "stateseditorimageprovider.h"
|
#include "stateseditorimageprovider.h"
|
||||||
#include "stateseditoriconprovider.h"
|
|
||||||
|
|
||||||
#include <theming.h>
|
#include <theming.h>
|
||||||
|
|
||||||
@@ -104,7 +103,7 @@ StatesEditorWidget::StatesEditorWidget(StatesEditorView *statesEditorView, State
|
|||||||
Theming::insertTheme(&m_themeProperties);
|
Theming::insertTheme(&m_themeProperties);
|
||||||
rootContext()->setContextProperty(QLatin1String("creatorTheme"), &m_themeProperties);
|
rootContext()->setContextProperty(QLatin1String("creatorTheme"), &m_themeProperties);
|
||||||
|
|
||||||
engine()->addImageProvider(QLatin1String("icons"), new StatesEditorIconProvider());
|
Theming::registerIconProvider(engine());
|
||||||
|
|
||||||
setWindowTitle(tr("States", "Title of Editor widget"));
|
setWindowTitle(tr("States", "Title of Editor widget"));
|
||||||
|
|
||||||
|
@@ -391,6 +391,8 @@ Project {
|
|||||||
"componentcore/modelnodeoperations.h",
|
"componentcore/modelnodeoperations.h",
|
||||||
"componentcore/selectioncontext.cpp",
|
"componentcore/selectioncontext.cpp",
|
||||||
"componentcore/selectioncontext.h",
|
"componentcore/selectioncontext.h",
|
||||||
|
"componentcore/qmldesignericonprovider.cpp",
|
||||||
|
"componentcore/qmldesignericonprovider.h",
|
||||||
"debugview/debugview.cpp",
|
"debugview/debugview.cpp",
|
||||||
"debugview/debugview.h",
|
"debugview/debugview.h",
|
||||||
"debugview/debugviewwidget.cpp",
|
"debugview/debugviewwidget.cpp",
|
||||||
@@ -557,8 +559,6 @@ Project {
|
|||||||
"resources/resources.qrc",
|
"resources/resources.qrc",
|
||||||
"stateseditor/stateseditorimageprovider.cpp",
|
"stateseditor/stateseditorimageprovider.cpp",
|
||||||
"stateseditor/stateseditorimageprovider.h",
|
"stateseditor/stateseditorimageprovider.h",
|
||||||
"stateseditor/stateeditorsiconprovider.cpp",
|
|
||||||
"stateseditor/stateseditoriconprovider.h",
|
|
||||||
"stateseditor/stateseditormodel.cpp",
|
"stateseditor/stateseditormodel.cpp",
|
||||||
"stateseditor/stateseditormodel.h",
|
"stateseditor/stateseditormodel.h",
|
||||||
"stateseditor/stateseditorview.cpp",
|
"stateseditor/stateseditorview.cpp",
|
||||||
|
Reference in New Issue
Block a user