gpt4 book ai didi

c++ - QItemDelegate 和 QStyledItemDelegate 有什么区别?

转载 作者:IT老高 更新时间:2023-10-28 23:20:32 40 4
gpt4 key购买 nike

这两个类都为模型中的数据项提供显示和编辑功能。 QStyledItemDelegate 较新,关于 QItemDelegate 的 Qt 文档指出:

Note that QStyledItemDelegate has taken over the job of drawing Qt's item views. We recommend the use of QStyledItemDelegate when creating new delegates.

我很困惑两者之间有什么区别以及为什么 QStyledItemDelegate 优于 QItemDelegate!

最佳答案

QStyledItemDelegate documentation 中所述,不同的是 QStyledItemDelegate 使用当前样式来绘制它的项目。

These two classes are independent alternatives to painting and providing editors for items in views. The difference between them is that QStyledItemDelegate uses the current style to paint its items. We therefore recommend using QStyledItemDelegate as the base class when implementing custom delegates or when working with Qt style sheets. The code required for either class should be equal unless the custom delegate needs to use the style for drawing.

请注意,此答案基于 Iuliu 和 Alex 的评论

关于c++ - QItemDelegate 和 QStyledItemDelegate 有什么区别?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28871121/

40 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com