use plastique as a fallback style if user is running GTK style so the part

widget display is ok.

svn path=/trunk/extragear/sysadmin/partitionmanager/; revision=1226198
This commit is contained in:
Volker Lanz 2011-03-27 16:44:29 +00:00
parent fd3105a50a
commit 92859b3aa5
1 changed files with 13 additions and 0 deletions

View File

@ -27,6 +27,8 @@
#include <QPainter>
#include <QStyleOptionButton>
#include <QApplication>
#include <QPlastiqueStyle>
#include <kdebug.h>
#include <kglobalsettings.h>
@ -44,6 +46,17 @@ PartWidget::PartWidget(QWidget* parent, const Partition* p) :
{
setFont(KGlobalSettings::smallestReadableFont());
// Check if user is running a GTK style; in that case, use plastique as a fallback
// style for the PartWidget to work around GTK styles not showing the FS colors
// correctly.
// Inspired by Aurélien Gâteau's similar workaround in Gwenview (230aebbd)
if (qstrcmp(QApplication::style()->metaObject()->className(), "QGtkStyle") == 0)
{
QStyle* style = new QPlastiqueStyle();
style->setParent(this);
setStyle(style);
}
init(p);
}