Unsolved QListWidget: click item then click white space, QListWidget.currentRow() will not change ?
-
QListWidget: click item then click white space, QListWidget.currentRow() will not change.
I want when click white space , QListWidget will clear selected row like visually.
The 2 way below will not emit signal when left click white space:connect(ui->listWidget,SIGNAL(clicked(QModelIndex)),this,SLOT(listWidgetClicked(QModelIndex)));
or
connect(ui->listWidget,SIGNAL(itemClicked(QListWidgetItem*)),this,SLOT(listWidgetItemClicked(QListWidgetItem*)));
-
Hi
Why would it ? , you are not changing the row since you are not hitting another new item. So selected row stays the same. -
If it is a QListWidget - the SIGNAL is not correct
void itemClicked(QListWidgetItem *item) (http://doc.qt.io/qt-5/qlistwidget.html)
If you have a QListView then QModelIndex should work.
-
@sonichy Hey, don't forget to close your other posts if you are no longer interested in them, e.g.
https://forum.qt.io/topic/90401/maxsize-argument-exceeds-qbytearray-size-limit
https://forum.qt.io/topic/90474/qdatastream-write-file-size-to-file-header
Cheers!