refactoring

wireframe display
worked on 3d-model display
This commit is contained in:
2018-02-08 21:38:51 +01:00
parent bce771d6d6
commit 839401edb7
16 changed files with 395 additions and 236 deletions

View File

@@ -65,8 +65,6 @@ QComboBox* getOutlineMethods() {
return cmb;
}
ElementParamWidget::ElementParamWidget(QWidget *parent) : QWidget(parent) {
this->lay = new QGridLayout(this);
@@ -148,7 +146,6 @@ void ElementParamWidget::refresh() {
}
}
{ // does the element have "parameters" ?
IHasParams* elem = dynamic_cast<IHasParams*>(el);
if (elem) {
@@ -168,6 +165,21 @@ void ElementParamWidget::refresh() {
case ParamType::NOT_AVAILABLE:
break;
case ParamType::ENUM: {
QComboBox* cmb = new QComboBox();
int idx = 0;
for (const std::string& str : param.getEnumValues()) {cmb->addItem(str.c_str(), idx++);}
cmb->setCurrentIndex(value.toInt());
connect(cmb, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged), [i, elem, cmb] (int idx) {
(void) idx;
elem->setParamValue(i, cmb->currentData().toInt() );
});
lay->addWidget(cmb,r,1);
break;
}
case ParamType::BOOL: {
QCheckBox* chk = new QCheckBox( );
chk->setChecked(value.toBool());
@@ -197,20 +209,20 @@ void ElementParamWidget::refresh() {
break;
}
case ParamType::DOUBLE: {
const std::string str = std::to_string(value.toDouble());
if (param.readOnly) {
lay->addWidget(new QLabel(str.c_str()),r,1);
} else {
QLineEdit* le = new QLineEdit( str.c_str() );
connect(le, &QLineEdit::textChanged, [i,elem] (const QString& str) {
const double val = str.toDouble();
elem->setParamValue(i, ParamValue(val));
});
lay->addWidget(le,r,1);
case ParamType::DOUBLE: {
const std::string str = std::to_string(value.toDouble());
if (param.readOnly) {
lay->addWidget(new QLabel(str.c_str()),r,1);
} else {
QLineEdit* le = new QLineEdit( str.c_str() );
connect(le, &QLineEdit::textChanged, [i,elem] (const QString& str) {
const double val = str.toDouble();
elem->setParamValue(i, ParamValue(val));
});
lay->addWidget(le,r,1);
}
break;
}
break;
}
case ParamType::INT: {
const std::string str = std::to_string(value.toInt());