From c171994c82a080deaf524bcf1c406a762b1cd089 Mon Sep 17 00:00:00 2001 From: Vadim Kurland Date: Sun, 5 Jun 2011 18:55:50 -0700 Subject: [PATCH] see #2454 double click or keypress Enter on object "any" shows editor with our special comment but does not switch obejct tree to the "Standard objects" library; also made the tree switch to the right library both when user double clicks or hits Enter --- src/libgui/RuleSetView.cpp | 32 ++++++++++++++++++++---------- src/libgui/RuleSetViewDelegate.cpp | 5 ----- 2 files changed, 21 insertions(+), 16 deletions(-) diff --git a/src/libgui/RuleSetView.cpp b/src/libgui/RuleSetView.cpp index 12a7a6d6e..ce4dba0ba 100644 --- a/src/libgui/RuleSetView.cpp +++ b/src/libgui/RuleSetView.cpp @@ -401,8 +401,6 @@ int RuleSetView::getColByType(ColDesc::ColumnType type) const void RuleSetView::mousePressEvent( QMouseEvent* ev ) { - if (fwbdebug) qDebug() << "RuleSetView::mousePressEvent"; - //TODO: provide custom implementation of QTreeView::mousePressEvent( ev ); for column != 0 QTreeView::mousePressEvent( ev ); @@ -883,16 +881,15 @@ void RuleSetView::itemDoubleClicked(const QModelIndex& index) if (!index.isValid()) return; if (index.row()<0) return; - ColDesc colDesc = index.data(Qt::UserRole).value(); - - if (fwosm->selectedObject!=NULL) - { - QCoreApplication::postEvent( - mw, - new showObjectInTreeEvent( - project->getFileName(), fwosm->selectedObject->getId())); + // ColDesc colDesc = index.data(Qt::UserRole).value(); + // if (fwosm->selectedObject!=NULL) + // { + // QCoreApplication::postEvent( + // mw, + // new showObjectInTreeEvent( + // project->getFileName(), fwosm->selectedObject->getId())); + // } - } editSelected(index); } @@ -901,6 +898,19 @@ void RuleSetView::editSelected(const QModelIndex& index) ColDesc colDesc = index.data(Qt::UserRole).value(); FWObject *obj = fwosm->selectedObject; + // see #2454 -- we do not want to switch object tree view to the standard + // objects library when user double clicks on object "any" + if (obj != NULL && + (obj->getId() != FWObjectDatabase::ANY_ADDRESS_ID && + obj->getId() != FWObjectDatabase::ANY_SERVICE_ID && + obj->getId() != FWObjectDatabase::ANY_INTERVAL_ID)) + { + QCoreApplication::postEvent( + mw, + new showObjectInTreeEvent( + project->getFileName(), fwosm->selectedObject->getId())); + } + if (!mw->isEditorVisible()) mw->showEditor(); switchObjectInEditor(index); } diff --git a/src/libgui/RuleSetViewDelegate.cpp b/src/libgui/RuleSetViewDelegate.cpp index 1e59b0a37..300505b19 100644 --- a/src/libgui/RuleSetViewDelegate.cpp +++ b/src/libgui/RuleSetViewDelegate.cpp @@ -293,11 +293,6 @@ void RuleSetViewDelegate::paintOptions( { DrawingContext ctx = initContext(option.rect, true); // useEnireSpace=true - if (fwbdebug) - qDebug() << "RuleSetViewDelegate::paintOptions" - << "option.rect=" << option.rect - << "ctx.objectRect=" << ctx.objectRect; - if (option.state & QStyle::State_Selected) drawSelectedFocus(painter, option, ctx.objectRect);