1
0
mirror of https://github.com/tomahawk-player/tomahawk.git synced 2025-08-11 16:44:05 +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( 2 + ARROW_HEIGHT * 3, 0 ) );
#ifdef Q_OS_WIN
position.ry() -= 2 * ARROW_HEIGHT;
position.ry() -= 12 + ARROW_HEIGHT;
#endif
if ( position != pos() )
{

View File

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