[Solved]How to focus on the last item of the and then come to the top item one by on using TAB key and UP-ARROW key?
I have a small application in which, I have a QListWidget which basically list of some QString values.
Now, I have only a TAB key for focusing into the QListWidget and then I have UP-ARROW key for navigation (focusing from one item to another) inside QListWidget .
By default, the focus comes to the top item of the QListWidget hence, UP-ARROW key will not help me to go to other below items for selecting. So, I would like to know, how to focus on the last item while opening? Also, how to start from the last focused item to come to the top item (or any item in between) by pressing the UP_ARROW.
I tried the following but, it kept focusing on the last item and not coming to the top items, when I use UP-ARROW:
Any help would be greatly appreciated.
SGaist Lifetime Qt Champion last edited by
setCurrentRow should do what you want. For the selection part, did you enable multiple selection ?
@SGaist Thank you for your support. I will test setCurrentRow along with setFocus to focus on the last row item of the listWidget.
For the selection part, I need only single selection but it has to move from bottom to up instead of default top to bottom movement.
@SGaist Thank you dude, setCurrentRow is what I want!