15 buttonBox =
new QDialogButtonBox;
16 propertyTable =
new QTableWidget;
19 buttonBox->setStandardButtons(QDialogButtonBox::Ok | QDialogButtonBox::Cancel);
20 propertyTable->setColumnCount(2);
21 const QStringList labels = QStringList() << tr(
"Name") << tr(
"Value");
22 propertyTable->setHorizontalHeaderLabels(labels);
23 propertyTable->horizontalHeader()->setStretchLastSection(
true);
24 propertyTable->setEditTriggers(QAbstractItemView::AllEditTriggers);
26 connect(buttonBox, &QDialogButtonBox::accepted,
this, &QDialog::accept, Qt::QueuedConnection);
27 connect(buttonBox, &QDialogButtonBox::rejected,
this, &QDialog::reject, Qt::QueuedConnection);
29 QVBoxLayout *layout =
new QVBoxLayout(
this);
30 layout->addWidget(label);
31 layout->addWidget(propertyTable);
32 layout->addWidget(buttonBox);
42 int rowCount = propertyTable->rowCount();
43 propertyTable->setRowCount(rowCount + 1);
47 name = tr(
"argument %1").arg(rowCount + 1);
49 name += QLatin1String(QMetaType(type).name());
51 QTableWidgetItem *nameItem =
new QTableWidgetItem(name);
52 nameItem->setFlags(nameItem->flags() &
53 ~(Qt::ItemIsEditable | Qt::ItemIsSelectable));
54 propertyTable->setItem(rowCount, 0, nameItem);
56 QTableWidgetItem *valueItem =
new QTableWidgetItem;
57 valueItem->setData(Qt::DisplayRole, QVariant(QMetaType(type), 0));
58 propertyTable->setItem(rowCount, 1, valueItem);