aboutsummaryrefslogtreecommitdiffstats
path: root/ui/qt/stats_tree_dialog.cpp
diff options
context:
space:
mode:
authorRoland Knall <roland.knall@br-automation.com>2017-01-11 13:55:23 +0100
committerRoland Knall <rknall@gmail.com>2017-01-12 16:04:00 +0000
commit3df81a055064e2e2c8c9548f1c6837ddef5e5034 (patch)
tree484d3a1e56679668e657ddb29fe6aa6a9d964cdf /ui/qt/stats_tree_dialog.cpp
parentd6d516888122a26d477dcaa39a52fc9cd8b24479 (diff)
Qt: Remove unneccessary Q_DECLARE_METATYPE
Remove unnecessary Q_DECLARE_METATYPE macros and replace calls to QVariant conversions with VariantPointer where necessary Change-Id: Ia4690590095f930bf94644197de7fa30b00ee7ec Reviewed-on: https://code.wireshark.org/review/19611 Petri-Dish: Roland Knall <rknall@gmail.com> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Roland Knall <rknall@gmail.com>
Diffstat (limited to 'ui/qt/stats_tree_dialog.cpp')
-rw-r--r--ui/qt/stats_tree_dialog.cpp12
1 files changed, 6 insertions, 6 deletions
diff --git a/ui/qt/stats_tree_dialog.cpp b/ui/qt/stats_tree_dialog.cpp
index 798a15373f..3ac27a0a7e 100644
--- a/ui/qt/stats_tree_dialog.cpp
+++ b/ui/qt/stats_tree_dialog.cpp
@@ -27,6 +27,8 @@
#include "qt_ui_utils.h"
+#include <ui/qt/variant_pointer.h>
+
#include <QHeaderView>
#include <QMessageBox>
#include <QTreeWidget>
@@ -34,8 +36,6 @@
const int item_col_ = 0;
-Q_DECLARE_METATYPE(stat_node *)
-
const int sn_type_ = 1000;
class StatsTreeWidgetItem : public QTreeWidgetItem
{
@@ -48,8 +48,8 @@ public:
}
bool operator< (const QTreeWidgetItem &other) const
{
- stat_node *thisnode = data(item_col_, Qt::UserRole).value<stat_node *>();
- stat_node *othernode = other.data(item_col_, Qt::UserRole).value<stat_node *>();
+ stat_node *thisnode = VariantPointer<stat_node>::asPtr(data(item_col_, Qt::UserRole));
+ stat_node *othernode = VariantPointer<stat_node>::asPtr(other.data(item_col_, Qt::UserRole));
Qt::SortOrder order = treeWidget()->header()->sortIndicatorOrder();
int result;
@@ -96,7 +96,7 @@ void StatsTreeDialog::setupNode(stat_node* node)
QTreeWidgetItem *ti = new StatsTreeWidgetItem(), *parent = NULL;
ti->setText(item_col_, node->name);
- ti->setData(item_col_, Qt::UserRole, qVariantFromValue(node));
+ ti->setData(item_col_, Qt::UserRole, VariantPointer<stat_node>::asQVariant(node));
node->pr = (st_node_pres *) ti;
if (node->parent && node->parent->pr) {
parent = (QTreeWidgetItem *) node->parent->pr;
@@ -176,7 +176,7 @@ void StatsTreeDialog::drawTreeItems(void *st_ptr)
int node_count = 0;
while (*iter) {
- stat_node *node = (*iter)->data(item_col_, Qt::UserRole).value<stat_node *>();
+ stat_node *node = VariantPointer<stat_node>::asPtr((*iter)->data(item_col_, Qt::UserRole));
if (node) {
gchar **valstrs = stats_tree_get_values_from_node(node);
for (int count = 0; count<st->num_columns; count++) {