質問

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