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

This commit is contained in:
Vadim Kurland
2011-06-05 18:55:50 -07:00
parent d9cd33f28b
commit c171994c82
2 changed files with 21 additions and 16 deletions
+21 -11
View File
@@ -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<ColDesc>();
if (fwosm->selectedObject!=NULL)
{
QCoreApplication::postEvent(
mw,
new showObjectInTreeEvent(
project->getFileName(), fwosm->selectedObject->getId()));
// ColDesc colDesc = index.data(Qt::UserRole).value<ColDesc>();
// 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<ColDesc>();
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);
}
-5
View File
@@ -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);