看不见的root的 QModelIndex() 是 无效的

list 和table 的index 函数中的parent参数就只要 root QModelIndex 就可以,因为没有层级概念

  • Model indexes give views and delegates information about the location of items provided by models in a way that is independent of any underlying data structures.
  • Items are referred to by their row and column numbers, and by the model index of their parent items.
  • Model indexes are constructed by models at the request of other components, such as views and delegates.
  • If a valid model index is specified for the parent item when an index is requested using index(), the index returned refers to an item beneath that parent item in the model. The index obtained refers to a child of that item.
  • If an invalid model index is specified for the parent item when an index is requested using index(), the index returned refers to a top-level item in the model.
  • The role distinguishes between the different kinds of data associated with an item.
  • The dimensions of a model can be found using rowCount() and columnCount(). These functions generally require a parent model index to be specified.
  • Model indexes are used to access items in the model. The row, column, and parent model index are needed to specify the item.
  • To access top-level items in a model, specify a null model index as the parent index with QModelIndex().
  • Items contain data for different roles. To obtain the data for a particular role, both the model index and the role must be supplied to the model.
 

qt model view 编程总结的更多相关文章

  1. Qt Model/View(官方翻译,图文并茂)

    http://doc.trolltech.com/main-snapshot/model-view-programming.html 介绍 Qt 4推出了一组新的item view类,它们使用mode ...

  2. (转)Qt Model/View 学习笔记 (五)——View 类

    Qt Model/View 学习笔记 (五) View 类 概念 在model/view架构中,view从model中获得数据项然后显示给用户.数据显示的方式不必与model提供的表示方式相同,可以与 ...

  3. (转)Qt Model/View 学习笔记 (一)——Qt Model/View模式简介

    Qt Model/View模式简介 Qt 4推出了一组新的item view类,它们使用model/view结构来管理数据与表示层的关系.这种结构带来的 功能上的分离给了开发人员更大的弹性来定制数据项 ...

  4. (转)Qt Model/View 学习笔记 (七)——Delegate类

    Qt Model/View 学习笔记 (七) Delegate  类 概念 与MVC模式不同,model/view结构没有用于与用户交互的完全独立的组件.一般来讲, view负责把数据展示 给用户,也 ...

  5. (转)Qt Model/View 学习笔记 (二)——Qt Model/View模式举例

    Qt Model/View模式举例 Qt提供了两个标准的models:QStandardItemModel和QDirModel.QStandardItemModel是一个多用途的model,可用于表示 ...

  6. (一) Qt Model/View 的简单说明

    (一) Qt Model/View 的简单说明 .预定义模型 (二)使用预定义模型 QstringListModel例子 (三)使用预定义模型QDirModel的例子 (四)Qt实现自定义模型基于QA ...

  7. qt model/view/delegate

    Qt Model/View理解(一)---构造model https://blog.csdn.net/weixin_42303052/article/details/89233887 Qt Model ...

  8. Qt Model/View 的简单说明

    目录: (一) Qt Model/View 的简单说明 .预定义模型 (二)使用预定义模型 QstringListModel例子 (三)使用预定义模型QDirModel的例子 (四)Qt实现自定义模型 ...

  9. Qt Model/View(模型/视图)结构(无师自通)

    Model/View(模型/视图)结构是 Qt 中用界面组件显示与编辑数据的一种结构,视图(View)是显示和编辑数据的界面组件,模型(Model)是视图与原始数据之间的接口. GUI 应用程序的一个 ...

随机推荐

  1. 使用 C# 开发智能手机软件:推箱子(十八)

    这是"使用 C# 开发智能手机软件:推箱子" 系列文章的第十八篇.在这篇文章中.介绍 Window/SelectLevelDlg.cs 源程序文件. 这个源程序文件包括 Selec ...

  2. Visual Studio:error MSB8020

    状况如下: error MSB8020: The builds tools for v120 (Platform Toolset = 'v120') cannot be found. To build ...

  3. 用wget做站点镜像

    用wget做站点镜像 -- :: 分类: LINUX # wget -r -p -np -k http://xxx.edu.cn -r 表示递归下载,会下载所有的链接,不过要注意的是,不要单独使用这个 ...

  4. 【ActiveMQ】ActiveMQ在Windows的安装,以及点对点的消息发送案例

    公司最近会用MQ对某些业务进行处理,所以,这次我下载了apache-activemq-5.12.0-bin把玩下. 基于练习方便需要,使用Windows的版本. 参考的优秀文章: activemq的几 ...

  5. filebeat+kafka失败

    filebeat端配置 #----------------------------- Kafka output -------------------------------- output.kafk ...

  6. 【转】oozie安装和自带示例的使用

    oozie安装 [转]http://www.tuicool.com/articles/qUVNJn oozie自带示例的使用 [转]http://blog.csdn.net/zhu_xun/artic ...

  7. CMWAP上网补丁描述文件!!支持ios9

    由于ios移动4G使用cmnet网络,某些情况下需要使用cmwap,因此就有了这些文字... 两个网址都可以: http://www.clore.net/iphone/cmwap.html https ...

  8. TIM—基本定时器

    本章参考资料:< STM32F4xx 参考手册>.< STM32F4xx 规格书>.库帮助文档< stm32f4xx_dsp_stdperiph_lib_um.chm&g ...

  9. 【转载】PHP 常用的header头部定义汇总

    header() 函数向客户端发送原始的 HTTP 报头. 认识到一点很重要,即必须在任何实际的输出被发送之前调用 header() 函数(在 PHP 4 以及更高的版本中,您可以使用输出缓存来解决此 ...

  10. xmapp+netbeans调试

    1.netbeans的设置 2.修改php.ini 如下: [XDebug]zend_extension = "D:\dev\xampp\php\ext\php_xdebug.dll&quo ...