diff --git a/widgets/tooltip.cpp b/widgets/tooltip.cpp index 9631c2601..c30543bb8 100644 --- a/widgets/tooltip.cpp +++ b/widgets/tooltip.cpp @@ -252,20 +252,26 @@ void WindowPreview::setInfo() reinterpret_cast< unsigned char* >( data ), sizeof( data ) / sizeof( data[ 0 ] )); } -//Patterned after KickerTip -//TODO: Do something to antialias edges -//Reimplement paintEvent perhaps? -void ToolTip::resizeEvent(QResizeEvent *) + +void ToolTip::paintEvent(QPaintEvent *) { + QPainter painter(this); + painter.setRenderHint(QPainter::Antialiasing); + + // draw items QBitmap mask(width(), height()); - QPainter painter(&mask); + QPainter maskPainter(&mask); mask.fill(Qt::white); - painter.setBrush(Qt::black); - painter.setPen(Qt::black); - painter.drawPath(Plasma::roundedRectangle(mask.rect(), 10)); + maskPainter.setBrush(Qt::black); + maskPainter.setPen(Qt::black); + + maskPainter.drawPath(roundedRectangle(mask.rect(), 10)); setMask(mask); + + painter.setPen(Qt::black); + painter.drawPath(roundedRectangle(mask.rect(), 10)); } } diff --git a/widgets/tooltip_p.h b/widgets/tooltip_p.h index 0c8df8d3f..d21407d94 100644 --- a/widgets/tooltip_p.h +++ b/widgets/tooltip_p.h @@ -52,7 +52,7 @@ public: protected: virtual void showEvent( QShowEvent* ); - void resizeEvent(QResizeEvent */*event*/); + void paintEvent(QPaintEvent */*event*/); private Q_SLOTS: void slotResetTimer();