| 148 | } |
| 149 | |
| 150 | void PageContainer::createUI() |
| 151 | { |
| 152 | m_pageStack = new QStackedLayout; |
| 153 | m_pageList = new PageView; |
| 154 | m_header = new QLabel(); |
| 155 | m_iconHeader = new IconLabel(this, QIcon(), QSize(24, 24)); |
| 156 | |
| 157 | QFont headerLabelFont = m_header->font(); |
| 158 | headerLabelFont.setBold(true); |
| 159 | const int pointSize = headerLabelFont.pointSize(); |
| 160 | if (pointSize > 0) |
| 161 | headerLabelFont.setPointSize(pointSize + 2); |
| 162 | m_header->setFont(headerLabelFont); |
| 163 | |
| 164 | QHBoxLayout *headerHLayout = new QHBoxLayout; |
| 165 | const int leftMargin = APPLICATION->style()->pixelMetric(QStyle::PM_LayoutLeftMargin); |
| 166 | headerHLayout->addSpacerItem(new QSpacerItem(leftMargin, 0, QSizePolicy::Fixed, QSizePolicy::Ignored)); |
| 167 | headerHLayout->addWidget(m_header); |
| 168 | headerHLayout->addSpacerItem(new QSpacerItem(0, 0, QSizePolicy::Expanding, QSizePolicy::Ignored)); |
| 169 | headerHLayout->addWidget(m_iconHeader); |
| 170 | const int rightMargin = APPLICATION->style()->pixelMetric(QStyle::PM_LayoutRightMargin); |
| 171 | headerHLayout->addSpacerItem(new QSpacerItem(rightMargin, 0, QSizePolicy::Fixed, QSizePolicy::Ignored)); |
| 172 | headerHLayout->setContentsMargins(0, 6, 0, 0); |
| 173 | |
| 174 | m_pageStack->setContentsMargins(0, 0, 0, 0); |
| 175 | m_pageStack->addWidget(new QWidget(this)); |
| 176 | |
| 177 | m_layout = new QGridLayout; |
| 178 | m_layout->addLayout(headerHLayout, 0, 1, 1, 1); |
| 179 | m_layout->addWidget(m_pageList, 0, 0, 2, 1); |
| 180 | m_layout->addLayout(m_pageStack, 1, 1, 1, 1); |
| 181 | m_layout->setColumnStretch(1, 4); |
| 182 | m_layout->setContentsMargins(0,0,0,6); |
| 183 | setLayout(m_layout); |
| 184 | } |
| 185 | |
| 186 | void PageContainer::retranslate() |
| 187 | { |