Originally Posted by
aamer4yu
Can you post the solution too
You won't like it. Codes were developed in Linux, and after moved to Windows, I got rubber band filled with red, so now I have to use #ifdef... too bad...
{
public:
setPalette(palette);
}
protected:
option.initFrom( this );
painter.
drawControl(QStyle::CE_FocusFrame, option
);
}
};
{
#ifdef Q_WS_WIN
#else
rubberBand
= new LinuxRubberBand
( QRubberBand::Rectangle,
0 ) ),
#endif
return rubberBand;
}
class LinuxRubberBand : public QRubberBand
{
public:
LinuxRubberBand( Shape s, QWidget * p = 0 ) : QRubberBand( s, p ) {
QPalette palette;
palette.setBrush( QPalette::WindowText, QBrush( Qt::red ) );
setPalette(palette);
}
protected:
virtual void paintEvent( QPaintEvent * ) {
QStylePainter painter(this);
QStyleOptionFocusRect option;
option.initFrom( this );
painter.drawControl(QStyle::CE_FocusFrame, option);
}
};
QRubberBand* createRubberBand()
{
QRubberBand* rubberBand( 0 );
#ifdef Q_WS_WIN
rubberBand = new QRubberBand( QRubberBand::Rectangle, 0 ) ),
#else
rubberBand = new LinuxRubberBand( QRubberBand::Rectangle, 0 ) ),
#endif
return rubberBand;
}
To copy to clipboard, switch view to plain text mode
Bookmarks