From 690f1c3c400f46a19bef82aeeb15210667ad0843 Mon Sep 17 00:00:00 2001 From: Gerald Combs Date: Wed, 10 Jan 2018 12:43:50 -0800 Subject: [PATCH] Qt: Adjust About box column sizing. Setting column sizes when we resize will clobber any adjustments made by the user. Set them when we show the dialog instead. The plugin text varies quite a bit from column to column. Resize each column to its contents instead of setting uniform widths. Change-Id: I1ed9b115665b4dd99a4ff9ee94701f449b8413de Reviewed-on: https://code.wireshark.org/review/25250 Reviewed-by: Gerald Combs Petri-Dish: Gerald Combs Tested-by: Petri Dish Buildbot Reviewed-by: Roland Knall --- ui/qt/about_dialog.cpp | 14 +++++++++++--- ui/qt/about_dialog.h | 2 +- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/ui/qt/about_dialog.cpp b/ui/qt/about_dialog.cpp index 3962636cab..64a4f7fc1a 100644 --- a/ui/qt/about_dialog.cpp +++ b/ui/qt/about_dialog.cpp @@ -396,11 +396,12 @@ AboutDialog::~AboutDialog() delete ui; } -void AboutDialog::resizeEvent(QResizeEvent * event) +void AboutDialog::showEvent(QShowEvent * event) { QList pages; - pages << ui->tab_authors << ui->tab_folders << ui->tab_plugins << ui->tab_shortcuts; + // Authors, Folders & Shortcuts: Equal-sized columns. + pages << ui->tab_authors << ui->tab_folders << ui->tab_shortcuts; foreach ( QWidget * tabPage, pages ) { @@ -416,7 +417,14 @@ void AboutDialog::resizeEvent(QResizeEvent * event) tree->header()->setStretchLastSection(true); } - QDialog::resizeEvent(event); + // Plugins: Content-sized columns + + QAbstractItemModel *model = ui->tblPlugins->model(); + for (int col = 0; col < model->columnCount() - 1; col++) { + ui->tblPlugins->resizeColumnToContents(col); + } + + QDialog::showEvent(event); } void AboutDialog::urlClicked(const QModelIndex &idx) diff --git a/ui/qt/about_dialog.h b/ui/qt/about_dialog.h index 7aed3e2d57..7bb458f30e 100644 --- a/ui/qt/about_dialog.h +++ b/ui/qt/about_dialog.h @@ -87,7 +87,7 @@ public: ~AboutDialog(); protected: - virtual void resizeEvent(QResizeEvent *); + virtual void showEvent(QShowEvent *); private: Ui::AboutDialog *ui;