forked from qt-creator/qt-creator
QmlDesigner: Unify texture image providers
Texture editor, material browser, and UrlChooser all had separate texture providers that served nearly identical purpose. Unified all use cases to use same PropertyEditorImageProvider. This provider is asynchronous, which combined with enabling caching on Image elements, significantly improves responsiveness of the material browser UI when there are many textures shown in the browser. Fixes: QDS-8387 Change-Id: I2888aee2f4320dba9456fa046c9ede319673a3d9 Reviewed-by: Mahmoud Badri <mahmoud.badri@qt.io>
This commit is contained in:
@@ -41,8 +41,10 @@ static QString propertyEditorResourcesPath()
|
||||
return Core::ICore::resourcePath("qmldesigner/propertyEditorQmlSources").toString();
|
||||
}
|
||||
|
||||
MaterialBrowserView::MaterialBrowserView(ExternalDependenciesInterface &externalDependencies)
|
||||
MaterialBrowserView::MaterialBrowserView(AsynchronousImageCache &imageCache,
|
||||
ExternalDependenciesInterface &externalDependencies)
|
||||
: AbstractView{externalDependencies}
|
||||
, m_imageCache(imageCache)
|
||||
{
|
||||
m_previewTimer.setSingleShot(true);
|
||||
connect(&m_previewTimer, &QTimer::timeout, this, &MaterialBrowserView::requestPreviews);
|
||||
@@ -59,12 +61,11 @@ bool MaterialBrowserView::hasWidget() const
|
||||
WidgetInfo MaterialBrowserView::widgetInfo()
|
||||
{
|
||||
if (m_widget.isNull()) {
|
||||
m_widget = new MaterialBrowserWidget(this);
|
||||
m_widget = new MaterialBrowserWidget(m_imageCache, this);
|
||||
|
||||
auto matEditorContext = new Internal::MaterialBrowserContext(m_widget.data());
|
||||
Core::ICore::addContextObject(matEditorContext);
|
||||
|
||||
|
||||
// custom notifications below are sent to the MaterialEditor
|
||||
MaterialBrowserModel *matBrowserModel = m_widget->materialBrowserModel().data();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user