如何循环QListView项目选择
如何使 QListView 项目选择循环从底部项目到顶部(通过按导航键,向下)和从顶部项目到底部(通过按导航键,向上)?是否有要定义的标志或其他方式?我的列表视图处于 IconMode 模式,我希望当我到达行尾时选择转到下一行的第一项。
谢谢
How can I make QListView item selection loop from bottom item to top (by pressing navigation key, down) and from top item to bottom (by pressing navigation key, up)? Is there a flag to be defined or some other way? My listview is in IconMode I wanted the selection to go to next row's 1st item when I've reached the end of a row.
Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
它的默认行为由图标模式的列表视图提供。
为了达到您的要求,您需要手动处理。
即,您将获得一行中的项目数,一旦到达最后一个项目,就处理右侧导航键按下事件,然后将其聚焦回同一行的第一个元素。
要获取导航按键事件,您可以安装事件过滤器或覆盖按键事件功能。
Its Default behavior provided by the list view for iconic mode.
in order to achieve your requirement, you need to handle it manually.
i.e you will be having the count of items in a row, once you reach the last item handle the right navigation key press event, then focus it back to the first element of the same row..
to get the navigation keypress event, either you install event filter or ovveride the keypress event function.