Minimal Qt version increased to Qt 5.15. Minimal C++ standard to C++17.

This commit is contained in:
Roman Telezhynskyi 2024-01-23 15:57:23 +02:00
parent 35adb101ba
commit 38dbbe29ba
295 changed files with 689 additions and 15753 deletions

View File

@ -62,6 +62,7 @@
- Puzzle app. Horizontal piece flipping. - Puzzle app. Horizontal piece flipping.
- Mirror line. - Mirror line.
- Fold line. - Fold line.
- Minimal Qt version increased to Qt 5.15. Minimal C++ standard to C++17.
# Valentina 0.7.52 September 12, 2022 # Valentina 0.7.52 September 12, 2022
- Fix crash when default locale is ru. - Fix crash when default locale is ru.

View File

@ -158,18 +158,6 @@ environment:
WINDEPLOYQT_NO_COMPILER_RUNTIME: "false" WINDEPLOYQT_NO_COMPILER_RUNTIME: "false"
DEPLOY: true DEPLOY: true
RUN_TESTS: true RUN_TESTS: true
- job_name: Windows_Qt_5_6_(GCC_x86)
APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015
COMPILER: mingw
QT: Qt\5.6\mingw49_32
QT_VERSION: Qt5_6
BUILD_SYSTEM: "make"
MINGW_PATH: C:\Qt\Tools\mingw492_32\bin
ARCH: x86
PYTHON: "C:\\Python38"
PLATFORM: "WindowsXP+"
DEPLOY: true
- job_name: Windows_Qt_5_15_(make_GCC_x86) - job_name: Windows_Qt_5_15_(make_GCC_x86)
APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2019 APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2019
@ -259,18 +247,6 @@ environment:
PLATFORM: "macOS_10.13+" PLATFORM: "macOS_10.13+"
DEPLOY: false DEPLOY: false
- job_name: Windows_Qt_5_6_(MSVC_x64)
APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015
COMPILER: msvc
QT: Qt\5.6\msvc2015_64
QT_VERSION: Qt5_6
BUILD_SYSTEM: "nmake"
VSVER: 14
ARCH: x64
PYTHON: "C:\\Python38-x64"
PLATFORM: "WindowsXP+"
DEPLOY: false
matrix: matrix:
fast_finish: false fast_finish: false
exclude: exclude:
@ -286,8 +262,6 @@ matrix:
job_name: Windows_Qt_5_15_(qbs_GCC_x64) job_name: Windows_Qt_5_15_(qbs_GCC_x64)
- platform: x86 - platform: x86
job_name: Windows_Qt_5_15_(qbs_MSVC_x64) job_name: Windows_Qt_5_15_(qbs_MSVC_x64)
- platform: x86
job_name: Windows_Qt_5_6_(MSVC_x64)
- platform: x86 - platform: x86
job_name: MacOS_12_Qt_6_4 (multibundle) job_name: MacOS_12_Qt_6_4 (multibundle)
- platform: x86 - platform: x86
@ -302,8 +276,6 @@ matrix:
job_name: Windows_Qt_5_15_(make_GCC_x86) job_name: Windows_Qt_5_15_(make_GCC_x86)
- platform: x64 - platform: x64
job_name: Windows_Qt_5_15_(qbs_GCC_x86) job_name: Windows_Qt_5_15_(qbs_GCC_x86)
- platform: x64
job_name: Windows_Qt_5_6_(GCC_x86)
for: for:
@ -449,8 +421,6 @@ for:
- job_name: Windows_Qt_5_15_(make_GCC_x86) - job_name: Windows_Qt_5_15_(make_GCC_x86)
- job_name: Windows_Qt_5_15_(make_GCC_x64) - job_name: Windows_Qt_5_15_(make_GCC_x64)
- job_name: Windows_Qt_5_15_(nmake_MSVC_x64) - job_name: Windows_Qt_5_15_(nmake_MSVC_x64)
- job_name: Windows_Qt_5_6_(GCC_x86)
- job_name: Windows_Qt_5_6_(MSVC_x64)
# clone directory # clone directory
clone_folder: c:\projects\valentina clone_folder: c:\projects\valentina

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -42,9 +42,7 @@ CppApplication {
cpp.cxxLanguageVersion: { cpp.cxxLanguageVersion: {
if (Qt.core.versionMajor >= 6) // Start building with C++20 since Qt 6.0 if (Qt.core.versionMajor >= 6) // Start building with C++20 since Qt 6.0
return "c++20"; return "c++20";
else if(Qt.core.versionMajor >= 5 && Qt.core.versionMinor >= 12) // Since Qt 5.12 available support for C++17 return "c++17";
return "c++17";
return "c++11";
} }
Properties { Properties {
@ -52,11 +50,7 @@ CppApplication {
cpp.minimumWindowsVersion: { cpp.minimumWindowsVersion: {
if (Qt.core.versionMajor >= 6) if (Qt.core.versionMajor >= 6)
return "6.02"; // should be 10.0 return "6.02"; // should be 10.0
return "6.00";
if (Qt.core.versionMajor >= 5 && Qt.core.versionMinor >= 7)
return "6.00";
return "5.01";
} }
} }
@ -80,31 +74,18 @@ CppApplication {
files.push("msvcr120.dll"); files.push("msvcr120.dll");
// Minimal supported OpenSSL version since Qt 5.12.4 is 1.1.1. // Minimal supported OpenSSL version since Qt 5.12.4 is 1.1.1.
if (Utilities.versionCompare(Qt.core.version, "5.12.4") >= 0) { if (qbs.architecture.contains("x86_64")) {
if (qbs.architecture.contains("x86_64")) { files.push(
files.push( "openssl/win64/libcrypto-1_1-x64.dll",
"openssl/win64/libcrypto-1_1-x64.dll", "openssl/win64/libssl-1_1-x64.dll"
"openssl/win64/libssl-1_1-x64.dll" );
);
} else {
files.push(
"openssl/win32/libcrypto-1_1.dll",
"openssl/win32/libssl-1_1.dll"
);
}
} else { } else {
if (qbs.architecture.contains("x86_64")) { files.push(
files.push( "openssl/win32/libcrypto-1_1.dll",
"openssl/win64/libeay32.dll", "openssl/win32/libssl-1_1.dll"
"openssl/win64/ssleay32.dll" );
);
} else {
files.push(
"openssl/win32/libeay32.dll",
"openssl/win32/ssleay32.dll"
);
}
} }
return files; return files;
} }
qbs.install: true qbs.install: true

View File

@ -26,9 +26,7 @@ Library {
cpp.cxxLanguageVersion: { cpp.cxxLanguageVersion: {
if (Qt.core.versionMajor >= 6) // Start building with C++20 since Qt 6.0 if (Qt.core.versionMajor >= 6) // Start building with C++20 since Qt 6.0
return "c++20"; return "c++20";
else if(Qt.core.versionMajor >= 5 && Qt.core.versionMinor >= 12) // Since Qt 5.12 available support for C++17 return "c++17";
return "c++17";
return "c++11";
} }
Properties { Properties {
@ -37,10 +35,7 @@ Library {
if (Qt.core.versionMajor >= 6) if (Qt.core.versionMajor >= 6)
return "6.02"; // should be 10.0 return "6.02"; // should be 10.0
if (Qt.core.versionMajor >= 5 && Qt.core.versionMinor >= 7) return "6.00";
return "6.00";
return "5.01";
} }
} }

View File

@ -157,34 +157,8 @@ Module {
return "10.15"; // Qt 6.4 and above return "10.15"; // Qt 6.4 and above
} }
if (Qt.core.versionMajor >= 5) { // See page https://doc.qt.io/qt-5.15/supported-platforms.html
// See page https://doc.qt.io/qt-5.15/supported-platforms.html return "10.13";
// For qt 5.14 https://doc.qt.io/archives/qt-5.14/supported-platforms.html
if (Qt.core.versionMinor >= 14) // Qt 5.14
return "10.13";
// For Qt 5.13 https://doc.qt.io/archives/qt-5.13/supported-platforms.html
// For Qt 5.12 https://doc.qt.io/archives/qt-5.12/supported-platforms.html
if (Qt.core.versionMinor >= 12) // Qt 5.12
return "10.12";
// For older versions https://doc.qt.io/archives/qt-5.11/supported-platforms-and-configurations.html
if (Qt.core.versionMinor >= 10) // Qt 5.11 and Qt 5.10
return "10.11";
if (Qt.core.versionMinor >= 9) // Qt 5.9
return "10.10";
if (Qt.core.versionMinor >= 8) // Qt 5.8
return "10.9";
if (Qt.core.versionMinor >= 7) // Qt 5.7
return "10.8";
return "10.7";
}
return undefined;
} }
cpp.separateDebugInformation: true cpp.separateDebugInformation: true

View File

@ -24,14 +24,8 @@ Module {
var enableCompression = input.moduleProperty("ebr", "enableCompression"); var enableCompression = input.moduleProperty("ebr", "enableCompression");
if (enableCompression) { if (enableCompression) {
var compressAlgorithm = input.moduleProperty("ebr", "compressAlgorithm"); var compressAlgorithm = input.moduleProperty("ebr", "compressAlgorithm");
if (product.Qt.core.versionMajor >= 5 && product.Qt.core.versionMinor >= 13) { if (compressAlgorithm !== "zstd")
// Since Qt 5.13 we have option to select compress algorithm args.push("-compress-algo", compressAlgorithm);
if (compressAlgorithm !== "zstd")
args.push("-compress-algo", compressAlgorithm);
} else {
if (compressAlgorithm !== "zlib")
compressAlgorithm = "zlib";
}
var thresholdLevel = input.moduleProperty("ebr", "thresholdLevel"); var thresholdLevel = input.moduleProperty("ebr", "thresholdLevel");
if (thresholdLevel !== 70) if (thresholdLevel !== 70)

View File

@ -32,9 +32,6 @@
#include <QScrollBar> #include <QScrollBar>
#include <QVBoxLayout> #include <QVBoxLayout>
#if QT_VERSION < QT_VERSION_CHECK(5, 7, 0)
#include "../vmisc/backport/qoverload.h"
#endif // QT_VERSION < QT_VERSION_CHECK(5, 7, 0)
#include "../layout/vplayout.h" #include "../layout/vplayout.h"
#include "../layout/vpsheet.h" #include "../layout/vpsheet.h"

View File

@ -35,9 +35,6 @@
#include <QWidget> #include <QWidget>
#include "../layout/layoutdef.h" #include "../layout/layoutdef.h"
#if QT_VERSION < QT_VERSION_CHECK(5, 13, 0)
#include "../vmisc/defglobal.h"
#endif
namespace Ui namespace Ui
{ {

View File

@ -32,9 +32,6 @@
#include <QMouseEvent> #include <QMouseEvent>
#include "../layout/layoutdef.h" #include "../layout/layoutdef.h"
#if QT_VERSION < QT_VERSION_CHECK(5, 13, 0)
#include "../vmisc/defglobal.h"
#endif
class VPCarrouselPiece : public QListWidgetItem class VPCarrouselPiece : public QListWidgetItem
{ {

View File

@ -43,10 +43,6 @@
#include "vpcarrouselpiece.h" #include "vpcarrouselpiece.h"
#include "vpmimedatapiece.h" #include "vpmimedatapiece.h"
#if QT_VERSION < QT_VERSION_CHECK(5, 7, 0)
#include "../vmisc/backport/qoverload.h"
#endif // QT_VERSION < QT_VERSION_CHECK(5, 7, 0)
QT_WARNING_PUSH QT_WARNING_PUSH
QT_WARNING_DISABLE_CLANG("-Wmissing-prototypes") QT_WARNING_DISABLE_CLANG("-Wmissing-prototypes")
QT_WARNING_DISABLE_INTEL(1418) QT_WARNING_DISABLE_INTEL(1418)

View File

@ -34,9 +34,6 @@
#include <QUuid> #include <QUuid>
#include "../layout/layoutdef.h" #include "../layout/layoutdef.h"
#if QT_VERSION < QT_VERSION_CHECK(5, 13, 0)
#include "../vmisc/defglobal.h"
#endif
class VPMimeDataPiece : public QMimeData class VPMimeDataPiece : public QMimeData
{ {

View File

@ -34,10 +34,6 @@
#include "../vmisc/vabstractshortcutmanager.h" #include "../vmisc/vabstractshortcutmanager.h"
#include "ui_puzzlepreferencesconfigurationpage.h" #include "ui_puzzlepreferencesconfigurationpage.h"
#if QT_VERSION < QT_VERSION_CHECK(5, 7, 0)
#include "../vmisc/backport/qoverload.h"
#endif // QT_VERSION < QT_VERSION_CHECK(5, 7, 0)
#include <QStyleHints> #include <QStyleHints>
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------

View File

@ -30,10 +30,6 @@
#include <QWidget> #include <QWidget>
#if QT_VERSION < QT_VERSION_CHECK(5, 13, 0)
#include "../vmisc/defglobal.h"
#endif
namespace Ui namespace Ui
{ {
class PuzzlePreferencesConfigurationPage; class PuzzlePreferencesConfigurationPage;

View File

@ -26,15 +26,12 @@
** **
*************************************************************************/ *************************************************************************/
#include "puzzlepreferenceslayoutpage.h" #include "puzzlepreferenceslayoutpage.h"
#include "ui_puzzlepreferenceslayoutpage.h"
#include "../../vpapplication.h" #include "../../vpapplication.h"
#if QT_VERSION < QT_VERSION_CHECK(5, 7, 0) #include "ui_puzzlepreferenceslayoutpage.h"
#include "../vmisc/backport/qoverload.h"
#endif // QT_VERSION < QT_VERSION_CHECK(5, 7, 0)
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
PuzzlePreferencesLayoutPage::PuzzlePreferencesLayoutPage(QWidget *parent) : PuzzlePreferencesLayoutPage::PuzzlePreferencesLayoutPage(QWidget *parent)
QWidget(parent), : QWidget(parent),
ui(new Ui::PuzzlePreferencesLayoutPage) ui(new Ui::PuzzlePreferencesLayoutPage)
{ {
ui->setupUi(this); ui->setupUi(this);
@ -49,47 +46,48 @@ PuzzlePreferencesLayoutPage::PuzzlePreferencesLayoutPage(QWidget *parent) :
ReadSettings(); ReadSettings();
connect(ui->comboBoxLayoutUnit, QOverload<int>::of(&QComboBox::currentIndexChanged), connect(ui->comboBoxLayoutUnit, QOverload<int>::of(&QComboBox::currentIndexChanged), this,
this, &PuzzlePreferencesLayoutPage::ConvertPaperSize); &PuzzlePreferencesLayoutPage::ConvertPaperSize);
connect(ui->comboBoxSheetTemplates, QOverload<int>::of(&QComboBox::currentIndexChanged), connect(ui->comboBoxSheetTemplates, QOverload<int>::of(&QComboBox::currentIndexChanged), this,
this, [this] [this]
{ {
SheetSize(SheetTemplate()); m_settingsChanged = true; SheetSize(SheetTemplate());
}); m_settingsChanged = true;
connect(ui->comboBoxTileTemplates, QOverload<int>::of(&QComboBox::currentIndexChanged), });
this, [this] connect(ui->comboBoxTileTemplates, QOverload<int>::of(&QComboBox::currentIndexChanged), this,
{ [this]
TileSize(TileTemplate()); {
m_settingsChanged = true; TileSize(TileTemplate());
}); m_settingsChanged = true;
});
connect(ui->doubleSpinBoxSheetPaperWidth, QOverload<double>::of(&QDoubleSpinBox::valueChanged), connect(ui->doubleSpinBoxSheetPaperWidth, QOverload<double>::of(&QDoubleSpinBox::valueChanged), this,
this, &PuzzlePreferencesLayoutPage::SheetPaperSizeChanged); &PuzzlePreferencesLayoutPage::SheetPaperSizeChanged);
connect(ui->doubleSpinBoxSheetPaperHeight, QOverload<double>::of(&QDoubleSpinBox::valueChanged), connect(ui->doubleSpinBoxSheetPaperHeight, QOverload<double>::of(&QDoubleSpinBox::valueChanged), this,
this, &PuzzlePreferencesLayoutPage::SheetPaperSizeChanged); &PuzzlePreferencesLayoutPage::SheetPaperSizeChanged);
connect(ui->doubleSpinBoxTilePaperWidth, QOverload<double>::of(&QDoubleSpinBox::valueChanged), connect(ui->doubleSpinBoxTilePaperWidth, QOverload<double>::of(&QDoubleSpinBox::valueChanged), this,
this, &PuzzlePreferencesLayoutPage::TilePaperSizeChanged); &PuzzlePreferencesLayoutPage::TilePaperSizeChanged);
connect(ui->doubleSpinBoxTilePaperHeight, QOverload<double>::of(&QDoubleSpinBox::valueChanged), connect(ui->doubleSpinBoxTilePaperHeight, QOverload<double>::of(&QDoubleSpinBox::valueChanged), this,
this, &PuzzlePreferencesLayoutPage::TilePaperSizeChanged); &PuzzlePreferencesLayoutPage::TilePaperSizeChanged);
connect(ui->doubleSpinBoxSheetPaperWidth, QOverload<double>::of(&QDoubleSpinBox::valueChanged), connect(ui->doubleSpinBoxSheetPaperWidth, QOverload<double>::of(&QDoubleSpinBox::valueChanged), this,
this, &PuzzlePreferencesLayoutPage::FindSheetTemplate); &PuzzlePreferencesLayoutPage::FindSheetTemplate);
connect(ui->doubleSpinBoxSheetPaperHeight, QOverload<double>::of(&QDoubleSpinBox::valueChanged), connect(ui->doubleSpinBoxSheetPaperHeight, QOverload<double>::of(&QDoubleSpinBox::valueChanged), this,
this, &PuzzlePreferencesLayoutPage::FindSheetTemplate); &PuzzlePreferencesLayoutPage::FindSheetTemplate);
connect(ui->doubleSpinBoxTilePaperWidth, QOverload<double>::of(&QDoubleSpinBox::valueChanged), connect(ui->doubleSpinBoxTilePaperWidth, QOverload<double>::of(&QDoubleSpinBox::valueChanged), this,
this, &PuzzlePreferencesLayoutPage::FindTileTemplate); &PuzzlePreferencesLayoutPage::FindTileTemplate);
connect(ui->doubleSpinBoxTilePaperHeight, QOverload<double>::of(&QDoubleSpinBox::valueChanged), connect(ui->doubleSpinBoxTilePaperHeight, QOverload<double>::of(&QDoubleSpinBox::valueChanged), this,
this, &PuzzlePreferencesLayoutPage::FindTileTemplate); &PuzzlePreferencesLayoutPage::FindTileTemplate);
connect(ui->doubleSpinBoxSheetPaperWidth, QOverload<double>::of(&QDoubleSpinBox::valueChanged), connect(ui->doubleSpinBoxSheetPaperWidth, QOverload<double>::of(&QDoubleSpinBox::valueChanged), this,
this, &PuzzlePreferencesLayoutPage::CorrectMaxMargins); &PuzzlePreferencesLayoutPage::CorrectMaxMargins);
connect(ui->doubleSpinBoxSheetPaperHeight, QOverload<double>::of(&QDoubleSpinBox::valueChanged), connect(ui->doubleSpinBoxSheetPaperHeight, QOverload<double>::of(&QDoubleSpinBox::valueChanged), this,
this, &PuzzlePreferencesLayoutPage::CorrectMaxMargins); &PuzzlePreferencesLayoutPage::CorrectMaxMargins);
connect(ui->doubleSpinBoxTilePaperWidth, QOverload<double>::of(&QDoubleSpinBox::valueChanged), connect(ui->doubleSpinBoxTilePaperWidth, QOverload<double>::of(&QDoubleSpinBox::valueChanged), this,
this, &PuzzlePreferencesLayoutPage::CorrectMaxMargins); &PuzzlePreferencesLayoutPage::CorrectMaxMargins);
connect(ui->doubleSpinBoxTilePaperHeight, QOverload<double>::of(&QDoubleSpinBox::valueChanged), connect(ui->doubleSpinBoxTilePaperHeight, QOverload<double>::of(&QDoubleSpinBox::valueChanged), this,
this, &PuzzlePreferencesLayoutPage::CorrectMaxMargins); &PuzzlePreferencesLayoutPage::CorrectMaxMargins);
connect(ui->checkBoxLayoutIgnoreFileds, &QCheckBox::stateChanged, this, connect(ui->checkBoxLayoutIgnoreFileds, &QCheckBox::stateChanged, this,
&PuzzlePreferencesLayoutPage::LayoutSheetIgnoreMargins); &PuzzlePreferencesLayoutPage::LayoutSheetIgnoreMargins);
@ -105,29 +103,31 @@ PuzzlePreferencesLayoutPage::PuzzlePreferencesLayoutPage(QWidget *parent) :
connect(ui->toolButtonTileLandscapeOrientation, &QToolButton::toggled, this, connect(ui->toolButtonTileLandscapeOrientation, &QToolButton::toggled, this,
&PuzzlePreferencesLayoutPage::SwapTileOrientation); &PuzzlePreferencesLayoutPage::SwapTileOrientation);
connect(ui->doubleSpinBoxSheetMarginLeft, QOverload<double>::of(&QDoubleSpinBox::valueChanged), connect(ui->doubleSpinBoxSheetMarginLeft, QOverload<double>::of(&QDoubleSpinBox::valueChanged), this,
this, [this](){m_settingsChanged=true;}); [this]() { m_settingsChanged = true; });
connect(ui->doubleSpinBoxSheetMarginRight, QOverload<double>::of(&QDoubleSpinBox::valueChanged), connect(ui->doubleSpinBoxSheetMarginRight, QOverload<double>::of(&QDoubleSpinBox::valueChanged), this,
this, [this](){m_settingsChanged=true;}); [this]() { m_settingsChanged = true; });
connect(ui->doubleSpinBoxSheetMarginTop, QOverload<double>::of(&QDoubleSpinBox::valueChanged), connect(ui->doubleSpinBoxSheetMarginTop, QOverload<double>::of(&QDoubleSpinBox::valueChanged), this,
this, [this](){m_settingsChanged=true;}); [this]() { m_settingsChanged = true; });
connect(ui->doubleSpinBoxSheetMarginBottom, QOverload<double>::of(&QDoubleSpinBox::valueChanged), connect(ui->doubleSpinBoxSheetMarginBottom, QOverload<double>::of(&QDoubleSpinBox::valueChanged), this,
this, [this](){m_settingsChanged=true;}); [this]() { m_settingsChanged = true; });
connect(ui->checkBoxTileShowTiles, &QCheckBox::stateChanged, this, [this](){m_settingsChanged=true;}); connect(ui->checkBoxTileShowTiles, &QCheckBox::stateChanged, this, [this]() { m_settingsChanged = true; });
connect(ui->checkBoxTileShowWatermark, &QCheckBox::stateChanged, this, [this](){m_settingsChanged=true;}); connect(ui->checkBoxTileShowWatermark, &QCheckBox::stateChanged, this, [this]() { m_settingsChanged = true; });
connect(ui->checkBoxTileShowWatermark, &QCheckBox::stateChanged, this, [this](){m_settingsChanged=true;}); connect(ui->checkBoxTileShowWatermark, &QCheckBox::stateChanged, this, [this]() { m_settingsChanged = true; });
connect(ui->doubleSpinBoxPiecesGap, QOverload<double>::of(&QDoubleSpinBox::valueChanged), connect(ui->doubleSpinBoxPiecesGap, QOverload<double>::of(&QDoubleSpinBox::valueChanged), this,
this, [this](){m_settingsChanged=true;}); [this]() { m_settingsChanged = true; });
ui->doubleSpinBoxPiecesGap->setSuffix(UnitsToStr(m_oldLayoutUnit)); ui->doubleSpinBoxPiecesGap->setSuffix(UnitsToStr(m_oldLayoutUnit));
ui->spinBoxLineWidth->setSuffix(UnitsToStr(Unit::Px)); ui->spinBoxLineWidth->setSuffix(UnitsToStr(Unit::Px));
connect(ui->checkBoxWarningPiecesSuperposition, &QCheckBox::stateChanged, this, [this](){m_settingsChanged=true;}); connect(ui->checkBoxWarningPiecesSuperposition, &QCheckBox::stateChanged, this,
connect(ui->checkBoxStickyEdges, &QCheckBox::stateChanged, this, [this](){m_settingsChanged=true;}); [this]() { m_settingsChanged = true; });
connect(ui->checkBoxWarningPiecesOutOfBound, &QCheckBox::stateChanged, this, [this](){m_settingsChanged=true;}); connect(ui->checkBoxStickyEdges, &QCheckBox::stateChanged, this, [this]() { m_settingsChanged = true; });
connect(ui->checkBoxFollowGrainline, &QCheckBox::stateChanged, this, [this](){m_settingsChanged=true;}); connect(ui->checkBoxWarningPiecesOutOfBound, &QCheckBox::stateChanged, this,
[this]() { m_settingsChanged = true; });
connect(ui->checkBoxFollowGrainline, &QCheckBox::stateChanged, this, [this]() { m_settingsChanged = true; });
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
@ -145,9 +145,9 @@ auto PuzzlePreferencesLayoutPage::Apply() -> QStringList
settings->SetLayoutUnit(LayoutUnit()); settings->SetLayoutUnit(LayoutUnit());
settings->SetLayoutSheetPaperHeight( settings->SetLayoutSheetPaperHeight(
UnitConvertor(ui->doubleSpinBoxSheetPaperHeight->value(), m_oldLayoutUnit, Unit::Px)); UnitConvertor(ui->doubleSpinBoxSheetPaperHeight->value(), m_oldLayoutUnit, Unit::Px));
settings->SetLayoutSheetPaperWidth( settings->SetLayoutSheetPaperWidth(
UnitConvertor(ui->doubleSpinBoxSheetPaperWidth->value(), m_oldLayoutUnit, Unit::Px)); UnitConvertor(ui->doubleSpinBoxSheetPaperWidth->value(), m_oldLayoutUnit, Unit::Px));
settings->SetLayoutSheetIgnoreMargins(ui->checkBoxLayoutIgnoreFileds->isChecked()); settings->SetLayoutSheetIgnoreMargins(ui->checkBoxLayoutIgnoreFileds->isChecked());
settings->SetLayoutSheetMargins(GetSheetMargins()); settings->SetLayoutSheetMargins(GetSheetMargins());
@ -156,9 +156,9 @@ auto PuzzlePreferencesLayoutPage::Apply() -> QStringList
settings->SetLayoutTileShowWatermark(ui->checkBoxTileShowWatermark->isChecked()); settings->SetLayoutTileShowWatermark(ui->checkBoxTileShowWatermark->isChecked());
settings->SetLayoutTilePaperHeight( settings->SetLayoutTilePaperHeight(
UnitConvertor(ui->doubleSpinBoxTilePaperHeight->value(), m_oldLayoutUnit, Unit::Px)); UnitConvertor(ui->doubleSpinBoxTilePaperHeight->value(), m_oldLayoutUnit, Unit::Px));
settings->SetLayoutTilePaperWidth( settings->SetLayoutTilePaperWidth(
UnitConvertor(ui->doubleSpinBoxTilePaperWidth->value(), m_oldLayoutUnit, Unit::Px)); UnitConvertor(ui->doubleSpinBoxTilePaperWidth->value(), m_oldLayoutUnit, Unit::Px));
settings->SetLayoutTileIgnoreMargins(ui->checkBoxTileIgnoreFileds->isChecked()); settings->SetLayoutTileIgnoreMargins(ui->checkBoxTileIgnoreFileds->isChecked());
settings->SetLayoutTileMargins(GetTileMargins()); settings->SetLayoutTileMargins(GetTileMargins());
@ -318,8 +318,8 @@ void PuzzlePreferencesLayoutPage::CorrectMaxMargins()
const qreal sheetHeight = ui->doubleSpinBoxSheetPaperHeight->value(); const qreal sheetHeight = ui->doubleSpinBoxSheetPaperHeight->value();
// 80%/2 of paper size for each field // 80%/2 of paper size for each field
const qreal sheetWidthMargin = (sheetWidth*80.0/100.0)/2.0; const qreal sheetWidthMargin = (sheetWidth * 80.0 / 100.0) / 2.0;
const qreal sheetHeightMargin = (sheetHeight*80.0/100.0)/2.0; const qreal sheetHeightMargin = (sheetHeight * 80.0 / 100.0) / 2.0;
ui->doubleSpinBoxSheetMarginLeft->setMaximum(sheetWidthMargin); ui->doubleSpinBoxSheetMarginLeft->setMaximum(sheetWidthMargin);
ui->doubleSpinBoxSheetMarginRight->setMaximum(sheetWidthMargin); ui->doubleSpinBoxSheetMarginRight->setMaximum(sheetWidthMargin);
@ -330,8 +330,8 @@ void PuzzlePreferencesLayoutPage::CorrectMaxMargins()
const qreal tileHeight = ui->doubleSpinBoxTilePaperHeight->value(); const qreal tileHeight = ui->doubleSpinBoxTilePaperHeight->value();
// 80%/2 of paper size for each field // 80%/2 of paper size for each field
const qreal tileWidthMargin = (tileWidth*80.0/100.0)/2.0; const qreal tileWidthMargin = (tileWidth * 80.0 / 100.0) / 2.0;
const qreal tileHeightMargin = (tileHeight*80.0/100.0)/2.0; const qreal tileHeightMargin = (tileHeight * 80.0 / 100.0) / 2.0;
ui->doubleSpinBoxTileMarginLeft->setMaximum(tileWidthMargin); ui->doubleSpinBoxTileMarginLeft->setMaximum(tileWidthMargin);
ui->doubleSpinBoxTileMarginRight->setMaximum(tileWidthMargin); ui->doubleSpinBoxTileMarginRight->setMaximum(tileWidthMargin);
@ -689,10 +689,10 @@ void PuzzlePreferencesLayoutPage::FindTemplate(QComboBox *box, qreal width, qrea
const Unit paperUnit = LayoutUnit(); const Unit paperUnit = LayoutUnit();
const int max = static_cast<int>(VAbstractLayoutDialog::PaperSizeTemplate::Custom); const int max = static_cast<int>(VAbstractLayoutDialog::PaperSizeTemplate::Custom);
for (int i=0; i < max; ++i) for (int i = 0; i < max; ++i)
{ {
const QSizeF tmplSize = VAbstractLayoutDialog::GetTemplateSize( const QSizeF tmplSize =
static_cast<VAbstractLayoutDialog::PaperSizeTemplate>(i), paperUnit); VAbstractLayoutDialog::GetTemplateSize(static_cast<VAbstractLayoutDialog::PaperSizeTemplate>(i), paperUnit);
if (QSizeF(width, height) == tmplSize || QSizeF(height, width) == tmplSize) if (QSizeF(width, height) == tmplSize || QSizeF(height, width) == tmplSize)
{ {
box->blockSignals(true); box->blockSignals(true);

View File

@ -30,10 +30,6 @@
#include <QWidget> #include <QWidget>
#if QT_VERSION < QT_VERSION_CHECK(5, 13, 0)
#include "../vmisc/defglobal.h"
#endif
namespace Ui namespace Ui
{ {
class PuzzlePreferencesPathPage; class PuzzlePreferencesPathPage;

View File

@ -30,10 +30,6 @@
#include <QDialog> #include <QDialog>
#if QT_VERSION < QT_VERSION_CHECK(5, 13, 0)
#include "../vmisc/defglobal.h"
#endif
namespace Ui namespace Ui
{ {
class DialogPuzzlePreferences; class DialogPuzzlePreferences;

View File

@ -30,9 +30,6 @@
#include "../vlayout/vlayoutexporter.h" #include "../vlayout/vlayoutexporter.h"
#include "../vpapplication.h" #include "../vpapplication.h"
#include "ui_dialogsavemanuallayout.h" #include "ui_dialogsavemanuallayout.h"
#if QT_VERSION < QT_VERSION_CHECK(5, 7, 0)
#include "../vmisc/backport/qoverload.h"
#endif // QT_VERSION < QT_VERSION_CHECK(5, 7, 0)
#include <QMessageBox> #include <QMessageBox>
#include <QShowEvent> #include <QShowEvent>

View File

@ -31,10 +31,6 @@
#include <QDialog> #include <QDialog>
#if QT_VERSION < QT_VERSION_CHECK(5, 13, 0)
#include "../vmisc/defglobal.h"
#endif
namespace Ui namespace Ui
{ {
class VPDialogAbout; class VPDialogAbout;

View File

@ -37,10 +37,6 @@
#include "../vlayout/vlayoutpiece.h" #include "../vlayout/vlayoutpiece.h"
#include "vpiecegrainline.h" #include "vpiecegrainline.h"
#if QT_VERSION < QT_VERSION_CHECK(5, 13, 0)
#include "../vmisc/defglobal.h"
#endif // QT_VERSION < QT_VERSION_CHECK(5, 13, 0)
class VPLayout; class VPLayout;
class VPSheet; class VPSheet;

View File

@ -39,10 +39,6 @@
#include "../vmisc/def.h" #include "../vmisc/def.h"
#if QT_VERSION < QT_VERSION_CHECK(5, 13, 0)
#include "../vmisc/defglobal.h"
#endif // QT_VERSION < QT_VERSION_CHECK(5, 13, 0)
class VPLayout; class VPLayout;
class VPPiece; class VPPiece;
class VMainGraphicsScene; class VMainGraphicsScene;

View File

@ -32,12 +32,8 @@
#include "vpapplication.h" #include "vpapplication.h"
#if defined(APPIMAGE) && defined(Q_OS_LINUX) #if defined(APPIMAGE) && defined(Q_OS_LINUX)
#if QT_VERSION < QT_VERSION_CHECK(5, 12, 0)
#include "../vmisc/backport/qscopeguard.h"
#else
#include <QScopeGuard>
#endif
#include "../vmisc/appimage.h" #include "../vmisc/appimage.h"
#include <QScopeGuard>
#endif // defined(APPIMAGE) && defined(Q_OS_LINUX) #endif // defined(APPIMAGE) && defined(Q_OS_LINUX)
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) #if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
@ -121,11 +117,9 @@ auto main(int argc, char *argv[]) -> int
VPApplication app(argc, argv); VPApplication app(argc, argv);
app.InitOptions(); app.InitOptions();
QT_REQUIRE_VERSION(argc, argv, "5.6.0") // clazy:exclude=qstring-arg,qstring-allocations NOLINT QT_REQUIRE_VERSION(argc, argv, "5.15.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")); VPApplication::setDesktopFileName(QStringLiteral("ua.com.smart-pattern.puzzle.desktop"));
#endif
QTimer::singleShot(0, &app, &VPApplication::ProcessCMD); QTimer::singleShot(0, &app, &VPApplication::ProcessCMD);

View File

@ -135,7 +135,7 @@ inline auto LineFont(const TextLine &tl, const VSvgFont &base) -> VSvgFont
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
inline auto LineAlign(const TextLine &tl, const QString &text, const QFontMetrics &fm, qreal width) -> qreal inline auto LineAlign(const TextLine &tl, const QString &text, const QFontMetrics &fm, qreal width) -> qreal
{ {
const int lineWidth = TextWidth(fm, text); const int lineWidth = fm.horizontalAdvance(text);
qreal dX = 0; qreal dX = 0;
if (tl.m_eAlign == 0 || (tl.m_eAlign & Qt::AlignLeft) > 0) if (tl.m_eAlign == 0 || (tl.m_eAlign & Qt::AlignLeft) > 0)
@ -553,7 +553,7 @@ void VPGraphicsPiece::InitPieceLabelOutlineFont(const QVector<QPointF> &labelSha
for (auto c : qAsConst(tl.m_qsText)) for (auto c : qAsConst(tl.m_qsText))
{ {
path.addPath(corrector.DrawChar(w, static_cast<qreal>(fm.ascent()), c)); path.addPath(corrector.DrawChar(w, static_cast<qreal>(fm.ascent()), c));
w += TextWidth(fm, c); w += fm.horizontalAdvance(c);
} }
} }
else else

View File

@ -35,10 +35,6 @@
#include "../layout/layoutdef.h" #include "../layout/layoutdef.h"
#include "scenedef.h" #include "scenedef.h"
#if QT_VERSION < QT_VERSION_CHECK(5, 13, 0)
#include "../vmisc/defglobal.h"
#endif // QT_VERSION < QT_VERSION_CHECK(5, 13, 0)
class VTextManager; class VTextManager;
class VGraphicsFillItem; class VGraphicsFillItem;

View File

@ -34,10 +34,6 @@
#include "../layout/layoutdef.h" #include "../layout/layoutdef.h"
#include "scenedef.h" #include "scenedef.h"
#if QT_VERSION < QT_VERSION_CHECK(5, 13, 0)
#include "../vmisc/defglobal.h"
#endif // QT_VERSION < QT_VERSION_CHECK(5, 13, 0)
class VPLayout; class VPLayout;
class VPGraphicsPiece; class VPGraphicsPiece;
class QGraphicsView; class QGraphicsView;

View File

@ -34,9 +34,6 @@
#include <QPainter> #include <QPainter>
#include "../layout/layoutdef.h" #include "../layout/layoutdef.h"
#if QT_VERSION < QT_VERSION_CHECK(5, 13, 0)
#include "../vmisc/defglobal.h"
#endif
class VPLayout; class VPLayout;

View File

@ -35,10 +35,6 @@
#include "../layout/layoutdef.h" #include "../layout/layoutdef.h"
#if QT_VERSION < QT_VERSION_CHECK(5, 13, 0)
#include "../vmisc/defglobal.h"
#endif // QT_VERSION < QT_VERSION_CHECK(5, 13, 0)
class VPTileFactory; class VPTileFactory;
class VPLayout; class VPLayout;
struct VWatermarkData; struct VWatermarkData;
@ -47,7 +43,7 @@ class VPGraphicsTileGrid : public QGraphicsItem
{ {
public: public:
explicit VPGraphicsTileGrid(const VPLayoutPtr &layout, const QUuid &sheetUuid, QGraphicsItem *parent = nullptr); explicit VPGraphicsTileGrid(const VPLayoutPtr &layout, const QUuid &sheetUuid, QGraphicsItem *parent = nullptr);
~VPGraphicsTileGrid() override =default; ~VPGraphicsTileGrid() override = default;
auto boundingRect() const -> QRectF override; auto boundingRect() const -> QRectF override;
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) override; void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) override;

View File

@ -28,17 +28,13 @@
#ifndef VPUNDOCOMMAND_H #ifndef VPUNDOCOMMAND_H
#define VPUNDOCOMMAND_H #define VPUNDOCOMMAND_H
#include <QLoggingCategory>
#include <QObject> #include <QObject>
#include <QUndoCommand> #include <QUndoCommand>
#include <QLoggingCategory>
#if QT_VERSION < QT_VERSION_CHECK(5, 13, 0)
#include "../vmisc/defglobal.h"
#endif // QT_VERSION < QT_VERSION_CHECK(5, 13, 0)
namespace ML namespace ML
{ {
enum class UndoCommand: qint8 enum class UndoCommand : qint8
{ {
MovePiece = 0, MovePiece = 0,
MovePieces = 1, MovePieces = 1,
@ -51,17 +47,18 @@ enum class UndoCommand: qint8
ZValueMovePiece = 8, ZValueMovePiece = 8,
ZValueMovePieces = 9, ZValueMovePieces = 9,
}; };
} // namespace ML } // namespace ML
Q_DECLARE_LOGGING_CATEGORY(vpUndo) // NOLINT Q_DECLARE_LOGGING_CATEGORY(vpUndo) // NOLINT
class VPUndoCommand : public QObject, public QUndoCommand class VPUndoCommand : public QObject, public QUndoCommand
{ {
Q_OBJECT // NOLINT Q_OBJECT // NOLINT
public: public:
explicit VPUndoCommand(QUndoCommand *parent = nullptr); explicit VPUndoCommand(QUndoCommand *parent = nullptr);
explicit VPUndoCommand(bool allowMerge = false, QUndoCommand *parent = nullptr); explicit VPUndoCommand(bool allowMerge = false, QUndoCommand *parent = nullptr);
~VPUndoCommand() override =default; ~VPUndoCommand() override = default;
auto AllowMerge() const -> bool; auto AllowMerge() const -> bool;
@ -72,7 +69,6 @@ private:
bool m_allowMerge{false}; bool m_allowMerge{false};
}; };
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
inline auto VPUndoCommand::AllowMerge() const -> bool inline auto VPUndoCommand::AllowMerge() const -> bool
{ {

View File

@ -28,12 +28,8 @@
#ifndef VPUNDOPIECEZVALUEMOVE_H #ifndef VPUNDOPIECEZVALUEMOVE_H
#define VPUNDOPIECEZVALUEMOVE_H #define VPUNDOPIECEZVALUEMOVE_H
#include "vpundocommand.h"
#include "../layout/layoutdef.h" #include "../layout/layoutdef.h"
#include "vpundocommand.h"
#if QT_VERSION < QT_VERSION_CHECK(5, 13, 0)
#include "../vmisc/defglobal.h"
#endif // QT_VERSION < QT_VERSION_CHECK(5, 13, 0)
namespace ML namespace ML
{ {
@ -49,9 +45,10 @@ enum class ZValueMove
class VPUndoPieceZValueMove : public VPUndoCommand class VPUndoPieceZValueMove : public VPUndoCommand
{ {
Q_OBJECT // NOLINT Q_OBJECT // NOLINT
public: public:
VPUndoPieceZValueMove(const VPPiecePtr &piece, ML::ZValueMove move, QUndoCommand *parent = nullptr); VPUndoPieceZValueMove(const VPPiecePtr &piece, ML::ZValueMove move, QUndoCommand *parent = nullptr);
~VPUndoPieceZValueMove() override =default; ~VPUndoPieceZValueMove() override = default;
void undo() override; void undo() override;
void redo() override; void redo() override;
@ -74,9 +71,10 @@ private:
class VPUndoPiecesZValueMove : public VPUndoCommand class VPUndoPiecesZValueMove : public VPUndoCommand
{ {
Q_OBJECT // NOLINT Q_OBJECT // NOLINT
public: public:
VPUndoPiecesZValueMove(const QList<VPPiecePtr> &pieces, ML::ZValueMove move, QUndoCommand *parent = nullptr); VPUndoPiecesZValueMove(const QList<VPPiecePtr> &pieces, ML::ZValueMove move, QUndoCommand *parent = nullptr);
~VPUndoPiecesZValueMove() override =default; ~VPUndoPiecesZValueMove() override = default;
void undo() override; void undo() override;
void redo() override; void redo() override;
@ -86,15 +84,15 @@ private:
Q_DISABLE_COPY_MOVE(VPUndoPiecesZValueMove) // NOLINT Q_DISABLE_COPY_MOVE(VPUndoPiecesZValueMove) // NOLINT
QList<VPPieceWeakPtr> m_pieces{}; QList<VPPieceWeakPtr> m_pieces{};
ML::ZValueMove m_move; ML::ZValueMove m_move;
QHash<QString, qreal> m_oldValues{}; QHash<QString, qreal> m_oldValues{};
auto Layout() const -> VPLayoutPtr; auto Layout() const -> VPLayoutPtr;
auto Sheet() const -> VPSheetPtr; auto Sheet() const -> VPSheetPtr;
auto PieceIds() const -> QVector<QString>; auto PieceIds() const -> QVector<QString>;
static auto Levels(const QList<VPPiecePtr> &allPieces, const QVector<QString> &skipPieces, static auto Levels(const QList<VPPiecePtr> &allPieces, const QVector<QString> &skipPieces, bool skip)
bool skip) -> QList<QVector<QString>>; -> QList<QVector<QString>>;
static auto LevelStep(const QList<VPPiecePtr> &pieces) -> qreal; static auto LevelStep(const QList<VPPiecePtr> &pieces) -> qreal;
}; };

View File

@ -115,26 +115,6 @@ inline void noisyFailureMsgHandler(QtMsgType type, const QMessageLogContext &con
#endif // defined(V_NO_ASSERT) #endif // defined(V_NO_ASSERT)
#if defined(Q_OS_MAC) #if defined(Q_OS_MAC)
#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
if ((type == QtWarningMsg) && msg.contains(QStringLiteral("QNSView")))
{
type = QtDebugMsg;
}
#endif
#if QT_VERSION < QT_VERSION_CHECK(5, 9, 0)
// Hide Qt bug 'Assertion when reading an icns file'
// https://bugreports.qt.io/browse/QTBUG-45537
// Remove after Qt fix will be released
if ((type == QtWarningMsg) && msg.contains(QStringLiteral("QICNSHandler::read()")))
{
type = QtDebugMsg;
}
#endif
// Hide anything that starts with QMacCGContext // Hide anything that starts with QMacCGContext
if ((type == QtWarningMsg) && msg.contains(QStringLiteral("QMacCGContext::"))) if ((type == QtWarningMsg) && msg.contains(QStringLiteral("QMacCGContext::")))
{ {

View File

@ -37,10 +37,6 @@
#include <ciso646> // and, not, or #include <ciso646> // and, not, or
#endif #endif
#if QT_VERSION < QT_VERSION_CHECK(5, 13, 0)
#include "../vmisc/defglobal.h"
#endif
class VPCommandLine; class VPCommandLine;
using VPCommandLinePtr = std::shared_ptr<VPCommandLine>; using VPCommandLinePtr = std::shared_ptr<VPCommandLine>;

View File

@ -36,6 +36,7 @@
#include <QPrintPreviewDialog> #include <QPrintPreviewDialog>
#include <QPrinterInfo> #include <QPrinterInfo>
#include <QSaveFile> #include <QSaveFile>
#include <QScopeGuard>
#include <QSvgGenerator> #include <QSvgGenerator>
#include <QTimer> #include <QTimer>
#include <QUndoStack> #include <QUndoStack>
@ -75,16 +76,6 @@
#include "xml/vplayoutfilereader.h" #include "xml/vplayoutfilereader.h"
#include "xml/vplayoutfilewriter.h" #include "xml/vplayoutfilewriter.h"
#if QT_VERSION < QT_VERSION_CHECK(5, 7, 0)
#include "../vmisc/backport/qoverload.h"
#endif // QT_VERSION < QT_VERSION_CHECK(5, 7, 0)
#if QT_VERSION < QT_VERSION_CHECK(5, 12, 0)
#include "../vmisc/backport/qscopeguard.h"
#else
#include <QScopeGuard>
#endif
QT_WARNING_PUSH QT_WARNING_PUSH
QT_WARNING_DISABLE_CLANG("-Wmissing-prototypes") QT_WARNING_DISABLE_CLANG("-Wmissing-prototypes")
QT_WARNING_DISABLE_INTEL(1418) QT_WARNING_DISABLE_INTEL(1418)
@ -93,16 +84,7 @@ Q_LOGGING_CATEGORY(pWindow, "p.window") // NOLINT
QT_WARNING_POP QT_WARNING_POP
#if (defined(Q_CC_GNU) && Q_CC_GNU < 409) && !defined(Q_CC_CLANG)
// DO NOT WORK WITH GCC 4.8
#else
#if __cplusplus >= 201402L
using namespace std::chrono_literals; using namespace std::chrono_literals;
#else
#include "../vmisc/bpstd/chrono.hpp"
using namespace bpstd::literals::chrono_literals;
#endif // __cplusplus >= 201402L
#endif //(defined(Q_CC_GNU) && Q_CC_GNU < 409) && !defined(Q_CC_CLANG)
#if QT_VERSION < QT_VERSION_CHECK(6, 4, 0) #if QT_VERSION < QT_VERSION_CHECK(6, 4, 0)
#include "../vmisc/compatibility.h" #include "../vmisc/compatibility.h"
@ -432,7 +414,7 @@ VPMainWindow::VPMainWindow(const VPCommandLinePtr &cmd, QWidget *parent)
if (m_cmd->IsGuiEnabled()) if (m_cmd->IsGuiEnabled())
{ {
QTimer::singleShot(V_SECONDS(1), this, &VPMainWindow::AskDefaultSettings); QTimer::singleShot(1s, this, &VPMainWindow::AskDefaultSettings);
} }
if (VAbstractShortcutManager *manager = VAbstractApplication::VApp()->GetShortcutManager()) if (VAbstractShortcutManager *manager = VAbstractApplication::VApp()->GetShortcutManager())
@ -3483,15 +3465,6 @@ void VPMainWindow::ShowToolTip(const QString &toolTip)
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
void VPMainWindow::closeEvent(QCloseEvent *event) void VPMainWindow::closeEvent(QCloseEvent *event)
{ {
#if defined(Q_OS_MAC) && QT_VERSION < QT_VERSION_CHECK(5, 11, 1)
// Workaround for Qt bug https://bugreports.qt.io/browse/QTBUG-43344
static int numCalled = 0;
if (numCalled++ >= 1)
{
return;
}
#endif
if (MaybeSave()) if (MaybeSave())
{ {
WriteSettings(); WriteSettings();

View File

@ -102,11 +102,6 @@ auto TriangleBasic() -> QPainterPath
} }
} // namespace } // namespace
// See https://stackoverflow.com/a/46719572/3045403
#if __cplusplus < 201703L // C++17
constexpr qreal VPTileFactory::tileStripeWidth; // NOLINT(readability-redundant-declaration)
#endif
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
VPTileFactory::VPTileFactory(const VPLayoutPtr &layout, VCommonSettings *commonSettings, QObject *parent) VPTileFactory::VPTileFactory(const VPLayoutPtr &layout, VCommonSettings *commonSettings, QObject *parent)
: QObject(parent), : QObject(parent),
@ -359,7 +354,7 @@ void VPTileFactory::DrawRuler(QPainter *painter, qreal scale) const
qreal unitsWidth = 0; qreal unitsWidth = 0;
QFontMetrics fm(fnt); QFontMetrics fm(fnt);
QString units = rulerUnits != Unit::Inch ? tr("cm", "unit") : tr("in", "unit"); QString units = rulerUnits != Unit::Inch ? tr("cm", "unit") : tr("in", "unit");
unitsWidth = TextWidth(fm, units); unitsWidth = fm.horizontalAdvance(units);
painter->drawText(QPointF(step * 0.5 - unitsWidth * 0.6, painter->drawText(QPointF(step * 0.5 - unitsWidth * 0.6,
m_drawingAreaHeight - tileStripeWidth + notchHeight + shortNotchHeight), m_drawingAreaHeight - tileStripeWidth + notchHeight + shortNotchHeight),
units); units);
@ -629,7 +624,7 @@ void VPTileFactory::DrawTextInformation(QPainter *painter, int row, int col, int
td.setPageSize(QSizeF(m_drawingAreaHeight - UnitConvertor(2, Unit::Cm, Unit::Px), m_drawingAreaWidth)); td.setPageSize(QSizeF(m_drawingAreaHeight - UnitConvertor(2, Unit::Cm, Unit::Px), m_drawingAreaWidth));
QFontMetrics metrix = QFontMetrics(td.defaultFont()); QFontMetrics metrix = QFontMetrics(td.defaultFont());
int maxWidth = TextWidth(metrix, QString().fill('z', 50)); int maxWidth = metrix.horizontalAdvance(QString().fill('z', 50));
QString clippedSheetName = metrix.elidedText(sheetName, Qt::ElideMiddle, maxWidth); QString clippedSheetName = metrix.elidedText(sheetName, Qt::ElideMiddle, maxWidth);
td.setHtml(QStringLiteral("<table width='100%' style='color:rgb(%1);'>" td.setHtml(QStringLiteral("<table width='100%' style='color:rgb(%1);'>"
@ -754,11 +749,7 @@ void VPTileFactory::PaintWatermarkImage(QPainter *painter, const QRectF &img, co
return; return;
} }
#if QT_VERSION < QT_VERSION_CHECK(5, 10, 0)
qint64 fileSize = watermarkImage.byteCount();
#else
qint64 fileSize = watermarkImage.sizeInBytes(); qint64 fileSize = watermarkImage.sizeInBytes();
#endif
qint64 pixelSize = fileSize / watermarkImage.height() / watermarkImage.width(); qint64 pixelSize = fileSize / watermarkImage.height() / watermarkImage.width();
QSize scaledSize(qRound(watermarkImage.width() / xScale), qRound(watermarkImage.height() / yScale)); QSize scaledSize(qRound(watermarkImage.width() / xScale), qRound(watermarkImage.height() / yScale));
qint64 scaledImageSize = pixelSize * scaledSize.width() * scaledSize.height() / 1024; qint64 scaledImageSize = pixelSize * scaledSize.width() * scaledSize.height() / 1024;

View File

@ -35,10 +35,6 @@
#include "../ifc/ifcdef.h" #include "../ifc/ifcdef.h"
#include "layout/layoutdef.h" #include "layout/layoutdef.h"
#if QT_VERSION < QT_VERSION_CHECK(5, 13, 0)
#include "../vmisc/defglobal.h"
#endif // QT_VERSION < QT_VERSION_CHECK(5, 13, 0)
class QGraphicsScene; class QGraphicsScene;
class VCommonSettings; class VCommonSettings;
class QPainter; class QPainter;

View File

@ -30,10 +30,6 @@
#include "../vmisc/vabstractshortcutmanager.h" #include "../vmisc/vabstractshortcutmanager.h"
#if QT_VERSION < QT_VERSION_CHECK(5, 13, 0)
#include "../vmisc/defglobal.h"
#endif
class VPuzzleShortcutManager : public VAbstractShortcutManager class VPuzzleShortcutManager : public VAbstractShortcutManager
{ {
Q_OBJECT // NOLINT Q_OBJECT // NOLINT

View File

@ -37,10 +37,6 @@
#include "../vmisc/vabstractshortcutmanager.h" #include "../vmisc/vabstractshortcutmanager.h"
#include "ui_tapepreferencesconfigurationpage.h" #include "ui_tapepreferencesconfigurationpage.h"
#if QT_VERSION < QT_VERSION_CHECK(5, 7, 0)
#include "../vmisc/backport/qoverload.h"
#endif // QT_VERSION < QT_VERSION_CHECK(5, 7, 0)
#include <QStyleHints> #include <QStyleHints>
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------

View File

@ -31,10 +31,6 @@
#include <QWidget> #include <QWidget>
#if QT_VERSION < QT_VERSION_CHECK(5, 13, 0)
#include "../vmisc/defglobal.h"
#endif
class QComboBox; class QComboBox;
namespace Ui namespace Ui

View File

@ -30,10 +30,6 @@
#include <QWidget> #include <QWidget>
#if QT_VERSION < QT_VERSION_CHECK(5, 13, 0)
#include "../vmisc/defglobal.h"
#endif
namespace Ui namespace Ui
{ {
class TapePreferencesPathPage; class TapePreferencesPathPage;

View File

@ -31,10 +31,6 @@
#include <QDialog> #include <QDialog>
#if QT_VERSION < QT_VERSION_CHECK(5, 13, 0)
#include "../vmisc/defglobal.h"
#endif
namespace Ui namespace Ui
{ {
class DialogAboutTape; class DialogAboutTape;

View File

@ -32,10 +32,6 @@
#include "../vformat/vdimensions.h" #include "../vformat/vdimensions.h"
#if QT_VERSION < QT_VERSION_CHECK(5, 13, 0)
#include "../vmisc/defglobal.h"
#endif // QT_VERSION < QT_VERSION_CHECK(5, 13, 0)
namespace Ui namespace Ui
{ {
class DialogDimensionCustomNames; class DialogDimensionCustomNames;
@ -46,7 +42,7 @@ class DialogDimensionCustomNames : public QDialog
Q_OBJECT // NOLINT Q_OBJECT // NOLINT
public: public:
explicit DialogDimensionCustomNames(const QMap<MeasurementDimension, MeasurementDimension_p > &dimensions, explicit DialogDimensionCustomNames(const QMap<MeasurementDimension, MeasurementDimension_p> &dimensions,
QWidget *parent = nullptr); QWidget *parent = nullptr);
~DialogDimensionCustomNames() override; ~DialogDimensionCustomNames() override;

View File

@ -27,17 +27,14 @@
*************************************************************************/ *************************************************************************/
#include "dialogdimensionlabels.h" #include "dialogdimensionlabels.h"
#include "ui_dialogdimensionlabels.h" #include "ui_dialogdimensionlabels.h"
#if QT_VERSION < QT_VERSION_CHECK(5, 7, 0)
#include "../vmisc/backport/qoverload.h"
#endif // QT_VERSION < QT_VERSION_CHECK(5, 7, 0)
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
DialogDimensionLabels::DialogDimensionLabels(const QMap<MeasurementDimension, MeasurementDimension_p> &dimensions, DialogDimensionLabels::DialogDimensionLabels(const QMap<MeasurementDimension, MeasurementDimension_p> &dimensions,
bool fullCircumference, QWidget *parent) bool fullCircumference, QWidget *parent)
: QDialog(parent), : QDialog(parent),
ui(new Ui::DialogDimensionLabels), ui(new Ui::DialogDimensionLabels),
m_dimensions(dimensions), m_dimensions(dimensions),
m_fullCircumference(fullCircumference) m_fullCircumference(fullCircumference)
{ {
ui->setupUi(this); ui->setupUi(this);
@ -119,7 +116,7 @@ void DialogDimensionLabels::InitLabels()
const QList<MeasurementDimension_p> dimensions = m_dimensions.values(); const QList<MeasurementDimension_p> dimensions = m_dimensions.values();
for(const auto &dimension : dimensions) for (const auto &dimension : dimensions)
{ {
m_labels.insert(dimension->Type(), dimension->Labels()); m_labels.insert(dimension->Type(), dimension->Labels());
} }
@ -131,7 +128,7 @@ void DialogDimensionLabels::InitDimensions()
ui->comboBoxDimensionLabels->blockSignals(true); ui->comboBoxDimensionLabels->blockSignals(true);
ui->comboBoxDimensionLabels->clear(); ui->comboBoxDimensionLabels->clear();
for(auto &dimension : m_dimensions) for (auto &dimension : m_dimensions)
{ {
ui->comboBoxDimensionLabels->addItem(dimension->Name(), static_cast<int>(dimension->Type())); ui->comboBoxDimensionLabels->addItem(dimension->Name(), static_cast<int>(dimension->Type()));
} }
@ -166,7 +163,7 @@ void DialogDimensionLabels::InitTable()
const DimesionLabels labels = m_labels.value(type); const DimesionLabels labels = m_labels.value(type);
for(int row = 0; row < bases.size(); ++row) for (int row = 0; row < bases.size(); ++row)
{ {
const qreal base = bases.at(row); const qreal base = bases.at(row);
@ -208,16 +205,15 @@ auto DialogDimensionLabels::DimensionValue(const MeasurementDimension_p &dimensi
{ {
if (dimension->IsBodyMeasurement()) if (dimension->IsBodyMeasurement())
{ {
return QString::number(m_fullCircumference ? value*2 : value); return QString::number(m_fullCircumference ? value * 2 : value);
} }
return QString::number(value); return QString::number(value);
} }
if (dimension->Type() == MeasurementDimension::W || dimension->Type() == MeasurementDimension::Z) if (dimension->Type() == MeasurementDimension::W || dimension->Type() == MeasurementDimension::Z)
{ {
return QString::number(m_fullCircumference ? value*2 : value); return QString::number(m_fullCircumference ? value * 2 : value);
} }
return QString::number(value); return QString::number(value);

View File

@ -29,9 +29,6 @@
#include "ui_dialogknownmeasurementscsvcolumns.h" #include "ui_dialogknownmeasurementscsvcolumns.h"
#include "../vmisc/qxtcsvmodel.h" #include "../vmisc/qxtcsvmodel.h"
#if QT_VERSION < QT_VERSION_CHECK(5, 7, 0)
#include "../vmisc/backport/qoverload.h"
#endif // QT_VERSION < QT_VERSION_CHECK(5, 7, 0)
#include "../vtools/dialogs/dialogtoolbox.h" #include "../vtools/dialogs/dialogtoolbox.h"
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) #if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)

View File

@ -30,10 +30,6 @@
#include <QDialog> #include <QDialog>
#if QT_VERSION < QT_VERSION_CHECK(5, 13, 0)
#include "../vmisc/defglobal.h"
#endif
class QxtCsvModel; class QxtCsvModel;
class QComboBox; class QComboBox;

View File

@ -32,10 +32,6 @@
#include <QDialog> #include <QDialog>
#include <QUuid> #include <QUuid>
#if QT_VERSION < QT_VERSION_CHECK(5, 13, 0)
#include "../vmisc/defglobal.h"
#endif
namespace Ui namespace Ui
{ {
class DialogMDataBase; class DialogMDataBase;

View File

@ -27,12 +27,8 @@
*************************************************************************/ *************************************************************************/
#include "dialogmeasurementscsvcolumns.h" #include "dialogmeasurementscsvcolumns.h"
#include "../vmisc/qxtcsvmodel.h" #include "../vmisc/qxtcsvmodel.h"
#include "ui_dialogmeasurementscsvcolumns.h"
#if QT_VERSION < QT_VERSION_CHECK(5, 7, 0)
#include "../vmisc/backport/qoverload.h"
#endif // QT_VERSION < QT_VERSION_CHECK(5, 7, 0)
#include "../vtools/dialogs/dialogtoolbox.h" #include "../vtools/dialogs/dialogtoolbox.h"
#include "ui_dialogmeasurementscsvcolumns.h"
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) #if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
#include "../vmisc/vtextcodec.h" #include "../vmisc/vtextcodec.h"

View File

@ -33,9 +33,6 @@
#include "../vpatterndb/variables/vmeasurement.h" #include "../vpatterndb/variables/vmeasurement.h"
#include "../vwidgets/vdecorationaligningdelegate.h" #include "../vwidgets/vdecorationaligningdelegate.h"
#if QT_VERSION < QT_VERSION_CHECK(5, 7, 0)
#include "../vmisc/backport/qoverload.h"
#endif // QT_VERSION < QT_VERSION_CHECK(5, 7, 0)
#if QT_VERSION < QT_VERSION_CHECK(6, 4, 0) #if QT_VERSION < QT_VERSION_CHECK(6, 4, 0)
#include "../vmisc/compatibility.h" #include "../vmisc/compatibility.h"

View File

@ -31,11 +31,6 @@
#include <QPushButton> #include <QPushButton>
#include <QShowEvent> #include <QShowEvent>
#include "../mapplication.h"
#if QT_VERSION < QT_VERSION_CHECK(5, 7, 0)
#include "../vmisc/backport/qoverload.h"
#endif // QT_VERSION < QT_VERSION_CHECK(5, 7, 0)
namespace namespace
{ {
void InitDimensionTitle(QGroupBox *group, const MeasurementDimension_p &dimension) void InitDimensionTitle(QGroupBox *group, const MeasurementDimension_p &dimension)
@ -43,11 +38,11 @@ void InitDimensionTitle(QGroupBox *group, const MeasurementDimension_p &dimensio
SCASSERT(group != nullptr) SCASSERT(group != nullptr)
group->setTitle(QStringLiteral("%1 (%2)").arg(dimension->Name(), dimension->Axis())); group->setTitle(QStringLiteral("%1 (%2)").arg(dimension->Name(), dimension->Axis()));
} }
} } // namespace
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
DialogSetupMultisize::DialogSetupMultisize(Unit unit, QWidget *parent) : DialogSetupMultisize::DialogSetupMultisize(Unit unit, QWidget *parent)
QDialog(parent), : QDialog(parent),
ui(new Ui::DialogSetupMultisize), ui(new Ui::DialogSetupMultisize),
m_xDimension(QSharedPointer<VXMeasurementDimension>::create(unit)), m_xDimension(QSharedPointer<VXMeasurementDimension>::create(unit)),
m_yDimension(QSharedPointer<VYMeasurementDimension>::create(unit)), m_yDimension(QSharedPointer<VYMeasurementDimension>::create(unit)),
@ -64,150 +59,133 @@ DialogSetupMultisize::DialogSetupMultisize(Unit unit, QWidget *parent) :
InitZDimension(); InitZDimension();
// height // height
connect(ui->doubleSpinBoxXDimensionMinValue, QOverload<qreal>::of(&QDoubleSpinBox::valueChanged), connect(ui->doubleSpinBoxXDimensionMinValue, QOverload<qreal>::of(&QDoubleSpinBox::valueChanged), this,
this, [this](qreal value) [this](qreal value)
{ {
DimensionMinValueChanged(value, ui->doubleSpinBoxXDimensionMaxValue, ui->comboBoxXDimensionStep, DimensionMinValueChanged(value, ui->doubleSpinBoxXDimensionMaxValue, ui->comboBoxXDimensionStep,
ui->comboBoxXDimensionBase, m_xDimension); ui->comboBoxXDimensionBase, m_xDimension);
}); });
connect(ui->doubleSpinBoxXDimensionMaxValue, QOverload<qreal>::of(&QDoubleSpinBox::valueChanged), connect(ui->doubleSpinBoxXDimensionMaxValue, QOverload<qreal>::of(&QDoubleSpinBox::valueChanged), this,
this, [this](qreal value) [this](qreal value)
{ {
DimensionMaxValueChanged(value, ui->doubleSpinBoxXDimensionMinValue, ui->comboBoxXDimensionStep, DimensionMaxValueChanged(value, ui->doubleSpinBoxXDimensionMinValue, ui->comboBoxXDimensionStep,
ui->comboBoxXDimensionBase, m_xDimension); ui->comboBoxXDimensionBase, m_xDimension);
}); });
connect(ui->comboBoxXDimensionStep, QOverload<int>::of(&QComboBox::currentIndexChanged), connect(ui->comboBoxXDimensionStep, QOverload<int>::of(&QComboBox::currentIndexChanged), this,
this, [this](int index) [this](int index)
{ { DimensionStepChanged(index, ui->comboBoxXDimensionStep, ui->comboBoxXDimensionBase, m_xDimension); });
DimensionStepChanged(index, ui->comboBoxXDimensionStep, ui->comboBoxXDimensionBase, m_xDimension); connect(ui->comboBoxXDimensionBase, QOverload<int>::of(&QComboBox::currentIndexChanged), this,
}); [this](int index) { DimensionBaseChanged(index, ui->comboBoxXDimensionBase, m_xDimension); });
connect(ui->comboBoxXDimensionBase, QOverload<int>::of(&QComboBox::currentIndexChanged),
this, [this](int index)
{
DimensionBaseChanged(index, ui->comboBoxXDimensionBase, m_xDimension);
});
// size // size
connect(ui->doubleSpinBoxYDimensionMinValue, QOverload<qreal>::of(&QDoubleSpinBox::valueChanged), connect(ui->doubleSpinBoxYDimensionMinValue, QOverload<qreal>::of(&QDoubleSpinBox::valueChanged), this,
this, [this](qreal value) [this](qreal value)
{ {
DimensionMinValueChanged(value, ui->doubleSpinBoxYDimensionMaxValue, ui->comboBoxYDimensionStep, DimensionMinValueChanged(value, ui->doubleSpinBoxYDimensionMaxValue, ui->comboBoxYDimensionStep,
ui->comboBoxYDimensionBase, m_yDimension); ui->comboBoxYDimensionBase, m_yDimension);
}); });
connect(ui->doubleSpinBoxYDimensionMaxValue, QOverload<qreal>::of(&QDoubleSpinBox::valueChanged), connect(ui->doubleSpinBoxYDimensionMaxValue, QOverload<qreal>::of(&QDoubleSpinBox::valueChanged), this,
this, [this](qreal value) [this](qreal value)
{ {
DimensionMaxValueChanged(value, ui->doubleSpinBoxYDimensionMinValue, ui->comboBoxYDimensionStep, DimensionMaxValueChanged(value, ui->doubleSpinBoxYDimensionMinValue, ui->comboBoxYDimensionStep,
ui->comboBoxYDimensionBase, m_yDimension); ui->comboBoxYDimensionBase, m_yDimension);
}); });
connect(ui->comboBoxYDimensionStep, QOverload<int>::of(&QComboBox::currentIndexChanged), connect(ui->comboBoxYDimensionStep, QOverload<int>::of(&QComboBox::currentIndexChanged), this,
this, [this](int index) [this](int index)
{ { DimensionStepChanged(index, ui->comboBoxYDimensionStep, ui->comboBoxYDimensionBase, m_yDimension); });
DimensionStepChanged(index, ui->comboBoxYDimensionStep, ui->comboBoxYDimensionBase, m_yDimension); connect(ui->comboBoxYDimensionBase, QOverload<int>::of(&QComboBox::currentIndexChanged), this,
}); [this](int index) { DimensionBaseChanged(index, ui->comboBoxYDimensionBase, m_yDimension); });
connect(ui->comboBoxYDimensionBase, QOverload<int>::of(&QComboBox::currentIndexChanged),
this, [this](int index)
{
DimensionBaseChanged(index, ui->comboBoxYDimensionBase, m_yDimension);
});
// hip // hip
connect(ui->doubleSpinBoxWDimensionMinValue, QOverload<qreal>::of(&QDoubleSpinBox::valueChanged), connect(ui->doubleSpinBoxWDimensionMinValue, QOverload<qreal>::of(&QDoubleSpinBox::valueChanged), this,
this, [this](qreal value) [this](qreal value)
{ {
DimensionMinValueChanged(value, ui->doubleSpinBoxWDimensionMaxValue, ui->comboBoxWDimensionStep, DimensionMinValueChanged(value, ui->doubleSpinBoxWDimensionMaxValue, ui->comboBoxWDimensionStep,
ui->comboBoxWDimensionBase, m_wDimension); ui->comboBoxWDimensionBase, m_wDimension);
}); });
connect(ui->doubleSpinBoxWDimensionMaxValue, QOverload<qreal>::of(&QDoubleSpinBox::valueChanged), connect(ui->doubleSpinBoxWDimensionMaxValue, QOverload<qreal>::of(&QDoubleSpinBox::valueChanged), this,
this, [this](qreal value) [this](qreal value)
{ {
DimensionMaxValueChanged(value, ui->doubleSpinBoxWDimensionMinValue, ui->comboBoxWDimensionStep, DimensionMaxValueChanged(value, ui->doubleSpinBoxWDimensionMinValue, ui->comboBoxWDimensionStep,
ui->comboBoxWDimensionBase, m_wDimension); ui->comboBoxWDimensionBase, m_wDimension);
}); });
connect(ui->comboBoxWDimensionStep, QOverload<int>::of(&QComboBox::currentIndexChanged), connect(ui->comboBoxWDimensionStep, QOverload<int>::of(&QComboBox::currentIndexChanged), this,
this, [this](int index) [this](int index)
{ { DimensionStepChanged(index, ui->comboBoxWDimensionStep, ui->comboBoxWDimensionBase, m_wDimension); });
DimensionStepChanged(index, ui->comboBoxWDimensionStep, ui->comboBoxWDimensionBase, m_wDimension); connect(ui->comboBoxWDimensionBase, QOverload<int>::of(&QComboBox::currentIndexChanged), this,
}); [this](int index) { DimensionBaseChanged(index, ui->comboBoxWDimensionBase, m_wDimension); });
connect(ui->comboBoxWDimensionBase, QOverload<int>::of(&QComboBox::currentIndexChanged),
this, [this](int index)
{
DimensionBaseChanged(index, ui->comboBoxWDimensionBase, m_wDimension);
});
// waist // waist
connect(ui->doubleSpinBoxZDimensionMinValue, QOverload<qreal>::of(&QDoubleSpinBox::valueChanged), connect(ui->doubleSpinBoxZDimensionMinValue, QOverload<qreal>::of(&QDoubleSpinBox::valueChanged), this,
this, [this](qreal value) [this](qreal value)
{ {
DimensionMinValueChanged(value, ui->doubleSpinBoxZDimensionMaxValue, ui->comboBoxZDimensionStep, DimensionMinValueChanged(value, ui->doubleSpinBoxZDimensionMaxValue, ui->comboBoxZDimensionStep,
ui->comboBoxZDimensionBase, m_zDimension); ui->comboBoxZDimensionBase, m_zDimension);
}); });
connect(ui->doubleSpinBoxZDimensionMaxValue, QOverload<qreal>::of(&QDoubleSpinBox::valueChanged), connect(ui->doubleSpinBoxZDimensionMaxValue, QOverload<qreal>::of(&QDoubleSpinBox::valueChanged), this,
this, [this](qreal value) [this](qreal value)
{ {
DimensionMaxValueChanged(value, ui->doubleSpinBoxZDimensionMinValue, ui->comboBoxZDimensionStep, DimensionMaxValueChanged(value, ui->doubleSpinBoxZDimensionMinValue, ui->comboBoxZDimensionStep,
ui->comboBoxZDimensionBase, m_zDimension); ui->comboBoxZDimensionBase, m_zDimension);
}); });
connect(ui->comboBoxZDimensionStep, QOverload<int>::of(&QComboBox::currentIndexChanged), connect(ui->comboBoxZDimensionStep, QOverload<int>::of(&QComboBox::currentIndexChanged), this,
this, [this](int index) [this](int index)
{ DimensionStepChanged(index, ui->comboBoxZDimensionStep, ui->comboBoxZDimensionBase, m_zDimension); });
connect(ui->comboBoxZDimensionBase, QOverload<int>::of(&QComboBox::currentIndexChanged), this,
[this](int index) { DimensionBaseChanged(index, ui->comboBoxZDimensionBase, m_zDimension); });
connect(ui->groupBoxXDimension, &QGroupBox::clicked, this, [this]() { CheckState(); });
connect(ui->groupBoxYDimension, &QGroupBox::clicked, this, [this]() { CheckState(); });
connect(ui->groupBoxWDimension, &QGroupBox::clicked, this, [this]() { CheckState(); });
connect(ui->groupBoxZDimension, &QGroupBox::clicked, this, [this]() { CheckState(); });
connect(ui->checkBoxFullCircumference, &QCheckBox::stateChanged, this,
&DialogSetupMultisize::ShowFullCircumference);
connect(ui->checkBoxXDimensionBodyMeasurement, &QCheckBox::stateChanged, this,
&DialogSetupMultisize::XDimensionBodyMeasurementChanged);
connect(ui->checkBoxYDimensionBodyMeasurement, &QCheckBox::stateChanged, this,
&DialogSetupMultisize::YDimensionBodyMeasurementChanged);
connect(ui->checkBoxWDimensionBodyMeasurement, &QCheckBox::stateChanged, this,
&DialogSetupMultisize::WDimensionBodyMeasurementChanged);
connect(ui->checkBoxZDimensionBodyMeasurement, &QCheckBox::stateChanged, this,
&DialogSetupMultisize::ZDimensionBodyMeasurementChanged);
connect(ui->lineEditCustomXDimensionName, &QLineEdit::textChanged, this,
[this](const QString &text)
{ {
DimensionStepChanged(index, ui->comboBoxZDimensionStep, ui->comboBoxZDimensionBase, m_zDimension); m_xDimension->SetCustomName(text);
}); InitDimensionTitle(ui->groupBoxXDimension, m_xDimension);
connect(ui->comboBoxZDimensionBase, QOverload<int>::of(&QComboBox::currentIndexChanged),
this, [this](int index) CheckState();
{
DimensionBaseChanged(index, ui->comboBoxZDimensionBase, m_zDimension);
}); });
connect(ui->lineEditCustomYDimensionName, &QLineEdit::textChanged, this,
[this](const QString &text)
{
m_yDimension->SetCustomName(text);
InitDimensionTitle(ui->groupBoxYDimension, m_yDimension);
connect(ui->groupBoxXDimension, &QGroupBox::clicked, this, [this](){CheckState();}); CheckState();
connect(ui->groupBoxYDimension, &QGroupBox::clicked, this, [this](){CheckState();}); });
connect(ui->groupBoxWDimension, &QGroupBox::clicked, this, [this](){CheckState();});
connect(ui->groupBoxZDimension, &QGroupBox::clicked, this, [this](){CheckState();});
connect(ui->checkBoxFullCircumference, &QCheckBox::stateChanged, connect(ui->lineEditCustomWDimensionName, &QLineEdit::textChanged, this,
this, &DialogSetupMultisize::ShowFullCircumference); [this](const QString &text)
{
m_wDimension->SetCustomName(text);
InitDimensionTitle(ui->groupBoxWDimension, m_wDimension);
connect(ui->checkBoxXDimensionBodyMeasurement, &QCheckBox::stateChanged, CheckState();
this, &DialogSetupMultisize::XDimensionBodyMeasurementChanged); });
connect(ui->checkBoxYDimensionBodyMeasurement, &QCheckBox::stateChanged,
this, &DialogSetupMultisize::YDimensionBodyMeasurementChanged);
connect(ui->checkBoxWDimensionBodyMeasurement, &QCheckBox::stateChanged,
this, &DialogSetupMultisize::WDimensionBodyMeasurementChanged);
connect(ui->checkBoxZDimensionBodyMeasurement, &QCheckBox::stateChanged,
this, &DialogSetupMultisize::ZDimensionBodyMeasurementChanged);
connect(ui->lineEditCustomXDimensionName, &QLineEdit::textChanged, this, [this](const QString &text) connect(ui->lineEditCustomZDimensionName, &QLineEdit::textChanged, this,
{ [this](const QString &text)
m_xDimension->SetCustomName(text); {
InitDimensionTitle(ui->groupBoxXDimension, m_xDimension); m_zDimension->SetCustomName(text);
InitDimensionTitle(ui->groupBoxZDimension, m_zDimension);
CheckState(); CheckState();
}); });
connect(ui->lineEditCustomYDimensionName, &QLineEdit::textChanged, this, [this](const QString &text)
{
m_yDimension->SetCustomName(text);
InitDimensionTitle(ui->groupBoxYDimension, m_yDimension);
CheckState();
});
connect(ui->lineEditCustomWDimensionName, &QLineEdit::textChanged, this, [this](const QString &text)
{
m_wDimension->SetCustomName(text);
InitDimensionTitle(ui->groupBoxWDimension, m_wDimension);
CheckState();
});
connect(ui->lineEditCustomZDimensionName, &QLineEdit::textChanged, this, [this](const QString &text)
{
m_zDimension->SetCustomName(text);
InitDimensionTitle(ui->groupBoxZDimension, m_zDimension);
CheckState();
});
CheckState(); CheckState();
} }
@ -271,8 +249,8 @@ auto DialogSetupMultisize::FullCircumference() const -> bool
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
void DialogSetupMultisize::showEvent(QShowEvent *event) void DialogSetupMultisize::showEvent(QShowEvent *event)
{ {
QDialog::showEvent( event ); QDialog::showEvent(event);
if ( event->spontaneous() ) if (event->spontaneous())
{ {
return; return;
} }
@ -286,15 +264,15 @@ void DialogSetupMultisize::showEvent(QShowEvent *event)
setMaximumSize(size()); setMaximumSize(size());
setMinimumSize(size()); setMinimumSize(size());
m_isInitialized = true;//first show windows are held m_isInitialized = true; // first show windows are held
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
void DialogSetupMultisize::ShowFullCircumference() void DialogSetupMultisize::ShowFullCircumference()
{ {
auto ShowDimensionFullCircumference = [this](QDoubleSpinBox *doubleSpinBoxMinValue, auto ShowDimensionFullCircumference = [this](QDoubleSpinBox *doubleSpinBoxMinValue,
QDoubleSpinBox *doubleSpinBoxMaxValue, QComboBox *comboBoxStep, QComboBox *comboBoxBase, QDoubleSpinBox *doubleSpinBoxMaxValue, QComboBox *comboBoxStep,
const MeasurementDimension_p &dimension) QComboBox *comboBoxBase, const MeasurementDimension_p &dimension)
{ {
SCASSERT(doubleSpinBoxMinValue != nullptr) SCASSERT(doubleSpinBoxMinValue != nullptr)
SCASSERT(doubleSpinBoxMaxValue != nullptr) SCASSERT(doubleSpinBoxMaxValue != nullptr)
@ -498,24 +476,23 @@ void DialogSetupMultisize::InitDimensionMinMax(QDoubleSpinBox *doubleSpinBoxMinV
doubleSpinBoxMinValue->blockSignals(true); doubleSpinBoxMinValue->blockSignals(true);
doubleSpinBoxMinValue->setSuffix(unitStr); doubleSpinBoxMinValue->setSuffix(unitStr);
doubleSpinBoxMinValue->setDecimals(dimension->Units() == Unit::Mm ? 0 : 1); doubleSpinBoxMinValue->setDecimals(dimension->Units() == Unit::Mm ? 0 : 1);
doubleSpinBoxMinValue->setMinimum(m && fc ? dimension->RangeMin()*2 : dimension->RangeMin()); doubleSpinBoxMinValue->setMinimum(m && fc ? dimension->RangeMin() * 2 : dimension->RangeMin());
doubleSpinBoxMinValue->setMaximum(m && fc ? dimension->MaxValue()*2 : dimension->MaxValue()); doubleSpinBoxMinValue->setMaximum(m && fc ? dimension->MaxValue() * 2 : dimension->MaxValue());
doubleSpinBoxMinValue->setValue(m && fc ? dimension->MinValue()*2 : dimension->MinValue()); doubleSpinBoxMinValue->setValue(m && fc ? dimension->MinValue() * 2 : dimension->MinValue());
doubleSpinBoxMinValue->blockSignals(false); doubleSpinBoxMinValue->blockSignals(false);
doubleSpinBoxMaxValue->blockSignals(true); doubleSpinBoxMaxValue->blockSignals(true);
doubleSpinBoxMaxValue->setSuffix(unitStr); doubleSpinBoxMaxValue->setSuffix(unitStr);
doubleSpinBoxMaxValue->setDecimals(dimension->Units() == Unit::Mm ? 0 : 1); doubleSpinBoxMaxValue->setDecimals(dimension->Units() == Unit::Mm ? 0 : 1);
doubleSpinBoxMaxValue->setMinimum(m && fc ? dimension->MinValue()*2 : dimension->MinValue()); doubleSpinBoxMaxValue->setMinimum(m && fc ? dimension->MinValue() * 2 : dimension->MinValue());
doubleSpinBoxMaxValue->setMaximum(m && fc ? dimension->RangeMax()*2 : dimension->RangeMax()); doubleSpinBoxMaxValue->setMaximum(m && fc ? dimension->RangeMax() * 2 : dimension->RangeMax());
doubleSpinBoxMaxValue->setValue(m && fc ? dimension->RangeMax()*2 : dimension->RangeMax()); doubleSpinBoxMaxValue->setValue(m && fc ? dimension->RangeMax() * 2 : dimension->RangeMax());
doubleSpinBoxMaxValue->setValue(m && fc ? dimension->MaxValue()*2 : dimension->MaxValue()); doubleSpinBoxMaxValue->setValue(m && fc ? dimension->MaxValue() * 2 : dimension->MaxValue());
doubleSpinBoxMaxValue->blockSignals(false); doubleSpinBoxMaxValue->blockSignals(false);
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
void DialogSetupMultisize::InitDimensionStep(QComboBox *comboBoxStep, void DialogSetupMultisize::InitDimensionStep(QComboBox *comboBoxStep, const MeasurementDimension_p &dimension)
const MeasurementDimension_p &dimension)
{ {
SCASSERT(comboBoxStep != nullptr) SCASSERT(comboBoxStep != nullptr)
@ -528,9 +505,9 @@ void DialogSetupMultisize::InitDimensionStep(QComboBox *comboBoxStep,
comboBoxStep->blockSignals(true); comboBoxStep->blockSignals(true);
const QVector<qreal> steps = dimension->ValidSteps(); const QVector<qreal> steps = dimension->ValidSteps();
comboBoxStep->clear(); comboBoxStep->clear();
for(auto step : steps) for (auto step : steps)
{ {
comboBoxStep->addItem(QStringLiteral("%1%2").arg(m && fc ? step*2 : step).arg(unitStr), step); comboBoxStep->addItem(QStringLiteral("%1%2").arg(m && fc ? step * 2 : step).arg(unitStr), step);
} }
comboBoxStep->setCurrentIndex(-1); // force a user to select comboBoxStep->setCurrentIndex(-1); // force a user to select
@ -560,7 +537,7 @@ void DialogSetupMultisize::InitXDimension()
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
void DialogSetupMultisize::InitYDimension() void DialogSetupMultisize::InitYDimension()
{ {
InitDimensionTitle(ui->groupBoxYDimension, m_yDimension); InitDimensionTitle(ui->groupBoxYDimension, m_yDimension);
InitDimension(ui->doubleSpinBoxYDimensionMinValue, ui->doubleSpinBoxYDimensionMaxValue, ui->comboBoxYDimensionStep, InitDimension(ui->doubleSpinBoxYDimensionMinValue, ui->doubleSpinBoxYDimensionMaxValue, ui->comboBoxYDimensionStep,
m_yDimension); m_yDimension);
} }
@ -663,8 +640,7 @@ void DialogSetupMultisize::DimensionBaseChanged(int index, QComboBox *comboBoxBa
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
void DialogSetupMultisize::UpdateSteps(QComboBox *comboBoxStep, void DialogSetupMultisize::UpdateSteps(QComboBox *comboBoxStep, const MeasurementDimension_p &dimension)
const MeasurementDimension_p &dimension)
{ {
SCASSERT(comboBoxStep != nullptr) SCASSERT(comboBoxStep != nullptr)
@ -683,7 +659,7 @@ void DialogSetupMultisize::UpdateSteps(QComboBox *comboBoxStep,
const bool m = dimension->IsBodyMeasurement(); const bool m = dimension->IsBodyMeasurement();
const QString unitStr = m ? " " + UnitsToStr(dimension->Units()) : QString(); const QString unitStr = m ? " " + UnitsToStr(dimension->Units()) : QString();
for(auto step : steps) for (auto step : steps)
{ {
comboBoxStep->addItem(QStringLiteral("%1%2").arg(m && fc ? step * 2 : step).arg(unitStr), step); comboBoxStep->addItem(QStringLiteral("%1%2").arg(m && fc ? step * 2 : step).arg(unitStr), step);
} }
@ -697,8 +673,7 @@ void DialogSetupMultisize::UpdateSteps(QComboBox *comboBoxStep,
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
void DialogSetupMultisize::UpdateBase(QComboBox *comboBoxBase, void DialogSetupMultisize::UpdateBase(QComboBox *comboBoxBase, const MeasurementDimension_p &dimension)
const MeasurementDimension_p &dimension)
{ {
SCASSERT(comboBoxBase != nullptr) SCASSERT(comboBoxBase != nullptr)
@ -716,7 +691,7 @@ void DialogSetupMultisize::UpdateBase(QComboBox *comboBoxBase,
const bool m = dimension->IsBodyMeasurement(); const bool m = dimension->IsBodyMeasurement();
const QString unitStr = m ? " " + UnitsToStr(dimension->Units()) : QString(); const QString unitStr = m ? " " + UnitsToStr(dimension->Units()) : QString();
for(auto base : bases) for (auto base : bases)
{ {
comboBoxBase->addItem(QStringLiteral("%1%2").arg(m && fc ? base * 2 : base).arg(unitStr), base); comboBoxBase->addItem(QStringLiteral("%1%2").arg(m && fc ? base * 2 : base).arg(unitStr), base);
} }
@ -728,4 +703,3 @@ void DialogSetupMultisize::UpdateBase(QComboBox *comboBoxBase,
const qreal base = comboBoxBase->currentData().toDouble(&ok); const qreal base = comboBoxBase->currentData().toDouble(&ok);
dimension->SetBaseValue(ok ? base : -1); dimension->SetBaseValue(ok ? base : -1);
} }

View File

@ -33,10 +33,6 @@
#include "../vformat/vdimensions.h" #include "../vformat/vdimensions.h"
#include "../vmisc/def.h" #include "../vmisc/def.h"
#if QT_VERSION < QT_VERSION_CHECK(5, 13, 0)
#include "../vmisc/defglobal.h"
#endif // QT_VERSION < QT_VERSION_CHECK(5, 13, 0)
class QDoubleSpinBox; class QDoubleSpinBox;
class QGroupBox; class QGroupBox;
class QLineEdit; class QLineEdit;
@ -101,8 +97,7 @@ private:
void DimensionStepChanged(int index, QComboBox *comboBoxStep, QComboBox *comboBoxBase, void DimensionStepChanged(int index, QComboBox *comboBoxStep, QComboBox *comboBoxBase,
const MeasurementDimension_p &dimension); const MeasurementDimension_p &dimension);
void DimensionBaseChanged(int index, QComboBox *comboBoxBase, void DimensionBaseChanged(int index, QComboBox *comboBoxBase, const MeasurementDimension_p &dimension);
const MeasurementDimension_p &dimension);
void UpdateSteps(QComboBox *comboBoxStep, const MeasurementDimension_p &dimension); void UpdateSteps(QComboBox *comboBoxStep, const MeasurementDimension_p &dimension);
void UpdateBase(QComboBox *comboBoxBase, const MeasurementDimension_p &dimension); void UpdateBase(QComboBox *comboBoxBase, const MeasurementDimension_p &dimension);

View File

@ -31,10 +31,6 @@
#include <QDialog> #include <QDialog>
#if QT_VERSION < QT_VERSION_CHECK(5, 13, 0)
#include "../vmisc/defglobal.h"
#endif
namespace Ui namespace Ui
{ {
class DialogTapePreferences; class DialogTapePreferences;

View File

@ -32,12 +32,8 @@
#include <QTimer> #include <QTimer>
#if defined(APPIMAGE) && defined(Q_OS_LINUX) #if defined(APPIMAGE) && defined(Q_OS_LINUX)
#if QT_VERSION < QT_VERSION_CHECK(5, 12, 0)
#include "../vmisc/backport/qscopeguard.h"
#else
#include <QScopeGuard>
#endif
#include "../vmisc/appimage.h" #include "../vmisc/appimage.h"
#include <QScopeGuard>
#endif // defined(APPIMAGE) && defined(Q_OS_LINUX) #endif // defined(APPIMAGE) && defined(Q_OS_LINUX)
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) #if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
@ -119,11 +115,9 @@ auto main(int argc, char *argv[]) -> int
MApplication app(argc, argv); MApplication app(argc, argv);
app.InitOptions(); app.InitOptions();
QT_REQUIRE_VERSION(argc, argv, "5.6.0"); // clazy:exclude=qstring-arg,qstring-allocations NOLINT QT_REQUIRE_VERSION(argc, argv, "5.15.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")); MApplication::setDesktopFileName(QStringLiteral("ua.com.smart-pattern.tape.desktop"));
#endif
QTimer::singleShot(0, &app, &MApplication::ProcessCMD); QTimer::singleShot(0, &app, &MApplication::ProcessCMD);

View File

@ -155,26 +155,6 @@ inline void noisyFailureMsgHandler(QtMsgType type, const QMessageLogContext &con
#endif // defined(V_NO_ASSERT) #endif // defined(V_NO_ASSERT)
#if defined(Q_OS_MAC) #if defined(Q_OS_MAC)
#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
if ((type == QtWarningMsg) && msg.contains(QStringLiteral("QNSView")))
{
type = QtDebugMsg;
}
#endif
#if QT_VERSION < QT_VERSION_CHECK(5, 9, 0)
// Hide Qt bug 'Assertion when reading an icns file'
// https://bugreports.qt.io/browse/QTBUG-45537
// Remove after Qt fix will be released
if ((type == QtWarningMsg) && msg.contains(QStringLiteral("QICNSHandler::read()")))
{
type = QtDebugMsg;
}
#endif
// Hide anything that starts with QMacCGContext // Hide anything that starts with QMacCGContext
if ((type == QtWarningMsg) && msg.contains(QStringLiteral("QMacCGContext::"))) if ((type == QtWarningMsg) && msg.contains(QStringLiteral("QMacCGContext::")))
{ {

View File

@ -69,20 +69,7 @@
#include <QTextCodec> #include <QTextCodec>
#endif #endif
#if QT_VERSION < QT_VERSION_CHECK(5, 7, 0)
#include "../vmisc/backport/qoverload.h"
#endif // QT_VERSION < QT_VERSION_CHECK(5, 7, 0)
#if (defined(Q_CC_GNU) && Q_CC_GNU < 409) && !defined(Q_CC_CLANG)
// DO NOT WORK WITH GCC 4.8
#else
#if __cplusplus >= 201402L
using namespace std::chrono_literals; using namespace std::chrono_literals;
#else
#include "../vmisc/bpstd/chrono.hpp"
using namespace bpstd::literals::chrono_literals;
#endif // __cplusplus >= 201402L
#endif //(defined(Q_CC_GNU) && Q_CC_GNU < 409) && !defined(Q_CC_CLANG)
QT_WARNING_PUSH QT_WARNING_PUSH
QT_WARNING_DISABLE_CLANG("-Wmissing-prototypes") QT_WARNING_DISABLE_CLANG("-Wmissing-prototypes")
@ -145,7 +132,7 @@ TKMMainWindow::TKMMainWindow(QWidget *parent)
if (MApplication::VApp()->IsAppInGUIMode()) if (MApplication::VApp()->IsAppInGUIMode())
{ {
QTimer::singleShot(V_SECONDS(1), this, &TKMMainWindow::AskDefaultSettings); QTimer::singleShot(1s, this, &TKMMainWindow::AskDefaultSettings);
} }
m_buttonShortcuts.insert(VShortcutAction::CaseSensitiveMatch, ui->toolButtonCaseSensitive); m_buttonShortcuts.insert(VShortcutAction::CaseSensitiveMatch, ui->toolButtonCaseSensitive);
@ -358,15 +345,6 @@ void TKMMainWindow::UpdateWindowTitle()
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
void TKMMainWindow::closeEvent(QCloseEvent *event) void TKMMainWindow::closeEvent(QCloseEvent *event)
{ {
#if defined(Q_OS_MAC) && QT_VERSION < QT_VERSION_CHECK(5, 11, 1)
// Workaround for Qt bug https://bugreports.qt.io/browse/QTBUG-43344
static int numCalled = 0;
if (numCalled++ >= 1)
{
return;
}
#endif
if (MaybeSave()) if (MaybeSave())
{ {
WriteSettings(); WriteSettings();

View File

@ -66,22 +66,12 @@
#include "vlitepattern.h" #include "vlitepattern.h"
#include "vtapesettings.h" #include "vtapesettings.h"
#if QT_VERSION < QT_VERSION_CHECK(5, 7, 0)
#include "../vmisc/backport/qoverload.h"
#endif // QT_VERSION < QT_VERSION_CHECK(5, 7, 0)
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) #if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
#include "../vmisc/vtextcodec.h" #include "../vmisc/vtextcodec.h"
#else #else
#include <QTextCodec> #include <QTextCodec>
#endif #endif
#if QT_VERSION < QT_VERSION_CHECK(5, 12, 0)
#include "../vmisc/backport/qscopeguard.h"
#else
#include <QScopeGuard>
#endif
#include <QComboBox> #include <QComboBox>
#include <QCursor> #include <QCursor>
#include <QDesktopServices> #include <QDesktopServices>
@ -91,21 +81,13 @@
#include <QMimeType> #include <QMimeType>
#include <QPixmap> #include <QPixmap>
#include <QProcess> #include <QProcess>
#include <QScopeGuard>
#include <QTimer> #include <QTimer>
#include <QUuid> #include <QUuid>
#include <QtNumeric> #include <QtNumeric>
#include <chrono> #include <chrono>
#if (defined(Q_CC_GNU) && Q_CC_GNU < 409) && !defined(Q_CC_CLANG)
// DO NOT WORK WITH GCC 4.8
#else
#if __cplusplus >= 201402L
using namespace std::chrono_literals; using namespace std::chrono_literals;
#else
#include "../vmisc/bpstd/chrono.hpp"
using namespace bpstd::literals::chrono_literals;
#endif // __cplusplus >= 201402L
#endif //(defined(Q_CC_GNU) && Q_CC_GNU < 409) && !defined(Q_CC_CLANG)
#if defined(Q_OS_MAC) #if defined(Q_OS_MAC)
#include <QDrag> #include <QDrag>
@ -313,7 +295,7 @@ TMainWindow::TMainWindow(QWidget *parent)
if (MApplication::VApp()->IsAppInGUIMode()) if (MApplication::VApp()->IsAppInGUIMode())
{ {
QTimer::singleShot(V_SECONDS(1), this, &TMainWindow::AskDefaultSettings); QTimer::singleShot(1s, this, &TMainWindow::AskDefaultSettings);
} }
m_buttonShortcuts.insert(VShortcutAction::CaseSensitiveMatch, ui->toolButtonCaseSensitive); m_buttonShortcuts.insert(VShortcutAction::CaseSensitiveMatch, ui->toolButtonCaseSensitive);
@ -732,15 +714,6 @@ void TMainWindow::ToolBarStyles()
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
void TMainWindow::closeEvent(QCloseEvent *event) void TMainWindow::closeEvent(QCloseEvent *event)
{ {
#if defined(Q_OS_MAC) && QT_VERSION < QT_VERSION_CHECK(5, 11, 1)
// Workaround for Qt bug https://bugreports.qt.io/browse/QTBUG-43344
static int numCalled = 0;
if (numCalled++ >= 1)
{
return;
}
#endif
if (MaybeSave()) if (MaybeSave())
{ {
WriteSettings(); WriteSettings();
@ -3278,7 +3251,7 @@ void TMainWindow::InitDimensionGradation(int index, const MeasurementDimension_p
int maxWidth = 0; int maxWidth = 0;
for (int i = 0; i < control->count(); ++i) for (int i = 0; i < control->count(); ++i)
{ {
int itemWidth = TextWidth(fontMetrics, control->itemText(i)); int itemWidth = fontMetrics.horizontalAdvance(control->itemText(i));
if (itemWidth > maxWidth) if (itemWidth > maxWidth)
{ {
maxWidth = itemWidth; maxWidth = itemWidth;

View File

@ -30,10 +30,6 @@
#include "../vmisc/vabstractshortcutmanager.h" #include "../vmisc/vabstractshortcutmanager.h"
#if QT_VERSION < QT_VERSION_CHECK(5, 13, 0)
#include "../vmisc/defglobal.h"
#endif
class VTapeShortcutManager : public VAbstractShortcutManager class VTapeShortcutManager : public VAbstractShortcutManager
{ {
Q_OBJECT // NOLINT Q_OBJECT // NOLINT

View File

@ -45,13 +45,10 @@
#include "../vmisc/vvalentinasettings.h" #include "../vmisc/vvalentinasettings.h"
#include "vvalentinashortcutmanager.h" #include "vvalentinashortcutmanager.h"
#if QT_VERSION < QT_VERSION_CHECK(5, 14, 0)
#include "../vmisc/backport/text.h"
#endif
#include "QtConcurrent/qtconcurrentrun.h" #include "QtConcurrent/qtconcurrentrun.h"
#include <QDateTime> #include <QDateTime>
#include <QDir> #include <QDir>
#include <QEvent>
#include <QFile> #include <QFile>
#include <QFileSystemWatcher> #include <QFileSystemWatcher>
#include <QFuture> #include <QFuture>
@ -60,6 +57,7 @@
#include <QMessageBox> #include <QMessageBox>
#include <QObject> #include <QObject>
#include <QProcess> #include <QProcess>
#include <QScopeGuard>
#include <QStandardPaths> #include <QStandardPaths>
#include <QStyleFactory> #include <QStyleFactory>
#include <QTemporaryFile> #include <QTemporaryFile>
@ -77,13 +75,6 @@
#define BUILD_REVISION VCS_REPO_STATE_REVISION #define BUILD_REVISION VCS_REPO_STATE_REVISION
#endif #endif
#if QT_VERSION < QT_VERSION_CHECK(5, 12, 0)
#include "../vmisc/backport/qscopeguard.h"
#else
#include <QEvent>
#include <QScopeGuard>
#endif
#if QT_VERSION < QT_VERSION_CHECK(6, 4, 0) #if QT_VERSION < QT_VERSION_CHECK(6, 4, 0)
#include "../vmisc/compatibility.h" #include "../vmisc/compatibility.h"
#endif #endif
@ -181,26 +172,6 @@ inline void noisyFailureMsgHandler(QtMsgType type, const QMessageLogContext &con
#endif // defined(V_NO_ASSERT) #endif // defined(V_NO_ASSERT)
#if defined(Q_OS_MAC) #if defined(Q_OS_MAC)
#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
if ((type == QtWarningMsg) && msg.contains(QStringLiteral("QNSView")))
{
type = QtDebugMsg;
}
#endif
#if QT_VERSION < QT_VERSION_CHECK(5, 9, 0)
// Hide Qt bug 'Assertion when reading an icns file'
// https://bugreports.qt.io/browse/QTBUG-45537
// Remove after Qt fix will be released
if ((type == QtWarningMsg) && msg.contains(QStringLiteral("QICNSHandler::read()")))
{
type = QtDebugMsg;
}
#endif
// Hide anything that starts with QMacCGContext // Hide anything that starts with QMacCGContext
if ((type == QtWarningMsg) && msg.contains(QStringLiteral("QMacCGContext::"))) if ((type == QtWarningMsg) && msg.contains(QStringLiteral("QMacCGContext::")))
{ {
@ -645,11 +616,7 @@ void VApplication::ClearOldLogs()
for (const auto &fn : allFiles) for (const auto &fn : allFiles)
{ {
QFileInfo info(fn); QFileInfo info(fn);
#if QT_VERSION >= QT_VERSION_CHECK(5, 10, 0)
const QDateTime created = info.birthTime(); const QDateTime created = info.birthTime();
#else
const QDateTime created = info.created();
#endif
if (created.daysTo(QDateTime::currentDateTime()) >= DAYS_TO_KEEP_LOGS) if (created.daysTo(QDateTime::currentDateTime()) >= DAYS_TO_KEEP_LOGS)
{ {
VLockGuard<QFile> tmp(info.absoluteFilePath(), [&fn]() { return new QFile(fn); }); VLockGuard<QFile> tmp(info.absoluteFilePath(), [&fn]() { return new QFile(fn); });

View File

@ -35,9 +35,6 @@
#include <QWidget> #include <QWidget>
#include "../vpatterndb/vformula.h" #include "../vpatterndb/vformula.h"
#if QT_VERSION < QT_VERSION_CHECK(5, 13, 0)
#include "../vmisc/defglobal.h"
#endif
class VFormulaPropertyEditor : public QWidget class VFormulaPropertyEditor : public QWidget
{ {

View File

@ -30,10 +30,6 @@
#include "../vmisc/vabstractshortcutmanager.h" #include "../vmisc/vabstractshortcutmanager.h"
#if QT_VERSION < QT_VERSION_CHECK(5, 13, 0)
#include "../vmisc/defglobal.h"
#endif
class VValentinaShortcutManager : public VAbstractShortcutManager class VValentinaShortcutManager : public VAbstractShortcutManager
{ {
Q_OBJECT // NOLINT Q_OBJECT // NOLINT

View File

@ -35,16 +35,12 @@
#include "../vmisc/theme/vtheme.h" #include "../vmisc/theme/vtheme.h"
#include "../vmisc/vabstractshortcutmanager.h" #include "../vmisc/vabstractshortcutmanager.h"
#include "../vmisc/vvalentinasettings.h" #include "../vmisc/vvalentinasettings.h"
#include "qpushbutton.h"
#include "ui_preferencesconfigurationpage.h" #include "ui_preferencesconfigurationpage.h"
#include "vcommonsettings.h" #include "vcommonsettings.h"
#if QT_VERSION < QT_VERSION_CHECK(5, 7, 0)
#include "../vmisc/backport/qoverload.h"
#endif // QT_VERSION < QT_VERSION_CHECK(5, 7, 0)
#include <QDir> #include <QDir>
#include <QDirIterator> #include <QDirIterator>
#include <QPushButton>
#include <QStyleHints> #include <QStyleHints>
#include <QTimer> #include <QTimer>

View File

@ -31,10 +31,6 @@
#include <QWidget> #include <QWidget>
#if QT_VERSION < QT_VERSION_CHECK(5, 13, 0)
#include "../vmisc/defglobal.h"
#endif
namespace Ui namespace Ui
{ {
class PreferencesConfigurationPage; class PreferencesConfigurationPage;

View File

@ -31,10 +31,6 @@
#include <QWidget> #include <QWidget>
#if QT_VERSION < QT_VERSION_CHECK(5, 13, 0)
#include "../vmisc/defglobal.h"
#endif
namespace Ui namespace Ui
{ {
class PreferencesPathPage; class PreferencesPathPage;

View File

@ -29,24 +29,21 @@
#include "preferencespatternpage.h" #include "preferencespatternpage.h"
#include "../dialogdatetimeformats.h" #include "../dialogdatetimeformats.h"
#include "../dialogknownmaterials.h" #include "../dialogknownmaterials.h"
#include "../ifc/xml/vabstractpattern.h"
#include "../vformat/vsinglelineoutlinechar.h"
#include "../vmisc/svgfont/vsvgfontdatabase.h" #include "../vmisc/svgfont/vsvgfontdatabase.h"
#include "../vmisc/vabstractvalapplication.h" #include "../vmisc/vabstractvalapplication.h"
#include "../vmisc/vvalentinasettings.h" #include "../vmisc/vvalentinasettings.h"
#include "../vwidgets/vmaingraphicsview.h"
#include "svgfont/svgdef.h" #include "svgfont/svgdef.h"
#include "svgfont/vsvgfont.h" #include "svgfont/vsvgfont.h"
#include "svgfont/vsvgfontengine.h" #include "svgfont/vsvgfontengine.h"
#include "ui_preferencespatternpage.h" #include "ui_preferencespatternpage.h"
#include "vabstractapplication.h" #include "vabstractapplication.h"
#include <QFontMetrics>
#if QT_VERSION < QT_VERSION_CHECK(5, 7, 0)
#include "../vmisc/backport/qoverload.h"
#endif // QT_VERSION < QT_VERSION_CHECK(5, 7, 0)
#include "../ifc/xml/vabstractpattern.h"
#include "../vformat/vsinglelineoutlinechar.h"
#include "../vwidgets/vmaingraphicsview.h"
#include <QCompleter> #include <QCompleter>
#include <QDate> #include <QDate>
#include <QFontMetrics>
#include <QMessageBox> #include <QMessageBox>
#include <QScreen> #include <QScreen>
#include <QStyledItemDelegate> #include <QStyledItemDelegate>

View File

@ -31,10 +31,6 @@
#include <QDialog> #include <QDialog>
#if QT_VERSION < QT_VERSION_CHECK(5, 13, 0)
#include "../vmisc/defglobal.h"
#endif
namespace Ui namespace Ui
{ {
class DialogAboutApp; class DialogAboutApp;

View File

@ -30,13 +30,9 @@
#include <QDialog> #include <QDialog>
#if QT_VERSION < QT_VERSION_CHECK(5, 13, 0)
#include "../vmisc/defglobal.h"
#endif // QT_VERSION < QT_VERSION_CHECK(5, 13, 0)
namespace Ui namespace Ui
{ {
class DialogAddBackgroundImage; class DialogAddBackgroundImage;
} }
class DialogAddBackgroundImage : public QDialog class DialogAddBackgroundImage : public QDialog

View File

@ -33,10 +33,6 @@
#include <QDialog> #include <QDialog>
#include <QTime> #include <QTime>
#if QT_VERSION < QT_VERSION_CHECK(5, 13, 0)
#include "../vmisc/defglobal.h"
#endif
namespace Ui namespace Ui
{ {
class DialogDateTimeFormats; class DialogDateTimeFormats;

View File

@ -27,14 +27,10 @@
*************************************************************************/ *************************************************************************/
#include "dialogincrements.h" #include "dialogincrements.h"
#include "../vmisc/vvalentinasettings.h"
#include "ui_dialogincrements.h"
#if QT_VERSION < QT_VERSION_CHECK(5, 7, 0)
#include "../vmisc/backport/qoverload.h"
#endif // QT_VERSION < QT_VERSION_CHECK(5, 7, 0)
#include "../qmuparser/qmudef.h" #include "../qmuparser/qmudef.h"
#include "../qmuparser/qmutokenparser.h" #include "../qmuparser/qmutokenparser.h"
#include "../vmisc/theme/vtheme.h" #include "../vmisc/theme/vtheme.h"
#include "../vmisc/vvalentinasettings.h"
#include "../vpatterndb/calculator.h" #include "../vpatterndb/calculator.h"
#include "../vpatterndb/variables/varcradius.h" #include "../vpatterndb/variables/varcradius.h"
#include "../vpatterndb/variables/vcurveangle.h" #include "../vpatterndb/variables/vcurveangle.h"
@ -45,6 +41,7 @@
#include "../vpatterndb/variables/vlinelength.h" #include "../vpatterndb/variables/vlinelength.h"
#include "../vpatterndb/vtranslatevars.h" #include "../vpatterndb/vtranslatevars.h"
#include "../vtools/dialogs/support/dialogeditwrongformula.h" #include "../vtools/dialogs/support/dialogeditwrongformula.h"
#include "ui_dialogincrements.h"
#include <QCloseEvent> #include <QCloseEvent>
#include <QDir> #include <QDir>
@ -2106,9 +2103,6 @@ DialogIncrements::~DialogIncrements()
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
void DialogIncrements::RestoreAfterClose() void DialogIncrements::RestoreAfterClose()
{ {
// Because of bug on Mac OS with Qt 5.11 closing this dialog causes a crash. Instead of closing we will keep
// dialog in memory and reuse it again. This function redo some moves made after close.
connect(this->m_doc, &VPattern::FullUpdateFromFile, this, &DialogIncrements::FullUpdateFromFile); connect(this->m_doc, &VPattern::FullUpdateFromFile, this, &DialogIncrements::FullUpdateFromFile);
ui->tabWidget->setCurrentIndex(0); ui->tabWidget->setCurrentIndex(0);

View File

@ -31,10 +31,6 @@
#include <QDialog> #include <QDialog>
#if QT_VERSION < QT_VERSION_CHECK(5, 13, 0)
#include "../vmisc/defglobal.h"
#endif
namespace Ui namespace Ui
{ {
class DialogKnownMaterials; class DialogKnownMaterials;

View File

@ -40,16 +40,7 @@
#include <QtDebug> #include <QtDebug>
#include <chrono> #include <chrono>
#if (defined(Q_CC_GNU) && Q_CC_GNU < 409) && !defined(Q_CC_CLANG)
// DO NOT WORK WITH GCC 4.8
#else
#if __cplusplus >= 201402L
using namespace std::chrono_literals; using namespace std::chrono_literals;
#else
#include "../vmisc/bpstd/chrono.hpp"
using namespace bpstd::literals::chrono_literals;
#endif // __cplusplus >= 201402L
#endif //(defined(Q_CC_GNU) && Q_CC_GNU < 409) && !defined(Q_CC_CLANG)
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
DialogLayoutProgress::DialogLayoutProgress(QElapsedTimer timer, qint64 timeout, QWidget *parent) DialogLayoutProgress::DialogLayoutProgress(QElapsedTimer timer, qint64 timeout, QWidget *parent)
@ -96,7 +87,7 @@ DialogLayoutProgress::DialogLayoutProgress(QElapsedTimer timer, qint64 timeout,
m_progressTimer->stop(); m_progressTimer->stop();
} }
}); });
m_progressTimer->start(V_SECONDS(1)); m_progressTimer->start(1s);
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------

View File

@ -33,10 +33,6 @@
#include <QElapsedTimer> #include <QElapsedTimer>
#include <QTimer> #include <QTimer>
#if QT_VERSION < QT_VERSION_CHECK(5, 13, 0)
#include "../vmisc/defglobal.h"
#endif
namespace Ui namespace Ui
{ {
class DialogLayoutProgress; class DialogLayoutProgress;

View File

@ -27,13 +27,10 @@
*************************************************************************/ *************************************************************************/
#include "dialoglayoutsettings.h" #include "dialoglayoutsettings.h"
#include "../vlayout/vlayoutgenerator.h"
#include "../vmisc/vabstractvalapplication.h" #include "../vmisc/vabstractvalapplication.h"
#include "../vmisc/vvalentinasettings.h" #include "../vmisc/vvalentinasettings.h"
#include "ui_dialoglayoutsettings.h" #include "ui_dialoglayoutsettings.h"
#if QT_VERSION < QT_VERSION_CHECK(5, 7, 0)
#include "../vmisc/backport/qoverload.h"
#endif // QT_VERSION < QT_VERSION_CHECK(5, 7, 0)
#include "../vlayout/vlayoutgenerator.h"
#include <QMessageBox> #include <QMessageBox>
#include <QPrinterInfo> #include <QPrinterInfo>

View File

@ -43,16 +43,13 @@
#include <QUrl> #include <QUrl>
#include "../core/vapplication.h" #include "../core/vapplication.h"
#include "../ifc/xml/utils.h"
#include "../ifc/xml/vpatternimage.h"
#include "../qmuparser/qmudef.h"
#include "../vmisc/vabstractvalapplication.h" #include "../vmisc/vabstractvalapplication.h"
#include "../vmisc/vvalentinasettings.h" #include "../vmisc/vvalentinasettings.h"
#include "../vpatterndb/vcontainer.h" #include "../vpatterndb/vcontainer.h"
#include "../xml/vpattern.h" #include "../xml/vpattern.h"
#if QT_VERSION < QT_VERSION_CHECK(5, 7, 0)
#include "../vmisc/backport/qoverload.h"
#endif // QT_VERSION < QT_VERSION_CHECK(5, 7, 0)
#include "../ifc/xml/utils.h"
#include "../ifc/xml/vpatternimage.h"
#include "../qmuparser/qmudef.h"
#if QT_VERSION < QT_VERSION_CHECK(6, 4, 0) #if QT_VERSION < QT_VERSION_CHECK(6, 4, 0)
#include "../vmisc/compatibility.h" #include "../vmisc/compatibility.h"

View File

@ -33,10 +33,6 @@
#include <QMap> #include <QMap>
#include <QPointer> #include <QPointer>
#if QT_VERSION < QT_VERSION_CHECK(5, 13, 0)
#include "../vmisc/defglobal.h"
#endif
class VPattern; class VPattern;
class VContainer; class VContainer;
class QCheckBox; class QCheckBox;

View File

@ -31,10 +31,6 @@
#include <QDialog> #include <QDialog>
#if QT_VERSION < QT_VERSION_CHECK(5, 13, 0)
#include "../vmisc/defglobal.h"
#endif
namespace Ui namespace Ui
{ {
class DialogPreferences; class DialogPreferences;

View File

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

View File

@ -44,10 +44,6 @@
#include "../vtools/undocommands/image/zvaluemovebackgroundimage.h" #include "../vtools/undocommands/image/zvaluemovebackgroundimage.h"
#include "ui_vwidgetbackgroundimages.h" #include "ui_vwidgetbackgroundimages.h"
#if QT_VERSION < QT_VERSION_CHECK(5, 7, 0)
#include "../vmisc/backport/qoverload.h"
#endif // QT_VERSION < QT_VERSION_CHECK(5, 7, 0)
#include <QMenu> #include <QMenu>
#include <QPushButton> #include <QPushButton>

View File

@ -30,10 +30,6 @@
#include <QWidget> #include <QWidget>
#if QT_VERSION < QT_VERSION_CHECK(5, 13, 0)
#include "../vmisc/defglobal.h"
#endif // QT_VERSION < QT_VERSION_CHECK(5, 13, 0)
#include "../vmisc/def.h" #include "../vmisc/def.h"
class VAbstractPattern; class VAbstractPattern;
@ -41,10 +37,17 @@ class VBackgroundPatternImage;
namespace Ui namespace Ui
{ {
class VWidgetBackgroundImages; class VWidgetBackgroundImages;
} }
enum class ScaleUnit {Percent, Mm, Cm, Inch, Px}; enum class ScaleUnit
{
Percent,
Mm,
Cm,
Inch,
Px
};
class VWidgetBackgroundImages : public QWidget class VWidgetBackgroundImages : public QWidget
{ {

View File

@ -40,16 +40,7 @@
#include <QUndoStack> #include <QUndoStack>
#include <chrono> #include <chrono>
#if (defined(Q_CC_GNU) && Q_CC_GNU < 409) && !defined(Q_CC_CLANG)
// DO NOT WORK WITH GCC 4.8
#else
#if __cplusplus >= 201402L
using namespace std::chrono_literals; using namespace std::chrono_literals;
#else
#include "../vmisc/bpstd/chrono.hpp"
using namespace bpstd::literals::chrono_literals;
#endif // __cplusplus >= 201402L
#endif //(defined(Q_CC_GNU) && Q_CC_GNU < 409) && !defined(Q_CC_CLANG)
namespace namespace
{ {
@ -95,7 +86,7 @@ void VWidgetDetails::UpdateList()
// The filling table is a very expensive operation. This optimization will postpone it. // The filling table is a very expensive operation. This optimization will postpone it.
// Each time a new request happen we will wait 800 ms before calling it. If at this time a new request will arrive // Each time a new request happen we will wait 800 ms before calling it. If at this time a new request will arrive
// we will wait 800 ms more. And so on, until nothing happens within 800ms. // we will wait 800 ms more. And so on, until nothing happens within 800ms.
m_updateListTimer->start(V_MSECONDS(800)); m_updateListTimer->start(800ms);
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------

View File

@ -31,10 +31,6 @@
#include <QWidget> #include <QWidget>
#if QT_VERSION < QT_VERSION_CHECK(5, 13, 0)
#include "../vmisc/defglobal.h"
#endif
class VAbstractPattern; class VAbstractPattern;
class VContainer; class VContainer;
class VPiece; class VPiece;

View File

@ -30,10 +30,8 @@
#define VWIDGETGROUPS_H #define VWIDGETGROUPS_H
#include "../vmisc/typedef.h" #include "../vmisc/typedef.h"
#include <QWidget> #include <QWidget>
#if QT_VERSION < QT_VERSION_CHECK(5, 13, 0)
#include "../vmisc/defglobal.h"
#endif
class QTableWidgetItem; class QTableWidgetItem;
class VAbstractPattern; class VAbstractPattern;

View File

@ -36,12 +36,8 @@
#include <QTimer> #include <QTimer>
#if defined(APPIMAGE) && defined(Q_OS_LINUX) #if defined(APPIMAGE) && defined(Q_OS_LINUX)
#if QT_VERSION < QT_VERSION_CHECK(5, 12, 0)
#include "../vmisc/backport/qscopeguard.h"
#else
#include <QScopeGuard>
#endif
#include "../vmisc/appimage.h" #include "../vmisc/appimage.h"
#include <QScopeGuard>
#endif // defined(APPIMAGE) && defined(Q_OS_LINUX) #endif // defined(APPIMAGE) && defined(Q_OS_LINUX)
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) #if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
@ -133,11 +129,9 @@ auto main(int argc, char *argv[]) -> int
VApplication app(argc, argv); VApplication app(argc, argv);
app.InitOptions(); app.InitOptions();
QT_REQUIRE_VERSION(argc, argv, "5.6.0") // clazy:exclude=qstring-arg,qstring-allocations NOLINT QT_REQUIRE_VERSION(argc, argv, "5.15.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")); VApplication::setDesktopFileName(QStringLiteral("ua.com.smart-pattern.valentina.desktop"));
#endif
if (VApplication::IsGUIMode() && VAbstractApplication::VApp()->Settings()->IsAutomaticallyCheckUpdates()) if (VApplication::IsGUIMode() && VAbstractApplication::VApp()->Settings()->IsAutomaticallyCheckUpdates())
{ {

View File

@ -42,6 +42,7 @@
#include <QMessageBox> #include <QMessageBox>
#include <QProcess> #include <QProcess>
#include <QProgressBar> #include <QProgressBar>
#include <QScopeGuard>
#include <QScrollBar> #include <QScrollBar>
#include <QSettings> #include <QSettings>
#include <QShowEvent> #include <QShowEvent>
@ -202,21 +203,11 @@
#include <QTextCodec> #include <QTextCodec>
#endif #endif
#if QT_VERSION < QT_VERSION_CHECK(5, 7, 0)
#include "../vmisc/backport/qoverload.h"
#endif // QT_VERSION < QT_VERSION_CHECK(5, 7, 0)
#if QT_VERSION < QT_VERSION_CHECK(5, 12, 0)
#include "../vmisc/backport/qscopeguard.h"
#else
#include <QScopeGuard>
#endif
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) #if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
#include <QSourceLocation> #include <QSourceLocation>
#endif #endif
#if defined(Q_OS_WIN32) && QT_VERSION < QT_VERSION_CHECK(6, 0, 0) && QT_VERSION >= QT_VERSION_CHECK(5, 7, 0) #if defined(Q_OS_WIN32) && QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
#include <QWinTaskbarButton> #include <QWinTaskbarButton>
#include <QWinTaskbarProgress> #include <QWinTaskbarProgress>
#endif #endif
@ -226,16 +217,7 @@
#include <QMimeData> #include <QMimeData>
#endif // defined(Q_OS_MAC) #endif // defined(Q_OS_MAC)
#if (defined(Q_CC_GNU) && Q_CC_GNU < 409) && !defined(Q_CC_CLANG)
// DO NOT WORK WITH GCC 4.8
#else
#if __cplusplus >= 201402L
using namespace std::chrono_literals; using namespace std::chrono_literals;
#else
#include "../vmisc/bpstd/chrono.hpp"
using namespace bpstd::literals::chrono_literals;
#endif // __cplusplus >= 201402L
#endif //(defined(Q_CC_GNU) && Q_CC_GNU < 409) && !defined(Q_CC_CLANG)
#if QT_VERSION < QT_VERSION_CHECK(6, 4, 0) #if QT_VERSION < QT_VERSION_CHECK(6, 4, 0)
#include "../vmisc/compatibility.h" #include "../vmisc/compatibility.h"
@ -403,7 +385,7 @@ MainWindow::MainWindow(QWidget *parent)
connect(ui->actionExportFontCorrections, &QAction::triggered, this, &MainWindow::ActionExportFontCorrections); connect(ui->actionExportFontCorrections, &QAction::triggered, this, &MainWindow::ActionExportFontCorrections);
m_progressBar->setVisible(false); m_progressBar->setVisible(false);
#if defined(Q_OS_WIN32) && QT_VERSION < QT_VERSION_CHECK(6, 0, 0) && QT_VERSION >= QT_VERSION_CHECK(5, 7, 0) #if defined(Q_OS_WIN32) && QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
m_taskbarProgress->setVisible(false); m_taskbarProgress->setVisible(false);
#endif #endif
m_statusLabel->setText(tr("Create new pattern piece to start working.")); m_statusLabel->setText(tr("Create new pattern piece to start working."));
@ -531,7 +513,7 @@ MainWindow::MainWindow(QWidget *parent)
if (VApplication::IsGUIMode()) if (VApplication::IsGUIMode())
{ {
QTimer::singleShot(V_SECONDS(1), this, &MainWindow::AskDefaultSettings); QTimer::singleShot(1s, this, &MainWindow::AskDefaultSettings);
} }
ui->actionExportFontCorrections->setEnabled(settings->GetSingleStrokeOutlineFont()); ui->actionExportFontCorrections->setEnabled(settings->GetSingleStrokeOutlineFont());
@ -1829,7 +1811,7 @@ void MainWindow::showEvent(QShowEvent *event)
return; return;
} }
#if defined(Q_OS_WIN32) && QT_VERSION < QT_VERSION_CHECK(6, 0, 0) && QT_VERSION >= QT_VERSION_CHECK(5, 7, 0) #if defined(Q_OS_WIN32) && QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
m_taskbarButton->setWindow(windowHandle()); m_taskbarButton->setWindow(windowHandle());
#endif #endif
@ -1894,15 +1876,6 @@ void MainWindow::changeEvent(QEvent *event)
*/ */
void MainWindow::closeEvent(QCloseEvent *event) void MainWindow::closeEvent(QCloseEvent *event)
{ {
#if defined(Q_OS_MAC) && QT_VERSION < QT_VERSION_CHECK(5, 11, 1)
// Workaround for Qt bug https://bugreports.qt.io/browse/QTBUG-43344
static int numCalled = 0;
if (numCalled++ >= 1)
{
return;
}
#endif
qCDebug(vMainWindow, "Closing main window"); qCDebug(vMainWindow, "Closing main window");
if (MaybeSave()) if (MaybeSave())
{ {
@ -2235,7 +2208,7 @@ void MainWindow::MeasurementsChanged(const QString &path)
{ {
m_mChanges = true; m_mChanges = true;
m_mChangesAsked = false; m_mChangesAsked = false;
m_measurementsSyncTimer->start(V_MSECONDS(1500)); m_measurementsSyncTimer->start(1500ms);
} }
else else
{ {
@ -2245,7 +2218,7 @@ void MainWindow::MeasurementsChanged(const QString &path)
{ {
m_mChanges = true; m_mChanges = true;
m_mChangesAsked = false; m_mChangesAsked = false;
m_measurementsSyncTimer->start(V_MSECONDS(1500)); m_measurementsSyncTimer->start(1500ms);
break; break;
} }
@ -4498,7 +4471,7 @@ void MainWindow::Clear()
m_toolOptions->ClearPropertyBrowser(); m_toolOptions->ClearPropertyBrowser();
m_toolOptions->itemClicked(nullptr); m_toolOptions->itemClicked(nullptr);
m_progressBar->setVisible(false); m_progressBar->setVisible(false);
#if defined(Q_OS_WIN32) && QT_VERSION < QT_VERSION_CHECK(6, 0, 0) && QT_VERSION >= QT_VERSION_CHECK(5, 7, 0) #if defined(Q_OS_WIN32) && QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
m_taskbarProgress->setVisible(false); m_taskbarProgress->setVisible(false);
#endif #endif
m_statusLabel->setVisible(true); m_statusLabel->setVisible(true);
@ -4914,7 +4887,7 @@ void MainWindow::ShowProgress()
{ {
const int newValue = m_progressBar->value() + 1; const int newValue = m_progressBar->value() + 1;
m_progressBar->setValue(newValue); m_progressBar->setValue(newValue);
#if defined(Q_OS_WIN32) && QT_VERSION < QT_VERSION_CHECK(6, 0, 0) && QT_VERSION >= QT_VERSION_CHECK(5, 7, 0) #if defined(Q_OS_WIN32) && QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
m_taskbarProgress->setValue(newValue); m_taskbarProgress->setValue(newValue);
#endif #endif
QCoreApplication::processEvents(); QCoreApplication::processEvents();
@ -5393,7 +5366,7 @@ void MainWindow::InitDimensionGradation(int index, const MeasurementDimension_p
int maxWidth = 0; int maxWidth = 0;
for (int i = 0; i < control->count(); ++i) for (int i = 0; i < control->count(); ++i)
{ {
int itemWidth = TextWidth(fontMetrics, control->itemText(i)); int itemWidth = fontMetrics.horizontalAdvance(control->itemText(i));
if (itemWidth > maxWidth) if (itemWidth > maxWidth)
{ {
maxWidth = itemWidth; maxWidth = itemWidth;
@ -6600,7 +6573,7 @@ auto MainWindow::LoadPattern(QString fileName, const QString &customMeasureFile)
m_progressBar->setValue(0); m_progressBar->setValue(0);
const int elements = doc->ElementsToParse(); const int elements = doc->ElementsToParse();
m_progressBar->setMaximum(elements); m_progressBar->setMaximum(elements);
#if defined(Q_OS_WIN32) && QT_VERSION < QT_VERSION_CHECK(6, 0, 0) && QT_VERSION >= QT_VERSION_CHECK(5, 7, 0) #if defined(Q_OS_WIN32) && QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
m_taskbarProgress->setVisible(true); m_taskbarProgress->setVisible(true);
m_taskbarProgress->setMaximum(elements); m_taskbarProgress->setMaximum(elements);
#endif #endif
@ -6608,7 +6581,7 @@ auto MainWindow::LoadPattern(QString fileName, const QString &customMeasureFile)
FullParseFile(); FullParseFile();
m_progressBar->setVisible(false); m_progressBar->setVisible(false);
#if defined(Q_OS_WIN32) && QT_VERSION < QT_VERSION_CHECK(6, 0, 0) && QT_VERSION >= QT_VERSION_CHECK(5, 7, 0) #if defined(Q_OS_WIN32) && QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
m_taskbarProgress->setVisible(false); m_taskbarProgress->setVisible(false);
#endif #endif
m_statusLabel->setVisible(true); m_statusLabel->setVisible(true);
@ -6619,7 +6592,7 @@ auto MainWindow::LoadPattern(QString fileName, const QString &customMeasureFile)
{ {
/* Collect garbage only after successfully parse. This way wrongly accused items have one more time to /* Collect garbage only after successfully parse. This way wrongly accused items have one more time to
* restore a reference. */ * restore a reference. */
QTimer::singleShot(V_MSECONDS(100), Qt::CoarseTimer, this, [this]() { doc->GarbageCollector(true); }); QTimer::singleShot(100ms, Qt::CoarseTimer, this, [this]() { doc->GarbageCollector(true); });
} }
m_patternReadOnly = doc->IsReadOnly(); m_patternReadOnly = doc->IsReadOnly();

View File

@ -71,7 +71,7 @@
#include <QtSvg> #include <QtSvg>
#include <functional> #include <functional>
#if defined(Q_OS_WIN32) && QT_VERSION < QT_VERSION_CHECK(6, 0, 0) && QT_VERSION >= QT_VERSION_CHECK(5, 7, 0) #if defined(Q_OS_WIN32) && QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
#include <QWinTaskbarButton> #include <QWinTaskbarButton>
#include <QWinTaskbarProgress> #include <QWinTaskbarProgress>
#endif #endif
@ -134,14 +134,14 @@ MainWindowsNoGUI::MainWindowsNoGUI(QWidget *parent)
: VAbstractMainWindow(parent), : VAbstractMainWindow(parent),
pattern(new VContainer(VAbstractApplication::VApp()->TrVars(), VAbstractValApplication::VApp()->patternUnitsP(), pattern(new VContainer(VAbstractApplication::VApp()->TrVars(), VAbstractValApplication::VApp()->patternUnitsP(),
valentinaNamespace)) valentinaNamespace))
#if defined(Q_OS_WIN32) && QT_VERSION < QT_VERSION_CHECK(6, 0, 0) && QT_VERSION >= QT_VERSION_CHECK(5, 7, 0) #if defined(Q_OS_WIN32) && QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
, ,
m_taskbarButton(new QWinTaskbarButton(this)) m_taskbarButton(new QWinTaskbarButton(this))
#endif #endif
{ {
InitTempLayoutScene(); InitTempLayoutScene();
#if defined(Q_OS_WIN32) && QT_VERSION < QT_VERSION_CHECK(6, 0, 0) && QT_VERSION >= QT_VERSION_CHECK(5, 7, 0) #if defined(Q_OS_WIN32) && QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
m_taskbarButton->setWindow(this->windowHandle()); m_taskbarButton->setWindow(this->windowHandle());
m_taskbarProgress = m_taskbarButton->progress(); m_taskbarProgress = m_taskbarButton->progress();
m_taskbarProgress->setMinimum(0); m_taskbarProgress->setMinimum(0);
@ -193,14 +193,14 @@ auto MainWindowsNoGUI::GenerateLayout(VLayoutGenerator &lGenerator) -> bool
QElapsedTimer timer; QElapsedTimer timer;
timer.start(); timer.start();
#if defined(Q_OS_WIN32) && QT_VERSION < QT_VERSION_CHECK(6, 0, 0) && QT_VERSION >= QT_VERSION_CHECK(5, 7, 0) #if defined(Q_OS_WIN32) && QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
QTimer *progressTimer = nullptr; QTimer *progressTimer = nullptr;
#endif #endif
QSharedPointer<DialogLayoutProgress> progress; QSharedPointer<DialogLayoutProgress> progress;
if (VApplication::IsGUIMode()) if (VApplication::IsGUIMode())
{ {
#if defined(Q_OS_WIN32) && QT_VERSION < QT_VERSION_CHECK(6, 0, 0) && QT_VERSION >= QT_VERSION_CHECK(5, 7, 0) #if defined(Q_OS_WIN32) && QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
m_taskbarProgress->setVisible(true); m_taskbarProgress->setVisible(true);
m_taskbarProgress->setValue(0); m_taskbarProgress->setValue(0);
m_taskbarProgress->setMaximum(lGenerator.GetNestingTime() * 60); m_taskbarProgress->setMaximum(lGenerator.GetNestingTime() * 60);
@ -419,7 +419,7 @@ auto MainWindowsNoGUI::GenerateLayout(VLayoutGenerator &lGenerator) -> bool
progress->Finished(); progress->Finished();
} }
#if defined(Q_OS_WIN32) && QT_VERSION < QT_VERSION_CHECK(6, 0, 0) && QT_VERSION >= QT_VERSION_CHECK(5, 7, 0) #if defined(Q_OS_WIN32) && QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
if (VApplication::IsGUIMode()) if (VApplication::IsGUIMode())
{ {
progressTimer->stop(); progressTimer->stop();

View File

@ -46,7 +46,7 @@ struct PosterData;
class QGraphicsRectItem; class QGraphicsRectItem;
class VMeasurements; class VMeasurements;
#if defined(Q_OS_WIN) && QT_VERSION < QT_VERSION_CHECK(6, 0, 0) && QT_VERSION >= QT_VERSION_CHECK(5, 7, 0) #if defined(Q_OS_WIN) && QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
class QWinTaskbarButton; class QWinTaskbarButton;
class QWinTaskbarProgress; class QWinTaskbarProgress;
#endif #endif
@ -127,7 +127,7 @@ protected:
QSharedPointer<DialogSaveLayout> m_dialogSaveLayout{}; // NOLINT(misc-non-private-member-variables-in-classes) QSharedPointer<DialogSaveLayout> m_dialogSaveLayout{}; // NOLINT(misc-non-private-member-variables-in-classes)
#if defined(Q_OS_WIN) && QT_VERSION < QT_VERSION_CHECK(6, 0, 0) && QT_VERSION >= QT_VERSION_CHECK(5, 7, 0) #if defined(Q_OS_WIN) && QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
QWinTaskbarButton *m_taskbarButton; // NOLINT(misc-non-private-member-variables-in-classes) QWinTaskbarButton *m_taskbarButton; // NOLINT(misc-non-private-member-variables-in-classes)
QWinTaskbarProgress *m_taskbarProgress{nullptr}; // NOLINT(misc-non-private-member-variables-in-classes) QWinTaskbarProgress *m_taskbarProgress{nullptr}; // NOLINT(misc-non-private-member-variables-in-classes)
#endif #endif

View File

@ -377,45 +377,18 @@ win32:*g++* {
package.files += $$[QT_INSTALL_BINS]/Qt5WinExtras.dll package.files += $$[QT_INSTALL_BINS]/Qt5WinExtras.dll
} }
greaterThan(QT_MAJOR_VERSION, 4):greaterThan(QT_MINOR_VERSION, 10) { package.files += \
versionAtLeast(QT_VERSION, 5.12.4){ $$PWD/../../../dist/win/msvcr120.dll
# Minimal supported OpenSSL version since Qt 5.12.4 is 1.1.1.
contains(QMAKE_HOST.arch, x86_64) {
package.files += \
$$PWD/../../../dist/win/openssl/win64/libcrypto-1_1-x64.dll \
$$PWD/../../../dist/win/openssl/win64/libssl-1_1-x64.dll
} else {
package.files += \
$$PWD/../../../dist/win/openssl/win32/libcrypto-1_1.dll \
$$PWD/../../../dist/win/openssl/win32/libssl-1_1.dll
}
} else {
package.files += \
$$PWD/../../../dist/win/msvcr120.dll \
contains(QMAKE_HOST.arch, x86_64) { # Minimal supported OpenSSL version since Qt 5.12.4 is 1.1.1.
package.files += \ contains(QMAKE_HOST.arch, x86_64) {
$$PWD/../../../dist/win/openssl/win64/libeay32.dll \ package.files += \
$$PWD/../../../dist/win/openssl/win64/ssleay32.dll $$PWD/../../../dist/win/openssl/win64/libcrypto-1_1-x64.dll \
} else { $$PWD/../../../dist/win/openssl/win64/libssl-1_1-x64.dll
package.files += \
$$PWD/../../../dist/win/openssl/win32/libeay32.dll \
$$PWD/../../../dist/win/openssl/win32/ssleay32.dll
}
}
} else { } else {
package.files += \ package.files += \
$$PWD/../../../dist/win/msvcr120.dll \ $$PWD/../../../dist/win/openssl/win32/libcrypto-1_1.dll \
$$PWD/../../../dist/win/openssl/win32/libssl-1_1.dll
contains(QMAKE_HOST.arch, x86_64) {
package.files += \
$$PWD/../../../dist/win/openssl/win64/libeay32.dll \
$$PWD/../../../dist/win/openssl/win64/ssleay32.dll
} else {
package.files += \
$$PWD/../../../dist/win/openssl/win32/libeay32.dll \
$$PWD/../../../dist/win/openssl/win32/ssleay32.dll
}
} }
package.CONFIG = no_check_exist package.CONFIG = no_check_exist

View File

@ -103,16 +103,11 @@
#include "../vtools/tools/vtooluniondetails.h" #include "../vtools/tools/vtooluniondetails.h"
#include "../vwidgets/vabstractmainwindow.h" #include "../vwidgets/vabstractmainwindow.h"
#if QT_VERSION < QT_VERSION_CHECK(5, 12, 0)
#include "../vmisc/backport/qscopeguard.h"
#else
#include <QScopeGuard>
#endif
#include <QDebug> #include <QDebug>
#include <QFileInfo> #include <QFileInfo>
#include <QFuture> #include <QFuture>
#include <QMessageBox> #include <QMessageBox>
#include <QScopeGuard>
#include <QTimer> #include <QTimer>
#include <QUndoStack> #include <QUndoStack>
#include <QtConcurrentMap> #include <QtConcurrentMap>
@ -121,16 +116,7 @@
#include <chrono> #include <chrono>
#include <functional> #include <functional>
#if (defined(Q_CC_GNU) && Q_CC_GNU < 409) && !defined(Q_CC_CLANG)
// DO NOT WORK WITH GCC 4.8
#else
#if __cplusplus >= 201402L
using namespace std::chrono_literals; using namespace std::chrono_literals;
#else
#include "../vmisc/bpstd/chrono.hpp"
using namespace bpstd::literals::chrono_literals;
#endif // __cplusplus >= 201402L
#endif //(defined(Q_CC_GNU) && Q_CC_GNU < 409) && !defined(Q_CC_CLANG)
using namespace Qt::Literals::StringLiterals; using namespace Qt::Literals::StringLiterals;
@ -291,7 +277,7 @@ void VPattern::Parse(const Document &parse)
if (VApplication::IsGUIMode()) if (VApplication::IsGUIMode())
{ {
QTimer::singleShot(V_SECONDS(1), Qt::VeryCoarseTimer, this, &VPattern::RefreshPieceGeometry); QTimer::singleShot(1s, Qt::VeryCoarseTimer, this, &VPattern::RefreshPieceGeometry);
} }
else if (VApplication::CommandLine()->IsTestModeEnabled()) else if (VApplication::CommandLine()->IsTestModeEnabled())
{ {

View File

@ -28,10 +28,6 @@
#include <QUrl> #include <QUrl>
#include <QtGlobal> #include <QtGlobal>
#if QT_VERSION < QT_VERSION_CHECK(5, 13, 0)
#include "../vmisc/defglobal.h"
#endif
class FvAvailableUpdate final : public QObject class FvAvailableUpdate final : public QObject
{ {
Q_OBJECT // NOLINT Q_OBJECT // NOLINT

View File

@ -28,10 +28,6 @@
#include <QString> #include <QString>
#include <QtGlobal> #include <QtGlobal>
#if QT_VERSION < QT_VERSION_CHECK(5, 13, 0)
#include "../vmisc/defglobal.h"
#endif
class QGraphicsScene; class QGraphicsScene;
namespace Ui namespace Ui

View File

@ -457,11 +457,7 @@ auto LocaleSign0(const QLocale &locale) -> QChar
const QString sign = locale.toString(0); const QString sign = locale.toString(0);
if (sign.size() == 1) if (sign.size() == 1)
{ {
#if QT_VERSION >= QT_VERSION_CHECK(5, 10, 0)
return sign.front(); return sign.front();
#else
return sign.at(0);
#endif
} }
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) #if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
@ -477,11 +473,7 @@ auto LocaleSign1(const QLocale &locale) -> QChar
const QString sign = locale.toString(1); const QString sign = locale.toString(1);
if (sign.size() == 1) if (sign.size() == 1)
{ {
#if QT_VERSION >= QT_VERSION_CHECK(5, 10, 0)
return sign.front(); return sign.front();
#else
return sign.at(0);
#endif
} }
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) #if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
@ -497,11 +489,7 @@ auto LocaleSign2(const QLocale &locale) -> QChar
const QString sign = locale.toString(2); const QString sign = locale.toString(2);
if (sign.size() == 1) if (sign.size() == 1)
{ {
#if QT_VERSION >= QT_VERSION_CHECK(5, 10, 0)
return sign.front(); return sign.front();
#else
return sign.at(0);
#endif
} }
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) #if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
@ -517,11 +505,7 @@ auto LocaleSign3(const QLocale &locale) -> QChar
const QString sign = locale.toString(3); const QString sign = locale.toString(3);
if (sign.size() == 1) if (sign.size() == 1)
{ {
#if QT_VERSION >= QT_VERSION_CHECK(5, 10, 0)
return sign.front(); return sign.front();
#else
return sign.at(0);
#endif
} }
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) #if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
@ -537,11 +521,7 @@ auto LocaleSign4(const QLocale &locale) -> QChar
const QString sign = locale.toString(4); const QString sign = locale.toString(4);
if (sign.size() == 1) if (sign.size() == 1)
{ {
#if QT_VERSION >= QT_VERSION_CHECK(5, 10, 0)
return sign.front(); return sign.front();
#else
return sign.at(0);
#endif
} }
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) #if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
@ -557,11 +537,7 @@ auto LocaleSign5(const QLocale &locale) -> QChar
const QString sign = locale.toString(5); const QString sign = locale.toString(5);
if (sign.size() == 1) if (sign.size() == 1)
{ {
#if QT_VERSION >= QT_VERSION_CHECK(5, 10, 0)
return sign.front(); return sign.front();
#else
return sign.at(0);
#endif
} }
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) #if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
@ -577,11 +553,7 @@ auto LocaleSign6(const QLocale &locale) -> QChar
const QString sign = locale.toString(6); const QString sign = locale.toString(6);
if (sign.size() == 1) if (sign.size() == 1)
{ {
#if QT_VERSION >= QT_VERSION_CHECK(5, 10, 0)
return sign.front(); return sign.front();
#else
return sign.at(0);
#endif
} }
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) #if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
@ -597,11 +569,7 @@ auto LocaleSign7(const QLocale &locale) -> QChar
const QString sign = locale.toString(7); const QString sign = locale.toString(7);
if (sign.size() == 1) if (sign.size() == 1)
{ {
#if QT_VERSION >= QT_VERSION_CHECK(5, 10, 0)
return sign.front(); return sign.front();
#else
return sign.at(0);
#endif
} }
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) #if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
@ -617,11 +585,7 @@ auto LocaleSign8(const QLocale &locale) -> QChar
const QString sign = locale.toString(8); const QString sign = locale.toString(8);
if (sign.size() == 1) if (sign.size() == 1)
{ {
#if QT_VERSION >= QT_VERSION_CHECK(5, 10, 0)
return sign.front(); return sign.front();
#else
return sign.at(0);
#endif
} }
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) #if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
@ -637,11 +601,7 @@ auto LocaleSign9(const QLocale &locale) -> QChar
const QString sign = locale.toString(9); const QString sign = locale.toString(9);
if (sign.size() == 1) if (sign.size() == 1)
{ {
#if QT_VERSION >= QT_VERSION_CHECK(5, 10, 0)
return sign.front(); return sign.front();
#else
return sign.at(0);
#endif
} }
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) #if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)

View File

@ -25,13 +25,6 @@
#include "qmuparser_global.h" #include "qmuparser_global.h"
#include "qmuparserdef.h" #include "qmuparserdef.h"
#if QT_VERSION < QT_VERSION_CHECK(5, 13, 0)
#define Q_DISABLE_COPY_MOVE(Class) \
Q_DISABLE_COPY(Class) \
Class(Class &&) = delete; \
Class &operator=(Class &&) = delete;
#endif
#ifndef Q_DISABLE_ASSIGN #ifndef Q_DISABLE_ASSIGN
#define Q_DISABLE_ASSIGN(Class) Class &operator=(const Class &) = delete; #define Q_DISABLE_ASSIGN(Class) Class &operator=(const Class &) = delete;
#endif #endif

View File

@ -23,15 +23,15 @@
#include <QCoreApplication> #include <QCoreApplication>
#include <QLineF> #include <QLineF>
#include <QtDebug>
#include <QtGlobal> #include <QtGlobal>
#include <QtMath>
#include <sstream> #include <sstream>
#include <string> #include <string>
#include <QtDebug>
#include <QtMath>
#include "qmuparsererror.h"
#include "../vmisc/defglobal.h" #include "../vmisc/defglobal.h"
#include "qmudef.h" #include "qmudef.h"
#include "qmuparsererror.h"
/** /**
* @file * @file
@ -64,13 +64,13 @@ auto CSR(qreal length, qreal split, qreal arcLength) -> qreal
const QLineF line(QPointF(0, 0), QPointF(0, length)); const QLineF line(QPointF(0, 0), QPointF(0, length));
QLineF tmp = line; QLineF tmp = line;
tmp.setAngle(tmp.angle()+90.0*sign); tmp.setAngle(tmp.angle() + 90.0 * sign);
tmp.setLength(split); tmp.setLength(split);
QPointF p1 = tmp.p2(); QPointF p1 = tmp.p2();
tmp = QLineF(QPointF(0, length), QPointF(0, 0)); tmp = QLineF(QPointF(0, length), QPointF(0, 0));
tmp.setAngle(tmp.angle()-90.0*sign); tmp.setAngle(tmp.angle() - 90.0 * sign);
tmp.setLength(split); tmp.setLength(split);
QPointF p2 = tmp.p2(); QPointF p2 = tmp.p2();
@ -83,11 +83,11 @@ auto CSR(qreal length, qreal split, qreal arcLength) -> qreal
{ {
if (arcL > arcLength) if (arcL > arcLength)
{ {
angle = angle - angle/2.0; angle = angle - angle / 2.0;
} }
else if (arcL < arcLength) else if (arcL < arcLength)
{ {
angle = angle + angle/2.0; angle = angle + angle / 2.0;
} }
else else
{ {
@ -100,28 +100,23 @@ auto CSR(qreal length, qreal split, qreal arcLength) -> qreal
} }
tmp = line2; tmp = line2;
tmp.setAngle(tmp.angle()+angle*sign); tmp.setAngle(tmp.angle() + angle * sign);
QPointF crosPoint; QPointF crosPoint;
#if QT_VERSION >= QT_VERSION_CHECK(5, 14, 0)
const auto type = line.intersects(tmp, &crosPoint); const auto type = line.intersects(tmp, &crosPoint);
#else
const auto type = line.intersect(tmp, &crosPoint);
#endif
if (type == QLineF::NoIntersection) if (type == QLineF::NoIntersection)
{ {
return 0; return 0;
} }
QLineF radius(crosPoint, tmp.p2()); QLineF radius(crosPoint, tmp.p2());
const qreal arcAngle = sign > 0 ? line.angleTo(radius): radius.angleTo(line); const qreal arcAngle = sign > 0 ? line.angleTo(radius) : radius.angleTo(line);
arcL = (M_PI*radius.length())/180.0 * arcAngle; arcL = (M_PI * radius.length()) / 180.0 * arcAngle;
} } while (qAbs(arcL - arcLength) > (0.5 /*mm*/ / 25.4) * PrintDPI);
while(qAbs(arcL - arcLength) > (0.5/*mm*/ / 25.4) * PrintDPI);
return angle; return angle;
} }
} } // namespace
/** /**
* @brief Namespace for mathematical applications. * @brief Namespace for mathematical applications.
@ -132,13 +127,13 @@ namespace qmu
// Trigonometric function // Trigonometric function
auto QmuParser::DegreeToRadian(qreal deg) -> qreal auto QmuParser::DegreeToRadian(qreal deg) -> qreal
{ {
return qDegreesToRadians(deg); return qDegreesToRadians(deg);
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
auto QmuParser::RadianToDegree(qreal rad) -> qreal auto QmuParser::RadianToDegree(qreal rad) -> qreal
{ {
return qRadiansToDegrees(rad); return qRadiansToDegrees(rad);
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
@ -221,12 +216,12 @@ auto QmuParser::ATanD(qreal v) -> qreal
auto QmuParser::Log2(qreal v) -> qreal auto QmuParser::Log2(qreal v) -> qreal
{ {
#ifdef MUP_MATH_EXCEPTIONS #ifdef MUP_MATH_EXCEPTIONS
if (v<=0) if (v <= 0)
{ {
throw QmuParserError(ecDOMAIN_ERROR, "Log2"); throw QmuParserError(ecDOMAIN_ERROR, "Log2");
} }
#endif #endif
return log(v)/log(2.0); return log(v) / log(2.0);
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
@ -234,7 +229,7 @@ auto QmuParser::Log2(qreal v) -> qreal
auto QmuParser::Log10(qreal v) -> qreal auto QmuParser::Log10(qreal v) -> qreal
{ {
#ifdef MUP_MATH_EXCEPTIONS #ifdef MUP_MATH_EXCEPTIONS
if (v<=0) if (v <= 0)
{ {
throw QmuParserError(ecDOMAIN_ERROR, "Log10"); throw QmuParserError(ecDOMAIN_ERROR, "Log10");
} }
@ -258,7 +253,7 @@ auto QmuParser::Rint(qreal v) -> qreal
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
auto QmuParser::R2CM(qreal v) -> qreal auto QmuParser::R2CM(qreal v) -> qreal
{ {
return Rint(v*10.0)/10.0; return Rint(v * 10.0) / 10.0;
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
@ -284,7 +279,7 @@ auto QmuParser::CSRInch(qreal length, qreal split, qreal arcLength) -> qreal
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
auto QmuParser::Sign(qreal v) -> qreal auto QmuParser::Sign(qreal v) -> qreal
{ {
return ((v<0) ? -1 : (v>0) ? 1 : 0); return ((v < 0) ? -1 : (v > 0) ? 1 : 0);
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
@ -303,11 +298,11 @@ auto QmuParser::Sum(const qreal *a_afArg, qmusizetype a_iArgc) -> qreal
{ {
if (a_iArgc == 0) if (a_iArgc == 0)
{ {
throw QmuParserError(QCoreApplication::translate("QmuParser", "too few arguments for function sum.", throw QmuParserError(
"parser error message")); QCoreApplication::translate("QmuParser", "too few arguments for function sum.", "parser error message"));
} }
qreal fRes=0; qreal fRes = 0;
for (int i=0; i<a_iArgc; ++i) for (int i = 0; i < a_iArgc; ++i)
{ {
fRes += a_afArg[i]; fRes += a_afArg[i];
} }
@ -324,15 +319,15 @@ auto QmuParser::Avg(const qreal *a_afArg, qmusizetype a_iArgc) -> qreal
{ {
if (a_iArgc == 0) if (a_iArgc == 0)
{ {
throw QmuParserError(QCoreApplication::translate("QmuParser", "too few arguments for function sum.", throw QmuParserError(
"parser error message")); QCoreApplication::translate("QmuParser", "too few arguments for function sum.", "parser error message"));
} }
qreal fRes=0; qreal fRes = 0;
for (int i=0; i<a_iArgc; ++i) for (int i = 0; i < a_iArgc; ++i)
{ {
fRes += a_afArg[i]; fRes += a_afArg[i];
} }
return fRes/static_cast<qreal>(a_iArgc); return fRes / static_cast<qreal>(a_iArgc);
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
@ -345,11 +340,11 @@ auto QmuParser::Min(const qreal *a_afArg, qmusizetype a_iArgc) -> qreal
{ {
if (a_iArgc == 0) if (a_iArgc == 0)
{ {
throw QmuParserError(QCoreApplication::translate("QmuParser", "too few arguments for function min.", throw QmuParserError(
"parser error message")); QCoreApplication::translate("QmuParser", "too few arguments for function min.", "parser error message"));
} }
qreal fRes=a_afArg[0]; qreal fRes = a_afArg[0];
for (int i=0; i<a_iArgc; ++i) for (int i = 0; i < a_iArgc; ++i)
{ {
fRes = qMin(fRes, a_afArg[i]); fRes = qMin(fRes, a_afArg[i]);
} }
@ -366,11 +361,11 @@ auto QmuParser::Max(const qreal *a_afArg, qmusizetype a_iArgc) -> qreal
{ {
if (a_iArgc == 0) if (a_iArgc == 0)
{ {
throw QmuParserError(QCoreApplication::translate("QmuParser", "too few arguments for function min.", throw QmuParserError(
"parser error message")); QCoreApplication::translate("QmuParser", "too few arguments for function min.", "parser error message"));
} }
qreal fRes=a_afArg[0]; qreal fRes = a_afArg[0];
for (int i=0; i<a_iArgc; ++i) for (int i = 0; i < a_iArgc; ++i)
{ {
fRes = qMax(fRes, a_afArg[i]); fRes = qMax(fRes, a_afArg[i]);
} }
@ -379,19 +374,19 @@ auto QmuParser::Max(const qreal *a_afArg, qmusizetype a_iArgc) -> qreal
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/** /**
* @brief Default value recognition callback. * @brief Default value recognition callback.
* @param [in] a_szExpr Pointer to the expression * @param [in] a_szExpr Pointer to the expression
* @param [in, out] a_iPos Pointer to an index storing the current position within the expression * @param [in, out] a_iPos Pointer to an index storing the current position within the expression
* @param [out] a_fVal Pointer where the value should be stored in case one is found. * @param [out] a_fVal Pointer where the value should be stored in case one is found.
* @return 1 if a value was found 0 otherwise. * @return 1 if a value was found 0 otherwise.
*/ */
auto QmuParser::IsVal(const QString &a_szExpr, qmusizetype *a_iPos, qreal *a_fVal, const QLocale &locale, bool cNumbers, auto QmuParser::IsVal(const QString &a_szExpr, qmusizetype *a_iPos, qreal *a_fVal, const QLocale &locale, bool cNumbers,
const QChar &decimal, const QChar &thousand) -> int const QChar &decimal, const QChar &thousand) -> int
{ {
qreal fVal(0); qreal fVal(0);
qmusizetype pos = ReadVal(a_szExpr, fVal, locale != QLocale::c() && cNumbers ? QLocale::c() : locale, decimal, qmusizetype pos =
thousand); ReadVal(a_szExpr, fVal, locale != QLocale::c() && cNumbers ? QLocale::c() : locale, decimal, thousand);
if (pos == -1) if (pos == -1)
{ {
@ -409,7 +404,8 @@ auto QmuParser::IsVal(const QString &a_szExpr, qmusizetype *a_iPos, qreal *a_fVa
* *
* Call QmuParserBase class constructor and trigger Function, Operator and Constant initialization. * Call QmuParserBase class constructor and trigger Function, Operator and Constant initialization.
*/ */
QmuParser::QmuParser():QmuParserBase() QmuParser::QmuParser()
: QmuParserBase()
{ {
AddValIdent(IsVal); AddValIdent(IsVal);
@ -426,9 +422,9 @@ QmuParser::QmuParser():QmuParserBase()
*/ */
void QmuParser::InitCharSets() void QmuParser::InitCharSets()
{ {
DefineNameChars( QStringLiteral("0123456789_abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ") ); DefineNameChars(QStringLiteral("0123456789_abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"));
DefineOprtChars( QStringLiteral("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ+-*^/?<>=#!$%&|~'_{}") ); DefineOprtChars(QStringLiteral("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ+-*^/?<>=#!$%&|~'_{}"));
DefineInfixOprtChars( QStringLiteral("/+-*^?<>=#!$%&|~'_") ); DefineInfixOprtChars(QStringLiteral("/+-*^?<>=#!$%&|~'_"));
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
@ -438,76 +434,76 @@ void QmuParser::InitCharSets()
void QmuParser::InitFun() void QmuParser::InitFun()
{ {
// trigonometric helper functions // trigonometric helper functions
DefineFun(QStringLiteral("degTorad"), DegreeToRadian); DefineFun(QStringLiteral("degTorad"), DegreeToRadian);
DefineFun(QStringLiteral("radTodeg"), RadianToDegree); DefineFun(QStringLiteral("radTodeg"), RadianToDegree);
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) #if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
#define QSIN_FUN qSin<qreal> #define QSIN_FUN qSin<qreal>
#define QCOS_FUN qCos<qreal> #define QCOS_FUN qCos<qreal>
#define QTAN_FUN qTan<qreal> #define QTAN_FUN qTan<qreal>
#define QASIN_FUN qAsin<qreal> #define QASIN_FUN qAsin<qreal>
#define QACOS_FUN qAcos<qreal> #define QACOS_FUN qAcos<qreal>
#define QATAN_FUN qAtan<qreal> #define QATAN_FUN qAtan<qreal>
#define QATAN2_FUN qAtan2<qreal, qreal> #define QATAN2_FUN qAtan2<qreal, qreal>
#define QLN_FUN qLn<qreal> #define QLN_FUN qLn<qreal>
#define QEXP_FUN qExp<qreal> #define QEXP_FUN qExp<qreal>
#define QSQRT_FUN qSqrt<qreal> #define QSQRT_FUN qSqrt<qreal>
#else #else
#define QSIN_FUN qSin #define QSIN_FUN qSin
#define QCOS_FUN qCos #define QCOS_FUN qCos
#define QTAN_FUN qTan #define QTAN_FUN qTan
#define QASIN_FUN qAsin #define QASIN_FUN qAsin
#define QACOS_FUN qAcos #define QACOS_FUN qAcos
#define QATAN_FUN qAtan #define QATAN_FUN qAtan
#define QATAN2_FUN qAtan2 #define QATAN2_FUN qAtan2
#define QLN_FUN qLn #define QLN_FUN qLn
#define QEXP_FUN qExp #define QEXP_FUN qExp
#define QSQRT_FUN qSqrt #define QSQRT_FUN qSqrt
#endif #endif
// trigonometric functions // trigonometric functions
DefineFun(QStringLiteral("sin"), QSIN_FUN); DefineFun(QStringLiteral("sin"), QSIN_FUN);
DefineFun(QStringLiteral("cos"), QCOS_FUN); DefineFun(QStringLiteral("cos"), QCOS_FUN);
DefineFun(QStringLiteral("tan"), QTAN_FUN); DefineFun(QStringLiteral("tan"), QTAN_FUN);
DefineFun(QStringLiteral("sinD"), SinD); DefineFun(QStringLiteral("sinD"), SinD);
DefineFun(QStringLiteral("cosD"), CosD); DefineFun(QStringLiteral("cosD"), CosD);
DefineFun(QStringLiteral("tanD"), TanD); DefineFun(QStringLiteral("tanD"), TanD);
// arcus functions // arcus functions
DefineFun(QStringLiteral("asin"), QASIN_FUN); DefineFun(QStringLiteral("asin"), QASIN_FUN);
DefineFun(QStringLiteral("acos"), QACOS_FUN); DefineFun(QStringLiteral("acos"), QACOS_FUN);
DefineFun(QStringLiteral("atan"), QATAN_FUN); DefineFun(QStringLiteral("atan"), QATAN_FUN);
DefineFun(QStringLiteral("atan2"), QATAN2_FUN); DefineFun(QStringLiteral("atan2"), QATAN2_FUN);
DefineFun(QStringLiteral("asinD"), ASinD); DefineFun(QStringLiteral("asinD"), ASinD);
DefineFun(QStringLiteral("acosD"), ACosD); DefineFun(QStringLiteral("acosD"), ACosD);
DefineFun(QStringLiteral("atanD"), ATanD); DefineFun(QStringLiteral("atanD"), ATanD);
// hyperbolic functions // hyperbolic functions
DefineFun(QStringLiteral("sinh"), Sinh); DefineFun(QStringLiteral("sinh"), Sinh);
DefineFun(QStringLiteral("cosh"), Cosh); DefineFun(QStringLiteral("cosh"), Cosh);
DefineFun(QStringLiteral("tanh"), Tanh); DefineFun(QStringLiteral("tanh"), Tanh);
// arcus hyperbolic functions // arcus hyperbolic functions
DefineFun(QStringLiteral("asinh"), ASinh); DefineFun(QStringLiteral("asinh"), ASinh);
DefineFun(QStringLiteral("acosh"), ACosh); DefineFun(QStringLiteral("acosh"), ACosh);
DefineFun(QStringLiteral("atanh"), ATanh); DefineFun(QStringLiteral("atanh"), ATanh);
// Logarithm functions // Logarithm functions
DefineFun(QStringLiteral("log2"), Log2); DefineFun(QStringLiteral("log2"), Log2);
DefineFun(QStringLiteral("log10"), Log10); DefineFun(QStringLiteral("log10"), Log10);
DefineFun(QStringLiteral("log"), Log10); DefineFun(QStringLiteral("log"), Log10);
DefineFun(QStringLiteral("ln"), QLN_FUN); DefineFun(QStringLiteral("ln"), QLN_FUN);
// misc // misc
DefineFun(QStringLiteral("exp"), QEXP_FUN); DefineFun(QStringLiteral("exp"), QEXP_FUN);
DefineFun(QStringLiteral("sqrt"), QSQRT_FUN); DefineFun(QStringLiteral("sqrt"), QSQRT_FUN);
DefineFun(QStringLiteral("sign"), Sign); DefineFun(QStringLiteral("sign"), Sign);
DefineFun(QStringLiteral("rint"), Rint); DefineFun(QStringLiteral("rint"), Rint);
DefineFun(QStringLiteral("r2cm"), R2CM); DefineFun(QStringLiteral("r2cm"), R2CM);
DefineFun(QStringLiteral("csrCm"), CSRCm); DefineFun(QStringLiteral("csrCm"), CSRCm);
DefineFun(QStringLiteral("csrInch"), CSRInch); DefineFun(QStringLiteral("csrInch"), CSRInch);
DefineFun(QStringLiteral("abs"), Abs); DefineFun(QStringLiteral("abs"), Abs);
DefineFun(QStringLiteral("fmod"), FMod); DefineFun(QStringLiteral("fmod"), FMod);
// Functions with variable number of arguments // Functions with variable number of arguments
DefineFun(QStringLiteral("sum"), Sum); DefineFun(QStringLiteral("sum"), Sum);
DefineFun(QStringLiteral("avg"), Avg); DefineFun(QStringLiteral("avg"), Avg);
DefineFun(QStringLiteral("min"), Min); DefineFun(QStringLiteral("min"), Min);
DefineFun(QStringLiteral("max"), Max); DefineFun(QStringLiteral("max"), Max);
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
@ -579,10 +575,7 @@ void QmuParser::OnDetectVar(const QString &pExpr, qmusizetype &nStart, qmusizety
// cppcheck-suppress unusedFunction // cppcheck-suppress unusedFunction
auto QmuParser::Diff(qreal *a_Var, qreal a_fPos, qreal a_fEpsilon) const -> qreal auto QmuParser::Diff(qreal *a_Var, qreal a_fPos, qreal a_fEpsilon) const -> qreal
{ {
qreal fRes(0), qreal fRes(0), fBuf(*a_Var), f[4] = {0, 0, 0, 0}, fEpsilon(a_fEpsilon);
fBuf(*a_Var),
f[4] = {0, 0, 0, 0},
fEpsilon(a_fEpsilon);
// Backwards compatible calculation of epsilon inc case the user doesnt provide // Backwards compatible calculation of epsilon inc case the user doesnt provide
// his own epsilon // his own epsilon
@ -591,13 +584,17 @@ auto QmuParser::Diff(qreal *a_Var, qreal a_fPos, qreal a_fEpsilon) const -> qrea
fEpsilon = qFuzzyIsNull(a_fPos) ? static_cast<qreal>(1e-10) : static_cast<qreal>(1e-7) * a_fPos; fEpsilon = qFuzzyIsNull(a_fPos) ? static_cast<qreal>(1e-10) : static_cast<qreal>(1e-7) * a_fPos;
} }
*a_Var = a_fPos+2 * fEpsilon; f[0] = Eval(); *a_Var = a_fPos + 2 * fEpsilon;
*a_Var = a_fPos+1 * fEpsilon; f[1] = Eval(); f[0] = Eval();
*a_Var = a_fPos-1 * fEpsilon; f[2] = Eval(); *a_Var = a_fPos + 1 * fEpsilon;
*a_Var = a_fPos-2 * fEpsilon; f[3] = Eval(); f[1] = Eval();
*a_Var = a_fPos - 1 * fEpsilon;
f[2] = Eval();
*a_Var = a_fPos - 2 * fEpsilon;
f[3] = Eval();
*a_Var = fBuf; // restore variable *a_Var = fBuf; // restore variable
fRes = (-f[0] + 8*f[1] - 8*f[2] + f[3]) / (12*fEpsilon); fRes = (-f[0] + 8 * f[1] - 8 * f[2] + f[3]) / (12 * fEpsilon);
return fRes; return fRes;
} }
} // namespace qmu } // namespace qmu

View File

@ -34,5 +34,5 @@ HEADERS += \
$$PWD/qmuformulabase.h \ $$PWD/qmuformulabase.h \
$$PWD/qmutokenparser.h \ $$PWD/qmutokenparser.h \
$$PWD/qmuparsercallback_p.h \ $$PWD/qmuparsercallback_p.h \
$$PWD/make_unique.h \ $$PWD/make_unique.h
$$PWD/text.h

View File

@ -32,7 +32,6 @@ VDynamicLib {
"qmutokenparser.h", "qmutokenparser.h",
"qmuparsercallback_p.h", "qmuparsercallback_p.h",
"make_unique.h", "make_unique.h",
"text.h"
] ]
cpp.defines: ["QMUPARSER_LIBRARY", 'QMUP_VERSION="' + product.version + '"'] cpp.defines: ["QMUPARSER_LIBRARY", 'QMUP_VERSION="' + product.version + '"']

View File

@ -36,10 +36,6 @@
#include "qmudef.h" #include "qmudef.h"
#if QT_VERSION < QT_VERSION_CHECK(5, 14, 0)
#include "text.h"
#endif
/** /**
* @file * @file
* @brief This file contains the basic implementation of the muparser engine. * @brief This file contains the basic implementation of the muparser engine.

View File

@ -64,34 +64,6 @@
#define __has_cpp_attribute(x) 0 #define __has_cpp_attribute(x) 0
#endif #endif
#if QT_VERSION < QT_VERSION_CHECK(5, 8, 0)
#ifndef QT_HAS_CPP_ATTRIBUTE
#ifdef __has_cpp_attribute
#define QT_HAS_CPP_ATTRIBUTE(x) __has_cpp_attribute(x)
#else
#define QT_HAS_CPP_ATTRIBUTE(x) 0
#endif
#endif // QT_HAS_CPP_ATTRIBUTE
#if defined(__cplusplus)
#if QT_HAS_CPP_ATTRIBUTE(clang::fallthrough)
#define Q_FALLTHROUGH() [[clang::fallthrough]]
#elif QT_HAS_CPP_ATTRIBUTE(gnu::fallthrough)
#define Q_FALLTHROUGH() [[gnu::fallthrough]]
#elif QT_HAS_CPP_ATTRIBUTE(fallthrough)
#define Q_FALLTHROUGH() [[fallthrough]]
#endif
#endif
#ifndef Q_FALLTHROUGH
#if (defined(Q_CC_GNU) && Q_CC_GNU >= 700) && !defined(Q_CC_INTEL)
#define Q_FALLTHROUGH() __attribute__((fallthrough))
#else
#define Q_FALLTHROUGH() (void)0
#endif
#endif // defined(__cplusplus)
#endif // QT_VERSION < QT_VERSION_CHECK(5, 8, 0)
/** @brief If this macro is defined mathematical exceptions (div by zero) will be thrown as exceptions. */ /** @brief If this macro is defined mathematical exceptions (div by zero) will be thrown as exceptions. */
// #define QMUP_MATH_EXCEPTIONS // #define QMUP_MATH_EXCEPTIONS

View File

@ -34,10 +34,6 @@
#include "qmuparserdef.h" #include "qmuparserdef.h"
#include "qmutranslation.h" #include "qmutranslation.h"
#if QT_VERSION < QT_VERSION_CHECK(5, 13, 0)
#include "../vmisc/defglobal.h"
#endif
/** @file /** @file
@brief This file defines the error class used by the parser. @brief This file defines the error class used by the parser.
*/ */

View File

@ -22,17 +22,14 @@
#ifndef QMUPARSERTEST_H #ifndef QMUPARSERTEST_H
#define QMUPARSERTEST_H #define QMUPARSERTEST_H
#include <stdlib.h>
#include <QMetaObject> #include <QMetaObject>
#include <QObject> #include <QObject>
#include <QRandomGenerator>
#include <QString> #include <QString>
#include <QVector> #include <QVector>
#include <QtGlobal> #include <QtGlobal>
#include <locale> #include <locale>
#include <stdlib.h>
#if QT_VERSION >= QT_VERSION_CHECK(5, 10, 0)
# include <QRandomGenerator>
#endif
#include "qmuparser.h" #include "qmuparser.h"
#include "qmuparser_global.h" #include "qmuparser_global.h"
@ -60,8 +57,9 @@ namespace Test
class QMUPARSERSHARED_EXPORT QmuParserTester : public QObject // final class QMUPARSERSHARED_EXPORT QmuParserTester : public QObject // final
{ {
Q_OBJECT // NOLINT Q_OBJECT // NOLINT
public: public:
typedef int ( QmuParserTester::*testfun_type ) (); typedef int (QmuParserTester::*testfun_type)();
explicit QmuParserTester(QObject *parent = nullptr); explicit QmuParserTester(QObject *parent = nullptr);
@ -73,7 +71,7 @@ private:
QVector<testfun_type> m_vTestFun; QVector<testfun_type> m_vTestFun;
static int c_iCount; static int c_iCount;
void AddTest ( testfun_type a_pFun ); void AddTest(testfun_type a_pFun);
// Test Double Parser // Test Double Parser
static auto EqnTest(const QString &a_str, double a_fRes, bool a_fPass) -> int; static auto EqnTest(const QString &a_str, double a_fRes, bool a_fPass) -> int;
@ -133,9 +131,9 @@ private:
static auto FirstArg(const qreal *a_afArg, qmusizetype a_iArgc) -> qreal static auto FirstArg(const qreal *a_afArg, qmusizetype a_iArgc) -> qreal
{ {
if ( a_iArgc == 0) if (a_iArgc == 0)
{ {
throw QmuParserError ( "too few arguments for function FirstArg." ); throw QmuParserError("too few arguments for function FirstArg.");
} }
return a_afArg[0]; return a_afArg[0];
@ -143,9 +141,9 @@ private:
static auto LastArg(const qreal *a_afArg, qmusizetype a_iArgc) -> qreal static auto LastArg(const qreal *a_afArg, qmusizetype a_iArgc) -> qreal
{ {
if ( a_iArgc == 0) if (a_iArgc == 0)
{ {
throw QmuParserError ( "too few arguments for function LastArg." ); throw QmuParserError("too few arguments for function LastArg.");
} }
return a_afArg[a_iArgc - 1]; return a_afArg[a_iArgc - 1];
@ -153,13 +151,13 @@ private:
static auto Sum(const qreal *a_afArg, qmusizetype a_iArgc) -> qreal static auto Sum(const qreal *a_afArg, qmusizetype a_iArgc) -> qreal
{ {
if ( a_iArgc == 0) if (a_iArgc == 0)
{ {
throw QmuParserError ( "too few arguments for function sum." ); throw QmuParserError("too few arguments for function sum.");
} }
qreal fRes = 0; qreal fRes = 0;
for ( int i = 0; i < a_iArgc; ++i ) for (int i = 0; i < a_iArgc; ++i)
{ {
fRes += a_afArg[i]; fRes += a_afArg[i];
} }
@ -168,22 +166,14 @@ private:
static auto Rnd(qreal v) -> qreal static auto Rnd(qreal v) -> qreal
{ {
#if QT_VERSION >= QT_VERSION_CHECK(5, 10, 0) return static_cast<qreal>(
return static_cast<qreal>( ( 1 + ( v * QRandomGenerator().bounded(static_cast<qreal>(RAND_MAX)) / (1 + (v * QRandomGenerator().bounded(static_cast<qreal>(RAND_MAX)) / (RAND_MAX + 1.0))));
( RAND_MAX + 1.0 ) ) ) );
#else
return static_cast<qreal>( ( 1 + ( v * qrand() / ( RAND_MAX + 1.0 ) ) ) );
#endif
} }
static auto RndWithString(const char_type *) -> qreal static auto RndWithString(const char_type *) -> qreal
{ {
#if QT_VERSION >= QT_VERSION_CHECK(5, 10, 0) return static_cast<qreal>(
return static_cast<qreal>( ( 1 + ( 1000.0f * QRandomGenerator().bounded(static_cast<qreal>(RAND_MAX)) / (1 + (1000.0f * QRandomGenerator().bounded(static_cast<qreal>(RAND_MAX)) / (RAND_MAX + 1.0))));
( RAND_MAX + 1.0 ) ) ) );
#else
return static_cast<qreal>( ( 1 + ( 1000.0f * static_cast<qreal>(qrand()) / ( RAND_MAX + 1.0 ) ) ) );
#endif
} }
static auto Ping() -> qreal { return 10; } static auto Ping() -> qreal { return 10; }
@ -199,7 +189,7 @@ private:
static auto StrFun2(const QString &v1, qreal v2) -> qreal static auto StrFun2(const QString &v1, qreal v2) -> qreal
{ {
int val = v1.toInt(); int val = v1.toInt();
return static_cast<qreal>( val + v2 ); return static_cast<qreal>(val + v2);
} }
static auto StrFun3(const QString &v1, qreal v2, qreal v3) -> qreal static auto StrFun3(const QString &v1, qreal v2, qreal v3) -> qreal

View File

@ -1,52 +0,0 @@
/************************************************************************
**
** @file text.h
** @author Roman Telezhynskyi <dismine(at)gmail.com>
** @date 21 2, 2023
**
** @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) 2023 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 TEXT_H
#define TEXT_H
#include <QtGlobal>
#if QT_VERSION < QT_VERSION_CHECK(5, 14, 0)
#include <QTextStream>
namespace Qt
{
QT_WARNING_PUSH
QT_WARNING_DISABLE_GCC("-Wunused-variable")
QT_WARNING_DISABLE_CLANG("-Wunused-variable")
// static auto endl Q_DECL_UNUSED = ::endl; // NOLINT
// static auto flush Q_DECL_UNUSED = ::flush; // NOLINT
static auto dec Q_DECL_UNUSED = ::dec; // NOLINT
// static auto SkipEmptyParts Q_DECL_UNUSED = QString::SkipEmptyParts; // NOLINT
QT_WARNING_POP
} // namespace Qt
#endif
#endif // TEXT_H

View File

@ -58,41 +58,6 @@
#define __has_cpp_attribute(x) 0 #define __has_cpp_attribute(x) 0
#endif #endif
#if QT_VERSION < QT_VERSION_CHECK(5, 8, 0)
#ifndef QT_HAS_CPP_ATTRIBUTE
#ifdef __has_cpp_attribute
#define QT_HAS_CPP_ATTRIBUTE(x) __has_cpp_attribute(x)
#else
#define QT_HAS_CPP_ATTRIBUTE(x) 0
#endif
#endif // QT_HAS_CPP_ATTRIBUTE
#if defined(__cplusplus)
#if QT_HAS_CPP_ATTRIBUTE(clang::fallthrough)
#define Q_FALLTHROUGH() [[clang::fallthrough]]
#elif QT_HAS_CPP_ATTRIBUTE(gnu::fallthrough)
#define Q_FALLTHROUGH() [[gnu::fallthrough]]
#elif QT_HAS_CPP_ATTRIBUTE(fallthrough)
#define Q_FALLTHROUGH() [[fallthrough]]
#endif
#endif
#ifndef Q_FALLTHROUGH
#if (defined(Q_CC_GNU) && Q_CC_GNU >= 700) && !defined(Q_CC_INTEL)
#define Q_FALLTHROUGH() __attribute__((fallthrough))
#else
#define Q_FALLTHROUGH() (void)0
#endif
#endif // defined(__cplusplus)
#endif // QT_VERSION < QT_VERSION_CHECK(5, 8, 0)
#if QT_VERSION < QT_VERSION_CHECK(5, 13, 0)
#define Q_DISABLE_COPY_MOVE(Class) \
Q_DISABLE_COPY(Class) \
Class(Class &&) = delete; \
Class &operator=(Class &&) = delete;
#endif
#ifndef Q_DISABLE_ASSIGN_MOVE #ifndef Q_DISABLE_ASSIGN_MOVE
#define Q_DISABLE_ASSIGN_MOVE(Class) \ #define Q_DISABLE_ASSIGN_MOVE(Class) \
Q_DISABLE_ASSIGN(Class) \ Q_DISABLE_ASSIGN(Class) \

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