PDA

View Full Version : costum QWidget with border-image in style sheet



qt fan
24th January 2009, 22:07
hello,

i have a simple class that derives from QWidget.
the paint event looks like this:

void ssbgtest::paintEvent(QPaintEvent *)
{
QStyleOption opt;
opt.init(this);
QPainter p(this);
style()->drawPrimitive(QStyle::PE_Widget, &opt, &p, this);
}
well, this paintevent lets me use background-image in the style sheet.

but i need a border-image, because it will then resize the image when you resize the window. background-image tiles the image.

what i need is the code to provide this feature for my simple class. i guess its only about the primitiv element, but which is the right to draw?

greetz qt fan

fanat9
25th January 2009, 21:36
Check border-image on Qt Style Sheets Reference.

http://doc.trolltech.com/4.4/stylesheet-reference.html#border-image