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 7baac67149.

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>
This commit is contained in:
Gerald Combs 2016-01-08 13:34:12 -08:00
parent 308b653da2
commit 8a23da3fd2
4 changed files with 11 additions and 14 deletions

View File

@ -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();
}
/*

View File

@ -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();
};

View File

@ -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);

View File

@ -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)