QTfrontend/ui/page/pagetraining.cpp
changeset 14476 c5033a95fd7b
parent 14467 4c743ef80b1b
child 14478 afa4f2140252
equal deleted inserted replaced
14475:6ab8335fe0a6 14476:c5033a95fd7b
    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; }");
   102     tbw->setCurrentWidget(lstTrainings);
   107     tbw->setCurrentWidget(lstTrainings);
   103 
   108 
   104     QLabel* lblteam = new QLabel(tr("Team"));
   109     QLabel* lblteam = new QLabel(tr("Team"));
   105     CBTeam = new QComboBox(this);
   110     CBTeam = new QComboBox(this);
   106     CBTeam->setMaxVisibleItems(30);
   111     CBTeam->setMaxVisibleItems(30);
   107     pageLayout->addWidget(lblteam, 2, 0);
   112     pageLayout->addWidget(lblteam, 2, 1);
   108     pageLayout->addWidget(CBTeam, 2, 1);
   113     pageLayout->addWidget(CBTeam, 2, 2);
   109 
   114 
   110     return pageLayout;
   115     return pageLayout;
   111 }
   116 }
   112 
   117 
   113 QLayout * PageTraining::footerLayoutDefinition()
   118 QLayout * PageTraining::footerLayoutDefinition()