Increased requirement for minimal Qt version.

develop
Roman Telezhynskyi 2023-08-12 12:03:28 +03:00
parent baf4f1a08b
commit a5bf891d43
154 changed files with 218 additions and 930 deletions

View File

@ -33,6 +33,7 @@
- Export to HP-GL format.
- Fix crash after using tool Union of details.
- Tool box redesign.
- Increased requirement for minimal Qt version.
# Valentina 0.7.52 September 12, 2022
- Fix crash when default locale is ru.

View File

@ -1,9 +1,9 @@
include(common.pri)
#Check if Qt version >= 5.4.0
!minQtVersion(5, 4, 0) {
#Check if Qt version >= 5.6.0
!minQtVersion(5, 6, 0) {
message("Cannot build Valentina with Qt version $${QT_VERSION}.")
error("Use at least Qt 5.4.0.")
error("Use at least Qt 5.6.0.")
}
#These checks need because we can quote all paths that contain space.

View File

@ -175,10 +175,7 @@ Module {
if (Qt.core.versionMinor >= 7) // Qt 5.7
return "10.8";
if (Qt.core.versionMinor >= 4) // Qt 5.4
return "10.7";
return "10.6";
return "10.7";
}
return undefined;

View File

@ -145,7 +145,8 @@ void VPCarrouselPieceList::mouseMoveEvent(QMouseEvent *event)
if (((event->buttons() & Qt::LeftButton) != 0U) &&
((event->pos() - m_dragStart).manhattanLength() >= QApplication::startDragDistance()) &&
(selectedItems().count() > 0) &&
(not m_pieceList.isEmpty() && ConstFirst(m_pieceList)->Sheet() == nullptr)) // only if it's from unplaced pieces
(not m_pieceList.isEmpty() &&
m_pieceList.constFirst()->Sheet() == nullptr)) // only if it's from unplaced pieces
{
startDrag(Qt::MoveAction);
}
@ -262,13 +263,13 @@ void VPCarrouselPieceList::contextMenuEvent(QContextMenuEvent *event)
QAction *removeAction = menu.addAction(tr("Remove from Sheet"));
removeAction->setVisible(false);
if (not m_pieceList.isEmpty() && ConstFirst(m_pieceList)->Sheet() == nullptr)
if (not m_pieceList.isEmpty() && m_pieceList.constFirst()->Sheet() == nullptr)
{
moveAction->setVisible(true);
deleteAction->setVisible(true);
}
if (not m_pieceList.isEmpty() && ConstFirst(m_pieceList)->Sheet() != nullptr)
if (not m_pieceList.isEmpty() && m_pieceList.constFirst()->Sheet() != nullptr)
{
removeAction->setVisible(true);
}

View File

@ -38,10 +38,6 @@
#include <QShowEvent>
#include <QtDebug>
#if QT_VERSION < QT_VERSION_CHECK(5, 5, 0)
#include "../vmisc/diagnostic.h"
#endif // QT_VERSION < QT_VERSION_CHECK(5, 5, 0)
namespace
{
QT_WARNING_PUSH

View File

@ -197,7 +197,7 @@ auto VPLayout::IsSheetsUniform() const -> bool
return true;
}
const VPSheetPtr &sheet = ConstFirst(sheets);
const VPSheetPtr &sheet = sheets.constFirst();
if (sheet.isNull())
{
return false;
@ -312,7 +312,7 @@ void VPLayout::SetFocusedSheet(const VPSheetPtr &focusedSheet)
}
else
{
m_focusedSheet = focusedSheet.isNull() ? ConstFirst(m_sheets) : focusedSheet;
m_focusedSheet = focusedSheet.isNull() ? m_sheets.constFirst() : focusedSheet;
}
emit ActiveSheetChanged(m_focusedSheet);

View File

@ -93,7 +93,7 @@ auto main(int argc, char *argv[]) -> int
VPApplication app(argc, argv);
app.InitOptions();
QT_REQUIRE_VERSION(argc, argv, "5.4.0") // clazy:exclude=qstring-arg,qstring-allocations NOLINT
QT_REQUIRE_VERSION(argc, argv, "5.6.0") // clazy:exclude=qstring-arg,qstring-allocations NOLINT
#if QT_VERSION >= QT_VERSION_CHECK(5, 7, 0)
VPApplication::setDesktopFileName(QStringLiteral("ua.com.smart-pattern.puzzle.desktop"));

View File

@ -57,10 +57,6 @@
#include "undocommands/vpundopiecemove.h"
#include "vpiecegrainline.h"
#if QT_VERSION < QT_VERSION_CHECK(5, 5, 0)
#include "../vmisc/diagnostic.h"
#endif // QT_VERSION < QT_VERSION_CHECK(5, 5, 0)
#include <QLoggingCategory>
QT_WARNING_PUSH
@ -659,7 +655,7 @@ void VPGraphicsPiece::PaintSeamLine(QPainter *painter, const VPPiecePtr &piece)
QVector<VLayoutPoint> seamLinePoints = piece->GetMappedContourPoints();
if (!seamLinePoints.isEmpty())
{
m_seamLine.moveTo(ConstFirst(seamLinePoints));
m_seamLine.moveTo(seamLinePoints.constFirst());
for (int i = 1; i < seamLinePoints.size(); i++)
{
m_seamLine.lineTo(seamLinePoints.at(i));
@ -684,7 +680,7 @@ void VPGraphicsPiece::PaintCuttingLine(QPainter *painter, const VPPiecePtr &piec
QVector<VLayoutPoint> cuttingLinepoints = piece->GetMappedSeamAllowancePoints();
if (!cuttingLinepoints.isEmpty())
{
m_cuttingLine.moveTo(ConstFirst(cuttingLinepoints));
m_cuttingLine.moveTo(cuttingLinepoints.constFirst());
for (int i = 1; i < cuttingLinepoints.size(); i++)
{
m_cuttingLine.lineTo(cuttingLinepoints.at(i));
@ -773,7 +769,7 @@ void VPGraphicsPiece::PaintStickyPath(QPainter *painter)
{
if (not m_stickyPoints.isEmpty())
{
m_stickyPath.moveTo(ConstFirst(m_stickyPoints));
m_stickyPath.moveTo(m_stickyPoints.constFirst());
for (int i = 1; i < m_stickyPoints.size(); i++)
{
m_stickyPath.lineTo(m_stickyPoints.at(i));
@ -833,7 +829,7 @@ void VPGraphicsPiece::GroupMove(const QPointF &pos)
if (pieces.size() == 1)
{
const VPPiecePtr &p = ConstFirst(pieces);
const VPPiecePtr &p = pieces.constFirst();
auto *command = new VPUndoPieceMove(piece, newPos.x(), newPos.y(), m_allowChangeMerge);
layout->UndoStack()->push(command);

View File

@ -43,15 +43,10 @@
#include "../layout/vpsheet.h"
#include "../undocommands/vpundooriginmove.h"
#include "../undocommands/vpundopiecerotate.h"
#include "../vmisc/compatibility.h"
#include "../vmisc/theme/vscenestylesheet.h"
#include "../vmisc/theme/vtheme.h"
#include "../vwidgets/global.h"
#if QT_VERSION < QT_VERSION_CHECK(5, 5, 0)
#include "../vmisc/diagnostic.h"
#endif // QT_VERSION < QT_VERSION_CHECK(5, 5, 0)
namespace
{
constexpr qreal penWidth = 2;
@ -469,7 +464,7 @@ void VPGraphicsPieceControls::mouseMoveEvent(QGraphicsSceneMouseEvent *event)
if (pieces.size() == 1)
{
auto *command = new VPUndoPieceRotate(ConstFirst(pieces), rotationOrigin, rotateOn, m_rotationSum,
auto *command = new VPUndoPieceRotate(pieces.constFirst(), rotationOrigin, rotateOn, m_rotationSum,
allowChangeMerge);
layout->UndoStack()->push(command);
}
@ -576,7 +571,6 @@ void VPGraphicsPieceControls::InitPixmaps()
const QString resource = QStringLiteral("icon");
#if QT_VERSION >= QT_VERSION_CHECK(5, 5, 0)
if (QGuiApplication::primaryScreen()->devicePixelRatio() >= 2)
{
const QString fileName2x = QStringLiteral("32x32/%1@2x.png").arg(imageName);
@ -590,10 +584,7 @@ void VPGraphicsPieceControls::InitPixmaps()
m_handlePixmaps.insert(type, VTheme::GetPixmapResource(resource, fileName));
m_handleHoverPixmaps.insert(type, VTheme::GetPixmapResource(resource, fileNameHover));
}
#else
m_handlePixmaps.insert(type, VTheme::GetPixmapResource(resource, fileName));
m_handleHoverPixmaps.insert(type, VTheme::GetPixmapResource(resource, fileNameHover));
#endif
QPainterPath p = PixmapToPainterPath(m_handlePixmaps.value(type));
p.setFillRule(Qt::WindingFill);
p.closeSubpath();

View File

@ -49,10 +49,6 @@
#include "../undocommands/vpundopiecerotate.h"
#include "../undocommands/vpundoremovesheet.h"
#if QT_VERSION < QT_VERSION_CHECK(5, 5, 0)
#include "../vmisc/diagnostic.h"
#endif // QT_VERSION < QT_VERSION_CHECK(5, 5, 0)
#include <QLoggingCategory>
QT_WARNING_PUSH
@ -466,7 +462,7 @@ void VPMainGraphicsView::RotatePiecesByAngle(qreal angle)
if (pieces.size() == 1)
{
auto *command = new VPUndoPieceRotate(ConstFirst(pieces), origin, angle, m_rotationSum, m_allowChangeMerge);
auto *command = new VPUndoPieceRotate(pieces.constFirst(), origin, angle, m_rotationSum, m_allowChangeMerge);
layout->UndoStack()->push(command);
}
else if (pieces.size() > 1)
@ -500,7 +496,7 @@ void VPMainGraphicsView::TranslatePiecesOn(qreal dx, qreal dy)
return;
}
VPPiecePtr piece = ConstFirst(graphicsPieces)->GetPiece();
VPPiecePtr piece = graphicsPieces.constFirst()->GetPiece();
if (piece.isNull())
{
return;
@ -525,7 +521,7 @@ void VPMainGraphicsView::TranslatePiecesOn(qreal dx, qreal dy)
QList<VPPiecePtr> pieces = PreparePieces();
if (pieces.size() == 1)
{
const VPPiecePtr &p = ConstFirst(pieces);
const VPPiecePtr &p = pieces.constFirst();
auto *command = new VPUndoPieceMove(p, dx, dy, m_allowChangeMerge);
layout->UndoStack()->push(command);
@ -627,7 +623,7 @@ void VPMainGraphicsView::ZValueMove(int move)
if (selectedPieces.size() == 1)
{
layout->UndoStack()->push(new VPUndoPieceZValueMove(ConstFirst(selectedPieces), zMove));
layout->UndoStack()->push(new VPUndoPieceZValueMove(selectedPieces.constFirst(), zMove));
}
else if (selectedPieces.size() > 1)
{
@ -708,7 +704,7 @@ void VPMainGraphicsView::MovePiece(QKeyEvent *event)
QList<VPPiecePtr> pieces = PreparePieces();
if (pieces.size() == 1)
{
const VPPiecePtr &p = ConstFirst(pieces);
const VPPiecePtr &p = pieces.constFirst();
auto *command = new VPUndoPieceMove(p, m_stickyTranslateX, m_stickyTranslateY, m_allowChangeMerge);
layout->UndoStack()->push(command);

View File

@ -27,10 +27,6 @@
*************************************************************************/
#include "vpundocommand.h"
#if QT_VERSION < QT_VERSION_CHECK(5, 5, 0)
#include "diagnostic.h"
#endif // QT_VERSION < QT_VERSION_CHECK(5, 5, 0)
QT_WARNING_PUSH
QT_WARNING_DISABLE_CLANG("-Wmissing-prototypes")
QT_WARNING_DISABLE_INTEL(1418)

View File

@ -41,10 +41,6 @@
#include "version.h"
#include "vpmainwindow.h"
#if QT_VERSION < QT_VERSION_CHECK(5, 5, 0)
#include "../vmisc/diagnostic.h"
#endif // QT_VERSION < QT_VERSION_CHECK(5, 5, 0)
#include <QCommandLineParser>
#include <QFileOpenEvent>
#include <QLocalServer>
@ -106,7 +102,7 @@ inline void noisyFailureMsgHandler(QtMsgType type, const QMessageLogContext &con
#endif // defined(V_NO_ASSERT)
#if defined(Q_OS_MAC)
#if QT_VERSION >= QT_VERSION_CHECK(5, 4, 0) && QT_VERSION < QT_VERSION_CHECK(5, 7, 0)
#if QT_VERSION < QT_VERSION_CHECK(5, 7, 0)
// Try hide very annoying, Qt related, warnings in Mac OS X
// QNSView mouseDragged: Internal mouse button tracking invalid (missing Qt::LeftButton)
// https://bugreports.qt.io/browse/QTBUG-42846
@ -179,11 +175,9 @@ inline void noisyFailureMsgHandler(QtMsgType type, const QMessageLogContext &con
case QtFatalMsg:
vStdErr() << QApplication::translate("mNoisyHandler", "FATAL:") << msg << "\n";
break;
#if QT_VERSION >= QT_VERSION_CHECK(5, 5, 0)
case QtInfoMsg:
vStdOut() << QApplication::translate("mNoisyHandler", "INFO:") << msg << "\n";
break;
#endif
default:
break;
}
@ -212,12 +206,10 @@ inline void noisyFailureMsgHandler(QtMsgType type, const QMessageLogContext &con
messageBox.setWindowTitle(QApplication::translate("mNoisyHandler", "Fatal error"));
messageBox.setIcon(QMessageBox::Critical);
break;
#if QT_VERSION >= QT_VERSION_CHECK(5, 5, 0)
case QtInfoMsg:
messageBox.setWindowTitle(QApplication::translate("mNoisyHandler", "Information"));
messageBox.setIcon(QMessageBox::Information);
break;
#endif
case QtDebugMsg:
Q_UNREACHABLE(); //-V501
break;
@ -397,7 +389,7 @@ auto VPApplication::MainWindows() -> QList<VPMainWindow *>
auto VPApplication::NewMainWindow() -> VPMainWindow *
{
VPCommandLinePtr cmd;
VPCommandLine::ProcessInstance(cmd, {ConstFirst<QString>(VPApplication::arguments())});
VPCommandLine::ProcessInstance(cmd, {VPApplication::arguments().constFirst()});
return NewMainWindow(cmd);
}

View File

@ -187,7 +187,7 @@ auto PreparePrinter(const QPrinterInfo &info, QPrinter::PrinterMode mode) -> QSh
return {};
}
tmpInfo = QPrinterInfo::printerInfo(ConstFirst<QString>(list));
tmpInfo = QPrinterInfo::printerInfo(list.constFirst());
}
auto printer = QSharedPointer<QPrinter>(new QPrinter(tmpInfo, mode));
@ -706,7 +706,7 @@ void VPMainWindow::InitPropertyTabCurrentPiece()
QList<VPPiecePtr> selectedPieces = SelectedPieces();
if (selectedPieces.size() == 1)
{
const VPPiecePtr &selectedPiece = ConstFirst(selectedPieces);
const VPPiecePtr &selectedPiece = selectedPieces.constFirst();
if (not selectedPiece.isNull())
{
selectedPiece->SetHideMainPath(not checked);
@ -723,7 +723,7 @@ void VPMainWindow::InitPropertyTabCurrentPiece()
QList<VPPiecePtr> selectedPieces = SelectedPieces();
if (selectedPieces.size() == 1)
{
const VPPiecePtr &selectedPiece = ConstFirst(selectedPieces);
const VPPiecePtr &selectedPiece = selectedPieces.constFirst();
if (not selectedPiece.isNull())
{
if (selectedPiece->IsMirror() != checked)
@ -1212,7 +1212,7 @@ void VPMainWindow::SetPropertyTabCurrentPieceData()
ui->groupBoxCurrentPieceSeamline->setVisible(true);
ui->groupBoxCurrentPieceGeometry->setVisible(true);
const VPPiecePtr &selectedPiece = ConstFirst(selectedPieces);
const VPPiecePtr &selectedPiece = selectedPieces.constFirst();
// set the value to the current piece
SetLineEditValue(ui->lineEditCurrentPieceName, selectedPiece->GetName());
@ -1769,11 +1769,7 @@ void VPMainWindow::CreateWindowMenu(QMenu *menu)
window->isWindowModified() ? title.replace(index, 3, QChar('*')) : title.replace(index, 3, QString());
}
#if QT_VERSION < QT_VERSION_CHECK(5, 6, 0)
QAction *action = menu->addAction(title, this, SLOT(ShowWindow()));
#else
QAction *action = menu->addAction(title, this, &VPMainWindow::ShowWindow);
#endif // QT_VERSION < QT_VERSION_CHECK(5, 6, 0)
action->setData(i);
action->setCheckable(true);
action->setMenuRole(QAction::NoRole);
@ -3137,7 +3133,7 @@ void VPMainWindow::ZValueMove(int move)
if (selectedPieces.size() == 1)
{
m_layout->UndoStack()->push(new VPUndoPieceZValueMove(ConstFirst(selectedPieces), zMove));
m_layout->UndoStack()->push(new VPUndoPieceZValueMove(selectedPieces.constFirst(), zMove));
}
else if (selectedPieces.size() > 1)
{
@ -3247,7 +3243,7 @@ void VPMainWindow::TranslatePieces()
if (selectedPieces.size() == 1)
{
auto *command = new VPUndoPieceMove(ConstFirst(selectedPieces), pieceDx, pieceDy);
auto *command = new VPUndoPieceMove(selectedPieces.constFirst(), pieceDx, pieceDy);
m_layout->UndoStack()->push(command);
}
else
@ -4195,7 +4191,7 @@ void VPMainWindow::on_actionPrintLayout_triggered()
QCoreApplication::applicationVersion());
QList<VPSheetPtr> sheets = m_layout->GetSheets();
const VPSheetPtr &firstSheet = ConstFirst(sheets);
const VPSheetPtr &firstSheet = sheets.constFirst();
if (firstSheet.isNull())
{
qCritical() << tr("Unable to get sheet page settings");
@ -4246,7 +4242,7 @@ void VPMainWindow::on_actionPrintPreviewLayout_triggered()
QCoreApplication::applicationVersion());
QList<VPSheetPtr> sheets = m_layout->GetSheets();
const VPSheetPtr &firstSheet = ConstFirst(sheets);
const VPSheetPtr &firstSheet = sheets.constFirst();
if (firstSheet.isNull())
{
qCritical() << tr("Unable to get sheet page settings");
@ -4281,7 +4277,7 @@ void VPMainWindow::on_actionPrintTiledLayout_triggered()
QCoreApplication::applicationVersion());
QList<VPSheetPtr> sheets = m_layout->GetSheets();
const VPSheetPtr &firstSheet = ConstFirst(sheets);
const VPSheetPtr &firstSheet = sheets.constFirst();
if (firstSheet.isNull())
{
qCritical() << tr("Unable to get sheet page settings");
@ -4319,7 +4315,7 @@ void VPMainWindow::on_actionPrintPreviewTiledLayout_triggered()
QCoreApplication::applicationVersion());
QList<VPSheetPtr> sheets = m_layout->GetSheets();
const VPSheetPtr &firstSheet = ConstFirst(sheets);
const VPSheetPtr &firstSheet = sheets.constFirst();
if (firstSheet.isNull())
{
qCritical() << tr("Unable to get sheet page settings");

View File

@ -28,10 +28,6 @@
#include "vpsettings.h"
#include "../vmisc/compatibility.h"
#if QT_VERSION < QT_VERSION_CHECK(5, 5, 0)
#include "../vmisc/diagnostic.h"
#endif // QT_VERSION < QT_VERSION_CHECK(5, 5, 0)
#include <QMarginsF>
namespace

View File

@ -12,10 +12,6 @@
#include "layout/vpsheet.h"
#include "theme/vtheme.h"
#if QT_VERSION < QT_VERSION_CHECK(5, 5, 0)
#include "../vmisc/diagnostic.h"
#endif // QT_VERSION < QT_VERSION_CHECK(5, 5, 0)
namespace
{
QT_WARNING_PUSH

View File

@ -878,7 +878,7 @@ auto VPLayoutFileReader::ReadLabelLines() -> VTextManager
QStringList svgFontData = ReadAttributeEmptyString(attribs, ML::AttrSVGFont).split(',');
if (!svgFontData.isEmpty())
{
text.SetSVGFontFamily(ConstFirst<QString>(svgFontData));
text.SetSVGFontFamily(svgFontData.constFirst());
if (svgFontData.size() > 1)
{

View File

@ -30,7 +30,7 @@
#include "../mapplication.h"
#include "../vpatterndb/measurements.h"
#include "ui_dialogmdatabase.h"
#include "../vmisc/compatibility.h"
#include <QKeyEvent>
#include <QMenu>
@ -372,7 +372,7 @@ void DialogMDataBase::FilterMeasurements(const QString &search)
FilterGroup(m_groupQ, search);
const QList<QTreeWidgetItem *> list = ui->treeWidget->selectedItems();
list.isEmpty() ? ShowDescription(nullptr, -1) : ShowDescription(ConstFirst(list), 0);
list.isEmpty() ? ShowDescription(nullptr, -1) : ShowDescription(list.constFirst(), 0);
}
//---------------------------------------------------------------------------------------------------------------------

View File

@ -91,7 +91,7 @@ auto main(int argc, char *argv[]) -> int
MApplication app(argc, argv);
app.InitOptions();
QT_REQUIRE_VERSION(argc, argv, "5.4.0") // clazy:exclude=qstring-arg,qstring-allocations NOLINT
QT_REQUIRE_VERSION(argc, argv, "5.6.0") // clazy:exclude=qstring-arg,qstring-allocations NOLINT
#if QT_VERSION >= QT_VERSION_CHECK(5, 7, 0)
MApplication::setDesktopFileName(QStringLiteral("ua.com.smart-pattern.tape.desktop"));

View File

@ -38,16 +38,11 @@
#include "../vganalytics/vganalytics.h"
#include "../vmisc/projectversion.h"
#include "../vmisc/qt_dispatch/qt_dispatch.h"
#include "../vmisc/theme/vapplicationstyle.h"
#include "../vmisc/theme/vtheme.h"
#include "../vmisc/vsysexits.h"
#include "tmainwindow.h"
#include "version.h"
#if QT_VERSION < QT_VERSION_CHECK(5, 5, 0)
#include "../vmisc/diagnostic.h"
#endif // QT_VERSION < QT_VERSION_CHECK(5, 5, 0)
#include <QCommandLineParser>
#include <QDir>
#include <QFileOpenEvent>
@ -142,7 +137,7 @@ inline void noisyFailureMsgHandler(QtMsgType type, const QMessageLogContext &con
#endif // defined(V_NO_ASSERT)
#if defined(Q_OS_MAC)
#if QT_VERSION >= QT_VERSION_CHECK(5, 4, 0) && QT_VERSION < QT_VERSION_CHECK(5, 7, 0)
#if QT_VERSION < QT_VERSION_CHECK(5, 7, 0)
// Try hide very annoying, Qt related, warnings in Mac OS X
// QNSView mouseDragged: Internal mouse button tracking invalid (missing Qt::LeftButton)
// https://bugreports.qt.io/browse/QTBUG-42846
@ -222,11 +217,9 @@ inline void noisyFailureMsgHandler(QtMsgType type, const QMessageLogContext &con
case QtFatalMsg:
vStdErr() << QApplication::translate("mNoisyHandler", "FATAL:") << logMsg << "\n";
break;
#if QT_VERSION >= QT_VERSION_CHECK(5, 5, 0)
case QtInfoMsg:
vStdOut() << QApplication::translate("mNoisyHandler", "INFO:") << logMsg << "\n";
break;
#endif
default:
break;
}
@ -255,12 +248,10 @@ inline void noisyFailureMsgHandler(QtMsgType type, const QMessageLogContext &con
messageBox.setWindowTitle(QApplication::translate("mNoisyHandler", "Fatal error"));
messageBox.setIcon(QMessageBox::Critical);
break;
#if QT_VERSION >= QT_VERSION_CHECK(5, 5, 0)
case QtInfoMsg:
messageBox.setWindowTitle(QApplication::translate("mNoisyHandler", "Information"));
messageBox.setIcon(QMessageBox::Information);
break;
#endif
case QtDebugMsg:
Q_UNREACHABLE(); //-V501
break;

View File

@ -3884,11 +3884,7 @@ void TMainWindow::CreateWindowMenu(QMenu *menu)
window->isWindowModified() ? title.replace(index, 3, QChar('*')) : title.replace(index, 3, QString());
}
#if QT_VERSION < QT_VERSION_CHECK(5, 6, 0)
QAction *action = menu->addAction(title, this, SLOT(ShowWindow()));
#else
QAction *action = menu->addAction(title, this, &TMainWindow::ShowWindow);
#endif // QT_VERSION < QT_VERSION_CHECK(5, 6, 0)
action->setData(i);
action->setCheckable(true);
action->setMenuRole(QAction::NoRole);

View File

@ -32,10 +32,6 @@
#include <QGlobalStatic>
#include <QVariant>
#if QT_VERSION < QT_VERSION_CHECK(5, 5, 0)
#include "diagnostic.h"
#endif // QT_VERSION < QT_VERSION_CHECK(5, 5, 0)
namespace
{
QT_WARNING_PUSH

View File

@ -168,7 +168,7 @@ inline void noisyFailureMsgHandler(QtMsgType type, const QMessageLogContext &con
#endif // defined(V_NO_ASSERT)
#if defined(Q_OS_MAC)
#if QT_VERSION >= QT_VERSION_CHECK(5, 4, 0) && QT_VERSION < QT_VERSION_CHECK(5, 7, 0)
#if QT_VERSION < QT_VERSION_CHECK(5, 7, 0)
// Try hide very annoying, Qt related, warnings in Mac OS X
// QNSView mouseDragged: Internal mouse button tracking invalid (missing Qt::LeftButton)
// https://bugreports.qt.io/browse/QTBUG-42846
@ -275,7 +275,6 @@ inline void noisyFailureMsgHandler(QtMsgType type, const QMessageLogContext &con
.arg(context.function, context.category, logMsg);
vStdErr() << QApplication::translate("vNoisyHandler", "FATAL:") << logMsg << "\n";
break;
#if QT_VERSION >= QT_VERSION_CHECK(5, 5, 0)
case QtInfoMsg:
if (isPatternMessage)
{
@ -287,7 +286,6 @@ inline void noisyFailureMsgHandler(QtMsgType type, const QMessageLogContext &con
.arg(context.function, context.category, logMsg);
vStdOut() << QApplication::translate("vNoisyHandler", "INFO:") << logMsg << "\n";
break;
#endif
default:
break;
}
@ -325,12 +323,10 @@ inline void noisyFailureMsgHandler(QtMsgType type, const QMessageLogContext &con
messageBox.setWindowTitle(QApplication::translate("vNoisyHandler", "Fatal error"));
messageBox.setIcon(QMessageBox::Critical);
break;
#if QT_VERSION >= QT_VERSION_CHECK(5, 5, 0)
case QtInfoMsg:
messageBox.setWindowTitle(QApplication::translate("vNoisyHandler", "Information"));
messageBox.setIcon(QMessageBox::Information);
break;
#endif
case QtDebugMsg:
default:
break;

View File

@ -420,7 +420,7 @@ auto VCommandLine::OptUserMaterials() const -> QMap<int, QString>
}
bool ok = false;
const int number = ConstFirst<QString>(parts).toInt(&ok);
const int number = parts.constFirst().toInt(&ok);
if (not ok or number < 1 or number > userMaterialPlaceholdersQuantity)
{
@ -429,7 +429,7 @@ auto VCommandLine::OptUserMaterials() const -> QMap<int, QString>
const_cast<VCommandLine *>(this)->parser.showHelp(V_EX_USAGE);
}
userMaterials.insert(number, ConstLast<QString>(parts));
userMaterials.insert(number, parts.constLast());
}
return userMaterials;

View File

@ -86,10 +86,6 @@
#include "../vtools/tools/drawTools/toolpoint/toolsinglepoint/vtooltriangle.h"
#include "../vtools/tools/drawTools/vtoolline.h"
#if QT_VERSION < QT_VERSION_CHECK(5, 5, 0)
#include "../vmisc/diagnostic.h"
#endif // QT_VERSION < QT_VERSION_CHECK(5, 5, 0)
#include <QComboBox>
#include <QDebug>
#include <QDockWidget>

View File

@ -28,7 +28,6 @@
#include "dialogfinalmeasurements.h"
#include "../qmuparser/qmudef.h"
#include "../vmisc/compatibility.h"
#include "../vmisc/theme/vtheme.h"
#include "../vmisc/vabstractvalapplication.h"
#include "../vmisc/vvalentinasettings.h"
@ -296,7 +295,7 @@ void DialogFinalMeasurements::MoveUp()
return;
}
Move(m_measurements, row, row - 1);
m_measurements.move(row, row - 1);
UpdateTree();
ui->tableWidget->selectRow(row - 1);
@ -313,7 +312,7 @@ void DialogFinalMeasurements::MoveDown()
return;
}
Move(m_measurements, row, row + 1);
m_measurements.move(row, row + 1);
UpdateTree();
ui->tableWidget->selectRow(row + 1);

View File

@ -37,10 +37,6 @@
#include "../vmisc/backport/qoverload.h"
#endif // QT_VERSION < QT_VERSION_CHECK(5, 7, 0)
#if QT_VERSION < QT_VERSION_CHECK(5, 5, 0)
#include "../vmisc/diagnostic.h"
#endif // QT_VERSION < QT_VERSION_CHECK(5, 5, 0)
#include <QDir>
#include <QFileDialog>
#include <QGlobalStatic>

View File

@ -35,10 +35,6 @@
#include "../vtools/undocommands/togglepiecestate.h"
#include "ui_vwidgetdetails.h"
#if QT_VERSION < QT_VERSION_CHECK(5, 5, 0)
#include "../vmisc/diagnostic.h"
#endif // QT_VERSION < QT_VERSION_CHECK(5, 5, 0)
#include <QMenu>
#include <QTimer>
#include <QUndoStack>

View File

@ -134,7 +134,7 @@ auto VWidgetGroups::FilterGroups(const QMap<quint32, VGroupData> &groups) -> QMa
{
const VGroupData &data = i.value();
QSet<QString> groupCategories = ConvertToSet<QString>(data.tags);
if (SetIntersects(filterCategories, groupCategories))
if (filterCategories.intersects(groupCategories))
{
filtered.insert(i.key(), data);
}

View File

@ -104,7 +104,7 @@ auto main(int argc, char *argv[]) -> int
VApplication app(argc, argv);
app.InitOptions();
QT_REQUIRE_VERSION(argc, argv, "5.4.0") // clazy:exclude=qstring-arg,qstring-allocations NOLINT
QT_REQUIRE_VERSION(argc, argv, "5.6.0") // clazy:exclude=qstring-arg,qstring-allocations NOLINT
#if QT_VERSION >= QT_VERSION_CHECK(5, 7, 0)
VApplication::setDesktopFileName(QStringLiteral("ua.com.smart-pattern.valentina.desktop"));

View File

@ -203,10 +203,6 @@
#include "../vmisc/backport/qoverload.h"
#endif // QT_VERSION < QT_VERSION_CHECK(5, 7, 0)
#if QT_VERSION < QT_VERSION_CHECK(5, 5, 0)
#include "../vmisc/diagnostic.h"
#endif // QT_VERSION < QT_VERSION_CHECK(5, 5, 0)
#if QT_VERSION < QT_VERSION_CHECK(5, 12, 0)
#include "../vmisc/backport/qscopeguard.h"
#else
@ -4044,7 +4040,7 @@ void MainWindow::on_actionOpen_triggered()
else
{
// Absolute path to last open file
dir = QFileInfo(ConstFirst<QString>(files)).absolutePath();
dir = QFileInfo(files.constFirst()).absolutePath();
}
qCDebug(vMainWindow, "Run QFileDialog::getOpenFileName: dir = %s.", qUtf8Printable(dir));
const QString filePath = QFileDialog::getOpenFileName(this, tr("Open file"), dir, filter, nullptr,
@ -7180,7 +7176,7 @@ void MainWindow::ProcessCMD()
VAbstractValApplication::VApp()->SetUserMaterials(cmd->OptUserMaterials());
const bool loaded = LoadPattern(ConstFirst<QString>(args), cmd->OptMeasurePath());
const bool loaded = LoadPattern(args.constFirst(), cmd->OptMeasurePath());
if (not loaded)
{
@ -7599,11 +7595,9 @@ void MainWindow::PrintPatternMessage(QEvent *event)
case QtFatalMsg:
severity = tr("FATAL");
break;
#if QT_VERSION >= QT_VERSION_CHECK(5, 5, 0)
case QtInfoMsg:
severity = tr("INFO");
break;
#endif
default:
break;
}

View File

@ -281,7 +281,7 @@ void VPattern::setCurrentData()
return;
}
const quint32 id = ConstLast(localHistory).getId();
const quint32 id = localHistory.constLast().getId();
qCDebug(vXML, "Resoring data from tool with id %u", id);
if (tools.isEmpty())
@ -334,7 +334,7 @@ auto VPattern::GetCompleteData() const -> VContainer
return (data != nullptr ? *data : VContainer(nullptr, nullptr, VContainer::UniqueNamespace()));
}
const quint32 id = (countPP == 1 ? ConstLast(history).getId() : LastToolId());
const quint32 id = (countPP == 1 ? history.constLast().getId() : LastToolId());
if (id == NULL_ID)
{
@ -369,7 +369,7 @@ auto VPattern::GetCompletePPData(const QString &name) const -> VContainer
return (data != nullptr ? *data : VContainer(nullptr, nullptr, VContainer::UniqueNamespace()));
}
const quint32 id = (countPP == 1 ? ConstLast(history).getId() : PPLastToolId(name));
const quint32 id = (countPP == 1 ? history.constLast().getId() : PPLastToolId(name));
if (id == NULL_ID)
{
@ -3777,7 +3777,7 @@ auto VPattern::PPLastToolId(const QString &name) const -> quint32
{
const QVector<VToolRecord> localHistory = getLocalHistory(name);
return (not localHistory.isEmpty() ? ConstLast(localHistory).getId() : NULL_ID);
return (not localHistory.isEmpty() ? localHistory.constLast().getId() : NULL_ID);
}
//---------------------------------------------------------------------------------------------------------------------

View File

@ -49,10 +49,6 @@
#include "fvavailableupdate.h"
#include "fvupdatewindow.h"
#if QT_VERSION < QT_VERSION_CHECK(5, 5, 0)
#include "../vmisc/diagnostic.h"
#endif // QT_VERSION < QT_VERSION_CHECK(5, 5, 0)
namespace
{
QT_WARNING_PUSH

View File

@ -35,10 +35,6 @@
#include <QPen>
#include <QPixmap>
#if QT_VERSION < QT_VERSION_CHECK(5, 5, 0)
#include "../vmisc/diagnostic.h"
#endif // QT_VERSION < QT_VERSION_CHECK(5, 5, 0)
const QString CustomMSign = QStringLiteral("@");
const QString CustomIncrSign = QStringLiteral("#");

View File

@ -42,9 +42,6 @@
#include "../vmisc/def.h"
#include "../vmisc/typedef.h"
#if QT_VERSION < QT_VERSION_CHECK(5, 5, 0)
#include "../vmisc/diagnostic.h"
#endif // QT_VERSION < QT_VERSION_CHECK(5, 5, 0)
extern const QString CustomMSign;
extern const QString CustomIncrSign;

View File

@ -59,10 +59,6 @@
#include "vtoolrecord.h"
#include "vvalentinasettings.h"
#if QT_VERSION < QT_VERSION_CHECK(5, 5, 0)
#include "../vmisc/diagnostic.h"
#endif // QT_VERSION < QT_VERSION_CHECK(5, 5, 0)
class QDomElement;
const QString VAbstractPattern::TagPattern = QStringLiteral("pattern");

View File

@ -45,9 +45,6 @@
#include "../ifcdef.h"
#include "../qmuparser/qmudef.h"
#include "../vmisc/def.h"
#if QT_VERSION < QT_VERSION_CHECK(5, 5, 0)
#include "../vmisc/diagnostic.h"
#endif // QT_VERSION < QT_VERSION_CHECK(5, 5, 0)
#include "../vmisc/literals.h"
class QDomElement;

View File

@ -29,11 +29,6 @@
#include "../exception/vexception.h"
#include "../ifcdef.h"
#include "../vlayout/vlayoutpoint.h"
#include "compatibility.h"
#if QT_VERSION < QT_VERSION_CHECK(5, 5, 0)
#include "../vmisc/diagnostic.h"
#endif // QT_VERSION < QT_VERSION_CHECK(5, 5, 0)
/*
* Version rules:
@ -367,7 +362,7 @@ void VLayoutConverter::ConvertPiecesToV0_1_5()
return PointToString(line.p1()) + groupSep + PointToString(line.p2());
};
node.firstChild().toText().setData(LineToString(QLineF(ConstFirst(path), ConstLast(path))));
node.firstChild().toText().setData(LineToString(QLineF(path.constFirst(), path.constLast())));
}
}
}

View File

@ -46,10 +46,6 @@
#include "../qmuparser/qmutokenparser.h"
#include "../vmisc/def.h"
#if QT_VERSION < QT_VERSION_CHECK(5, 5, 0)
#include "../vmisc/diagnostic.h"
#endif // QT_VERSION < QT_VERSION_CHECK(5, 5, 0)
class QDomElement;
/*

View File

@ -40,10 +40,6 @@
#include "vabstractmconverter.h"
#if QT_VERSION < QT_VERSION_CHECK(5, 5, 0)
#include "../vmisc/diagnostic.h"
#endif // QT_VERSION < QT_VERSION_CHECK(5, 5, 0)
/*
* Version rules:
* 1. Version have three parts "major.minor.patch";

View File

@ -41,10 +41,6 @@
#include "../vmisc/def.h"
#include "vabstractmconverter.h"
#if QT_VERSION < QT_VERSION_CHECK(5, 5, 0)
#include "../vmisc/diagnostic.h"
#endif // QT_VERSION < QT_VERSION_CHECK(5, 5, 0)
/*
* Version rules:
* 1. Version have three parts "major.minor.patch";

View File

@ -25,64 +25,6 @@
#include "qmuparser_global.h"
#include "qmuparserdef.h"
#if QT_VERSION < QT_VERSION_CHECK(5, 5, 0)
/*
* Warning/diagnostic handling
*/
#define QT_DO_PRAGMA(text) _Pragma(#text)
#if defined(Q_CC_INTEL) && defined(Q_CC_MSVC)
/* icl.exe: Intel compiler on Windows */
#undef QT_DO_PRAGMA /* not needed */
#define QT_WARNING_PUSH __pragma(warning(push))
#define QT_WARNING_POP __pragma(warning(pop))
#define QT_WARNING_DISABLE_MSVC(number)
#define QT_WARNING_DISABLE_INTEL(number) __pragma(warning(disable : number))
#define QT_WARNING_DISABLE_CLANG(text)
#define QT_WARNING_DISABLE_GCC(text)
#elif defined(Q_CC_INTEL)
/* icc: Intel compiler on Linux or OS X */
#define QT_WARNING_PUSH QT_DO_PRAGMA(warning(push))
#define QT_WARNING_POP QT_DO_PRAGMA(warning(pop))
#define QT_WARNING_DISABLE_INTEL(number) QT_DO_PRAGMA(warning(disable : number))
#define QT_WARNING_DISABLE_MSVC(number)
#define QT_WARNING_DISABLE_CLANG(text)
#define QT_WARNING_DISABLE_GCC(text)
#elif defined(Q_CC_MSVC) && _MSC_VER >= 1500
#undef QT_DO_PRAGMA /* not needed */
#define QT_WARNING_PUSH __pragma(warning(push))
#define QT_WARNING_POP __pragma(warning(pop))
#define QT_WARNING_DISABLE_MSVC(number) __pragma(warning(disable : number))
#define QT_WARNING_DISABLE_INTEL(number)
#define QT_WARNING_DISABLE_CLANG(text)
#define QT_WARNING_DISABLE_GCC(text)
#elif defined(Q_CC_CLANG)
#define QT_WARNING_PUSH QT_DO_PRAGMA(clang diagnostic push)
#define QT_WARNING_POP QT_DO_PRAGMA(clang diagnostic pop)
#define QT_WARNING_DISABLE_CLANG(text) QT_DO_PRAGMA(clang diagnostic ignored text)
#define QT_WARNING_DISABLE_GCC(text) QT_DO_PRAGMA(GCC diagnostic ignored text) // GCC directives work in Clang too
#define QT_WARNING_DISABLE_INTEL(number)
#define QT_WARNING_DISABLE_MSVC(number)
#elif defined(Q_CC_GNU) && (__GNUC__ * 100 + __GNUC_MINOR__ >= 406)
#define QT_WARNING_PUSH QT_DO_PRAGMA(GCC diagnostic push)
#define QT_WARNING_POP QT_DO_PRAGMA(GCC diagnostic pop)
#define QT_WARNING_DISABLE_GCC(text) QT_DO_PRAGMA(GCC diagnostic ignored text)
#define QT_WARNING_DISABLE_CLANG(text)
#define QT_WARNING_DISABLE_INTEL(number)
#define QT_WARNING_DISABLE_MSVC(number)
#else // All other compilers, GCC < 4.6 and MSVC < 2008
#define QT_WARNING_DISABLE_GCC(text)
#define QT_WARNING_PUSH
#define QT_WARNING_POP
#define QT_WARNING_DISABLE_INTEL(number)
#define QT_WARNING_DISABLE_MSVC(number)
#define QT_WARNING_DISABLE_CLANG(text)
#define QT_WARNING_DISABLE_GCC(text)
#endif
#endif // QT_VERSION < QT_VERSION_CHECK(5, 5, 0)
#if QT_VERSION < QT_VERSION_CHECK(5, 13, 0)
#define Q_DISABLE_COPY_MOVE(Class) \
Q_DISABLE_COPY(Class) \

View File

@ -25,12 +25,9 @@
#ifndef QMUPARSERCALLBACK_P_H
#define QMUPARSERCALLBACK_P_H
#include "qmudef.h"
#include "qmuparserdef.h"
#include <QSharedData>
#if QT_VERSION < QT_VERSION_CHECK(5, 5, 0)
#include "../vmisc/diagnostic.h"
#endif // QT_VERSION < QT_VERSION_CHECK(5, 5, 0)
#include "../vmisc/defglobal.h"
namespace qmu
{

View File

@ -33,10 +33,6 @@
#if QT_VERSION < QT_VERSION_CHECK(5, 14, 0)
#include <QTextStream>
#if QT_VERSION < QT_VERSION_CHECK(5, 5, 0)
#include "qmudef.h"
#endif // QT_VERSION < QT_VERSION_CHECK(5, 5, 0)
namespace Qt
{
QT_WARNING_PUSH

View File

@ -16,10 +16,6 @@
#include "intern/drw_dbg.h"
#include "intern/dxfreader.h"
#include <cstdlib>
#if QT_VERSION < QT_VERSION_CHECK(5, 5, 0)
#include "../vmisc/diagnostic.h"
#endif // QT_VERSION < QT_VERSION_CHECK(5, 5, 0)
//! Calculate arbitrary axis
/*!

View File

@ -19,10 +19,6 @@
#include "drw_header.h"
#include "drw_objects.h"
#if QT_VERSION < QT_VERSION_CHECK(5, 5, 0)
#include "../vmisc/diagnostic.h"
#endif // QT_VERSION < QT_VERSION_CHECK(5, 5, 0)
QT_WARNING_PUSH
QT_WARNING_DISABLE_GCC("-Wsuggest-final-types")
QT_WARNING_DISABLE_GCC("-Wsuggest-final-methods")

View File

@ -21,9 +21,6 @@
#include <fstream>
#include <memory>
#include <sstream>
#if QT_VERSION < QT_VERSION_CHECK(5, 5, 0)
#include "../vmisc/diagnostic.h"
#endif // QT_VERSION < QT_VERSION_CHECK(5, 5, 0)
#define FIRSTHANDLE 48

View File

@ -53,10 +53,6 @@
#include <QTextCodec>
#endif
#if QT_VERSION < QT_VERSION_CHECK(5, 5, 0)
#include "../vmisc/diagnostic.h"
#endif // QT_VERSION < QT_VERSION_CHECK(5, 5, 0)
#include "../vgeometry/vgeometrydef.h"
#include "../vgeometry/vlayoutplacelabel.h"
#include "../vlayout/vlayoutpiece.h"
@ -203,7 +199,7 @@ void VDxfEngine::drawPath(const QPainterPath &path)
poly->lWeight = DRW_LW_Conv::widthByLayer;
poly->lineType = GetPenStyle();
if (polygon.size() > 1 && ConstFirst<QPointF>(polygon) == ConstLast<QPointF>(polygon))
if (polygon.size() > 1 && polygon.constFirst() == polygon.constLast())
{
poly->flags |= 0x1; // closed NOLINT(hicpp-signed-bitwise)
}
@ -225,7 +221,7 @@ void VDxfEngine::drawPath(const QPainterPath &path)
poly->color = GetPenColor();
poly->lWeight = DRW_LW_Conv::widthByLayer;
poly->lineType = GetPenStyle();
if (polygon.size() > 1 && ConstFirst<QPointF>(polygon) == ConstLast<QPointF>(polygon))
if (polygon.size() > 1 && polygon.constFirst() == polygon.constLast())
{
poly->flags |= 0x1; // closed NOLINT(hicpp-signed-bitwise)
}
@ -1177,20 +1173,20 @@ void VDxfEngine::ExportASTMNotch(const QSharedPointer<dx_ifaceBlock> &detailBloc
case PassmarkLineType::ExternalVMark:
case PassmarkLineType::InternalVMark:
{ // V-Notch
QLineF boundaryLine(ConstFirst(passmark.lines).p1(), ConstLast(passmark.lines).p2());
QLineF boundaryLine(passmark.lines.constFirst().p1(), passmark.lines.constLast().p2());
notch->thickness = FromPixel(boundaryLine.length(), m_varInsunits); // width
notch->layer = *layer4;
break;
}
case PassmarkLineType::TMark:
// T-Notch
notch->thickness = FromPixel(ConstLast(passmark.lines).length(), m_varInsunits); // width
notch->thickness = FromPixel(passmark.lines.constLast().length(), m_varInsunits); // width
notch->layer = *layer80;
break;
case PassmarkLineType::BoxMark:
{ // Castle Notch
QPointF start = ConstFirst(passmark.lines).p1();
QPointF end = ConstLast(passmark.lines).p2();
QPointF start = passmark.lines.constFirst().p1();
QPointF end = passmark.lines.constLast().p2();
notch->layer = *layer81;
notch->thickness = FromPixel(QLineF(start, end).length(), m_varInsunits); // width
@ -1198,8 +1194,8 @@ void VDxfEngine::ExportASTMNotch(const QSharedPointer<dx_ifaceBlock> &detailBloc
}
case PassmarkLineType::UMark:
{ // U-Notch
QPointF start = ConstFirst(passmark.lines).p1();
QPointF end = ConstLast(passmark.lines).p2();
QPointF start = passmark.lines.constFirst().p1();
QPointF end = passmark.lines.constLast().p2();
notch->thickness = FromPixel(QLineF(start, end).length(), m_varInsunits); // width
@ -1208,8 +1204,8 @@ void VDxfEngine::ExportASTMNotch(const QSharedPointer<dx_ifaceBlock> &detailBloc
}
case PassmarkLineType::CheckMark:
{ // Check Notch
const QLineF &line1 = ConstFirst(passmark.lines);
const QLineF &line2 = ConstLast(passmark.lines);
const QLineF &line1 = passmark.lines.constFirst();
const QLineF &line2 = passmark.lines.constLast();
qreal width = QLineF(line1.p1(), line2.p2()).length();
@ -1346,7 +1342,7 @@ auto VDxfEngine::CreateAAMAPolygon(const QVector<C> &polygon, const UTF8STRING &
}
else
{
if (polygon.size() > 1 && ConstFirst<QPointF>(polygon) == ConstLast<QPointF>(polygon))
if (polygon.size() > 1 && polygon.constFirst() == polygon.constLast())
{
poly->flags |= 0x1; // closed NOLINT(hicpp-signed-bitwise)
}

View File

@ -243,9 +243,7 @@ auto VDxfPaintDevice::metric(QPaintDevice::PaintDeviceMetric metric) const -> in
case QPaintDevice::PdmDpiY:
return static_cast<int>(m_engine->GetResolution());
case QPaintDevice::PdmDevicePixelRatio:
#if QT_VERSION >= QT_VERSION_CHECK(5, 6, 0)
case QPaintDevice::PdmDevicePixelRatioScaled:
#endif
return 1;
default:
qWarning("VDxfPaintDevice::metric(), unhandled metric %d\n", metric);

View File

@ -54,10 +54,6 @@
#include "../vpatterndb/vcontainer.h"
#include "def.h"
#if QT_VERSION < QT_VERSION_CHECK(5, 5, 0)
#include "../vmisc/diagnostic.h"
#endif // QT_VERSION < QT_VERSION_CHECK(5, 5, 0)
const QString VMeasurements::TagVST = QStringLiteral("vst");
const QString VMeasurements::TagVIT = QStringLiteral("vit");
const QString VMeasurements::TagBodyMeasurements = QStringLiteral("body-measurements");

View File

@ -28,10 +28,6 @@
#include "vsinglelineoutlinechar.h"
#include "../vmisc/compatibility.h"
#if QT_VERSION < QT_VERSION_CHECK(5, 5, 0)
#include "../vmisc/diagnostic.h"
#endif // QT_VERSION < QT_VERSION_CHECK(5, 5, 0)
#include <QCache>
#include <QDir>
#include <QFile>
@ -171,7 +167,7 @@ void VSingleLineOutlineChar::LoadCorrections(const QString &dirPath) const
{
return;
}
QString filePath = directory.absoluteFilePath(ConstFirst<QString>(matchingFiles));
QString filePath = directory.absoluteFilePath(matchingFiles.constFirst());
QFile jsonFile(filePath);
if (!jsonFile.open(QIODevice::ReadOnly | QIODevice::Text))

View File

@ -29,11 +29,8 @@
#ifndef VABSTRACTARC_P_H
#define VABSTRACTARC_P_H
#include <QSharedData>
#if QT_VERSION < QT_VERSION_CHECK(5, 5, 0)
#include "../vmisc/diagnostic.h"
#endif // QT_VERSION < QT_VERSION_CHECK(5, 5, 0)
#include "vpointf.h"
#include <QSharedData>
QT_WARNING_PUSH
QT_WARNING_DISABLE_GCC("-Weffc++")

View File

@ -102,8 +102,8 @@ auto VAbstractCurve::GetSegmentPoints(const QVector<QPointF> &points, const QPoi
if (begin == end)
{
start = ConstFirst(segment);
finish = ConstLast(segment);
start = segment.constFirst();
finish = segment.constLast();
}
bool ok = false;
@ -176,7 +176,7 @@ auto VAbstractCurve::FromBegin(const QVector<QPointF> &points, const QPointF &be
return points;
}
if (ConstFirst(points).toPoint() == begin.toPoint())
if (points.constFirst().toPoint() == begin.toPoint())
{
SetResult(true);
return points;
@ -240,9 +240,9 @@ auto VAbstractCurve::ClosestPoint(QPointF scenePoint) const -> QPointF
return {};
}
if (VFuzzyComparePoints(ConstFirst(points), scenePoint))
if (VFuzzyComparePoints(points.constFirst(), scenePoint))
{
return ConstFirst(points);
return points.constFirst();
}
QPointF candidatePoint;
@ -301,7 +301,7 @@ auto VAbstractCurve::GetLengthByPoint(const QPointF &point) const -> qreal
return -1;
}
if (ConstFirst(points).toPoint() == point.toPoint())
if (points.constFirst().toPoint() == point.toPoint())
{
return 0;
}

View File

@ -32,9 +32,6 @@
#include <QSharedData>
#include "../ifc/ifcdef.h"
#if QT_VERSION < QT_VERSION_CHECK(5, 5, 0)
#include "../vmisc/diagnostic.h"
#endif // QT_VERSION < QT_VERSION_CHECK(5, 5, 0)
QT_WARNING_PUSH
QT_WARNING_DISABLE_GCC("-Weffc++")

View File

@ -30,9 +30,6 @@
#define VARC_P_H
#include <QSharedData>
#if QT_VERSION < QT_VERSION_CHECK(5, 5, 0)
#include "../vmisc/diagnostic.h"
#endif // QT_VERSION < QT_VERSION_CHECK(5, 5, 0)
#include "../vmisc/defglobal.h"

View File

@ -33,9 +33,6 @@
#include <QSharedData>
#include "vpointf.h"
#if QT_VERSION < QT_VERSION_CHECK(5, 5, 0)
#include "../vmisc/diagnostic.h"
#endif // QT_VERSION < QT_VERSION_CHECK(5, 5, 0)
QT_WARNING_PUSH
QT_WARNING_DISABLE_GCC("-Weffc++")

View File

@ -33,7 +33,6 @@
#include <QtMath>
#include "../ifc/exception/vexception.h"
#include "../vmisc/compatibility.h"
#include "vabstractcurve.h"
#include "vcubicbezierpath_p.h"
#include "vspline.h"
@ -350,7 +349,7 @@ auto VCubicBezierPath::FirstPoint() const -> VPointF
{
if (not d->path.isEmpty())
{
return ConstFirst(d->path);
return d->path.constFirst();
}
return {};
}

View File

@ -32,9 +32,6 @@
#include <QSharedData>
#include "vpointf.h"
#if QT_VERSION < QT_VERSION_CHECK(5, 5, 0)
#include "../vmisc/diagnostic.h"
#endif // QT_VERSION < QT_VERSION_CHECK(5, 5, 0)
QT_WARNING_PUSH
QT_WARNING_DISABLE_GCC("-Weffc++")

View File

@ -218,7 +218,7 @@ auto JoinVectors(const QVector<QPointF> &v1, const QVector<QPointF> &v2) -> QVec
for (auto p : v2)
{
if (not VFuzzyComparePoints(ConstLast(v), p, accuracy))
if (not VFuzzyComparePoints(v.constLast(), p, accuracy))
{
v.append(p);
}

View File

@ -3,9 +3,7 @@
#include <QSharedData>
#include <QTransform>
#if QT_VERSION < QT_VERSION_CHECK(5, 5, 0)
#include "../vmisc/diagnostic.h"
#endif // QT_VERSION < QT_VERSION_CHECK(5, 5, 0)
#include "../vmisc/defglobal.h"
QT_WARNING_PUSH

View File

@ -31,9 +31,6 @@
#include "vgeometrydef.h"
#include <QSharedData>
#if QT_VERSION < QT_VERSION_CHECK(5, 5, 0)
#include "../vmisc/diagnostic.h"
#endif // QT_VERSION < QT_VERSION_CHECK(5, 5, 0)
#include "../vmisc/typedef.h"

View File

@ -30,9 +30,6 @@
#include "vgeometrydef.h"
#include <QSharedData>
#if QT_VERSION < QT_VERSION_CHECK(5, 5, 0)
#include "../vmisc/diagnostic.h"
#endif // QT_VERSION < QT_VERSION_CHECK(5, 5, 0)
QT_WARNING_PUSH
QT_WARNING_DISABLE_GCC("-Weffc++")

View File

@ -35,9 +35,6 @@
#include <QTypeInfo>
#include <QtGlobal>
#if QT_VERSION < QT_VERSION_CHECK(5, 5, 0)
#include "../vmisc/diagnostic.h"
#endif // QT_VERSION < QT_VERSION_CHECK(5, 5, 0)
#include "vgobject.h"
class VPointFData;

View File

@ -29,12 +29,9 @@
#ifndef VPOINTF_P_H
#define VPOINTF_P_H
#include <QSharedData>
#if QT_VERSION < QT_VERSION_CHECK(5, 5, 0)
#include "../vmisc/diagnostic.h"
#endif // QT_VERSION < QT_VERSION_CHECK(5, 5, 0)
#include "../vmisc/defglobal.h"
#include <QPointF>
#include <QSharedData>
QT_WARNING_PUSH
QT_WARNING_DISABLE_GCC("-Weffc++")

View File

@ -33,7 +33,6 @@
#include <QPoint>
#include "../ifc/exception/vexception.h"
#include "../vmisc/compatibility.h"
#include "vabstractcurve.h"
#include "vsplinepath_p.h"
@ -365,7 +364,7 @@ auto VSplinePath::ToJson() const -> QJsonObject
//---------------------------------------------------------------------------------------------------------------------
auto VSplinePath::GetStartAngle() const -> qreal
{
return CountPoints() > 0 ? ConstFirst(GetSplinePath()).Angle2() : 0;
return CountPoints() > 0 ? GetSplinePath().constFirst().Angle2() : 0;
}
//---------------------------------------------------------------------------------------------------------------------
@ -373,30 +372,28 @@ auto VSplinePath::GetEndAngle() const -> qreal
{
if (CountPoints() > 0)
{
return ConstLast(GetSplinePath()).Angle1();
}
else
{
return 0;
return GetSplinePath().constLast().Angle1();
}
return 0;
}
//---------------------------------------------------------------------------------------------------------------------
auto VSplinePath::GetC1Length() const -> qreal
{
return CountPoints() > 0 ? ConstFirst(GetSplinePath()).Length2() : 0;
return CountPoints() > 0 ? GetSplinePath().constFirst().Length2() : 0;
}
//---------------------------------------------------------------------------------------------------------------------
auto VSplinePath::GetC2Length() const -> qreal
{
return CountPoints() > 0 ? ConstFirst(GetSplinePath()).Length1() : 0;
return CountPoints() > 0 ? GetSplinePath().constFirst().Length1() : 0;
}
//---------------------------------------------------------------------------------------------------------------------
auto VSplinePath::FirstPoint() const -> VPointF
{
return not d->path.isEmpty() ? ConstFirst(d->path).P() : VPointF();
return not d->path.isEmpty() ? d->path.constFirst().P() : VPointF();
}
//---------------------------------------------------------------------------------------------------------------------

View File

@ -45,10 +45,6 @@
#include "../vmisc/backport/text.h"
#endif
#if QT_VERSION < QT_VERSION_CHECK(5, 5, 0)
#include "../vmisc/diagnostic.h"
#endif // QT_VERSION < QT_VERSION_CHECK(5, 5, 0)
#include <QFile>
#include <QLine>
#include <QtMath>

View File

@ -607,7 +607,7 @@ auto AngleBySecondRightAngle(QVector<VRawSAPoint> points, QPointF p1, QPointF p2
if (success)
{
points = temp;
px = ConstLast(points);
px = points.constLast();
}
if (countBefore > 0)
@ -745,9 +745,9 @@ auto Rollback(QVector<VRawSAPoint> &points, const QLineF &edge) -> bool
if (not points.isEmpty())
{
if (ConstLast(points).toPoint() != ConstFirst(points).toPoint())
if (points.constLast().toPoint() != points.constFirst().toPoint())
{
points.append(ConstFirst(points)); // Should be always closed
points.append(points.constFirst()); // Should be always closed
}
}
}
@ -810,7 +810,7 @@ void RollbackByPointsIntersection(QVector<VRawSAPoint> &ekvPoints, const QVector
const QLineF bigLine1 = VAbstractPiece::ParallelLine(points.at(points.size() - 2), points.at(0), width);
QVector<VRawSAPoint> temp = ekvPoints;
temp.insert(ekvPoints.size() - 1, VRawSAPoint(bigLine1.p2(), points.at(0).CurvePoint(), points.at(0).TurnPoint()));
bool success = Rollback(temp, QLineF(ConstLast(points), points.at(1)));
bool success = Rollback(temp, QLineF(points.constLast(), points.at(1)));
if (success)
{
@ -829,7 +829,7 @@ void RollbackBySecondEdgeRightAngle(QVector<VRawSAPoint> &ekvPoints, const QVect
{
if (not ekvPoints.isEmpty())
{
const QLineF edge(ConstLast(points), points.at(1));
const QLineF edge(points.constLast(), points.at(1));
const QLineF bigLine1 = VAbstractPiece::ParallelLine(points.at(points.size() - 2), points.at(0), width);
QPointF px;
@ -841,7 +841,7 @@ void RollbackBySecondEdgeRightAngle(QVector<VRawSAPoint> &ekvPoints, const QVect
{
if (ekvPoints.size() > 3)
{
const QLineF edge1(ekvPoints.at(ekvPoints.size() - 2), ConstLast(ekvPoints));
const QLineF edge1(ekvPoints.at(ekvPoints.size() - 2), ekvPoints.constLast());
const QLineF edge2(ekvPoints.at(0), ekvPoints.at(1));
QPointF crosPoint;
@ -866,7 +866,7 @@ void RollbackBySecondEdgeRightAngle(QVector<VRawSAPoint> &ekvPoints, const QVect
if (success)
{
ekvPoints = temp;
px = ConstLast(ekvPoints);
px = ekvPoints.constLast();
}
QLineF seam(px, points.at(1));
@ -876,15 +876,15 @@ void RollbackBySecondEdgeRightAngle(QVector<VRawSAPoint> &ekvPoints, const QVect
if (not ekvPoints.isEmpty())
{
ekvPoints.append(ConstFirst(ekvPoints));
ekvPoints.append(ekvPoints.constFirst());
}
}
if (not ekvPoints.isEmpty())
{
if (ConstLast(ekvPoints).toPoint() != ConstFirst(ekvPoints).toPoint())
if (ekvPoints.constLast().toPoint() != ekvPoints.constFirst().toPoint())
{
ekvPoints.append(ConstFirst(ekvPoints)); // Should be always closed
ekvPoints.append(ekvPoints.constFirst()); // Should be always closed
}
}
}
@ -1077,7 +1077,7 @@ auto VAbstractPiece::Equidistant(QVector<VSAPoint> points, qreal width, const QS
return {};
}
if (ConstLast(points).toPoint() != ConstFirst(points).toPoint())
if (points.constLast().toPoint() != points.constFirst().toPoint())
{
points.append(points.at(0)); // Should be always closed
}
@ -1097,7 +1097,7 @@ auto VAbstractPiece::Equidistant(QVector<VSAPoint> points, qreal width, const QS
{ // last point
if (not ekvPoints.isEmpty())
{
ekvPoints.append(ConstFirst(ekvPoints));
ekvPoints.append(ekvPoints.constFirst());
}
continue;
}
@ -1111,7 +1111,7 @@ auto VAbstractPiece::Equidistant(QVector<VSAPoint> points, qreal width, const QS
QT_WARNING_DISABLE_GCC("-Wswitch-default")
// This check helps to find missed angle types in the switch
Q_STATIC_ASSERT_X(static_cast<int>(PieceNodeAngle::LAST_ONE_DO_NOT_USE) == 7, "Not all types were handled.");
switch (ConstLast(points).GetAngleType())
switch (points.constLast().GetAngleType())
{
case PieceNodeAngle::LAST_ONE_DO_NOT_USE:
case PieceNodeAngle::ByFirstEdgeRightAngle:
@ -1933,9 +1933,9 @@ auto VAbstractPiece::PlaceLabelShape(const VLayoutPlaceLabel &label) -> PlaceLab
arc.SetApproximationScale(10);
QVector<QPointF> points = arc.GetPoints();
if (not points.isEmpty() && ConstFirst(points) != ConstLast(points))
if (not points.isEmpty() && points.constFirst() != points.constLast())
{
points.append(ConstFirst(points));
points.append(points.constFirst());
}
QVector<VLayoutPoint> shape3;
@ -1959,9 +1959,9 @@ auto VAbstractPiece::PlaceLabelShape(const VLayoutPlaceLabel &label) -> PlaceLab
arc.SetApproximationScale(10);
QVector<QPointF> points = arc.GetPoints();
if (not points.isEmpty() && ConstFirst(points) != ConstLast(points))
if (not points.isEmpty() && points.constFirst() != points.constLast())
{
points.append(ConstFirst(points));
points.append(points.constFirst());
}
QVector<VLayoutPoint> circle;
@ -2021,7 +2021,7 @@ auto VAbstractPiece::LabelShapePath(const PlaceLabelImg &shape) -> QPainterPath
{
if (not p.isEmpty())
{
path.moveTo(ConstFirst<QPointF>(p));
path.moveTo(p.constFirst());
QVector<QPointF> polygon;
CastTo(p, polygon);
path.addPolygon(polygon);

View File

@ -274,9 +274,9 @@ inline auto VAbstractPiece::CorrectEquidistantPoints(const QVector<T> &points, b
}
}
if (not buf2.isEmpty() && ConstFirst(buf2) != ConstLast(buf2))
if (not buf2.isEmpty() && buf2.constFirst() != buf2.constLast())
{
buf2.append(ConstFirst(buf2));
buf2.append(buf2.constFirst());
}
buf2 = RemoveDublicates(buf2, false);
@ -297,7 +297,7 @@ inline auto VAbstractPiece::RemoveDublicates(const QVector<T> &points, bool remo
QVector<T> p;
p.reserve(points.size());
p.append(ConstFirst(points));
p.append(points.constFirst());
// Default accuracy is not enough
constexpr qreal accuracy = MmToPixel(0.5);
@ -408,8 +408,8 @@ template <class T> inline auto VAbstractPiece::CompareFirstAndLastPoints(QVector
return;
}
const T &first = ConstFirst(points);
const T &last = ConstLast(points);
const T &first = points.constFirst();
const T &last = points.constLast();
qreal testAccuracy = accuracy;
if (last.TurnPoint())
@ -441,8 +441,8 @@ template <> inline auto VAbstractPiece::CompareFirstAndLastPoints(QVector<VRawSA
return;
}
const VRawSAPoint &first = ConstFirst(points);
const VRawSAPoint &last = ConstLast(points);
const VRawSAPoint &first = points.constFirst();
const VRawSAPoint &last = points.constLast();
qreal testAccuracy = accuracy;
if ((first.Primary() && last.Primary()) || last.TurnPoint())
@ -475,7 +475,7 @@ inline auto VAbstractPiece::CompareFirstAndLastPoints<QPointF>(QVector<QPointF>
return;
}
if (VFuzzyComparePoints(ConstFirst(points), ConstLast(points), accuracy))
if (VFuzzyComparePoints(points.constFirst(), points.constLast(), accuracy))
{
points.removeLast();
}
@ -581,7 +581,7 @@ template <class T> inline auto VAbstractPiece::CheckLoop(const QVector<T> &point
{
loopFound = false;
const bool pathClosed = (ConstFirst(points) == ConstLast(points));
const bool pathClosed = (points.constFirst() == points.constLast());
QVector<T> ekvPoints;
ekvPoints.reserve(points.size());

View File

@ -34,10 +34,6 @@
#include <QString>
#include <QUuid>
#if QT_VERSION < QT_VERSION_CHECK(5, 5, 0)
#include "../vmisc/diagnostic.h"
#endif // QT_VERSION < QT_VERSION_CHECK(5, 5, 0)
#if QT_VERSION < QT_VERSION_CHECK(5, 14, 0)
#include "../vmisc/vdatastreamenum.h"
#endif

View File

@ -31,11 +31,8 @@
#include <QSharedData>
#include <QTransform>
#include "vlayoutdef.h"
#if QT_VERSION < QT_VERSION_CHECK(5, 5, 0)
#include "../vmisc/diagnostic.h"
#endif // QT_VERSION < QT_VERSION_CHECK(5, 5, 0)
#include "../vmisc/defglobal.h"
#include "vlayoutdef.h"
QT_WARNING_PUSH
QT_WARNING_DISABLE_GCC("-Weffc++")

View File

@ -48,7 +48,7 @@ void AppendToContour(QVector<QPointF> &contour, QPointF point)
{
if (not contour.isEmpty())
{
if (not VFuzzyComparePoints(ConstLast(contour), point))
if (not VFuzzyComparePoints(contour.constLast(), point))
{
contour.append(point);
}
@ -67,7 +67,7 @@ auto OptimizeCombining(const QVector<QPointF> &contour, const QPointF &withdrawE
return contour;
}
QPointF withdrawFirst = ConstLast(contour);
QPointF withdrawFirst = contour.constLast();
bool optimize = false;
int count = 0;
vsizetype cutIndex = -1;
@ -143,7 +143,7 @@ void VContour::CeateEmptySheetContour()
if (d->globalContour.isEmpty())
{
d->globalContour = CutEmptySheetEdge();
d->globalContour.append(ConstFirst(d->globalContour)); // Close path
d->globalContour.append(d->globalContour.constFirst()); // Close path
ResetAttributes();
}

View File

@ -35,9 +35,6 @@
#include <QSharedData>
#include <QVector>
#if QT_VERSION < QT_VERSION_CHECK(5, 5, 0)
#include "../vmisc/diagnostic.h"
#endif // QT_VERSION < QT_VERSION_CHECK(5, 5, 0)
#include "../vmisc/defglobal.h"
QT_WARNING_PUSH

View File

@ -52,10 +52,6 @@
#include "vprintlayout.h"
#include "vrawlayout.h"
#if QT_VERSION < QT_VERSION_CHECK(5, 5, 0)
#include "../vmisc/diagnostic.h"
#endif // QT_VERSION < QT_VERSION_CHECK(5, 5, 0)
namespace
{
QT_WARNING_PUSH
@ -457,11 +453,10 @@ void VLayoutExporter::PdfToPs(const QStringList &params)
QGuiApplication::restoreOverrideCursor();
#endif
QFile f(ConstLast<QString>(params));
QFile f(params.constLast());
if (not f.exists())
{
qCritical() << qUtf8Printable(
tr("Creating file '%1' failed! %2").arg(ConstLast<QString>(params), proc.errorString()));
qCritical() << qUtf8Printable(tr("Creating file '%1' failed! %2").arg(params.constLast(), proc.errorString()));
}
}

View File

@ -705,7 +705,7 @@ auto VLayoutGenerator::MasterPage() const -> VLayoutPaper
{
if (papers.size() < 2)
{
return ConstFirst(papers);
return papers.constFirst();
}
QList<QList<VLayoutPiece>> nDetails;

View File

@ -276,11 +276,11 @@ auto PrepareSAPassmark(const VPiece &piece, const VContainer *pattern, const VPa
if (side == PassmarkSide::All || side == PassmarkSide::Right)
{
layoutPassmark.baseLine = ConstFirst(baseLines);
layoutPassmark.baseLine = baseLines.constFirst();
}
else if (side == PassmarkSide::Right)
{
layoutPassmark.baseLine = ConstLast(baseLines);
layoutPassmark.baseLine = baseLines.constLast();
}
const QVector<QLineF> lines = passmark.SAPassmark(piece, pattern, side);
@ -358,7 +358,7 @@ auto PreapreBuiltInSAPassmark(const VPiece &piece, const VContainer *pattern, co
return {};
}
layoutPassmark.baseLine = ConstFirst(baseLines);
layoutPassmark.baseLine = baseLines.constFirst();
layoutPassmark.type = pData.passmarkLineType;
layoutPassmark.isBuiltIn = true;
layoutPassmark.isClockwiseOpening = pData.passmarkSAPoint.IsPassmarkClockwiseOpening();
@ -830,7 +830,7 @@ auto VLayoutPiece::GetPieceTextPosition() const -> QPointF
{
if (d->m_detailLabel.count() > 2)
{
return d->m_matrix.map(ConstFirst(d->m_detailLabel));
return d->m_matrix.map(d->m_detailLabel.constFirst());
}
return {};
@ -914,7 +914,7 @@ auto VLayoutPiece::GetPatternTextPosition() const -> QPointF
{
if (d->m_patternInfo.count() > 2)
{
return d->m_matrix.map(ConstFirst(d->m_patternInfo));
return d->m_matrix.map(d->m_patternInfo.constFirst());
}
return {};
@ -1383,7 +1383,7 @@ auto VLayoutPiece::ContourPath() const -> QPainterPath
// Draw seam allowance
QVector<VLayoutPoint> points = GetSeamAllowancePoints();
if (ConstLast(points).toPoint() != ConstFirst(points).toPoint())
if (points.constLast().toPoint() != points.constFirst().toPoint())
{
points.append(points.at(0)); // Should be always closed
}
@ -1527,7 +1527,7 @@ auto VLayoutPiece::MapPlaceLabelShape(PlaceLabelImg shape) const -> PlaceLabelIm
//---------------------------------------------------------------------------------------------------------------------
auto VLayoutPiece::BoundingRect(QVector<QPointF> points) -> QRectF
{
points.append(ConstFirst(points));
points.append(points.constFirst());
return QPolygonF(points).boundingRect();
}

View File

@ -36,11 +36,6 @@
#include "../vpatterndb/floatItemData/floatitemdef.h"
#include "../vwidgets/vpiecegrainline.h"
#include "compatibility.h"
#if QT_VERSION < QT_VERSION_CHECK(5, 5, 0)
#include "../vmisc/diagnostic.h"
#endif // QT_VERSION < QT_VERSION_CHECK(5, 5, 0)
#if QT_VERSION < QT_VERSION_CHECK(5, 14, 0)
#include "../vmisc/vdatastreamenum.h"
@ -262,7 +257,7 @@ inline auto operator>>(QDataStream &dataStream, VLayoutPieceData &piece) -> QDat
{
if (shape.size() >= 2)
{
piece.m_grainline = VPieceGrainline(QLineF(ConstFirst(shape), ConstLast(shape)), arrowType);
piece.m_grainline = VPieceGrainline(QLineF(shape.constFirst(), shape.constLast()), arrowType);
piece.m_grainline.SetEnabled(false);
}
else

View File

@ -34,10 +34,6 @@
#include <QSharedData>
#include <QVector>
#if QT_VERSION < QT_VERSION_CHECK(5, 5, 0)
#include "../vmisc/diagnostic.h"
#endif // QT_VERSION < QT_VERSION_CHECK(5, 5, 0)
#if QT_VERSION < QT_VERSION_CHECK(5, 14, 0)
#include "../vmisc/vdatastreamenum.h"
#endif

View File

@ -33,10 +33,6 @@
#include <QVector>
#include <QtGlobal>
#if QT_VERSION < QT_VERSION_CHECK(5, 5, 0)
#include "../vmisc/diagnostic.h"
#endif // QT_VERSION < QT_VERSION_CHECK(5, 5, 0)
QT_WARNING_PUSH
QT_WARNING_DISABLE_GCC("-Weffc++")
QT_WARNING_DISABLE_GCC("-Wnon-virtual-dtor")

View File

@ -280,7 +280,7 @@ void VPosition::SaveCandidate(VBestSquare &bestResult, const VLayoutPiece &detai
}
QVector<QPointF> newGContour = m_data.gContour.UniteWithContour(detail, globalI, detJ, type);
newGContour.append(ConstFirst(newGContour));
newGContour.append(newGContour.constFirst());
const QSizeF size = QPolygonF(newGContour).boundingRect().size();
const QRectF boundingRect = detail.MappedDetailBoundingRect();
const qreal depthPosition = m_data.isOriginPaperOrientationPortrait ? boundingRect.y() : boundingRect.x();

View File

@ -48,7 +48,6 @@
#include "../vmisc/compatibility.h"
#include "../vmisc/def.h"
#include "../vmisc/vabstractvalapplication.h"
#include "../vmisc/vmath.h"
namespace
{
@ -158,11 +157,7 @@ auto VPoster::Tile(QGraphicsItem *parent, const PosterData &img, vsizetype sheet
const QString &watermarkPath) const -> QVector<QGraphicsItem *>
{
QVector<QGraphicsItem *> data;
#if QT_VERSION >= QT_VERSION_CHECK(5, 5, 0)
data.append(Borders(parent, img, sheets));
#else
data += Borders(parent, img, sheets);
#endif
if (watermarkData.opacity > 0)
{

View File

@ -45,7 +45,6 @@
#include "../ifc/exception/vexception.h"
#include "../ifc/xml/vwatermarkconverter.h"
#include "../vformat/vwatermark.h"
#include "../vmisc/compatibility.h"
#include "../vmisc/vabstractvalapplication.h"
#include "../vpropertyexplorer/checkablemessagebox.h"
#include "dialogs/dialoglayoutscale.h"
@ -126,7 +125,7 @@ auto PreparePrinter(const QPrinterInfo &info, QPrinter::PrinterMode mode) -> QSh
return {};
}
tmpInfo = QPrinterInfo::printerInfo(ConstFirst<QString>(list));
tmpInfo = QPrinterInfo::printerInfo(list.constFirst());
}
auto printer = QSharedPointer<QPrinter>(new QPrinter(tmpInfo, mode));

View File

@ -30,9 +30,6 @@
#include <QtGlobal>
#if QT_VERSION < QT_VERSION_CHECK(5, 5, 0)
#include "../vmisc/diagnostic.h"
#endif // QT_VERSION < QT_VERSION_CHECK(5, 5, 0)
#include "vlayoutpoint.h"
QT_WARNING_PUSH

View File

@ -35,10 +35,6 @@
#include "../vmisc/def.h"
#include "vlayoutpoint.h"
#if QT_VERSION < QT_VERSION_CHECK(5, 5, 0)
#include "../vmisc/diagnostic.h"
#endif // QT_VERSION < QT_VERSION_CHECK(5, 5, 0)
QT_WARNING_PUSH
QT_WARNING_DISABLE_GCC("-Weffc++")
QT_WARNING_DISABLE_GCC("-Wnon-virtual-dtor")

View File

@ -55,10 +55,6 @@
#include "../vpatterndb/vcontainer.h"
#include "vtextmanager.h"
#if QT_VERSION < QT_VERSION_CHECK(5, 5, 0)
#include "../vmisc/diagnostic.h"
#endif // QT_VERSION < QT_VERSION_CHECK(5, 5, 0)
namespace
{
QT_WARNING_PUSH
@ -914,9 +910,9 @@ auto VTextManager::BreakTextIntoLines(const QString &text, const QFont &font, in
}
else
{
const int width = TextWidth(fontMetrics, ConstFirst<QString>(subWords));
const int width = TextWidth(fontMetrics, subWords.constFirst());
const int tWidth = !currentLine.isEmpty() ? currentLineWidth + spaceWidth + width : width;
AppendWord(ConstFirst<QString>(subWords), tWidth);
AppendWord(subWords.constFirst(), tWidth);
lines.append(currentLine);
if (subWords.size() == 2)
@ -925,7 +921,7 @@ auto VTextManager::BreakTextIntoLines(const QString &text, const QFont &font, in
currentLineWidth = 0;
// Insert the item after the current item
iterator.insert(ConstLast<QString>(subWords));
iterator.insert(subWords.constLast());
iterator.previous();
}
}
@ -1014,9 +1010,9 @@ auto VTextManager::BreakTextIntoLines(const QString &text, const VSvgFont &font,
}
else
{
const int width = qRound(engine.TextWidth(ConstFirst<QString>(subWords), penWidth));
const int width = qRound(engine.TextWidth(subWords.constFirst(), penWidth));
const int tWidth = !currentLine.isEmpty() ? currentLineWidth + spaceWidth + width : width;
AppendWord(ConstFirst<QString>(subWords), tWidth);
AppendWord(subWords.constFirst(), tWidth);
lines.append(currentLine);
if (subWords.size() == 2)
@ -1025,7 +1021,7 @@ auto VTextManager::BreakTextIntoLines(const QString &text, const VSvgFont &font,
currentLineWidth = 0;
// Insert the item after the current item
iterator.insert(ConstLast<QString>(subWords));
iterator.insert(subWords.constLast());
iterator.previous();
}
}

View File

@ -33,10 +33,6 @@
#if QT_VERSION < QT_VERSION_CHECK(5, 7, 0)
#if defined(Q_COMPILER_VARIADIC_TEMPLATES)
#if QT_VERSION < QT_VERSION_CHECK(5, 5, 0)
#include "../vmisc/diagnostic.h"
#endif // QT_VERSION < QT_VERSION_CHECK(5, 5, 0)
QT_WARNING_PUSH
QT_WARNING_DISABLE_GCC("-Weffc++")

View File

@ -33,10 +33,6 @@
#if QT_VERSION < QT_VERSION_CHECK(5, 14, 0)
#include <QTextStream>
#if QT_VERSION < QT_VERSION_CHECK(5, 5, 0)
#include "../vmisc/diagnostic.h"
#endif // QT_VERSION < QT_VERSION_CHECK(5, 5, 0)
namespace Qt
{
QT_WARNING_PUSH

View File

@ -52,54 +52,9 @@
#define REGISTER_META_TYPE_STREAM_OPERATORS(TYPE) qRegisterMetaTypeStreamOperators<TYPE>(#TYPE);
#endif // QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
#if QT_VERSION < QT_VERSION_CHECK(5, 5, 0)
#include "diagnostic.h"
#endif // QT_VERSION < QT_VERSION_CHECK(5, 5, 0)
class QPointF;
// Contains helpful methods to hide version dependent code. It can be deprecation of method or change in API
//---------------------------------------------------------------------------------------------------------------------
template <typename T, template <typename> class Cont> inline auto ConstFirst(const Cont<T> &container) -> const T &
{
#if QT_VERSION >= QT_VERSION_CHECK(5, 6, 0)
return container.constFirst();
#else
return container.first(); // clazy:exclude=detaching-temporary
#endif
}
//---------------------------------------------------------------------------------------------------------------------
template <typename T, typename C> inline auto ConstFirst(const C &container) -> const T &
{
#if QT_VERSION >= QT_VERSION_CHECK(5, 6, 0)
return container.constFirst();
#else
return container.first(); // clazy:exclude=detaching-temporary
#endif
}
//---------------------------------------------------------------------------------------------------------------------
template <typename T, template <typename> class Cont> inline auto ConstLast(const Cont<T> &container) -> const T &
{
#if QT_VERSION >= QT_VERSION_CHECK(5, 6, 0)
return container.constLast();
#else
return container.last(); // clazy:exclude=detaching-temporary
#endif
}
//---------------------------------------------------------------------------------------------------------------------
template <typename T, typename C> inline auto ConstLast(const C &container) -> const T &
{
#if QT_VERSION >= QT_VERSION_CHECK(5, 6, 0)
return container.constLast();
#else
return container.last(); // clazy:exclude=detaching-temporary
#endif
}
//---------------------------------------------------------------------------------------------------------------------
template <typename T>
inline auto Intersects(const T &l1, const T &l2, QPointF *intersectionPoint) -> typename T::IntersectType
@ -179,29 +134,6 @@ template <typename T> inline auto ConvertToVector(const QSet<T> &container) -> Q
// #endif
//}
//---------------------------------------------------------------------------------------------------------------------
template <typename T> inline void Move(T &vector, int from, int to)
{
QT_WARNING_PUSH
// cppcheck-suppress unknownMacro
QT_WARNING_DISABLE_GCC("-Wstrict-overflow")
#if QT_VERSION < QT_VERSION_CHECK(5, 6, 0)
Q_ASSERT_X(from >= 0 && from < vector.size(), "QVector::move(int,int)", "'from' is out-of-range");
Q_ASSERT_X(to >= 0 && to < vector.size(), "QVector::move(int,int)", "'to' is out-of-range");
if (from == to) // don't detach when no-op
{
return;
}
typename T::iterator b = vector.begin();
from < to ? std::rotate(b + from, b + from + 1, b + to + 1) : std::rotate(b + to, b + from, b + from + 1);
#else
vector.move(from, to);
#endif // QT_VERSION < QT_VERSION_CHECK(5, 6, 0)
QT_WARNING_POP
}
//---------------------------------------------------------------------------------------------------------------------
template <typename T> inline auto Reverse(const QVector<T> &container) -> QVector<T>
{
@ -233,42 +165,6 @@ inline auto Reverse(const T &container) -> T
return Reverse<QString, QList>(container);
}
//---------------------------------------------------------------------------------------------------------------------
template <typename Cont, typename Input> inline void AppendTo(Cont &container, const Input &input)
{
#if QT_VERSION >= QT_VERSION_CHECK(5, 5, 0)
container.append(input);
#else
for (auto &item : input)
{
container.append(item);
}
#endif // QT_VERSION >= QT_VERSION_CHECK(5, 5, 0)
}
//---------------------------------------------------------------------------------------------------------------------
template <typename T> inline auto SetIntersects(const QSet<T> &set1, const QSet<T> &set2) -> bool
{
#if QT_VERSION >= QT_VERSION_CHECK(5, 6, 0)
return set1.intersects(set2);
#else
const bool otherIsBigger = set2.size() > set1.size();
const QSet<T> &smallestSet = otherIsBigger ? set1 : set2;
const QSet<T> &biggestSet = otherIsBigger ? set2 : set1;
typename QSet<T>::const_iterator i = smallestSet.cbegin();
typename QSet<T>::const_iterator e = smallestSet.cend();
while (i != e)
{
if (biggestSet.contains(*i))
{
return true;
}
++i;
}
return false;
#endif
}
//---------------------------------------------------------------------------------------------------------------------
inline auto TextWidth(const QFontMetrics &fm, const QString &text, int len = -1) -> int
{

View File

@ -61,10 +61,6 @@
#include "../ifc/exception/vexception.h"
#include "literals.h"
#if QT_VERSION < QT_VERSION_CHECK(5, 5, 0)
#include "diagnostic.h"
#endif // QT_VERSION < QT_VERSION_CHECK(5, 5, 0)
namespace
{
//---------------------------------------------------------------------------------------------------------------------

View File

@ -43,9 +43,6 @@
#include "debugbreak.h"
#include "defglobal.h"
#if QT_VERSION < QT_VERSION_CHECK(5, 5, 0)
#include "diagnostic.h"
#endif // QT_VERSION < QT_VERSION_CHECK(5, 5, 0)
template <class T> class QSharedPointer;
@ -54,22 +51,6 @@ template <class T> class QSharedPointer;
#include <ciso646> // and, not, or
#endif
// Backport of relaxed constexpr
#if QT_VERSION < QT_VERSION_CHECK(5, 5, 0)
#if defined Q_COMPILER_CONSTEXPR
#if defined(__cpp_constexpr) && __cpp_constexpr - 0 >= 201304
#define Q_DECL_RELAXED_CONSTEXPR constexpr
#define Q_RELAXED_CONSTEXPR constexpr
#else
#define Q_DECL_RELAXED_CONSTEXPR
#define Q_RELAXED_CONSTEXPR const
#endif
#else
#define Q_DECL_RELAXED_CONSTEXPR
#define Q_RELAXED_CONSTEXPR const
#endif
#endif
#if (defined(Q_CC_GNU) && Q_CC_GNU <= 409) && !defined(Q_CC_CLANG)
// NOLINTNEXTLINE(cppcoreguidelines-macro-usage)
#define COPY_CONSTRUCTOR_IMPL(className) \

View File

@ -1,96 +0,0 @@
/************************************************************************
**
** @file diagnostic.h
** @author Roman Telezhynskyi <dismine(at)gmail.com>
** @date 6 8, 2016
**
** @brief
** @copyright
** This source code is part of the Valentina project, a pattern making
** program, whose allow create and modeling patterns of clothing.
** Copyright (C) 2016 Valentina project
** <https://gitlab.com/smart-pattern/valentina> All Rights Reserved.
**
** Valentina is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation, either version 3 of the License, or
** (at your option) any later version.
**
** Valentina 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 General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with Valentina. If not, see <http://www.gnu.org/licenses/>.
**
*************************************************************************/
#ifndef DIAGNOSTIC_H
#define DIAGNOSTIC_H
#include <QtGlobal>
#if QT_VERSION < QT_VERSION_CHECK(5, 5, 0)
/*
* Warning/diagnostic handling
*/
#define QT_DO_PRAGMA(text) _Pragma(#text)
#if defined(Q_CC_INTEL) && defined(Q_CC_MSVC)
/* icl.exe: Intel compiler on Windows */
#undef QT_DO_PRAGMA /* not needed */
#define QT_WARNING_PUSH __pragma(warning(push))
#define QT_WARNING_POP __pragma(warning(pop))
#define QT_WARNING_DISABLE_MSVC(number)
#define QT_WARNING_DISABLE_INTEL(number) __pragma(warning(disable : number))
#define QT_WARNING_DISABLE_CLANG(text)
#define QT_WARNING_DISABLE_GCC(text)
#elif defined(Q_CC_INTEL)
/* icc: Intel compiler on Linux or OS X */
#define QT_WARNING_PUSH QT_DO_PRAGMA(warning(push))
#define QT_WARNING_POP QT_DO_PRAGMA(warning(pop))
#define QT_WARNING_DISABLE_INTEL(number) QT_DO_PRAGMA(warning(disable : number))
#define QT_WARNING_DISABLE_MSVC(number)
#define QT_WARNING_DISABLE_CLANG(text)
#define QT_WARNING_DISABLE_GCC(text)
#elif defined(Q_CC_MSVC) && _MSC_VER >= 1500
#undef QT_DO_PRAGMA /* not needed */
#define QT_WARNING_PUSH __pragma(warning(push))
#define QT_WARNING_POP __pragma(warning(pop))
#define QT_WARNING_DISABLE_MSVC(number) __pragma(warning(disable : number))
#define QT_WARNING_DISABLE_INTEL(number)
#define QT_WARNING_DISABLE_CLANG(text)
#define QT_WARNING_DISABLE_GCC(text)
#elif defined(Q_CC_CLANG)
#define QT_WARNING_PUSH QT_DO_PRAGMA(clang diagnostic push)
#define QT_WARNING_POP QT_DO_PRAGMA(clang diagnostic pop)
#define QT_WARNING_DISABLE_CLANG(text) QT_DO_PRAGMA(clang diagnostic ignored text)
#define QT_WARNING_DISABLE_GCC(text) QT_DO_PRAGMA(GCC diagnostic ignored text) // GCC directives work in Clang too
#define QT_WARNING_DISABLE_INTEL(number)
#define QT_WARNING_DISABLE_MSVC(number)
#elif defined(Q_CC_GNU) && (__GNUC__ * 100 + __GNUC_MINOR__ >= 406)
#define QT_WARNING_PUSH QT_DO_PRAGMA(GCC diagnostic push)
#define QT_WARNING_POP QT_DO_PRAGMA(GCC diagnostic pop)
#define QT_WARNING_DISABLE_GCC(text) QT_DO_PRAGMA(GCC diagnostic ignored text)
#define QT_WARNING_DISABLE_CLANG(text)
#define QT_WARNING_DISABLE_INTEL(number)
#define QT_WARNING_DISABLE_MSVC(number)
#else // All other compilers, GCC < 4.6 and MSVC < 2008
#define QT_WARNING_DISABLE_GCC(text)
#define QT_WARNING_PUSH
#define QT_WARNING_POP
#define QT_WARNING_DISABLE_INTEL(number)
#define QT_WARNING_DISABLE_MSVC(number)
#define QT_WARNING_DISABLE_CLANG(text)
#define QT_WARNING_DISABLE_GCC(text)
#endif
#else
#include <qcompilerdetection.h>
#endif // QT_VERSION < QT_VERSION_CHECK(5, 5, 0)
#endif // DIAGNOSTIC_H

View File

@ -10,10 +10,6 @@
#include <QtGlobal>
#if QT_VERSION < QT_VERSION_CHECK(5, 5, 0)
#include "../diagnostic.h"
#endif // QT_VERSION < QT_VERSION_CHECK(5, 5, 0)
namespace fpm
{

View File

@ -46,10 +46,6 @@
#include <QTextCodec>
#endif
#if QT_VERSION < QT_VERSION_CHECK(5, 5, 0)
#include "../vmisc/diagnostic.h"
#endif // QT_VERSION < QT_VERSION_CHECK(5, 5, 0)
#if QT_VERSION < QT_VERSION_CHECK(5, 14, 0)
#include "backport/text.h"
#endif

View File

@ -30,9 +30,7 @@
#include <QList>
#include <QSharedData>
#if QT_VERSION < QT_VERSION_CHECK(5, 5, 0)
#include "../diagnostic.h"
#endif // QT_VERSION < QT_VERSION_CHECK(5, 5, 0)
#include "../defglobal.h"
#include "svgdef.h"

View File

@ -38,10 +38,6 @@
#include "vsvgfontengine.h"
#include "vsvgfontreader.h"
#if QT_VERSION < QT_VERSION_CHECK(5, 5, 0)
#include "../vmisc/diagnostic.h"
#endif // QT_VERSION < QT_VERSION_CHECK(5, 5, 0)
namespace
{
QT_WARNING_PUSH

View File

@ -32,9 +32,7 @@
#include <QChar>
#include <QHash>
#include <QSharedData>
#if QT_VERSION < QT_VERSION_CHECK(5, 5, 0)
#include "../diagnostic.h"
#endif // QT_VERSION < QT_VERSION_CHECK(5, 5, 0)
#include "../defglobal.h"
#include "vsvgglyph.h"

View File

@ -31,9 +31,7 @@
#include <QChar>
#include <QPainterPath>
#include <QSharedData>
#if QT_VERSION < QT_VERSION_CHECK(5, 5, 0)
#include "../diagnostic.h"
#endif // QT_VERSION < QT_VERSION_CHECK(5, 5, 0)
#include "../defglobal.h"
QT_WARNING_PUSH

View File

@ -32,10 +32,6 @@
#include <QSet>
#include <QtMath>
#if QT_VERSION < QT_VERSION_CHECK(5, 5, 0)
#include "../diagnostic.h"
#endif // QT_VERSION < QT_VERSION_CHECK(5, 5, 0)
#include "../compatibility.h"
namespace

View File

@ -30,10 +30,6 @@
#include <QJsonObject>
#include <QJsonValue>
#if QT_VERSION < QT_VERSION_CHECK(5, 5, 0)
#include "../diagnostic.h"
#endif // QT_VERSION < QT_VERSION_CHECK(5, 5, 0)
namespace
{
QT_WARNING_PUSH

View File

@ -29,10 +29,6 @@
#include <QJsonObject>
#if QT_VERSION < QT_VERSION_CHECK(5, 5, 0)
#include "../diagnostic.h"
#endif // QT_VERSION < QT_VERSION_CHECK(5, 5, 0)
namespace
{
QT_WARNING_PUSH

View File

@ -33,10 +33,6 @@
#include <algorithm>
#include <vector>
#if QT_VERSION < QT_VERSION_CHECK(5, 5, 0)
#include "../diagnostic.h"
#endif // QT_VERSION < QT_VERSION_CHECK(5, 5, 0)
namespace
{
QT_WARNING_PUSH

View File

@ -42,7 +42,6 @@
#include "QtConcurrent/qtconcurrentrun.h"
#include "compatibility.h"
#include "literals.h"
#include "svgfont/vsvgfontdatabase.h"
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
@ -112,7 +111,6 @@ VAbstractApplication::VAbstractApplication(int &argc, char **argv)
{
QString rules;
#if QT_VERSION >= QT_VERSION_CHECK(5, 4, 1)
#if defined(V_NO_ASSERT)
// Ignore SSL-related warnings
// See issue #528: Error: QSslSocket: cannot resolve SSLv2_client_method.
@ -121,7 +119,6 @@ VAbstractApplication::VAbstractApplication(int &argc, char **argv)
rules += QLatin1String("qt.network.ssl.critical=false\n"
"qt.network.ssl.fatal=false\n");
#endif // defined(V_NO_ASSERT)
#endif // QT_VERSION >= QT_VERSION_CHECK(5, 4, 1)
#if defined(V_NO_ASSERT)
// See issue #992: QXcbConnection: XCB Error.
@ -135,7 +132,7 @@ VAbstractApplication::VAbstractApplication(int &argc, char **argv)
QLoggingCategory::setFilterRules(rules);
}
#if QT_VERSION >= QT_VERSION_CHECK(5, 6, 0) && QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
// Enable support for HiDPI bitmap resources
// The attribute is available since Qt 5.1, but by default disabled.
// Because on Windows and Mac OS X we always use last version
@ -538,19 +535,11 @@ void VAbstractApplication::InitHighDpiScaling(int argc, char *argv[])
/* For more info see: http://doc.qt.io/qt-5/highdpi.html */
if (IsOptionSet(argc, argv, qPrintable(QLatin1String("--") + LONG_OPTION_NO_HDPI_SCALING)))
{
#if QT_VERSION >= QT_VERSION_CHECK(5, 6, 0)
QCoreApplication::setAttribute(Qt::AA_DisableHighDpiScaling);
#else
qputenv("QT_DEVICE_PIXEL_RATIO", QByteArray("1"));
#endif
}
else
{
#if QT_VERSION >= QT_VERSION_CHECK(5, 6, 0)
QApplication::setAttribute(Qt::AA_EnableHighDpiScaling); // DPI support
#else
qputenv("QT_AUTO_SCREEN_SCALE_FACTOR", QByteArray("1"));
#endif
}
#else
Q_UNUSED(argc);

Some files were not shown because too many files have changed in this diff Show More