Commit 695d3f0b authored by Laurent Montel's avatar Laurent Montel 😁
Browse files

Allow to double click to editing rule

parent 416db66d
Pipeline #69369 canceled with stage
......@@ -30,6 +30,7 @@ ConfirmBeforeDeletingWidget::ConfirmBeforeDeletingWidget(QWidget *parent)
const QStringList lst = {i18n("Pattern"), i18n("Type")};
mTreeWidget->setHeaderLabels(lst);
connect(mTreeWidget, &QTreeWidget::customContextMenuRequested, this, &ConfirmBeforeDeletingWidget::slotCustomContextMenuRequested);
connect(mTreeWidget, &QTreeWidget::itemDoubleClicked, this, &ConfirmBeforeDeletingWidget::slotEditRule);
fillRules();
}
......@@ -50,17 +51,19 @@ void ConfirmBeforeDeletingWidget::fillRules()
void ConfirmBeforeDeletingWidget::slotEditRule()
{
QTreeWidgetItem *item = mTreeWidget->currentItem();
QPointer<ConfirmBeforeDeletingCreateRuleDialog> dlg = new ConfirmBeforeDeletingCreateRuleDialog(this);
ConfirmBeforeDeletingCreateRuleWidget::ConfirmBeforeDeletingInfo currentInfo;
currentInfo.pattern = item->text(0);
currentInfo.ruleType = item->text(1);
dlg->setInfo(currentInfo);
if (dlg->exec()) {
const ConfirmBeforeDeletingCreateRuleWidget::ConfirmBeforeDeletingInfo info = dlg->info();
item->setText(0, info.pattern);
item->setText(1, info.ruleType);
if (item) {
QPointer<ConfirmBeforeDeletingCreateRuleDialog> dlg = new ConfirmBeforeDeletingCreateRuleDialog(this);
ConfirmBeforeDeletingCreateRuleWidget::ConfirmBeforeDeletingInfo currentInfo;
currentInfo.pattern = item->text(0);
currentInfo.ruleType = item->text(1);
dlg->setInfo(currentInfo);
if (dlg->exec()) {
const ConfirmBeforeDeletingCreateRuleWidget::ConfirmBeforeDeletingInfo info = dlg->info();
item->setText(0, info.pattern);
item->setText(1, info.ruleType);
}
delete dlg;
}
delete dlg;
}
void ConfirmBeforeDeletingWidget::slotCustomContextMenuRequested(const QPoint &p)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment