Reputation: 876
I'm very new to Qt. I'm following this tutorial http://sector.ynet.sk/qt4-tutorial/my-first-qt-gui-application.html. There is a small mistake in this tutorial. Though it adds a combo box entry, text is not set. Can somebody tell me how to initialize the combo box, correctly.
Also, can somebody point out me if there are better tutorials for learning Qt ?
Upvotes: 7
Views: 27589
Reputation: 876
At last, I got the right answer. I have provided it below, hopefully it will be useful to other beginners:
QStringList list=(QStringList()<<"red"<<"yellow"<<"blue");
comboBox->addItems(list);
Upvotes: 15
Reputation: 93
When your in Qt Designer you could just double click on the QComboBox and an EditComboBox screen will appear. There you just click on the plus or minus sign to easily add items to the list of objects.Hope this helps.This way you don't have to do it with code though.
Upvotes: 6
Reputation: 191
This tutorial is made for Qt 4.2, we are now at Qt 4.8. You should find what you are looking for here http://qt-project.org/doc/qt-4.8/how-to-learn-qt.html
Little advice, try not to use Qt creator to design your Gui until you understand how to do it with code, you will do less mistakes (and know what to look for when you do).
Upvotes: 5