aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/qmldesigner/components/formeditor/formeditoritem.cpp
diff options
context:
space:
mode:
authorThomas Hartmann <thomas.hartmann@qt.io>2017-02-09 17:31:36 +0100
committerThomas Hartmann <thomas.hartmann@qt.io>2017-02-13 16:33:50 +0000
commit6459fbb9839b10090668d170d46ee31fc6aac883 (patch)
treee16ebbe29c9461eed44a320bdf61342995d3f3a7 /src/plugins/qmldesigner/components/formeditor/formeditoritem.cpp
parentfb14b4a6c86abc920eeecfa3abdd4c94d9d89853 (diff)
QmlDesigner: Refine painting of place holder
Generally painting the place holder for invisble items makes sense. The logic is different for items stacked containers, since those are overlapping and we are only interested in the current visible one. Also it does not make sense to paint the placeholder if already the parent is invisible, since this just creates noise. The logic is now more complex, but the usabilty increases significantly. Change-Id: Ia25f2877c79cace475f0b99fd11ebd242c96e4bb Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
Diffstat (limited to 'src/plugins/qmldesigner/components/formeditor/formeditoritem.cpp')
-rw-r--r--src/plugins/qmldesigner/components/formeditor/formeditoritem.cpp28
1 files changed, 20 insertions, 8 deletions
diff --git a/src/plugins/qmldesigner/components/formeditor/formeditoritem.cpp b/src/plugins/qmldesigner/components/formeditor/formeditoritem.cpp
index 74529328be..445eac1266 100644
--- a/src/plugins/qmldesigner/components/formeditor/formeditoritem.cpp
+++ b/src/plugins/qmldesigner/components/formeditor/formeditoritem.cpp
@@ -327,14 +327,26 @@ void FormEditorItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *,
painter->save();
- if (qmlItemNode().instanceIsRenderPixmapNull() || !isContentVisible()) {
- if (scene()->showBoundingRects() && m_boundingRect.width() > 15 && m_boundingRect.height() > 15)
- paintPlaceHolderForInvisbleItem(painter);
- } else {
- if (m_blurContent)
- painter->drawPixmap(m_paintedBoundingRect.topLeft(), qmlItemNode().instanceBlurredRenderPixmap());
- else
- painter->drawPixmap(m_paintedBoundingRect.topLeft(), qmlItemNode().instanceRenderPixmap());
+ bool showPlaceHolder = qmlItemNode().instanceIsRenderPixmapNull() || !isContentVisible();
+
+ const bool isInStackedContainer = qmlItemNode().isInStackedContainer();
+
+ /* If already the parent is invisible then show nothing */
+ const bool hideCompletely = !isContentVisible() && (parentItem() && !parentItem()->isContentVisible());
+
+ if (isInStackedContainer)
+ showPlaceHolder = qmlItemNode().instanceIsRenderPixmapNull() && isContentVisible();
+
+ if (!hideCompletely) {
+ if (showPlaceHolder) {
+ if (scene()->showBoundingRects() && m_boundingRect.width() > 15 && m_boundingRect.height() > 15)
+ paintPlaceHolderForInvisbleItem(painter);
+ } else if (!isInStackedContainer || isContentVisible() ) {
+ if (m_blurContent)
+ painter->drawPixmap(m_paintedBoundingRect.topLeft(), qmlItemNode().instanceBlurredRenderPixmap());
+ else
+ painter->drawPixmap(m_paintedBoundingRect.topLeft(), qmlItemNode().instanceRenderPixmap());
+ }
}
if (!qmlItemNode().isRootModelNode())