mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-03-13 20:39:57 +01:00
Add workaround for Qt bug for Qt::Popup on OS X/Cocoa
This commit is contained in:
parent
7690eddff3
commit
5441128473
@ -391,7 +391,8 @@ IF( APPLE )
|
||||
SET( libSources ${libSources}
|
||||
utils/TomahawkUtils_Mac.mm
|
||||
mac/FileHelpers.mm
|
||||
thirdparty/Qocoa/qsearchfield_mac.mm )
|
||||
thirdparty/Qocoa/qsearchfield_mac.mm
|
||||
widgets/SourceTreePopupDialog_mac.mm )
|
||||
|
||||
SET_SOURCE_FILES_PROPERTIES(utils/TomahawkUtils_Mac.mm PROPERTIES COMPILE_FLAGS "-fvisibility=default")
|
||||
|
||||
|
@ -28,6 +28,10 @@
|
||||
#include <QPushButton>
|
||||
#include <QTimer>
|
||||
|
||||
#ifdef QT_MAC_USE_COCOA
|
||||
#include "SourceTreePopupDialog_mac.h"
|
||||
#endif
|
||||
|
||||
SourceTreePopupDialog::SourceTreePopupDialog( SourceTreeView* parent )
|
||||
: QWidget( 0 )
|
||||
, m_result( false )
|
||||
@ -127,6 +131,13 @@ SourceTreePopupDialog::paintEvent( QPaintEvent* event )
|
||||
p.drawPath( outline );
|
||||
|
||||
p.fillPath( outline, QColor( "#D6E3F1" ) );
|
||||
|
||||
#ifdef QT_MAC_USE_COCOA
|
||||
// Work around bug in Qt/Mac Cocoa where opening subsequent popups
|
||||
// would incorrectly calculate the background due to it not being
|
||||
// invalidated.
|
||||
SourceTreePopupHelper::clearBackground( this );
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
|
29
src/libtomahawk/widgets/SourceTreePopupDialog_mac.h
Normal file
29
src/libtomahawk/widgets/SourceTreePopupDialog_mac.h
Normal file
@ -0,0 +1,29 @@
|
||||
/* === This file is part of Tomahawk Player - <http://tomahawk-player.org> ===
|
||||
*
|
||||
* Copyright 2012 Leo Franchi <lfranchi@kde.org>
|
||||
*
|
||||
* Tomahawk is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Tomahawk is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with Tomahawk. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef SOURCETREE_POPUP_DIALOG_MAC_H
|
||||
#define SOURCETREE_POPUP_DIALOG_MAC_H
|
||||
|
||||
class QWidget;
|
||||
|
||||
namespace SourceTreePopupHelper {
|
||||
|
||||
void clearBackground( QWidget* widget );
|
||||
|
||||
}
|
||||
#endif
|
35
src/libtomahawk/widgets/SourceTreePopupDialog_mac.mm
Normal file
35
src/libtomahawk/widgets/SourceTreePopupDialog_mac.mm
Normal file
@ -0,0 +1,35 @@
|
||||
/* === This file is part of Tomahawk Player - <http://tomahawk-player.org> ===
|
||||
*
|
||||
* Copyright 2012 Leo Franchi <lfranchi@kde.org>
|
||||
*
|
||||
* Tomahawk is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Tomahawk is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with Tomahawk. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "SourceTreePopupDialog_mac.h"
|
||||
|
||||
#include <QWidget>
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
#import <AppKit/NSView.h>
|
||||
#import <AppKit/NSWindow.h>
|
||||
|
||||
void
|
||||
SourceTreePopupHelper::clearBackground( QWidget* widget )
|
||||
{
|
||||
Q_ASSERT( widget );
|
||||
// Workaround from QTBUG-15368
|
||||
NSView* view = reinterpret_cast< NSView* >( widget->winId() );
|
||||
NSWindow* cocoaWindow = [view window];
|
||||
[cocoaWindow invalidateShadow];
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user