Unsolved QTextEdit doesn't display its corner with border-radius
-
Hello,
My problem is that I can't make my subclass of QTextEdit have rounded borders.
Because when I use the stylesheet property border-radius, the corners are not displayed.// In my TextEdit constructor : setStyleSheet("border: 1px solid; border-radius:10px;");
ScreenShot
I use Windows 10 with Qt5.5.1
I hope you will be able to help me...
(and sorry for the bad english, I'm french ^^) -
Hi, welcome to devnet.
Looks like a small bug in the way stylesheets are applied. You can workaround it by explicitly setting a background color:
setStyleSheet("border: 1px solid; border-radius:10px; background-color: palette(base); ");
-
@Chris-Kawa It works ! Thanks for all ^^
-
@Chris-Kawa Why is it useless to set border-radius for QTextEdit without setting a background? It's confusing to me.
-
Apparently changing just border radius does not internally trigger changing a style from the native one to stylesheets. Like I said - could be a bug. Have a look at the source code of QWidget and setStyleSheet if you're interested.
-
@Chris-Kawa Thanks. But why it is useful for QLabel.
-
@Gaobo Sorry, I don't understand the question. Why is it useful? It's your label. How should I know why it is useful to you?
-
@Chris-Kawa Sorry for my poor expresson. I mean, it's useful that I only set the border-radius for QLabel and not the background.