00001
00002
00003
00004
00005
00006
00007 #include "ChecklistGuidePage.h"
00008 #include "ChecklistLineEdit.h"
00009 #include "Logger.h"
00010 #include <QGridLayout>
00011 #include <QLabel>
00012 #include <QPalette>
00013 #include <QRadioButton>
00014 #include <QVBoxLayout>
00015
00016 ChecklistGuidePage::ChecklistGuidePage(const QString &title) :
00017 m_row (0),
00018 m_checklineLineEditContainer (0),
00019 m_checklineLineEditLayout (0)
00020 {
00021 setTitle (title);
00022
00023 m_layout = new QGridLayout;
00024 m_layout->setColumnStretch (0, 0);
00025 m_layout->setColumnStretch (1, 1);
00026 setLayout (m_layout);
00027 }
00028
00029 void ChecklistGuidePage::addHtml (const QString &html)
00030 {
00031 LOG4CPP_INFO_S ((*mainCat)) << "ChecklistGuidePage::addHtml";
00032
00033 QLabel *label = new QLabel (html);
00034 label->setWordWrap (true);
00035
00036 m_layout->addWidget (label, m_row++, 0, 1, 2, Qt::AlignTop);
00037 }
00038
00039 QRadioButton *ChecklistGuidePage::addLabelAndRadioButton (const QString &label,
00040 const QString &whatsThis)
00041 {
00042 LOG4CPP_INFO_S ((*mainCat)) << "ChecklistGuidePage::addLabelAndRadioButton";
00043
00044 QRadioButton *button = new QRadioButton;
00045 button->setWhatsThis (whatsThis);
00046 m_layout->addWidget (button, m_row, 0, 1, 1, Qt::AlignTop);
00047
00048 QLabel *lbl = new QLabel (label);
00049 lbl->setWordWrap(true);
00050 m_layout->addWidget (lbl, m_row++, 1, 1, 1, Qt::AlignTop);
00051
00052 return button;
00053 }
00054
00055 void ChecklistGuidePage::addLineEdit (ChecklistLineEdit *edit,
00056 const QString &whatsThis)
00057 {
00058 LOG4CPP_INFO_S ((*mainCat)) << "ChecklistGuidePage::addLineEdit";
00059
00060 bool isFirst = false;
00061
00062 if (m_checklineLineEditContainer == 0) {
00063
00064 isFirst = true;
00065
00066
00067 m_checklineLineEditLayout = new QVBoxLayout;
00068 m_checklineLineEditLayout->setSpacing (0);
00069
00070 m_checklineLineEditContainer = new QWidget;
00071 m_checklineLineEditContainer->setLayout (m_checklineLineEditLayout);
00072 m_layout->addWidget (m_checklineLineEditContainer, m_row++, 0, 1, 2, Qt::AlignTop);
00073 }
00074
00075 edit->setWhatsThis (whatsThis);
00076 m_checklineLineEditLayout->addWidget (edit);
00077
00078
00079 QString style = QString ("QLineEdit { "
00080 "border-left : 1px solid gray; "
00081 "border-right: 1px solid gray; "
00082 "border-top: %1px solid gray; "
00083 "border-bottom:1px solid gray; }")
00084 .arg (isFirst ? 1 : 0);
00085 edit->setStyleSheet (style);
00086 }