aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGerald Combs <gerald@wireshark.org>2016-01-08 13:34:12 -0800
committerGerald Combs <gerald@wireshark.org>2016-01-08 22:46:09 +0000
commit8a23da3fd2a1f730128c0c0a1baef2dcd7b13812 (patch)
tree0cf7e71eb2f02c36b1aa23291164cd9b35ee05f3
parent308b653da2afd05f62b944dda965d45650b23cf4 (diff)
Revert "Qt: Try to fix Main Welcome Interfaces List Scrollbar"
Instead of calling InterfaceTree::reset (which clears our selection) when we resize, just pass our resize event to QTreeWidget. Additionally, select our default interface using setCurrentItem. This fixes behavior broken in gb152ca3. This reverts commit 7baac67149a68b66087c5d688dbeda2869485765. Bug: 11733 Change-Id: I58855de38561fcb6984273ae3910c0dfcda04e69 Reviewed-on: https://code.wireshark.org/review/13135 Petri-Dish: Gerald Combs <gerald@wireshark.org> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Gerald Combs <gerald@wireshark.org>
-rw-r--r--ui/qt/accordion_frame.cpp6
-rw-r--r--ui/qt/accordion_frame.h3
-rw-r--r--ui/qt/interface_tree.cpp13
-rw-r--r--ui/qt/main_welcome.cpp3
4 files changed, 11 insertions, 14 deletions
diff --git a/ui/qt/accordion_frame.cpp b/ui/qt/accordion_frame.cpp
index 87d7c31ac4..9a0e7b3559 100644
--- a/ui/qt/accordion_frame.cpp
+++ b/ui/qt/accordion_frame.cpp
@@ -50,7 +50,7 @@ AccordionFrame::AccordionFrame(QWidget *parent) :
animation_ = new QPropertyAnimation(this, "maximumHeight", this);
animation_->setDuration(duration_);
animation_->setEasingCurve(QEasingCurve::InOutQuad);
- connect(animation_, SIGNAL(finished()), this, SLOT(animationFinish()));
+ connect(animation_, SIGNAL(finished()), this, SLOT(animationFinished()));
}
void AccordionFrame::animatedShow()
@@ -98,14 +98,12 @@ void AccordionFrame::animatedHide()
}
}
-void AccordionFrame::animationFinish()
+void AccordionFrame::animationFinished()
{
if (animation_->currentValue().toInt() < 1) {
hide();
setMaximumHeight(frame_height_);
}
-
- emit animationFinished();
}
/*
diff --git a/ui/qt/accordion_frame.h b/ui/qt/accordion_frame.h
index ce484ff028..778b86d1d6 100644
--- a/ui/qt/accordion_frame.h
+++ b/ui/qt/accordion_frame.h
@@ -36,7 +36,6 @@ public:
signals:
void visibilityChanged(bool visible);
- void animationFinished();
protected:
virtual void hideEvent(QHideEvent *) { emit visibilityChanged(false); }
@@ -47,7 +46,7 @@ private:
QPropertyAnimation *animation_;
private slots:
- void animationFinish();
+ void animationFinished();
};
diff --git a/ui/qt/interface_tree.cpp b/ui/qt/interface_tree.cpp
index 2ab3f4158f..900bb64976 100644
--- a/ui/qt/interface_tree.cpp
+++ b/ui/qt/interface_tree.cpp
@@ -122,8 +122,7 @@ void InterfaceTree::showEvent(QShowEvent *) {
#endif // HAVE_LIBPCAP
}
-#include <QDebug>
-void InterfaceTree::resizeEvent(QResizeEvent *)
+void InterfaceTree::resizeEvent(QResizeEvent *evt)
{
int max_if_width = width() * 2 / 3; // Arbitrary
@@ -134,6 +133,8 @@ void InterfaceTree::resizeEvent(QResizeEvent *)
}
setUpdatesEnabled(true);
+
+ QTreeWidget::resizeEvent(evt);
}
void InterfaceTree::display()
@@ -175,6 +176,7 @@ void InterfaceTree::display()
// traffic, interface name, or most recently used.
QList<QTreeWidgetItem *> phys_ifaces;
QList<QTreeWidgetItem *> virt_ifaces;
+ QTreeWidgetItem *selected_iface = NULL;
for (guint i = 0; i < global_capture_opts.all_ifaces->len; i++) {
device = g_array_index(global_capture_opts.all_ifaces, interface_t, i);
@@ -213,17 +215,18 @@ void InterfaceTree::display()
if (strstr(prefs.capture_device, device.name) != NULL) {
device.selected = TRUE;
+ selected_iface = ti;
global_capture_opts.num_selected++;
global_capture_opts.all_ifaces = g_array_remove_index(global_capture_opts.all_ifaces, i);
g_array_insert_val(global_capture_opts.all_ifaces, i, device);
}
- if (device.selected) {
- ti->setSelected(true);
- }
}
if (!phys_ifaces.isEmpty()) addTopLevelItems(phys_ifaces);
if (!virt_ifaces.isEmpty()) addTopLevelItems(virt_ifaces);
+ if (selected_iface) {
+ setCurrentItem(selected_iface);
+ }
// XXX Add other device information
resizeColumnToContents(IFTREE_COL_NAME);
diff --git a/ui/qt/main_welcome.cpp b/ui/qt/main_welcome.cpp
index 1e20dbc229..236ae9f397 100644
--- a/ui/qt/main_welcome.cpp
+++ b/ui/qt/main_welcome.cpp
@@ -180,8 +180,6 @@ MainWelcome::MainWelcome(QWidget *parent) :
connect(welcome_ui_->captureFilterComboBox, SIGNAL(startCapture()),
this, SIGNAL(startCapture()));
connect(recent_files_, SIGNAL(itemActivated(QListWidgetItem *)), this, SLOT(openRecentItem(QListWidgetItem *)));
- connect(welcome_ui_->openFrame, SIGNAL(animationFinished()),
- welcome_ui_->interfaceTree, SLOT(reset()));
updateRecentFiles();
#if !defined(Q_OS_MAC) || QT_VERSION > QT_VERSION_CHECK(5, 0, 0)
@@ -341,7 +339,6 @@ void MainWelcome::resizeEvent(QResizeEvent *event)
// event->accept();
QFrame::resizeEvent(event);
- welcome_ui_->interfaceTree->reset();
}
void MainWelcome::changeEvent(QEvent* event)