Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有一个 QListWidget,里面装满了不同颜色的矩形图标,用作我们应用程序的颜色选择对话框。我不喜欢它们的亮点,因为它没有正确对齐,从附图中可以看出。
我该如何解决?一般来说,任何关于更好亮点的想法也会很棒!
谢谢, 萨扬
您需要对其方法进行子类化QItemDelegate并重新实现paint,然后QAbstractItemView::setItemDelegate在您的QListWidget.
QItemDelegate
paint
QAbstractItemView::setItemDelegate
QListWidget