From 47439baa377a4a45f35d86c797df9bab6851754b Mon Sep 17 00:00:00 2001 From: Teo Mrnjavac Date: Sat, 12 Jan 2013 18:20:08 +0100 Subject: [PATCH] Draw SocialWidget, STPD and AccountsWidget the same way. --- src/SocialWidget.cpp | 27 +++++++------------ .../widgets/SourceTreePopupDialog.cpp | 6 ++--- 2 files changed, 11 insertions(+), 22 deletions(-) diff --git a/src/SocialWidget.cpp b/src/SocialWidget.cpp index caed845ad..ae0d319a4 100644 --- a/src/SocialWidget.cpp +++ b/src/SocialWidget.cpp @@ -41,11 +41,11 @@ SocialWidget::SocialWidget( QWidget* parent ) , m_parentRect( parent->rect() ) { ui->setupUi( this ); -#ifndef Q_OS_WIN - setWindowFlags( Qt::FramelessWindowHint ); //this causes ugly black shadows on Windows - setWindowFlags( Qt::Popup ); -#endif + setWindowFlags( Qt::Popup | Qt::FramelessWindowHint ); + + setAutoFillBackground( false ); setAttribute( Qt::WA_TranslucentBackground, true ); + setAttribute( Qt::WA_NoSystemBackground, true ); TomahawkUtils::unmarginLayout( layout() ); @@ -149,20 +149,11 @@ SocialWidget::paintEvent( QPaintEvent* event ) outline.lineTo( r.right() - ARROW_HEIGHT * 3, r.bottom()+1 + ARROW_HEIGHT ); outline.lineTo( r.right() - ARROW_HEIGHT * 4, r.bottom()+1 ); - QPainter p( this ); - p.setRenderHint( QPainter::Antialiasing ); - p.setBackgroundMode( Qt::TransparentMode ); - - QPen pen( TomahawkUtils::Colors::BORDER_LINE ); - pen.setWidth( 2 ); - p.setPen( pen ); - p.drawPath( outline ); - - p.setOpacity( TomahawkUtils::POPUP_OPACITY ); - p.fillPath( outline, TomahawkUtils::Colors::POPUP_BACKGROUND ); - - QWidget::paintEvent( event ); - return; + TomahawkUtils::drawCompositedPopup( this, + outline, + TomahawkUtils::Colors::BORDER_LINE, + TomahawkUtils::Colors::POPUP_BACKGROUND, + TomahawkUtils::POPUP_OPACITY ); } diff --git a/src/libtomahawk/widgets/SourceTreePopupDialog.cpp b/src/libtomahawk/widgets/SourceTreePopupDialog.cpp index c8a91a69b..e0a406bff 100644 --- a/src/libtomahawk/widgets/SourceTreePopupDialog.cpp +++ b/src/libtomahawk/widgets/SourceTreePopupDialog.cpp @@ -49,13 +49,11 @@ SourceTreePopupDialog::SourceTreePopupDialog() #ifndef ENABLE_HEADLESS setParent( QApplication::activeWindow() ); #endif -#ifndef Q_OS_WIN - setWindowFlags( Qt::FramelessWindowHint ); - setWindowFlags( Qt::Popup ); -#endif + setWindowFlags( Qt::Popup | Qt::FramelessWindowHint ); setAutoFillBackground( false ); setAttribute( Qt::WA_TranslucentBackground, true ); + setAttribute( Qt::WA_NoSystemBackground, true ); //setSizePolicy( QSizePolicy::Fixed, QSizePolicy::Fixed );