aboutsummaryrefslogtreecommitdiffstats
path: root/ui/qt/models
diff options
context:
space:
mode:
authorStig Bjørlykke <stig@bjorlykke.org>2018-10-07 19:45:15 +0200
committerAnders Broman <a.broman58@gmail.com>2018-10-08 07:12:34 +0000
commitb3cb942dbccf85dcff349d9c319a8c70a869c2be (patch)
treecda20950e9c571d82d6c61ba9ddc9801be3f04a4 /ui/qt/models
parent6e22ecbc208e8a1ebf0e9f307c3845b078db09ce (diff)
Qt: Add clear all button to Decode As
Add a clear all button to easily remove all existing entries. Change-Id: I76e7ee2b7b85a9b4e5f9f5a788a89f38f70ee8ce Reviewed-on: https://code.wireshark.org/review/30052 Petri-Dish: Stig Bjørlykke <stig@bjorlykke.org> Tested-by: Petri Dish Buildbot Reviewed-by: Anders Broman <a.broman58@gmail.com>
Diffstat (limited to 'ui/qt/models')
-rw-r--r--ui/qt/models/decode_as_model.cpp10
-rw-r--r--ui/qt/models/decode_as_model.h1
2 files changed, 11 insertions, 0 deletions
diff --git a/ui/qt/models/decode_as_model.cpp b/ui/qt/models/decode_as_model.cpp
index 303ba565ff..18b9c8834a 100644
--- a/ui/qt/models/decode_as_model.cpp
+++ b/ui/qt/models/decode_as_model.cpp
@@ -391,6 +391,16 @@ bool DecodeAsModel::removeRows(int row, int count, const QModelIndex &/*parent*/
return true;
}
+void DecodeAsModel::clearAll()
+{
+ if (rowCount() < 1)
+ return;
+
+ beginResetModel();
+ decode_as_items_.clear();
+ endResetModel();
+}
+
bool DecodeAsModel::copyRow(int dst_row, int src_row)
{
if (src_row < 0 || src_row >= rowCount() || dst_row < 0 || dst_row >= rowCount()) {
diff --git a/ui/qt/models/decode_as_model.h b/ui/qt/models/decode_as_model.h
index f1cf825808..003d005dde 100644
--- a/ui/qt/models/decode_as_model.h
+++ b/ui/qt/models/decode_as_model.h
@@ -72,6 +72,7 @@ public:
bool insertRows(int row, int count, const QModelIndex &parent = QModelIndex());
bool removeRows(int row, int count, const QModelIndex &parent = QModelIndex());
+ void clearAll();
bool copyRow(int dst_row, int src_row);
static QString entryString(const gchar *table_name, gpointer value);