35 |
35 |
36 QLayout * PageTraining::bodyLayoutDefinition() |
36 QLayout * PageTraining::bodyLayoutDefinition() |
37 { |
37 { |
38 QGridLayout * pageLayout = new QGridLayout(); |
38 QGridLayout * pageLayout = new QGridLayout(); |
39 |
39 |
40 // left column |
|
41 |
|
42 // declare start button, caption and description |
40 // declare start button, caption and description |
43 btnPreview = formattedButton(":/res/Trainings.png", true); |
41 btnPreview = formattedButton(":/res/Trainings.png", true); |
44 |
42 |
45 // make both rows equal height |
43 // tweak widget spacing |
46 pageLayout->setRowStretch(0, 1); |
44 pageLayout->setRowStretch(0, 1); |
47 pageLayout->setRowStretch(1, 1); |
45 pageLayout->setRowStretch(1, 1); |
48 |
46 pageLayout->setRowStretch(2, 1); |
49 // add start button, caption and description to 3 different rows |
47 pageLayout->setColumnStretch(0, 5); |
50 pageLayout->addWidget(btnPreview, 0, 0); |
48 pageLayout->setColumnStretch(1, 1); |
|
49 pageLayout->setColumnStretch(2, 9); |
|
50 pageLayout->setColumnStretch(3, 5); |
|
51 |
|
52 QWidget * infoWidget = new QWidget(); |
|
53 QHBoxLayout * infoLayout = new QHBoxLayout(); |
|
54 // add preview, caption and description |
|
55 infoWidget->setLayout(infoLayout); |
|
56 infoLayout->addWidget(btnPreview); |
51 |
57 |
52 // center preview |
58 // center preview |
53 pageLayout->setAlignment(btnPreview, Qt::AlignRight | Qt::AlignVCenter); |
59 infoLayout->setAlignment(btnPreview, Qt::AlignRight | Qt::AlignVCenter); |
54 |
|
55 |
|
56 // right column |
|
57 |
60 |
58 // info area (caption on top, description below) |
61 // info area (caption on top, description below) |
59 QWidget * infoWidget = new QWidget(); |
62 QWidget * infoTextWidget = new QWidget(); |
60 QVBoxLayout * infoLayout = new QVBoxLayout(); |
63 QVBoxLayout * infoTextLayout = new QVBoxLayout(); |
61 infoWidget->setObjectName("trainingInfo"); |
64 infoTextWidget->setObjectName("trainingInfo"); |
62 infoWidget->setLayout(infoLayout); |
65 infoTextWidget->setLayout(infoTextLayout); |
63 |
66 |
64 lblCaption = new QLabel(); |
67 lblCaption = new QLabel(); |
65 lblCaption->setMinimumWidth(360); |
68 lblCaption->setMinimumWidth(360); |
66 lblCaption->setAlignment(Qt::AlignHCenter | Qt::AlignBottom); |
69 lblCaption->setAlignment(Qt::AlignHCenter | Qt::AlignBottom); |
67 lblCaption->setWordWrap(true); |
70 lblCaption->setWordWrap(true); |
68 lblDescription = new QLabel(); |
71 lblDescription = new QLabel(); |
69 lblDescription->setMinimumWidth(360); |
72 lblDescription->setMinimumWidth(360); |
70 lblDescription->setAlignment(Qt::AlignHCenter | Qt::AlignTop); |
73 lblDescription->setAlignment(Qt::AlignHCenter | Qt::AlignTop); |
71 lblDescription->setWordWrap(true); |
74 lblDescription->setWordWrap(true); |
72 |
75 |
73 infoLayout->addWidget(lblCaption); |
76 infoTextLayout->addWidget(lblCaption); |
74 infoLayout->addWidget(lblDescription); |
77 infoTextLayout->addWidget(lblDescription); |
75 |
78 |
76 pageLayout->addWidget(infoWidget, 0, 1); |
79 infoLayout->addWidget(infoTextWidget); |
77 pageLayout->setAlignment(infoWidget, Qt::AlignLeft); |
80 |
|
81 pageLayout->addWidget(infoWidget, 0, 1, 1, 2); // span 2 columns |
|
82 pageLayout->setAlignment(infoTextWidget, Qt::AlignLeft); |
78 |
83 |
79 |
84 |
80 // tab widget containing all lists |
85 // tab widget containing all lists |
81 tbw = new QTabWidget(this); |
86 tbw = new QTabWidget(this); |
82 pageLayout->addWidget(tbw, 1, 0, 1, 2); // span 2 columns |
87 pageLayout->addWidget(tbw, 1, 0, 1, 4); // span 4 columns |
83 // let's not make the tab widget use more space than needed |
88 // let's not make the tab widget use more space than needed |
84 tbw->setFixedWidth(400); |
89 tbw->setFixedWidth(400); |
85 pageLayout->setAlignment(tbw, Qt::AlignHCenter); |
90 pageLayout->setAlignment(tbw, Qt::AlignHCenter); |
86 |
91 |
87 tbw->setStyleSheet("QListWidget { border-style: none; padding-top: 6px; }"); |
92 tbw->setStyleSheet("QListWidget { border-style: none; padding-top: 6px; }"); |