如何在Qt中强制设置项目选择

发布于 2024-08-25 17:04:39 字数 249 浏览 7 评论 0原文

任何人都可以告诉我如何设置要强制选择的项目..

我在将项目添加到列表行后尝试了此操作..

QModelIndex index = mylistview->currentIndex();
             mylistview ->setCurrentIndex(index);

它不起作用..索引我得到索引(-1,-1).. 任何人都可以帮我解决这个问题吗

?谢谢

Can any one tell me how to set the item to be selected forcefully..

I tried this after adding items to list row..

QModelIndex index = mylistview->currentIndex();
             mylistview ->setCurrentIndex(index);

its not working.. index I am getting index (-1,-1)..
can any one help me on this

Thanks

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

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

发布评论

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

评论(1

玩套路吗 2024-09-01 17:04:39

您是否检查过您已授权选择?在 Qt 文档中,解释了该项目被选中,除非选择模式为无选择

Have you check the you have authorized selection? In the Qt Documentation, it is explain the item is selected unless selection mode is No Selection.

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