Border-image not working in QWidget?
I have a class derived from QWidget. When I try to use the style-sheet to set the border-image, it appears to ignore it. I am using QT 4.4 and it looks like the QWidget should support border-image. Is there something I would need to do in the paint event to get it to display, or something else I am missing?
Also, is it possible to define a series of images for the border, using border-top-left-image and the rest?
Re: Border-image not working in QWidget?
Quote:
Originally Posted by
astampor
Is there something I would need to do in the paint event to get it to display, or something else I am missing?
Yes. You need to use QStyle API to render the PE_Widget primitive.
Re: Border-image not working in QWidget?
Re: Border-image not working in QWidget?
Quote:
Originally Posted by
wysota
Yes. You need to use
QStyle API to render the PE_Widget primitive.
In the paintEvent, I am already doing this:
Code:
o.initFrom(this);
style
()->drawPrimitive
(QStyle::PE_Widget,
&o,
&painter,
this);
I needed this to get the background image to draw. Is there something else I need to add to get the border-image to draw as well?
Re: Border-image not working in QWidget?
No, this should be sufficient. It could be that you can't use both the background and border image or that you are doing something else incorrectly. Does it work if you apply both the background and the border image to a plain QWidget instance?