1
0
mirror of https://github.com/tomahawk-player/tomahawk.git synced 2025-03-23 01:09:42 +01:00

Reenabled ProxyStyle under QtCurve, and fixed QSlider appearance.

This commit is contained in:
Teo Mrnjavac 2012-08-02 12:24:28 +02:00
parent 2236b0ffb3
commit 7e47d0efcc
3 changed files with 18 additions and 5 deletions

View File

@ -202,11 +202,7 @@ TomahawkWindow::saveSettings()
void
TomahawkWindow::applyPlatformTweaks()
{
// HACK QtCurve causes an infinite loop on startup. This is because setStyle calls setPalette, which calls ensureBaseStyle,
// which loads QtCurve. QtCurve calls setPalette, which creates an infinite loop. The UI will look like CRAP with QtCurve, but
// the user is asking for it explicitly... so he's gonna be stuck with an ugly UI.
if ( !QString( qApp->style()->metaObject()->className() ).toLower().contains( "qtcurve" ) )
qApp->setStyle( new ProxyStyle() );
qApp->setStyle( new ProxyStyle() );
#ifdef Q_OS_MAC
setUnifiedTitleAndToolBarOnMac( true );

View File

@ -1,6 +1,7 @@
/* === This file is part of Tomahawk Player - <http://tomahawk-player.org> ===
*
* Copyright 2010-2011, Christian Muehlhaeuser <muesli@tomahawk-player.org>
* Copyright 2012, Teo Mrnjavac <teo@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
@ -82,3 +83,18 @@ ProxyStyle::drawControl( ControlElement ce, const QStyleOption* opt, QPainter* p
else
QProxyStyle::drawControl( ce, opt, p, w );
}
QSize
ProxyStyle::sizeFromContents( QStyle::ContentsType type, const QStyleOption *option, const QSize &size, const QWidget *widget ) const
{
if( type == CT_Splitter )
{
const QSplitter* splitter = qobject_cast< const QSplitter* >( widget );
if( splitter->orientation() == Qt::Horizontal )
return QSize( 1, size.height() );
else
return QSize( size.width(), 1 );
}
else
return QProxyStyle::sizeFromContents( type, option, size, widget );
}

View File

@ -31,6 +31,7 @@ public:
virtual void drawPrimitive( PrimitiveElement pe, const QStyleOption *opt, QPainter *p, const QWidget *w = 0 ) const;
virtual void drawControl( ControlElement ce, const QStyleOption *opt, QPainter *p, const QWidget *w = 0 ) const;
virtual QSize sizeFromContents( ContentsType type, const QStyleOption *option, const QSize &size, const QWidget *widget ) const;
};
#endif // PROXYSTYLE_H