remove more QApplication dependencies
authorLars Knoll <lars.knoll@nokia.com>
Tue, 3 May 2011 19:14:05 +0000 (21:14 +0200)
committerLars Knoll <lars.knoll@nokia.com>
Tue, 3 May 2011 19:14:05 +0000 (21:14 +0200)
src/gui/painting/qdrawutil.cpp
src/gui/painting/qpaintengine.cpp
src/gui/painting/qpainter.cpp
src/gui/painting/qprinter.cpp
src/gui/painting/qwindowsurface.cpp

index bbd23c2..4eb38e6 100644 (file)
@@ -949,7 +949,7 @@ QRect qItemRect(QPainter *p, Qt::GUIStyle gs,
             x += w - pixmap->width();
         else if ((flags & Qt::AlignHCenter) == Qt::AlignHCenter)
             x += w/2 - pixmap->width()/2;
-        else if ((flags & Qt::AlignLeft) != Qt::AlignLeft && QApplication::isRightToLeft())
+        else if ((flags & Qt::AlignLeft) != Qt::AlignLeft && QGuiApplication::isRightToLeft())
             x += w - pixmap->width();
         result = QRect(x, y, pixmap->width(), pixmap->height());
     } else if (!text.isNull() && p) {
@@ -1008,7 +1008,7 @@ void qDrawItem(QPainter *p, Qt::GUIStyle gs,
             x += w - pm.width();
         else if ((flags & Qt::AlignHCenter) == Qt::AlignHCenter)
             x += w/2 - pm.width()/2;
-        else if (((flags & Qt::AlignLeft) != Qt::AlignLeft) && QApplication::isRightToLeft()) // Qt::AlignAuto && rightToLeft
+        else if (((flags & Qt::AlignLeft) != Qt::AlignLeft) && QGuiApplication::isRightToLeft()) // Qt::AlignAuto && rightToLeft
             x += w - pm.width();
 
         if (!enabled) {
index 0b66a6c..9773626 100644 (file)
@@ -138,7 +138,7 @@ QString QTextItem::text() const
 QFont QTextItem::font() const
 {
     const QTextItemInt *ti = static_cast<const QTextItemInt *>(this);
-    return ti->f ? *ti->f : QApplication::font();
+    return ti->f ? *ti->f : QGuiApplication::font();
 }
 
 
index 2b42f21..876b7f6 100644 (file)
@@ -6452,7 +6452,7 @@ static void drawTextItemDecoration(QPainter *painter, const QPointF &pos, const
     const qreal underlinePos = pos.y() + qCeil(underlineOffset) - aliasedCoordinateDelta;
 
     if (underlineStyle == QTextCharFormat::SpellCheckUnderline) {
-        underlineStyle = QTextCharFormat::UnderlineStyle(QApplication::style()->styleHint(QStyle::SH_SpellCheckUnderlineStyle));
+        underlineStyle = QTextCharFormat::SpellCheckUnderline; // ### Qt5 QTextCharFormat::UnderlineStyle(QApplication::style()->styleHint(QStyle::SH_SpellCheckUnderlineStyle));
     }
 
     if (underlineStyle == QTextCharFormat::WaveUnderline) {
@@ -8296,7 +8296,7 @@ QPainterState::QPainterState()
       wx(0), wy(0), ww(0), wh(0), vx(0), vy(0), vw(0), vh(0),
       opacity(1), WxF(false), VxF(false), clipEnabled(true),
       bgMode(Qt::TransparentMode), painter(0),
-      layoutDirection(QApplication::layoutDirection()),
+      layoutDirection(QGuiApplication::layoutDirection()),
       composition_mode(QPainter::CompositionMode_SourceOver),
       emulationSpecifier(0), changeFlags(0)
 {
@@ -8326,7 +8326,7 @@ void QPainterState::init(QPainter *p) {
     clipInfo.clear();
     worldMatrix.reset();
     matrix.reset();
-    layoutDirection = QApplication::layoutDirection();
+    layoutDirection = QGuiApplication::layoutDirection();
     composition_mode = QPainter::CompositionMode_SourceOver;
     emulationSpecifier = 0;
     dirtyFlags = 0;
index 5111bf4..2baa1dd 100644 (file)
@@ -45,7 +45,7 @@
 #include "qprinterinfo.h"
 #include "qlist.h"
 #include <qpagesetupdialog.h>
-#include <qapplication.h>
+#include <qcoreapplication.h>
 #include <qfileinfo.h>
 #if !defined(QT_NO_CUPS) && !defined(QT_NO_LIBRARY)
 #include "private/qcups_p.h"
@@ -627,9 +627,9 @@ QPrinter::QPrinter(const QPrinterInfo& printer, PrinterMode mode)
 void QPrinter::init(PrinterMode mode)
 {
 #if !defined(Q_WS_X11)
-    if (!qApp) {
+    if (!QCoreApplication::instance()) {
 #else
-    if (!qApp || !X11) {
+    if (!QCoreApplication::instance() || !X11) {
 #endif
         qFatal("QPrinter: Must construct a QApplication before a QPaintDevice");
         return;
index f616769..13d1521 100644 (file)
@@ -116,12 +116,6 @@ QWindowSurface::QWindowSurface(QWindow *window, bool /*setDefaultSurface*/)
 {
     if (window)
         window->d_func()->surface = this;
-#if 0
-    if (!QApplicationPrivate::runtime_graphics_system) {
-        if (setDefaultSurface && window)
-            window->setWindowSurface(this);
-    }
-#endif
 }
 
 /*!
@@ -149,7 +143,6 @@ void QWindowSurface::beginPaint(const QRegion &)
 
 void QWindowSurface::endPaint(const QRegion &)
 {
-//     QApplication::syncX();
 }
 
 #if !defined(Q_WS_QPA)