| 63 | } |
| 64 | |
| 65 | void AttachInfoDialog::initButton() |
| 66 | { |
| 67 | auto buttonBox = new DWidget(this); |
| 68 | auto buttonLayout = new QHBoxLayout(buttonBox); |
| 69 | |
| 70 | DPushButton *btnUpdate = new DPushButton(tr("Update"), this); |
| 71 | DPushButton *btnCancel = new DPushButton(tr("Cancel"), this); |
| 72 | DPushButton *btnAttaching = new DPushButton(tr("Attaching"), this); |
| 73 | btnAttaching->setEnabled(false); |
| 74 | |
| 75 | buttonLayout->addWidget(btnUpdate); |
| 76 | buttonLayout->addWidget(btnCancel); |
| 77 | buttonLayout->addWidget(btnAttaching); |
| 78 | |
| 79 | connect(view->selectionModel(), &QItemSelectionModel::selectionChanged, this, [=](){ |
| 80 | if (view->selectionModel()->hasSelection()) |
| 81 | btnAttaching->setEnabled(true); |
| 82 | else |
| 83 | btnAttaching->setEnabled(false); |
| 84 | }); |
| 85 | connect(btnUpdate, &DPushButton::clicked, this, [=](){ |
| 86 | updateProcess(); |
| 87 | }); |
| 88 | connect(btnCancel, &DPushButton::clicked, this, [=](){ |
| 89 | reject(); |
| 90 | }); |
| 91 | connect(btnAttaching, &DPushButton::clicked, this, [=](){ |
| 92 | auto selectedItem = view->selectionModel()->selectedRows(0).at(0); |
| 93 | emit attachToProcessId(selectedItem.data().toString()); |
| 94 | accept(); |
| 95 | }); |
| 96 | |
| 97 | addContent(buttonBox); |
| 98 | } |
| 99 | |
| 100 | void AttachInfoDialog::updateProcess() |
| 101 | { |