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 <gerald@wireshark.org>
Petri-Dish: Gerald Combs <gerald@wireshark.org>
Tested-by: Petri Dish Buildbot
Reviewed-by: Roland Knall <rknall@gmail.com>
This commit is contained in:
Gerald Combs 2018-01-10 12:43:50 -08:00 committed by Roland Knall
parent 2aa8260957
commit 690f1c3c40
2 changed files with 12 additions and 4 deletions

View File

@ -396,11 +396,12 @@ AboutDialog::~AboutDialog()
delete ui;
}
void AboutDialog::resizeEvent(QResizeEvent * event)
void AboutDialog::showEvent(QShowEvent * event)
{
QList<QWidget *> 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)

View File

@ -87,7 +87,7 @@ public:
~AboutDialog();
protected:
virtual void resizeEvent(QResizeEvent *);
virtual void showEvent(QShowEvent *);
private:
Ui::AboutDialog *ui;