
Originally Posted by
aamer4yu
Try this -
painter.setOpacity(0.5)... in the paintEvent
It doesn't work.
Here the new code:
{
public:
{
//palette.setBrush( QPalette::WindowText, QBrush( Qt::red ) );
setPalette(palette);
}
protected:
{
option.initFrom( this );
painter.
drawControl(QStyle::CE_FocusFrame, option
);
painter.setOpacity(0.5); // from aamer4yu
}
};
class WfRubberBand : public QRubberBand
{
public:
WfRubberBand( Shape s, QWidget * p = 0 ) : QRubberBand( s, p )
{
QPalette palette;
//palette.setBrush( QPalette::WindowText, QBrush( Qt::red ) );
palette.setBrush( QPalette::Foreground, QBrush( Qt::red ) );
setPalette(palette);
}
protected:
virtual void paintEvent( QPaintEvent * )
{
QStylePainter painter(this);
QStyleOptionFocusRect option;
option.initFrom( this );
painter.drawControl(QStyle::CE_FocusFrame, option);
painter.setOpacity(0.5); // from aamer4yu
}
};
To copy to clipboard, switch view to plain text mode
Which can be the problem?
Bookmarks