PDA

View Full Version : Why my text entry scrollbar track color is transparent?



Ishaq Khan
6th July 2019, 16:10
Hi,

I have a text entry whose background color is black and I want its scrollbar track color also to be black. But I get some pattern/texture similar to transparent part of a layer we see in Photoshop, applied to scrollbar's track.

Below is my code:


from PyQt5.QtWidgets import QApplication, QPlainTextEdit

app = QApplication([])

t = QPlainTextEdit('blah ' * 100, styleSheet='background: black; color: white; font-size: 12pt')
t.verticalScrollBar().setStyleSheet('background: black')

t.show()
app.exec_()


in case someone want to know my problem visually, I have added an image showing gotten and desired (Photoshopped) result. See below:
13179

This is a very important issue for me, please kindly solve it if you can. I shall be very thankful to you.

anda_skoa
7th July 2019, 12:27
The style draws different parts of widgets with different colors, e.g. to achieve a "3D" effect, see https://doc.qt.io/archives/qt-4.8/qpalette.html#ColorRole-enum

So in this case it might not be using the normal background for some of the areas.

You could try modifying the widget's palette and experiment if you can find which color role is the one being used.

Cheers,
_