27 #include <QFormLayout>
53 content =
new QGroupBox(
this);
54 content->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::MinimumExpanding));
55 contentLayout =
new QGridLayout();
56 content->setLayout(contentLayout);
59 QBoxLayout* boxLayout =
new QBoxLayout(QBoxLayout::TopToBottom,
this);
60 boxLayout->addWidget(content);
68 fullTitle =
"Properties for " + title;
69 content->setTitle(fullTitle);
72 void addProperty(
const QString& label, QWidget* propertyWidget)
74 QString fullLabel =
"<b>" + label +
": </b>";
75 auto rowCount = contentLayout->rowCount();
76 contentLayout->addWidget(
new QLabel(fullLabel), rowCount, 0);
77 contentLayout->addWidget(propertyWidget, rowCount, 1);
78 contentLayout->addItem(
new QSpacerItem(50, 10, QSizePolicy::Expanding), rowCount, 2);
83 auto rowCount = contentLayout->rowCount();
87 void setProperty(
int row,
const QString& label,
const QString& text)
89 QString fullLabel =
"<b>" + label +
": </b>";
90 QLabel* textLabel =
new QLabel(
this);
91 textLabel->setText(text);
92 textLabel->setTextInteractionFlags(Qt::TextSelectableByMouse);
94 QLabel* labelLabel =
new QLabel(fullLabel);
96 contentLayout->addWidget(labelLabel, row, 0);
97 contentLayout->addWidget(textLabel, row, 1);
98 contentLayout->addItem(
new QSpacerItem(50, 10, QSizePolicy::Expanding), row, 2);
104 for (row = 0; row < contentLayout->rowCount(); ++row)
106 if (!contentLayout->itemAtPosition(row, 0))
110 QLabel* labelWidget = qobject_cast<QLabel*>(contentLayout->itemAtPosition(row, 0)->widget());
113 QLabel* textWidget = qobject_cast<QLabel*>(contentLayout->itemAtPosition(row, 1)->widget());
116 textWidget->setText(text);
127 QString fullHeading =
"<b>" + heading +
": </b>";
128 QLabel* textLabel =
new QLabel(
this);
129 textLabel->setText(fullHeading);
130 textLabel->setTextInteractionFlags(Qt::TextSelectableByMouse);
132 auto rowCount = contentLayout->rowCount();
133 contentLayout->addWidget(textLabel, rowCount, 0, 1, 3);
138 auto rowCount = contentLayout->rowCount();
139 contentLayout->addWidget(widget, rowCount, 0, 1, 3);
145 return contentLayout;
150 QGridLayout* contentLayout;