From 09ba6780f027a9426a42ae1ab3104e844641bd71 Mon Sep 17 00:00:00 2001 From: Jim Lieb Date: Sun, 5 Dec 2021 12:27:50 -0800 Subject: [PATCH 1/8] Update QT5 references 5.6 -> 5.15 Builds and runs but now needs deprecated -> current updates. Signed-off-by: Jim Lieb --- CMakeLists.txt | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index c70fcc9..e34f53b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -107,11 +107,11 @@ if (MINGW) set (CMAKE_PREFIX_PATH ${MINGW_BASE_DIR} ) endif () -find_package (Qt5Core 5.6 REQUIRED) -find_package (Qt5Widgets 5.6 REQUIRED) -find_package (Qt5PrintSupport 5.6 REQUIRED) -find_package (Qt5Xml 5.6 REQUIRED) -find_package (Qt5Svg 5.6 REQUIRED) +find_package (Qt5Core 5.15 REQUIRED) +find_package (Qt5Widgets 5.15 REQUIRED) +find_package (Qt5PrintSupport 5.15 REQUIRED) +find_package (Qt5Xml 5.15 REQUIRED) +find_package (Qt5Svg 5.15 REQUIRED) find_package (Qt5LinguistTools) if (WIN32) From fadff6c67e425db6c72a83ae8a3159878e5deb1d Mon Sep 17 00:00:00 2001 From: Jim Lieb Date: Sun, 5 Dec 2021 14:18:48 -0800 Subject: [PATCH 2/8] Update build instructions for Fedora 35 particulars Signed-off-by: Jim Lieb --- docs/BUILD-INSTRUCTIONS-LINUX.md | 29 ++++++++++++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) diff --git a/docs/BUILD-INSTRUCTIONS-LINUX.md b/docs/BUILD-INSTRUCTIONS-LINUX.md index dbc40a0..ee93da0 100644 --- a/docs/BUILD-INSTRUCTIONS-LINUX.md +++ b/docs/BUILD-INSTRUCTIONS-LINUX.md @@ -6,7 +6,7 @@ gLabels Linux Build Instructions - g++ - CMake 2.8.12+ -- Qt5 5.6+ Development Packages ( Qt5Core, Qt5Widgets, Qt5PrintSupport, Qt5Xml, Qt5Svg ) +- Qt5 5.15+ Development Packages ( Qt5Core, Qt5Widgets, Qt5PrintSupport, Qt5Xml, Qt5Svg ) - zlib 1.2+ Development Package > Even if the above library packages are installed, their corresponding development packages @@ -67,3 +67,30 @@ $ cmake .. $ make $ sudo make install ``` +## Example: Fedora 35 + +### Installing Prerequisites +We assume the build system already has things like cmake and the GNU C++ suite installed. + +``` +$ sudo dnf install qt5-qtbase-devel qt5-qtsvg-devel qt5-linguist qt5-qttools +``` +These installs will pull in additional packages to fill out their prerequisites. +Fedora has a different package naming scheme that Ubuntu. This is to distinguish the QT5 +packages from the QT3 and QT4 packages that they still support for compatibility. +If the Cmake pass or build has missing package errors or warnings, you can search for the needed +package with: +``` +$ sudo dnf search qt5 |grep +``` + +### Compile and Install gLabels into /usr/local +``` +$ cd glabels-qt +$ mkdir build +$ cd build +$ cmake .. +$ make +$ sudo make install + +``` \ No newline at end of file From 23c3150f37ba470bd692aabc998cb6bc842fb7ad Mon Sep 17 00:00:00 2001 From: Jim Lieb Date: Mon, 6 Dec 2021 15:04:25 -0800 Subject: [PATCH 3/8] Replace deprecated QtString::sprintf with QtString::arg This was deprecated some revisions prior to 5.15. Signed-off-by: Jim Lieb --- model/FrameCd.cpp | 11 +++-------- model/FrameContinuous.cpp | 10 ++-------- model/FrameEllipse.cpp | 12 ++++-------- model/FramePath.cpp | 12 ++++-------- model/FrameRect.cpp | 12 ++++-------- model/FrameRound.cpp | 11 +++-------- model/StrUtil.cpp | 4 ++-- 7 files changed, 22 insertions(+), 50 deletions(-) diff --git a/model/FrameCd.cpp b/model/FrameCd.cpp index 465ac24..5bd36e7 100644 --- a/model/FrameCd.cpp +++ b/model/FrameCd.cpp @@ -135,17 +135,12 @@ namespace glabels { QString dStr = StrUtil::formatFraction( 2 * mR1.in() ); - return QString().sprintf( "%s %s %s", - qPrintable(dStr), - qPrintable(units.toTrName()), - qPrintable(tr("diameter")) ); + return QString("%1 %2 %3").arg(dStr).arg(units.toTrName()).arg(tr("diameter")); } else { - return QString().sprintf( "%.5g %s %s", - 2 * mR1.inUnits(units), - qPrintable(units.toTrName()), - qPrintable(tr("diameter")) ); + return QString("%1 %2 %3").arg(2 * mR1.inUnits(units), 0, 'g', 5) + .arg(units.toTrName()).arg(tr("diameter")); } } diff --git a/model/FrameContinuous.cpp b/model/FrameContinuous.cpp index 16f2bc7..f196937 100644 --- a/model/FrameContinuous.cpp +++ b/model/FrameContinuous.cpp @@ -90,17 +90,11 @@ namespace glabels { QString wStr = StrUtil::formatFraction( mW.in() ); - return QString().sprintf( "%s %s %s", - qPrintable(wStr), - qPrintable(units.toTrName()), - qPrintable(tr("wide")) ); + return QString("%1 %2 %3").arg(wStr).arg(units.toTrName()).arg(tr("wide")); } else { - return QString().sprintf( "%.3f %s %s", - mW.inUnits(units), - qPrintable(units.toTrName()), - qPrintable(tr("wide")) ); + return QString("%1 %2 %3").arg(mW.inUnits(units), 0, 'f', 3).arg(units.toTrName()).arg(tr("wide")); } } diff --git a/model/FrameEllipse.cpp b/model/FrameEllipse.cpp index 18b3844..6cc98c6 100644 --- a/model/FrameEllipse.cpp +++ b/model/FrameEllipse.cpp @@ -71,17 +71,13 @@ namespace glabels QString wStr = StrUtil::formatFraction( mW.in() ); QString hStr = StrUtil::formatFraction( mH.in() ); - return QString().sprintf( "%s x %s %s", - qPrintable(wStr), - qPrintable(hStr), - qPrintable(units.toTrName()) ); + return QString("%1 x %2 %3").arg(wStr).arg(hStr).arg(units.toTrName()); } else { - return QString().sprintf( "%.5g x %.5g %s", - mW.inUnits(units), - mH.inUnits(units), - qPrintable(units.toTrName()) ); + return QString("%1 x %2 %3").arg(mW.inUnits(units), 0, 'g', 5) + .arg(mH.inUnits(units), 0, 'g', 5) + .arg(units.toTrName()); } } diff --git a/model/FramePath.cpp b/model/FramePath.cpp index dcf9f41..2e15207 100644 --- a/model/FramePath.cpp +++ b/model/FramePath.cpp @@ -89,17 +89,13 @@ namespace glabels QString wStr = StrUtil::formatFraction( mW.in() ); QString hStr = StrUtil::formatFraction( mH.in() ); - return QString().sprintf( "%s x %s %s", - qPrintable(wStr), - qPrintable(hStr), - qPrintable(units.toTrName()) ); + return QString("%1 x %2 %3").arg(wStr).arg(hStr).arg(units.toTrName()); } else { - return QString().sprintf( "%.5g x %.5g %s", - mW.inUnits(units), - mH.inUnits(units), - qPrintable(units.toTrName()) ); + return QString("%1 x %2 %3").arg(mW.inUnits(units), 0, 'g', 5) + .arg(mH.inUnits(units), 0, 'g', 5) + .arg(units.toTrName()); } } diff --git a/model/FrameRect.cpp b/model/FrameRect.cpp index 204eb74..b5701e9 100644 --- a/model/FrameRect.cpp +++ b/model/FrameRect.cpp @@ -88,17 +88,13 @@ namespace glabels QString wStr = StrUtil::formatFraction( mW.in() ); QString hStr = StrUtil::formatFraction( mH.in() ); - return QString().sprintf( "%s x %s %s", - qPrintable(wStr), - qPrintable(hStr), - qPrintable(units.toTrName()) ); + return QString("%1 x %2 %3").arg(wStr).arg(hStr).arg(units.toTrName()); } else { - return QString().sprintf( "%.5g x %.5g %s", - mW.inUnits(units), - mH.inUnits(units), - qPrintable(units.toTrName()) ); + return QString("%1 x %2 %3").arg(mW.inUnits(units), 0, 'g', 5) + .arg(mH.inUnits(units), 0, 'g', 5) + .arg(units.toTrName()); } } diff --git a/model/FrameRound.cpp b/model/FrameRound.cpp index b1c4f7b..dd7fad0 100644 --- a/model/FrameRound.cpp +++ b/model/FrameRound.cpp @@ -76,17 +76,12 @@ namespace glabels { QString dStr = StrUtil::formatFraction( 2 * mR.in() ); - return QString().sprintf( "%s %s %s", - qPrintable(dStr), - qPrintable(units.toTrName()), - qPrintable(tr("diameter")) ); + return QString("%1 %2 %3").arg(dStr).arg(units.toTrName()).arg(tr("diameter")); } else { - return QString().sprintf( "%.5g %s %s", - 2 * mR.inUnits(units), - qPrintable(units.toTrName()), - qPrintable(tr("diameter")) ); + return QString("%1 %2 %3").arg(2 * mR.inUnits(units), 0, 'g', 5) + .arg(units.toTrName()).arg(tr("diameter")); } } diff --git a/model/StrUtil.cpp b/model/StrUtil.cpp index 169f7cd..a5c4efc 100644 --- a/model/StrUtil.cpp +++ b/model/StrUtil.cpp @@ -61,12 +61,12 @@ namespace glabels if ( denom[i] == 0.0 ) { /* None of our denominators work. */ - return QString().sprintf( "%.3f", x ); + return QString("%1").arg(x, 0, 'f', 3 ); } if ( denom[i] == 1.0 ) { /* Simple integer. */ - return QString().sprintf( "%.0f", x ); + return QString().arg(x, 0, 'f', 0); } auto n = int( x * denom[i] + 0.5 ); auto d = int( denom[i] ); From 7e1cad0561d37c05332044309e6fd658d248361a Mon Sep 17 00:00:00 2001 From: Jim Lieb Date: Mon, 6 Dec 2021 15:40:47 -0800 Subject: [PATCH 4/8] Replace deprecated QtString::SkipEmptyParts with Qt::SkipEmptyParts Builds now with 5.15 Signed-off-by: Jim Lieb --- model/XmlTemplateParser.cpp | 2 +- model/XmlUtil.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/model/XmlTemplateParser.cpp b/model/XmlTemplateParser.cpp index 561a4dd..88c97e5 100644 --- a/model/XmlTemplateParser.cpp +++ b/model/XmlTemplateParser.cpp @@ -117,7 +117,7 @@ namespace glabels QString name = XmlUtil::getStringAttr( node, "name", "" ); if ( name != "" ) { - QStringList fields = name.split( " ", QString::SkipEmptyParts ); + QStringList fields = name.split( " ", Qt::SkipEmptyParts ); brand = fields[0]; part = fields[1]; } diff --git a/model/XmlUtil.cpp b/model/XmlUtil.cpp index 04f58cb..1cfa8d0 100644 --- a/model/XmlUtil.cpp +++ b/model/XmlUtil.cpp @@ -372,7 +372,7 @@ namespace glabels // // Simple path data parser // - QStringList tokens = node.attribute( name, "" ).split( " ", QString::SkipEmptyParts ); + QStringList tokens = node.attribute( name, "" ).split( " ", Qt::SkipEmptyParts ); enum { CMD, MX, MY, MDX, MDY, LX, LY, LDX, LDY, HX, HDX, VY, VDY } state = CMD; Distance x = 0; From 5de23647dec701aaaa527e3f70ad3a3e3f5adb64 Mon Sep 17 00:00:00 2001 From: Jim Lieb Date: Mon, 6 Dec 2021 16:44:44 -0800 Subject: [PATCH 5/8] Replace deprecated QPrinter::setPageMargins with 5.15 version Signed-off-by: Jim Lieb --- model/PageRenderer.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/model/PageRenderer.cpp b/model/PageRenderer.cpp index f4a992d..e7e3513 100644 --- a/model/PageRenderer.cpp +++ b/model/PageRenderer.cpp @@ -238,7 +238,7 @@ namespace glabels QSizeF pageSize( mModel->tmplate()->pageWidth().pt(), mModel->tmplate()->pageHeight().pt() ); printer->setPageSize( QPageSize(pageSize, QPageSize::Point) ); printer->setFullPage( true ); - printer->setPageMargins( 0, 0, 0, 0, QPrinter::Point ); + printer->setPageMargins( QMarginsF(0, 0, 0, 0), QPageLayout::Point ); QPainter painter( printer ); From 90573dd846e298c6ba0405f549d1a8d78bcbfd6c Mon Sep 17 00:00:00 2001 From: Jim Lieb Date: Mon, 6 Dec 2021 17:42:33 -0800 Subject: [PATCH 6/8] Replace deprecated QImage::byteCount() with QImage::sizeInBytes() This could be problematic if qsizetype differs from int Signed-off-by: Jim Lieb --- model/ModelImageObject.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/model/ModelImageObject.cpp b/model/ModelImageObject.cpp index 3de2438..f0377c2 100644 --- a/model/ModelImageObject.cpp +++ b/model/ModelImageObject.cpp @@ -316,7 +316,7 @@ namespace glabels } mImage = new QImage(value); - quint16 cs = qChecksum( (const char*)mImage->constBits(), mImage->byteCount() ); + quint16 cs = qChecksum( (const char*)mImage->constBits(), mImage->sizeInBytes() ); mFilenameNode = TextNode( false, QString("%image_%1%").arg( cs ) ); emit changed(); From cf6276cf4be3c9f8f02d7482bb3594f9c3a6262e Mon Sep 17 00:00:00 2001 From: Jim Lieb Date: Tue, 7 Dec 2021 09:43:25 -0800 Subject: [PATCH 7/8] Replace deprecated endl with QT::endl Signed-off-by: Jim Lieb --- translations/XmlStrings.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/translations/XmlStrings.cpp b/translations/XmlStrings.cpp index b25b701..9ee0200 100644 --- a/translations/XmlStrings.cpp +++ b/translations/XmlStrings.cpp @@ -92,17 +92,17 @@ int main( int argc, char *argv[] ) QTextStream out( stdout ); - out << "// Automatically generated with " << app.arguments().at(0) << endl; - out << "//" << endl; - out << "// Sources:" << endl; + out << "// Automatically generated with " << app.arguments().at(0) << Qt::endl; + out << "//" << Qt::endl; + out << "// Sources:" << Qt::endl; foreach ( QString filename, filenameList ) { - out << "// " << filename << endl; + out << "// " << filename << Qt::endl; } - out << "//" << endl; + out << "//" << Qt::endl; foreach ( QString string, stringList ) { - out << "QT_TRANSLATE_NOOP( \"XmlStrings\", \"" << string << "\" );" << endl; + out << "QT_TRANSLATE_NOOP( \"XmlStrings\", \"" << string << "\" );" << Qt::endl; } } From 5902f8a14e420b74a677555deda5f7b79272cad2 Mon Sep 17 00:00:00 2001 From: Jim Lieb Date: Tue, 7 Dec 2021 16:40:31 -0800 Subject: [PATCH 8/8] Replace deprecated QMatrix with QTransform Signed-off-by: Jim Lieb --- model/ModelBarcodeObject.cpp | 2 +- model/ModelBarcodeObject.h | 2 +- model/ModelBoxObject.cpp | 2 +- model/ModelBoxObject.h | 2 +- model/ModelEllipseObject.cpp | 2 +- model/ModelEllipseObject.h | 2 +- model/ModelImageObject.cpp | 6 +++--- model/ModelImageObject.h | 6 +++--- model/ModelLineObject.cpp | 2 +- model/ModelLineObject.h | 2 +- model/ModelObject.cpp | 20 ++++++++++---------- model/ModelObject.h | 10 +++++----- model/ModelShapeObject.cpp | 2 +- model/ModelShapeObject.h | 2 +- model/ModelTextObject.cpp | 2 +- model/ModelTextObject.h | 2 +- model/XmlLabelCreator.cpp | 2 +- model/XmlLabelParser.cpp | 18 +++++++++--------- model/XmlLabelParser_3.cpp | 2 +- model/XmlLabelParser_3.h | 2 +- model/unit_tests/TestXmlLabel.cpp | 12 ++++++------ 21 files changed, 51 insertions(+), 51 deletions(-) diff --git a/model/ModelBarcodeObject.cpp b/model/ModelBarcodeObject.cpp index ed4f1bf..412ee6d 100644 --- a/model/ModelBarcodeObject.cpp +++ b/model/ModelBarcodeObject.cpp @@ -95,7 +95,7 @@ namespace glabels bool bcChecksumFlag, QString bcData, const ColorNode& bcColorNode, - const QMatrix& matrix ) + const QTransform& matrix ) : ModelObject( x0, y0, w, h, lockAspectRatio, matrix ) { mOutline = new Outline( this ); diff --git a/model/ModelBarcodeObject.h b/model/ModelBarcodeObject.h index 2a49304..bb4e3cc 100644 --- a/model/ModelBarcodeObject.h +++ b/model/ModelBarcodeObject.h @@ -57,7 +57,7 @@ namespace glabels bool bcChecksumFlag, QString bcData, const ColorNode& bcColorNode, - const QMatrix& matrix = QMatrix() ); + const QTransform& matrix = QTransform() ); ModelBarcodeObject( const ModelBarcodeObject* object ); diff --git a/model/ModelBoxObject.cpp b/model/ModelBoxObject.cpp index 4fd66e7..af29b5d 100644 --- a/model/ModelBoxObject.cpp +++ b/model/ModelBoxObject.cpp @@ -58,7 +58,7 @@ namespace glabels const Distance& lineWidth, const ColorNode& lineColorNode, const ColorNode& fillColorNode, - const QMatrix& matrix, + const QTransform& matrix, bool shadowState, const Distance& shadowX, const Distance& shadowY, diff --git a/model/ModelBoxObject.h b/model/ModelBoxObject.h index 21b5826..a66e930 100644 --- a/model/ModelBoxObject.h +++ b/model/ModelBoxObject.h @@ -51,7 +51,7 @@ namespace glabels const Distance& lineWidth, const ColorNode& lineColorNode, const ColorNode& fillColorNode, - const QMatrix& matrix = QMatrix(), + const QTransform& matrix = QTransform(), bool shadowState = false, const Distance& shadowX = 0, const Distance& shadowY = 0, diff --git a/model/ModelEllipseObject.cpp b/model/ModelEllipseObject.cpp index 7e35791..0bc4260 100644 --- a/model/ModelEllipseObject.cpp +++ b/model/ModelEllipseObject.cpp @@ -58,7 +58,7 @@ namespace glabels const Distance& lineWidth, const ColorNode& lineColorNode, const ColorNode& fillColorNode, - const QMatrix& matrix, + const QTransform& matrix, bool shadowState, const Distance& shadowX, const Distance& shadowY, diff --git a/model/ModelEllipseObject.h b/model/ModelEllipseObject.h index 26ae6d4..05c2283 100644 --- a/model/ModelEllipseObject.h +++ b/model/ModelEllipseObject.h @@ -51,7 +51,7 @@ namespace glabels const Distance& lineWidth, const ColorNode& lineColorNode, const ColorNode& fillColorNode, - const QMatrix& matrix = QMatrix(), + const QTransform& matrix = QTransform(), bool shadowState = false, const Distance& shadowX = 0, const Distance& shadowY = 0, diff --git a/model/ModelImageObject.cpp b/model/ModelImageObject.cpp index f0377c2..90a39e0 100644 --- a/model/ModelImageObject.cpp +++ b/model/ModelImageObject.cpp @@ -85,7 +85,7 @@ namespace glabels const Distance& h, bool lockAspectRatio, const TextNode& filenameNode, - const QMatrix& matrix, + const QTransform& matrix, bool shadowState, const Distance& shadowX, const Distance& shadowY, @@ -130,7 +130,7 @@ namespace glabels bool lockAspectRatio, const QString& filename, const QImage& image, - const QMatrix& matrix, + const QTransform& matrix, bool shadowState, const Distance& shadowX, const Distance& shadowY, @@ -172,7 +172,7 @@ namespace glabels bool lockAspectRatio, const QString& filename, const QByteArray& svg, - const QMatrix& matrix, + const QTransform& matrix, bool shadowState, const Distance& shadowX, const Distance& shadowY, diff --git a/model/ModelImageObject.h b/model/ModelImageObject.h index 3e982f5..ed9079d 100644 --- a/model/ModelImageObject.h +++ b/model/ModelImageObject.h @@ -51,7 +51,7 @@ namespace glabels const Distance& h, bool lockAspectRatio, const TextNode& filenameNode, - const QMatrix& matrix = QMatrix(), + const QTransform& matrix = QTransform(), bool shadowState = false, const Distance& shadowX = 0, const Distance& shadowY = 0, @@ -65,7 +65,7 @@ namespace glabels bool lockAspectRatio, const QString& filename, const QImage& image, - const QMatrix& matrix = QMatrix(), + const QTransform& matrix = QTransform(), bool shadowState = false, const Distance& shadowX = 0, const Distance& shadowY = 0, @@ -79,7 +79,7 @@ namespace glabels bool lockAspectRatio, const QString& filename, const QByteArray& svg, - const QMatrix& matrix = QMatrix(), + const QTransform& matrix = QTransform(), bool shadowState = false, const Distance& shadowX = 0, const Distance& shadowY = 0, diff --git a/model/ModelLineObject.cpp b/model/ModelLineObject.cpp index 5bef065..e0392d1 100644 --- a/model/ModelLineObject.cpp +++ b/model/ModelLineObject.cpp @@ -62,7 +62,7 @@ namespace glabels const Distance& dy, const Distance& lineWidth, const ColorNode& lineColorNode, - const QMatrix& matrix, + const QTransform& matrix, bool shadowState, const Distance& shadowX, const Distance& shadowY, diff --git a/model/ModelLineObject.h b/model/ModelLineObject.h index a09670e..e9d4a82 100644 --- a/model/ModelLineObject.h +++ b/model/ModelLineObject.h @@ -49,7 +49,7 @@ namespace glabels const Distance& h, const Distance& lineWidth, const ColorNode& lineColorNode, - const QMatrix& matrix = QMatrix(), + const QTransform& matrix = QTransform(), bool shadowState = false, const Distance& shadowX = 0, const Distance& shadowY = 0, diff --git a/model/ModelObject.cpp b/model/ModelObject.cpp index 65ed72a..041a5e3 100644 --- a/model/ModelObject.cpp +++ b/model/ModelObject.cpp @@ -52,7 +52,7 @@ namespace glabels mW = 0; mH = 0; mLockAspectRatio = false; - mMatrix = QMatrix(); + mMatrix = QTransform(); mShadowState = false; mShadowX = 1.3; @@ -74,7 +74,7 @@ namespace glabels const Distance& w, const Distance& h, bool lockAspectRatio, - const QMatrix& matrix, + const QTransform& matrix, bool shadowState, const Distance& shadowX, const Distance& shadowY, @@ -301,7 +301,7 @@ namespace glabels /// /// Matrix Property Getter /// - QMatrix ModelObject::matrix() const + QTransform ModelObject::matrix() const { return mMatrix; } @@ -310,7 +310,7 @@ namespace glabels /// /// Matrix Property Setter /// - void ModelObject::setMatrix( const QMatrix& value ) + void ModelObject::setMatrix( const QTransform& value ) { if ( mMatrix != value ) { @@ -1131,7 +1131,7 @@ namespace glabels { if ( thetaDegs != 0 ) { - QMatrix m; + QTransform m; m.rotate( thetaDegs ); mMatrix *= m; @@ -1145,7 +1145,7 @@ namespace glabels /// void ModelObject::flipHoriz() { - QMatrix m; + QTransform m; m.scale( -1, 1 ); mMatrix *= m; @@ -1158,7 +1158,7 @@ namespace glabels /// void ModelObject::flipVert() { - QMatrix m; + QTransform m; m.scale( 1, -1 ); mMatrix *= m; @@ -1238,12 +1238,12 @@ namespace glabels { painter->save(); painter->translate( mShadowX.pt(), mShadowY.pt() ); - painter->setMatrix( mMatrix, true ); + painter->setTransform( mMatrix, true ); drawShadow( painter, inEditor, record, variables ); painter->restore(); } - painter->setMatrix( mMatrix, true ); + painter->setTransform( mMatrix, true ); drawObject( painter, inEditor, record, variables ); painter->restore(); @@ -1258,7 +1258,7 @@ namespace glabels painter->save(); painter->translate( mX0.pt(), mY0.pt() ); - painter->setMatrix( mMatrix, true ); + painter->setTransform( mMatrix, true ); if ( mOutline ) { diff --git a/model/ModelObject.h b/model/ModelObject.h index 4962ffd..6dbccad 100644 --- a/model/ModelObject.h +++ b/model/ModelObject.h @@ -34,7 +34,7 @@ #include #include -#include +#include #include @@ -66,7 +66,7 @@ namespace glabels const Distance& w, const Distance& h, bool lockAspectRatio = false, - const QMatrix& matrix = QMatrix(), + const QTransform& matrix = QTransform(), bool shadowState = false, const Distance& shadowX = 0, const Distance& shadowY = 0, @@ -148,8 +148,8 @@ namespace glabels // // Transformation Matrix Property // - QMatrix matrix() const; - void setMatrix( const QMatrix& value ); + QTransform matrix() const; + void setMatrix( const QTransform& value ); // @@ -464,7 +464,7 @@ namespace glabels static int msNextId; int mId; - QMatrix mMatrix; + QTransform mMatrix; }; diff --git a/model/ModelShapeObject.cpp b/model/ModelShapeObject.cpp index afca487..3a4e949 100644 --- a/model/ModelShapeObject.cpp +++ b/model/ModelShapeObject.cpp @@ -62,7 +62,7 @@ namespace glabels const Distance& lineWidth, const ColorNode& lineColorNode, const ColorNode& fillColorNode, - const QMatrix& matrix, + const QTransform& matrix, bool shadowState, const Distance& shadowX, const Distance& shadowY, diff --git a/model/ModelShapeObject.h b/model/ModelShapeObject.h index 888ac03..8a80210 100644 --- a/model/ModelShapeObject.h +++ b/model/ModelShapeObject.h @@ -51,7 +51,7 @@ namespace glabels const Distance& lineWidth, const ColorNode& lineColorNode, const ColorNode& fillColorNode, - const QMatrix& matrix, + const QTransform& matrix, bool shadowState, const Distance& shadowX, const Distance& shadowY, diff --git a/model/ModelTextObject.cpp b/model/ModelTextObject.cpp index bb5c7e6..9931ed1 100644 --- a/model/ModelTextObject.cpp +++ b/model/ModelTextObject.cpp @@ -95,7 +95,7 @@ namespace glabels QTextOption::WrapMode textWrapMode, double textLineSpacing, bool textAutoShrink, - const QMatrix& matrix, + const QTransform& matrix, bool shadowState, const Distance& shadowX, const Distance& shadowY, diff --git a/model/ModelTextObject.h b/model/ModelTextObject.h index 0f7d1e9..7a0aa5e 100644 --- a/model/ModelTextObject.h +++ b/model/ModelTextObject.h @@ -63,7 +63,7 @@ namespace glabels QTextOption::WrapMode textWrapMode, double textLineSpacing, bool textAutoShrink, - const QMatrix& matrix = QMatrix(), + const QTransform& matrix = QTransform(), bool shadowState = false, const Distance& shadowX = 0, const Distance& shadowY = 0, diff --git a/model/XmlLabelCreator.cpp b/model/XmlLabelCreator.cpp index b7f7cc9..87c277d 100644 --- a/model/XmlLabelCreator.cpp +++ b/model/XmlLabelCreator.cpp @@ -437,7 +437,7 @@ namespace glabels void XmlLabelCreator::createAffineAttrs( QDomElement &node, const ModelObject* object ) { - QMatrix a = object->matrix(); + QTransform a = object->matrix(); XmlUtil::setDoubleAttr( node, "a0", a.m11() ); XmlUtil::setDoubleAttr( node, "a1", a.m12() ); diff --git a/model/XmlLabelParser.cpp b/model/XmlLabelParser.cpp index fce0f2d..8b63175 100644 --- a/model/XmlLabelParser.cpp +++ b/model/XmlLabelParser.cpp @@ -407,7 +407,7 @@ namespace glabels return new ModelBoxObject( x0, y0, w, h, lockAspectRatio, lineWidth, lineColorNode, fillColorNode, - QMatrix( a[0], a[1], a[2], a[3], a[4], a[5] ), + QTransform( a[0], a[1], a[2], a[3], a[4], a[5] ), shadowState, shadowX, shadowY, shadowOpacity, shadowColorNode ); } @@ -461,7 +461,7 @@ namespace glabels return new ModelEllipseObject( x0, y0, w, h, lockAspectRatio, lineWidth, lineColorNode, fillColorNode, - QMatrix( a[0], a[1], a[2], a[3], a[4], a[5] ), + QTransform( a[0], a[1], a[2], a[3], a[4], a[5] ), shadowState, shadowX, shadowY, shadowOpacity, shadowColorNode ); } @@ -507,7 +507,7 @@ namespace glabels return new ModelLineObject( x0, y0, dx, dy, lineWidth, lineColorNode, - QMatrix( a[0], a[1], a[2], a[3], a[4], a[5] ), + QTransform( a[0], a[1], a[2], a[3], a[4], a[5] ), shadowState, shadowX, shadowY, shadowOpacity, shadowColorNode ); } @@ -556,7 +556,7 @@ namespace glabels { return new ModelImageObject( x0, y0, w, h, lockAspectRatio, filenameNode, - QMatrix( a[0], a[1], a[2], a[3], a[4], a[5] ), + QTransform( a[0], a[1], a[2], a[3], a[4], a[5] ), shadowState, shadowX, shadowY, shadowOpacity, shadowColorNode ); } else @@ -567,14 +567,14 @@ namespace glabels { return new ModelImageObject( x0, y0, w, h, lockAspectRatio, filename, data.getImage( fn ), - QMatrix( a[0], a[1], a[2], a[3], a[4], a[5] ), + QTransform( a[0], a[1], a[2], a[3], a[4], a[5] ), shadowState, shadowX, shadowY, shadowOpacity, shadowColorNode ); } else if ( data.hasSvg( fn ) ) { return new ModelImageObject( x0, y0, w, h, lockAspectRatio, filename, data.getSvg( fn ), - QMatrix( a[0], a[1], a[2], a[3], a[4], a[5] ), + QTransform( a[0], a[1], a[2], a[3], a[4], a[5] ), shadowState, shadowX, shadowY, shadowOpacity, shadowColorNode ); } else @@ -586,7 +586,7 @@ namespace glabels } return new ModelImageObject( x0, y0, w, h, lockAspectRatio, filenameNode, - QMatrix( a[0], a[1], a[2], a[3], a[4], a[5] ), + QTransform( a[0], a[1], a[2], a[3], a[4], a[5] ), shadowState, shadowX, shadowY, shadowOpacity, shadowColorNode ); } } @@ -629,7 +629,7 @@ namespace glabels return new ModelBarcodeObject( x0, y0, w, h, lockAspectRatio, bcStyle, bcTextFlag, bcChecksumFlag, bcData, bcColorNode, - QMatrix( a[0], a[1], a[2], a[3], a[4], a[5] ) ); + QTransform( a[0], a[1], a[2], a[3], a[4], a[5] ) ); } @@ -714,7 +714,7 @@ namespace glabels fontFamily, fontSize, fontWeight, fontItalicFlag, fontUnderlineFlag, textColorNode, textHAlign, textVAlign, textWrapMode, textLineSpacing, textAutoShrink, - QMatrix( a[0], a[1], a[2], a[3], a[4], a[5] ), + QTransform( a[0], a[1], a[2], a[3], a[4], a[5] ), shadowState, shadowX, shadowY, shadowOpacity, shadowColorNode ); } diff --git a/model/XmlLabelParser_3.cpp b/model/XmlLabelParser_3.cpp index fe129d8..d68ab74 100644 --- a/model/XmlLabelParser_3.cpp +++ b/model/XmlLabelParser_3.cpp @@ -450,7 +450,7 @@ namespace glabels } - QMatrix + QTransform XmlLabelParser_3::parseAffineTransformation(const QDomElement &node) { return {XmlUtil::getDoubleAttr( node, "a0", 1.0 ), diff --git a/model/XmlLabelParser_3.h b/model/XmlLabelParser_3.h index b7484fb..e8cc4a7 100644 --- a/model/XmlLabelParser_3.h +++ b/model/XmlLabelParser_3.h @@ -74,7 +74,7 @@ namespace glabels static QFont::Weight getWeightAttr( const QDomElement& node, const QString& name, const QFont::Weight default_value ); - static QMatrix parseAffineTransformation(const QDomElement &node); + static QTransform parseAffineTransformation(const QDomElement &node); }; diff --git a/model/unit_tests/TestXmlLabel.cpp b/model/unit_tests/TestXmlLabel.cpp index e70221f..95fa2f7 100644 --- a/model/unit_tests/TestXmlLabel.cpp +++ b/model/unit_tests/TestXmlLabel.cpp @@ -98,7 +98,7 @@ void TestXmlLabel::serializeDeserialize() bool lock = true, noLock = false, shadow = true, noShadow = false; ColorNode black( Qt::black ), white( Qt::white ), red( Qt::red ), green( Qt::green ), blue( Qt::blue ); - QMatrix tMatrix( 1, 0, 0, 1, 50.0, 50.0 ), sMatrix( 0.5, 0, 0, 1.0, 0, 0 ); + QTransform tMatrix( 1, 0, 0, 1, 50.0, 50.0 ), sMatrix( 0.5, 0, 0, 1.0, 0, 0 ); Style bcStyle = Backends::defaultStyle(); objects << new ModelBoxObject( 0, 1, 10, 20, lock, 2, red, green, tMatrix, shadow, 1, 2, 0.7, black ); @@ -252,7 +252,7 @@ void TestXmlLabel::writeReadFile() bool lock = true, noLock = false, shadow = true, noShadow = false; ColorNode black( Qt::black ), white( Qt::white ), red( Qt::red ), green( Qt::green ), blue( Qt::blue ); - QMatrix tMatrix( 1, 0, 0, 1, 50.0, 50.0 ), sMatrix( 0.5, 0, 0, 1.0, 0, 0 ); + QTransform tMatrix( 1, 0, 0, 1, 50.0, 50.0 ), sMatrix( 0.5, 0, 0, 1.0, 0, 0 ); Style bcStyle = Backends::defaultStyle(); /// @@ -537,7 +537,7 @@ void TestXmlLabel::parser_3ReadFile() QCOMPARE( modelTextObject0->y0().in(), 0.2625 ); // Width and height set to naturalSize() QCOMPARE( modelTextObject0->lockAspectRatio(), false ); - QCOMPARE( modelTextObject0->matrix(), QMatrix( 1, 0, 0, 1, 0, 0 ) ); + QCOMPARE( modelTextObject0->matrix(), QTransform( 1, 0, 0, 1, 0, 0 ) ); QCOMPARE( modelTextObject0->shadow(), false ); QCOMPARE( modelTextObject0->text(), QString( "Hello, my name is" ) ); QCOMPARE( modelTextObject0->fontFamily(), QString( "Sans" ) ); @@ -555,7 +555,7 @@ void TestXmlLabel::parser_3ReadFile() QCOMPARE( modelTextObject1->y0().in(), 0.645 ); // Width and height set to naturalSize() QCOMPARE( modelTextObject1->lockAspectRatio(), false ); - QCOMPARE( modelTextObject1->matrix(), QMatrix( 1, 0, 0, 1, 0, 0 ) ); + QCOMPARE( modelTextObject1->matrix(), QTransform( 1, 0, 0, 1, 0, 0 ) ); QCOMPARE( modelTextObject1->shadow(), false ); QCOMPARE( modelTextObject1->text(), QString( "${Name}" ) ); QCOMPARE( modelTextObject1->fontFamily(), QString( "Sans" ) ); @@ -573,7 +573,7 @@ void TestXmlLabel::parser_3ReadFile() QCOMPARE( modelTextObject2->y0().in(), 1.14 ); // Width and height set to naturalSize() QCOMPARE( modelTextObject2->lockAspectRatio(), false ); - QCOMPARE( modelTextObject2->matrix(), QMatrix( 1, 0, 0, 1, 0, 0 ) ); + QCOMPARE( modelTextObject2->matrix(), QTransform( 1, 0, 0, 1, 0, 0 ) ); QCOMPARE( modelTextObject2->shadow(), false ); QCOMPARE( modelTextObject2->text(), QString( "Department: ${Department}" ) ); QCOMPARE( modelTextObject2->fontFamily(), QString( "Sans" ) ); @@ -592,7 +592,7 @@ void TestXmlLabel::parser_3ReadFile() QCOMPARE( modelBarcodeObject3->w().in(), 3.06944 ); QCOMPARE( modelBarcodeObject3->h().in(), 0.847222 ); QCOMPARE( modelBarcodeObject3->lockAspectRatio(), false ); - QCOMPARE( modelBarcodeObject3->matrix(), QMatrix( 1, 0, 0, 1, 0, 0 ) ); + QCOMPARE( modelBarcodeObject3->matrix(), QTransform( 1, 0, 0, 1, 0, 0 ) ); QCOMPARE( modelBarcodeObject3->shadow(), false ); QCOMPARE( modelBarcodeObject3->bcData(), QString( "${SN}" ) );