forked from qt-creator/qt-creator
QmlDesigner: Implement visibility for unified render path
If the item is set to invisible we set visible to false in the render and preview puppets. This will have no effect on the value in the property editor. Changing the actual value of visible can have side-effects on the rendering in some rare cases. Task-number: QDS-4932 Change-Id: I5ce0925ebff8f5e4e64bc71fd5d33d6154b85f91 Reviewed-by: Miikka Heikkinen <miikka.heikkinen@qt.io>
This commit is contained in:
@@ -1529,4 +1529,9 @@ void NodeInstanceServer::registerFonts(const QUrl &resourceUrl) const
|
||||
QFontDatabase::addApplicationFont(it.next());
|
||||
}
|
||||
|
||||
bool NodeInstanceServer::isInformationServer() const
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
} // namespace QmlDesigner
|
||||
|
@@ -220,6 +220,8 @@ public:
|
||||
virtual QImage grabWindow() = 0;
|
||||
virtual QImage grabItem(QQuickItem *item) = 0;
|
||||
|
||||
virtual bool isInformationServer() const;
|
||||
|
||||
public slots:
|
||||
void refreshLocalFileProperty(const QString &path);
|
||||
void refreshDummyData(const QString &path);
|
||||
|
@@ -2085,6 +2085,11 @@ void Qt5InformationNodeInstanceServer::handleInstanceHidden(const ServerNodeInst
|
||||
#endif
|
||||
}
|
||||
|
||||
bool Qt5InformationNodeInstanceServer::isInformationServer() const
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
// update 3D view size when it changes in creator side
|
||||
void Qt5InformationNodeInstanceServer::update3DViewState(const Update3dViewStateCommand &command)
|
||||
{
|
||||
|
@@ -75,6 +75,8 @@ public:
|
||||
void handleInstanceLocked(const ServerNodeInstance &instance, bool enable, bool checkAncestors) override;
|
||||
void handleInstanceHidden(const ServerNodeInstance &instance, bool enable, bool checkAncestors) override;
|
||||
|
||||
bool isInformationServer() const override;
|
||||
|
||||
private slots:
|
||||
void handleSelectionChanged(const QVariant &objs);
|
||||
void handleObjectPropertyCommit(const QVariant &objects, const QVariant &propNames);
|
||||
|
@@ -295,6 +295,27 @@ bool QuickItemNodeInstance::unifiedRenderPathOrQt6()
|
||||
#endif
|
||||
}
|
||||
|
||||
void QuickItemNodeInstance::setHiddenInEditor(bool hide)
|
||||
{
|
||||
ObjectNodeInstance::setHiddenInEditor(hide);
|
||||
if (s_unifiedRenderPath && !nodeInstanceServer()->isInformationServer()) {
|
||||
QQmlProperty property(object(), "visible", context());
|
||||
|
||||
if (!property.isValid())
|
||||
return;
|
||||
|
||||
bool visible = property.read().toBool();
|
||||
|
||||
if (hide && visible) {
|
||||
setPropertyVariant("visible", false);
|
||||
m_hidden = true;
|
||||
} else if (!hide && !visible && m_hidden) {
|
||||
setPropertyVariant("visible", true);
|
||||
m_hidden = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
QRectF QuickItemNodeInstance::contentItemBoundingBox() const
|
||||
{
|
||||
if (contentItem()) {
|
||||
|
@@ -106,6 +106,8 @@ public:
|
||||
static bool unifiedRenderPath();
|
||||
static bool unifiedRenderPathOrQt6();
|
||||
|
||||
void setHiddenInEditor(bool b) override;
|
||||
|
||||
protected:
|
||||
explicit QuickItemNodeInstance(QQuickItem*);
|
||||
QQuickItem *quickItem() const;
|
||||
@@ -139,6 +141,7 @@ private: //variables
|
||||
double m_y;
|
||||
double m_width;
|
||||
double m_height;
|
||||
bool m_hidden = false;
|
||||
static bool s_createEffectItem;
|
||||
static bool s_unifiedRenderPath;
|
||||
};
|
||||
|
Reference in New Issue
Block a user