forked from qt-creator/qt-creator
QmlDesigner: Refactor library icon generation for imported 3D assets
Previously, icon generation was done at import time, but that was wasteful, as we now have image cache backed icon generation available for component library icons. Added the few remaining missing bits to support icon generation for image cache and disabled the old icon generation implementation for Qt6. A few issues in fit algorithm for preview image generation were also uncovered and fixed to make icons render scene in comparable size to the old version. Qt5 imports still generate using old way since component library 3D previews generation doesn't work on Qt5. Fixes: QDS-6205 Change-Id: I5418fa19d86e81adcd184be023f1dfbc813d0bf5 Reviewed-by: Mahmoud Badri <mahmoud.badri@qt.io> Reviewed-by: <github-actions-qt-creator@cristianadam.eu> Reviewed-by: Samuel Ghinet <samuel.ghinet@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
This commit is contained in:
@@ -57,6 +57,9 @@ void Quick3DRenderableNodeInstance::initialize(const ObjectNodeInstance::Pointer
|
||||
// In case this is the scene root, we need to create a dummy View3D for the scene
|
||||
// in preview puppets
|
||||
if (instanceId() == 0 && (!nodeInstanceServer()->isInformationServer())) {
|
||||
nodeInstanceServer()->quickWindow()->setDefaultAlphaBuffer(true);
|
||||
nodeInstanceServer()->quickWindow()->setColor(Qt::transparent);
|
||||
|
||||
auto helper = new QmlDesigner::Internal::GeneralHelper();
|
||||
engine()->rootContext()->setContextProperty("_generalHelper", helper);
|
||||
|
||||
@@ -199,6 +202,14 @@ QQuickItem *Quick3DRenderableNodeInstance::contentItem() const
|
||||
return m_dummyRootView;
|
||||
}
|
||||
|
||||
void Quick3DRenderableNodeInstance::setPropertyVariant(const PropertyName &name,
|
||||
const QVariant &value)
|
||||
{
|
||||
if (m_dummyRootView && name == "isLibraryIcon")
|
||||
QMetaObject::invokeMethod(m_dummyRootView, "setIconMode", Q_ARG(QVariant, value));
|
||||
ObjectNodeInstance::setPropertyVariant(name, value);
|
||||
}
|
||||
|
||||
Qt5NodeInstanceServer *Quick3DRenderableNodeInstance::qt5NodeInstanceServer() const
|
||||
{
|
||||
return qobject_cast<Qt5NodeInstanceServer *>(nodeInstanceServer());
|
||||
|
||||
Reference in New Issue
Block a user