aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStig Bjørlykke <stig@bjorlykke.org>2020-07-01 13:54:26 +0200
committerAnders Broman <a.broman58@gmail.com>2020-07-02 04:59:49 +0000
commitcb5bb6c99b744b62519a04172787968face3d911 (patch)
tree32d86f04a07ed3983d9a1385d07c4a23826849e8
parent1699e50102d179dda5924a0c0a98ca51a757c5af (diff)
Qt: Use elided heading in filter menus
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 <stig@bjorlykke.org> Tested-by: Petri Dish Buildbot Reviewed-by: Anders Broman <a.broman58@gmail.com>
-rw-r--r--ui/qt/filter_action.cpp5
1 files changed, 4 insertions, 1 deletions
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();
}