MCPcopy Create free account
hub / github.com/Artikash/Textractor / AttachProcessDialog

Method AttachProcessDialog

GUI/attachprocessdialog.cpp:7–34  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

5extern const char* ATTACH_INFO;
6
7AttachProcessDialog::AttachProcessDialog(QWidget* parent, std::vector<std::pair<QString, HICON>> processIcons) :
8 QDialog(parent, Qt::WindowCloseButtonHint),
9 model(this)
10{
11 ui.setupUi(this);
12 setWindowTitle(SELECT_PROCESS);
13 ui.label->setText(ATTACH_INFO);
14 ui.processList->setModel(&model);
15
16 QPixmap transparent(100, 100);
17 transparent.fill(QColor::fromRgba(0));
18 for (const auto& [process, icon] : processIcons)
19 {
20 auto item = new QStandardItem(icon ? QIcon(QtWin::fromHICON(icon)) : transparent, process);
21 item->setEditable(false);
22 model.appendRow(item);
23 }
24
25 connect(ui.buttonBox, &QDialogButtonBox::accepted, this, &QDialog::accept);
26 connect(ui.buttonBox, &QDialogButtonBox::rejected, this, &QDialog::reject);
27 connect(ui.processList, &QListView::clicked, [this](QModelIndex index) { ui.processEdit->setText(model.item(index.row())->text()); });
28 connect(ui.processList, &QListView::doubleClicked, this, &QDialog::accept);
29 connect(ui.processEdit, &QLineEdit::textEdited, [this](QString process)
30 {
31 for (int i = 0; i < model.rowCount(); ++i) ui.processList->setRowHidden(i, !model.item(i)->text().contains(process, Qt::CaseInsensitive));
32 });
33 connect(ui.processEdit, &QLineEdit::returnPressed, this, &QDialog::accept);
34}
35
36QString AttachProcessDialog::SelectedProcess()
37{

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected