MCPcopy Create free account
hub / github.com/YACReader/yacreader / AddLabelDialog

Method AddLabelDialog

YACReaderLibrary/add_label_dialog.cpp:23–64  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

21}
22
23AddLabelDialog::AddLabelDialog(QWidget *parent)
24 : QDialog(parent)
25{
26 auto layout = new QVBoxLayout;
27
28 layout->addWidget(new QLabel(tr("Label name:")));
29 layout->addWidget(edit = new QLineEdit());
30
31 layout->addWidget(new QLabel(tr("Choose a color:")));
32 layout->addWidget(list = new QListWidget());
33
34 for (const auto &colorName : labelColorNames) {
35 list->addItem(new QListWidgetItem(tr(colorName)));
36 }
37
38 list->setMinimumHeight(225);
39
40 setModal(true);
41
42 setMinimumHeight(340);
43
44 // buttons
45 acceptButton = new QPushButton(tr("accept"), this);
46 cancelButton = new QPushButton(tr("cancel"), this);
47
48 auto buttons = new QHBoxLayout;
49 buttons->addStretch();
50 buttons->addWidget(acceptButton);
51 buttons->addWidget(cancelButton);
52
53 layout->addStretch();
54 layout->addLayout(buttons);
55
56 setLayout(layout);
57
58 // connections
59 connect(edit, &QLineEdit::textChanged, this, &AddLabelDialog::validateName);
60 connect(cancelButton, &QAbstractButton::clicked, this, &QWidget::close);
61 connect(acceptButton, &QAbstractButton::clicked, this, &QDialog::accept);
62
63 initTheme(this);
64}
65
66void AddLabelDialog::applyTheme(const Theme &theme)
67{

Callers

nothing calls this directly

Calls 1

addItemMethod · 0.80

Tested by

no test coverage detected