diff --git a/src/quick/items/qquickitem.cpp b/src/quick/items/qquickitem.cpp
index c7a713de53b2eedfa29878c59e536d656d25541b..7173ad366c1d45beecddcf32965801fe303bc99c 100644
--- a/src/quick/items/qquickitem.cpp
+++ b/src/quick/items/qquickitem.cpp
@@ -59,6 +59,7 @@
 #include <QtCore/qcoreevent.h>
 #include <QtCore/qnumeric.h>
 #include <QtGui/qpa/qplatformtheme.h>
+#include <QtCore/qloggingcategory.h>
 
 #include <private/qqmlglobal_p.h>
 #include <private/qqmlengine_p.h>
@@ -87,25 +88,24 @@ QT_BEGIN_NAMESPACE
 static bool qsg_leak_check = !qgetenv("QML_LEAK_CHECK").isEmpty();
 #endif
 
-#ifdef FOCUS_DEBUG
-void printFocusTree(QQuickItem *item, QQuickItem *scope = 0, int depth = 1);
-void printFocusTree(QQuickItem *item, QQuickItem *scope, int depth)
-{
-    qWarning()
-            << QByteArray(depth, '\t').constData()
-            << (scope && QQuickItemPrivate::get(scope)->subFocusItem == item ? '*' : ' ')
-            << item->hasFocus()
-            << item->hasActiveFocus()
-            << item->isFocusScope()
-            << item;
-    foreach (QQuickItem *child, item->childItems()) {
-        printFocusTree(
-                child,
-                item->isFocusScope() || !scope ? item : scope,
-                item->isFocusScope() || !scope ? depth + 1 : depth);
+void debugFocusTree(QQuickItem *item, QQuickItem *scope = 0, int depth = 1)
+{
+    if (DBG_FOCUS().isEnabled(QtDebugMsg)) {
+        qCDebug(DBG_FOCUS)
+                << QByteArray(depth, '\t').constData()
+                << (scope && QQuickItemPrivate::get(scope)->subFocusItem == item ? '*' : ' ')
+                << item->hasFocus()
+                << item->hasActiveFocus()
+                << item->isFocusScope()
+                << item;
+        foreach (QQuickItem *child, item->childItems()) {
+            debugFocusTree(
+                    child,
+                    item->isFocusScope() || !scope ? item : scope,
+                    item->isFocusScope() || !scope ? depth + 1 : depth);
+        }
     }
 }
-#endif
 
 static void QQuickItem_parentNotifier(QObject *o, qintptr, QQmlNotifier **n)
 {
@@ -2182,14 +2182,10 @@ QQuickItem* QQuickItemPrivate::nextPrevItemInTabFocusChain(QQuickItem *item, boo
         if (current == startItem && from == firstFromItem) {
             // wrapped around, avoid endless loops
             if (originalItem == contentItem) {
-#ifdef FOCUS_DEBUG
-                qDebug() << "QQuickItemPrivate::nextPrevItemInTabFocusChain: looped, return contentItem";
-#endif
+                qCDebug(DBG_FOCUS) << "QQuickItemPrivate::nextPrevItemInTabFocusChain: looped, return contentItem";
                 return item->window()->contentItem();
             } else {
-#ifdef FOCUS_DEBUG
-                qDebug() << "QQuickItemPrivate::nextPrevItemInTabFocusChain: looped, return " << startItem;
-#endif
+                qCDebug(DBG_FOCUS) << "QQuickItemPrivate::nextPrevItemInTabFocusChain: looped, return " << startItem;
                 return startItem;
             }
         }
diff --git a/src/quick/items/qquickwindow.cpp b/src/quick/items/qquickwindow.cpp
index 83b4b16e8e3143c328e92b145be298e00deed408..b6a8fb0a0358e604b7a079fe7dc36727adc51822 100644
--- a/src/quick/items/qquickwindow.cpp
+++ b/src/quick/items/qquickwindow.cpp
@@ -75,6 +75,11 @@
 
 QT_BEGIN_NAMESPACE
 
+Q_LOGGING_CATEGORY(DBG_TOUCH, "qt.quick.touch");
+Q_LOGGING_CATEGORY(DBG_MOUSE, "qt.quick.mouse");
+Q_LOGGING_CATEGORY(DBG_FOCUS, "qt.quick.focus");
+Q_LOGGING_CATEGORY(DBG_DIRTY, "qt.quick.dirty");
+
 extern Q_GUI_EXPORT QImage qt_gl_read_framebuffer(const QSize &size, bool alpha_format, bool include_alpha);
 
 bool QQuickWindowPrivate::defaultAlphaBuffer = false;
@@ -190,16 +195,6 @@ thus the first item that has focus will get it (assuming the scope doesn't alrea
 have a scope focused item), and the other items will have their focus cleared.
 */
 
-
-// #define FOCUS_DEBUG
-// #define MOUSE_DEBUG
-// #define TOUCH_DEBUG
-// #define DIRTY_DEBUG
-
-#ifdef FOCUS_DEBUG
-void printFocusTree(QQuickItem *item, QQuickItem *scope = 0, int depth = 1);
-#endif
-
 QQuickItem::UpdatePaintNodeData::UpdatePaintNodeData()
 : transformNode(0)
 {
@@ -699,14 +694,12 @@ void QQuickWindowPrivate::setFocusInScope(QQuickItem *scope, QQuickItem *item, Q
     Q_ASSERT(item);
     Q_ASSERT(scope || item == contentItem);
 
-#ifdef FOCUS_DEBUG
-    qWarning() << "QQuickWindowPrivate::setFocusInScope():";
-    qWarning() << "    scope:" << (QObject *)scope;
+    qCDebug(DBG_FOCUS) << "QQuickWindowPrivate::setFocusInScope():";
+    qCDebug(DBG_FOCUS) << "    scope:" << (QObject *)scope;
     if (scope)
-        qWarning() << "    scopeSubFocusItem:" << (QObject *)QQuickItemPrivate::get(scope)->subFocusItem;
-    qWarning() << "    item:" << (QObject *)item;
-    qWarning() << "    activeFocusItem:" << (QObject *)activeFocusItem;
-#endif
+        qCDebug(DBG_FOCUS) << "    scopeSubFocusItem:" << (QObject *)QQuickItemPrivate::get(scope)->subFocusItem;
+    qCDebug(DBG_FOCUS) << "    item:" << (QObject *)item;
+    qCDebug(DBG_FOCUS) << "    activeFocusItem:" << (QObject *)activeFocusItem;
 
     QQuickItemPrivate *scopePrivate = scope ? QQuickItemPrivate::get(scope) : 0;
     QQuickItemPrivate *itemPrivate = QQuickItemPrivate::get(item);
@@ -802,12 +795,10 @@ void QQuickWindowPrivate::clearFocusInScope(QQuickItem *scope, QQuickItem *item,
     Q_ASSERT(item);
     Q_ASSERT(scope || item == contentItem);
 
-#ifdef FOCUS_DEBUG
-    qWarning() << "QQuickWindowPrivate::clearFocusInScope():";
-    qWarning() << "    scope:" << (QObject *)scope;
-    qWarning() << "    item:" << (QObject *)item;
-    qWarning() << "    activeFocusItem:" << (QObject *)activeFocusItem;
-#endif
+    qCDebug(DBG_FOCUS) << "QQuickWindowPrivate::clearFocusInScope():";
+    qCDebug(DBG_FOCUS) << "    scope:" << (QObject *)scope;
+    qCDebug(DBG_FOCUS) << "    item:" << (QObject *)item;
+    qCDebug(DBG_FOCUS) << "    activeFocusItem:" << (QObject *)activeFocusItem;
 
     QQuickItemPrivate *scopePrivate = 0;
     if (scope) {
@@ -1473,10 +1464,7 @@ void QQuickWindow::mousePressEvent(QMouseEvent *event)
         return;
     }
 
-#ifdef MOUSE_DEBUG
-    qWarning() << "QQuickWindow::mousePressEvent()" << event->localPos() << event->button() << event->buttons();
-#endif
-
+    qCDebug(DBG_MOUSE) << "QQuickWindow::mousePressEvent()" << event->localPos() << event->button() << event->buttons();
     d->deliverMouseEvent(event);
 }
 
@@ -1490,9 +1478,7 @@ void QQuickWindow::mouseReleaseEvent(QMouseEvent *event)
         return;
     }
 
-#ifdef MOUSE_DEBUG
-    qWarning() << "QQuickWindow::mouseReleaseEvent()" << event->localPos() << event->button() << event->buttons();
-#endif
+    qCDebug(DBG_MOUSE) << "QQuickWindow::mouseReleaseEvent()" << event->localPos() << event->button() << event->buttons();
 
     if (!d->mouseGrabberItem) {
         QWindow::mouseReleaseEvent(event);
@@ -1514,9 +1500,7 @@ void QQuickWindow::mouseDoubleClickEvent(QMouseEvent *event)
         return;
     }
 
-#ifdef MOUSE_DEBUG
-    qWarning() << "QQuickWindow::mouseDoubleClickEvent()" << event->localPos() << event->button() << event->buttons();
-#endif
+    qCDebug(DBG_MOUSE) << "QQuickWindow::mouseDoubleClickEvent()" << event->localPos() << event->button() << event->buttons();
 
     if (!d->mouseGrabberItem && (event->buttons() & event->button()) == event->buttons()) {
         if (d->deliverInitialMousePressEvent(d->contentItem, event))
@@ -1555,9 +1539,7 @@ void QQuickWindow::mouseMoveEvent(QMouseEvent *event)
         return;
     }
 
-#ifdef MOUSE_DEBUG
-    qWarning() << "QQuickWindow::mouseMoveEvent()" << event->localPos() << event->button() << event->buttons();
-#endif
+    qCDebug(DBG_MOUSE) << "QQuickWindow::mouseMoveEvent()" << event->localPos() << event->button() << event->buttons();
 
 #ifndef QT_NO_CURSOR
     d->updateCursor(event->windowPos());
@@ -1696,9 +1678,7 @@ bool QQuickWindowPrivate::deliverWheelEvent(QQuickItem *item, QWheelEvent *event
 void QQuickWindow::wheelEvent(QWheelEvent *event)
 {
     Q_D(QQuickWindow);
-#ifdef MOUSE_DEBUG
-    qWarning() << "QQuickWindow::wheelEvent()" << event->pixelDelta() << event->angleDelta();
-#endif
+    qCDebug(DBG_MOUSE) << "QQuickWindow::wheelEvent()" << event->pixelDelta() << event->angleDelta();
 
     //if the actual wheel event was accepted, accept the compatibility wheel event and return early
     if (d->lastWheelEventAccepted && event->angleDelta().isNull() && event->phase() == Qt::ScrollUpdate)
@@ -1713,9 +1693,7 @@ void QQuickWindow::wheelEvent(QWheelEvent *event)
 
 bool QQuickWindowPrivate::deliverTouchCancelEvent(QTouchEvent *event)
 {
-#ifdef TOUCH_DEBUG
-    qWarning("touchCancelEvent");
-#endif
+    qCDebug(DBG_TOUCH) << event;
     Q_Q(QQuickWindow);
     // A TouchCancel event will typically not contain any points.
     // Deliver it to all items that have active touches.
@@ -1738,14 +1716,7 @@ bool QQuickWindowPrivate::deliverTouchCancelEvent(QTouchEvent *event)
 // call deliverTouchPoints to actually dispatch the points
 bool QQuickWindowPrivate::deliverTouchEvent(QTouchEvent *event)
 {
-#ifdef TOUCH_DEBUG
-    if (event->type() == QEvent::TouchBegin)
-        qWarning() << "touchBeginEvent";
-    else if (event->type() == QEvent::TouchUpdate)
-        qWarning() << "touchUpdateEvent points";
-    else if (event->type() == QEvent::TouchEnd)
-        qWarning("touchEndEvent");
-#endif
+    qCDebug(DBG_TOUCH) << event;
 
     // List of all items that received an event before
     // When we have TouchBegin this is and will stay empty
@@ -2451,9 +2422,7 @@ void QQuickWindowPrivate::cleanupNodesOnShutdown()
 
 void QQuickWindowPrivate::updateDirtyNodes()
 {
-#ifdef DIRTY_DEBUG
-    qWarning() << "QQuickWindowPrivate::updateDirtyNodes():";
-#endif
+    qCDebug(DBG_DIRTY) << "QQuickWindowPrivate::updateDirtyNodes():";
 
     cleanupNodes();
 
@@ -2466,9 +2435,7 @@ void QQuickWindowPrivate::updateDirtyNodes()
         QQuickItemPrivate *itemPriv = QQuickItemPrivate::get(item);
         itemPriv->removeFromDirtyList();
 
-#ifdef DIRTY_DEBUG
-        qWarning() << "   QSGNode:" << item << qPrintable(itemPriv->dirtyToString());
-#endif
+        qCDebug(DBG_DIRTY) << "   QSGNode:" << item << qPrintable(itemPriv->dirtyToString());
         updateDirtyNode(item);
     }
 }
diff --git a/src/quick/qtquickglobal_p.h b/src/quick/qtquickglobal_p.h
index f67a08c218070ae1e5d020102c41dda81c21e7a8..cd4cb61ebbc8d4886307c606ff3e9f01baaa7437 100644
--- a/src/quick/qtquickglobal_p.h
+++ b/src/quick/qtquickglobal_p.h
@@ -42,6 +42,8 @@
 #ifndef QTQUICKGLOBAL_P_H
 #define QTQUICKGLOBAL_P_H
 
+#include <QtCore/qloggingcategory.h>
+
 //
 //  W A R N I N G
 //  -------------
@@ -61,6 +63,11 @@ QT_BEGIN_NAMESPACE
 
 void QQuick_initializeProviders();
 
+Q_DECLARE_LOGGING_CATEGORY(DBG_TOUCH)
+Q_DECLARE_LOGGING_CATEGORY(DBG_MOUSE)
+Q_DECLARE_LOGGING_CATEGORY(DBG_FOCUS)
+Q_DECLARE_LOGGING_CATEGORY(DBG_DIRTY)
+
 QT_END_NAMESPACE
 
 #endif // QTQUICKGLOBAL_P_H