diff options
author | Gerald Combs <gerald@wireshark.org> | 2018-01-15 17:13:45 -0800 |
---|---|---|
committer | Gerald Combs <gerald@wireshark.org> | 2018-01-16 18:55:24 +0000 |
commit | 107a91a8cc283f648552a4924fade2216670fb23 (patch) | |
tree | 0b351c33f3bcadb4da8501e84e71b665fe5595bc /ui/qt/models | |
parent | 96e865b4b80595b49edfe294729ac7de054fe33c (diff) |
Qt: Fix proto tree links and related frames.
Add FieldInformation::isLink and use it to style link items.
Add back a related frame information.
Get rid of rowsInserted() and just visit each tree node starting from
the root.
Change-Id: I0e7ef6b2e11d25465705adffbb77d6f6cfb2a435
Reviewed-on: https://code.wireshark.org/review/25342
Petri-Dish: Gerald Combs <gerald@wireshark.org>
Tested-by: Petri Dish Buildbot
Reviewed-by: Gerald Combs <gerald@wireshark.org>
Diffstat (limited to 'ui/qt/models')
-rw-r--r-- | ui/qt/models/proto_tree_model.cpp | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/ui/qt/models/proto_tree_model.cpp b/ui/qt/models/proto_tree_model.cpp index b67e772ec0..45e1d6b056 100644 --- a/ui/qt/models/proto_tree_model.cpp +++ b/ui/qt/models/proto_tree_model.cpp @@ -67,6 +67,12 @@ int ProtoTreeModel::rowCount(const QModelIndex &parent) const return ProtoNode(root_node_).childrenCount(); } +// The QItemDelegate documentation says +// "When displaying items from a custom model in a standard view, it is +// often sufficient to simply ensure that the model returns appropriate +// data for each of the roles that determine the appearance of items in +// views." +// We might want to move this to a delegate regardless. QVariant ProtoTreeModel::data(const QModelIndex &index, int role) const { ProtoNode index_node = protoNodeFromIndex(index); @@ -106,11 +112,20 @@ QVariant ProtoTreeModel::data(const QModelIndex &index, int role) const if(finfo.flag(PI_SEVERITY_MASK)) { return ColorUtils::expert_color_foreground; } + if (finfo.isLink()) { + return QApplication::palette().link(); + } if(finfo.headerInfo().type == FT_PROTOCOL) { return QApplication::palette().windowText(); } return QApplication::palette().text(); } + case Qt::FontRole: + if (finfo.isLink()) { + QFont font; + font.setUnderline(true); + return font; + } default: break; } |