Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Qt5 #162

Open
wants to merge 8 commits into
base: master
Choose a base branch
from
Open

Qt5 #162

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
29 changes: 28 additions & 1 deletion docs/BUILD-INSTRUCTIONS-LINUX.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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 <package name substring>
```

### Compile and Install gLabels into /usr/local
```
$ cd glabels-qt
$ mkdir build
$ cd build
$ cmake ..
$ make
$ sudo make install

```
11 changes: 3 additions & 8 deletions model/FrameCd.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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"));
}
}

Expand Down
10 changes: 2 additions & 8 deletions model/FrameContinuous.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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"));
}
}

Expand Down
12 changes: 4 additions & 8 deletions model/FrameEllipse.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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());
}
}

Expand Down
12 changes: 4 additions & 8 deletions model/FramePath.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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());
}
}

Expand Down
12 changes: 4 additions & 8 deletions model/FrameRect.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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());
}
}

Expand Down
11 changes: 3 additions & 8 deletions model/FrameRound.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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"));
}
}

Expand Down
2 changes: 1 addition & 1 deletion model/ModelBarcodeObject.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 );
Expand Down
2 changes: 1 addition & 1 deletion model/ModelBarcodeObject.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 );

Expand Down
2 changes: 1 addition & 1 deletion model/ModelBoxObject.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion model/ModelBoxObject.h
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion model/ModelEllipseObject.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion model/ModelEllipseObject.h
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
8 changes: 4 additions & 4 deletions model/ModelImageObject.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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();
Expand Down
6 changes: 3 additions & 3 deletions model/ModelImageObject.h
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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,
Expand All @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion model/ModelLineObject.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion model/ModelLineObject.h
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
Loading