Update Qt dependency from QT 5.6 to QT 5.15 (#162)

* Update QT5 references 5.6 -> 5.15

Builds and runs but now needs deprecated -> current updates.

Signed-off-by: Jim Lieb <lieb@sea-troll.net>

* Update build instructions for Fedora 35 particulars

Signed-off-by: Jim Lieb <lieb@sea-troll.net>

* Replace deprecated QtString::sprintf with QtString::arg

This was deprecated some revisions prior to 5.15.

Signed-off-by: Jim Lieb <lieb@sea-troll.net>

* Replace deprecated QtString::SkipEmptyParts with Qt::SkipEmptyParts

Builds now with 5.15

Signed-off-by: Jim Lieb <lieb@sea-troll.net>

* Replace deprecated QPrinter::setPageMargins with 5.15 version

Signed-off-by: Jim Lieb <lieb@sea-troll.net>

* Replace deprecated QImage::byteCount() with QImage::sizeInBytes()

This could be problematic if qsizetype differs from int

Signed-off-by: Jim Lieb <lieb@sea-troll.net>

* Replace deprecated endl with QT::endl

Signed-off-by: Jim Lieb <lieb@sea-troll.net>

* Replace deprecated QMatrix with QTransform

Signed-off-by: Jim Lieb <lieb@sea-troll.net>

---------

Signed-off-by: Jim Lieb <lieb@sea-troll.net>
This commit is contained in:
Jim Lieb
2025-04-28 19:16:28 -07:00
committed by GitHub
parent 7f98f1e308
commit be567f90eb
34 changed files with 116 additions and 117 deletions
+5 -5
View File
@@ -111,11 +111,11 @@ if (MINGW)
set (CMAKE_PREFIX_PATH ${MINGW_BASE_DIR} ) set (CMAKE_PREFIX_PATH ${MINGW_BASE_DIR} )
endif () endif ()
find_package (Qt5Core 5.6 REQUIRED) find_package (Qt5Core 5.15 REQUIRED)
find_package (Qt5Widgets 5.6 REQUIRED) find_package (Qt5Widgets 5.15 REQUIRED)
find_package (Qt5PrintSupport 5.6 REQUIRED) find_package (Qt5PrintSupport 5.15 REQUIRED)
find_package (Qt5Xml 5.6 REQUIRED) find_package (Qt5Xml 5.15 REQUIRED)
find_package (Qt5Svg 5.6 REQUIRED) find_package (Qt5Svg 5.15 REQUIRED)
find_package (Qt5LinguistTools) find_package (Qt5LinguistTools)
if (WIN32) if (WIN32)
+28 -1
View File
@@ -6,7 +6,7 @@ gLabels Linux Build Instructions
- g++ - g++
- CMake 2.8.12+ - 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 - zlib 1.2+ Development Package
> Even if the above library packages are installed, their corresponding development packages > Even if the above library packages are installed, their corresponding development packages
@@ -67,3 +67,30 @@ $ cmake ..
$ make $ make
$ sudo make install $ 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 <package name substring>
```
### Compile and Install gLabels into /usr/local
```
$ cd glabels-qt
$ mkdir build
$ cd build
$ cmake ..
$ make
$ sudo make install
```
+3 -8
View File
@@ -135,17 +135,12 @@ namespace glabels
{ {
QString dStr = StrUtil::formatFraction( 2 * mR1.in() ); QString dStr = StrUtil::formatFraction( 2 * mR1.in() );
return QString().sprintf( "%s %s %s", return QString("%1 %2 %3").arg(dStr).arg(units.toTrName()).arg(tr("diameter"));
qPrintable(dStr),
qPrintable(units.toTrName()),
qPrintable(tr("diameter")) );
} }
else else
{ {
return QString().sprintf( "%.5g %s %s", return QString("%1 %2 %3").arg(2 * mR1.inUnits(units), 0, 'g', 5)
2 * mR1.inUnits(units), .arg(units.toTrName()).arg(tr("diameter"));
qPrintable(units.toTrName()),
qPrintable(tr("diameter")) );
} }
} }
+2 -8
View File
@@ -90,17 +90,11 @@ namespace glabels
{ {
QString wStr = StrUtil::formatFraction( mW.in() ); QString wStr = StrUtil::formatFraction( mW.in() );
return QString().sprintf( "%s %s %s", return QString("%1 %2 %3").arg(wStr).arg(units.toTrName()).arg(tr("wide"));
qPrintable(wStr),
qPrintable(units.toTrName()),
qPrintable(tr("wide")) );
} }
else else
{ {
return QString().sprintf( "%.3f %s %s", return QString("%1 %2 %3").arg(mW.inUnits(units), 0, 'f', 3).arg(units.toTrName()).arg(tr("wide"));
mW.inUnits(units),
qPrintable(units.toTrName()),
qPrintable(tr("wide")) );
} }
} }
+4 -8
View File
@@ -71,17 +71,13 @@ namespace glabels
QString wStr = StrUtil::formatFraction( mW.in() ); QString wStr = StrUtil::formatFraction( mW.in() );
QString hStr = StrUtil::formatFraction( mH.in() ); QString hStr = StrUtil::formatFraction( mH.in() );
return QString().sprintf( "%s x %s %s", return QString("%1 x %2 %3").arg(wStr).arg(hStr).arg(units.toTrName());
qPrintable(wStr),
qPrintable(hStr),
qPrintable(units.toTrName()) );
} }
else else
{ {
return QString().sprintf( "%.5g x %.5g %s", return QString("%1 x %2 %3").arg(mW.inUnits(units), 0, 'g', 5)
mW.inUnits(units), .arg(mH.inUnits(units), 0, 'g', 5)
mH.inUnits(units), .arg(units.toTrName());
qPrintable(units.toTrName()) );
} }
} }
+4 -8
View File
@@ -89,17 +89,13 @@ namespace glabels
QString wStr = StrUtil::formatFraction( mW.in() ); QString wStr = StrUtil::formatFraction( mW.in() );
QString hStr = StrUtil::formatFraction( mH.in() ); QString hStr = StrUtil::formatFraction( mH.in() );
return QString().sprintf( "%s x %s %s", return QString("%1 x %2 %3").arg(wStr).arg(hStr).arg(units.toTrName());
qPrintable(wStr),
qPrintable(hStr),
qPrintable(units.toTrName()) );
} }
else else
{ {
return QString().sprintf( "%.5g x %.5g %s", return QString("%1 x %2 %3").arg(mW.inUnits(units), 0, 'g', 5)
mW.inUnits(units), .arg(mH.inUnits(units), 0, 'g', 5)
mH.inUnits(units), .arg(units.toTrName());
qPrintable(units.toTrName()) );
} }
} }
+4 -8
View File
@@ -88,17 +88,13 @@ namespace glabels
QString wStr = StrUtil::formatFraction( mW.in() ); QString wStr = StrUtil::formatFraction( mW.in() );
QString hStr = StrUtil::formatFraction( mH.in() ); QString hStr = StrUtil::formatFraction( mH.in() );
return QString().sprintf( "%s x %s %s", return QString("%1 x %2 %3").arg(wStr).arg(hStr).arg(units.toTrName());
qPrintable(wStr),
qPrintable(hStr),
qPrintable(units.toTrName()) );
} }
else else
{ {
return QString().sprintf( "%.5g x %.5g %s", return QString("%1 x %2 %3").arg(mW.inUnits(units), 0, 'g', 5)
mW.inUnits(units), .arg(mH.inUnits(units), 0, 'g', 5)
mH.inUnits(units), .arg(units.toTrName());
qPrintable(units.toTrName()) );
} }
} }
+3 -8
View File
@@ -76,17 +76,12 @@ namespace glabels
{ {
QString dStr = StrUtil::formatFraction( 2 * mR.in() ); QString dStr = StrUtil::formatFraction( 2 * mR.in() );
return QString().sprintf( "%s %s %s", return QString("%1 %2 %3").arg(dStr).arg(units.toTrName()).arg(tr("diameter"));
qPrintable(dStr),
qPrintable(units.toTrName()),
qPrintable(tr("diameter")) );
} }
else else
{ {
return QString().sprintf( "%.5g %s %s", return QString("%1 %2 %3").arg(2 * mR.inUnits(units), 0, 'g', 5)
2 * mR.inUnits(units), .arg(units.toTrName()).arg(tr("diameter"));
qPrintable(units.toTrName()),
qPrintable(tr("diameter")) );
} }
} }
+1 -1
View File
@@ -95,7 +95,7 @@ namespace glabels
bool bcChecksumFlag, bool bcChecksumFlag,
QString bcData, QString bcData,
const ColorNode& bcColorNode, const ColorNode& bcColorNode,
const QMatrix& matrix ) const QTransform& matrix )
: ModelObject( x0, y0, w, h, lockAspectRatio, matrix ) : ModelObject( x0, y0, w, h, lockAspectRatio, matrix )
{ {
mOutline = new Outline( this ); mOutline = new Outline( this );
+1 -1
View File
@@ -57,7 +57,7 @@ namespace glabels
bool bcChecksumFlag, bool bcChecksumFlag,
QString bcData, QString bcData,
const ColorNode& bcColorNode, const ColorNode& bcColorNode,
const QMatrix& matrix = QMatrix() ); const QTransform& matrix = QTransform() );
ModelBarcodeObject( const ModelBarcodeObject* object ); ModelBarcodeObject( const ModelBarcodeObject* object );
+1 -1
View File
@@ -58,7 +58,7 @@ namespace glabels
const Distance& lineWidth, const Distance& lineWidth,
const ColorNode& lineColorNode, const ColorNode& lineColorNode,
const ColorNode& fillColorNode, const ColorNode& fillColorNode,
const QMatrix& matrix, const QTransform& matrix,
bool shadowState, bool shadowState,
const Distance& shadowX, const Distance& shadowX,
const Distance& shadowY, const Distance& shadowY,
+1 -1
View File
@@ -51,7 +51,7 @@ namespace glabels
const Distance& lineWidth, const Distance& lineWidth,
const ColorNode& lineColorNode, const ColorNode& lineColorNode,
const ColorNode& fillColorNode, const ColorNode& fillColorNode,
const QMatrix& matrix = QMatrix(), const QTransform& matrix = QTransform(),
bool shadowState = false, bool shadowState = false,
const Distance& shadowX = 0, const Distance& shadowX = 0,
const Distance& shadowY = 0, const Distance& shadowY = 0,
+1 -1
View File
@@ -58,7 +58,7 @@ namespace glabels
const Distance& lineWidth, const Distance& lineWidth,
const ColorNode& lineColorNode, const ColorNode& lineColorNode,
const ColorNode& fillColorNode, const ColorNode& fillColorNode,
const QMatrix& matrix, const QTransform& matrix,
bool shadowState, bool shadowState,
const Distance& shadowX, const Distance& shadowX,
const Distance& shadowY, const Distance& shadowY,
+1 -1
View File
@@ -51,7 +51,7 @@ namespace glabels
const Distance& lineWidth, const Distance& lineWidth,
const ColorNode& lineColorNode, const ColorNode& lineColorNode,
const ColorNode& fillColorNode, const ColorNode& fillColorNode,
const QMatrix& matrix = QMatrix(), const QTransform& matrix = QTransform(),
bool shadowState = false, bool shadowState = false,
const Distance& shadowX = 0, const Distance& shadowX = 0,
const Distance& shadowY = 0, const Distance& shadowY = 0,
+4 -4
View File
@@ -85,7 +85,7 @@ namespace glabels
const Distance& h, const Distance& h,
bool lockAspectRatio, bool lockAspectRatio,
const TextNode& filenameNode, const TextNode& filenameNode,
const QMatrix& matrix, const QTransform& matrix,
bool shadowState, bool shadowState,
const Distance& shadowX, const Distance& shadowX,
const Distance& shadowY, const Distance& shadowY,
@@ -130,7 +130,7 @@ namespace glabels
bool lockAspectRatio, bool lockAspectRatio,
const QString& filename, const QString& filename,
const QImage& image, const QImage& image,
const QMatrix& matrix, const QTransform& matrix,
bool shadowState, bool shadowState,
const Distance& shadowX, const Distance& shadowX,
const Distance& shadowY, const Distance& shadowY,
@@ -172,7 +172,7 @@ namespace glabels
bool lockAspectRatio, bool lockAspectRatio,
const QString& filename, const QString& filename,
const QByteArray& svg, const QByteArray& svg,
const QMatrix& matrix, const QTransform& matrix,
bool shadowState, bool shadowState,
const Distance& shadowX, const Distance& shadowX,
const Distance& shadowY, const Distance& shadowY,
@@ -316,7 +316,7 @@ namespace glabels
} }
mImage = new QImage(value); 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 ) ); mFilenameNode = TextNode( false, QString("%image_%1%").arg( cs ) );
emit changed(); emit changed();
+3 -3
View File
@@ -51,7 +51,7 @@ namespace glabels
const Distance& h, const Distance& h,
bool lockAspectRatio, bool lockAspectRatio,
const TextNode& filenameNode, const TextNode& filenameNode,
const QMatrix& matrix = QMatrix(), const QTransform& matrix = QTransform(),
bool shadowState = false, bool shadowState = false,
const Distance& shadowX = 0, const Distance& shadowX = 0,
const Distance& shadowY = 0, const Distance& shadowY = 0,
@@ -65,7 +65,7 @@ namespace glabels
bool lockAspectRatio, bool lockAspectRatio,
const QString& filename, const QString& filename,
const QImage& image, const QImage& image,
const QMatrix& matrix = QMatrix(), const QTransform& matrix = QTransform(),
bool shadowState = false, bool shadowState = false,
const Distance& shadowX = 0, const Distance& shadowX = 0,
const Distance& shadowY = 0, const Distance& shadowY = 0,
@@ -79,7 +79,7 @@ namespace glabels
bool lockAspectRatio, bool lockAspectRatio,
const QString& filename, const QString& filename,
const QByteArray& svg, const QByteArray& svg,
const QMatrix& matrix = QMatrix(), const QTransform& matrix = QTransform(),
bool shadowState = false, bool shadowState = false,
const Distance& shadowX = 0, const Distance& shadowX = 0,
const Distance& shadowY = 0, const Distance& shadowY = 0,
+1 -1
View File
@@ -62,7 +62,7 @@ namespace glabels
const Distance& dy, const Distance& dy,
const Distance& lineWidth, const Distance& lineWidth,
const ColorNode& lineColorNode, const ColorNode& lineColorNode,
const QMatrix& matrix, const QTransform& matrix,
bool shadowState, bool shadowState,
const Distance& shadowX, const Distance& shadowX,
const Distance& shadowY, const Distance& shadowY,
+1 -1
View File
@@ -49,7 +49,7 @@ namespace glabels
const Distance& h, const Distance& h,
const Distance& lineWidth, const Distance& lineWidth,
const ColorNode& lineColorNode, const ColorNode& lineColorNode,
const QMatrix& matrix = QMatrix(), const QTransform& matrix = QTransform(),
bool shadowState = false, bool shadowState = false,
const Distance& shadowX = 0, const Distance& shadowX = 0,
const Distance& shadowY = 0, const Distance& shadowY = 0,
+10 -10
View File
@@ -52,7 +52,7 @@ namespace glabels
mW = 0; mW = 0;
mH = 0; mH = 0;
mLockAspectRatio = false; mLockAspectRatio = false;
mMatrix = QMatrix(); mMatrix = QTransform();
mShadowState = false; mShadowState = false;
mShadowX = 1.3; mShadowX = 1.3;
@@ -74,7 +74,7 @@ namespace glabels
const Distance& w, const Distance& w,
const Distance& h, const Distance& h,
bool lockAspectRatio, bool lockAspectRatio,
const QMatrix& matrix, const QTransform& matrix,
bool shadowState, bool shadowState,
const Distance& shadowX, const Distance& shadowX,
const Distance& shadowY, const Distance& shadowY,
@@ -301,7 +301,7 @@ namespace glabels
/// ///
/// Matrix Property Getter /// Matrix Property Getter
/// ///
QMatrix ModelObject::matrix() const QTransform ModelObject::matrix() const
{ {
return mMatrix; return mMatrix;
} }
@@ -310,7 +310,7 @@ namespace glabels
/// ///
/// Matrix Property Setter /// Matrix Property Setter
/// ///
void ModelObject::setMatrix( const QMatrix& value ) void ModelObject::setMatrix( const QTransform& value )
{ {
if ( mMatrix != value ) if ( mMatrix != value )
{ {
@@ -1131,7 +1131,7 @@ namespace glabels
{ {
if ( thetaDegs != 0 ) if ( thetaDegs != 0 )
{ {
QMatrix m; QTransform m;
m.rotate( thetaDegs ); m.rotate( thetaDegs );
mMatrix *= m; mMatrix *= m;
@@ -1145,7 +1145,7 @@ namespace glabels
/// ///
void ModelObject::flipHoriz() void ModelObject::flipHoriz()
{ {
QMatrix m; QTransform m;
m.scale( -1, 1 ); m.scale( -1, 1 );
mMatrix *= m; mMatrix *= m;
@@ -1158,7 +1158,7 @@ namespace glabels
/// ///
void ModelObject::flipVert() void ModelObject::flipVert()
{ {
QMatrix m; QTransform m;
m.scale( 1, -1 ); m.scale( 1, -1 );
mMatrix *= m; mMatrix *= m;
@@ -1238,12 +1238,12 @@ namespace glabels
{ {
painter->save(); painter->save();
painter->translate( mShadowX.pt(), mShadowY.pt() ); painter->translate( mShadowX.pt(), mShadowY.pt() );
painter->setMatrix( mMatrix, true ); painter->setTransform( mMatrix, true );
drawShadow( painter, inEditor, record, variables ); drawShadow( painter, inEditor, record, variables );
painter->restore(); painter->restore();
} }
painter->setMatrix( mMatrix, true ); painter->setTransform( mMatrix, true );
drawObject( painter, inEditor, record, variables ); drawObject( painter, inEditor, record, variables );
painter->restore(); painter->restore();
@@ -1258,7 +1258,7 @@ namespace glabels
painter->save(); painter->save();
painter->translate( mX0.pt(), mY0.pt() ); painter->translate( mX0.pt(), mY0.pt() );
painter->setMatrix( mMatrix, true ); painter->setTransform( mMatrix, true );
if ( mOutline ) if ( mOutline )
{ {
+5 -5
View File
@@ -34,7 +34,7 @@
#include <QObject> #include <QObject>
#include <QFont> #include <QFont>
#include <QMatrix> #include <QTransform>
#include <QPainter> #include <QPainter>
@@ -66,7 +66,7 @@ namespace glabels
const Distance& w, const Distance& w,
const Distance& h, const Distance& h,
bool lockAspectRatio = false, bool lockAspectRatio = false,
const QMatrix& matrix = QMatrix(), const QTransform& matrix = QTransform(),
bool shadowState = false, bool shadowState = false,
const Distance& shadowX = 0, const Distance& shadowX = 0,
const Distance& shadowY = 0, const Distance& shadowY = 0,
@@ -148,8 +148,8 @@ namespace glabels
// //
// Transformation Matrix Property // Transformation Matrix Property
// //
QMatrix matrix() const; QTransform matrix() const;
void setMatrix( const QMatrix& value ); void setMatrix( const QTransform& value );
// //
@@ -464,7 +464,7 @@ namespace glabels
static int msNextId; static int msNextId;
int mId; int mId;
QMatrix mMatrix; QTransform mMatrix;
}; };
+1 -1
View File
@@ -62,7 +62,7 @@ namespace glabels
const Distance& lineWidth, const Distance& lineWidth,
const ColorNode& lineColorNode, const ColorNode& lineColorNode,
const ColorNode& fillColorNode, const ColorNode& fillColorNode,
const QMatrix& matrix, const QTransform& matrix,
bool shadowState, bool shadowState,
const Distance& shadowX, const Distance& shadowX,
const Distance& shadowY, const Distance& shadowY,
+1 -1
View File
@@ -51,7 +51,7 @@ namespace glabels
const Distance& lineWidth, const Distance& lineWidth,
const ColorNode& lineColorNode, const ColorNode& lineColorNode,
const ColorNode& fillColorNode, const ColorNode& fillColorNode,
const QMatrix& matrix, const QTransform& matrix,
bool shadowState, bool shadowState,
const Distance& shadowX, const Distance& shadowX,
const Distance& shadowY, const Distance& shadowY,
+1 -1
View File
@@ -95,7 +95,7 @@ namespace glabels
QTextOption::WrapMode textWrapMode, QTextOption::WrapMode textWrapMode,
double textLineSpacing, double textLineSpacing,
bool textAutoShrink, bool textAutoShrink,
const QMatrix& matrix, const QTransform& matrix,
bool shadowState, bool shadowState,
const Distance& shadowX, const Distance& shadowX,
const Distance& shadowY, const Distance& shadowY,
+1 -1
View File
@@ -63,7 +63,7 @@ namespace glabels
QTextOption::WrapMode textWrapMode, QTextOption::WrapMode textWrapMode,
double textLineSpacing, double textLineSpacing,
bool textAutoShrink, bool textAutoShrink,
const QMatrix& matrix = QMatrix(), const QTransform& matrix = QTransform(),
bool shadowState = false, bool shadowState = false,
const Distance& shadowX = 0, const Distance& shadowX = 0,
const Distance& shadowY = 0, const Distance& shadowY = 0,
+1 -1
View File
@@ -238,7 +238,7 @@ namespace glabels
QSizeF pageSize( mModel->tmplate()->pageWidth().pt(), mModel->tmplate()->pageHeight().pt() ); QSizeF pageSize( mModel->tmplate()->pageWidth().pt(), mModel->tmplate()->pageHeight().pt() );
printer->setPageSize( QPageSize(pageSize, QPageSize::Point) ); printer->setPageSize( QPageSize(pageSize, QPageSize::Point) );
printer->setFullPage( true ); printer->setFullPage( true );
printer->setPageMargins( 0, 0, 0, 0, QPrinter::Point ); printer->setPageMargins( QMarginsF(0, 0, 0, 0), QPageLayout::Point );
QPainter painter( printer ); QPainter painter( printer );
+2 -2
View File
@@ -61,12 +61,12 @@ namespace glabels
if ( denom[i] == 0.0 ) if ( denom[i] == 0.0 )
{ {
/* None of our denominators work. */ /* None of our denominators work. */
return QString().sprintf( "%.3f", x ); return QString("%1").arg(x, 0, 'f', 3 );
} }
if ( denom[i] == 1.0 ) if ( denom[i] == 1.0 )
{ {
/* Simple integer. */ /* Simple integer. */
return QString().sprintf( "%.0f", x ); return QString().arg(x, 0, 'f', 0);
} }
auto n = int( x * denom[i] + 0.5 ); auto n = int( x * denom[i] + 0.5 );
auto d = int( denom[i] ); auto d = int( denom[i] );
+1 -1
View File
@@ -437,7 +437,7 @@ namespace glabels
void void
XmlLabelCreator::createAffineAttrs( QDomElement &node, const ModelObject* object ) XmlLabelCreator::createAffineAttrs( QDomElement &node, const ModelObject* object )
{ {
QMatrix a = object->matrix(); QTransform a = object->matrix();
XmlUtil::setDoubleAttr( node, "a0", a.m11() ); XmlUtil::setDoubleAttr( node, "a0", a.m11() );
XmlUtil::setDoubleAttr( node, "a1", a.m12() ); XmlUtil::setDoubleAttr( node, "a1", a.m12() );
+9 -9
View File
@@ -407,7 +407,7 @@ namespace glabels
return new ModelBoxObject( x0, y0, w, h, lockAspectRatio, return new ModelBoxObject( x0, y0, w, h, lockAspectRatio,
lineWidth, lineColorNode, lineWidth, lineColorNode,
fillColorNode, 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 ); shadowState, shadowX, shadowY, shadowOpacity, shadowColorNode );
} }
@@ -461,7 +461,7 @@ namespace glabels
return new ModelEllipseObject( x0, y0, w, h, lockAspectRatio, return new ModelEllipseObject( x0, y0, w, h, lockAspectRatio,
lineWidth, lineColorNode, lineWidth, lineColorNode,
fillColorNode, 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 ); shadowState, shadowX, shadowY, shadowOpacity, shadowColorNode );
} }
@@ -507,7 +507,7 @@ namespace glabels
return new ModelLineObject( x0, y0, dx, dy, return new ModelLineObject( x0, y0, dx, dy,
lineWidth, lineColorNode, 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 ); shadowState, shadowX, shadowY, shadowOpacity, shadowColorNode );
} }
@@ -556,7 +556,7 @@ namespace glabels
{ {
return new ModelImageObject( x0, y0, w, h, lockAspectRatio, return new ModelImageObject( x0, y0, w, h, lockAspectRatio,
filenameNode, 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 ); shadowState, shadowX, shadowY, shadowOpacity, shadowColorNode );
} }
else else
@@ -567,14 +567,14 @@ namespace glabels
{ {
return new ModelImageObject( x0, y0, w, h, lockAspectRatio, return new ModelImageObject( x0, y0, w, h, lockAspectRatio,
filename, data.getImage( fn ), 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 ); shadowState, shadowX, shadowY, shadowOpacity, shadowColorNode );
} }
else if ( data.hasSvg( fn ) ) else if ( data.hasSvg( fn ) )
{ {
return new ModelImageObject( x0, y0, w, h, lockAspectRatio, return new ModelImageObject( x0, y0, w, h, lockAspectRatio,
filename, data.getSvg( fn ), 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 ); shadowState, shadowX, shadowY, shadowOpacity, shadowColorNode );
} }
else else
@@ -586,7 +586,7 @@ namespace glabels
} }
return new ModelImageObject( x0, y0, w, h, lockAspectRatio, return new ModelImageObject( x0, y0, w, h, lockAspectRatio,
filenameNode, 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 ); shadowState, shadowX, shadowY, shadowOpacity, shadowColorNode );
} }
} }
@@ -629,7 +629,7 @@ namespace glabels
return new ModelBarcodeObject( x0, y0, w, h, lockAspectRatio, return new ModelBarcodeObject( x0, y0, w, h, lockAspectRatio,
bcStyle, bcTextFlag, bcChecksumFlag, bcData, bcColorNode, 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, fontFamily, fontSize, fontWeight, fontItalicFlag, fontUnderlineFlag,
textColorNode, textHAlign, textVAlign, textWrapMode, textLineSpacing, textColorNode, textHAlign, textVAlign, textWrapMode, textLineSpacing,
textAutoShrink, 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 ); shadowState, shadowX, shadowY, shadowOpacity, shadowColorNode );
} }
+1 -1
View File
@@ -450,7 +450,7 @@ namespace glabels
} }
QMatrix QTransform
XmlLabelParser_3::parseAffineTransformation(const QDomElement &node) XmlLabelParser_3::parseAffineTransformation(const QDomElement &node)
{ {
return {XmlUtil::getDoubleAttr( node, "a0", 1.0 ), return {XmlUtil::getDoubleAttr( node, "a0", 1.0 ),
+1 -1
View File
@@ -74,7 +74,7 @@ namespace glabels
static QFont::Weight getWeightAttr( const QDomElement& node, static QFont::Weight getWeightAttr( const QDomElement& node,
const QString& name, const QFont::Weight default_value ); const QString& name, const QFont::Weight default_value );
static QMatrix parseAffineTransformation(const QDomElement &node); static QTransform parseAffineTransformation(const QDomElement &node);
}; };
+1 -1
View File
@@ -117,7 +117,7 @@ namespace glabels
QString name = XmlUtil::getStringAttr( node, "name", "" ); QString name = XmlUtil::getStringAttr( node, "name", "" );
if ( name != "" ) if ( name != "" )
{ {
QStringList fields = name.split( " ", QString::SkipEmptyParts ); QStringList fields = name.split( " ", Qt::SkipEmptyParts );
brand = fields[0]; brand = fields[0];
part = fields[1]; part = fields[1];
} }
+1 -1
View File
@@ -372,7 +372,7 @@ namespace glabels
// //
// Simple path data parser // 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; enum { CMD, MX, MY, MDX, MDY, LX, LY, LDX, LDY, HX, HDX, VY, VDY } state = CMD;
Distance x = 0; Distance x = 0;
+6 -6
View File
@@ -98,7 +98,7 @@ void TestXmlLabel::serializeDeserialize()
bool lock = true, noLock = false, shadow = true, noShadow = false; 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 ); 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(); Style bcStyle = Backends::defaultStyle();
objects << new ModelBoxObject( 0, 1, 10, 20, lock, 2, red, green, tMatrix, shadow, 1, 2, 0.7, black ); 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; 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 ); 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(); Style bcStyle = Backends::defaultStyle();
/// ///
@@ -537,7 +537,7 @@ void TestXmlLabel::parser_3ReadFile()
QCOMPARE( modelTextObject0->y0().in(), 0.2625 ); QCOMPARE( modelTextObject0->y0().in(), 0.2625 );
// Width and height set to naturalSize() // Width and height set to naturalSize()
QCOMPARE( modelTextObject0->lockAspectRatio(), false ); 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->shadow(), false );
QCOMPARE( modelTextObject0->text(), QString( "Hello, my name is" ) ); QCOMPARE( modelTextObject0->text(), QString( "Hello, my name is" ) );
QCOMPARE( modelTextObject0->fontFamily(), QString( "Sans" ) ); QCOMPARE( modelTextObject0->fontFamily(), QString( "Sans" ) );
@@ -555,7 +555,7 @@ void TestXmlLabel::parser_3ReadFile()
QCOMPARE( modelTextObject1->y0().in(), 0.645 ); QCOMPARE( modelTextObject1->y0().in(), 0.645 );
// Width and height set to naturalSize() // Width and height set to naturalSize()
QCOMPARE( modelTextObject1->lockAspectRatio(), false ); 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->shadow(), false );
QCOMPARE( modelTextObject1->text(), QString( "${Name}" ) ); QCOMPARE( modelTextObject1->text(), QString( "${Name}" ) );
QCOMPARE( modelTextObject1->fontFamily(), QString( "Sans" ) ); QCOMPARE( modelTextObject1->fontFamily(), QString( "Sans" ) );
@@ -573,7 +573,7 @@ void TestXmlLabel::parser_3ReadFile()
QCOMPARE( modelTextObject2->y0().in(), 1.14 ); QCOMPARE( modelTextObject2->y0().in(), 1.14 );
// Width and height set to naturalSize() // Width and height set to naturalSize()
QCOMPARE( modelTextObject2->lockAspectRatio(), false ); 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->shadow(), false );
QCOMPARE( modelTextObject2->text(), QString( "Department: ${Department}" ) ); QCOMPARE( modelTextObject2->text(), QString( "Department: ${Department}" ) );
QCOMPARE( modelTextObject2->fontFamily(), QString( "Sans" ) ); QCOMPARE( modelTextObject2->fontFamily(), QString( "Sans" ) );
@@ -592,7 +592,7 @@ void TestXmlLabel::parser_3ReadFile()
QCOMPARE( modelBarcodeObject3->w().in(), 3.06944 ); QCOMPARE( modelBarcodeObject3->w().in(), 3.06944 );
QCOMPARE( modelBarcodeObject3->h().in(), 0.847222 ); QCOMPARE( modelBarcodeObject3->h().in(), 0.847222 );
QCOMPARE( modelBarcodeObject3->lockAspectRatio(), false ); 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->shadow(), false );
QCOMPARE( modelBarcodeObject3->bcData(), QString( "${SN}" ) ); QCOMPARE( modelBarcodeObject3->bcData(), QString( "${SN}" ) );
+6 -6
View File
@@ -92,17 +92,17 @@ int main( int argc, char *argv[] )
QTextStream out( stdout ); QTextStream out( stdout );
out << "// Automatically generated with " << app.arguments().at(0) << endl; out << "// Automatically generated with " << app.arguments().at(0) << Qt::endl;
out << "//" << endl; out << "//" << Qt::endl;
out << "// Sources:" << endl; out << "// Sources:" << Qt::endl;
foreach ( QString filename, filenameList ) foreach ( QString filename, filenameList )
{ {
out << "// " << filename << endl; out << "// " << filename << Qt::endl;
} }
out << "//" << endl; out << "//" << Qt::endl;
foreach ( QString string, stringList ) foreach ( QString string, stringList )
{ {
out << "QT_TRANSLATE_NOOP( \"XmlStrings\", \"" << string << "\" );" << endl; out << "QT_TRANSLATE_NOOP( \"XmlStrings\", \"" << string << "\" );" << Qt::endl;
} }
} }