문제

I have created a QTextBrowser and I wanted to know how i would set the background colour of the whole widget. I have tried QTextBrowser.setBackground(QtGui.QBrush(QtCore.Qt.blue, QtCore.Qt.SolidPattern)) with no luck.

도움이 되었습니까?

해결책

In this case I suggest you to use stylesheet: If in QDesigner, right click on the control, click "Set Stylesheet" and write

background-color: blue;

If you want to do it by code, just use

YourControlTextBrowser.setStyleSheet("background-color: blue;")

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top