Center wizard page and use "classic style"

This commit is contained in:
Klaus Basan
2019-04-09 15:59:31 +02:00
committed by Mat Sutcliffe
parent 1dd10ffe29
commit 5c870a8404
4 changed files with 37 additions and 4 deletions

View File

@@ -25,6 +25,9 @@
<property name="modal">
<bool>true</bool>
</property>
<property name="wizardStyle">
<enum>QWizard::ClassicStyle</enum>
</property>
<property name="options">
<set>QWizard::HaveCustomButton1</set>
</property>
@@ -140,8 +143,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>98</width>
<height>28</height>
<width>90</width>
<height>20</height>
</rect>
</property>
<layout class="QVBoxLayout" name="vl_CopySettingsAndCacheWidget">
@@ -243,7 +246,7 @@
<rect>
<x>0</x>
<y>0</y>
<width>98</width>
<width>89</width>
<height>64</height>
</rect>
</property>
@@ -268,7 +271,7 @@
<rect>
<x>0</x>
<y>0</y>
<width>98</width>
<width>75</width>
<height>64</height>
</rect>
</property>

View File

@@ -572,6 +572,29 @@ namespace BlackGui
return QSizeF(w, h);
}
void CGuiUtility::centerWidget(QWidget *widget)
{
const QRect screenGeometry = QApplication::desktop()->screenGeometry();
const int x = (screenGeometry.width() - widget->width()) / 2;
const int y = (screenGeometry.height() - widget->height()) / 2;
widget->move(x, y);
}
void CGuiUtility::centerWidget(QWidget *widget, QWidget *host)
{
if (!host) { host = widget->parentWidget(); }
if (host)
{
const QRect hostRect = host->geometry();
widget->move(hostRect.center() - widget->rect().center());
}
else
{
CGuiUtility::centerWidget(widget);
}
}
QString CGuiUtility::metricsInfo()
{
static const QString s("%1 %2 %3 | 80 chars: w%4 h%5 | 43 chars: w%6 h%7");

View File

@@ -218,6 +218,12 @@ namespace BlackGui
//! Estimate size based on current font
static QSizeF fontMetricsEstimateSize(int xCharacters, int yCharacters, bool withRatio = false);
//! Center widget to host or screen
static void centerWidget(QWidget *widget);
//! Center widget to screen
static void centerWidget(QWidget *widget, QWidget *host);
//! Some info about font metrics
static QString metricsInfo();

View File

@@ -506,6 +506,7 @@ void CSwiftLauncher::startWizard()
m_wizard.reset(new CConfigurationWizard(this));
}
m_wizard->show();
CGuiUtility::centerWidget(m_wizard.data(), this);
}
void CSwiftLauncher::onStyleSheetsChanged()