qt-4.2
I try to draw this way:
{
}
{
painter.save();
QPen pen
(Qt
::blue,
5, Qt
::SolidLine, Qt
::RoundCap, Qt
::RoundJoin);
painter.setPen(pen);
QRectF rectangle
(option.
rect.
x(), option.
rect.
y(), option.
rect.
width(),option.
rect.
height());
painter.drawRoundRect(rectangle,5,5);
painter.restore();
}
myView::myView(QWidget *parent)
: QListView(parent)
{
}
void myView::paintEvent(QPaintEvent *event)
{
QStyleOptionViewItem option = viewOptions();
QPainter painter(viewport());
painter.save();
QPen pen(Qt::blue, 5, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin);
painter.setPen(pen);
QRectF rectangle(option.rect.x(), option.rect.y(), option.rect.width(),option.rect.height());
painter.drawRoundRect(rectangle,5,5);
painter.restore();
}
To copy to clipboard, switch view to plain text mode
but all items are being overlaped, though the scroll works and you can see that there are items there (behind the rectangle) How to draw on background behind items?
Bookmarks