Hi to all I need to select a region over my waveform display so someone suggested to me to use QRubberBand. I tried it and it works but I would change the selection color to transparent red so I found in internet this class
{
public:
{
//palette.setBrush( QPalette::WindowText, QBrush( Qt::red ) );
setPalette(palette);
}
protected:
{
option.initFrom( this );
painter.
drawControl(QStyle::CE_FocusFrame, option
);
}
};
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);
}
};
To copy to clipboard, switch view to plain text mode
I tested it and effectively it draw a red rectangle but filled and not transparent so I added this line
setWindowOpacity( 0.0 );
setWindowOpacity( 0.0 );
To copy to clipboard, switch view to plain text mode
without any effects.
How can I do to have a transparency?
May be should I use composition instead of rubberband?
Best Regards,
Franco
Bookmarks