From a9e0d7892d05ca10a913a9984eb16680e7308296 Mon Sep 17 00:00:00 2001 From: Raphael Isemann <teemperor@gmail.com> Date: Mon, 14 May 2018 18:25:52 +0200 Subject: [PATCH] [cxxmodules] Move all Qt header into a wrapper module to fix warnings Currently all included Qt headers in this ROOT module are duplicated into each submodule. We now wrap all includes to Qt headers in a single wrapper module which includes and owns those declarations. This should fix warnings related to ambiguous linkage of all the constants that the Qt headers define (and which make the builds yellow). --- graf2d/qt/CMakeLists.txt | 1 + graf2d/qt/inc/TGQt.h | 15 +------ graf2d/qt/inc/TQMimeTypes.h | 2 +- graf2d/qt/inc/TQUserEvent.h | 5 +-- graf2d/qt/inc/TQtBrush.h | 4 +- graf2d/qt/inc/TQtCanvasPainter.h | 2 +- graf2d/qt/inc/TQtClientFilter.h | 5 +-- graf2d/qt/inc/TQtClientGuard.h | 8 +--- graf2d/qt/inc/TQtClientWidget.h | 4 +- graf2d/qt/inc/TQtEmitter.h | 2 +- graf2d/qt/inc/TQtEvent.h | 2 +- graf2d/qt/inc/TQtEventQueue.h | 2 +- graf2d/qt/inc/TQtIncludes.h | 69 +++++++++++++++++++++++++++++++ graf2d/qt/inc/TQtLock.h | 2 +- graf2d/qt/inc/TQtLockGuard.h | 2 +- graf2d/qt/inc/TQtMarker.h | 2 +- graf2d/qt/inc/TQtPadFont.h | 2 +- graf2d/qt/inc/TQtPen.h | 2 +- graf2d/qt/inc/TQtRConfig.h | 2 +- graf2d/qt/inc/TQtRootSlot.h | 2 +- graf2d/qt/inc/TQtSymbolCodec.h | 4 +- graf2d/qt/inc/TQtTimer.h | 2 +- graf2d/qt/inc/TQtUtil.h | 3 +- graf2d/qt/inc/TQtWidget.h | 16 +------ gui/qtgsi/CMakeLists.txt | 1 + gui/qtgsi/inc/TQCanvasMenu.h | 3 +- gui/qtgsi/inc/TQRootApplication.h | 3 +- gui/qtgsi/inc/TQRootCanvas.h | 3 +- gui/qtgsi/inc/TQRootDialog.h | 3 +- gui/qtgsi/inc/TQtGSIIncludes.h | 20 +++++++++ 30 files changed, 118 insertions(+), 75 deletions(-) create mode 100644 graf2d/qt/inc/TQtIncludes.h create mode 100644 gui/qtgsi/inc/TQtGSIIncludes.h diff --git a/graf2d/qt/CMakeLists.txt b/graf2d/qt/CMakeLists.txt index cd9d67f5c3b..21e87dca7c8 100644 --- a/graf2d/qt/CMakeLists.txt +++ b/graf2d/qt/CMakeLists.txt @@ -28,6 +28,7 @@ set(headers inc/TQtRootSlot.h inc/TQtTimer.h inc/TQtWidget.h + inc/TQtIncludes.h ) set(sources diff --git a/graf2d/qt/inc/TGQt.h b/graf2d/qt/inc/TGQt.h index 65467e1c1cb..ec15de642f4 100644 --- a/graf2d/qt/inc/TGQt.h +++ b/graf2d/qt/inc/TGQt.h @@ -28,20 +28,7 @@ #include <vector> #include <map> -#include <qobject.h> -#include <QMap> -#include <QColor> -#include <QCursor> -#include <QPainter> -#include <QRect> -#include <qnamespace.h> - -#include <QtGui/QPixmap> -#include <QtCore/QEvent> -#include <QtCore/QVector> - -#include <QtGui/QFontDatabase> - +#include "TQtIncludes.h" #include "TQtClientGuard.h" class QPainter; diff --git a/graf2d/qt/inc/TQMimeTypes.h b/graf2d/qt/inc/TQMimeTypes.h index fb976c9aa1e..3610012ccd1 100644 --- a/graf2d/qt/inc/TQMimeTypes.h +++ b/graf2d/qt/inc/TQMimeTypes.h @@ -29,7 +29,7 @@ #include "TObject.h" #include "TString.h" #ifndef __CINT__ -# include "qglobal.h" +# include "TQtIncludes.h" #endif class QFileIconProvider; diff --git a/graf2d/qt/inc/TQUserEvent.h b/graf2d/qt/inc/TQUserEvent.h index 028164cff37..d877dac959a 100644 --- a/graf2d/qt/inc/TQUserEvent.h +++ b/graf2d/qt/inc/TQUserEvent.h @@ -13,10 +13,7 @@ #ifndef ROOT_TQUserEvent #define ROOT_TQUserEvent -#include <qglobal.h> -#if QT_VERSION < 0x40000 - #include <qevent.h> -#endif /* QT_VERSION */ +#include <TQtIncludes.h> #include "GuiTypes.h" class TQUserEvent : public diff --git a/graf2d/qt/inc/TQtBrush.h b/graf2d/qt/inc/TQtBrush.h index dfe3fee955f..02126a3a4a7 100644 --- a/graf2d/qt/inc/TQtBrush.h +++ b/graf2d/qt/inc/TQtBrush.h @@ -14,9 +14,7 @@ #define ROOT_TQtBrush #ifndef __CINT__ -# include <qbrush.h> -# include <qcolor.h> -# include <qpixmap.h> +# include "TQtIncludes.h" #else class QColor; class QBrush; diff --git a/graf2d/qt/inc/TQtCanvasPainter.h b/graf2d/qt/inc/TQtCanvasPainter.h index 208146aef43..1c186871ce1 100644 --- a/graf2d/qt/inc/TQtCanvasPainter.h +++ b/graf2d/qt/inc/TQtCanvasPainter.h @@ -12,7 +12,7 @@ // // ///////////////////////////////////////////////////////////////////////////// -#include <QtCore/QObject> +#include "TQtIncludes.h" class QPainter; class QPaintEvent; diff --git a/graf2d/qt/inc/TQtClientFilter.h b/graf2d/qt/inc/TQtClientFilter.h index 017793d2c9a..8e1cdf9946d 100644 --- a/graf2d/qt/inc/TQtClientFilter.h +++ b/graf2d/qt/inc/TQtClientFilter.h @@ -17,10 +17,7 @@ #include "Rtypes.h" #ifndef __CINT__ -# include <QEvent> -# include <QMouseEvent> -# include <QList> -# include <QApplication> +# include "TQtIncludes.h" #else class TQtClientWidget; class QObject; diff --git a/graf2d/qt/inc/TQtClientGuard.h b/graf2d/qt/inc/TQtClientGuard.h index 8e3bb6fda1e..2aec2d301bd 100644 --- a/graf2d/qt/inc/TQtClientGuard.h +++ b/graf2d/qt/inc/TQtClientGuard.h @@ -13,13 +13,7 @@ * For the list of contributors see $ROOTSYS/README/CREDITS. * *************************************************************************/ -#include <qobject.h> -#include <qpixmap.h> -#if QT_VERSION < 0x40000 -# include <qptrlist.h> -#else /* QT_VERSION */ -# include <QList> -#endif /* QT_VERSION */ +#include "TQtIncludes.h" #include "TQtClientWidget.h" diff --git a/graf2d/qt/inc/TQtClientWidget.h b/graf2d/qt/inc/TQtClientWidget.h index 78a27dd429b..bcebd22d4ac 100644 --- a/graf2d/qt/inc/TQtClientWidget.h +++ b/graf2d/qt/inc/TQtClientWidget.h @@ -13,9 +13,7 @@ #ifndef __CINT__ -# include <QKeySequence> -# include <QFrame> -# include <QCursor> +# include "TQtIncludes.h" # include <map> #else class QFrame; diff --git a/graf2d/qt/inc/TQtEmitter.h b/graf2d/qt/inc/TQtEmitter.h index 4f068942440..a539b9abb57 100644 --- a/graf2d/qt/inc/TQtEmitter.h +++ b/graf2d/qt/inc/TQtEmitter.h @@ -19,7 +19,7 @@ #include "TQtRConfig.h" #ifndef __CINT__ -#include <qobject.h> +#include <TQtIncludes.h> class QPixmap; class TQtEmitter : public QObject { diff --git a/graf2d/qt/inc/TQtEvent.h b/graf2d/qt/inc/TQtEvent.h index a04b8a0fd75..fce0b7a2006 100644 --- a/graf2d/qt/inc/TQtEvent.h +++ b/graf2d/qt/inc/TQtEvent.h @@ -13,7 +13,7 @@ #ifndef ROOT_TQtEvent #define ROOT_TQtEvent -#include <QEvent> +#include "TQtIncludes.h" class TQtObject; class TWaitCondition; diff --git a/graf2d/qt/inc/TQtEventQueue.h b/graf2d/qt/inc/TQtEventQueue.h index d9cc2e1857f..feb983014a3 100644 --- a/graf2d/qt/inc/TQtEventQueue.h +++ b/graf2d/qt/inc/TQtEventQueue.h @@ -15,7 +15,7 @@ *************************************************************************/ #include "GuiTypes.h" -#include <QQueue> +#include "TQtIncludes.h" ///////////////////////////////////////////////////////////////////////////////// // diff --git a/graf2d/qt/inc/TQtIncludes.h b/graf2d/qt/inc/TQtIncludes.h new file mode 100644 index 00000000000..f1898b82a38 --- /dev/null +++ b/graf2d/qt/inc/TQtIncludes.h @@ -0,0 +1,69 @@ +// @(#)root/qt:$Id$ +// Author: Raphael Isemann 14/05/2018 + +/************************************************************************* + * Copyright (C) 1995-2004, Rene Brun and Fons Rademakers. * + * Copyright (C) 2003 by Valeri Fine. * + * All rights reserved. * + * * + * For the licensing terms see $ROOTSYS/LICENSE. * + * For the list of contributors see $ROOTSYS/README/CREDITS. * + *************************************************************************/ + +#ifndef ROOT_TQtIncludes +#define ROOT_TQtIncludes + +// Single header that provides Qt headers to all classes. +// This prevents that the Qt headers are duplicated in multiple modules. + +#ifndef __CINT__ +# include <qapplication.h> +# include <qbrush.h> +# include <qcolor.h> +# include <qglobal.h> +# include <qmutex.h> +# include <qnamespace.h> +# include <qobject.h> +# include <qpixmap.h> +# include <QApplication> +# include <QByteArray> +# include <QColor> +# include <QCursor> +# include <QEvent> +# include <QFont> +# include <QFrame> +# include <QKeySequence> +# include <QList> +# include <QMap> +# include <QMouseEvent> +# include <QPainter> +# include <QPolygon> +# include <QQueue> +# include <QRect> +# include <QtCore/QEvent> +# include <QtCore/QObject> +# include <QtCore/QPoint> +# include <QtCore/QPointer> +# include <QtCore/QSize> +# include <QtCore/QVector> +# include <QTextCodec> +# include <QtGui/QFocusEvent> +# include <QtGui/QFontDatabase> +# include <QtGui/QKeyEvent> +# include <QtGui/QMouseEvent> +# include <QtGui/QPaintDevice> +# include <QtGui/QPaintEvent> +# include <QtGui/QPen> +# include <QtGui/QPixmap> +# include <QtGui/QResizeEvent> +# include <QtGui/QShowEvent> +# include <QtGui/QWidget> +# include <QTimer> + +#if QT_VERSION < 0x40000 +# include <qevent.h> +#endif + +#endif + +#endif diff --git a/graf2d/qt/inc/TQtLock.h b/graf2d/qt/inc/TQtLock.h index 849b29c5078..4e4bb656a03 100644 --- a/graf2d/qt/inc/TQtLock.h +++ b/graf2d/qt/inc/TQtLock.h @@ -13,7 +13,7 @@ ////////////////////////////////////////////////////////////////////////// #include "Rtypes.h" -#include <qapplication.h> +#include <TQtIncludes.h> class TQtLock { public: diff --git a/graf2d/qt/inc/TQtLockGuard.h b/graf2d/qt/inc/TQtLockGuard.h index 7c07465938f..24a9a267b8e 100644 --- a/graf2d/qt/inc/TQtLockGuard.h +++ b/graf2d/qt/inc/TQtLockGuard.h @@ -26,7 +26,7 @@ // // ////////////////////////////////////////////////////////////////////////// -#include "qmutex.h" +#include "TQtIncludes.h" class TQtLockGuard { diff --git a/graf2d/qt/inc/TQtMarker.h b/graf2d/qt/inc/TQtMarker.h index a215007131b..099b2cc8ce0 100644 --- a/graf2d/qt/inc/TQtMarker.h +++ b/graf2d/qt/inc/TQtMarker.h @@ -16,7 +16,7 @@ #include "TPoint.h" #ifndef __CINT__ -#include <QPolygon> +#include "TQtIncludes.h" #else class QPointArray; class QPolygon; diff --git a/graf2d/qt/inc/TQtPadFont.h b/graf2d/qt/inc/TQtPadFont.h index 2ccd7c967a6..3cd24584136 100644 --- a/graf2d/qt/inc/TQtPadFont.h +++ b/graf2d/qt/inc/TQtPadFont.h @@ -13,7 +13,7 @@ #include "TString.h" #ifndef __CINT__ -# include <QFont> +#include "TQtIncludes.h" #else class QFont; #endif diff --git a/graf2d/qt/inc/TQtPen.h b/graf2d/qt/inc/TQtPen.h index 7fc630c43f6..30412644961 100644 --- a/graf2d/qt/inc/TQtPen.h +++ b/graf2d/qt/inc/TQtPen.h @@ -12,7 +12,7 @@ #include "TAttLine.h" #ifndef __CINT__ -# include <QtGui/QPen> +#include "TQtIncludes.h" #else class QPen; #endif diff --git a/graf2d/qt/inc/TQtRConfig.h b/graf2d/qt/inc/TQtRConfig.h index d06c3d044cf..457054642eb 100644 --- a/graf2d/qt/inc/TQtRConfig.h +++ b/graf2d/qt/inc/TQtRConfig.h @@ -12,7 +12,7 @@ #define ROOT_TQTRCONFIG #include <ROOT/RConfig.h> #ifndef __CINT__ -# include "qglobal.h" +# include "TQtIncludes.h" #endif // defined the CPP symbols to create the different versions diff --git a/graf2d/qt/inc/TQtRootSlot.h b/graf2d/qt/inc/TQtRootSlot.h index e7f96e48647..b93a0a36f95 100644 --- a/graf2d/qt/inc/TQtRootSlot.h +++ b/graf2d/qt/inc/TQtRootSlot.h @@ -25,7 +25,7 @@ #define ROOT_TQRootSlot #ifndef __CINT__ -#include <qobject.h> +#include <TQtIncludes.h> #else class QObject; #ifndef Q_OBJECT diff --git a/graf2d/qt/inc/TQtSymbolCodec.h b/graf2d/qt/inc/TQtSymbolCodec.h index b395567dbe4..5aee97c2939 100644 --- a/graf2d/qt/inc/TQtSymbolCodec.h +++ b/graf2d/qt/inc/TQtSymbolCodec.h @@ -11,9 +11,7 @@ #define ROOT_QSYMBOLCODEC_H -#include <QByteArray> -#include <QTextCodec> -#include <QByteArray> +#include "TQtIncludes.h" #ifndef QT_NO_CODEC_SYMBOL diff --git a/graf2d/qt/inc/TQtTimer.h b/graf2d/qt/inc/TQtTimer.h index 786cfceddb3..1a7b93fcb6e 100644 --- a/graf2d/qt/inc/TQtTimer.h +++ b/graf2d/qt/inc/TQtTimer.h @@ -16,7 +16,7 @@ #include "Rtypes.h" #ifndef __CINT__ -# include <QTimer> +#include "TQtIncludes.h" #else class QTimer; #endif diff --git a/graf2d/qt/inc/TQtUtil.h b/graf2d/qt/inc/TQtUtil.h index d9e1705908e..d1f281bbe3a 100644 --- a/graf2d/qt/inc/TQtUtil.h +++ b/graf2d/qt/inc/TQtUtil.h @@ -17,8 +17,7 @@ #include "TVirtualPad.h" #include "TCanvasImp.h" -#include <QtGui/QPixmap> -#include <QtGui/QWidget> +#include "TQtIncludes.h" //---------------------------------------- // Q: How to get Qt pointer: diff --git a/graf2d/qt/inc/TQtWidget.h b/graf2d/qt/inc/TQtWidget.h index 53aafedd7e6..715e16c7cdf 100644 --- a/graf2d/qt/inc/TQtWidget.h +++ b/graf2d/qt/inc/TQtWidget.h @@ -19,22 +19,10 @@ #include <assert.h> #include "Rtypes.h" #include "TCanvas.h" +#include "TQtCanvasPainter.h" #ifndef __CINT__ -# include <QtGui/QWidget> -# include <QtGui/QMouseEvent> -# include <QtGui/QShowEvent> -# include <QtGui/QFocusEvent> -# include <QtGui/QKeyEvent> -# include <QtGui/QResizeEvent> -# include <QtCore/QEvent> -# include <QtGui/QPaintEvent> -# include <QtGui/QPaintDevice> -# include <QtCore/QSize> -# include <QtCore/QPoint> -# include <QtCore/QPointer> -# include <QtGui/QPixmap> -# include "TQtCanvasPainter.h" +#include "TQtIncludes.h" #else // List of the fake classes to make RootCint happy. class QWidget; diff --git a/gui/qtgsi/CMakeLists.txt b/gui/qtgsi/CMakeLists.txt index de24673a249..013ac2e6c55 100644 --- a/gui/qtgsi/CMakeLists.txt +++ b/gui/qtgsi/CMakeLists.txt @@ -25,6 +25,7 @@ set(headers inc/TQRootCanvas.h inc/TQRootDialog.h inc/TQRootGuiFactory.h + inc/TQtGSIIncludes.h ) set(sources diff --git a/gui/qtgsi/inc/TQCanvasMenu.h b/gui/qtgsi/inc/TQCanvasMenu.h index 7398d2a83dd..24496fa9e61 100644 --- a/gui/qtgsi/inc/TQCanvasMenu.h +++ b/gui/qtgsi/inc/TQCanvasMenu.h @@ -22,8 +22,7 @@ // //////////////////////////////////////////////////////////////////////////////// -#include <QtGui> - +#include "TQtGSIIncludes.h" #include "TList.h" class TCanvas; diff --git a/gui/qtgsi/inc/TQRootApplication.h b/gui/qtgsi/inc/TQRootApplication.h index f774092809b..9df53b61e4f 100644 --- a/gui/qtgsi/inc/TQRootApplication.h +++ b/gui/qtgsi/inc/TQRootApplication.h @@ -23,8 +23,7 @@ /////////////////////////////////////////////////////////////////////// #include "Rtypes.h" - -#include <QtGui> +#include "TQtGSIIncludes.h" class TTimer; diff --git a/gui/qtgsi/inc/TQRootCanvas.h b/gui/qtgsi/inc/TQRootCanvas.h index 43c28ee96b6..9431fc812e0 100644 --- a/gui/qtgsi/inc/TQRootCanvas.h +++ b/gui/qtgsi/inc/TQRootCanvas.h @@ -25,8 +25,7 @@ //version 2.0 ////////////////////////////////////////////////////////////////////// -#include <QtGui> - +#include "TQtGSIIncludes.h" #include "TVirtualPad.h" class TPad; diff --git a/gui/qtgsi/inc/TQRootDialog.h b/gui/qtgsi/inc/TQRootDialog.h index 7a49fa237da..0333f2b2506 100644 --- a/gui/qtgsi/inc/TQRootDialog.h +++ b/gui/qtgsi/inc/TQRootDialog.h @@ -23,8 +23,7 @@ // M. AL-Turany <m.al-turany@gsi.de> //////////////////////////////////////////////////////////////////////////// -#include <QtGui> - +#include "TQtGSIIncludes.h" #include "TObject.h" class TMethod; diff --git a/gui/qtgsi/inc/TQtGSIIncludes.h b/gui/qtgsi/inc/TQtGSIIncludes.h new file mode 100644 index 00000000000..7a904eda324 --- /dev/null +++ b/gui/qtgsi/inc/TQtGSIIncludes.h @@ -0,0 +1,20 @@ +// @(#)root/qtgsi:$Id$ +// Author: Raphael Isemann 14/05/2018 + +/************************************************************************* + * Copyright (C) 1995-2006, Rene Brun and Fons Rademakers. * + * All rights reserved. * + * * + * For the licensing terms see $ROOTSYS/LICENSE. * + * For the list of contributors see $ROOTSYS/README/CREDITS. * + *************************************************************************/ + +#ifndef ROOT_TQtGSIIncludes +#define ROOT_TQtGSIIncludes + +// Wrapper header for Qt, so that all Qt declarations are only owned by +// a single module. + +#include <QtGui> + +#endif -- GitLab