From 218071207cc7e719e5fc8dba64d197588538d3d7 Mon Sep 17 00:00:00 2001 From: Claudio Valerio Date: Mon, 3 Sep 2012 15:59:49 +0200 Subject: [PATCH] resizable title page first draft achieved --- src/gui/UBTeacherGuideWidget.cpp | 74 ++++++++++++++++++++------------ src/gui/UBTeacherGuideWidget.h | 7 ++- 2 files changed, 52 insertions(+), 29 deletions(-) diff --git a/src/gui/UBTeacherGuideWidget.cpp b/src/gui/UBTeacherGuideWidget.cpp index 77bebf96..a18edc4e 100644 --- a/src/gui/UBTeacherGuideWidget.cpp +++ b/src/gui/UBTeacherGuideWidget.cpp @@ -20,7 +20,7 @@ #include #include #include - +#include #include "UBTeacherGuideWidget.h" @@ -632,8 +632,11 @@ UBTeacherGuidePageZeroWidget::UBTeacherGuidePageZeroWidget(QWidget* parent, cons QWidget(parent) , mpLayout(NULL) , mpButtonTitleLayout(NULL) + , mpContainerWidgetLayout(NULL) , mpModePushButton(NULL) , mpPageNumberLabel(NULL) + , mpScrollArea(NULL) + , mpContainerWidget(NULL) , mpSessionTitle(NULL) , mpSeparatorSessionTitle(NULL) , mpAuthorsLabel(NULL) @@ -673,6 +676,18 @@ UBTeacherGuidePageZeroWidget::UBTeacherGuidePageZeroWidget(QWidget* parent, cons mpPageNumberLabel->setText(tr("Title page")); mpLayout->addWidget(mpPageNumberLabel); + + mpScrollArea = new QScrollArea(); + mpContainerWidget = new QWidget(); + mpContainerWidgetLayout = new QVBoxLayout(); + + + mpLayout->addWidget(mpScrollArea); + mpScrollArea->setWidget(mpContainerWidget); + mpScrollArea->setWidgetResizable(true); + mpContainerWidget->setLayout(mpContainerWidgetLayout); + + mpButtonTitleLayout = new QHBoxLayout(0); mpModePushButton = new QPushButton(this); @@ -687,129 +702,129 @@ UBTeacherGuidePageZeroWidget::UBTeacherGuidePageZeroWidget(QWidget* parent, cons mpButtonTitleLayout->addWidget(mpSessionTitle); connect(this, SIGNAL(resized()), mpSessionTitle, SLOT(onTextChanged())); - mpLayout->addLayout(mpButtonTitleLayout); + mpContainerWidgetLayout->addLayout(mpButtonTitleLayout); mpSeparatorSessionTitle = new QFrame(this); mpSeparatorSessionTitle->setFixedHeight(UBTG_SEPARATOR_FIXED_HEIGHT); mpSeparatorSessionTitle->setObjectName("UBTGSeparator"); - mpLayout->addWidget(mpSeparatorSessionTitle); + mpContainerWidgetLayout->addWidget(mpSeparatorSessionTitle); mpAuthorsLabel = new QLabel(this); mpAuthorsLabel->setObjectName("UBTGZeroPageEditionModeTitle"); mpAuthorsLabel->setText(tr("Author(s)")); mpAuthorsLabel->setStyleSheet(chapterStyle); - mpLayout->addWidget(mpAuthorsLabel); + mpContainerWidgetLayout->addWidget(mpAuthorsLabel); mpAuthors = new UBTGAdaptableText(0, this); mpAuthors->setObjectName("UBTGZeroPageInputText"); mpAuthors->setPlaceHolderText(tr("Type authors here ...")); - mpLayout->addWidget(mpAuthors); + mpContainerWidgetLayout->addWidget(mpAuthors); connect(this, SIGNAL(resized()), mpAuthors, SLOT(onTextChanged())); mpCreationLabel = new QLabel(this); mpCreationLabel->setObjectName("UBTGZeroPageDateLabel"); - mpLayout->addWidget(mpCreationLabel); + mpContainerWidgetLayout->addWidget(mpCreationLabel); mpLastModifiedLabel = new QLabel(this); mpLastModifiedLabel->setObjectName("UBTGZeroPageDateLabel"); - mpLayout->addWidget(mpLastModifiedLabel); + mpContainerWidgetLayout->addWidget(mpLastModifiedLabel); mpSeparatorAuthors = new QFrame(this); mpSeparatorAuthors->setFixedHeight(UBTG_SEPARATOR_FIXED_HEIGHT); mpSeparatorAuthors->setObjectName("UBTGSeparator"); - mpLayout->addWidget(mpSeparatorAuthors); + mpContainerWidgetLayout->addWidget(mpSeparatorAuthors); mpObjectivesLabel = new QLabel(this); mpObjectivesLabel->setObjectName("UBTGZeroPageEditionModeTitle"); mpObjectivesLabel->setText(tr("Objective(s)")); mpObjectivesLabel->setStyleSheet(chapterStyle); - mpLayout->addWidget(mpObjectivesLabel); + mpContainerWidgetLayout->addWidget(mpObjectivesLabel); mpObjectives = new UBTGAdaptableText(0, this); mpObjectives->setObjectName("UBTGZeroPageInputText"); mpObjectives->setPlaceHolderText(tr("Type objectives here...")); - mpLayout->addWidget(mpObjectives); + mpContainerWidgetLayout->addWidget(mpObjectives); connect(this, SIGNAL(resized()), mpObjectives, SLOT(onTextChanged())); mpSeparatorObjectives = new QFrame(this); mpSeparatorObjectives->setFixedHeight(UBTG_SEPARATOR_FIXED_HEIGHT); mpSeparatorObjectives->setObjectName("UBTGSeparator"); - mpLayout->addWidget(mpSeparatorObjectives); + mpContainerWidgetLayout->addWidget(mpSeparatorObjectives); mpIndexLabel = new QLabel(this); mpIndexLabel->setObjectName("UBTGZeroPageEditionModeTitle"); mpIndexLabel->setText(tr("Resource indexing")); mpIndexLabel->setStyleSheet(chapterStyle); - mpLayout->addWidget(mpIndexLabel); + mpContainerWidgetLayout->addWidget(mpIndexLabel); mpKeywordsLabel = new QLabel(this); mpKeywordsLabel->setObjectName("UBTGZeroPageItemLabel"); mpKeywordsLabel->setText(tr("Keywords:")); mpKeywordsLabel->setStyleSheet(chapterStyle); - mpLayout->addWidget(mpKeywordsLabel); + mpContainerWidgetLayout->addWidget(mpKeywordsLabel); mpKeywords = new UBTGAdaptableText(0, this); mpKeywords->setPlaceHolderText(tr("Type keywords here ...")); - mpLayout->addWidget(mpKeywords); + mpContainerWidgetLayout->addWidget(mpKeywords); connect(this, SIGNAL(resized()), mpKeywords, SLOT(onTextChanged())); mpSchoolLevelItemLabel = new QLabel(this); mpSchoolLevelItemLabel->setObjectName("UBTGZeroPageItemLabel"); mpSchoolLevelItemLabel->setText(tr("Level:")); mpSchoolLevelItemLabel->setStyleSheet(chapterStyle); - mpLayout->addWidget(mpSchoolLevelItemLabel); + mpContainerWidgetLayout->addWidget(mpSchoolLevelItemLabel); mpSchoolLevelBox = new QComboBox(this); mpSchoolLevelBox->setMinimumHeight(22); mpSchoolLevelBox->setObjectName("DockPaletteWidgetComboBox"); connect(mpSchoolLevelBox, SIGNAL(currentIndexChanged(QString)), this, SLOT(onSchoolLevelChanged(QString))); - mpLayout->addWidget(mpSchoolLevelBox); + mpContainerWidgetLayout->addWidget(mpSchoolLevelBox); mpSchoolLevelValueLabel = new QLabel(this); - mpLayout->addWidget(mpSchoolLevelValueLabel); + mpContainerWidgetLayout->addWidget(mpSchoolLevelValueLabel); mpSchoolSubjectsItemLabel = new QLabel(this); mpSchoolSubjectsItemLabel->setObjectName("UBTGZeroPageItemLabel"); mpSchoolSubjectsItemLabel->setText(tr("Subjects:")); mpSchoolSubjectsItemLabel->setStyleSheet(chapterStyle); - mpLayout->addWidget(mpSchoolSubjectsItemLabel); + mpContainerWidgetLayout->addWidget(mpSchoolSubjectsItemLabel); mpSchoolSubjectsBox = new QComboBox(this); mpSchoolSubjectsBox->setMinimumHeight(22); mpSchoolSubjectsBox->setObjectName("DockPaletteWidgetComboBox"); - mpLayout->addWidget(mpSchoolSubjectsBox); + mpContainerWidgetLayout->addWidget(mpSchoolSubjectsBox); mpSchoolSubjectsValueLabel = new QLabel(this); - mpLayout->addWidget(mpSchoolSubjectsValueLabel); + mpContainerWidgetLayout->addWidget(mpSchoolSubjectsValueLabel); mpSchoolTypeItemLabel = new QLabel(this); mpSchoolTypeItemLabel->setObjectName("UBTGZeroPageItemLabel"); mpSchoolTypeItemLabel->setText(tr("Type:")); mpSchoolTypeItemLabel->setStyleSheet(chapterStyle); - mpLayout->addWidget(mpSchoolTypeItemLabel); + mpContainerWidgetLayout->addWidget(mpSchoolTypeItemLabel); mpSchoolTypeBox = new QComboBox(this); mpSchoolTypeBox->setMinimumHeight(22); mpSchoolTypeBox->setObjectName("DockPaletteWidgetComboBox"); - mpLayout->addWidget(mpSchoolTypeBox); + mpContainerWidgetLayout->addWidget(mpSchoolTypeBox); mpSchoolTypeValueLabel = new QLabel(this); - mpLayout->addWidget(mpSchoolTypeValueLabel); + mpContainerWidgetLayout->addWidget(mpSchoolTypeValueLabel); mpSeparatorIndex = new QFrame(this); mpSeparatorIndex->setFixedHeight(UBTG_SEPARATOR_FIXED_HEIGHT); mpSeparatorIndex->setObjectName("UBTGSeparator"); - mpLayout->addWidget(mpSeparatorIndex); + mpContainerWidgetLayout->addWidget(mpSeparatorIndex); mpLicenceLabel = new QLabel(this); mpLicenceLabel->setObjectName("UBTGZeroPageItemLabel"); mpLicenceLabel->setText(tr("Licence")); mpLicenceLabel->setStyleSheet(chapterStyle); - mpLayout->addWidget(mpLicenceLabel); + mpContainerWidgetLayout->addWidget(mpLicenceLabel); mpLicenceBox = new QComboBox(this); mpLicenceBox->setMinimumHeight(22); mpLicenceBox->setObjectName("DockPaletteWidgetComboBox"); - mpLayout->addWidget(mpLicenceBox); + mpContainerWidgetLayout->addWidget(mpLicenceBox); mpLicenceLayout = new QHBoxLayout(0); mpLicenceIcon = new QLabel(this); mpLicenceLayout->addWidget(mpLicenceIcon); mpLicenceValueLabel = new QLabel(this); mpLicenceLayout->addWidget(mpLicenceValueLabel); - mpLayout->addLayout(mpLicenceLayout); - mpLayout->addStretch(1); + mpContainerWidgetLayout->addLayout(mpLicenceLayout); + mpContainerWidgetLayout->addStretch(1); connect(UBApplication::boardController, SIGNAL(activeSceneChanged()), this, SLOT(onActiveSceneChanged())); fillComboBoxes(); @@ -845,6 +860,9 @@ UBTeacherGuidePageZeroWidget::~UBTeacherGuidePageZeroWidget() DELETEPTR(mpModePushButton); DELETEPTR(mpLicenceLayout); DELETEPTR(mpButtonTitleLayout); + DELETEPTR(mpContainerWidgetLayout); + DELETEPTR(mpContainerWidget); + DELETEPTR(mpScrollArea); DELETEPTR(mpLayout); } diff --git a/src/gui/UBTeacherGuideWidget.h b/src/gui/UBTeacherGuideWidget.h index a970807e..60e5ab04 100644 --- a/src/gui/UBTeacherGuideWidget.h +++ b/src/gui/UBTeacherGuideWidget.h @@ -23,7 +23,7 @@ class QVBoxLayout; class QPushButton; class UBDocumentProxy; class UBGraphicsTextItem; - +class QScrollArea; #include "UBTeacherGuideWidgetsTools.h" @@ -155,8 +155,13 @@ private: QVBoxLayout* mpLayout; QHBoxLayout* mpButtonTitleLayout; + QVBoxLayout* mpContainerWidgetLayout; QPushButton* mpModePushButton; QLabel* mpPageNumberLabel; + + QScrollArea* mpScrollArea; + QWidget* mpContainerWidget; + UBTGAdaptableText* mpSessionTitle; QFrame* mpSeparatorSessionTitle;