mirror of
https://github.com/fwbuilder/fwbuilder
synced 2026-03-20 02:07:23 +01:00
see #1895 added context menu item Expand/Collapse
This commit is contained in:
parent
5e099e5c97
commit
da2c04e6f4
@ -1,5 +1,16 @@
|
|||||||
2011-02-12 vadim <vadim@netcitadel.com>
|
2011-02-12 vadim <vadim@netcitadel.com>
|
||||||
|
|
||||||
|
* ObjectManipulator_tree_ops.cpp (expandOrCollapseCurrentTreeNode):
|
||||||
|
fixes #1895 "Add context menu option to expand all child nodes in
|
||||||
|
object tree". Added menu item "Expand" to the context menu
|
||||||
|
associated with all objects in the object tree. This item recursively
|
||||||
|
expands all tree nodes under the given object and automatically
|
||||||
|
changes to "Collapse" if the item is expanded. Also changed behavior
|
||||||
|
of the double click on the object in tree: before, double click
|
||||||
|
opened object in the editor and expanded or collapsed subtree. Now
|
||||||
|
it only opens object in the editor but does not expand/collapse
|
||||||
|
subtree.
|
||||||
|
|
||||||
* fixes #2083 Added new services to the Standard Objects Library:
|
* fixes #2083 Added new services to the Standard Objects Library:
|
||||||
rtmp, xmpp-client, xmpp-server, nrpe
|
rtmp, xmpp-client, xmpp-server, nrpe
|
||||||
|
|
||||||
|
|||||||
@ -363,6 +363,17 @@ void ObjectManipulator::contextMenuRequested(const QPoint &pos)
|
|||||||
|
|
||||||
popup_menu->clear();
|
popup_menu->clear();
|
||||||
|
|
||||||
|
if (item->childCount() > 0)
|
||||||
|
{
|
||||||
|
if (item->isExpanded())
|
||||||
|
popup_menu->addAction(tr("Collapse"), this,
|
||||||
|
SLOT(collapseCurrentTreeNode()));
|
||||||
|
else
|
||||||
|
popup_menu->addAction(tr("Expand"), this,
|
||||||
|
SLOT(expandCurrentTreeNode()));
|
||||||
|
popup_menu->addSeparator();
|
||||||
|
}
|
||||||
|
|
||||||
QAction *edtID;
|
QAction *edtID;
|
||||||
|
|
||||||
if (currentObj->isReadOnly())
|
if (currentObj->isReadOnly())
|
||||||
@ -1245,10 +1256,9 @@ void ObjectManipulator::showObjectInTree(ObjectTreeViewItem *otvi)
|
|||||||
m_objectManipulator->widgetStack->setCurrentWidget(otv);
|
m_objectManipulator->widgetStack->setCurrentWidget(otv);
|
||||||
|
|
||||||
otvi->getTree()->clearSelection();
|
otvi->getTree()->clearSelection();
|
||||||
otvi->getTree()->scrollToItem(otvi,
|
otvi->getTree()->scrollToItem(otvi, QAbstractItemView::PositionAtTop);
|
||||||
QAbstractItemView::PositionAtTop); // QAbstractItemView::EnsureVisible );
|
otvi->getTree()->setCurrentItem(otvi);
|
||||||
otvi->getTree()->setCurrentItem( otvi );
|
otvi->setSelected(true);
|
||||||
otvi->setSelected( true );
|
|
||||||
otvi->getTree()->setFocus(Qt::OtherFocusReason);
|
otvi->getTree()->setFocus(Qt::OtherFocusReason);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1259,13 +1269,8 @@ void ObjectManipulator::expandObjectInTree(FWObject *obj)
|
|||||||
|
|
||||||
QTreeWidgetItem *it = allItems[o];
|
QTreeWidgetItem *it = allItems[o];
|
||||||
if (it==NULL) return;
|
if (it==NULL) return;
|
||||||
it->setExpanded(true);
|
|
||||||
|
|
||||||
for (list<FWObject*>::iterator i=o->begin(); i!=o->end(); ++i)
|
expandOrCollapseCurrentTreeNode(it, true);
|
||||||
{
|
|
||||||
FWObject *o1 = *i;
|
|
||||||
if (o1 && o1->size() > 0) expandObjectInTree(o1);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void ObjectManipulator::libChangedById(int obj_id)
|
void ObjectManipulator::libChangedById(int obj_id)
|
||||||
|
|||||||
@ -132,6 +132,8 @@ class ObjectManipulator : public QWidget
|
|||||||
|
|
||||||
void makeNameUnique(libfwbuilder::FWObject* p,libfwbuilder::FWObject* obj);
|
void makeNameUnique(libfwbuilder::FWObject* p,libfwbuilder::FWObject* obj);
|
||||||
|
|
||||||
|
void expandOrCollapseCurrentTreeNode(QTreeWidgetItem*, bool);
|
||||||
|
|
||||||
/* find the name of the interface that was created last */
|
/* find the name of the interface that was created last */
|
||||||
QString findNewestInterfaceName(libfwbuilder::FWObject *parent);
|
QString findNewestInterfaceName(libfwbuilder::FWObject *parent);
|
||||||
|
|
||||||
@ -177,6 +179,9 @@ public slots:
|
|||||||
virtual void switchingTrees(QWidget* w);
|
virtual void switchingTrees(QWidget* w);
|
||||||
virtual void currentTreePageChanged(int i);
|
virtual void currentTreePageChanged(int i);
|
||||||
|
|
||||||
|
void expandCurrentTreeNode();
|
||||||
|
void collapseCurrentTreeNode();
|
||||||
|
|
||||||
void newClusterFromSelected();
|
void newClusterFromSelected();
|
||||||
|
|
||||||
void selectionChanged(QTreeWidgetItem *cur);
|
void selectionChanged(QTreeWidgetItem *cur);
|
||||||
|
|||||||
@ -171,6 +171,29 @@ QString ObjectManipulator::getTreeLabel(FWObject *obj, int col)
|
|||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ObjectManipulator::expandOrCollapseCurrentTreeNode(QTreeWidgetItem *item,
|
||||||
|
bool expand)
|
||||||
|
{
|
||||||
|
item->setExpanded(expand);
|
||||||
|
for (int i=0; i<item->childCount(); ++i)
|
||||||
|
expandOrCollapseCurrentTreeNode(item->child(i), expand);
|
||||||
|
}
|
||||||
|
|
||||||
|
void ObjectManipulator::expandCurrentTreeNode()
|
||||||
|
{
|
||||||
|
if (getCurrentObjectTree()->getNumSelected()==0) return;
|
||||||
|
QTreeWidgetItem *item = getCurrentObjectTree()->currentItem();
|
||||||
|
expandOrCollapseCurrentTreeNode(item, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
void ObjectManipulator::collapseCurrentTreeNode()
|
||||||
|
{
|
||||||
|
if (getCurrentObjectTree()->getNumSelected()==0) return;
|
||||||
|
QTreeWidgetItem *item = getCurrentObjectTree()->currentItem();
|
||||||
|
expandOrCollapseCurrentTreeNode(item, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
ObjectTreeViewItem* ObjectManipulator::insertObject(ObjectTreeViewItem *itm,
|
ObjectTreeViewItem* ObjectManipulator::insertObject(ObjectTreeViewItem *itm,
|
||||||
FWObject *obj)
|
FWObject *obj)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -83,6 +83,9 @@ ObjectTreeView::ObjectTreeView(ProjectPanel* project,
|
|||||||
setObjectName(name);
|
setObjectName(name);
|
||||||
this->setParent(parent, f);
|
this->setParent(parent, f);
|
||||||
setFont(st->getTreeFont());
|
setFont(st->getTreeFont());
|
||||||
|
|
||||||
|
setExpandsOnDoubleClick(false);
|
||||||
|
|
||||||
// setAcceptDrops( TRUE );
|
// setAcceptDrops( TRUE );
|
||||||
item_before_drag_started=NULL;
|
item_before_drag_started=NULL;
|
||||||
lastSelected = NULL;
|
lastSelected = NULL;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user