diff options
author | Gerald Combs <gerald@wireshark.org> | 2017-12-26 10:03:09 -0600 |
---|---|---|
committer | Anders Broman <a.broman58@gmail.com> | 2017-12-31 08:48:22 +0000 |
commit | 6f84e1b5f3a87489785a7ee31049d83823ceb0b9 (patch) | |
tree | cdd2df0acfcf146d008078458dd5d577ed93a3d9 /ui | |
parent | f9307105855036231db67a840b9d1be464750990 (diff) |
Qt: Fixup fieldSelected behavior.
Check the originating sender of fieldSelected in a couple of places so
that we don't re-emit it. This fixes an issue that was keeping the byte
view from marking the protocol.
Remove duplicate signal+slot connections in MainWindow.
Remove an unused member function.
Change-Id: Ia876bb4117d1e30a56f4c335a65f6976c8058f9d
Reviewed-on: https://code.wireshark.org/review/25077
Petri-Dish: Gerald Combs <gerald@wireshark.org>
Tested-by: Petri Dish Buildbot
Reviewed-by: Anders Broman <a.broman58@gmail.com>
Diffstat (limited to 'ui')
-rw-r--r-- | ui/qt/byte_view_tab.cpp | 4 | ||||
-rw-r--r-- | ui/qt/main_window.cpp | 17 | ||||
-rw-r--r-- | ui/qt/proto_tree.cpp | 10 | ||||
-rw-r--r-- | ui/qt/utils/field_information.cpp | 2 |
4 files changed, 18 insertions, 15 deletions
diff --git a/ui/qt/byte_view_tab.cpp b/ui/qt/byte_view_tab.cpp index a022f64a1f..dd5e081531 100644 --- a/ui/qt/byte_view_tab.cpp +++ b/ui/qt/byte_view_tab.cpp @@ -255,6 +255,10 @@ void ByteViewTab::selectedFieldChanged(FieldInformation *selected) ByteViewText * byte_view_text = 0; if (selected) { + if (selected->parent() == this) { + // We only want inbound signals. + return; + } const field_info *fi = selected->fieldInfo(); int idx = 0; diff --git a/ui/qt/main_window.cpp b/ui/qt/main_window.cpp index 370514098e..ce51e4863a 100644 --- a/ui/qt/main_window.cpp +++ b/ui/qt/main_window.cpp @@ -477,8 +477,6 @@ MainWindow::MainWindow(QWidget *parent) : packet_list_ = new PacketList(&master_split_); main_ui_->wirelessTimelineWidget->setPacketList(packet_list_); - connect(packet_list_, SIGNAL(fieldSelected(FieldInformation *)), - this, SIGNAL(fieldSelected(FieldInformation *))); connect(packet_list_, SIGNAL(frameSelected(int)), this, SIGNAL(frameSelected(int))); connect(this, SIGNAL(frameSelected(int)), @@ -498,10 +496,15 @@ MainWindow::MainWindow(QWidget *parent) : this, SIGNAL(fieldSelected(FieldInformation *))); connect(this, SIGNAL(fieldSelected(FieldInformation *)), proto_tree_, SLOT(selectedFieldChanged(FieldInformation *))); - connect(this, SIGNAL(fieldHighlight(FieldInformation *)), - main_ui_->statusBar, SLOT(highlightedFieldChanged(FieldInformation *))); + connect(packet_list_, SIGNAL(fieldSelected(FieldInformation *)), + this, SIGNAL(fieldSelected(FieldInformation *))); + connect(this, SIGNAL(fieldSelected(FieldInformation *)), + this, SLOT(setMenusForSelectedTreeRow(FieldInformation *))); connect(this, SIGNAL(fieldSelected(FieldInformation *)), main_ui_->statusBar, SLOT(selectedFieldChanged(FieldInformation *))); + + connect(this, SIGNAL(fieldHighlight(FieldInformation *)), + main_ui_->statusBar, SLOT(highlightedFieldChanged(FieldInformation *))); connect(wsApp, SIGNAL(captureActive(int)), this, SIGNAL(captureActive(int))); createByteViewDialog(); @@ -643,12 +646,6 @@ MainWindow::MainWindow(QWidget *parent) : connect(packet_list_->packetListModel(), SIGNAL(popProgressStatus()), main_ui_->statusBar, SLOT(popProgressStatus())); - connect(proto_tree_, SIGNAL(fieldSelected(FieldInformation *)), - this, SIGNAL(fieldSelected(FieldInformation *))); - connect(this, SIGNAL(fieldSelected(FieldInformation *)), - main_ui_->statusBar, SLOT(selectedFieldChanged(FieldInformation *))); - connect(this, SIGNAL(fieldSelected(FieldInformation *)), - this, SLOT(setMenusForSelectedTreeRow(FieldInformation *))); connect(proto_tree_, SIGNAL(openPacketInNewWindow(bool)), this, SLOT(openPacketDialog(bool))); connect(proto_tree_, SIGNAL(showProtocolPreferences(QString)), diff --git a/ui/qt/proto_tree.cpp b/ui/qt/proto_tree.cpp index f67fcde882..6ce06c6196 100644 --- a/ui/qt/proto_tree.cpp +++ b/ui/qt/proto_tree.cpp @@ -262,7 +262,7 @@ void ProtoTree::selectionChanged(const QItemSelection &selected, const QItemSele QModelIndex index = selected.indexes().first(); - FieldInformation finfo(proto_tree_model_->protoNodeFromIndex(index).protoNode()); + FieldInformation finfo(proto_tree_model_->protoNodeFromIndex(index).protoNode(), this); if (!finfo.isValid()) return; // Find and highlight the protocol bytes @@ -423,10 +423,12 @@ void ProtoTree::itemDoubleClicked(const QModelIndex &index) { void ProtoTree::selectedFieldChanged(FieldInformation *finfo) { QModelIndex index = proto_tree_model_->findFieldInformation(finfo); - if (index.isValid()) { - scrollTo(index); - selectionModel()->select(index, QItemSelectionModel::ClearAndSelect); + if (!index.isValid() || finfo->parent() == this) { + // We only want valid, inbound signals. + return; } + scrollTo(index); + selectionModel()->select(index, QItemSelectionModel::ClearAndSelect); } // Remember the currently focussed field based on: diff --git a/ui/qt/utils/field_information.cpp b/ui/qt/utils/field_information.cpp index 0a89b450cb..797f650347 100644 --- a/ui/qt/utils/field_information.cpp +++ b/ui/qt/utils/field_information.cpp @@ -93,7 +93,7 @@ FieldInformation::HeaderInfo FieldInformation::headerInfo() const FieldInformation * FieldInformation::parentField() const { - return new FieldInformation(parent_fi_); + return new FieldInformation(parent_fi_, parent()); } bool FieldInformation::tvbContains(FieldInformation *child) |