From a56478e63fa3d14bdc09a4bc3baa3d6a9d012045 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Dutkiewicz?= Date: Wed, 17 Apr 2024 23:29:04 +0200 Subject: [PATCH] Improve handling of the flags --- src/ui/ActionParametersDialog.cpp | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/ui/ActionParametersDialog.cpp b/src/ui/ActionParametersDialog.cpp index ec7687fde..c6be180b8 100644 --- a/src/ui/ActionParametersDialog.cpp +++ b/src/ui/ActionParametersDialog.cpp @@ -111,7 +111,9 @@ void ActionParametersDialog::changeEvent(QEvent *event) QStandardItem* ActionParametersDialog::addItem(const QString &key, const QVariant &value, QStandardItem *parent) { QList items({new QStandardItem(key), new QStandardItem(), new QStandardItem()}); - items[1]->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled); + items[0]->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled | Qt::ItemNeverHasChildren); + items[1]->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled | Qt::ItemNeverHasChildren); + items[2]->setFlags(items[2]->flags() | Qt::ItemNeverHasChildren); switch (value.type()) { @@ -120,11 +122,9 @@ QStandardItem* ActionParametersDialog::addItem(const QString &key, const QVarian { const QStringList list(value.toStringList()); - items[0]->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled | Qt::ItemNeverHasChildren); items[1]->setText(tr("List")); items[2]->setText(list.join(QLatin1String(", "))); items[2]->setData(list, Qt::UserRole); - items[2]->setFlags(items[2]->flags() | Qt::ItemNeverHasChildren); } break; @@ -162,10 +162,8 @@ QStandardItem* ActionParametersDialog::addItem(const QString &key, const QVarian break; } - items[0]->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled | Qt::ItemNeverHasChildren); items[1]->setText(text); items[2]->setText(value.toString()); - items[2]->setFlags(items[2]->flags() | Qt::ItemNeverHasChildren); } break;