Skip to content

Commit

Permalink
Improve handling of the flags
Browse files Browse the repository at this point in the history
  • Loading branch information
Emdek committed Apr 17, 2024
1 parent 234856f commit a56478e
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions src/ui/ActionParametersDialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,9 @@ void ActionParametersDialog::changeEvent(QEvent *event)
QStandardItem* ActionParametersDialog::addItem(const QString &key, const QVariant &value, QStandardItem *parent)
{
QList<QStandardItem*> 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())
{
Expand All @@ -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;
Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit a56478e

Please sign in to comment.