From d8658716277bbb2378819d25997ce0646b72c9c2 Mon Sep 17 00:00:00 2001 From: Roland Knall Date: Fri, 24 Nov 2017 15:46:30 +0100 Subject: Qt: About Dialog move to QTreeView and fix copy - Fix an issue, where the url was opened twice on Linux - Make the filter case insensitive if so wished for - Allow the copy to either copy the selected column (just Copy) or copy the complete row, with tab separation - Move to QTreeView instead to make it similar to the rest of the tables Change-Id: Ie6064f2ad2014e24546553c5febe63358e2f69ec Reviewed-on: https://code.wireshark.org/review/24570 Petri-Dish: Roland Knall Tested-by: Petri Dish Buildbot Reviewed-by: Jim Young Reviewed-by: Anders Broman --- ui/qt/models/url_link_delegate.cpp | 39 +++++++------------------------------- 1 file changed, 7 insertions(+), 32 deletions(-) (limited to 'ui/qt/models/url_link_delegate.cpp') diff --git a/ui/qt/models/url_link_delegate.cpp b/ui/qt/models/url_link_delegate.cpp index a058a883d1..503a606100 100644 --- a/ui/qt/models/url_link_delegate.cpp +++ b/ui/qt/models/url_link_delegate.cpp @@ -1,4 +1,4 @@ -/* url_link.cpp +/* url_link_delegate.cpp * Delegates for displaying links as links, including elide model * * Wireshark - Network traffic analyzer @@ -28,41 +28,16 @@ void UrlLinkDelegate::paint(QPainter *painter, const QStyleOptionViewItem &optio QStyleOptionViewItem options = option; initStyleOption(&options, index); - QString text = options.text; - if (text.isEmpty()) - return; + QStyleOptionViewItem opt = option; + initStyleOption(&opt, index); - int one_em = option.fontMetrics.height(); - QString short_dir = option.fontMetrics.elidedText(text, Qt::ElideMiddle, one_em * 10); + opt.font.setUnderline(true); - painter->save(); - QFont font = option.font; - font.setUnderline(true); - painter->setFont(font); - painter->setPen(option.palette.link().color()); - painter->drawText(option.rect, Qt::AlignLeft | Qt::AlignVCenter, short_dir); - - painter->restore(); -} - -QSize UrlLinkDelegate::sizeHint(const QStyleOptionViewItem &option, const QModelIndex &index) const { - QStyleOptionViewItem options = option; - initStyleOption(&options, index); - - QString text = options.text; - if (text.isEmpty()) - return QStyledItemDelegate::sizeHint(option, index); - - int one_em = option.fontMetrics.height(); - QString short_dir = option.fontMetrics.elidedText(text, Qt::ElideMiddle, one_em * 10); - - QTextDocument doc; - doc.setHtml(short_dir); - doc.setTextWidth(options.rect.width()); - return QSize(doc.idealWidth(), doc.size().height()); + QStyledItemDelegate::paint(painter, opt, index); } -/* * Editor modelines +/* + * Editor modelines * * Local Variables: * c-basic-offset: 4 -- cgit v1.2.3