code format
This commit is contained in:
@@ -1,6 +1,8 @@
|
||||
#include "propertystorage_editor.h"
|
||||
|
||||
#include "propertystorage.h"
|
||||
#include "qvariantedit.h"
|
||||
|
||||
#include <QGridLayout>
|
||||
#include <QToolButton>
|
||||
|
||||
@@ -24,7 +26,7 @@ void PropertyStorageEditor::clear() {
|
||||
|
||||
|
||||
bool PropertyStorageEditor::isEmpty() const {
|
||||
return static_cast<QGridLayout*>(layout())->count() == 0;
|
||||
return static_cast<QGridLayout *>(layout())->count() == 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -32,9 +34,9 @@ void PropertyStorageEditor::setStorage(PropertyStorage * s) {
|
||||
clear();
|
||||
storage = s;
|
||||
if (!storage) return;
|
||||
int r = 0;
|
||||
auto layoutProps = static_cast<QGridLayout*>(layout());
|
||||
for (const PropertyStorage::Property & p : *storage) {
|
||||
int r = 0;
|
||||
auto layoutProps = static_cast<QGridLayout *>(layout());
|
||||
for (const PropertyStorage::Property & p: *storage) {
|
||||
auto lbl = new QLabel(p.name);
|
||||
_widgets << lbl;
|
||||
lbl->setAlignment(Qt::AlignVCenter | Qt::AlignRight);
|
||||
@@ -44,9 +46,12 @@ void PropertyStorageEditor::setStorage(PropertyStorage * s) {
|
||||
ve->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred);
|
||||
ve->setMinimumWidth(50);
|
||||
connect(ve, SIGNAL(valueChanged(QVariant)), this, SIGNAL(changed()));
|
||||
layoutProps->addWidget(ve, r, 1); _widgets << ve;
|
||||
lbl = new QLabel(p.comment); lbl->setAlignment(Qt::AlignVCenter | Qt::AlignLeft);
|
||||
layoutProps->addWidget(lbl, r, 2); _widgets << lbl;
|
||||
layoutProps->addWidget(ve, r, 1);
|
||||
_widgets << ve;
|
||||
lbl = new QLabel(p.comment);
|
||||
lbl->setAlignment(Qt::AlignVCenter | Qt::AlignLeft);
|
||||
layoutProps->addWidget(lbl, r, 2);
|
||||
_widgets << lbl;
|
||||
++r;
|
||||
}
|
||||
}
|
||||
@@ -55,13 +60,13 @@ void PropertyStorageEditor::setStorage(PropertyStorage * s) {
|
||||
void PropertyStorageEditor::applyProperties() {
|
||||
if (!storage) return;
|
||||
QList<PropertyStorage::Property> & props(storage->properties());
|
||||
auto layoutProps = static_cast<QGridLayout*>(layout());
|
||||
auto layoutProps = static_cast<QGridLayout *>(layout());
|
||||
for (int r = 0; r < layoutProps->rowCount(); ++r) {
|
||||
if (layoutProps->itemAtPosition(r, 0) == nullptr || layoutProps->itemAtPosition(r, 1) == nullptr) {
|
||||
continue;
|
||||
}
|
||||
QLabel * lbl = qobject_cast<QLabel * >(layoutProps->itemAtPosition(r, 0)->widget());
|
||||
QVariantEdit * ve = qobject_cast<QVariantEdit * >(layoutProps->itemAtPosition(r, 1)->widget());
|
||||
QLabel * lbl = qobject_cast<QLabel *>(layoutProps->itemAtPosition(r, 0)->widget());
|
||||
QVariantEdit * ve = qobject_cast<QVariantEdit *>(layoutProps->itemAtPosition(r, 1)->widget());
|
||||
if (lbl == nullptr || ve == nullptr) {
|
||||
continue;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user