Is that possbile to change the border color & style of frame box
-
I've built a custom QScrollArea-based widget, and set its frame shape to BOX and some line width.
Now I'm intended to change the border color and border style (maybe dashed, dotted, etc) of that frame box, how to get that?
The four borders may get different line width or style individually. You can image that it's quite like CSS box concept.I tried to override paintEvent() in scrollarea widget, however it never got called. Only paintEvent of content widget of scrollarea was working. I guessed the reason was that content widget covered over scrollarea widget, so there was no paint event received by scrollarea widget.
Thanks.
-
this would help you "Style Sheet":http://doc.qt.nokia.com/4.7/stylesheet.html
-
I'm afraid that I'm not going to use style sheet. The style sheet programming way is not quite comfortable in my case, I built everything dynamically. Most importantly, the inheritance of style sheet would be also unacceptable, it will break some of my rules.
[quote author="BlackDante" date="1294912567"]this would help you "Style Sheet":http://doc.qt.nokia.com/4.7/stylesheet.html[/quote]
-
[quote author="fifth" date="1294912043"]I've built a custom QScrollArea-based widget, and set its frame shape to BOX and some line width.
Now I'm intended to change the border color and border style (maybe dashed, dotted, etc) of that frame box, how to get that?
The four borders may get different line width or style individually. You can image that it's quite like CSS box concept.[/quote]Then you have to implement custom painting for your QFrame base, or go with stylesheets.
[quote]Most importantly, the inheritance of style sheet would be also unacceptable, it will break some of my rules.[/quote]
This is simply wrong. Just use the right selectors.
-
[quote author="fifth" date="1294913184"]I'm afraid that I'm not going to use style sheet. The style sheet programming way is not quite comfortable in my case, I built everything dynamically. Most importantly, the inheritance of style sheet would be also unacceptable, it will break some of my rules.
[/quote]can u elaborate why and which rules would get broken? I use stylesheets and find them very convenient to use and very neat :)