From 07943d2a9acdd986bd245e6422634ef6e8a41fbb Mon Sep 17 00:00:00 2001 From: wmayer Date: Mon, 12 Dec 2016 15:22:34 +0100 Subject: [PATCH] Qt4/Qt5 neutral changes: + move meta types to own header to avoid double declaration --- src/Gui/CMakeLists.txt | 1 + src/Gui/InputField.h | 2 +- src/Gui/MetaTypes.h | 38 +++++++++++++++++++ src/Gui/QuantitySpinBox.h | 2 +- src/Gui/propertyeditor/PropertyItem.h | 3 ++ src/Mod/Part/Gui/DlgFilletEdges.cpp | 2 - .../Gui/PropertyConstraintListItem.cpp | 4 +- 7 files changed, 46 insertions(+), 6 deletions(-) create mode 100644 src/Gui/MetaTypes.h diff --git a/src/Gui/CMakeLists.txt b/src/Gui/CMakeLists.txt index 61e47600fcee..305774c8a477 100644 --- a/src/Gui/CMakeLists.txt +++ b/src/Gui/CMakeLists.txt @@ -1046,6 +1046,7 @@ SET(FreeCADGui_SRCS InventorAll.h Macro.h MergeDocuments.h + MetaTypes.h PreCompiled.cpp PreCompiled.h Qt4All.h diff --git a/src/Gui/InputField.h b/src/Gui/InputField.h index 3c13e2c78961..fa522af38fdc 100644 --- a/src/Gui/InputField.h +++ b/src/Gui/InputField.h @@ -28,7 +28,7 @@ #include #include #include -#include +#include #include "Widgets.h" #include "Window.h" #include "SpinBox.h" diff --git a/src/Gui/MetaTypes.h b/src/Gui/MetaTypes.h new file mode 100644 index 000000000000..1ff64406b175 --- /dev/null +++ b/src/Gui/MetaTypes.h @@ -0,0 +1,38 @@ +/*************************************************************************** + * Copyright (c) 2016 Werner Mayer * + * * + * This file is part of the FreeCAD CAx development system. * + * * + * This library is free software; you can redistribute it and/or * + * modify it under the terms of the GNU Library General Public * + * License as published by the Free Software Foundation; either * + * version 2 of the License, or (at your option) any later version. * + * * + * This library is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU Library General Public License for more details. * + * * + * You should have received a copy of the GNU Library General Public * + * License along with this library; see the file COPYING.LIB. If not, * + * write to the Free Software Foundation, Inc., 59 Temple Place, * + * Suite 330, Boston, MA 02111-1307, USA * + * * + ***************************************************************************/ + +#ifndef GUI_METATYPES_H +#define GUI_METATYPES_H + +#include +#include +#include +#include + +Q_DECLARE_METATYPE(Base::Vector3f) +Q_DECLARE_METATYPE(Base::Vector3d) +Q_DECLARE_METATYPE(Base::Matrix4D) +Q_DECLARE_METATYPE(Base::Placement) +Q_DECLARE_METATYPE(Base::Quantity) +Q_DECLARE_METATYPE(QList) + +#endif // GUI_METATYPES_H diff --git a/src/Gui/QuantitySpinBox.h b/src/Gui/QuantitySpinBox.h index 3363d098119e..c719e88e3617 100644 --- a/src/Gui/QuantitySpinBox.h +++ b/src/Gui/QuantitySpinBox.h @@ -25,7 +25,7 @@ #define GUI_QUANTITYSPINBOX_H #include -#include +#include #include "ExpressionBinding.h" #ifdef Q_MOC_RUN diff --git a/src/Gui/propertyeditor/PropertyItem.h b/src/Gui/propertyeditor/PropertyItem.h index f6d57cebf3f9..4d3cb724fff7 100644 --- a/src/Gui/propertyeditor/PropertyItem.h +++ b/src/Gui/propertyeditor/PropertyItem.h @@ -38,13 +38,16 @@ #include #include #include +#include +#ifdef Q_MOC_RUN Q_DECLARE_METATYPE(Base::Vector3f) Q_DECLARE_METATYPE(Base::Vector3d) Q_DECLARE_METATYPE(Base::Matrix4D) Q_DECLARE_METATYPE(Base::Placement) Q_DECLARE_METATYPE(Base::Quantity) Q_DECLARE_METATYPE(QList) +#endif namespace Gui { namespace Dialog { class TaskPlacement; } diff --git a/src/Mod/Part/Gui/DlgFilletEdges.cpp b/src/Mod/Part/Gui/DlgFilletEdges.cpp index 275f368e06bd..f11a61aa9d0f 100644 --- a/src/Mod/Part/Gui/DlgFilletEdges.cpp +++ b/src/Mod/Part/Gui/DlgFilletEdges.cpp @@ -76,8 +76,6 @@ using namespace PartGui; -Q_DECLARE_METATYPE(Base::Quantity) - FilletRadiusDelegate::FilletRadiusDelegate(QObject *parent) : QItemDelegate(parent) { } diff --git a/src/Mod/Sketcher/Gui/PropertyConstraintListItem.cpp b/src/Mod/Sketcher/Gui/PropertyConstraintListItem.cpp index dffde78b670c..e17b4dfffa63 100644 --- a/src/Mod/Sketcher/Gui/PropertyConstraintListItem.cpp +++ b/src/Mod/Sketcher/Gui/PropertyConstraintListItem.cpp @@ -28,7 +28,7 @@ #include -#include +#include #include "../App/PropertyConstraintList.h" #include "PropertyConstraintListItem.h" @@ -36,7 +36,7 @@ using namespace SketcherGui; using namespace Gui::PropertyEditor; -TYPESYSTEM_SOURCE(SketcherGui::PropertyConstraintListItem, Gui::PropertyEditor::PropertyItem); +TYPESYSTEM_SOURCE(SketcherGui::PropertyConstraintListItem, Gui::PropertyEditor::PropertyItem) PropertyConstraintListItem::PropertyConstraintListItem() {