windows - 使用 Qt 的 ListView 组?

标签 windows qt listview

我们在 .NET 中有 ListView.Groups。 Qt 中是否有等效项(不使用 Windows API)?

我在 Qt 的文档中找不到任何表明对此支持的内容。

Windows Vista/7 中的示例:http://i50.tinypic.com/zumgyg.jpg

提前致谢!

最佳答案

看起来用Qt model-view 很容易做到这一点控制。

起初有点令人困惑,但基本上所有列表、树控件和网格都以相同的方式处理 - 这让您可以非常轻松地对它们进行有趣的组合。

编辑:Casey在已删除的答案中发布了有用的评论。 这是文本和链接:

creating your tree model is pretty straight forward. To create that "grouped" effect where the parent nodes look different then their children, I would suggest creating an ItemDelegate then setting it on your view using setItemDelegate1. In the Delegate's paint function you can detect whether the index is a header or now, and draw something appropriately. When you get there if you need help, start another question and I can post an example.

http://doc.trolltech.com/4.6/qabstractitemview.html#setItemDelegate

关于windows - 使用 Qt 的 ListView 组?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3195246/

相关文章:

android - RecyclerView 中的 ListView

c++ - IAMVideoProcAmp GetRange 仅在延迟后有效(C++)?

windows - 单击 bin 目录中的可执行文件时,Visual Studio UWP 未启动

c# - 如何包含 System.Windows.Shapes?

windows - SAPI:语音转文本示例

c++ - Qt C++ - 在 QSplashScreen 中对齐 QProgressBar

python - QDataWidgetMapper-在pyqt中查找sql​​ite数据库行的索引

c++ - 如何在 QtCreator 中更改项目的名称?

android - 在 AlertDialog 中使用 edittext 的 Recyclerview 不起作用

android - 在 Android 中使用 FirebaseListAdapter 填充 ListView