From 6da9c16c4f67d43586ac986e8e131af4bf433834 Mon Sep 17 00:00:00 2001 From: Gary Wang Date: Thu, 8 Oct 2020 22:24:54 +0800 Subject: [PATCH] chore: the way we setup aboutdialog layout --- aboutdialog.cpp | 15 +++++++++------ aboutdialog.h | 4 +++- 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/aboutdialog.cpp b/aboutdialog.cpp index 419c3ae4..83891266 100644 --- a/aboutdialog.cpp +++ b/aboutdialog.cpp @@ -137,14 +137,12 @@ SOFTWARE. this->close(); }); - QVBoxLayout * mainLayout = new QVBoxLayout; + setLayout(new QVBoxLayout); - mainLayout->addWidget(m_tabWidget); - mainLayout->addWidget(m_buttonBox); + layout()->addWidget(m_tabWidget); + layout()->addWidget(m_buttonBox); - this->setLayout(mainLayout); - this->setMinimumSize(361, 161); // not sure why it complain "Unable to set geometry" - this->resize(520, 350); + setMinimumSize(361, 161); // not sure why it complain "Unable to set geometry" setWindowFlag(Qt::WindowContextHelpButtonHint, false); } @@ -152,3 +150,8 @@ AboutDialog::~AboutDialog() { } + +QSize AboutDialog::sizeHint() const +{ + return QSize(520, 350); +} diff --git a/aboutdialog.h b/aboutdialog.h index d4845620..4fc3bca8 100644 --- a/aboutdialog.h +++ b/aboutdialog.h @@ -14,7 +14,9 @@ class AboutDialog : public QDialog Q_OBJECT public: explicit AboutDialog(QWidget *parent = nullptr); - ~AboutDialog(); + ~AboutDialog() override; + + QSize sizeHint() const override; private: QTabWidget * m_tabWidget = nullptr;