Fix wizard's maximum size

User can set height and width for wizard in config.xml. If the given
dimentions does not fit to the screen, wizard was clipped and buttons
were of the screen. Fixed so that the screen size cannot be exceeded.

Task-number: QTIFW-1016
Change-Id: Iab6970d4203fc1271b93475aec71c946d0508653
Reviewed-by: Iikka Eklund <iikka.eklund@qt.io>
This commit is contained in:
Katja Marttila 2018-11-09 14:01:04 +02:00
parent a16f67ea99
commit 0886f83a9a
2 changed files with 10 additions and 0 deletions

View File

@ -73,6 +73,7 @@
#include <QShowEvent>
#include <QFileDialog>
#include <QGroupBox>
#include <QDesktopWidget>
#ifdef Q_OS_WIN
# include <qt_windows.h>
@ -382,8 +383,16 @@ PackageManagerGui::PackageManagerGui(PackageManagerCore *core, QWidget *parent)
d->m_defaultButtonText.insert(i, buttonText(QWizard::WizardButton(i)));
m_core->setGuiObject(this);
// We need to create this ugly hack so that the installer doesn't exceed the maximum size of the
// screen. The screen size where the widget lies is not available until the widget is visible.
QTimer::singleShot(30, this, SLOT(setMaxSize()));
}
void PackageManagerGui::setMaxSize()
{
setMaximumSize(qApp->desktop()->availableGeometry(this).size());
}
/*!
Destructs a package manager UI.
*/

View File

@ -106,6 +106,7 @@ public Q_SLOTS:
void rejectWithoutPrompt();
void showFinishedPage();
void setModified(bool value);
void setMaxSize();
protected Q_SLOTS:
void wizardPageInsertionRequested(QWidget *widget, QInstaller::PackageManagerCore::WizardPage page);