diff --git a/src/app/main.cpp b/src/app/main.cpp
index 9d3842fe12b3a5dada1024f6174c267319f7e5c9..526ca15477f62b0b23a046613d5a49f724566540 100644
--- a/src/app/main.cpp
+++ b/src/app/main.cpp
@@ -52,7 +52,6 @@
 
 #include <QApplication>
 #include <QDesktopServices>
-#include <QMainWindow>
 #include <QMessageBox>
 
 #ifdef ENABLE_QT_BREAKPAD
diff --git a/src/plugins/analyzerbase/analyzermanager.cpp b/src/plugins/analyzerbase/analyzermanager.cpp
index 49be027161a6c153ddbda24fc59f15fbc88241e8..4f2feffe6b1623822449b064bf73013ed4075bae 100644
--- a/src/plugins/analyzerbase/analyzermanager.cpp
+++ b/src/plugins/analyzerbase/analyzermanager.cpp
@@ -90,7 +90,6 @@
 #include <QLabel>
 #include <QCheckBox>
 #include <QDialogButtonBox>
-#include <QMainWindow>
 #include <QPushButton>
 
 using namespace Core;
diff --git a/src/plugins/analyzerbase/analyzerplugin.cpp b/src/plugins/analyzerbase/analyzerplugin.cpp
index 2362661ddbeb960664c8744f106691b30cf02891..a8608f94e31b88530686ba1ea9d5a605609466fc 100644
--- a/src/plugins/analyzerbase/analyzerplugin.cpp
+++ b/src/plugins/analyzerbase/analyzerplugin.cpp
@@ -47,7 +47,6 @@
 
 #include <QtPlugin>
 #include <QMessageBox>
-#include <QMainWindow>
 #include <QApplication>
 
 using namespace Analyzer;
diff --git a/src/plugins/bineditor/bineditorplugin.cpp b/src/plugins/bineditor/bineditorplugin.cpp
index c9f9b0d0e3b0f64f06b2275ab8baab638592f153..c67c19574f91650cf3428f32ceeb9360d8a16124 100644
--- a/src/plugins/bineditor/bineditorplugin.cpp
+++ b/src/plugins/bineditor/bineditorplugin.cpp
@@ -44,7 +44,6 @@
 
 #include <QMenu>
 #include <QAction>
-#include <QMainWindow>
 #include <QMessageBox>
 #include <QHBoxLayout>
 #include <QLineEdit>
diff --git a/src/plugins/cmakeprojectmanager/cmakeproject.cpp b/src/plugins/cmakeprojectmanager/cmakeproject.cpp
index 16ef4f6c227fde70de69ec59601ad35fc28787f9..0b148969ee98363dc5975b63a91a98501e364fe3 100644
--- a/src/plugins/cmakeprojectmanager/cmakeproject.cpp
+++ b/src/plugins/cmakeprojectmanager/cmakeproject.cpp
@@ -63,7 +63,6 @@
 #include <QDateTime>
 #include <QProcess>
 #include <QFormLayout>
-#include <QMainWindow>
 #include <QInputDialog>
 #include <QFileSystemWatcher>
 
diff --git a/src/plugins/coreplugin/actionmanager/command.cpp b/src/plugins/coreplugin/actionmanager/command.cpp
index 6647b24936f09d3349c8dcc452e5c97c82ac3db6..b320e43dced20d0320b41600b6b6f3982b125b45 100644
--- a/src/plugins/coreplugin/actionmanager/command.cpp
+++ b/src/plugins/coreplugin/actionmanager/command.cpp
@@ -39,7 +39,6 @@
 
 #include <QAction>
 #include <QShortcut>
-#include <QMainWindow>
 
 /*!
     \class Core::Command
diff --git a/src/plugins/coreplugin/basefilewizard.cpp b/src/plugins/coreplugin/basefilewizard.cpp
index fc3806b62a3514a1c44093da7905e2c7feefd172..d7a8eaaf1aaaf511b9e408589482d4652f8c82b2 100644
--- a/src/plugins/coreplugin/basefilewizard.cpp
+++ b/src/plugins/coreplugin/basefilewizard.cpp
@@ -54,7 +54,6 @@
 
 #include <QMessageBox>
 #include <QWizard>
-#include <QMainWindow>
 #include <QIcon>
 
 enum { debugWizard = 0 };
diff --git a/src/plugins/coreplugin/editormanager/editormanager.cpp b/src/plugins/coreplugin/editormanager/editormanager.cpp
index bd49704cfa8e783a7d698307aac9895f976328a3..54762d9bc5a1ed9008993c6e14462da679422f86 100644
--- a/src/plugins/coreplugin/editormanager/editormanager.cpp
+++ b/src/plugins/coreplugin/editormanager/editormanager.cpp
@@ -78,7 +78,6 @@
 #include <QApplication>
 #include <QFileDialog>
 #include <QLayout>
-#include <QMainWindow>
 #include <QMenu>
 #include <QMessageBox>
 #include <QPushButton>
diff --git a/src/plugins/coreplugin/generalsettings.cpp b/src/plugins/coreplugin/generalsettings.cpp
index a11e08c6ccc39250d6ece375c0bffc35e4838be4..a6ab371b2b34f2a004c156f99653d97a06b02151 100644
--- a/src/plugins/coreplugin/generalsettings.cpp
+++ b/src/plugins/coreplugin/generalsettings.cpp
@@ -38,7 +38,6 @@
 #include <coreplugin/editormanager/editormanager.h>
 #include <coreplugin/icore.h>
 
-#include <QMainWindow>
 #include <QMessageBox>
 
 #include <QCoreApplication>
diff --git a/src/plugins/coreplugin/icore.cpp b/src/plugins/coreplugin/icore.cpp
index bd1a39f640e0ba28a784a7a7c760c603ff8a308f..b9ad7f93015103ab4953d845026d8bbc87549e2e 100644
--- a/src/plugins/coreplugin/icore.cpp
+++ b/src/plugins/coreplugin/icore.cpp
@@ -513,7 +513,7 @@ IContext *ICore::currentContextObject()
 }
 
 
-QMainWindow *ICore::mainWindow()
+QWidget *ICore::mainWindow()
 {
     return m_mainwindow;
 }
diff --git a/src/plugins/coreplugin/icore.h b/src/plugins/coreplugin/icore.h
index cc8eba960a9ff4c00ba7e5f8bef4fa8bf2bb83ed..a954b6f76a1b93896f1f87b0f828281b2ea2e085 100644
--- a/src/plugins/coreplugin/icore.h
+++ b/src/plugins/coreplugin/icore.h
@@ -37,9 +37,9 @@
 #include <QSettings>
 
 QT_BEGIN_NAMESPACE
-class QMainWindow;
 class QPrinter;
 class QStatusBar;
+class QWidget;
 template <class T> class QList;
 QT_END_NAMESPACE
 
@@ -112,7 +112,7 @@ public:
     static QString resourcePath();
     static QString userResourcePath();
 
-    static QMainWindow *mainWindow();
+    static QWidget *mainWindow();
     static QStatusBar *statusBar();
 
     static IContext *currentContextObject();
diff --git a/src/plugins/coreplugin/manhattanstyle.cpp b/src/plugins/coreplugin/manhattanstyle.cpp
index e06de7700597600b7cd2037b8cb5be14c870d498..fd32959e97cfe60bb2386644256c69690362101a 100644
--- a/src/plugins/coreplugin/manhattanstyle.cpp
+++ b/src/plugins/coreplugin/manhattanstyle.cpp
@@ -47,7 +47,6 @@
 #include <QDockWidget>
 #include <QLabel>
 #include <QLineEdit>
-#include <QMainWindow>
 #include <QMenuBar>
 #include <QPainter>
 #include <QPixmap>
diff --git a/src/plugins/cpaster/cpasterplugin.cpp b/src/plugins/cpaster/cpasterplugin.cpp
index 65a01b58b6e4af6444fab91f4db097f8107cedfa..54efe98e7fa36c514d47a7c6be5e16b1f66ef2a9 100644
--- a/src/plugins/cpaster/cpasterplugin.cpp
+++ b/src/plugins/cpaster/cpasterplugin.cpp
@@ -64,7 +64,6 @@
 #include <QApplication>
 #include <QClipboard>
 #include <QMenu>
-#include <QMainWindow>
 #include <QInputDialog>
 #include <QUrl>
 
diff --git a/src/plugins/cpaster/protocol.cpp b/src/plugins/cpaster/protocol.cpp
index 306665142e1492fe5a47d4796073d970ec0c00ef..49a3fa2a087dcad120af799833c544d37be023d9 100644
--- a/src/plugins/cpaster/protocol.cpp
+++ b/src/plugins/cpaster/protocol.cpp
@@ -48,7 +48,6 @@
 
 #include <QMessageBox>
 #include <QApplication>
-#include <QMainWindow>
 #include <QPushButton>
 
 namespace CodePaster {
diff --git a/src/plugins/cppeditor/cppeditor.cpp b/src/plugins/cppeditor/cppeditor.cpp
index 17b17894ef60d1381fa74d66ce5c40ae7a628491..7f98f0842f12bc90b73b0a8425e0340e2fba37f1 100644
--- a/src/plugins/cppeditor/cppeditor.cpp
+++ b/src/plugins/cppeditor/cppeditor.cpp
@@ -112,7 +112,6 @@
 #include <QToolBar>
 #include <QTreeView>
 #include <QSortFilterProxyModel>
-#include <QMainWindow>
 
 #include <sstream>
 
diff --git a/src/plugins/debugger/debuggertooltipmanager.cpp b/src/plugins/debugger/debuggertooltipmanager.cpp
index 34719e67d400af6f0493279abd2d198e1f925768..fcdf0882c816a3ee6d8b1a32698d4add131373ad 100644
--- a/src/plugins/debugger/debuggertooltipmanager.cpp
+++ b/src/plugins/debugger/debuggertooltipmanager.cpp
@@ -56,7 +56,6 @@
 #include <QStyle>
 #include <QIcon>
 #include <QApplication>
-#include <QMainWindow>
 #include <QMoveEvent>
 #include <QDesktopWidget>
 #include <QScrollBar>
diff --git a/src/plugins/debugger/gdb/gdbengine.cpp b/src/plugins/debugger/gdb/gdbengine.cpp
index c986d2ea8ffffaf9e5543ccb40a9e626b96ca3dc..4bcecc8c462bf20811ee8c1922dbeadcb700b08c 100644
--- a/src/plugins/debugger/gdb/gdbengine.cpp
+++ b/src/plugins/debugger/gdb/gdbengine.cpp
@@ -95,7 +95,6 @@
 #include <QAction>
 #include <QDialogButtonBox>
 #include <QLabel>
-#include <QMainWindow>
 #include <QMessageBox>
 #include <QPushButton>
 
diff --git a/src/plugins/debugger/memoryagent.cpp b/src/plugins/debugger/memoryagent.cpp
index 0043c18612b5da87aea36dba939c952ad5860d11..0b55844bae183affd6269a0f5b6edb4cab3e7e43 100644
--- a/src/plugins/debugger/memoryagent.cpp
+++ b/src/plugins/debugger/memoryagent.cpp
@@ -47,7 +47,6 @@
 #include <extensionsystem/invoker.h>
 
 #include <QMessageBox>
-#include <QMainWindow>
 #include <QVBoxLayout>
 
 #include <cstring>
diff --git a/src/plugins/debugger/qml/qmlcppengine.cpp b/src/plugins/debugger/qml/qmlcppengine.cpp
index 72433ed264bc6741ed00ae172048be26700578a4..cba83a2e439116e9c81e68bef58dc0b6077e97de 100644
--- a/src/plugins/debugger/qml/qmlcppengine.cpp
+++ b/src/plugins/debugger/qml/qmlcppengine.cpp
@@ -44,7 +44,6 @@
 #include <cppeditor/cppeditorconstants.h>
 
 #include <QTimer>
-#include <QMainWindow>
 
 namespace Debugger {
 namespace Internal {
diff --git a/src/plugins/debugger/qml/qmlengine.cpp b/src/plugins/debugger/qml/qmlengine.cpp
index 6ab15d7f286198e359efa965c5bfcaf92a3abd51..8c68ecc80501d88bcc97f9853da225a2882d523a 100644
--- a/src/plugins/debugger/qml/qmlengine.cpp
+++ b/src/plugins/debugger/qml/qmlengine.cpp
@@ -76,7 +76,6 @@
 
 #include <QAction>
 #include <QApplication>
-#include <QMainWindow>
 #include <QMessageBox>
 #include <QPlainTextEdit>
 #include <QToolTip>
diff --git a/src/plugins/debugger/shared/cdbsymbolpathlisteditor.cpp b/src/plugins/debugger/shared/cdbsymbolpathlisteditor.cpp
index df48e5451748baab0c08ecac711f1ca003a868aa..badcf37c119b00dec144a2da1f5bc601405e4473 100644
--- a/src/plugins/debugger/shared/cdbsymbolpathlisteditor.cpp
+++ b/src/plugins/debugger/shared/cdbsymbolpathlisteditor.cpp
@@ -43,7 +43,6 @@
 #include <QVBoxLayout>
 #include <QFormLayout>
 #include <QMessageBox>
-#include <QMainWindow>
 
 namespace Debugger {
 namespace Internal {
diff --git a/src/plugins/designer/formeditorw.cpp b/src/plugins/designer/formeditorw.cpp
index 1be3ca705dc75d45cd2410b96bfe1b04715b8ff6..57aa038ce2deb2423461139fc9135b835eae3099 100644
--- a/src/plugins/designer/formeditorw.cpp
+++ b/src/plugins/designer/formeditorw.cpp
@@ -85,7 +85,6 @@
 #include <QCursor>
 #include <QDockWidget>
 #include <QMenu>
-#include <QMainWindow>
 #include <QMessageBox>
 #include <QKeySequence>
 #include <QPrintDialog>
diff --git a/src/plugins/designer/formwindowfile.cpp b/src/plugins/designer/formwindowfile.cpp
index ecaf5ccdaef533be3e0aed68a33047b9084fd092..478de27409ad31d61119af3579d0dac818a21f26 100644
--- a/src/plugins/designer/formwindowfile.cpp
+++ b/src/plugins/designer/formwindowfile.cpp
@@ -44,7 +44,6 @@
 #endif
 
 #include <QMessageBox>
-#include <QMainWindow>
 #include <QUndoStack>
 
 #include <QFile>
diff --git a/src/plugins/find/findtoolwindow.cpp b/src/plugins/find/findtoolwindow.cpp
index e78eef309d70bdaee5384fa2093e07f54ce55e2a..60e2f9e8dac1bb5ed8b66c0e844296d5b1c2461f 100644
--- a/src/plugins/find/findtoolwindow.cpp
+++ b/src/plugins/find/findtoolwindow.cpp
@@ -34,7 +34,6 @@
 #include <coreplugin/icore.h>
 
 #include <QSettings>
-#include <QMainWindow>
 #include <QStringListModel>
 #include <QCompleter>
 #include <QKeyEvent>
diff --git a/src/plugins/genericprojectmanager/genericproject.cpp b/src/plugins/genericprojectmanager/genericproject.cpp
index 9ec185c5cc5b1c72e9afb7645197306e5e29854c..caeead1f8ad17493b683fc0452b07d595a4e3cdd 100644
--- a/src/plugins/genericprojectmanager/genericproject.cpp
+++ b/src/plugins/genericprojectmanager/genericproject.cpp
@@ -54,7 +54,6 @@
 #include <QDir>
 #include <QProcessEnvironment>
 
-#include <QMainWindow>
 #include <QComboBox>
 
 using namespace GenericProjectManager;
diff --git a/src/plugins/genericprojectmanager/genericprojectplugin.cpp b/src/plugins/genericprojectmanager/genericprojectplugin.cpp
index 9b991befc09c0024317421cb5ea275df3a05d655..0c3e5c94aecf08463efbb456460c7d6afc8edc96 100644
--- a/src/plugins/genericprojectmanager/genericprojectplugin.cpp
+++ b/src/plugins/genericprojectmanager/genericprojectplugin.cpp
@@ -54,7 +54,6 @@
 #include <QDebug>
 
 #include <QTreeView>
-#include <QMainWindow>
 
 using namespace GenericProjectManager;
 using namespace GenericProjectManager::Internal;
diff --git a/src/plugins/git/gerrit/gerritplugin.cpp b/src/plugins/git/gerrit/gerritplugin.cpp
index 39df21ad9b77bfbc8cf09e15a604b5faf8037863..8105e4528c2485f470e7222a9f1a7b092300b1d7 100644
--- a/src/plugins/git/gerrit/gerritplugin.cpp
+++ b/src/plugins/git/gerrit/gerritplugin.cpp
@@ -59,7 +59,6 @@
 #include <QDebug>
 #include <QProcess>
 #include <QRegExp>
-#include <QMainWindow>
 #include <QAction>
 #include <QFileDialog>
 #include <QTemporaryFile>
diff --git a/src/plugins/git/gitclient.cpp b/src/plugins/git/gitclient.cpp
index 84d8f66aa5b8460e91b073368fb8daa3566c51e9..ca785e344867d785b592b63dc2e852ea0e8ec4f4 100644
--- a/src/plugins/git/gitclient.cpp
+++ b/src/plugins/git/gitclient.cpp
@@ -71,7 +71,6 @@
 #include <QSignalMapper>
 
 #include <QComboBox>
-#include <QMainWindow> // for msg box parent
 #include <QMessageBox>
 #include <QToolButton>
 #include <QTextCodec>
diff --git a/src/plugins/git/gitplugin.cpp b/src/plugins/git/gitplugin.cpp
index a4a239199fc644db2f0cc885510ff2949c73a3e8..53797b5ad9414aacc71fbbb1bf7124a70eb8cbef 100644
--- a/src/plugins/git/gitplugin.cpp
+++ b/src/plugins/git/gitplugin.cpp
@@ -79,7 +79,6 @@
 
 #include <QAction>
 #include <QFileDialog>
-#include <QMainWindow>
 #include <QMenu>
 #include <QMessageBox>
 
diff --git a/src/plugins/glsleditor/glsleditor.cpp b/src/plugins/glsleditor/glsleditor.cpp
index c7e1ea22811f4e4b47ccf4a94eca0cab7992e922..fc2b0669ef95549e73b8db48f318421728b90129 100644
--- a/src/plugins/glsleditor/glsleditor.cpp
+++ b/src/plugins/glsleditor/glsleditor.cpp
@@ -72,7 +72,6 @@
 #include <QComboBox>
 #include <QHeaderView>
 #include <QInputDialog>
-#include <QMainWindow>
 #include <QToolBar>
 #include <QTreeView>
 
diff --git a/src/plugins/glsleditor/glsleditoractionhandler.cpp b/src/plugins/glsleditor/glsleditoractionhandler.cpp
index 56c2f0b4b190d2a90a564a71d23d820ff185cca2..80edcf0e7cf47842ec72c4eb31893897d37ff5bc 100644
--- a/src/plugins/glsleditor/glsleditoractionhandler.cpp
+++ b/src/plugins/glsleditor/glsleditoractionhandler.cpp
@@ -37,7 +37,6 @@
 
 #include <QDebug>
 #include <QAction>
-#include <QMainWindow>
 #include <QMessageBox>
 
 namespace GLSLEditor {
diff --git a/src/plugins/glsleditor/glsleditorfactory.cpp b/src/plugins/glsleditor/glsleditorfactory.cpp
index 6c4d9174dfea8629d30a1197c8a54c9c36cc1881..048fcbc2d85c7cbd608f2f025a1cc4947bbb79cd 100644
--- a/src/plugins/glsleditor/glsleditorfactory.cpp
+++ b/src/plugins/glsleditor/glsleditorfactory.cpp
@@ -47,7 +47,6 @@
 #include <QSettings>
 #include <QMessageBox>
 #include <QPushButton>
-#include <QMainWindow>
 
 using namespace GLSLEditor::Internal;
 using namespace GLSLEditor::Constants;
diff --git a/src/plugins/help/helpviewer.cpp b/src/plugins/help/helpviewer.cpp
index 1e89faffcc658e01544e3ad575b223ffbde3cb77..2abffba55c5bdf21b098cbaa63b4e51f996c61a8 100644
--- a/src/plugins/help/helpviewer.cpp
+++ b/src/plugins/help/helpviewer.cpp
@@ -43,7 +43,6 @@
 
 #include <QApplication>
 #include <QDesktopServices>
-#include <QMainWindow>
 #include <QMouseEvent>
 
 #include <QHelpEngine>
diff --git a/src/plugins/macros/macromanager.cpp b/src/plugins/macros/macromanager.cpp
index 6cf09f54c9caef214e11ed72e1d956a4d814edf2..dcc19369d7747778c5a23d2c0d19fdf15d5f433a 100644
--- a/src/plugins/macros/macromanager.cpp
+++ b/src/plugins/macros/macromanager.cpp
@@ -59,7 +59,6 @@
 #include <QList>
 
 #include <QShortcut>
-#include <QMainWindow>
 #include <QAction>
 #include <QFileDialog>
 #include <QMessageBox>
@@ -228,7 +227,7 @@ bool MacroManager::MacroManagerPrivate::executeMacro(Macro *macro)
 
 void MacroManager::MacroManagerPrivate::showSaveDialog()
 {
-    QMainWindow *mainWindow = Core::ICore::mainWindow();
+    QWidget *mainWindow = Core::ICore::mainWindow();
     SaveDialog dialog(mainWindow);
     if (dialog.exec()) {
         if (dialog.name().isEmpty())
diff --git a/src/plugins/mercurial/mercurialplugin.cpp b/src/plugins/mercurial/mercurialplugin.cpp
index b99026871eb0bfa3601af890f3f8d057467b040a..5eda4132c344ef4cf482c13c2a37ebaac5dfd4ce 100644
--- a/src/plugins/mercurial/mercurialplugin.cpp
+++ b/src/plugins/mercurial/mercurialplugin.cpp
@@ -63,7 +63,6 @@
 #include <QtPlugin>
 #include <QAction>
 #include <QMenu>
-#include <QMainWindow>
 #include <QtDebug>
 #include <QtGlobal>
 #include <QDir>
diff --git a/src/plugins/projectexplorer/buildmanager.cpp b/src/plugins/projectexplorer/buildmanager.cpp
index 1971773460bb5dd4d8274e722e5e085a9f936528..0b88954d24d2d25d012747abd56a9f52bd3849cb 100644
--- a/src/plugins/projectexplorer/buildmanager.cpp
+++ b/src/plugins/projectexplorer/buildmanager.cpp
@@ -59,7 +59,6 @@
 #include <utils/QtConcurrentTools>
 
 #include <QApplication>
-#include <QMainWindow>
 
 static inline QString msgProgress(int progress, int total)
 {
diff --git a/src/plugins/projectexplorer/buildstepspage.cpp b/src/plugins/projectexplorer/buildstepspage.cpp
index 28dfbc4cc83eae29e378d6de0ebb37c0e20bc4dd..e450f58981a5ac9160a4af4cf6e534de40cd5ceb 100644
--- a/src/plugins/projectexplorer/buildstepspage.cpp
+++ b/src/plugins/projectexplorer/buildstepspage.cpp
@@ -50,7 +50,6 @@
 #include <QHBoxLayout>
 #include <QToolButton>
 #include <QMessageBox>
-#include <QMainWindow>
 #include <QGraphicsOpacityEffect>
 
 using namespace ProjectExplorer;
diff --git a/src/plugins/projectexplorer/devicesupport/devicemanager.cpp b/src/plugins/projectexplorer/devicesupport/devicemanager.cpp
index da5ad0f0efeb08ad92b9553ca7565b3e212460a3..d9efc0bf1dcd794507d7dad684f153ccdb6dba3a 100644
--- a/src/plugins/projectexplorer/devicesupport/devicemanager.cpp
+++ b/src/plugins/projectexplorer/devicesupport/devicemanager.cpp
@@ -40,7 +40,6 @@
 #include <QFileInfo>
 #include <QHash>
 #include <QList>
-#include <QMainWindow>
 #include <QSettings>
 #include <QString>
 #include <QVariantHash>
diff --git a/src/plugins/projectexplorer/miniprojecttargetselector.cpp b/src/plugins/projectexplorer/miniprojecttargetselector.cpp
index 6f7a5599247b3db9bf113117e90d22c2dc43e004..cb50d71a609afc108f32912534c0634faf1ab258 100644
--- a/src/plugins/projectexplorer/miniprojecttargetselector.cpp
+++ b/src/plugins/projectexplorer/miniprojecttargetselector.cpp
@@ -58,7 +58,6 @@
 #include <QPainter>
 #include <QAction>
 #include <QItemDelegate>
-#include <QMainWindow>
 #include <QApplication>
 
 static QIcon createCenteredIcon(const QIcon &icon, const QIcon &overlay)
diff --git a/src/plugins/projectexplorer/pluginfilefactory.cpp b/src/plugins/projectexplorer/pluginfilefactory.cpp
index 815cb6ae22c29e83c9e99e02157e5cfc2c37eb12..99bca766a7b8173313587003ebf428d92e5287f2 100644
--- a/src/plugins/projectexplorer/pluginfilefactory.cpp
+++ b/src/plugins/projectexplorer/pluginfilefactory.cpp
@@ -43,7 +43,6 @@
 
 #include <QDebug>
 #include <QMessageBox>
-#include <QMainWindow>
 
 using namespace ProjectExplorer;
 using namespace ProjectExplorer::Internal;
diff --git a/src/plugins/projectexplorer/profilemanager.cpp b/src/plugins/projectexplorer/profilemanager.cpp
index c93a6b292cd8aba3789c08a7ed59886c34c9f074..dcfe0e9bfc242234506432697474084b3c03f476 100644
--- a/src/plugins/projectexplorer/profilemanager.cpp
+++ b/src/plugins/projectexplorer/profilemanager.cpp
@@ -49,7 +49,6 @@
 
 #include <QFormLayout>
 #include <QLabel>
-#include <QMainWindow>
 
 static const char PROFILE_DATA_KEY[] = "Profile.";
 static const char PROFILE_COUNT_KEY[] = "Profile.Count";
diff --git a/src/plugins/projectexplorer/projectexplorer.cpp b/src/plugins/projectexplorer/projectexplorer.cpp
index 69aa361003f8b5a0c72f65cf5da93db612bc9a71..9bb2f22cedad4cb161602dba6b74ef8ea9d0072e 100644
--- a/src/plugins/projectexplorer/projectexplorer.cpp
+++ b/src/plugins/projectexplorer/projectexplorer.cpp
@@ -130,7 +130,6 @@
 #include <QFileDialog>
 #include <QMenu>
 #include <QMessageBox>
-#include <QMainWindow>
 #include <QWizard>
 
 /*!
diff --git a/src/plugins/projectexplorer/runconfiguration.cpp b/src/plugins/projectexplorer/runconfiguration.cpp
index 3ff4d599cded83ba7cbb36dee6d4b7ecc9c07564..87ae827ddf5b9725b7a2b1eb39fcee7e53520e22 100644
--- a/src/plugins/projectexplorer/runconfiguration.cpp
+++ b/src/plugins/projectexplorer/runconfiguration.cpp
@@ -47,7 +47,6 @@
 
 #include <QTimer>
 #include <QSettings>
-#include <QMainWindow>
 #include <QMessageBox>
 #include <QPushButton>
 
diff --git a/src/plugins/projectexplorer/session.cpp b/src/plugins/projectexplorer/session.cpp
index 88891fd817ead729196eb6ec28ff6235e0421eae..c59de13b2d9e062c6eebbe378196e28fde379695 100644
--- a/src/plugins/projectexplorer/session.cpp
+++ b/src/plugins/projectexplorer/session.cpp
@@ -59,7 +59,6 @@
 #include <QTimer>
 
 #include <QApplication>
-#include <QMainWindow>
 #include <QMessageBox>
 #include <QPushButton>
 #include <QTextCodec>
diff --git a/src/plugins/projectexplorer/settingsaccessor.cpp b/src/plugins/projectexplorer/settingsaccessor.cpp
index 858efbe08c0bd0a7e8ae935268f3843dcc5f19c6..d6a3bb4ace620646966fd4715cb973a1a3252095 100644
--- a/src/plugins/projectexplorer/settingsaccessor.cpp
+++ b/src/plugins/projectexplorer/settingsaccessor.cpp
@@ -50,7 +50,6 @@
 #include <QApplication>
 #include <QDebug>
 #include <QFile>
-#include <QMainWindow>
 #include <QMessageBox>
 
 namespace ProjectExplorer {
diff --git a/src/plugins/projectexplorer/toolchainmanager.cpp b/src/plugins/projectexplorer/toolchainmanager.cpp
index fde724465ce5e60f0b14a4afbe929ccacecd410a..2b86f2f05100e15f63639b63d5d9bd71935e884d 100644
--- a/src/plugins/projectexplorer/toolchainmanager.cpp
+++ b/src/plugins/projectexplorer/toolchainmanager.cpp
@@ -43,7 +43,6 @@
 #include <QCoreApplication>
 #include <QDir>
 #include <QSettings>
-#include <QMainWindow>
 
 static const char TOOLCHAIN_DATA_KEY[] = "ToolChain.";
 static const char TOOLCHAIN_COUNT_KEY[] = "ToolChain.Count";
diff --git a/src/plugins/qmljseditor/qmljscomponentfromobjectdef.cpp b/src/plugins/qmljseditor/qmljscomponentfromobjectdef.cpp
index 59211da793f4434207eb60eb1660789741394b59..e28e6f681939311c7ec8655641013b1dfc99fd02 100644
--- a/src/plugins/qmljseditor/qmljscomponentfromobjectdef.cpp
+++ b/src/plugins/qmljseditor/qmljscomponentfromobjectdef.cpp
@@ -45,7 +45,6 @@
 #include <QCoreApplication>
 #include <QDir>
 #include <QFileInfo>
-#include <QMainWindow>
 #include <QMessageBox>
 
 using namespace QmlJS::AST;
diff --git a/src/plugins/qmljseditor/qmljseditor.cpp b/src/plugins/qmljseditor/qmljseditor.cpp
index bbe5d9d8f033fe3bbdf0d7b2613853c5b288b1b6..628d97d4bb561678e3f92b8c86b749e4fdd2e783 100644
--- a/src/plugins/qmljseditor/qmljseditor.cpp
+++ b/src/plugins/qmljseditor/qmljseditor.cpp
@@ -85,7 +85,6 @@
 #include <QComboBox>
 #include <QHeaderView>
 #include <QInputDialog>
-#include <QMainWindow>
 #include <QToolBar>
 #include <QTreeView>
 
diff --git a/src/plugins/qmljseditor/qmljseditoractionhandler.cpp b/src/plugins/qmljseditor/qmljseditoractionhandler.cpp
index 9938a28f55c5739a5717ed5a951188a183fdb646..09fae4e7b71b9fe1d205bf62f3a300c0ac05ee6f 100644
--- a/src/plugins/qmljseditor/qmljseditoractionhandler.cpp
+++ b/src/plugins/qmljseditor/qmljseditoractionhandler.cpp
@@ -37,7 +37,6 @@
 
 #include <QDebug>
 #include <QAction>
-#include <QMainWindow>
 #include <QMessageBox>
 
 namespace QmlJSEditor {
diff --git a/src/plugins/qmljseditor/qmljseditorfactory.cpp b/src/plugins/qmljseditor/qmljseditorfactory.cpp
index 412546c968abb5318064263699109add3f70098b..9454420660c12f516dd61946d1240db71ee3a939 100644
--- a/src/plugins/qmljseditor/qmljseditorfactory.cpp
+++ b/src/plugins/qmljseditor/qmljseditorfactory.cpp
@@ -50,7 +50,6 @@
 #include <QSettings>
 #include <QMessageBox>
 #include <QPushButton>
-#include <QMainWindow>
 
 using namespace QmlJSEditor;
 using namespace QmlJSEditor::Internal;
diff --git a/src/plugins/qt4projectmanager/qt-s60/codaruncontrol.cpp b/src/plugins/qt4projectmanager/qt-s60/codaruncontrol.cpp
index d99b6fa2a68360b22f88ffe06feca39f84081389..469d947de8a6821de76213cd1f4deeeb4aa6dc83 100644
--- a/src/plugins/qt4projectmanager/qt-s60/codaruncontrol.cpp
+++ b/src/plugins/qt4projectmanager/qt-s60/codaruncontrol.cpp
@@ -52,7 +52,6 @@
 #include <QTimer>
 
 #include <QMessageBox>
-#include <QMainWindow>
 
 #include <QTcpSocket>
 
diff --git a/src/plugins/qt4projectmanager/qt-s60/s60deploystep.cpp b/src/plugins/qt4projectmanager/qt-s60/s60deploystep.cpp
index f254ad8199bb3bf51aa2ba743d41121ec93f14cb..71b41259524f9fe707bdb90e8e9cf324f21a6415 100644
--- a/src/plugins/qt4projectmanager/qt-s60/s60deploystep.cpp
+++ b/src/plugins/qt4projectmanager/qt-s60/s60deploystep.cpp
@@ -50,7 +50,6 @@
 #include <utils/qtcassert.h>
 
 #include <QMessageBox>
-#include <QMainWindow>
 
 #include <QTimer>
 #include <QDateTime>
diff --git a/src/plugins/qt4projectmanager/qt-s60/s60manager.cpp b/src/plugins/qt4projectmanager/qt-s60/s60manager.cpp
index ec727066534bb51d29a239c18037ebd9799201c2..18a065a4205b8125b57d50795e01a888fdd0b002 100644
--- a/src/plugins/qt4projectmanager/qt-s60/s60manager.cpp
+++ b/src/plugins/qt4projectmanager/qt-s60/s60manager.cpp
@@ -56,8 +56,6 @@
 #include <debugger/debuggerconstants.h>
 #include <utils/qtcassert.h>
 
-#include <QMainWindow>
-
 #include <QDir>
 
 namespace Qt4ProjectManager {
diff --git a/src/plugins/qt4projectmanager/qt4nodes.cpp b/src/plugins/qt4projectmanager/qt4nodes.cpp
index 6ee827d622495a671789f048518f61451d1810ef..2959f928d4980c6a5371ca08959ce3c30bfe12fa 100644
--- a/src/plugins/qt4projectmanager/qt4nodes.cpp
+++ b/src/plugins/qt4projectmanager/qt4nodes.cpp
@@ -72,7 +72,6 @@
 #include <QXmlStreamReader>
 
 #include <QPainter>
-#include <QMainWindow>
 #include <QMessageBox>
 #include <QPushButton>
 #include <utils/QtConcurrentTools>
diff --git a/src/plugins/qtsupport/customexecutablerunconfiguration.cpp b/src/plugins/qtsupport/customexecutablerunconfiguration.cpp
index bcb5354ebc9b3c41976d2c5004f7e2453039eff1..efb3a7a0b1cbf12b71169805e767c405b010cf64 100644
--- a/src/plugins/qtsupport/customexecutablerunconfiguration.cpp
+++ b/src/plugins/qtsupport/customexecutablerunconfiguration.cpp
@@ -46,7 +46,6 @@
 #include <QDialog>
 #include <QDialogButtonBox>
 #include <QLabel>
-#include <QMainWindow>
 #include <QVBoxLayout>
 
 #include <QDir>
diff --git a/src/plugins/qtsupport/gettingstartedwelcomepage.cpp b/src/plugins/qtsupport/gettingstartedwelcomepage.cpp
index a22d7abbb8597a154ee5d2d397d50230398b2e27..34f1c821b48158732710136153b480dcc8409d72 100644
--- a/src/plugins/qtsupport/gettingstartedwelcomepage.cpp
+++ b/src/plugins/qtsupport/gettingstartedwelcomepage.cpp
@@ -67,7 +67,6 @@
 #include <QPushButton>
 #include <QMessageBox>
 #include <QApplication>
-#include <QMainWindow>
 #include <QDeclarativeImageProvider>
 #include <QDeclarativeEngine>
 #include <QDeclarativeContext>
diff --git a/src/plugins/qtsupport/qtoptionspage.cpp b/src/plugins/qtsupport/qtoptionspage.cpp
index d4d2b3ca95b2299b7d923114d9ba6dcfd7553872..803de478cb627240477c8501241e88d0262c5e20 100644
--- a/src/plugins/qtsupport/qtoptionspage.cpp
+++ b/src/plugins/qtsupport/qtoptionspage.cpp
@@ -55,7 +55,6 @@
 #include <QToolTip>
 #include <QMessageBox>
 #include <QFileDialog>
-#include <QMainWindow>
 #include <QTextBrowser>
 #include <QDesktopServices>
 
diff --git a/src/plugins/qtsupport/qtversionmanager.cpp b/src/plugins/qtsupport/qtversionmanager.cpp
index 6a14bead2150fddada466e8ae730f69d96d41660..94bcd5b91a390747c815e06c8a3308bf3a9a5bc4 100644
--- a/src/plugins/qtsupport/qtversionmanager.cpp
+++ b/src/plugins/qtsupport/qtversionmanager.cpp
@@ -58,7 +58,6 @@
 #include <QDebug>
 #include <QDir>
 #include <QFile>
-#include <QMainWindow>
 #include <QSettings>
 #include <QTextStream>
 #include <QTimer>
diff --git a/src/plugins/remotelinux/deploymentsettingsassistant.cpp b/src/plugins/remotelinux/deploymentsettingsassistant.cpp
index 76b50d7924f578a16b06ae03557193455d4ade03..d8518cd37698e80f0eab90e4aad122f57a22fa82 100644
--- a/src/plugins/remotelinux/deploymentsettingsassistant.cpp
+++ b/src/plugins/remotelinux/deploymentsettingsassistant.cpp
@@ -45,7 +45,6 @@
 #include <QDir>
 #include <QHash>
 #include <QString>
-#include <QMainWindow>
 
 using namespace Qt4ProjectManager;
 
diff --git a/src/plugins/remotelinux/publickeydeploymentdialog.cpp b/src/plugins/remotelinux/publickeydeploymentdialog.cpp
index 0818278feda5032b508f374e9bca029e0dc07a74..26ab6af0ecd01bf8f320fbc700f2de47bba286f1 100644
--- a/src/plugins/remotelinux/publickeydeploymentdialog.cpp
+++ b/src/plugins/remotelinux/publickeydeploymentdialog.cpp
@@ -36,7 +36,6 @@
 
 #include <QTimer>
 #include <QFileDialog>
-#include <QMainWindow>
 
 namespace RemoteLinux {
 namespace Internal {
diff --git a/src/plugins/resourceeditor/resourceeditorw.cpp b/src/plugins/resourceeditor/resourceeditorw.cpp
index 8e310cfc8f1f4fff138f3d5dbcb007285c90e8ce..b5941722971b2961dbe671f22fce59e1917a6e81 100644
--- a/src/plugins/resourceeditor/resourceeditorw.cpp
+++ b/src/plugins/resourceeditor/resourceeditorw.cpp
@@ -49,7 +49,6 @@
 #include <QDir>
 #include <qdebug.h>
 #include <QHBoxLayout>
-#include <QMainWindow>
 #include <QMenu>
 #include <QToolBar>
 #include <QInputDialog>
diff --git a/src/plugins/subversion/subversionplugin.cpp b/src/plugins/subversion/subversionplugin.cpp
index b792a042ab76ed5b21e8730d1c91426667d2236d..942ad7fb14bf4c7bf61ee4a56ef86fbe4ba59591 100644
--- a/src/plugins/subversion/subversionplugin.cpp
+++ b/src/plugins/subversion/subversionplugin.cpp
@@ -73,7 +73,6 @@
 #include <QXmlStreamReader>
 #include <QAction>
 #include <QFileDialog>
-#include <QMainWindow>
 #include <QMenu>
 #include <QMessageBox>
 #include <QInputDialog>
diff --git a/src/plugins/tasklist/taskfilefactory.cpp b/src/plugins/tasklist/taskfilefactory.cpp
index 473976b0226a07d286da4590ecdbbbe6f38402f5..d83f0de2ed3daf232b8e293c9e25b2352cf71f3e 100644
--- a/src/plugins/tasklist/taskfilefactory.cpp
+++ b/src/plugins/tasklist/taskfilefactory.cpp
@@ -37,7 +37,6 @@
 #include <coreplugin/id.h>
 #include <coreplugin/documentmanager.h>
 
-#include <QMainWindow>
 #include <QMessageBox>
 
 using namespace TaskList::Internal;
diff --git a/src/plugins/texteditor/basefilefind.cpp b/src/plugins/texteditor/basefilefind.cpp
index ef522ad1a9db12f55f6d5db950e1a7be6276b026..129e71887a49692444edbf34574b08f29b4ec260 100644
--- a/src/plugins/texteditor/basefilefind.cpp
+++ b/src/plugins/texteditor/basefilefind.cpp
@@ -56,7 +56,6 @@
 #include <QComboBox>
 #include <QHBoxLayout>
 #include <QLabel>
-#include <QMainWindow>
 #include <QPushButton>
 #include <QTextBlock>
 
diff --git a/src/plugins/texteditor/basetextdocument.cpp b/src/plugins/texteditor/basetextdocument.cpp
index 1fd9f00066ae91e6acf13b0314bb4a44d91e6978..923b9a889468589732f1090dac6e44d7459a036e 100644
--- a/src/plugins/texteditor/basetextdocument.cpp
+++ b/src/plugins/texteditor/basetextdocument.cpp
@@ -46,7 +46,6 @@
 #include <QTextStream>
 #include <QTextCodec>
 #include <QFutureInterface>
-#include <QMainWindow>
 #include <QSyntaxHighlighter>
 #include <QApplication>
 
diff --git a/src/plugins/texteditor/fontsettings.cpp b/src/plugins/texteditor/fontsettings.cpp
index 8795fd81d8a06542b7438eb913a331c00e871867..219fab2a8beec93ef8a6ddd13cc1422d3e0c01ba 100644
--- a/src/plugins/texteditor/fontsettings.cpp
+++ b/src/plugins/texteditor/fontsettings.cpp
@@ -40,7 +40,6 @@
 #include <QFile>
 #include <QFileInfo>
 #include <QFont>
-#include <QMainWindow>
 #include <QSettings>
 #include <QTextCharFormat>
 
diff --git a/src/plugins/texteditor/fontsettingspage.cpp b/src/plugins/texteditor/fontsettingspage.cpp
index 6ec4a4187cfdc5ab4cafa617987c01fd2963352e..7d0240abb40c20aa17c23262c7176d1c9a04f650 100644
--- a/src/plugins/texteditor/fontsettingspage.cpp
+++ b/src/plugins/texteditor/fontsettingspage.cpp
@@ -49,7 +49,6 @@
 #include <QInputDialog>
 #include <QListWidget>
 #include <QMessageBox>
-#include <QMainWindow>
 #include <QPalette>
 #include <QTextCharFormat>
 #include <QTextEdit>
diff --git a/src/plugins/texteditor/refactoringchanges.cpp b/src/plugins/texteditor/refactoringchanges.cpp
index bd2346ae0084ce6bd266c33c9f342df9e904c044..9acd0e16cbc5eb56a54f0647beac58c49d1cd20a 100644
--- a/src/plugins/texteditor/refactoringchanges.cpp
+++ b/src/plugins/texteditor/refactoringchanges.cpp
@@ -39,7 +39,6 @@
 
 #include <QFile>
 #include <QSet>
-#include <QMainWindow>
 #include <QTextBlock>
 #include <QTextCursor>
 #include <QTextDocument>
diff --git a/src/plugins/texteditor/snippets/snippetssettingspage.cpp b/src/plugins/texteditor/snippets/snippetssettingspage.cpp
index 5ab13f349e037c22e9d41cf813d1728ed0294b7c..41015a4af156395db648bf366166d1c4f8c5ee40 100644
--- a/src/plugins/texteditor/snippets/snippetssettingspage.cpp
+++ b/src/plugins/texteditor/snippets/snippetssettingspage.cpp
@@ -49,7 +49,6 @@
 #include <QTextStream>
 #include <QHash>
 #include <QMessageBox>
-#include <QMainWindow>
 
 namespace TextEditor {
 namespace Internal {
diff --git a/src/plugins/texteditor/texteditorplugin.cpp b/src/plugins/texteditor/texteditorplugin.cpp
index 1525e8edbd0f6bcdde72a576153c8f68b0f04e78..de59f2688b667106a37475ea7a21f7a5e960bf5d 100644
--- a/src/plugins/texteditor/texteditorplugin.cpp
+++ b/src/plugins/texteditor/texteditorplugin.cpp
@@ -61,7 +61,6 @@
 #include <utils/qtcassert.h>
 
 #include <QtPlugin>
-#include <QMainWindow>
 #include <QShortcut>
 #include <QDir>
 #include <QTemporaryFile>
diff --git a/src/plugins/vcsbase/vcsbaseplugin.cpp b/src/plugins/vcsbase/vcsbaseplugin.cpp
index b6008ae5c7fb452b9e46fa5dea5872c227c848bb..3c3e6902f440c0c64e38fee7c808cb464909bc0d 100644
--- a/src/plugins/vcsbase/vcsbaseplugin.cpp
+++ b/src/plugins/vcsbase/vcsbaseplugin.cpp
@@ -60,7 +60,6 @@
 #include <QAction>
 #include <QMessageBox>
 #include <QFileDialog>
-#include <QMainWindow>
 
 using namespace Utils;
 
@@ -643,7 +642,7 @@ void VcsBasePlugin::createRepository()
     if (const ProjectExplorer::Project *currentProject = ProjectExplorer::ProjectExplorerPlugin::currentProject())
         directory = QFileInfo(currentProject->document()->fileName()).absolutePath();
     // Prompt for a directory that is not under version control yet
-    QMainWindow *mw = Core::ICore::mainWindow();
+    QWidget *mw = Core::ICore::mainWindow();
     do {
         directory = QFileDialog::getExistingDirectory(mw, tr("Choose Repository Directory"), directory);
         if (directory.isEmpty())
diff --git a/src/plugins/vcsbase/vcsbasesubmiteditor.cpp b/src/plugins/vcsbase/vcsbasesubmiteditor.cpp
index e30cb35eeacf63743747b54d5950a8ec8568768b..b11c734807dbb420c7ef77710eab038f9715e101 100644
--- a/src/plugins/vcsbase/vcsbasesubmiteditor.cpp
+++ b/src/plugins/vcsbase/vcsbasesubmiteditor.cpp
@@ -78,7 +78,6 @@
 #include <QAction>
 #include <QApplication>
 #include <QMessageBox>
-#include <QMainWindow>
 #include <QCompleter>
 #include <QLineEdit>
 #include <QTextEdit>