PDA

View Full Version : Adding items to a QTableWidget from a QComboBox



Erito
19th June 2013, 23:14
Hello everyone, I'm a newbie in Qt and so, I have no idea of how to do this.

The thing is I have a QComboBox with 3 items, and depending on what I choose it has to create a different table, i.e for option 1 the table will contain 2 rows, option 2 will contain 5 rows and option 3 will contain 20 rows.

But that's not all, I have the empty Table and a button to add items, when you click a QDialog asks for the price, residual value and the type which is the Combo Box.

based on the type I have to make the table so the question should be, how do I read the type from the combo box and based on that make the table because on each option the size of the table will be different.

Thanks in advance and sorry if I'm not clear enough

9168

Lykurg
20th June 2013, 06:24
I don't know if I get you right, but simply make getters for all values you need from that dialog. Then after accepting, you can retrieve the values and based on that you can build the table. Google for "getters and setters C++" for more info.