I need to add numbers from 50 to 500 in this combo box. What's the way out without adding them manually by hand?
qt.jpg
I need to add numbers from 50 to 500 in this combo box. What's the way out without adding them manually by hand?
qt.jpg
you can do this in code by a loop, ui->comboBox->addItem(i);
I know that, but in this case I am using the creator. It generates a file called "showmap.ui".
Where do I have to write code now?
.ui files are in xml format. I don't know a way to do this in qtcreator but in xml you can do this for example by copy and pasting from excel to xml in its correct format
Add the code after showmap::setupUi();
When you know how to do it then you may do it wrong.
When you don't know how to do it then it is not that you may do it wrong but you may not do it right.
setupUi() is in cpp, if you have it.Add the code after showmap::setupUi();
Well you can edit the ui file, but this may take more effort than typing in the Qt Creator. Moreover it requires some insignt into ui file format / xml.
When you know how to do it then you may do it wrong.
When you don't know how to do it then it is not that you may do it wrong but you may not do it right.
in qtCreator add QtDesignerFormClass then you have .h,.cpp beside .ui file. then in constructor you can find setupUI
showmap.ui is a UI file, it generally will be included by a QWidget based class, and in the ctor of that QWidget a setupUi() will be used.
When you know how to do it then you may do it wrong.
When you don't know how to do it then it is not that you may do it wrong but you may not do it right.
Bookmarks