From 3f2635330783ff73011aa40f78567c8b81082622 Mon Sep 17 00:00:00 2001 From: Ilia Ryabokon Date: Thu, 23 Aug 2012 15:45:05 +0300 Subject: [PATCH 1/2] Sankore-958 Hide groups on extended screen --- src/domain/UBGraphicsItemDelegate.cpp | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/src/domain/UBGraphicsItemDelegate.cpp b/src/domain/UBGraphicsItemDelegate.cpp index 962121a9..b75b6521 100644 --- a/src/domain/UBGraphicsItemDelegate.cpp +++ b/src/domain/UBGraphicsItemDelegate.cpp @@ -474,15 +474,21 @@ void UBGraphicsItemDelegate::lock(bool locked) void UBGraphicsItemDelegate::showHide(bool show) { - if (show) - { + if (show) { mDelegated->setData(UBGraphicsItemData::ItemLayerType, QVariant(UBItemLayerType::Object)); - } - else - { + if (mDelegated->childItems().count()) { + foreach (QGraphicsItem *item, mDelegated->childItems()) { + item->setData(UBGraphicsItemData::ItemLayerType, QVariant(UBItemLayerType::Object)); + } + } + } else { mDelegated->setData(UBGraphicsItemData::ItemLayerType, QVariant(UBItemLayerType::Control)); + if (mDelegated->childItems().count()) { + foreach (QGraphicsItem *item, mDelegated->childItems()) { + item->setData(UBGraphicsItemData::ItemLayerType, QVariant(UBItemLayerType::Control)); + } + } } - mDelegated->update(); emit showOnDisplayChanged(show); From 36fd3243a7b13455a29c44f1020929abe04c6c4f Mon Sep 17 00:00:00 2001 From: Ilia Ryabokon Date: Thu, 23 Aug 2012 16:37:06 +0300 Subject: [PATCH 2/2] Sankore-958 recursive fix --- src/domain/UBGraphicsItemDelegate.cpp | 24 +++++++++--------------- src/domain/UBGraphicsItemDelegate.h | 1 + 2 files changed, 10 insertions(+), 15 deletions(-) diff --git a/src/domain/UBGraphicsItemDelegate.cpp b/src/domain/UBGraphicsItemDelegate.cpp index b75b6521..b6ec5868 100644 --- a/src/domain/UBGraphicsItemDelegate.cpp +++ b/src/domain/UBGraphicsItemDelegate.cpp @@ -471,24 +471,18 @@ void UBGraphicsItemDelegate::lock(bool locked) mFrame->positionHandles(); } +void UBGraphicsItemDelegate::showHideRecurs(const QVariant &pShow, QGraphicsItem *pItem) +{ + pItem->setData(UBGraphicsItemData::ItemLayerType, pShow); + foreach (QGraphicsItem *insideItem, pItem->childItems()) { + showHideRecurs(pShow, insideItem); + } +} void UBGraphicsItemDelegate::showHide(bool show) { - if (show) { - mDelegated->setData(UBGraphicsItemData::ItemLayerType, QVariant(UBItemLayerType::Object)); - if (mDelegated->childItems().count()) { - foreach (QGraphicsItem *item, mDelegated->childItems()) { - item->setData(UBGraphicsItemData::ItemLayerType, QVariant(UBItemLayerType::Object)); - } - } - } else { - mDelegated->setData(UBGraphicsItemData::ItemLayerType, QVariant(UBItemLayerType::Control)); - if (mDelegated->childItems().count()) { - foreach (QGraphicsItem *item, mDelegated->childItems()) { - item->setData(UBGraphicsItemData::ItemLayerType, QVariant(UBItemLayerType::Control)); - } - } - } + QVariant showFlag = QVariant(show ? UBItemLayerType::Object : UBItemLayerType::Control); + showHideRecurs(showFlag, mDelegated); mDelegated->update(); emit showOnDisplayChanged(show); diff --git a/src/domain/UBGraphicsItemDelegate.h b/src/domain/UBGraphicsItemDelegate.h index fc5c460c..099dd06d 100644 --- a/src/domain/UBGraphicsItemDelegate.h +++ b/src/domain/UBGraphicsItemDelegate.h @@ -297,6 +297,7 @@ protected slots: private: void updateFrame(); void updateButtons(bool showUpdated = false); + inline void showHideRecurs(const QVariant &pShow, QGraphicsItem *pItem); QPointF mOffset; QTransform mPreviousTransform;