QModelIndex的疑问

weicheichei 2013-06-10 09:53:43
我在使用tableWidget用了一个双击槽函数on_tableWidget_doubleClicked(QModelIndex index)
。会传递一个参数QModelIndex index,会在槽函数中判断是第几行,执行响应的操作,我现在的问题是我想在其他地方也触发这个槽函数,我就是不知道怎么给QModelIndex类型赋值,谢谢。
...全文
808 3 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
一如当初 2013-06-12
  • 打赏
  • 举报
回复
这个东西最好还是自己继承实现,更容易扩展和控制。 索引这里分临时索引和持久索引两种。 建议看看DEMO
一如当初 2013-06-12
  • 打赏
  • 举报
回复
QModelIndex QAbstractItemModel::createIndex(int row, int column, void * ptr = 0) const [protected] Creates a model index for the given row and column with the internal pointer ptr. When using a QSortFilterProxyModel, its indexes have their own internal pointer. It is not advisable to access this internal pointer outside of the model. Use the data() function instead. This function provides a consistent interface that model subclasses must use to create model indexes.
jdwx 2013-06-10
  • 打赏
  • 举报
回复
自己想办法取:modelIndex。

16,816

社区成员

发帖
与我相关
我的任务
社区描述
Qt 是一个跨平台应用程序框架。通过使用 Qt,您可以一次性开发应用程序和用户界面,然后将其部署到多个桌面和嵌入式操作系统,而无需重复编写源代码。
社区管理员
  • Qt
  • 亭台六七座
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧