From abfe9572bdee9d43c8eacf33b484f336b646d12f Mon Sep 17 00:00:00 2001 From: Gerald Combs Date: Thu, 29 Nov 2018 08:46:29 -0800 Subject: [PATCH] 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 Petri-Dish: Gerald Combs Tested-by: Petri Dish Buildbot Reviewed-by: Anders Broman --- ui/qt/main_window.cpp | 14 +------------- ui/qt/main_window.h | 2 -- ui/qt/widgets/filter_expression_toolbar.cpp | 2 +- 3 files changed, 2 insertions(+), 16 deletions(-) diff --git a/ui/qt/main_window.cpp b/ui/qt/main_window.cpp index 629e0e0860..732352311c 100644 --- a/ui/qt/main_window.cpp +++ b/ui/qt/main_window.cpp @@ -270,7 +270,6 @@ MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), main_ui_(new Ui::MainWindow), cur_layout_(QVector()), - 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(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) { diff --git a/ui/qt/main_window.h b/ui/qt/main_window.h index 4112d1ba78..a7c619d7a4 100644 --- a/ui/qt/main_window.h +++ b/ui/qt/main_window.h @@ -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 diff --git a/ui/qt/widgets/filter_expression_toolbar.cpp b/ui/qt/widgets/filter_expression_toolbar.cpp index ed78e0cbbc..92c8934280 100644 --- a/ui/qt/widgets/filter_expression_toolbar.cpp +++ b/ui/qt/widgets/filter_expression_toolbar.cpp @@ -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);