QListWidget bug
-
is this a bug? i created a QListWidget with more than 2 items and every first select of the 2nd and up item will cause the currentTextChanged(QString) signal to emit twice..
@
void Window::Window() {
setupUI(this);
QListWidgetItem *a = new QListWidgetItem("hello");
QListWidgetItem *b = new QListWidgetItem("world");
QListWidgetItem *c = new QListWidgetItem("foo");
QListWidgetItem *d = new QListWidgetItem("bar");
listWidget->addItem(a);
listWidget->addItem(b);
listWidget->addItem(c);
listWidget->addItem(d);
connect(listWidget, SIGNAL(currentTextChanged(QString)), this, SLOT(selectItem(QString)));
}
void Window::selectItem(QString val) {
QMessageBox::information(this, "blah", val);
}
@if the QListWidget has no item selected yet and you select the 'world', 'foo' & 'bar' values, the messagebox appear twice unless you select the 'hello' value.
this is what i understand, on your first select/click of the item in the QListWidget (except the first item), it sends a signal that the first item is selected then the chosen item will send a signal that it is the changes made in the QListWidget. -
[quote author="Volker" date="1297171469"]I cannot reproduce this behavior. I get the signal only once. I'm on a Mac here. Could be some platform problem, but I doubt that.[/quote]
just tried and can't reproduce this on windows too.
-
i tested it on a stand-alone and when the UI gets loaded, the messagebox appear with the value of the first item. so i think, the problem is on focus because when i put another widget and it is on first select on tab. the messagebox dont appear but when i select an item (other than the first item) same problem occur.
tested on ubuntu. i will try to test it in opensuse.