Trolltech Home | Qt-interest Home | Recent Threads | All Threads | Author | Date
All threads index page 4

Qt-interest Archive, March 2002
QComboBox inconsistency?


Message 1 in thread

Is there an inconsistency with the currentItem stored in QComboBox, or am I
using it incorrectly?
I have some test code that essentially does the following :

...
QComboBox combo;
std::cout << combo.currentItem() << ", " << combo.count();
// output is "0, 0"
combo.insertItem("New Item");
// Select item in combo box
std::cout << combo.currentItem() << ", " << combo.count();
// output is "0, 1"
combo.deleteItem(0); // actually a slot deleting selected item
std::cout << combo.currentItem() << ", " << combo.count();
// output is "-1, 0"
...

is this the behaviour you would expect; I was expecting currentItem() to
always return -1 when 
the combo was empty?

thanks in advance
Martin Stone

This e-mail, and any attachment, is confidential. If you have received it in
error, please delete it from your system, do not use or disclose the
information in any way, and notify me immediately.