MCPcopy Create free account
hub / github.com/Codeya-IDE/deepin-ide / initUI

Method initUI

src/plugins/builder/mainframe/settingdialog.cpp:27–73  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

25}
26
27void SettingDialog::initUI()
28{
29 setFixedSize(550, 600);
30 setIcon(QIcon::fromTheme("ide"));
31 setWindowTitle(tr("Settings"));
32 setOnButtonClickedClose(false);
33
34 auto createButton = [this](const QIcon &icon, const QString &tips) {
35 auto btn = new QPushButton(this);
36 btn->setIconSize({ 16, 16 });
37 btn->setIcon(icon);
38 btn->setToolTip(tips);
39 return btn;
40 };
41
42 DFrame *contentFrame = new DFrame(this);
43 QVBoxLayout *mainLayout = new QVBoxLayout(contentFrame);
44
45 DLabel *label = new DLabel(tr("Select Prompt"), this);
46 promptCB = new QComboBox(this);
47 promptEdit = new QTextEdit(this);
48 promptEdit->setFrameShape(QFrame::NoFrame);
49 promptEdit->viewport()->installEventFilter(this);
50 promptEdit->installEventFilter(this);
51 addBtn = createButton(DStyle::standardIcon(style(), DStyle::SP_IncreaseElement), tr("Add Prompt"));
52 delBtn = createButton(DStyle::standardIcon(style(), DStyle::SP_DecreaseElement), tr("Delete Prompt"));
53
54 QHBoxLayout *topLayout = new QHBoxLayout;
55 topLayout->addWidget(label);
56 topLayout->addWidget(promptCB, 1);
57
58 QVBoxLayout *btnLayout = new QVBoxLayout;
59 btnLayout->addWidget(addBtn);
60 btnLayout->addWidget(delBtn);
61 btnLayout->addStretch(1);
62
63 QHBoxLayout *layout = new QHBoxLayout;
64 layout->addWidget(promptEdit);
65 layout->addLayout(btnLayout);
66
67 mainLayout->addLayout(topLayout);
68 mainLayout->addLayout(layout);
69
70 addContent(contentFrame);
71 addButton(tr("Cancel", "button"));
72 addButton(tr("OK", "button"), true, DDialog::ButtonRecommend);
73}
74
75void SettingDialog::initConnection()
76{

Callers

nothing calls this directly

Calls 3

styleFunction · 0.85
setIconMethod · 0.45
addWidgetMethod · 0.45

Tested by

no test coverage detected