[SOLVED] QStyleOptionViewItem draw text ?
-
[quote author="raven-worx" date="1371554769"]ok, but why do you want to draw a line edit instead of using a real qlinedit widget?
pro: works our of the box like a qlineedit should
con: may cause performance
[/quote]I can't use setInexWidget() performance drops heavily !!!
bq. Or why do you want to use a QLineEdit widget at all?
The lineEdit is initialized in the createEditor(). what else you recommend ?
-
just draw the text with a simple background is enough for you?
How do you exactly change the background color of the line edit when the QValidator fails? By Stylesheet?
-
yes the background color for the lineEdit changes through styleSheets.
Yes easiest way is to change the background color of the cell.Thanks :)
PS : I was thinking too complex :)
-
thats why i asked ;)
-
One more question I would like to ask , is there anyway we can get the background-color of the lineEdit which is set through stylesheets like in the above image the yellow color is set through stylesheet.
Anything like
lineEdit->palette().color(QPalette::?????); -
No. It might not even be a color. It might be a brush. Or an image, or...
-
try QPalette::Background
-
and if we are setting the background-color through stylesheets then also its not possible to retrieve the value ?
PS : QPalette::Background return gray color
-
[quote author="Sam" date="1371730152"]and if we are setting the background-color through stylesheets then also its not possible to retrieve the value ?[/quote]
AFAIK: indeed not. The style sheets are not exposed through the public API other then setting them on a widget or the application.I'd love to be proven wrong on this one though!
-
Thanks Andre,
I think then I have to check/set the color for the painter based on properties specified for the lineEdit.