diff options
author | Gerald Combs <gerald@wireshark.org> | 2016-01-13 11:27:11 -0800 |
---|---|---|
committer | Gerald Combs <gerald@wireshark.org> | 2016-01-13 21:28:07 +0000 |
commit | 7c2eaefd07e2fb68ae8603c72e1151e5a81dd1b6 (patch) | |
tree | 8c61e8c5737d89098f48db6708c7eebdd2521044 /ui/qt/proto_tree.cpp | |
parent | b275ea864a38051a68df06614d290f6a4acb80de (diff) |
Qt: Show the horizontal scrollbar in the packet detail.
Call resizeColumnToContents when we fill, clear, expand, or contract
items. This make sure the horizontal scrollbar shows up instead of
eliding items.
A commonly suggested solution is to call
header()->setSectionResizeMode(QHeaderView::ResizeToContents) followed
by header()->setStretchLastSection(false). This makes the scroll bar
show up when the tree is wider than the window, but when the column is
narrower than the window we end up with unused white space on the right.
Change-Id: I5896f6048385bed27858f0ac676b29a1bf1255cd
Reviewed-on: https://code.wireshark.org/review/13265
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 | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/ui/qt/proto_tree.cpp b/ui/qt/proto_tree.cpp index a4fcd3458e..ac2bbca80c 100644 --- a/ui/qt/proto_tree.cpp +++ b/ui/qt/proto_tree.cpp @@ -283,6 +283,7 @@ void ProtoTree::closeContextMenu() void ProtoTree::clear() { updateSelectionStatus(NULL); QTreeWidget::clear(); + resizeColumnToContents(0); } void ProtoTree::contextMenuEvent(QContextMenuEvent *event) @@ -333,6 +334,7 @@ void ProtoTree::fillProtocolTree(proto_tree *protocol_tree) { setFont(mono_font_); proto_tree_children_foreach(protocol_tree, proto_tree_draw_node, invisibleRootItem()); + resizeColumnToContents(0); } void ProtoTree::emitRelatedFrame(int related_frame, ft_framenum_type_t framenum_type) @@ -440,6 +442,8 @@ void ProtoTree::expand(const QModelIndex & index) { fi->tree_type < num_tree_types); tree_expanded_set(fi->tree_type, TRUE); } + + resizeColumnToContents(0); } void ProtoTree::collapse(const QModelIndex & index) { @@ -457,6 +461,7 @@ void ProtoTree::collapse(const QModelIndex & index) { fi->tree_type < num_tree_types); tree_expanded_set(fi->tree_type, FALSE); } + resizeColumnToContents(0); } void ProtoTree::expandSubtrees() @@ -486,6 +491,7 @@ void ProtoTree::expandSubtrees() (*iter)->setExpanded(true); iter++; } + resizeColumnToContents(0); } void ProtoTree::expandAll() @@ -495,6 +501,7 @@ void ProtoTree::expandAll() tree_expanded_set(i, TRUE); } QTreeWidget::expandAll(); + resizeColumnToContents(0); } void ProtoTree::collapseAll() @@ -504,6 +511,7 @@ void ProtoTree::collapseAll() tree_expanded_set(i, FALSE); } QTreeWidget::collapseAll(); + resizeColumnToContents(0); } void ProtoTree::itemDoubleClick(QTreeWidgetItem *item, int) { |