Base: add convenience classes/functions that are marked as deprecated in Qt 5.15 and removed in Qt 6
This commit is contained in:
@@ -242,6 +242,7 @@ SET(FreeCADBase_CPP_SRCS
|
||||
Matrix.cpp
|
||||
MatrixPyImp.cpp
|
||||
MemDebug.cpp
|
||||
Mutex.cpp
|
||||
Parameter.xsd
|
||||
Parameter.cpp
|
||||
ParameterPy.cpp
|
||||
@@ -251,6 +252,7 @@ SET(FreeCADBase_CPP_SRCS
|
||||
PlacementPyImp.cpp
|
||||
PyExport.cpp
|
||||
PyObjectBase.cpp
|
||||
QtTools.cpp
|
||||
Reader.cpp
|
||||
Rotation.cpp
|
||||
RotationPyImp.cpp
|
||||
@@ -306,12 +308,14 @@ SET(FreeCADBase_HPP_SRCS
|
||||
Interpreter.h
|
||||
Matrix.h
|
||||
MemDebug.h
|
||||
Mutex.h
|
||||
Observer.h
|
||||
Parameter.h
|
||||
Persistence.h
|
||||
Placement.h
|
||||
PyExport.h
|
||||
PyObjectBase.h
|
||||
QtTools.h
|
||||
Reader.h
|
||||
Rotation.h
|
||||
Sequencer.h
|
||||
|
||||
37
src/Base/Mutex.cpp
Normal file
37
src/Base/Mutex.cpp
Normal file
@@ -0,0 +1,37 @@
|
||||
/***************************************************************************
|
||||
* Copyright (c) 2022 Werner Mayer <wmayer[at]users.sourceforge.net> *
|
||||
* *
|
||||
* 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 *
|
||||
* *
|
||||
***************************************************************************/
|
||||
|
||||
|
||||
#include "PreCompiled.h"
|
||||
|
||||
#include "Mutex.h"
|
||||
|
||||
|
||||
#if QT_VERSION < QT_VERSION_CHECK(5,14,0)
|
||||
QRecursiveMutex::QRecursiveMutex() : QMutex(QMutex::Recursive)
|
||||
{
|
||||
}
|
||||
|
||||
QRecursiveMutex::~QRecursiveMutex()
|
||||
{
|
||||
}
|
||||
#endif
|
||||
39
src/Base/Mutex.h
Normal file
39
src/Base/Mutex.h
Normal file
@@ -0,0 +1,39 @@
|
||||
/***************************************************************************
|
||||
* Copyright (c) 2022 Werner Mayer <wmayer[at]users.sourceforge.net> *
|
||||
* *
|
||||
* 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 BASE_MUTEX_H
|
||||
#define BASE_MUTEX_H
|
||||
|
||||
#include <QMutex>
|
||||
#include <FCGlobal.h>
|
||||
|
||||
#if QT_VERSION < QT_VERSION_CHECK(5,14,0)
|
||||
class BaseExport QRecursiveMutex : public QMutex
|
||||
{
|
||||
public:
|
||||
QRecursiveMutex();
|
||||
~QRecursiveMutex();
|
||||
};
|
||||
#endif
|
||||
|
||||
#endif // BASE_MUTEX_H
|
||||
35
src/Base/QtTools.cpp
Normal file
35
src/Base/QtTools.cpp
Normal file
@@ -0,0 +1,35 @@
|
||||
/***************************************************************************
|
||||
* Copyright (c) 2022 Werner Mayer <wmayer[at]users.sourceforge.net> *
|
||||
* *
|
||||
* 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 *
|
||||
* *
|
||||
***************************************************************************/
|
||||
|
||||
|
||||
#include "PreCompiled.h"
|
||||
|
||||
#include "QtTools.h"
|
||||
|
||||
|
||||
#if QT_VERSION < QT_VERSION_CHECK(5,14,0)
|
||||
namespace Qt {
|
||||
BaseExport QTextStream& endl(QTextStream& stream) {
|
||||
return stream << QLatin1Char('\n') << flush;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
55
src/Base/QtTools.h
Normal file
55
src/Base/QtTools.h
Normal file
@@ -0,0 +1,55 @@
|
||||
/***************************************************************************
|
||||
* Copyright (c) 2022 Werner Mayer <wmayer[at]users.sourceforge.net> *
|
||||
* *
|
||||
* 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 BASE_QTTOOLS_H
|
||||
#define BASE_QTTOOLS_H
|
||||
|
||||
#include <QtGlobal>
|
||||
#include <QString>
|
||||
#include <FCGlobal.h>
|
||||
|
||||
// Suppress warning about 'SkipEmptyParts' not being used
|
||||
#if defined(__clang__)
|
||||
# pragma clang diagnostic push
|
||||
# pragma clang diagnostic ignored "-Wunused-variable"
|
||||
#elif defined (__GNUC__)
|
||||
# pragma GCC diagnostic push
|
||||
# pragma GCC diagnostic ignored "-Wunused-variable"
|
||||
#endif
|
||||
|
||||
#if QT_VERSION < QT_VERSION_CHECK(5, 14, 0)
|
||||
#include <QTextStream>
|
||||
namespace Qt
|
||||
{
|
||||
BaseExport QTextStream& endl(QTextStream& stream);
|
||||
static auto SkipEmptyParts = QString::SkipEmptyParts;
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(__clang__)
|
||||
# pragma clang diagnostic pop
|
||||
#elif defined (__GNUC__)
|
||||
# pragma GCC diagnostic pop
|
||||
#endif
|
||||
|
||||
#endif // BASE_QTTOOLS_H
|
||||
@@ -24,11 +24,11 @@
|
||||
#include "PreCompiled.h"
|
||||
|
||||
#ifndef _PreComp_
|
||||
# include <QMutex>
|
||||
# include <QMutexLocker>
|
||||
#endif
|
||||
|
||||
#include "Sequencer.h"
|
||||
#include "Mutex.h"
|
||||
|
||||
|
||||
using namespace Base;
|
||||
@@ -38,11 +38,7 @@ namespace Base {
|
||||
// members
|
||||
static std::vector<SequencerBase*> _instances; /**< A vector of all created instances */
|
||||
static SequencerLauncher* _topLauncher; /**< The outermost launcher */
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(5,14,0)
|
||||
static QRecursiveMutex mutex; /**< A mutex-locker for the launcher */
|
||||
#else
|
||||
static QMutex mutex; /**< A mutex-locker for the launcher */
|
||||
#endif
|
||||
/** Sets a global sequencer object.
|
||||
* Access to the last registered object is performed by @see Sequencer().
|
||||
*/
|
||||
@@ -68,11 +64,7 @@ namespace Base {
|
||||
*/
|
||||
std::vector<SequencerBase*> SequencerP::_instances;
|
||||
SequencerLauncher* SequencerP::_topLauncher = nullptr;
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(5,14,0)
|
||||
QRecursiveMutex SequencerP::mutex;
|
||||
#else
|
||||
QMutex SequencerP::mutex(QMutex::Recursive);
|
||||
#endif
|
||||
}
|
||||
|
||||
SequencerBase& SequencerBase::Instance ()
|
||||
|
||||
Reference in New Issue
Block a user