Make item delegate in QTableView not transparent

◇◆丶佛笑我妖孽 提交于 2019-12-24 23:09:24

问题


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?)


回答1:


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

editor->setAutoFillBackground(true);



回答2:


widget->setStyleSheet("background-color: #eee;");



来源:https://stackoverflow.com/questions/22805756/make-item-delegate-in-qtableview-not-transparent

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!