aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRoland Knall <rknall@gmail.com>2019-11-19 10:18:26 +0100
committerRoland Knall <rknall@gmail.com>2019-11-19 09:37:06 +0000
commit962f8d0c7e9124c06254cc9c8b942f9c974ac5fc (patch)
tree19f3368a778e4d9a24993847462b9596e54bb846
parent3db2743095649de18eb3aa386104a38641fb0645 (diff)
Qt: Handle emptying selections
Clicking in an empty area of the Packet List to "unselect" the packet selection, left one packet indicated as selected (by having a single field active, but not highlighted). This is fixed, by selecting this entry. If the last line is being deselected, not index is set as active, as it has been in previous versions of the Qt interface Bug: 16216 Change-Id: Ib5353a7e59b09a4f816655e1dd65a20d6c6d1a13 Reviewed-on: https://code.wireshark.org/review/35132 Petri-Dish: Roland Knall <rknall@gmail.com> Tested-by: Petri Dish Buildbot Reviewed-by: Roland Knall <rknall@gmail.com>
-rw-r--r--ui/qt/packet_list.cpp20
1 files changed, 20 insertions, 0 deletions
diff --git a/ui/qt/packet_list.cpp b/ui/qt/packet_list.cpp
index 3b487272ed..f041fcac57 100644
--- a/ui/qt/packet_list.cpp
+++ b/ui/qt/packet_list.cpp
@@ -469,6 +469,26 @@ void PacketList::selectionChanged (const QItemSelection & selected, const QItemS
multiSelect = false;
row = selectionModel()->selectedIndexes().at(0).row();
}
+
+ /* Handling empty selection */
+ if (selectionModel()->selectedIndexes().count() <= 0)
+ {
+ /* Nothing selected, but multiSelect is still active */
+ if (multiSelect)
+ {
+ multiSelect = false;
+ if (currentIndex().isValid())
+ {
+ selectionModel()->select(currentIndex(), QItemSelectionModel::ClearAndSelect | QItemSelectionModel::Rows );
+ return;
+ }
+ }
+ /* Nothing selected, so in WS <= 3.0 nothing was indicated as well */
+ else if (currentIndex().isValid())
+ {
+ setCurrentIndex(QModelIndex());
+ }
+ }
}
if (row < 0)