使 QTableView 中的项目委托不透明 [英] Make item delegate in QTableView not transparent

查看:42
本文介绍了使 QTableView 中的项目委托不透明的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我遇到了 QTableView 的自定义项目委托问题.

I issued in problem with custom item delegate for QTableView.

该屏幕截图完全说明了该问题:

That problem is completely illustrated by that screenshoot:

我们可以在项目委托编辑器后面看到项目内容.隐藏该内容或使项目委托不透明的最佳方法是什么?(如何获得编辑行的背景颜色/画笔?)

We can see item content behind item delegate editor. What is the best way to hide that content or make item delegate not transparent? (how I can get background color/brush for edited row?)

推荐答案

您需要通过启用自动填充背景属性来让您的编辑器绘制自己的背景:

You need to let your editor to paint its own background by enabling the autofill background property:

editor->setAutoFillBackground(true);

这篇关于使 QTableView 中的项目委托不透明的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆