Removed deprecated QPlastiqueStyle. Replaced by stock Fusion style (new in Qt5). Change this to keep the custom look defined in UBStyle?

preferencesAboutTextFull
Craig Watson 10 years ago
parent 385ac60ccf
commit 42eb05560b
  1. 36
      src/core/UBApplication.cpp
  2. 27
      src/core/UBApplication.h

@ -31,6 +31,7 @@
#include <QtWebKit>
#include <QtXml>
#include <QFontDatabase>
#include <QStyleFactory>
#if defined(Q_WS_MACX)
#include <Carbon/Carbon.h>
@ -157,7 +158,7 @@ UBApplication::UBApplication(const QString &id, int &argc, char **argv) : QtSing
setWindowIcon(QIcon(":/images/OpenBoard.png"));
#endif
setStyle(new UBStyle()); // Style is owned and deleted by the application
setStyle("fusion");
QString css = UBFileSystemUtils::readTextFile(UBPlatformUtils::applicationResourcesDirectory() + "/etc/"+ qApp->applicationName()+".css");
if (css.length() > 0)
@ -650,39 +651,6 @@ void UBApplication::cleanup()
documentController = NULL;
}
void UBStyle::drawItemText(QPainter *painter, const QRect &rect, int alignment, const QPalette &pal,
bool enabled, const QString& text, QPalette::ColorRole textRole) const
{
if (text.isEmpty())
return;
QPen savedPen;
if (textRole != QPalette::NoRole)
{
savedPen = painter->pen();
painter->setPen(QPen(pal.brush(textRole), savedPen.widthF()));
}
if (!enabled)
{
QPen pen = painter->pen();
QColor half = pen.color();
half.setRed(half.red() / 2);
half.setGreen(half.green() / 2);
half.setBlue(half.blue() / 2);
painter->setPen(half);
painter->drawText(rect, alignment, text);
painter->setPen(pen);
}
painter->drawText(rect, alignment, text);
if (textRole != QPalette::NoRole)
painter->setPen(savedPen);
}
QString UBApplication::urlFromHtml(QString html)
{
QString _html;

@ -29,6 +29,8 @@
#define UBAPPLICATION_H_
#include <QtGui>
#include <QUndoStack>
#include <QToolBar>
#include "qtsingleapplication.h"
@ -144,29 +146,4 @@ class UBApplication : public QtSingleApplication
};
class UBStyle : public QPlastiqueStyle
{
public:
UBStyle()
: QPlastiqueStyle()
{
// NOOP
}
virtual ~UBStyle()
{
// NOOP
}
/*
* redefined to be more cocoa like on texts
*/
virtual void drawItemText(QPainter *painter, const QRect &rect, int alignment, const QPalette &pal,
bool enabled, const QString& text, QPalette::ColorRole textRole) const;
};
#endif /* UBAPPLICATION_H_ */

Loading…
Cancel
Save