QTfrontend/ui/page/AbstractPage.cpp
changeset 6477 ad5741c252b9
parent 6200 6a4ace88d85a
child 6572 0d0af531c1c7
equal deleted inserted replaced
6476:afb7ef0c1c6e 6477:ad5741c252b9
    20  * @file
    20  * @file
    21  * @brief AbstractPage class implementation
    21  * @brief AbstractPage class implementation
    22  */
    22  */
    23 
    23 
    24 #include "AbstractPage.h"
    24 #include "AbstractPage.h"
       
    25 #include <QLabel>
       
    26 #include <QSize>
       
    27 #include <QFontMetricsF>
    25 
    28 
    26 AbstractPage::AbstractPage(QWidget* parent)
    29 AbstractPage::AbstractPage(QWidget* parent)
    27 {
    30 {
    28     Q_UNUSED(parent);
    31     Q_UNUSED(parent);
       
    32     defautDesc = new QString();
    29 
    33 
    30     font14 = new QFont("MS Shell Dlg", 14);
    34     font14 = new QFont("MS Shell Dlg", 14);
    31 }
    35 }
    32 
    36 
    33 void AbstractPage::initPage()
    37 void AbstractPage::initPage()
    43     // add back/exit button
    47     // add back/exit button
    44     btnBack = formattedButton(":/res/Exit.png", true);
    48     btnBack = formattedButton(":/res/Exit.png", true);
    45     pageLayout->addWidget(btnBack, 1, 0, 1, 1, Qt::AlignLeft | Qt::AlignBottom);
    49     pageLayout->addWidget(btnBack, 1, 0, 1, 1, Qt::AlignLeft | Qt::AlignBottom);
    46 
    50 
    47     // add body layout as defined by the subclass
    51     // add body layout as defined by the subclass
    48     pageLayout->addLayout(bodyLayoutDefinition(), 0, 0, 1, 2);
    52     pageLayout->addLayout(bodyLayoutDefinition(), 0, 0, 1, 3);
       
    53 
       
    54     descLabel = new QLabel();
       
    55     descLabel->setAlignment(Qt::AlignCenter);
       
    56     descLabel->setWordWrap(true);
       
    57     descLabel->setOpenExternalLinks(true);
       
    58     descLabel->setFixedHeight(50);
       
    59     descLabel->setStyleSheet("font-size: 16px");
       
    60     pageLayout->addWidget(descLabel, 1, 1);
    49 
    61 
    50     // add footer layout
    62     // add footer layout
    51     QLayout * fld = footerLayoutDefinition();
    63     QLayout * fld = footerLayoutDefinition();
    52     if (fld != NULL)
    64     if (fld != NULL)
    53         pageLayout->addLayout(fld, 1, 1);
    65         pageLayout->addLayout(fld, 1, 2);
    54 
    66 
    55     // connect signals
    67     // connect signals
    56     connect(btnBack, SIGNAL(clicked()), this, SIGNAL(goBack()));
    68     connect(btnBack, SIGNAL(clicked()), this, SIGNAL(goBack()));
    57     connectSignals();
    69     connectSignals();
    58 }
    70 }
    95 
   107 
    96 void AbstractPage::setBackButtonVisible(bool visible)
   108 void AbstractPage::setBackButtonVisible(bool visible)
    97 {
   109 {
    98     btnBack->setVisible(visible);
   110     btnBack->setVisible(visible);
    99 }
   111 }
       
   112 
       
   113 void AbstractPage::setButtonDescription(QString desc)
       
   114 {
       
   115     descLabel->setText(desc);
       
   116 }
       
   117 
       
   118 void AbstractPage::setDefautDescription(QString text)
       
   119 {
       
   120     *defautDesc = text;
       
   121     descLabel->setText(text);
       
   122 }
       
   123 
       
   124 QString * AbstractPage::getDefautDescription()
       
   125 {
       
   126     return defautDesc;
       
   127 }