| 25 | } |
| 26 | |
| 27 | void CodePortingWidget::initUI() |
| 28 | { |
| 29 | DStyle::setFrameRadius(this, 0); |
| 30 | setLineWidth(0); |
| 31 | |
| 32 | DButtonBox *btnBox = new DButtonBox(this); |
| 33 | btnBox->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed); |
| 34 | DButtonBoxButton *outputBtn = new DButtonBoxButton(tr("C&ode Porting")); |
| 35 | DButtonBoxButton *reportBtn = new DButtonBoxButton(tr("Porting &Report")); |
| 36 | QList<DButtonBoxButton*> list; |
| 37 | list.append(outputBtn); |
| 38 | list.append(reportBtn); |
| 39 | btnBox->setButtonList(list, true); |
| 40 | |
| 41 | DComboBox *reportTab = new DComboBox(); |
| 42 | reportTab->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed); |
| 43 | reportTab->addItem(REPORT_SRCLIST); |
| 44 | reportTab->addItem(REPORT_LIBLIST); |
| 45 | reportTab->hide(); |
| 46 | |
| 47 | connect(reportTab, &QComboBox::currentTextChanged, reportPane, &ReportPane::onChangeReportList); |
| 48 | |
| 49 | QHBoxLayout *hLayout = new QHBoxLayout(); |
| 50 | hLayout->setContentsMargins(0, 0, 0, 0); |
| 51 | hLayout->addWidget(btnBox); |
| 52 | hLayout->addWidget(reportTab); |
| 53 | hLayout->setAlignment(btnBox, Qt::AlignLeft); |
| 54 | hLayout->setAlignment(reportTab, Qt::AlignRight); |
| 55 | |
| 56 | DStackedWidget *tabWidget = new DStackedWidget(); |
| 57 | tabWidget->addWidget(outputPane); |
| 58 | tabWidget->addWidget(reportPane); |
| 59 | |
| 60 | QVBoxLayout *vLayout = new QVBoxLayout(this); |
| 61 | vLayout->addLayout(hLayout); |
| 62 | vLayout->addWidget(tabWidget); |
| 63 | |
| 64 | connect(outputBtn, &DButtonBoxButton::clicked, [=]{ |
| 65 | tabWidget->setCurrentIndex(list.indexOf(outputBtn)); |
| 66 | reportTab->hide(); |
| 67 | }); |
| 68 | |
| 69 | connect(reportBtn, &DButtonBoxButton::clicked, [=]{ |
| 70 | tabWidget->setCurrentIndex(list.indexOf(reportBtn)); |
| 71 | reportTab->show(); |
| 72 | }); |
| 73 | |
| 74 | outputBtn->setChecked(true); |
| 75 | } |
nothing calls this directly
no test coverage detected