Make the Summary page contents scrollable.

main
Teo Mrnjavac 10 years ago
parent 69f6a2c73c
commit e6748f8656

@ -1,6 +1,6 @@
/* === This file is part of Calamares - <http://github.com/calamares> === /* === This file is part of Calamares - <http://github.com/calamares> ===
* *
* Copyright 2014, Teo Mrnjavac <teo@kde.org> * Copyright 2014-2015, Teo Mrnjavac <teo@kde.org>
* *
* Calamares is free software: you can redistribute it and/or modify * Calamares is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@ -25,11 +25,14 @@
#include <QBoxLayout> #include <QBoxLayout>
#include <QLabel> #include <QLabel>
#include <QScrollArea>
static const int SECTION_SPACING = 12; static const int SECTION_SPACING = 12;
SummaryPage::SummaryPage( QWidget* parent ) SummaryPage::SummaryPage( QWidget* parent )
: QWidget() : QWidget()
, m_scrollArea( new QScrollArea( this ) )
, m_contentWidget( nullptr )
{ {
QVBoxLayout* layout = new QVBoxLayout( this ); QVBoxLayout* layout = new QVBoxLayout( this );
layout->setContentsMargins( 0, 0, 0, 0 ); layout->setContentsMargins( 0, 0, 0, 0 );
@ -40,6 +43,12 @@ SummaryPage::SummaryPage( QWidget* parent )
"the install procedure." ) ); "the install procedure." ) );
) )
layout->addWidget( headerLabel ); layout->addWidget( headerLabel );
layout->addWidget( m_scrollArea );
m_scrollArea->setWidgetResizable( true );
m_scrollArea->setHorizontalScrollBarPolicy( Qt::ScrollBarAlwaysOff );
m_scrollArea->setVerticalScrollBarPolicy( Qt::ScrollBarAsNeeded );
m_scrollArea->setFrameStyle( QFrame::NoFrame );
m_scrollArea->setContentsMargins( 0, 0, 0, 0 );
} }
@ -88,7 +97,7 @@ SummaryPage::createContentWidget()
m_contentWidget = new QWidget; m_contentWidget = new QWidget;
m_layout = new QVBoxLayout( m_contentWidget ); m_layout = new QVBoxLayout( m_contentWidget );
CalamaresUtils::unmarginLayout( m_layout ); CalamaresUtils::unmarginLayout( m_layout );
layout()->addWidget( m_contentWidget ); m_scrollArea->setWidget( m_contentWidget );
} }
QLabel* QLabel*

@ -1,6 +1,6 @@
/* === This file is part of Calamares - <http://github.com/calamares> === /* === This file is part of Calamares - <http://github.com/calamares> ===
* *
* Copyright 2014, Teo Mrnjavac <teo@kde.org> * Copyright 2014-2015, Teo Mrnjavac <teo@kde.org>
* *
* Calamares is free software: you can redistribute it and/or modify * Calamares is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@ -22,6 +22,7 @@
#include <QWidget> #include <QWidget>
class QLabel; class QLabel;
class QScrollArea;
class QVBoxLayout; class QVBoxLayout;
class SummaryPage : public QWidget class SummaryPage : public QWidget
@ -39,6 +40,8 @@ private:
void createContentWidget(); void createContentWidget();
QLabel* createTitleLabel( const QString& text ) const; QLabel* createTitleLabel( const QString& text ) const;
QLabel* createBodyLabel( const QString& text ) const; QLabel* createBodyLabel( const QString& text ) const;
QScrollArea* m_scrollArea;
}; };
#endif // SUMMARYPAGE_H #endif // SUMMARYPAGE_H

Loading…
Cancel
Save