Hi everyone!
I am attemptting to access to elements of mainwindow.ui (it would be named ui elements? ).
I have two sample of use of this elements.
First work fine but in case of comboBox It doen't work.
Could you help me?
QString def_fileGbxml
= ui
->lineEditFile
->text
();
QComboBox cb_tipoEdificio
= this
->ui
->comboBox_1
QString def_fileGbxml = ui->lineEditFile->text();
QComboBox cb_tipoEdificio = this->ui->comboBox_1
To copy to clipboard, switch view to plain text mode
How can define it to use in my mainwindow.cpp. I want to load it from file of data.
I have data on file like that:
constructionIdRefs:
cons-1
cons-2
cons-3
cons-4
cons-5
cons-6
***************
openingTypes:
FixedWindow
NonSlidingDoor
end1;
end2;
constructionIdRefs:
cons-1
cons-2
cons-3
cons-4
cons-5
cons-6
***************
openingTypes:
FixedWindow
NonSlidingDoor
end1;
end2;
To copy to clipboard, switch view to plain text mode
I can write file like I want. Do you recommend another organization of data??
On the other hand. I read about define manual ComboBox and Label but in this way I can't view it in main window.
For example:
layoutPrincipal
->addWidget
(new QLabel("Latitud"),
0,
0);
layoutPrincipal->addWidget(latitud,0,1);
layoutPrincipal
->addWidget
(new QLabel("Longitud"),
1,
0);
layoutPrincipal->addWidget(longitud,1,1);
layoutPrincipal->addWidget(getLocation,3,0,1,2);
valores_combo << "primero" << "segundo" << "tercero";
combo_buildings->addItems(valores_combo);
this->setWindowTitle("Config of initial values of gbxml");
this->setLayout(layoutPrincipal);
QGridLayout *layoutPrincipal = new QGridLayout();
layoutPrincipal->addWidget(new QLabel("Latitud"),0,0);
latitud = new QLineEdit();
layoutPrincipal->addWidget(latitud,0,1);
layoutPrincipal->addWidget(new QLabel("Longitud"),1,0);
longitud = new QLineEdit();
layoutPrincipal->addWidget(longitud,1,1);
getLocation = new QPushButton("Get Position");
layoutPrincipal->addWidget(getLocation,3,0,1,2);
valores_combo << "primero" << "segundo" << "tercero";
combo_buildings = new QComboBox();
combo_buildings->addItems(valores_combo);
this->setWindowTitle("Config of initial values of gbxml");
this->setLayout(layoutPrincipal);
To copy to clipboard, switch view to plain text mode
Is there any way to view this elements in mainwindow.ui?
It is possible a mix of both?
Bookmarks