summaryrefslogtreecommitdiff
path: root/ui/qt/proto_tree.h
diff options
context:
space:
mode:
authorGerald Combs <gerald@wireshark.org>2016-03-10 12:43:59 -0800
committerGerald Combs <gerald@wireshark.org>2016-03-11 20:42:11 +0000
commit28bfb3210537ce60895e10526f0a3e8cdfbd279d (patch)
tree44af57314c924e1d9794dc20f2a4bfbb4bb38d8a /ui/qt/proto_tree.h
parent6ed543dbe6115170be335b42c6ba01c42568c6e8 (diff)
downloadwireshark-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.h8
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