Scale Welcome image correctly, adjust layouts throughout Welcome page.

This commit is contained in:
Teo Mrnjavac 2015-06-20 01:05:55 +02:00
parent 80c76c549f
commit b636d69a45
4 changed files with 17 additions and 25 deletions

View File

@ -94,8 +94,7 @@ WelcomePage::WelcomePage( RequirementsChecker* requirementsChecker, QWidget* par
mb.exec();
} );
ui->verticalLayout->insertStretch( 3 );
ui->verticalLayout->insertWidget( 4, m_requirementsChecker->widget() );
ui->verticalLayout->insertWidget( 3, m_requirementsChecker->widget() );
}

View File

@ -15,7 +15,7 @@
</property>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<layout class="QVBoxLayout" name="verticalLayout" stretch="0,0,0,0,0,0">
<layout class="QVBoxLayout" name="verticalLayout" stretch="0,0,0,0,0">
<item>
<spacer name="verticalSpacer">
<property name="orientation">
@ -45,19 +45,6 @@
</property>
</widget>
</item>
<item>
<spacer name="verticalSpacer_2">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_3" stretch="0,1,2,1,0">
<item>

View File

@ -20,9 +20,10 @@
#include "CheckItemWidget.h"
#include "Branding.h"
#include "utils/CalamaresUtilsGui.h"
#include "utils/Retranslator.h"
#include "Branding.h"
#include "widgets/FixedAspectRatioLabel.h"
#include <QAbstractButton>
#include <QBoxLayout>
@ -34,13 +35,13 @@
CheckerWidget::CheckerWidget( QWidget* parent )
: QWidget( parent )
{
setSizePolicy( QSizePolicy::Expanding, QSizePolicy::Minimum );
setSizePolicy( QSizePolicy::Expanding, QSizePolicy::Expanding );
QBoxLayout* mainLayout = new QVBoxLayout;
setLayout( mainLayout );
m_mainLayout = new QVBoxLayout;
setLayout( m_mainLayout );
QHBoxLayout* spacerLayout = new QHBoxLayout;
mainLayout->addLayout( spacerLayout );
m_mainLayout->addLayout( spacerLayout );
m_paddingSize = qBound( 32, CalamaresUtils::defaultFontHeight() * 4, 128 );
spacerLayout->addSpacing( m_paddingSize );
m_entriesLayout = new QVBoxLayout;
@ -128,11 +129,11 @@ CheckerWidget::init( const QList< PrepareEntry >& checkEntries )
imagePath( Calamares::Branding::ProductWelcome ) );
if ( !theImage.isNull() )
{
QLabel* imageLabel = new QLabel;
imageLabel->setContentsMargins( 4, CalamaresUtils::defaultFontHeight(), 4, 4 );
m_entriesLayout->addWidget( imageLabel );
FixedAspectRatioLabel* imageLabel = new FixedAspectRatioLabel;
imageLabel->setContentsMargins( 4, CalamaresUtils::defaultFontHeight()*0.75, 4, 4 );
m_mainLayout->addWidget( imageLabel );
imageLabel->setAlignment( Qt::AlignCenter );
imageLabel->setScaledContents( false );
imageLabel->setSizePolicy( QSizePolicy::Expanding, QSizePolicy::Expanding );
imageLabel->setPixmap( theImage );
}
@ -145,6 +146,10 @@ CheckerWidget::init( const QList< PrepareEntry >& checkEntries )
textLabel->setAlignment( Qt::AlignCenter );
)
}
else
{
m_mainLayout->addStretch();
}
}

View File

@ -35,6 +35,7 @@ public:
private:
void showDetailsDialog( const QList< PrepareEntry >& checkEntries );
QBoxLayout* m_mainLayout;
QBoxLayout* m_entriesLayout;
int m_paddingSize;
};