diff options
author | Gerald Combs <gerald@wireshark.org> | 2012-08-14 16:35:52 +0000 |
---|---|---|
committer | Gerald Combs <gerald@wireshark.org> | 2012-08-14 16:35:52 +0000 |
commit | fab29eea8d1f01535c78d6bf24e8dceb78282efd (patch) | |
tree | 181c084bdc3a08d34f95a050be0052551f836124 /ui/qt/proto_tree.cpp | |
parent | 41082851795afd9709b77d2d07a76a6d03c1833f (diff) |
Properly enable and disable "View/Expand Subtrees". Get rid
of ProtoTree::protoItemUnselected and use an empty string in
protoItemSelected to indicate that nothing is selected.
svn path=/trunk/; revision=44492
Diffstat (limited to 'ui/qt/proto_tree.cpp')
-rw-r--r-- | ui/qt/proto_tree.cpp | 33 |
1 files changed, 26 insertions, 7 deletions
diff --git a/ui/qt/proto_tree.cpp b/ui/qt/proto_tree.cpp index c4cffaae83..197ebc5e0f 100644 --- a/ui/qt/proto_tree.cpp +++ b/ui/qt/proto_tree.cpp @@ -190,8 +190,10 @@ void ProtoTree::updateSelectionStatus(QTreeWidgetItem* item) { itemInfo.append(QString(tr(", %1 bytes")).arg(finfo_length)); } - emit protoItemUnselected(); + emit protoItemSelected(QString()); + emit protoItemSelected(false); emit protoItemSelected(itemInfo); + emit protoItemSelected(true); } // else the GTK+ version pushes an empty string as described below. /* * Don't show anything if the field name is zero-length; @@ -214,7 +216,8 @@ void ProtoTree::updateSelectionStatus(QTreeWidgetItem* item) { */ } else { - emit protoItemUnselected(); + emit protoItemSelected(QString()); + emit protoItemSelected(false); } } @@ -224,12 +227,28 @@ void ProtoTree::expandSubtrees() { QTreeWidgetItem *topSel; - foreach(topSel, selectedItems()) { - QTreeWidgetItemIterator iter(topSel); - while (*iter) { - (*iter)->setExpanded(true); - iter++; + if (selectedItems().length() < 1) { + return; + } + + topSel = selectedItems()[0]; + + if (!topSel) { + return; + } + + while (topSel->parent()) { + topSel = topSel->parent(); + } + + QTreeWidgetItemIterator iter(topSel); + while (*iter) { + if ((*iter) != topSel && (*iter)->parent() == NULL) { + // We found the next top-level item + break; } + (*iter)->setExpanded(true); + iter++; } } |