Question

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.

Était-ce utile?

La solution

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;")

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top