From 904ee4b5178ea1b85b391a81e61d04c6eeaa1975 Mon Sep 17 00:00:00 2001 From: Christiaan Janssen <christiaan.janssen@nokia.com> Date: Thu, 18 Feb 2010 13:38:32 +0100 Subject: [PATCH] QmlDesigner.Navigator: Root item cannot be hidden --- .../components/navigator/navigatortreemodel.cpp | 3 +++ .../components/navigator/navigatortreeview.cpp | 16 +++++++++------- 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/src/plugins/qmldesigner/components/navigator/navigatortreemodel.cpp b/src/plugins/qmldesigner/components/navigator/navigatortreemodel.cpp index 654b05a8b77..f01763bb674 100644 --- a/src/plugins/qmldesigner/components/navigator/navigatortreemodel.cpp +++ b/src/plugins/qmldesigner/components/navigator/navigatortreemodel.cpp @@ -208,6 +208,9 @@ NavigatorTreeModel::ItemRow NavigatorTreeModel::createItemRow(const ModelNode &n visibilityItem->setCheckable(true); visibilityItem->setEditable(false); visibilityItem->setData(hash, Qt::UserRole); + if (node.isRootNode()) { + visibilityItem->setEnabled(false); + } #ifdef _LOCK_ITEMS_ return ItemRow(idItem, lockItem, visibilityItem); diff --git a/src/plugins/qmldesigner/components/navigator/navigatortreeview.cpp b/src/plugins/qmldesigner/components/navigator/navigatortreeview.cpp index c319a4176cb..6338c5c2784 100644 --- a/src/plugins/qmldesigner/components/navigator/navigatortreeview.cpp +++ b/src/plugins/qmldesigner/components/navigator/navigatortreeview.cpp @@ -108,16 +108,18 @@ void IconCheckboxItemDelegate::paint(QPainter *painter, if (option.state & QStyle::State_Selected) drawSelectionBackground(painter, option); - bool isChecked= (m_TreeModel->itemFromIndex(index)->checkState() == Qt::Checked); + if (!m_TreeModel->nodeForIndex(index).isRootNode()) { - if (m_TreeModel->isNodeInvisible( index )) - painter->setOpacity(0.5); + bool isChecked= (m_TreeModel->itemFromIndex(index)->checkState() == Qt::Checked); - if (isChecked) - painter->drawPixmap(option.rect.x()+2,option.rect.y()+5,onPix); - else - painter->drawPixmap(option.rect.x()+2,option.rect.y()+5,offPix); + if (m_TreeModel->isNodeInvisible( index )) + painter->setOpacity(0.5); + if (isChecked) + painter->drawPixmap(option.rect.x()+2,option.rect.y()+5,onPix); + else + painter->drawPixmap(option.rect.x()+2,option.rect.y()+5,offPix); + } painter->restore(); } -- GitLab