【问题标题】:Need To Translate One Line of Code in from C++ Qt to PyQt需要将一行代码从 C++ Qt 翻译成 PyQt
【发布时间】:2019-03-29 08:32:22
【问题描述】:

这个等价物是什么

QModelIndex index = ui->listView->currentIndex();

在 Python 中,如果我的 listView 是 self.listView

这就是我需要知道的,我花了几个小时试图寻找一个问题的答案,但我只在 C++ 中找到了它。

编辑:

基本上,在 PyQt 中,要访问 QListView 的索引,您需要使用 QModelIndex,所以我对如何在 QListView 上应用 QModelIndex 感到困惑。

【问题讨论】:

  • 你能用英语表达一下这条线在做什么吗?这将帮助我们确定您的代码正在尝试做什么。

标签: python c++ pyqt translate qmodelindex


【解决方案1】:

index = self.listView.currentIndex()

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2012-05-29
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-06-26
    • 2011-09-05
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多