1
0
mirror of https://github.com/tomahawk-player/tomahawk.git synced 2025-08-12 00:54:20 +02:00

Try to fix popup shadows on Windows.

This commit is contained in:
Teo Mrnjavac
2012-11-18 12:36:47 +01:00
parent fb216e604a
commit adb3311c72
3 changed files with 15 additions and 3 deletions

View File

@@ -251,7 +251,7 @@ SocialWidget::onGeometryUpdate()
QPoint position( m_position - QPoint( size().width(), size().height() ) QPoint position( m_position - QPoint( size().width(), size().height() )
+ QPoint( 2 + ARROW_HEIGHT * 3, 0 ) ); + QPoint( 2 + ARROW_HEIGHT * 3, 0 ) );
#ifdef Q_OS_WIN #ifdef Q_OS_WIN
position.ry() -= 2 * ARROW_HEIGHT; position.ry() -= 12 + ARROW_HEIGHT;
#endif #endif
if ( position != pos() ) if ( position != pos() )
{ {

View File

@@ -21,6 +21,7 @@
#include "utils/TomahawkUtilsGui.h" #include "utils/TomahawkUtilsGui.h"
#include <QApplication>
#include <QPaintEvent> #include <QPaintEvent>
#include <QPainter> #include <QPainter>
#include <QDialogButtonBox> #include <QDialogButtonBox>
@@ -44,6 +45,9 @@ SourceTreePopupDialog::SourceTreePopupDialog()
, m_label( 0 ) , m_label( 0 )
, m_buttons( 0 ) , m_buttons( 0 )
{ {
#ifndef ENABLE_HEADLESS
setParent( QApplication::activeWindow() );
#endif
#ifndef Q_OS_WIN #ifndef Q_OS_WIN
setWindowFlags( Qt::FramelessWindowHint ); setWindowFlags( Qt::FramelessWindowHint );
setWindowFlags( Qt::Popup ); setWindowFlags( Qt::Popup );
@@ -54,7 +58,6 @@ SourceTreePopupDialog::SourceTreePopupDialog()
//setSizePolicy( QSizePolicy::Fixed, QSizePolicy::Fixed ); //setSizePolicy( QSizePolicy::Fixed, QSizePolicy::Fixed );
m_title = new QLabel( this ); m_title = new QLabel( this );
QFont titleFont = m_title->font(); QFont titleFont = m_title->font();
titleFont.setBold( true ); titleFont.setBold( true );
@@ -114,6 +117,7 @@ SourceTreePopupDialog::SourceTreePopupDialog()
background-color: #D35052; \ background-color: #D35052; \
border-style: flat; \ border-style: flat; \
}" );*/ }" );*/
setFixedHeight( 80 );
} }
void void
@@ -137,6 +141,8 @@ void
SourceTreePopupDialog::setMainText( const QString& text ) SourceTreePopupDialog::setMainText( const QString& text )
{ {
m_label->setText( text ); m_label->setText( text );
QFontMetrics fm = m_label->fontMetrics();
setFixedWidth( fm.width( text ) + 20 );
} }
@@ -153,6 +159,7 @@ SourceTreePopupDialog::setExtraQuestions( const Tomahawk::PlaylistDeleteQuestion
{ {
m_questions = questions; m_questions = questions;
int baseHeight = 80;
int idx = m_layout->indexOf( m_label ) + 1; int idx = m_layout->indexOf( m_label ) + 1;
foreach ( const Tomahawk::PlaylistDeleteQuestion& question, m_questions ) foreach ( const Tomahawk::PlaylistDeleteQuestion& question, m_questions )
{ {
@@ -168,7 +175,9 @@ SourceTreePopupDialog::setExtraQuestions( const Tomahawk::PlaylistDeleteQuestion
m_questionCheckboxes << cb; m_questionCheckboxes << cb;
idx++; idx++;
baseHeight += cb->height() + m_layout->spacing();
} }
setFixedHeight( baseHeight );
} }

View File

@@ -372,8 +372,11 @@ SourceTreeView::deletePlaylist( const QModelIndex& idxIn )
PlaylistItem* item = itemFromIndex< PlaylistItem >( idx ); PlaylistItem* item = itemFromIndex< PlaylistItem >( idx );
playlist_ptr playlist = item->playlist(); playlist_ptr playlist = item->playlist();
QPoint rightCenter = viewport()->mapToGlobal( visualRect( idx ).topRight() + QPoint( 0, visualRect( idx ).height() / 2 ) );
#ifdef Q_OS_WIN
rightCenter = QApplication::activeWindow()->mapFromGlobal( rightCenter );
#endif
const QPoint rightCenter = viewport()->mapToGlobal( visualRect( idx ).topRight() + QPoint( 0, visualRect( idx ).height() / 2 ) );
if ( playlist->hasCustomDeleter() ) if ( playlist->hasCustomDeleter() )
{ {
playlist->customDelete( rightCenter ); playlist->customDelete( rightCenter );