Skip to content
Permalink
Browse files

Backward compatibility for Qt 5.9 to 5.14 (#933)

* Update codes to copmile against from Qt 5.9.x to Qt 5.14.x

Signed-off-by: Michael Jackson <mike.jackson@bluequartz.net>

* Use Qt5 backwards compatibility macros

Signed-off-by: Michael Jackson <mike.jackson@bluequartz.net>

* Updating backwards compatibility macros for Qt5.9 through 5.14

Signed-off-by: Michael Jackson <mike.jackson@bluequartz.net>
  • Loading branch information
imikejackson committed Mar 18, 2020
1 parent 42497ae commit 53dd7314dee2e3873868a8e698e3407955f48180
Showing with 223 additions and 111 deletions.
  1. +42 −1 Source/EbsdLib/EbsdMacros.h
  2. +1 −16 Source/OrientationLib/OrientationMath/OrientationConverter.hpp
  3. +47 −0 Source/OrientationLib/OrientationMath/OrientationRepresentation.h
  4. +1 −0 Source/OrientationLib/OrientationMath/SourceList.cmake
  5. +1 −1 Source/Plugins/OrientationAnalysis/Gui/FilterParameterWidgets/EnsembleInfoTableModel.cpp
  6. +2 −0 Source/Plugins/OrientationAnalysis/Gui/Widgets/AxisAngleWidget.cpp
  7. +4 −0 Source/Plugins/OrientationAnalysis/Gui/Widgets/CubochoricWidget.cpp
  8. +5 −3 Source/Plugins/OrientationAnalysis/Gui/Widgets/CubochoricWidget.h
  9. +2 −0 Source/Plugins/OrientationAnalysis/Gui/Widgets/EulerWidget.cpp
  10. +2 −0 Source/Plugins/OrientationAnalysis/Gui/Widgets/HomochoricWidget.cpp
  11. +2 −0 Source/Plugins/OrientationAnalysis/Gui/Widgets/OmWidget.cpp
  12. +2 −0 Source/Plugins/OrientationAnalysis/Gui/Widgets/OrientationUtilityCalculator.cpp
  13. +6 −1 Source/Plugins/OrientationAnalysis/Gui/Widgets/OrientationUtilityCalculator.h
  14. +2 −0 Source/Plugins/OrientationAnalysis/Gui/Widgets/OrientationWidget.cpp
  15. +5 −2 Source/Plugins/OrientationAnalysis/Gui/Widgets/OrientationWidget.h
  16. +5 −6 Source/Plugins/OrientationAnalysis/Gui/Widgets/QEbsdReferenceFrameDialog.cpp
  17. +1 −0 Source/Plugins/OrientationAnalysis/Gui/Widgets/QuatWidget.cpp
  18. +1 −0 Source/Plugins/OrientationAnalysis/Gui/Widgets/RodriguesWidget.cpp
  19. +2 −1 Source/Plugins/OrientationAnalysis/OrientationAnalysisFilters/GenerateFZQuaternions.cpp
  20. +5 −5 ...Plugins/OrientationAnalysis/OrientationAnalysisFilters/IPFLegendHelpers/CubicIPFLegendPainter.cpp
  21. +3 −3 ...gins/OrientationAnalysis/OrientationAnalysisFilters/IPFLegendHelpers/CubicLowIPFLegendPainter.cpp
  22. +5 −5 ...ins/OrientationAnalysis/OrientationAnalysisFilters/IPFLegendHelpers/HexagonalIPFLegendPainter.cpp
  23. +5 −5 .../OrientationAnalysis/OrientationAnalysisFilters/IPFLegendHelpers/HexagonalLowIPFLegendPainter.cpp
  24. +4 −2 Source/Plugins/OrientationAnalysis/OrientationAnalysisFilters/IPFLegendHelpers/IPFLegendPainter.cpp
  25. +6 −6 ...ns/OrientationAnalysis/OrientationAnalysisFilters/IPFLegendHelpers/MonoclinicIPFLegendPainter.cpp
  26. +5 −5 .../OrientationAnalysis/OrientationAnalysisFilters/IPFLegendHelpers/OrthorhombicIPFLegendPainter.cpp
  27. +5 −5 ...ns/OrientationAnalysis/OrientationAnalysisFilters/IPFLegendHelpers/TetragonalIPFLegendPainter.cpp
  28. +5 −5 ...OrientationAnalysis/OrientationAnalysisFilters/IPFLegendHelpers/TetragonalLowIPFLegendPainter.cpp
  29. +4 −4 ...ins/OrientationAnalysis/OrientationAnalysisFilters/IPFLegendHelpers/TriclinicIPFLegendPainter.cpp
  30. +5 −5 ...gins/OrientationAnalysis/OrientationAnalysisFilters/IPFLegendHelpers/TrigonalIPFLegendPainter.cpp
  31. +5 −5 ...s/OrientationAnalysis/OrientationAnalysisFilters/IPFLegendHelpers/TrigonalLowIPFLegendPainter.cpp
  32. +2 −1 Source/Plugins/OrientationAnalysis/OrientationAnalysisFilters/WriteIPFStandardTriangle.cpp
  33. +6 −3 Source/Plugins/Processing/ProcessingFilters/HelperClasses/DetectEllipsoidsImpl.cpp
  34. +12 −11 Source/Plugins/SyntheticBuilding/Gui/Utilities/PoleFigureImageUtilities.cpp
  35. +1 −1 Source/Plugins/SyntheticBuilding/Gui/Widgets/StatsGenCurveTracker.cpp
  36. +2 −2 Source/Plugins/SyntheticBuilding/Gui/Widgets/StatsGenRDFWidget.cpp
  37. +1 −1 Source/Plugins/SyntheticBuilding/Gui/Widgets/TableModels/SGBetaTableModel.cpp
  38. +1 −1 Source/Plugins/SyntheticBuilding/Gui/Widgets/TableModels/SGLogNormalTableModel.cpp
  39. +3 −1 Source/Plugins/SyntheticBuilding/Gui/Widgets/TableModels/SGMDFTableModel.cpp
  40. +1 −1 Source/Plugins/SyntheticBuilding/Gui/Widgets/TableModels/SGODFTableModel.cpp
  41. +1 −1 Source/Plugins/SyntheticBuilding/Gui/Widgets/TableModels/SGPowerLawTableModel.cpp
  42. +1 −1 Source/Plugins/SyntheticBuilding/Gui/Widgets/TableModels/SGRDFTableModel.cpp
  43. +2 −1 Source/Plugins/SyntheticBuilding/SyntheticBuildingFilters/GeneratePrecipitateStatsData.cpp
@@ -39,6 +39,45 @@
/* Define our buffer size for reading data */
#define kBufferSize 1024

#include <QtCore/QtGlobal>

#if QT_VERSION < QT_VERSION_CHECK(5, 11, 0)
#define QFONTMETRICS_WIDTH width
#else
#define QFONTMETRICS_WIDTH horizontalAdvance
#endif

#if QT_VERSION < QT_VERSION_CHECK(5, 14, 0)

#ifndef QVECTOR_FROM_STD_VECTOR
#define QVECTOR_FROM_STD_VECTOR(def, qvector, other) def qvector = def::fromStdVector(other);
#endif

#ifndef QVECTOR_TO_STD_VECTOR
#define QVECTOR_TO_STD_VECTOR(def, qvector, other) def other = qvector.toStdVector();
#endif

#ifndef QLIST_FROM_QSET
#define QLIST_FROM_QSET(def, qlist, other) def qlist = other.toList();
#endif

#else

#ifndef QVECTOR_FROM_STD_VECTOR
#define QVECTOR_FROM_STD_VECTOR(def, qvecVarName, svector) def qvecVarName(svector.begin(), svector.end());
#endif

#ifndef QVECTOR_TO_STD_VECTOR
#define QVECTOR_TO_STD_VECTOR(def, qvecVarName, svector) def svector(qvecVarName.begin(), qvecVarName.end());
#endif

#ifndef QLIST_FROM_QSET
#define QLIST_FROM_QSET(def, qlist, other) def qlist = other.toList();
#endif

#endif


/**
* @brief These macros are used to read header values from an HDF5 file, NOT From a .ang or .ctf file
*/
@@ -148,7 +187,9 @@
H5Gclose(gid); \
return -1; \
} \
phase->set##key(QVector<Type>::fromStdVector(t)); \
\
QVECTOR_FROM_STD_VECTOR(QVector<Type>, temp##key, t) \
phase->set##key(temp##key); \
}

#define SHUFFLE_ARRAY(name, var, Type) \
@@ -48,9 +48,8 @@
#include "OrientationLib/Core/Orientation.hpp"
#include "OrientationLib/Core/OrientationTransformation.hpp"
#include "OrientationLib/OrientationLib.h"

#include "OrientationLib/Core/Orientation.hpp"

#include "OrientationLib/OrientationMath/OrientationRepresentation.h"

#ifdef SIMPL_USE_PARALLEL_ALGORITHMS
#include <tbb/blocked_range.h>
@@ -59,20 +58,6 @@
#include <tbb/task_scheduler_init.h>
#endif

namespace OrientationRepresentation
{
enum class Type : int
{
Euler = 0,
OrientationMatrix,
Quaternion,
AxisAngle,
Rodrigues,
Homochoric,
Cubochoric,
Unknown
};
}

/**
* @brief This is the top level superclass for doing the conversions between orientation
@@ -0,0 +1,47 @@
/* ============================================================================
* Copyright (c) 2019 BlueQuartz Software, LLC
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
*
* Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer.
*
* Redistributions in binary form must reproduce the above copyright notice, this
* list of conditions and the following disclaimer in the documentation and/or
* other materials provided with the distribution.
*
* Neither the names of any of the BlueQuartz Software contributors
* may be used to endorse or promote products derived from this software without
* specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
* USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*
* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
#pragma once

namespace OrientationRepresentation
{
enum class Type : int
{
Euler = 0,
OrientationMatrix,
Quaternion,
AxisAngle,
Rodrigues,
Homochoric,
Cubochoric,
Unknown
};
}
@@ -1,6 +1,7 @@

set(OrientationLib_OrientationMath_HDRS
${OrientationLib_SOURCE_DIR}/OrientationMath/OrientationConverter.hpp
${OrientationLib_SOURCE_DIR}/OrientationMath/OrientationRepresentation.h
)

set(OrientationLib_OrientationMath_SRCS
@@ -160,7 +160,7 @@ QVariant EnsembleInfoTableModel::data(const QModelIndex& index, qint32 role) con
}
QFontMetrics fontMetrics(data(index, Qt::FontRole).value<QFont>());
comboBox.fontMetrics = fontMetrics;
QSize size(fontMetrics.width(comboBox.currentText), fontMetrics.height());
QSize size(fontMetrics.QFONTMETRICS_WIDTH(comboBox.currentText), fontMetrics.height());
// FIXME: Is this size correct? Can we get a more accurate size without using QApplication
return size;

@@ -44,6 +44,8 @@
#include "SIMPLib/Math/SIMPLibMath.h"

#include "OrientationLib/Core/OrientationTransformation.hpp"
#include "OrientationLib/OrientationMath/OrientationRepresentation.h"
#include "OrientationUtilityCalculator.h"

// -----------------------------------------------------------------------------
//
@@ -38,6 +38,10 @@
#include <QtGui/QDoubleValidator>

#include "OrientationLib/Core/OrientationTransformation.hpp"
#include "OrientationLib/OrientationMath/OrientationConverter.hpp"
#include "OrientationLib/OrientationMath/OrientationRepresentation.h"

#include "OrientationUtilityCalculator.h"

// -----------------------------------------------------------------------------
//
@@ -36,11 +36,13 @@
#pragma once

#include "OrientationWidget.h"

#include "OrientationLib/OrientationMath/OrientationConverter.hpp"

#include "ui_CubochoricWidget.h"

class OrientationUtilityCalculator;

/**
* @brief The CubochoricWidget class
*/
class CubochoricWidget : public OrientationWidget, private Ui::CubochoricWidget
{
Q_OBJECT
@@ -41,6 +41,8 @@

#include "OrientationLib/Core/OrientationTransformation.hpp"

#include "OrientationUtilityCalculator.h"

// -----------------------------------------------------------------------------
//
// -----------------------------------------------------------------------------
@@ -39,6 +39,8 @@

#include "OrientationLib/Core/OrientationTransformation.hpp"

#include "OrientationUtilityCalculator.h"

// -----------------------------------------------------------------------------
//
// -----------------------------------------------------------------------------
@@ -39,6 +39,8 @@

#include "OrientationLib/Core/OrientationTransformation.hpp"

#include "OrientationUtilityCalculator.h"

// -----------------------------------------------------------------------------
//
// -----------------------------------------------------------------------------
@@ -44,6 +44,8 @@
#include "QuatWidget.h"
#include "RodriguesWidget.h"

#include "OrientationLib/OrientationMath/OrientationConverter.hpp"

// -----------------------------------------------------------------------------
//
// -----------------------------------------------------------------------------
@@ -37,8 +37,13 @@

#include <QtWidgets/QWidget>

#include "OrientationLib/OrientationMath/OrientationConverter.hpp"
#include "OrientationLib/OrientationMath/OrientationRepresentation.h"

class OrientationUtilityCalculator;

/**
* @brief The OrientationUtilityCalculator class
*/
class OrientationUtilityCalculator : public QWidget
{
Q_OBJECT
@@ -35,6 +35,8 @@

#include "OrientationWidget.h"

#include "OrientationUtilityCalculator.h"

// -----------------------------------------------------------------------------
//
// -----------------------------------------------------------------------------
@@ -37,10 +37,13 @@

#include <QtWidgets/QWidget>

#include "OrientationLib/OrientationMath/OrientationConverter.hpp"
#include "OrientationLib/OrientationMath/OrientationRepresentation.h"

#include "OrientationUtilityCalculator.h"
class OrientationUtilityCalculator;

/**
* @brief The OrientationWidget class
*/
class OrientationWidget : public QWidget
{
Q_OBJECT
@@ -37,22 +37,21 @@

#include <iostream>

#include <QtCore/QTextStream>
#include <QtCore/QFileInfo>

#include <QtGui/QColor>
#include <QtGui/QFont>
#include <QtGui/QPainter>

#include <QtWidgets/QButtonGroup>
#include <QtWidgets/QMenu>
#include <QtWidgets/QMessageBox>

#include "EbsdLib/HKL/CtfConstants.h"
#include "EbsdLib/TSL/AngConstants.h"

#include <QtCore/QTextStream>

#include "SIMPLib/CoreFilters/GenerateColorTable.h"

#include "SIMPLib/DataArrays/DataArray.hpp"
#include "SIMPLib/DataContainers/DataContainer.h"
#include "SIMPLib/FilterParameters/FilterParameter.h"
@@ -715,7 +714,7 @@ QImage QEbsdReferenceFrameDialog::paintImage(QImage image)
painter.setFont(font);
QFontMetrics metrics = painter.fontMetrics();
pxHigh = metrics.height();
pxWide = metrics.width(QString("TD"));
pxWide = metrics.QFONTMETRICS_WIDTH(QString("TD"));
painter.end();
}

@@ -737,7 +736,7 @@ QImage QEbsdReferenceFrameDialog::paintImage(QImage image)
painter.setFont(font);
QFontMetrics metrics = painter.fontMetrics();
pxHigh = metrics.height();
pxWide = metrics.width(QString("TD"));
pxWide = metrics.QFONTMETRICS_WIDTH(QString("TD"));

QPoint point(pxOffset, pyOffset);
painter.drawImage(point, image); // Draw the image we just generated into the QPainter's canvas
@@ -752,7 +751,7 @@ QImage QEbsdReferenceFrameDialog::paintImage(QImage image)

painter.drawText(pxOffset / 2, pImageHeight / 2 + pxHigh / 3, "Y");

pxWide = metrics.width(QString("X"));
pxWide = metrics.QFONTMETRICS_WIDTH(QString("X"));
painter.drawText(pImageWidth / 2 - pxWide / 2, pImageHeight - pyOffset + pxHigh + 2, "X");

painter.drawText(pxOffset / 2, pImageHeight - pyOffset + pxHigh + 2, "(0,0)");
@@ -38,6 +38,7 @@
#include <QtGui/QDoubleValidator>

#include "OrientationLib/Core/OrientationTransformation.hpp"
#include "OrientationUtilityCalculator.h"

// -----------------------------------------------------------------------------
//
@@ -38,6 +38,7 @@
#include <QtGui/QDoubleValidator>

#include "OrientationLib/Core/OrientationTransformation.hpp"
#include "OrientationUtilityCalculator.h"

// -----------------------------------------------------------------------------
//
@@ -157,7 +157,8 @@ void GenerateFZQuaternions::initialize()
void GenerateFZQuaternions::setupFilterParameters()
{
FilterParameterVectorType parameters;
QVector<QString> choices = QVector<QString>::fromStdVector(LaueOps::GetLaueNames());
std::vector<QString> names = LaueOps::GetLaueNames();
QVECTOR_FROM_STD_VECTOR(QVector<QString>, choices, names)
choices.pop_back(); // Remove the last name because we don't need it.

QStringList linkedProps("GoodVoxelsArrayPath");
@@ -101,7 +101,7 @@ QImage CubicIPFLegendPainter::overlayText(int pixelWidth, int pixelHeight, QImag
painter.setFont(font);
QFontMetrics metrics = painter.fontMetrics();
fontHeight = metrics.height();
fontWidth = metrics.width(ops->getSymmetryName());
fontWidth = metrics.QFONTMETRICS_WIDTH(ops->getSymmetryName());
painter.end();
}

@@ -134,22 +134,22 @@ QImage CubicIPFLegendPainter::overlayText(int pixelWidth, int pixelHeight, QImag

// Draw the [111] label in the Upper Right corner
QString label("[111]");
fontWidth = metrics.width(label);
fontWidth = metrics.QFONTMETRICS_WIDTH(label);
fontHeight = metrics.height();
painter.drawText(pImageWidth - (fontWidth * 1.25), fontHeight * 2, label);

label = QString("[101]");
fontWidth = metrics.width(label);
fontWidth = metrics.QFONTMETRICS_WIDTH(label);
fontHeight = metrics.height();
painter.drawText(pImageWidth - (fontWidth * 1.05), fontHeight * 1.75 + imageSize.height(), label);

label = QString("[001]");
fontWidth = metrics.width(label);
fontWidth = metrics.QFONTMETRICS_WIDTH(label);
fontHeight = metrics.height();
painter.drawText(10, fontHeight*1.75 + imageSize.height(), label);

label = ops->getSymmetryName();
fontWidth = metrics.width(label);
fontWidth = metrics.QFONTMETRICS_WIDTH(label);
fontHeight = metrics.height();
painter.drawText(pImageWidth/2 - fontWidth/2, fontHeight * 1.0, label);

0 comments on commit 53dd731

Please sign in to comment.
You can’t perform that action at this time.