Setting selection in QListView widget
I'm a new Qt developer. Can anyone tell me how I would force a selection in a QListView widget?
Not really sure what you mean. What do you want to force? Or do you just want a line selected at all times? Maybe a small picture with it to show what you need.
Welcome to the Forum,
I agree that you can be a bit more clear about your requirements. An image will be perfect as discussed above. From my assumptions of force selection in a QListView, i think you want
a. Forcefully select an particular index/row on start up
ans. You can get the QModelIndex for the particular row and use "setSelectedIndex(index)":http://doc.qt.digia.com/qt/qabstractitemview.html#setCurrentIndex funtion and through stylesheets you can change the border-color or width.
b. To set the focus on QListView.
ans. check "setFocus()":http://doc.qt.digia.com/qt/qwidget.html#setFocus