27 #include <QVBoxLayout>
34 this->variant = variant;
37 layout =
new QVBoxLayout(
this);
38 variantEdit =
new QTextEdit(
this);
47 if (variant->getInitialized())
59 value =
value.arg(variant->getFloat(), 0,
'f', 2);
66 value =
value.arg(variant->getDouble(), 0,
'f', 2);
86 QString
value(variant->getString().c_str());
91 VariantDataClassPtr var = variant->getClass<VariantDataClass>();
92 QString
value(var->output().c_str());
99 valueString =
"<i>not initalized</i>";
101 variantEdit->setEnabled(variant->getInitialized());
102 variantEdit->setText(valueString);
107 this->enableEdit = enableEdit;
113 this->showType = showType;
129 return variantEdit->toPlainText();
133 void VariantWidget::setupLayout()
135 int valueEditWidth = 120;
139 std::vector<QWidget*>::iterator iter = widgets.begin();
141 while (iter != widgets.end())
153 layout->addWidget(variantEdit);
154 variantEdit->setGeometry(x_start + 0 * (valueEditWidth + x_gap), y_start, valueEditWidth, 20);
155 variantEdit->setReadOnly(!enableEdit);
163 int x = x_start + 1 * (valueEditWidth + x_gap);
164 QLabel* label =
new QLabel(
this);
165 label->setTextInteractionFlags(Qt::TextSelectableByMouse);
166 label->setGeometry(x, y_start, 120, 21);
167 label->setText(variant->getTypeName().c_str());
168 layout->addWidget(label);
170 widgets.push_back(label);