diff --git a/kdeui/kernel/kapplication.cpp b/kdeui/kernel/kapplication.cpp
index b093034..3e1b2f2 100644
--- a/kdeui/kernel/kapplication.cpp
+++ b/kdeui/kernel/kapplication.cpp
@@ -207,7 +207,11 @@ public:
   QString sessionConfigName() const;
   void init(bool GUIenabled=true);
   void parseCommandLine( ); // Handle KDE arguments (Using KCmdLineArgs)
+#ifdef Q_OS_MAC
+  static void preqapplicationhack(bool GUIenabled = true);
+#else
   static void preqapplicationhack();
+#endif
   static void preread_app_startup_id();
   void read_app_startup_id();
 
@@ -342,7 +346,11 @@ static SmcConn mySmcConnection = 0;
 #endif
 
 KApplication::KApplication(bool GUIenabled)
+#ifdef Q_OS_MAC
+    : QApplication((KApplicationPrivate::preqapplicationhack(GUIenabled),KCmdLineArgs::qtArgc()), KCmdLineArgs::qtArgv(), GUIenabled),
+#else
     : QApplication((KApplicationPrivate::preqapplicationhack(),KCmdLineArgs::qtArgc()), KCmdLineArgs::qtArgv(), GUIenabled),
+#endif
     d(new KApplicationPrivate(this))
 {
     d->read_app_startup_id();
@@ -402,10 +432,39 @@ KApplication::KApplication(Display *display, int& argc, char** argv, const QByte
 }
 #endif
 
+#ifdef Q_OS_MAC
+static bool useRaster = true;
+void KApplication::doNotUseRaster()
+{
+    useRaster = false;
+}
+#endif
+
 // this function is called in KApplication ctors while evaluating arguments to QApplication ctor,
 // i.e. before QApplication ctor is called
+#ifdef Q_OS_MAC
+void KApplicationPrivate::preqapplicationhack(bool GUIenabled)
+#else
 void KApplicationPrivate::preqapplicationhack()
+#endif
 {
+#ifdef Q_OS_MAC
+    // Setting env RasterOff avoids setting raster. Can be used for before/after
+    // testing and to work around an application failing when raster is set.
+
+    // Fetch the default graphics system from Qt's settings store managed via qtconfig
+    QSettings settings(QSettings::UserScope, QLatin1String("Trolltech"));
+    settings.beginGroup(QLatin1String("Qt"));
+    const QString defaultGraphicsSystem = settings.value(QLatin1String("DefaultGraphicsSystem")).toString();
+    if (defaultGraphicsSystem.isNull() || defaultGraphicsSystem.isEmpty()) {
+        // only force raster mode here when not overriden via qtconfig or one of our own mechanisms
+        if (getenv("RasterOff") == NULL) {
+            if (useRaster && GUIenabled) {
+                QApplication::setGraphicsSystem(QString("raster"));
+            }
+        }
+    }
+#endif
     preread_app_startup_id();
 
     KGlobal::config(); // initialize qt plugin path (see KComponentDataPrivate::lazyInit)
diff --git a/kdeui/kernel/kapplication.h b/kdeui/kernel/kapplication.h
index fa2ab26..cc21e76 100644
--- a/kdeui/kernel/kapplication.h
+++ b/kdeui/kernel/kapplication.h
@@ -403,6 +403,14 @@ public:
    */
   static bool loadedByKdeinit;
 
+#ifdef Q_OS_MAC
+  /**
+   * Use before creating KApplication in an app which fails with raster
+   * graphics, such as KMyMoney. Most KDE apps on OS X run better with raster.
+   */
+  static void doNotUseRaster();
+#endif
+
 public Q_SLOTS:
   /**
    * Updates the last user action timestamp to the given time, or to the current time,
