From cb5bb6c99b744b62519a04172787968face3d911 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stig=20Bj=C3=B8rlykke?= Date: Wed, 1 Jul 2020 13:54:26 +0200 Subject: Qt: Use elided heading in filter menus MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The heading in Apply as Filter and Prepare as Filter may be very wide for byte arrays. Use ElideRight with an appropriate length to limit the menu width. Change-Id: I2b8f5c805d8fd180c23a211fb7a88d16591175d0 Reviewed-on: https://code.wireshark.org/review/37641 Petri-Dish: Stig Bjørlykke Tested-by: Petri Dish Buildbot Reviewed-by: Anders Broman --- ui/qt/filter_action.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'ui') diff --git a/ui/qt/filter_action.cpp b/ui/qt/filter_action.cpp index 4da3ae8da3..d724a88237 100644 --- a/ui/qt/filter_action.cpp +++ b/ui/qt/filter_action.cpp @@ -230,7 +230,10 @@ QMenu * FilterAction::createFilterMenu(FilterAction::Action act, QString filter, QMenu * submenu = new QMenu(title, par); if (filter.length() > 0) { - QAction * comment = submenu->addAction(QString("%1: %2").arg(title).arg(filter)); + int one_em = submenu->fontMetrics().height(); + QString prep_text = QString("%1: %2").arg(title).arg(filter); + prep_text = submenu->fontMetrics().elidedText(prep_text, Qt::ElideRight, one_em * 40); + QAction * comment = submenu->addAction(prep_text); comment->setEnabled(false); submenu->addSeparator(); } -- cgit v1.2.3