diff options
author | Gerald Combs <gerald@wireshark.org> | 2015-07-23 12:53:45 -0700 |
---|---|---|
committer | Gerald Combs <gerald@wireshark.org> | 2015-07-23 20:37:50 +0000 |
commit | da5eba636a1bb4de2a5e09a1ec7e4191fbe77976 (patch) | |
tree | 7da8fa858fe1bab92f2fc8e7f7a9a7a4edf0a952 /ui/qt/proto_tree.cpp | |
parent | dc6d376f67b5b5a8e315af78746c0e8b6de09a5d (diff) |
Fix QCocoaMenu errors.
In PacketList and ProtoTree, create our own QMenus instead of stealing
actions from the main window. This only fixes the errors listed in bug
10890. Add "to do" items for other bugs.
Bug: 10890
Change-Id: I1c7ce8e4b863de95b2836e0cdcfb25824fe21edd
Reviewed-on: https://code.wireshark.org/review/9760
Petri-Dish: Gerald Combs <gerald@wireshark.org>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Gerald Combs <gerald@wireshark.org>
Diffstat (limited to 'ui/qt/proto_tree.cpp')
-rw-r--r-- | ui/qt/proto_tree.cpp | 31 |
1 files changed, 15 insertions, 16 deletions
diff --git a/ui/qt/proto_tree.cpp b/ui/qt/proto_tree.cpp index 0bee28656b..2a9a86ccc7 100644 --- a/ui/qt/proto_tree.cpp +++ b/ui/qt/proto_tree.cpp @@ -35,6 +35,10 @@ #include <QTreeWidgetItemIterator> #include <QUrl> +// To do: +// - Fix "apply as filter" behavior. +// - Add colorize conversation. + /* Fill a single protocol tree item with its string value and set its color. */ static void proto_tree_draw_node(proto_node *node, gpointer data) @@ -149,9 +153,6 @@ ProtoTree::ProtoTree(QWidget *parent) : QTreeWidget(parent), decode_as_(NULL) { - QMenu *submenu, *subsubmenu; - QAction *action; - setAccessibleName(tr("Packet details")); // Leave the uniformRowHeights property as-is (false) since items might // have multiple lines (e.g. packet comments). If this slows things down @@ -163,6 +164,9 @@ ProtoTree::ProtoTree(QWidget *parent) : // Assume we're a child of the main window. // XXX We might want to reimplement setParent() and fill in the context // menu there. + QMenu *submenu, *subsubmenu; + QAction *action; + ctx_menu_.addAction(window()->findChild<QAction *>("actionViewExpandSubtrees")); ctx_menu_.addAction(window()->findChild<QAction *>("actionViewExpandAll")); ctx_menu_.addAction(window()->findChild<QAction *>("actionViewCollapseAll")); @@ -173,10 +177,8 @@ ProtoTree::ProtoTree(QWidget *parent) : ctx_menu_.addSeparator(); action = window()->findChild<QAction *>("actionApply_as_Filter"); - - submenu = new QMenu(); - action->setMenu(submenu); - ctx_menu_.addAction(action); + submenu = new QMenu(action->text()); + ctx_menu_.addMenu(submenu); submenu->addAction(window()->findChild<QAction *>("actionAnalyzeAAFSelected")); submenu->addAction(window()->findChild<QAction *>("actionAnalyzeAAFNotSelected")); submenu->addAction(window()->findChild<QAction *>("actionAnalyzeAAFAndSelected")); @@ -185,9 +187,8 @@ ProtoTree::ProtoTree(QWidget *parent) : submenu->addAction(window()->findChild<QAction *>("actionAnalyzeAAFOrNotSelected")); action = window()->findChild<QAction *>("actionPrepare_a_Filter"); - submenu = new QMenu(); - action->setMenu(submenu); - ctx_menu_.addAction(action); + submenu = new QMenu(action->text()); + ctx_menu_.addMenu(submenu); submenu->addAction(window()->findChild<QAction *>("actionAnalyzePAFSelected")); submenu->addAction(window()->findChild<QAction *>("actionAnalyzePAFNotSelected")); submenu->addAction(window()->findChild<QAction *>("actionAnalyzePAFAndSelected")); @@ -221,9 +222,8 @@ ProtoTree::ProtoTree(QWidget *parent) : ctx_menu_.addSeparator(); action = window()->findChild<QAction *>("actionCopy"); - submenu = new QMenu(); - action->setMenu(submenu); - ctx_menu_.addAction(action); + subsubmenu = new QMenu(action->text()); + submenu->addMenu(subsubmenu); submenu->addAction(window()->findChild<QAction *>("actionCopyAllVisibleItems")); submenu->addAction(window()->findChild<QAction *>("actionCopyAllVisibleSelectedTreeItems")); submenu->addAction(window()->findChild<QAction *>("actionEditCopyDescription")); @@ -233,9 +233,8 @@ ProtoTree::ProtoTree(QWidget *parent) : submenu->addAction(window()->findChild<QAction *>("actionEditCopyAsFilter")); action = window()->findChild<QAction *>("actionBytes"); - subsubmenu = new QMenu(); - action->setMenu(subsubmenu); - submenu->addAction(action); + subsubmenu = new QMenu(action->text()); + submenu->addMenu(subsubmenu); subsubmenu->addSeparator(); // " <menu name= 'Bytes' action='/Copy/Bytes'>\n" // " <menuitem name='OffsetHexText' action='/Copy/Bytes/OffsetHexText'/>\n" |