aboutsummaryrefslogtreecommitdiffstats
path: root/ui
diff options
context:
space:
mode:
authorRoland Knall <rknall@gmail.com>2019-07-11 12:57:28 +0200
committerRoland Knall <rknall@gmail.com>2019-07-11 13:06:34 +0000
commit251b66da30943d35143f4ea6e105d87c19b15c8d (patch)
treeb6e1e93a74891e3ed06356ccc3ee3ed6b0c9a213 /ui
parenta87ca4e01720533f51991738ed03d5b499ade153 (diff)
Qt: Fix warning and remove dead code
Fix a "discard const qualifier" warning and remove code, which should be active in Qt5, but never made it to majurity Change-Id: I8d4dd526d07413ca30ab0b8430c6b8205e4e3063 Reviewed-on: https://code.wireshark.org/review/33896 Petri-Dish: Roland Knall <rknall@gmail.com> Tested-by: Petri Dish Buildbot Reviewed-by: Roland Knall <rknall@gmail.com>
Diffstat (limited to 'ui')
-rw-r--r--ui/qt/models/tree_model_helpers.h91
1 files changed, 4 insertions, 87 deletions
diff --git a/ui/qt/models/tree_model_helpers.h b/ui/qt/models/tree_model_helpers.h
index 643af38418..664415c5e0 100644
--- a/ui/qt/models/tree_model_helpers.h
+++ b/ui/qt/models/tree_model_helpers.h
@@ -69,10 +69,12 @@ public:
return childItems_.count();
}
- int row() const
+ int row()
{
if (parent_)
- return parent_->childItems_.indexOf(VariantPointer<Item>::asQVariant((Item*)this));
+ {
+ return parent_->childItems_.indexOf(VariantPointer<Item>::asQVariant((Item *)this));
+ }
return 0;
}
@@ -84,91 +86,6 @@ protected:
QList<QVariant> childItems_;
};
-//XXX - Qt 4.8 doesn't work with these types of templated classes, so save the functionality for now.
-#ifdef WIRESHARK_SUPPORTS_QT_5_0_MINIMUM
-
-//Base class to inherit basic model for tree
-template <typename Item>
-class ModelHelperTreeModel : public QAbstractItemModel
-{
-public:
- explicit ModelHelperTreeModel(QObject * parent = Q_NULLPTR) : QAbstractItemModel(parent),
- root_(NULL)
- {
- }
-
- virtual ~ModelHelperTreeModel()
- {
- delete root_;
- }
-
- virtual QModelIndex index(int row, int column, const QModelIndex &parent = QModelIndex()) const
- {
- if (!hasIndex(row, column, parent))
- return QModelIndex();
-
- Item *parent_item, *child_item;
-
- if (!parent.isValid())
- parent_item = root_;
- else
- parent_item = static_cast<Item*>(parent.internalPointer());
-
- Q_ASSERT(parent_item);
-
- child_item = parent_item->child(row);
- if (child_item) {
- return createIndex(row, column, child_item);
- }
-
- return QModelIndex();
- }
-
- virtual QModelIndex parent(const QModelIndex& indexItem) const
- {
- if (!indexItem.isValid())
- return QModelIndex();
-
- Item* item = static_cast<Item*>(indexItem.internalPointer());
- if (item != NULL) {
- Item* parent_item = item->parentItem();
- if (parent_item != NULL) {
- if (parent_item == root_)
- return QModelIndex();
-
- return createIndex(parent_item->row(), 0, parent_item);
- }
- }
-
- return QModelIndex();
- }
-
- virtual int rowCount(const QModelIndex& parent = QModelIndex()) const
- {
- Item *parent_item;
-
- if (parent.column() > 0)
- return 0;
-
- if (!parent.isValid())
- parent_item = root_;
- else
- parent_item = static_cast<Item*>(parent.internalPointer());
-
- if (parent_item == NULL)
- return 0;
-
- return parent_item->childCount();
- }
-
-protected:
- Item* root_;
-
-};
-#endif
-
-
-
#endif // TREE_MODEL_HELPERS_H
/*