diff options
author | Gerald Combs <gerald@wireshark.org> | 2016-03-10 12:43:59 -0800 |
---|---|---|
committer | Gerald Combs <gerald@wireshark.org> | 2016-03-11 20:42:11 +0000 |
commit | 28bfb3210537ce60895e10526f0a3e8cdfbd279d (patch) | |
tree | 44af57314c924e1d9794dc20f2a4bfbb4bb38d8a /ui/qt/proto_tree.h | |
parent | 6ed543dbe6115170be335b42c6ba01c42568c6e8 (diff) | |
download | wireshark-28bfb3210537ce60895e10526f0a3e8cdfbd279d.tar.gz |
Qt: Defer proto tree column content resizing.
Try to avoid the following call graph:
ProtoTree::expandAll
...
ProtoTree::expand
...
QTreeView::resizeColumnToContents
QTreeView::resizeColumnToContents calls sizeHintForColumn, which
iterates over a number of items (default 1000). Calling it from
ProtoTree::expand can lead to excessive wheel-spinning.
Add a single-shot timer for resizeColumnToContents. This is similar to
what QTreeView does internally when columns are resized.
Bug: 12228
Change-Id: I7b50c1486b3a25817efae58efbb8c9e961dbdab0
Reviewed-on: https://code.wireshark.org/review/14411
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.h')
-rw-r--r-- | ui/qt/proto_tree.h | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/ui/qt/proto_tree.h b/ui/qt/proto_tree.h index a97f69c6a5..56815cc85d 100644 --- a/ui/qt/proto_tree.h +++ b/ui/qt/proto_tree.h @@ -47,7 +47,9 @@ public: void clear(); protected: - void contextMenuEvent(QContextMenuEvent *event); + virtual void contextMenuEvent(QContextMenuEvent *event); + virtual void timerEvent(QTimerEvent *event); + virtual void keyReleaseEvent(QKeyEvent *event); private: QMenu ctx_menu_; @@ -57,6 +59,7 @@ private: QAction *decode_as_; QList<QAction *> copy_actions_; QFont mono_font_; + int column_resize_timer_; signals: void protoItemSelected(const QString &); @@ -76,6 +79,9 @@ public slots: void expandAll(); void collapseAll(); void itemDoubleClick(QTreeWidgetItem *item, int column); + +private slots: + void updateContentWidth(); }; #endif // PROTO_TREE_H |