如何循环QListView项目选择

发布于 2024-09-24 21:23:17 字数 136 浏览 0 评论 0原文

如何使 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

那一片橙海, 2024-10-01 21:23:17

它的默认行为由图标模式的列表视图提供。
为了达到您的要求,您需要手动处理。

即,您将获得一行中的项目数,一旦到达最后一个项目,就处理右侧导航键按下事件,然后将其聚焦回同一行的第一个元素。

要获取导航按键事件,您可以安装事件过滤器或覆盖按键事件功能。

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文