void QMwMaterialLayersWidget::LayerSelected() { QRadioButton *sender = (QRadioButton*)QObject::sender(); int layerIndex = sender->property("layerIndex").toInt(); this->selectedLayerIndex = layerIndex; }
bool PEUtils::fillInMetadata(int senderIndex, QWidget * parent, ConnectorMetadata & cmd) { bool result = false; QList<QWidget *> widgets = parent->findChildren<QWidget *>(); foreach (QWidget * widget, widgets) { bool ok; int index = widget->property("index").toInt(&ok); if (!ok) continue; if (index != senderIndex) continue; QString type = widget->property("type").toString(); if (type == "name") { QLineEdit * lineEdit = qobject_cast<QLineEdit *>(widget); if (lineEdit == NULL) continue; cmd.connectorName = lineEdit->text(); cmd.connectorID = widget->property("id").toString(); result = true; } else if (type == "radio") { QRadioButton * radioButton = qobject_cast<QRadioButton *>(widget); if (radioButton == NULL) continue; if (!radioButton->isChecked()) continue; cmd.connectorType = (Connector::ConnectorType) radioButton->property("value").toInt(); } else if (type == "description") { QLineEdit * lineEdit = qobject_cast<QLineEdit *>(widget); if (lineEdit == NULL) continue; cmd.connectorDescription = lineEdit->text(); } }
void MainWindow::ChangeLanguage() { std::clog<<"MainWindow::ChangeLanguage()"<<std::endl; QList<QRadioButton*> list = ui->groupBox->findChildren<QRadioButton*>(); for(int i=0;i<list.size();i++) { QRadioButton* rb = list.at(i); if(rb->isChecked()) { lang->ChangeLanguage(rb->property(("lang_file")).toString()); // lang_file is dynamic property break; } } ui->retranslateUi(this); }