Qt: Display filter toolbar updates.

Don't set the display filter combo's minimum size. This lets us show
more filter expression buttons.

Clear the filter expression toolbar before redrawing it. This gets rid
of a leftover artifact here on macOS.

Change-Id: Iab944e8992caf554e024521df52d0089a4501674
Reviewed-on: https://code.wireshark.org/review/30902
Reviewed-by: Gerald Combs <gerald@wireshark.org>
Petri-Dish: Gerald Combs <gerald@wireshark.org>
Tested-by: Petri Dish Buildbot
Reviewed-by: Anders Broman <a.broman58@gmail.com>
This commit is contained in:
Gerald Combs 2018-11-29 08:46:29 -08:00 committed by Anders Broman
parent 697623411c
commit abfe9572bd
3 changed files with 2 additions and 16 deletions

View File

@ -270,7 +270,6 @@ MainWindow::MainWindow(QWidget *parent) :
QMainWindow(parent),
main_ui_(new Ui::MainWindow),
cur_layout_(QVector<unsigned>()),
df_combo_box_(new DisplayFilterCombo),
packet_list_(NULL),
proto_tree_(NULL),
previous_focus_(NULL),
@ -372,6 +371,7 @@ MainWindow::MainWindow(QWidget *parent) :
Qt::BlockingQueuedConnection);
#endif
df_combo_box_ = new DisplayFilterCombo(this);
const DisplayFilterEdit *df_edit = qobject_cast<DisplayFilterEdit *>(df_combo_box_->lineEdit());
connect(df_edit, SIGNAL(pushFilterSyntaxStatus(const QString&)),
main_ui_->statusBar, SLOT(pushFilterStatus(const QString&)));
@ -690,12 +690,6 @@ MainWindow::MainWindow(QWidget *parent) :
/* Register Interface Toolbar callbacks */
iface_toolbar_register_cb(mainwindow_add_toolbar, mainwindow_remove_toolbar);
// We set the minimum width of df_combo_box_ in resizeEvent so that it won't shrink
// down too much if we have a lot of filter buttons. Unfortunately that can break
// Aero snapping if our window is large or maximized. Set a minimum width here in
// order to counteract that.
setMinimumWidth(350); // Arbitrary
showWelcome();
}
@ -2501,12 +2495,6 @@ void MainWindow::changeEvent(QEvent* event)
QMainWindow::changeEvent(event);
}
void MainWindow::resizeEvent(QResizeEvent *event)
{
df_combo_box_->setMinimumWidth(width() * 2 / 3); // Arbitrary
QMainWindow::resizeEvent(event);
}
/* Update main window items based on whether there's a capture in progress. */
void MainWindow::setForCaptureInProgress(bool capture_in_progress, GArray *ifaces)
{

View File

@ -134,8 +134,6 @@ protected:
virtual void dragEnterEvent(QDragEnterEvent *event);
virtual void dropEvent(QDropEvent *event);
virtual void changeEvent(QEvent* event);
virtual void resizeEvent(QResizeEvent *event);
private:
// XXX Move to FilterUtils

View File

@ -102,9 +102,9 @@ void FilterExpressionToolBar::filterExpressionsChanged()
// Hiding and showing seems to be the only way to get the layout to
// work correctly in some cases. See bug 14121 for details.
clear();
setUpdatesEnabled(false);
hide();
clear();
// XXX Add a context menu for removing and changing buttons.
filter_expression_iterate_expressions(filter_expression_add_action, &data);