Optimize usage of defglobal.h.
This commit is contained in:
parent
dc625ceaa4
commit
254d32ff7f
|
@ -29,13 +29,15 @@
|
||||||
#ifndef VPCARROUSEL_H
|
#ifndef VPCARROUSEL_H
|
||||||
#define VPCARROUSEL_H
|
#define VPCARROUSEL_H
|
||||||
|
|
||||||
#include <QWidget>
|
|
||||||
#include <QComboBox>
|
#include <QComboBox>
|
||||||
#include <QScrollArea>
|
#include <QScrollArea>
|
||||||
#include <QUuid>
|
#include <QUuid>
|
||||||
|
#include <QWidget>
|
||||||
|
|
||||||
#include "../layout/layoutdef.h"
|
#include "../layout/layoutdef.h"
|
||||||
|
#if QT_VERSION < QT_VERSION_CHECK(5, 13, 0)
|
||||||
#include "../vmisc/defglobal.h"
|
#include "../vmisc/defglobal.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
namespace Ui
|
namespace Ui
|
||||||
{
|
{
|
||||||
|
@ -54,6 +56,7 @@ struct VPCarrouselSheet
|
||||||
class VPCarrousel : public QWidget
|
class VPCarrousel : public QWidget
|
||||||
{
|
{
|
||||||
Q_OBJECT // NOLINT
|
Q_OBJECT // NOLINT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit VPCarrousel(const VPLayoutPtr &layout, QWidget *parent = nullptr);
|
explicit VPCarrousel(const VPLayoutPtr &layout, QWidget *parent = nullptr);
|
||||||
~VPCarrousel() override = default;
|
~VPCarrousel() override = default;
|
||||||
|
@ -87,7 +90,7 @@ public slots:
|
||||||
void on_ActiveSheetChanged(const VPSheetPtr &sheet);
|
void on_ActiveSheetChanged(const VPSheetPtr &sheet);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void changeEvent(QEvent* event) override;
|
void changeEvent(QEvent *event) override;
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
|
|
||||||
|
|
|
@ -28,18 +28,23 @@
|
||||||
#ifndef VPCARROUSELPIECE_H
|
#ifndef VPCARROUSELPIECE_H
|
||||||
#define VPCARROUSELPIECE_H
|
#define VPCARROUSELPIECE_H
|
||||||
|
|
||||||
#include <QMouseEvent>
|
|
||||||
#include <QListWidgetItem>
|
#include <QListWidgetItem>
|
||||||
|
#include <QMouseEvent>
|
||||||
|
|
||||||
#include "../layout/layoutdef.h"
|
#include "../layout/layoutdef.h"
|
||||||
|
#if QT_VERSION < QT_VERSION_CHECK(5, 13, 0)
|
||||||
#include "../vmisc/defglobal.h"
|
#include "../vmisc/defglobal.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
class VPCarrouselPiece : public QListWidgetItem
|
class VPCarrouselPiece : public QListWidgetItem
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
enum { Type = UserType + 1};
|
enum
|
||||||
|
{
|
||||||
|
Type = UserType + 1
|
||||||
|
};
|
||||||
|
|
||||||
explicit VPCarrouselPiece(const VPPiecePtr &piece, QListWidget* parent);
|
explicit VPCarrouselPiece(const VPPiecePtr &piece, QListWidget *parent);
|
||||||
~VPCarrouselPiece() override = default;
|
~VPCarrouselPiece() override = default;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -60,7 +65,6 @@ public:
|
||||||
*/
|
*/
|
||||||
auto CreatePieceIcon(const QSize &size, bool isDragIcon = false) const -> QIcon;
|
auto CreatePieceIcon(const QSize &size, bool isDragIcon = false) const -> QIcon;
|
||||||
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// cppcheck-suppress unknownMacro
|
// cppcheck-suppress unknownMacro
|
||||||
Q_DISABLE_COPY_MOVE(VPCarrouselPiece) // NOLINT
|
Q_DISABLE_COPY_MOVE(VPCarrouselPiece) // NOLINT
|
||||||
|
|
|
@ -34,7 +34,9 @@
|
||||||
#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"
|
#include "../vmisc/defglobal.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
class VPMimeDataPiece : public QMimeData
|
class VPMimeDataPiece : public QMimeData
|
||||||
{
|
{
|
||||||
|
|
|
@ -30,11 +30,13 @@
|
||||||
|
|
||||||
#include <QWidget>
|
#include <QWidget>
|
||||||
|
|
||||||
|
#if QT_VERSION < QT_VERSION_CHECK(5, 13, 0)
|
||||||
#include "../vmisc/defglobal.h"
|
#include "../vmisc/defglobal.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
namespace Ui
|
namespace Ui
|
||||||
{
|
{
|
||||||
class PuzzlePreferencesConfigurationPage;
|
class PuzzlePreferencesConfigurationPage;
|
||||||
}
|
}
|
||||||
|
|
||||||
class PuzzlePreferencesConfigurationPage : public QWidget
|
class PuzzlePreferencesConfigurationPage : public QWidget
|
||||||
|
@ -48,7 +50,7 @@ public:
|
||||||
auto Apply() -> QStringList;
|
auto Apply() -> QStringList;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void changeEvent(QEvent* event) override;
|
void changeEvent(QEvent *event) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// cppcheck-suppress unknownMacro
|
// cppcheck-suppress unknownMacro
|
||||||
|
|
|
@ -30,11 +30,13 @@
|
||||||
|
|
||||||
#include <QDialog>
|
#include <QDialog>
|
||||||
|
|
||||||
|
#if QT_VERSION < QT_VERSION_CHECK(5, 13, 0)
|
||||||
#include "../vmisc/defglobal.h"
|
#include "../vmisc/defglobal.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
namespace Ui
|
namespace Ui
|
||||||
{
|
{
|
||||||
class DialogPuzzlePreferences;
|
class DialogPuzzlePreferences;
|
||||||
}
|
}
|
||||||
|
|
||||||
class PuzzlePreferencesConfigurationPage;
|
class PuzzlePreferencesConfigurationPage;
|
||||||
|
@ -56,7 +58,7 @@ signals:
|
||||||
protected:
|
protected:
|
||||||
void showEvent(QShowEvent *event) override;
|
void showEvent(QShowEvent *event) override;
|
||||||
void resizeEvent(QResizeEvent *event) override;
|
void resizeEvent(QResizeEvent *event) override;
|
||||||
void changeEvent(QEvent* event) override;
|
void changeEvent(QEvent *event) override;
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void Apply();
|
void Apply();
|
||||||
|
@ -69,8 +71,8 @@ private:
|
||||||
Ui::DialogPuzzlePreferences *ui;
|
Ui::DialogPuzzlePreferences *ui;
|
||||||
bool m_isInitialized{false};
|
bool m_isInitialized{false};
|
||||||
PuzzlePreferencesConfigurationPage *m_configurationPage;
|
PuzzlePreferencesConfigurationPage *m_configurationPage;
|
||||||
PuzzlePreferencesLayoutPage *m_layoutPage;
|
PuzzlePreferencesLayoutPage *m_layoutPage;
|
||||||
PuzzlePreferencesPathPage *m_pathPage;
|
PuzzlePreferencesPathPage *m_pathPage;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // DIALOGPUZZLEPREFERENCES_H
|
#endif // DIALOGPUZZLEPREFERENCES_H
|
||||||
|
|
|
@ -30,6 +30,7 @@
|
||||||
|
|
||||||
#include "../vlayout/dialogs/vabstractlayoutdialog.h"
|
#include "../vlayout/dialogs/vabstractlayoutdialog.h"
|
||||||
#include "../vlayout/vlayoutdef.h"
|
#include "../vlayout/vlayoutdef.h"
|
||||||
|
#include "../vmisc/defglobal.h"
|
||||||
|
|
||||||
namespace Ui
|
namespace Ui
|
||||||
{
|
{
|
||||||
|
@ -57,7 +58,7 @@ public:
|
||||||
void SetShowGrainline(bool show);
|
void SetShowGrainline(bool show);
|
||||||
auto IsShowGrainline() const -> bool;
|
auto IsShowGrainline() const -> bool;
|
||||||
|
|
||||||
void SetDestinationPath(const QString& cmdDestinationPath);
|
void SetDestinationPath(const QString &cmdDestinationPath);
|
||||||
|
|
||||||
auto IsTextAsPaths() const -> bool;
|
auto IsTextAsPaths() const -> bool;
|
||||||
void SetTextAsPaths(bool textAsPaths);
|
void SetTextAsPaths(bool textAsPaths);
|
||||||
|
@ -86,7 +87,7 @@ private:
|
||||||
bool m_consoleExport;
|
bool m_consoleExport;
|
||||||
|
|
||||||
static auto SupportPSTest() -> bool;
|
static auto SupportPSTest() -> bool;
|
||||||
static auto InitFormats() -> QVector<std::pair<QString, LayoutExportFormats> >;
|
static auto InitFormats() -> QVector<std::pair<QString, LayoutExportFormats>>;
|
||||||
|
|
||||||
void RemoveFormatFromList(LayoutExportFormats format);
|
void RemoveFormatFromList(LayoutExportFormats format);
|
||||||
|
|
||||||
|
|
|
@ -31,11 +31,13 @@
|
||||||
|
|
||||||
#include <QDialog>
|
#include <QDialog>
|
||||||
|
|
||||||
|
#if QT_VERSION < QT_VERSION_CHECK(5, 13, 0)
|
||||||
#include "../vmisc/defglobal.h"
|
#include "../vmisc/defglobal.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
namespace Ui
|
namespace Ui
|
||||||
{
|
{
|
||||||
class VPDialogAbout;
|
class VPDialogAbout;
|
||||||
}
|
}
|
||||||
|
|
||||||
class VPDialogAbout : public QDialog
|
class VPDialogAbout : public QDialog
|
||||||
|
@ -47,7 +49,7 @@ public:
|
||||||
~VPDialogAbout() override;
|
~VPDialogAbout() override;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void changeEvent(QEvent* event) override;
|
void changeEvent(QEvent *event) override;
|
||||||
void showEvent(QShowEvent *event) override;
|
void showEvent(QShowEvent *event) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
|
@ -33,7 +33,9 @@
|
||||||
#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"
|
#include "../vmisc/defglobal.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
class VPLayout;
|
class VPLayout;
|
||||||
|
|
||||||
|
@ -41,7 +43,7 @@ class VPGraphicsSheet : public QGraphicsItem
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
explicit VPGraphicsSheet(const VPLayoutPtr &layout, QGraphicsItem *parent = nullptr);
|
explicit VPGraphicsSheet(const VPLayoutPtr &layout, QGraphicsItem *parent = nullptr);
|
||||||
~VPGraphicsSheet() override =default;
|
~VPGraphicsSheet() 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;
|
||||||
|
|
|
@ -33,7 +33,6 @@
|
||||||
#include <QPainter>
|
#include <QPainter>
|
||||||
#include <QUuid>
|
#include <QUuid>
|
||||||
|
|
||||||
#include "../vmisc/def.h"
|
|
||||||
#include "../layout/layoutdef.h"
|
#include "../layout/layoutdef.h"
|
||||||
|
|
||||||
#if QT_VERSION < QT_VERSION_CHECK(5, 13, 0)
|
#if QT_VERSION < QT_VERSION_CHECK(5, 13, 0)
|
||||||
|
|
|
@ -28,19 +28,22 @@
|
||||||
#ifndef VPCOMMANDLINE_H
|
#ifndef VPCOMMANDLINE_H
|
||||||
#define VPCOMMANDLINE_H
|
#define VPCOMMANDLINE_H
|
||||||
|
|
||||||
#include <memory>
|
|
||||||
#include <QCoreApplication>
|
|
||||||
#include <QCommandLineParser>
|
#include <QCommandLineParser>
|
||||||
|
#include <QCoreApplication>
|
||||||
#include <ciso646>
|
#include <ciso646>
|
||||||
|
#include <memory>
|
||||||
|
|
||||||
|
#if QT_VERSION < QT_VERSION_CHECK(5, 13, 0)
|
||||||
#include "../vmisc/defglobal.h"
|
#include "../vmisc/defglobal.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
class VPCommandLine;
|
class VPCommandLine;
|
||||||
using VPCommandLinePtr = std::shared_ptr<VPCommandLine>;
|
using VPCommandLinePtr = std::shared_ptr<VPCommandLine>;
|
||||||
|
|
||||||
class VPCommandLine: public QObject
|
class VPCommandLine : public QObject
|
||||||
{
|
{
|
||||||
Q_OBJECT // NOLINT
|
Q_OBJECT // NOLINT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
~VPCommandLine() override = default;
|
~VPCommandLine() override = default;
|
||||||
|
|
||||||
|
@ -57,16 +60,18 @@ public:
|
||||||
auto IsNoScalingEnabled() const -> bool;
|
auto IsNoScalingEnabled() const -> bool;
|
||||||
|
|
||||||
Q_NORETURN void ShowHelp(int exitCode = 0);
|
Q_NORETURN void ShowHelp(int exitCode = 0);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
VPCommandLine();
|
VPCommandLine();
|
||||||
|
|
||||||
/** @brief create the single instance of the class inside vpapplication */
|
/** @brief create the single instance of the class inside vpapplication */
|
||||||
static auto Instance() -> VPCommandLinePtr;
|
static auto Instance() -> VPCommandLinePtr;
|
||||||
static void ProcessInstance(VPCommandLinePtr &instance, const QStringList &arguments);
|
static void ProcessInstance(VPCommandLinePtr &instance, const QStringList &arguments);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// cppcheck-suppress unknownMacro
|
// cppcheck-suppress unknownMacro
|
||||||
Q_DISABLE_COPY_MOVE(VPCommandLine) // NOLINT
|
Q_DISABLE_COPY_MOVE(VPCommandLine) // NOLINT
|
||||||
static VPCommandLinePtr instance; // NOLINT(cppcoreguidelines-avoid-non-const-global-variables)
|
static VPCommandLinePtr instance; // NOLINT(cppcoreguidelines-avoid-non-const-global-variables)
|
||||||
QCommandLineParser parser{};
|
QCommandLineParser parser{};
|
||||||
bool isGuiEnabled{true};
|
bool isGuiEnabled{true};
|
||||||
friend class VPApplication;
|
friend class VPApplication;
|
||||||
|
@ -74,7 +79,7 @@ private:
|
||||||
/** @brief add options to the QCommandLineParser that there are in the cmd can be */
|
/** @brief add options to the QCommandLineParser that there are in the cmd can be */
|
||||||
void InitCommandLineOptions();
|
void InitCommandLineOptions();
|
||||||
|
|
||||||
auto IsOptionSet(const QString &option)const -> bool;
|
auto IsOptionSet(const QString &option) const -> bool;
|
||||||
auto OptionValue(const QString &option) const -> QString;
|
auto OptionValue(const QString &option) const -> QString;
|
||||||
auto OptionValues(const QString &option) const -> QStringList;
|
auto OptionValues(const QString &option) const -> QStringList;
|
||||||
};
|
};
|
||||||
|
|
|
@ -8,8 +8,8 @@
|
||||||
#include "../vmisc/literals.h"
|
#include "../vmisc/literals.h"
|
||||||
#include "../vmisc/vcommonsettings.h"
|
#include "../vmisc/vcommonsettings.h"
|
||||||
#include "../vwidgets/vmaingraphicsscene.h"
|
#include "../vwidgets/vmaingraphicsscene.h"
|
||||||
|
#include "layout/vplayout.h"
|
||||||
#include "layout/vpsheet.h"
|
#include "layout/vpsheet.h"
|
||||||
#include "qobject.h"
|
|
||||||
|
|
||||||
#if QT_VERSION < QT_VERSION_CHECK(5, 5, 0)
|
#if QT_VERSION < QT_VERSION_CHECK(5, 5, 0)
|
||||||
#include "../vmisc/diagnostic.h"
|
#include "../vmisc/diagnostic.h"
|
||||||
|
|
|
@ -29,11 +29,11 @@
|
||||||
#ifndef VPTILEFACTORY_H
|
#ifndef VPTILEFACTORY_H
|
||||||
#define VPTILEFACTORY_H
|
#define VPTILEFACTORY_H
|
||||||
|
|
||||||
#include <QtMath>
|
|
||||||
#include <QObject>
|
#include <QObject>
|
||||||
|
#include <QtMath>
|
||||||
|
|
||||||
#include "layout/vplayout.h"
|
|
||||||
#include "../ifc/ifcdef.h"
|
#include "../ifc/ifcdef.h"
|
||||||
|
#include "layout/layoutdef.h"
|
||||||
|
|
||||||
#if QT_VERSION < QT_VERSION_CHECK(5, 13, 0)
|
#if QT_VERSION < QT_VERSION_CHECK(5, 13, 0)
|
||||||
#include "../vmisc/defglobal.h"
|
#include "../vmisc/defglobal.h"
|
||||||
|
@ -108,7 +108,7 @@ private:
|
||||||
// cppcheck-suppress unknownMacro
|
// cppcheck-suppress unknownMacro
|
||||||
Q_DISABLE_COPY_MOVE(VPTileFactory) // NOLINT
|
Q_DISABLE_COPY_MOVE(VPTileFactory) // NOLINT
|
||||||
|
|
||||||
VPLayoutWeakPtr m_layout;
|
VPLayoutWeakPtr m_layout;
|
||||||
VCommonSettings *m_commonSettings{nullptr};
|
VCommonSettings *m_commonSettings{nullptr};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -31,11 +31,13 @@
|
||||||
|
|
||||||
#include <QDialog>
|
#include <QDialog>
|
||||||
|
|
||||||
|
#if QT_VERSION < QT_VERSION_CHECK(5, 13, 0)
|
||||||
#include "../vmisc/defglobal.h"
|
#include "../vmisc/defglobal.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
namespace Ui
|
namespace Ui
|
||||||
{
|
{
|
||||||
class DialogAboutTape;
|
class DialogAboutTape;
|
||||||
}
|
}
|
||||||
|
|
||||||
class DialogAboutTape : public QDialog
|
class DialogAboutTape : public QDialog
|
||||||
|
@ -47,7 +49,7 @@ public:
|
||||||
~DialogAboutTape() override;
|
~DialogAboutTape() override;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void changeEvent(QEvent* event) override;
|
void changeEvent(QEvent *event) override;
|
||||||
void showEvent(QShowEvent *event) override;
|
void showEvent(QShowEvent *event) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
|
@ -31,11 +31,13 @@
|
||||||
|
|
||||||
#include <QDialog>
|
#include <QDialog>
|
||||||
|
|
||||||
|
#if QT_VERSION < QT_VERSION_CHECK(5, 13, 0)
|
||||||
#include "../vmisc/defglobal.h"
|
#include "../vmisc/defglobal.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
namespace Ui
|
namespace Ui
|
||||||
{
|
{
|
||||||
class DialogMDataBase;
|
class DialogMDataBase;
|
||||||
}
|
}
|
||||||
|
|
||||||
class QTreeWidgetItem;
|
class QTreeWidgetItem;
|
||||||
|
@ -56,7 +58,7 @@ public:
|
||||||
static auto ImgTag(const QString &number) -> QString;
|
static auto ImgTag(const QString &number) -> QString;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void changeEvent(QEvent* event) override;
|
void changeEvent(QEvent *event) override;
|
||||||
auto eventFilter(QObject *target, QEvent *event) -> bool override;
|
auto eventFilter(QObject *target, QEvent *event) -> bool override;
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
|
|
|
@ -31,11 +31,13 @@
|
||||||
|
|
||||||
#include <QDialog>
|
#include <QDialog>
|
||||||
|
|
||||||
|
#if QT_VERSION < QT_VERSION_CHECK(5, 13, 0)
|
||||||
#include "../vmisc/defglobal.h"
|
#include "../vmisc/defglobal.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
namespace Ui
|
namespace Ui
|
||||||
{
|
{
|
||||||
class DialogTapePreferences;
|
class DialogTapePreferences;
|
||||||
}
|
}
|
||||||
|
|
||||||
class TapePreferencesConfigurationPage;
|
class TapePreferencesConfigurationPage;
|
||||||
|
@ -51,21 +53,23 @@ public:
|
||||||
~DialogTapePreferences() override;
|
~DialogTapePreferences() override;
|
||||||
signals:
|
signals:
|
||||||
void UpdateProperties();
|
void UpdateProperties();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void showEvent(QShowEvent *event) override;
|
void showEvent(QShowEvent *event) override;
|
||||||
void resizeEvent(QResizeEvent *event) override;
|
void resizeEvent(QResizeEvent *event) override;
|
||||||
void changeEvent(QEvent* event) override;
|
void changeEvent(QEvent *event) override;
|
||||||
private slots:
|
private slots:
|
||||||
void Apply();
|
void Apply();
|
||||||
void Ok();
|
void Ok();
|
||||||
void PageChanged(QListWidgetItem *current, QListWidgetItem *previous);
|
void PageChanged(QListWidgetItem *current, QListWidgetItem *previous);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// cppcheck-suppress unknownMacro
|
// cppcheck-suppress unknownMacro
|
||||||
Q_DISABLE_COPY_MOVE(DialogTapePreferences) // NOLINT
|
Q_DISABLE_COPY_MOVE(DialogTapePreferences) // NOLINT
|
||||||
Ui::DialogTapePreferences *ui;
|
Ui::DialogTapePreferences *ui;
|
||||||
bool m_isInitialized{false};
|
bool m_isInitialized{false};
|
||||||
TapePreferencesConfigurationPage *m_configurationPage;
|
TapePreferencesConfigurationPage *m_configurationPage;
|
||||||
TapePreferencesPathPage *m_pathPage;
|
TapePreferencesPathPage *m_pathPage;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // DIALOGTAPEPREFERENCES_H
|
#endif // DIALOGTAPEPREFERENCES_H
|
||||||
|
|
|
@ -29,13 +29,15 @@
|
||||||
#ifndef VFORMULAPROPERTYEDITOR_H
|
#ifndef VFORMULAPROPERTYEDITOR_H
|
||||||
#define VFORMULAPROPERTYEDITOR_H
|
#define VFORMULAPROPERTYEDITOR_H
|
||||||
|
|
||||||
#include <QWidget>
|
|
||||||
#include <QToolButton>
|
|
||||||
#include <QLineEdit>
|
|
||||||
#include <QLabel>
|
#include <QLabel>
|
||||||
|
#include <QLineEdit>
|
||||||
|
#include <QToolButton>
|
||||||
|
#include <QWidget>
|
||||||
|
|
||||||
#include "../vpatterndb/vformula.h"
|
#include "../vpatterndb/vformula.h"
|
||||||
|
#if QT_VERSION < QT_VERSION_CHECK(5, 13, 0)
|
||||||
#include "../vmisc/defglobal.h"
|
#include "../vmisc/defglobal.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
class VFormulaPropertyEditor : public QWidget
|
class VFormulaPropertyEditor : public QWidget
|
||||||
{
|
{
|
||||||
|
@ -56,7 +58,7 @@ public:
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
//! This is emitted, when the user changes the color
|
//! This is emitted, when the user changes the color
|
||||||
void dataChangedByUser(const VFormula &GetFormula, VFormulaPropertyEditor* editor);
|
void dataChangedByUser(const VFormula &GetFormula, VFormulaPropertyEditor *editor);
|
||||||
|
|
||||||
void dataChanged();
|
void dataChanged();
|
||||||
|
|
||||||
|
@ -71,9 +73,8 @@ private:
|
||||||
// cppcheck-suppress unknownMacro
|
// cppcheck-suppress unknownMacro
|
||||||
Q_DISABLE_COPY_MOVE(VFormulaPropertyEditor) // NOLINT
|
Q_DISABLE_COPY_MOVE(VFormulaPropertyEditor) // NOLINT
|
||||||
VFormula m_formula{};
|
VFormula m_formula{};
|
||||||
QToolButton* m_ToolButton{nullptr};
|
QToolButton *m_ToolButton{nullptr};
|
||||||
QLabel* m_TextLabel{nullptr};
|
QLabel *m_TextLabel{nullptr};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
#endif // VFORMULAPROPERTYEDITOR_H
|
#endif // VFORMULAPROPERTYEDITOR_H
|
||||||
|
|
|
@ -31,11 +31,13 @@
|
||||||
|
|
||||||
#include <QDialog>
|
#include <QDialog>
|
||||||
|
|
||||||
|
#if QT_VERSION < QT_VERSION_CHECK(5, 13, 0)
|
||||||
#include "../vmisc/defglobal.h"
|
#include "../vmisc/defglobal.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
namespace Ui
|
namespace Ui
|
||||||
{
|
{
|
||||||
class DialogAboutApp;
|
class DialogAboutApp;
|
||||||
}
|
}
|
||||||
|
|
||||||
class DialogAboutApp : public QDialog
|
class DialogAboutApp : public QDialog
|
||||||
|
|
|
@ -29,15 +29,17 @@
|
||||||
#ifndef DIALOGDATETIMEFORMATS_H
|
#ifndef DIALOGDATETIMEFORMATS_H
|
||||||
#define DIALOGDATETIMEFORMATS_H
|
#define DIALOGDATETIMEFORMATS_H
|
||||||
|
|
||||||
#include <QDialog>
|
|
||||||
#include <QDate>
|
#include <QDate>
|
||||||
|
#include <QDialog>
|
||||||
#include <QTime>
|
#include <QTime>
|
||||||
|
|
||||||
|
#if QT_VERSION < QT_VERSION_CHECK(5, 13, 0)
|
||||||
#include "../vmisc/defglobal.h"
|
#include "../vmisc/defglobal.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
namespace Ui
|
namespace Ui
|
||||||
{
|
{
|
||||||
class DialogDateTimeFormats;
|
class DialogDateTimeFormats;
|
||||||
}
|
}
|
||||||
|
|
||||||
class QListWidgetItem;
|
class QListWidgetItem;
|
||||||
|
@ -65,7 +67,7 @@ private:
|
||||||
// cppcheck-suppress unknownMacro
|
// cppcheck-suppress unknownMacro
|
||||||
Q_DISABLE_COPY_MOVE(DialogDateTimeFormats) // NOLINT
|
Q_DISABLE_COPY_MOVE(DialogDateTimeFormats) // NOLINT
|
||||||
Ui::DialogDateTimeFormats *ui;
|
Ui::DialogDateTimeFormats *ui;
|
||||||
bool m_dateMode;
|
bool m_dateMode;
|
||||||
QDate m_date{};
|
QDate m_date{};
|
||||||
QTime m_time{};
|
QTime m_time{};
|
||||||
QStringList m_predefined;
|
QStringList m_predefined;
|
||||||
|
|
|
@ -31,11 +31,13 @@
|
||||||
|
|
||||||
#include <QDialog>
|
#include <QDialog>
|
||||||
|
|
||||||
|
#if QT_VERSION < QT_VERSION_CHECK(5, 13, 0)
|
||||||
#include "../vmisc/defglobal.h"
|
#include "../vmisc/defglobal.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
namespace Ui
|
namespace Ui
|
||||||
{
|
{
|
||||||
class DialogKnownMaterials;
|
class DialogKnownMaterials;
|
||||||
}
|
}
|
||||||
|
|
||||||
class DialogKnownMaterials : public QDialog
|
class DialogKnownMaterials : public QDialog
|
||||||
|
|
|
@ -33,11 +33,13 @@
|
||||||
#include <QElapsedTimer>
|
#include <QElapsedTimer>
|
||||||
#include <QTimer>
|
#include <QTimer>
|
||||||
|
|
||||||
|
#if QT_VERSION < QT_VERSION_CHECK(5, 13, 0)
|
||||||
#include "../vmisc/defglobal.h"
|
#include "../vmisc/defglobal.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
namespace Ui
|
namespace Ui
|
||||||
{
|
{
|
||||||
class DialogLayoutProgress;
|
class DialogLayoutProgress;
|
||||||
}
|
}
|
||||||
|
|
||||||
class DialogLayoutProgress : public QDialog
|
class DialogLayoutProgress : public QDialog
|
||||||
|
|
|
@ -33,7 +33,9 @@
|
||||||
#include <QMap>
|
#include <QMap>
|
||||||
#include <QPointer>
|
#include <QPointer>
|
||||||
|
|
||||||
|
#if QT_VERSION < QT_VERSION_CHECK(5, 13, 0)
|
||||||
#include "../vmisc/defglobal.h"
|
#include "../vmisc/defglobal.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
class VPattern;
|
class VPattern;
|
||||||
class VContainer;
|
class VContainer;
|
||||||
|
@ -43,17 +45,19 @@ class QTemporaryFile;
|
||||||
|
|
||||||
namespace Ui
|
namespace Ui
|
||||||
{
|
{
|
||||||
class DialogPatternProperties;
|
class DialogPatternProperties;
|
||||||
}
|
}
|
||||||
|
|
||||||
class DialogPatternProperties : public QDialog
|
class DialogPatternProperties : public QDialog
|
||||||
{
|
{
|
||||||
Q_OBJECT // NOLINT
|
Q_OBJECT // NOLINT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit DialogPatternProperties(VPattern *doc, VContainer *pattern, QWidget *parent = nullptr);
|
explicit DialogPatternProperties(VPattern *doc, VContainer *pattern, QWidget *parent = nullptr);
|
||||||
~DialogPatternProperties() override;
|
~DialogPatternProperties() override;
|
||||||
signals:
|
signals:
|
||||||
void UpddatePieces();
|
void UpddatePieces();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
auto eventFilter(QObject *object, QEvent *event) -> bool override;
|
auto eventFilter(QObject *object, QEvent *event) -> bool override;
|
||||||
private slots:
|
private slots:
|
||||||
|
@ -65,6 +69,7 @@ private slots:
|
||||||
void ShowImage();
|
void ShowImage();
|
||||||
void BrowseLabelPath();
|
void BrowseLabelPath();
|
||||||
void LabelPathChanged(const QString &text);
|
void LabelPathChanged(const QString &text);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// cppcheck-suppress unknownMacro
|
// cppcheck-suppress unknownMacro
|
||||||
Q_DISABLE_COPY_MOVE(DialogPatternProperties) // NOLINT
|
Q_DISABLE_COPY_MOVE(DialogPatternProperties) // NOLINT
|
||||||
|
|
|
@ -31,11 +31,13 @@
|
||||||
|
|
||||||
#include <QDialog>
|
#include <QDialog>
|
||||||
|
|
||||||
|
#if QT_VERSION < QT_VERSION_CHECK(5, 13, 0)
|
||||||
#include "../vmisc/defglobal.h"
|
#include "../vmisc/defglobal.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
namespace Ui
|
namespace Ui
|
||||||
{
|
{
|
||||||
class DialogPreferences;
|
class DialogPreferences;
|
||||||
}
|
}
|
||||||
|
|
||||||
class PreferencesConfigurationPage;
|
class PreferencesConfigurationPage;
|
||||||
|
@ -53,20 +55,22 @@ public:
|
||||||
~DialogPreferences() override;
|
~DialogPreferences() override;
|
||||||
signals:
|
signals:
|
||||||
void UpdateProperties();
|
void UpdateProperties();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void showEvent(QShowEvent *event) override;
|
void showEvent(QShowEvent *event) override;
|
||||||
void resizeEvent(QResizeEvent *event) override;
|
void resizeEvent(QResizeEvent *event) override;
|
||||||
void changeEvent(QEvent* event) override;
|
void changeEvent(QEvent *event) override;
|
||||||
private slots:
|
private slots:
|
||||||
void PageChanged(QListWidgetItem *current, QListWidgetItem *previous);
|
void PageChanged(QListWidgetItem *current, QListWidgetItem *previous);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// cppcheck-suppress unknownMacro
|
// cppcheck-suppress unknownMacro
|
||||||
Q_DISABLE_COPY_MOVE(DialogPreferences) // NOLINT
|
Q_DISABLE_COPY_MOVE(DialogPreferences) // NOLINT
|
||||||
Ui::DialogPreferences *ui;
|
Ui::DialogPreferences *ui;
|
||||||
bool m_isInitialized{false};
|
bool m_isInitialized{false};
|
||||||
PreferencesConfigurationPage *m_configurePage;
|
PreferencesConfigurationPage *m_configurePage;
|
||||||
PreferencesPatternPage *m_patternPage;
|
PreferencesPatternPage *m_patternPage;
|
||||||
PreferencesPathPage *m_pathPage;
|
PreferencesPathPage *m_pathPage;
|
||||||
|
|
||||||
void Apply();
|
void Apply();
|
||||||
void Ok();
|
void Ok();
|
||||||
|
|
|
@ -31,7 +31,9 @@
|
||||||
|
|
||||||
#include <QWidget>
|
#include <QWidget>
|
||||||
|
|
||||||
|
#if QT_VERSION < QT_VERSION_CHECK(5, 13, 0)
|
||||||
#include "../vmisc/defglobal.h"
|
#include "../vmisc/defglobal.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
class VAbstractPattern;
|
class VAbstractPattern;
|
||||||
class VContainer;
|
class VContainer;
|
||||||
|
@ -40,7 +42,7 @@ class QTableWidgetItem;
|
||||||
|
|
||||||
namespace Ui
|
namespace Ui
|
||||||
{
|
{
|
||||||
class VWidgetDetails;
|
class VWidgetDetails;
|
||||||
}
|
}
|
||||||
|
|
||||||
class VWidgetDetails : public QWidget
|
class VWidgetDetails : public QWidget
|
||||||
|
@ -60,7 +62,7 @@ public slots:
|
||||||
void ToggledPiece(quint32 id);
|
void ToggledPiece(quint32 id);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void changeEvent ( QEvent * event) override;
|
void changeEvent(QEvent *event) override;
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void InLayoutStateChanged(int row, int column);
|
void InLayoutStateChanged(int row, int column);
|
||||||
|
@ -72,9 +74,9 @@ private:
|
||||||
// cppcheck-suppress unknownMacro
|
// cppcheck-suppress unknownMacro
|
||||||
Q_DISABLE_COPY_MOVE(VWidgetDetails) // NOLINT
|
Q_DISABLE_COPY_MOVE(VWidgetDetails) // NOLINT
|
||||||
Ui::VWidgetDetails *ui;
|
Ui::VWidgetDetails *ui;
|
||||||
VAbstractPattern *m_doc;
|
VAbstractPattern *m_doc;
|
||||||
VContainer *m_data;
|
VContainer *m_data;
|
||||||
QTimer *m_updateListTimer;
|
QTimer *m_updateListTimer;
|
||||||
|
|
||||||
void FillTable(const QHash<quint32, VPiece> *details);
|
void FillTable(const QHash<quint32, VPiece> *details);
|
||||||
void ToggleSectionDetails(bool select);
|
void ToggleSectionDetails(bool select);
|
||||||
|
|
|
@ -29,9 +29,11 @@
|
||||||
#ifndef VWIDGETGROUPS_H
|
#ifndef VWIDGETGROUPS_H
|
||||||
#define VWIDGETGROUPS_H
|
#define VWIDGETGROUPS_H
|
||||||
|
|
||||||
#include <QWidget>
|
|
||||||
#include "../vmisc/typedef.h"
|
#include "../vmisc/typedef.h"
|
||||||
|
#include <QWidget>
|
||||||
|
#if QT_VERSION < QT_VERSION_CHECK(5, 13, 0)
|
||||||
#include "../vmisc/defglobal.h"
|
#include "../vmisc/defglobal.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
class QTableWidgetItem;
|
class QTableWidgetItem;
|
||||||
class VAbstractPattern;
|
class VAbstractPattern;
|
||||||
|
@ -39,7 +41,7 @@ struct VGroupData;
|
||||||
|
|
||||||
namespace Ui
|
namespace Ui
|
||||||
{
|
{
|
||||||
class VWidgetGroups;
|
class VWidgetGroups;
|
||||||
}
|
}
|
||||||
|
|
||||||
class VWidgetGroups : public QWidget
|
class VWidgetGroups : public QWidget
|
||||||
|
|
|
@ -28,11 +28,14 @@
|
||||||
#include <QUrl>
|
#include <QUrl>
|
||||||
#include <QtGlobal>
|
#include <QtGlobal>
|
||||||
|
|
||||||
|
#if QT_VERSION < QT_VERSION_CHECK(5, 13, 0)
|
||||||
#include "../vmisc/defglobal.h"
|
#include "../vmisc/defglobal.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
class FvAvailableUpdate final : public QObject
|
class FvAvailableUpdate final : public QObject
|
||||||
{
|
{
|
||||||
Q_OBJECT // NOLINT
|
Q_OBJECT // NOLINT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit FvAvailableUpdate(QObject *parent = nullptr);
|
explicit FvAvailableUpdate(QObject *parent = nullptr);
|
||||||
|
|
||||||
|
@ -50,9 +53,9 @@ private:
|
||||||
// cppcheck-suppress unknownMacro
|
// cppcheck-suppress unknownMacro
|
||||||
Q_DISABLE_COPY_MOVE(FvAvailableUpdate) // NOLINT
|
Q_DISABLE_COPY_MOVE(FvAvailableUpdate) // NOLINT
|
||||||
|
|
||||||
QUrl m_enclosureUrl;
|
QUrl m_enclosureUrl;
|
||||||
QString m_enclosureVersion;
|
QString m_enclosureVersion;
|
||||||
QString m_enclosurePlatform;
|
QString m_enclosurePlatform;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // FVAVAILABLEUPDATE_H
|
#endif // FVAVAILABLEUPDATE_H
|
||||||
|
|
|
@ -28,13 +28,15 @@
|
||||||
#include <QString>
|
#include <QString>
|
||||||
#include <QtGlobal>
|
#include <QtGlobal>
|
||||||
|
|
||||||
|
#if QT_VERSION < QT_VERSION_CHECK(5, 13, 0)
|
||||||
#include "../vmisc/defglobal.h"
|
#include "../vmisc/defglobal.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
class QGraphicsScene;
|
class QGraphicsScene;
|
||||||
|
|
||||||
namespace Ui
|
namespace Ui
|
||||||
{
|
{
|
||||||
class FvUpdateWindow;
|
class FvUpdateWindow;
|
||||||
}
|
}
|
||||||
|
|
||||||
class FvUpdateWindow : public QDialog
|
class FvUpdateWindow : public QDialog
|
||||||
|
@ -52,7 +54,7 @@ private:
|
||||||
// cppcheck-suppress unknownMacro
|
// cppcheck-suppress unknownMacro
|
||||||
Q_DISABLE_COPY_MOVE(FvUpdateWindow) // NOLINT
|
Q_DISABLE_COPY_MOVE(FvUpdateWindow) // NOLINT
|
||||||
|
|
||||||
Ui::FvUpdateWindow* m_ui;
|
Ui::FvUpdateWindow *m_ui;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // FVUPDATEWINDOW_H
|
#endif // FVUPDATEWINDOW_H
|
||||||
|
|
|
@ -34,7 +34,9 @@
|
||||||
#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"
|
#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.
|
||||||
|
@ -78,11 +80,11 @@ enum EErrorCodes
|
||||||
ecEMPTY_EXPRESSION = 25, ///< The Expression is empty
|
ecEMPTY_EXPRESSION = 25, ///< The Expression is empty
|
||||||
ecNAME_CONFLICT = 26, ///< Name conflict
|
ecNAME_CONFLICT = 26, ///< Name conflict
|
||||||
ecOPT_PRI = 27, ///< Invalid operator priority
|
ecOPT_PRI = 27, ///< Invalid operator priority
|
||||||
//
|
//
|
||||||
ecDOMAIN_ERROR = 28, ///< catch division by zero, sqrt(-1), log(0) (currently unused)
|
ecDOMAIN_ERROR = 28, ///< catch division by zero, sqrt(-1), log(0) (currently unused)
|
||||||
ecDIV_BY_ZERO = 29, ///< Division by zero (currently unused)
|
ecDIV_BY_ZERO = 29, ///< Division by zero (currently unused)
|
||||||
ecGENERIC = 30, ///< Generic error
|
ecGENERIC = 30, ///< Generic error
|
||||||
ecLOCALE = 31, ///< Conflict with current locale
|
ecLOCALE = 31, ///< Conflict with current locale
|
||||||
|
|
||||||
ecUNEXPECTED_CONDITIONAL = 32,
|
ecUNEXPECTED_CONDITIONAL = 32,
|
||||||
ecMISSING_ELSE_CLAUSE = 33,
|
ecMISSING_ELSE_CLAUSE = 33,
|
||||||
|
|
|
@ -14,11 +14,15 @@
|
||||||
#define DXFREADER_H
|
#define DXFREADER_H
|
||||||
|
|
||||||
#include "drw_textcodec.h"
|
#include "drw_textcodec.h"
|
||||||
|
#if QT_VERSION < QT_VERSION_CHECK(5, 13, 0)
|
||||||
#include "../vmisc/defglobal.h"
|
#include "../vmisc/defglobal.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
class dxfReader {
|
class dxfReader
|
||||||
|
{
|
||||||
public:
|
public:
|
||||||
enum TYPE {
|
enum TYPE
|
||||||
|
{
|
||||||
STRING,
|
STRING,
|
||||||
INT32,
|
INT32,
|
||||||
INT64,
|
INT64,
|
||||||
|
@ -27,17 +31,19 @@ public:
|
||||||
INVALID
|
INVALID
|
||||||
};
|
};
|
||||||
TYPE type;
|
TYPE type;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit dxfReader(std::istream *stream)
|
explicit dxfReader(std::istream *stream)
|
||||||
: type(INVALID),
|
: type(INVALID),
|
||||||
filestr(stream),
|
filestr(stream),
|
||||||
strData(),
|
strData(),
|
||||||
doubleData(),
|
doubleData(),
|
||||||
intData(),
|
intData(),
|
||||||
int64(),
|
int64(),
|
||||||
skip(),
|
skip(),
|
||||||
decoder()
|
decoder()
|
||||||
{}
|
{
|
||||||
|
}
|
||||||
|
|
||||||
virtual ~dxfReader() = default;
|
virtual ~dxfReader() = default;
|
||||||
auto readRec(int *codeData) -> bool;
|
auto readRec(int *codeData) -> bool;
|
||||||
|
@ -51,10 +57,10 @@ public:
|
||||||
auto getInt64() const -> unsigned long long int { return int64; }
|
auto getInt64() const -> unsigned long long int { return int64; }
|
||||||
auto getBool() const -> bool { return (intData == 0) ? false : true; }
|
auto getBool() const -> bool { return (intData == 0) ? false : true; }
|
||||||
auto getVersion() const -> int { return decoder.getVersion(); }
|
auto getVersion() const -> int { return decoder.getVersion(); }
|
||||||
void setVersion(const std::string &v, bool dxfFormat){decoder.setVersion(v, dxfFormat);}
|
void setVersion(const std::string &v, bool dxfFormat) { decoder.setVersion(v, dxfFormat); }
|
||||||
void setCodePage(const std::string &c){decoder.setCodePage(c, true);}
|
void setCodePage(const std::string &c) { decoder.setCodePage(c, true); }
|
||||||
auto getCodePage() const -> std::string { return decoder.getCodePage(); }
|
auto getCodePage() const -> std::string { return decoder.getCodePage(); }
|
||||||
void setIgnoreComments(const bool bValue) {m_bIgnoreComments = bValue;}
|
void setIgnoreComments(const bool bValue) { m_bIgnoreComments = bValue; }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual auto readCode(int *code) -> bool = 0; // return true if successful (not EOF)
|
virtual auto readCode(int *code) -> bool = 0; // return true if successful (not EOF)
|
||||||
|
@ -71,20 +77,24 @@ protected:
|
||||||
std::istream *filestr;
|
std::istream *filestr;
|
||||||
std::string strData;
|
std::string strData;
|
||||||
double doubleData;
|
double doubleData;
|
||||||
signed int intData; //32 bits integer
|
signed int intData; // 32 bits integer
|
||||||
unsigned long long int int64; //64 bits integer
|
unsigned long long int int64; // 64 bits integer
|
||||||
bool skip; //set to true for ascii dxf, false for binary
|
bool skip; // set to true for ascii dxf, false for binary
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Q_DISABLE_COPY_MOVE(dxfReader) // NOLINT
|
Q_DISABLE_COPY_MOVE(dxfReader) // NOLINT
|
||||||
DRW_TextCodec decoder;
|
DRW_TextCodec decoder;
|
||||||
bool m_bIgnoreComments {false};
|
bool m_bIgnoreComments{false};
|
||||||
};
|
};
|
||||||
|
|
||||||
class dxfReaderBinary : public dxfReader {
|
class dxfReaderBinary : public dxfReader
|
||||||
|
{
|
||||||
public:
|
public:
|
||||||
explicit dxfReaderBinary(std::istream *stream)
|
explicit dxfReaderBinary(std::istream *stream)
|
||||||
: dxfReader(stream)
|
: dxfReader(stream)
|
||||||
{skip = false; }
|
{
|
||||||
|
skip = false;
|
||||||
|
}
|
||||||
|
|
||||||
virtual ~dxfReaderBinary() = default;
|
virtual ~dxfReaderBinary() = default;
|
||||||
virtual auto readCode(int *code) -> bool override;
|
virtual auto readCode(int *code) -> bool override;
|
||||||
|
@ -98,11 +108,14 @@ public:
|
||||||
virtual auto readBool() -> bool override;
|
virtual auto readBool() -> bool override;
|
||||||
};
|
};
|
||||||
|
|
||||||
class dxfReaderAscii final : public dxfReader {
|
class dxfReaderAscii final : public dxfReader
|
||||||
|
{
|
||||||
public:
|
public:
|
||||||
explicit dxfReaderAscii(std::istream *stream)
|
explicit dxfReaderAscii(std::istream *stream)
|
||||||
: dxfReader(stream)
|
: dxfReader(stream)
|
||||||
{skip = true; }
|
{
|
||||||
|
skip = true;
|
||||||
|
}
|
||||||
|
|
||||||
virtual ~dxfReaderAscii() = default;
|
virtual ~dxfReaderAscii() = default;
|
||||||
virtual auto readCode(int *code) -> bool override;
|
virtual auto readCode(int *code) -> bool override;
|
||||||
|
|
|
@ -28,7 +28,6 @@
|
||||||
#ifndef VHPGLENGINE_H
|
#ifndef VHPGLENGINE_H
|
||||||
#define VHPGLENGINE_H
|
#define VHPGLENGINE_H
|
||||||
|
|
||||||
#include "../vmisc/def.h"
|
|
||||||
#include <QPoint>
|
#include <QPoint>
|
||||||
#include <QSize>
|
#include <QSize>
|
||||||
#include <QString>
|
#include <QString>
|
||||||
|
|
|
@ -30,11 +30,13 @@
|
||||||
|
|
||||||
#include <QDialog>
|
#include <QDialog>
|
||||||
|
|
||||||
|
#if QT_VERSION < QT_VERSION_CHECK(5, 13, 0)
|
||||||
#include "../vmisc/defglobal.h"
|
#include "../vmisc/defglobal.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
namespace Ui
|
namespace Ui
|
||||||
{
|
{
|
||||||
class DialogLayoutScale;
|
class DialogLayoutScale;
|
||||||
}
|
}
|
||||||
|
|
||||||
class DialogLayoutScale final : public QDialog
|
class DialogLayoutScale final : public QDialog
|
||||||
|
@ -45,13 +47,13 @@ public:
|
||||||
explicit DialogLayoutScale(bool printTiled, QWidget *parent = nullptr);
|
explicit DialogLayoutScale(bool printTiled, QWidget *parent = nullptr);
|
||||||
~DialogLayoutScale();
|
~DialogLayoutScale();
|
||||||
|
|
||||||
void SetTiledMargins(QMarginsF margins);
|
void SetTiledMargins(QMarginsF margins);
|
||||||
auto GetTiledMargins() const -> QMarginsF;
|
auto GetTiledMargins() const -> QMarginsF;
|
||||||
|
|
||||||
void SetXScale(qreal scale);
|
void SetXScale(qreal scale);
|
||||||
auto GetXScale() const -> qreal;
|
auto GetXScale() const -> qreal;
|
||||||
|
|
||||||
void SetYScale(qreal scale);
|
void SetYScale(qreal scale);
|
||||||
auto GetYScale() const -> qreal;
|
auto GetYScale() const -> qreal;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
|
@ -32,14 +32,17 @@
|
||||||
#include <QComboBox>
|
#include <QComboBox>
|
||||||
#include <QDialog>
|
#include <QDialog>
|
||||||
|
|
||||||
|
#if QT_VERSION < QT_VERSION_CHECK(5, 13, 0)
|
||||||
#include "../vmisc/defglobal.h"
|
#include "../vmisc/defglobal.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
enum class Unit : qint8;
|
enum class Unit : qint8;
|
||||||
|
|
||||||
class VAbstractLayoutDialog : public QDialog
|
class VAbstractLayoutDialog : public QDialog
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
enum class PaperSizeTemplate : qint8 {
|
enum class PaperSizeTemplate : qint8
|
||||||
|
{
|
||||||
A0 = 0,
|
A0 = 0,
|
||||||
A1,
|
A1,
|
||||||
A2,
|
A2,
|
||||||
|
@ -73,7 +76,6 @@ protected:
|
||||||
|
|
||||||
static auto RoundTemplateSize(qreal width, qreal height, Unit unit) -> QSizeF;
|
static auto RoundTemplateSize(qreal width, qreal height, Unit unit) -> QSizeF;
|
||||||
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Q_DISABLE_COPY_MOVE(VAbstractLayoutDialog) // NOLINT
|
Q_DISABLE_COPY_MOVE(VAbstractLayoutDialog) // NOLINT
|
||||||
};
|
};
|
||||||
|
|
|
@ -31,11 +31,13 @@
|
||||||
|
|
||||||
#include <QDialog>
|
#include <QDialog>
|
||||||
|
|
||||||
|
#if QT_VERSION < QT_VERSION_CHECK(5, 13, 0)
|
||||||
#include "../defglobal.h"
|
#include "../defglobal.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
namespace Ui
|
namespace Ui
|
||||||
{
|
{
|
||||||
class DialogExportToCSV;
|
class DialogExportToCSV;
|
||||||
}
|
}
|
||||||
|
|
||||||
class DialogExportToCSV : public QDialog
|
class DialogExportToCSV : public QDialog
|
||||||
|
@ -53,7 +55,7 @@ public:
|
||||||
void SetSelectedMib(int value);
|
void SetSelectedMib(int value);
|
||||||
|
|
||||||
auto GetSeparator() const -> QChar;
|
auto GetSeparator() const -> QChar;
|
||||||
void SetSeparator(const QChar &separator);
|
void SetSeparator(const QChar &separator);
|
||||||
|
|
||||||
void ShowFilePreview(const QString &fileName);
|
void ShowFilePreview(const QString &fileName);
|
||||||
|
|
||||||
|
@ -61,7 +63,7 @@ public:
|
||||||
static auto MakeHelpSeparatorList() -> QString;
|
static auto MakeHelpSeparatorList() -> QString;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual void changeEvent(QEvent* event) override;
|
virtual void changeEvent(QEvent *event) override;
|
||||||
virtual void showEvent(QShowEvent *event) override;
|
virtual void showEvent(QShowEvent *event) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
|
@ -30,7 +30,9 @@
|
||||||
|
|
||||||
#include <QDialog>
|
#include <QDialog>
|
||||||
|
|
||||||
|
#if QT_VERSION < QT_VERSION_CHECK(5, 13, 0)
|
||||||
#include "../defglobal.h"
|
#include "../defglobal.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
namespace Ui
|
namespace Ui
|
||||||
{
|
{
|
||||||
|
|
|
@ -32,7 +32,7 @@
|
||||||
|
|
||||||
#include <QtGlobal>
|
#include <QtGlobal>
|
||||||
#ifdef Q_OS_WIN
|
#ifdef Q_OS_WIN
|
||||||
# include <qt_windows.h>
|
#include <qt_windows.h>
|
||||||
#endif /*Q_OS_WIN*/
|
#endif /*Q_OS_WIN*/
|
||||||
|
|
||||||
#include <QString>
|
#include <QString>
|
||||||
|
@ -41,7 +41,10 @@
|
||||||
#if QT_VERSION < QT_VERSION_CHECK(5, 5, 0)
|
#if QT_VERSION < QT_VERSION_CHECK(5, 5, 0)
|
||||||
#include "../vmisc/diagnostic.h"
|
#include "../vmisc/diagnostic.h"
|
||||||
#endif // QT_VERSION < QT_VERSION_CHECK(5, 5, 0)
|
#endif // QT_VERSION < QT_VERSION_CHECK(5, 5, 0)
|
||||||
|
|
||||||
|
#if QT_VERSION < QT_VERSION_CHECK(5, 13, 0)
|
||||||
#include "../vmisc/defglobal.h"
|
#include "../vmisc/defglobal.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
#include <QFileInfo>
|
#include <QFileInfo>
|
||||||
#include <QLockFile>
|
#include <QLockFile>
|
||||||
|
@ -53,32 +56,30 @@
|
||||||
*
|
*
|
||||||
* On older Qt lock assumed always taken and compile-time warning is shown.
|
* On older Qt lock assumed always taken and compile-time warning is shown.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
template <typename Guarded>
|
template <typename Guarded> class VLockGuard
|
||||||
class VLockGuard
|
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
explicit VLockGuard(const QString& lockName, int stale = 0, int timeout = 0);
|
explicit VLockGuard(const QString &lockName, int stale = 0, int timeout = 0);
|
||||||
|
|
||||||
template <typename Alloc>
|
template <typename Alloc> VLockGuard(const QString &lockName, Alloc a, int stale = 0, int timeout = 0);
|
||||||
VLockGuard(const QString& lockName, Alloc a, int stale = 0, int timeout=0);
|
|
||||||
|
|
||||||
template <typename Alloc, typename Delete>
|
template <typename Alloc, typename Delete>
|
||||||
VLockGuard(const QString& lockName, Alloc a, Delete d, int stale = 0, int timeout=0);
|
VLockGuard(const QString &lockName, Alloc a, Delete d, int stale = 0, int timeout = 0);
|
||||||
|
|
||||||
auto GetProtected() const -> const QSharedPointer<Guarded> &;
|
auto GetProtected() const -> const QSharedPointer<Guarded> &;
|
||||||
auto GetLockError() const -> int;
|
auto GetLockError() const -> int;
|
||||||
auto IsLocked() const -> bool;
|
auto IsLocked() const -> bool;
|
||||||
void Unlock();
|
void Unlock();
|
||||||
auto GetLockFile() const -> QString;
|
auto GetLockFile() const -> QString;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// cppcheck-suppress unknownMacro
|
// cppcheck-suppress unknownMacro
|
||||||
Q_DISABLE_COPY_MOVE(VLockGuard) // NOLINT
|
Q_DISABLE_COPY_MOVE(VLockGuard) // NOLINT
|
||||||
|
|
||||||
QSharedPointer<Guarded> holder;
|
QSharedPointer<Guarded> holder;
|
||||||
int lockError;
|
int lockError;
|
||||||
QString lockFile;
|
QString lockFile;
|
||||||
QSharedPointer<QLockFile> lock;
|
QSharedPointer<QLockFile> lock;
|
||||||
|
|
||||||
auto TryLock(const QString &lockName, int stale, int timeout) -> bool;
|
auto TryLock(const QString &lockName, int stale, int timeout) -> bool;
|
||||||
|
@ -87,7 +88,10 @@ private:
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
template <typename Guarded>
|
template <typename Guarded>
|
||||||
VLockGuard<Guarded>::VLockGuard(const QString &lockName, int stale, int timeout)
|
VLockGuard<Guarded>::VLockGuard(const QString &lockName, int stale, int timeout)
|
||||||
: holder(nullptr), lockError(0), lockFile(), lock(nullptr)
|
: holder(nullptr),
|
||||||
|
lockError(0),
|
||||||
|
lockFile(),
|
||||||
|
lock(nullptr)
|
||||||
{
|
{
|
||||||
if (TryLock(lockName, stale, timeout))
|
if (TryLock(lockName, stale, timeout))
|
||||||
{
|
{
|
||||||
|
@ -96,11 +100,15 @@ VLockGuard<Guarded>::VLockGuard(const QString &lockName, int stale, int timeout)
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
//using allocator lambdas seems logically better than supplying pointer, because we will take ownership of allocated
|
// using allocator lambdas seems logically better than supplying pointer, because we will take ownership of allocated
|
||||||
//object
|
// object
|
||||||
template <typename Guarded> template <typename Alloc>
|
template <typename Guarded>
|
||||||
VLockGuard<Guarded>::VLockGuard(const QString& lockName, Alloc a, int stale, int timeout)
|
template <typename Alloc>
|
||||||
: holder(nullptr), lockError(0), lockFile(), lock(nullptr)
|
VLockGuard<Guarded>::VLockGuard(const QString &lockName, Alloc a, int stale, int timeout)
|
||||||
|
: holder(nullptr),
|
||||||
|
lockError(0),
|
||||||
|
lockFile(),
|
||||||
|
lock(nullptr)
|
||||||
{
|
{
|
||||||
if (TryLock(lockName, stale, timeout))
|
if (TryLock(lockName, stale, timeout))
|
||||||
{
|
{
|
||||||
|
@ -109,9 +117,13 @@ VLockGuard<Guarded>::VLockGuard(const QString& lockName, Alloc a, int stale, int
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
template <typename Guarded> template <typename Alloc, typename Delete>
|
template <typename Guarded>
|
||||||
VLockGuard<Guarded>::VLockGuard(const QString& lockName, Alloc a, Delete d, int stale, int timeout)
|
template <typename Alloc, typename Delete>
|
||||||
: holder(nullptr), lockError(0), lockFile(), lock(nullptr)
|
VLockGuard<Guarded>::VLockGuard(const QString &lockName, Alloc a, Delete d, int stale, int timeout)
|
||||||
|
: holder(nullptr),
|
||||||
|
lockError(0),
|
||||||
|
lockFile(),
|
||||||
|
lock(nullptr)
|
||||||
{
|
{
|
||||||
if (TryLock(lockName, stale, timeout))
|
if (TryLock(lockName, stale, timeout))
|
||||||
{
|
{
|
||||||
|
@ -138,8 +150,7 @@ template <typename Guarded> inline auto VLockGuard<Guarded>::IsLocked() const ->
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
template<typename Guarded>
|
template <typename Guarded> inline void VLockGuard<Guarded>::Unlock()
|
||||||
inline void VLockGuard<Guarded>::Unlock()
|
|
||||||
{
|
{
|
||||||
if (IsLocked())
|
if (IsLocked())
|
||||||
{
|
{
|
||||||
|
@ -191,27 +202,27 @@ template <typename Guarded> auto VLockGuard<Guarded>::TryLock(const QString &loc
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
//use pointer and function below to persistent things like class-member, because lock is taken by constructor
|
// use pointer and function below to persistent things like class-member, because lock is taken by constructor
|
||||||
//helper functions allow to write shorter creating and setting new lock-pointer
|
// helper functions allow to write shorter creating and setting new lock-pointer
|
||||||
|
|
||||||
QT_WARNING_PUSH
|
QT_WARNING_PUSH
|
||||||
QT_WARNING_DISABLE_INTEL(1418)
|
QT_WARNING_DISABLE_INTEL(1418)
|
||||||
|
|
||||||
template <typename Guarded>
|
template <typename Guarded>
|
||||||
void VlpCreateLock(QSharedPointer<VLockGuard<Guarded>>& r, const QString& lockName, int stale = 0, int timeout = 0)
|
void VlpCreateLock(QSharedPointer<VLockGuard<Guarded>> &r, const QString &lockName, int stale = 0, int timeout = 0)
|
||||||
{
|
{
|
||||||
r.reset(new VLockGuard<Guarded>(lockName, stale, timeout));
|
r.reset(new VLockGuard<Guarded>(lockName, stale, timeout));
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename Guarded, typename Alloc>
|
template <typename Guarded, typename Alloc>
|
||||||
void VlpCreateLock(QSharedPointer<VLockGuard<Guarded>>& r, const QString& lockName, Alloc a, int stale = 0,
|
void VlpCreateLock(QSharedPointer<VLockGuard<Guarded>> &r, const QString &lockName, Alloc a, int stale = 0,
|
||||||
int timeout = 0)
|
int timeout = 0)
|
||||||
{
|
{
|
||||||
r.reset(new VLockGuard<Guarded>(lockName, a, stale, timeout));
|
r.reset(new VLockGuard<Guarded>(lockName, a, stale, timeout));
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename Guarded, typename Alloc, typename Del>
|
template <typename Guarded, typename Alloc, typename Del>
|
||||||
void VlpCreateLock(QSharedPointer<VLockGuard<Guarded>>& r, const QString& lockName, Alloc a, Del d, int stale = 0,
|
void VlpCreateLock(QSharedPointer<VLockGuard<Guarded>> &r, const QString &lockName, Alloc a, Del d, int stale = 0,
|
||||||
int timeout = 0)
|
int timeout = 0)
|
||||||
{
|
{
|
||||||
r.reset(new VLockGuard<Guarded>(lockName, a, d, stale, timeout));
|
r.reset(new VLockGuard<Guarded>(lockName, a, d, stale, timeout));
|
||||||
|
|
|
@ -40,14 +40,14 @@
|
||||||
#include <QString>
|
#include <QString>
|
||||||
#include <QTextStream>
|
#include <QTextStream>
|
||||||
#include <QVector>
|
#include <QVector>
|
||||||
#include <QtDebug>
|
|
||||||
#include <Qt>
|
#include <Qt>
|
||||||
|
#include <QtDebug>
|
||||||
|
|
||||||
#if QT_VERSION < QT_VERSION_CHECK(5, 5, 0)
|
#if QT_VERSION < QT_VERSION_CHECK(5, 5, 0)
|
||||||
#include "../vmisc/diagnostic.h"
|
#include "../vmisc/diagnostic.h"
|
||||||
#endif // QT_VERSION < QT_VERSION_CHECK(5, 5, 0)
|
#endif // QT_VERSION < QT_VERSION_CHECK(5, 5, 0)
|
||||||
|
|
||||||
#include "../vmisc/vmath.h"
|
#include "../vmisc/defglobal.h"
|
||||||
|
|
||||||
#if QT_VERSION < QT_VERSION_CHECK(5, 14, 0)
|
#if QT_VERSION < QT_VERSION_CHECK(5, 14, 0)
|
||||||
#include "../vmisc/backport/text.h"
|
#include "../vmisc/backport/text.h"
|
||||||
|
@ -65,28 +65,31 @@ class QRectF;
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
static inline auto svgEngineFeatures() -> QPaintEngine::PaintEngineFeatures
|
static inline auto svgEngineFeatures() -> QPaintEngine::PaintEngineFeatures
|
||||||
{
|
{
|
||||||
QT_WARNING_PUSH
|
QT_WARNING_PUSH
|
||||||
QT_WARNING_DISABLE_CLANG("-Wsign-conversion")
|
QT_WARNING_DISABLE_CLANG("-Wsign-conversion")
|
||||||
// cppcheck-suppress unknownMacro
|
// cppcheck-suppress unknownMacro
|
||||||
QT_WARNING_DISABLE_INTEL(68)
|
QT_WARNING_DISABLE_INTEL(68)
|
||||||
QT_WARNING_DISABLE_INTEL(2022)
|
QT_WARNING_DISABLE_INTEL(2022)
|
||||||
|
|
||||||
return QPaintEngine::PaintEngineFeatures(
|
return QPaintEngine::PaintEngineFeatures(QPaintEngine::AllFeatures & ~QPaintEngine::PatternBrush &
|
||||||
QPaintEngine::AllFeatures
|
~QPaintEngine::PerspectiveTransform & ~QPaintEngine::ConicalGradientFill &
|
||||||
& ~QPaintEngine::PatternBrush
|
~QPaintEngine::PorterDuff);
|
||||||
& ~QPaintEngine::PerspectiveTransform
|
|
||||||
& ~QPaintEngine::ConicalGradientFill
|
|
||||||
& ~QPaintEngine::PorterDuff);
|
|
||||||
|
|
||||||
QT_WARNING_POP
|
QT_WARNING_POP
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
VObjEngine::VObjEngine()
|
VObjEngine::VObjEngine()
|
||||||
:QPaintEngine(svgEngineFeatures()), stream(), globalPointsCount(0), outputDevice(), planeCount(0),
|
: QPaintEngine(svgEngineFeatures()),
|
||||||
size(), resolution(96), matrix()
|
stream(),
|
||||||
|
globalPointsCount(0),
|
||||||
|
outputDevice(),
|
||||||
|
planeCount(0),
|
||||||
|
size(),
|
||||||
|
resolution(96),
|
||||||
|
matrix()
|
||||||
{
|
{
|
||||||
for (int i=0; i < MAX_POINTS; i++)
|
for (int i = 0; i < MAX_POINTS; i++)
|
||||||
{
|
{
|
||||||
points[i].x = 0;
|
points[i].x = 0;
|
||||||
points[i].y = 0;
|
points[i].y = 0;
|
||||||
|
@ -94,7 +97,7 @@ VObjEngine::VObjEngine()
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(Q_CC_INTEL)
|
#if defined(Q_CC_INTEL)
|
||||||
#pragma warning( pop )
|
#pragma warning(pop)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
@ -129,13 +132,13 @@ auto VObjEngine::begin(QPaintDevice *pdev) -> bool
|
||||||
|
|
||||||
if (size.isValid() == false)
|
if (size.isValid() == false)
|
||||||
{
|
{
|
||||||
qWarning()<<"VObjEngine::begin(), size is not valid";
|
qWarning() << "VObjEngine::begin(), size is not valid";
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
stream = QSharedPointer<QTextStream>(new QTextStream(outputDevice.data()));
|
stream = QSharedPointer<QTextStream>(new QTextStream(outputDevice.data()));
|
||||||
*stream << "# Valentina OBJ File" << Qt::endl;
|
*stream << "# Valentina OBJ File" << Qt::endl;
|
||||||
*stream << "# smart-pattern.com.ua/" << Qt::endl;
|
*stream << "# smart-pattern.com.ua/" << Qt::endl;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -155,7 +158,6 @@ void VObjEngine::updateState(const QPaintEngineState &state)
|
||||||
// always stream full gstate, which is not required, but...
|
// always stream full gstate, which is not required, but...
|
||||||
flags |= QPaintEngine::AllDirty;
|
flags |= QPaintEngine::AllDirty;
|
||||||
|
|
||||||
|
|
||||||
if (flags & QPaintEngine::DirtyTransform)
|
if (flags & QPaintEngine::DirtyTransform)
|
||||||
{
|
{
|
||||||
matrix = state.transform(); // Save new matrix for moving paths
|
matrix = state.transform(); // Save new matrix for moving paths
|
||||||
|
@ -166,7 +168,7 @@ void VObjEngine::updateState(const QPaintEngineState &state)
|
||||||
void VObjEngine::drawPath(const QPainterPath &path)
|
void VObjEngine::drawPath(const QPainterPath &path)
|
||||||
{
|
{
|
||||||
QPolygonF polygon = path.toFillPolygon(matrix);
|
QPolygonF polygon = path.toFillPolygon(matrix);
|
||||||
polygon = MakePointsUnique(polygon);// Points must be unique
|
polygon = MakePointsUnique(polygon); // Points must be unique
|
||||||
if (polygon.size() < 3)
|
if (polygon.size() < 3)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
|
@ -181,7 +183,7 @@ void VObjEngine::drawPath(const QPainterPath &path)
|
||||||
|
|
||||||
for (auto &p : polygon)
|
for (auto &p : polygon)
|
||||||
{
|
{
|
||||||
if ( num_points < MAX_POINTS )
|
if (num_points < MAX_POINTS)
|
||||||
{
|
{
|
||||||
points[num_points].x = p.x();
|
points[num_points].x = p.x();
|
||||||
points[num_points].y = p.y();
|
points[num_points].y = p.y();
|
||||||
|
@ -190,47 +192,47 @@ void VObjEngine::drawPath(const QPainterPath &path)
|
||||||
}
|
}
|
||||||
|
|
||||||
int offset = 0;
|
int offset = 0;
|
||||||
delaunay2d_t *res = delaunay2d_from(points, num_points);//Calculate faces
|
delaunay2d_t *res = delaunay2d_from(points, num_points); // Calculate faces
|
||||||
|
|
||||||
QPointF pf[MAX_POINTS];
|
QPointF pf[MAX_POINTS];
|
||||||
// cppcheck-suppress unreadVariable
|
// cppcheck-suppress unreadVariable
|
||||||
bool skipFace=false;//Need skip first face
|
bool skipFace = false; // Need skip first face
|
||||||
|
|
||||||
for (quint32 i = 0; i < res->num_faces; i++ )
|
for (quint32 i = 0; i < res->num_faces; i++)
|
||||||
{
|
{
|
||||||
if (offset == 0)
|
if (offset == 0)
|
||||||
{
|
{
|
||||||
skipFace=true;
|
skipFace = true;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
skipFace=false;
|
skipFace = false;
|
||||||
}
|
}
|
||||||
int num_verts = static_cast<int>(res->faces[offset]);
|
int num_verts = static_cast<int>(res->faces[offset]);
|
||||||
offset++;
|
offset++;
|
||||||
for ( int j = 0; j < num_verts; j++ )
|
for (int j = 0; j < num_verts; j++)
|
||||||
{
|
{
|
||||||
int p0 = static_cast<int>(res->faces[offset + j]);
|
int p0 = static_cast<int>(res->faces[offset + j]);
|
||||||
pf[j] = QPointF(points[p0].x, points[p0].y);
|
pf[j] = QPointF(points[p0].x, points[p0].y);
|
||||||
}
|
}
|
||||||
if (skipFace == false )
|
if (skipFace == false)
|
||||||
{
|
{
|
||||||
QPolygonF face;
|
QPolygonF face;
|
||||||
for ( int ind = 0; ind < num_verts; ind++ )
|
for (int ind = 0; ind < num_verts; ind++)
|
||||||
{
|
{
|
||||||
face << QPointF(pf[ind]);
|
face << QPointF(pf[ind]);
|
||||||
}
|
}
|
||||||
QPolygonF united = polygon.united(face);
|
QPolygonF united = polygon.united(face);
|
||||||
qint64 sqUnited = Square(united);
|
qint64 sqUnited = Square(united);
|
||||||
if (sqUnited <= sq)
|
if (sqUnited <= sq)
|
||||||
{// This face incide our base polygon.
|
{ // This face incide our base polygon.
|
||||||
drawPolygon(pf, num_verts, QPaintEngine::OddEvenMode);
|
drawPolygon(pf, num_verts, QPaintEngine::OddEvenMode);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
offset += num_verts;
|
offset += num_verts;
|
||||||
}
|
}
|
||||||
|
|
||||||
delaunay2d_release(res);//Don't forget release data
|
delaunay2d_release(res); // Don't forget release data
|
||||||
*stream << "s off" << Qt::endl;
|
*stream << "s off" << Qt::endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -266,10 +268,11 @@ void VObjEngine::drawPoints(const QPointF *points, int pointCount)
|
||||||
{
|
{
|
||||||
for (int i = 0; i < pointCount; ++i)
|
for (int i = 0; i < pointCount; ++i)
|
||||||
{
|
{
|
||||||
qreal x = ((points[i].x() - 0)/qFloor(size.width()/2.0)) - 1.0;
|
qreal x = ((points[i].x() - 0) / qFloor(size.width() / 2.0)) - 1.0;
|
||||||
qreal y = (((points[i].y() - 0)/qFloor(size.width()/2.0)) - 1.0)*-1;
|
qreal y = (((points[i].y() - 0) / qFloor(size.width() / 2.0)) - 1.0) * -1;
|
||||||
|
|
||||||
*stream << "v" << " " << QString::number(x, 'f', 6 ) << " " << QString::number(y, 'f', 6 ) << " "
|
*stream << "v"
|
||||||
|
<< " " << QString::number(x, 'f', 6) << " " << QString::number(y, 'f', 6) << " "
|
||||||
<< "0.000000" << Qt::endl;
|
<< "0.000000" << Qt::endl;
|
||||||
++globalPointsCount;
|
++globalPointsCount;
|
||||||
}
|
}
|
||||||
|
@ -355,7 +358,7 @@ auto VObjEngine::Square(const QPolygonF &poly) const -> qint64
|
||||||
qreal s, res = 0;
|
qreal s, res = 0;
|
||||||
qint64 sq = 0;
|
qint64 sq = 0;
|
||||||
|
|
||||||
for (int i=0; i < n; i++)
|
for (int i = 0; i < n; i++)
|
||||||
{
|
{
|
||||||
x.append(poly.at(i).x());
|
x.append(poly.at(i).x());
|
||||||
y.append(poly.at(i).y());
|
y.append(poly.at(i).y());
|
||||||
|
@ -366,23 +369,23 @@ auto VObjEngine::Square(const QPolygonF &poly) const -> qint64
|
||||||
{
|
{
|
||||||
if (i == 0)
|
if (i == 0)
|
||||||
{
|
{
|
||||||
s = x.at(i)*(y.at(n-1) - y.at(i+1)); //if i == 0, then y[i-1] replace on y[n-1]
|
s = x.at(i) * (y.at(n - 1) - y.at(i + 1)); // if i == 0, then y[i-1] replace on y[n-1]
|
||||||
res += s;
|
res += s;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (i == n-1)
|
if (i == n - 1)
|
||||||
{
|
{
|
||||||
s = x.at(i)*(y.at(i-1) - y.at(0)); // if i == n-1, then y[i+1] replace on y[0]
|
s = x.at(i) * (y.at(i - 1) - y.at(0)); // if i == n-1, then y[i+1] replace on y[0]
|
||||||
res += s;
|
res += s;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
s = x.at(i)*(y.at(i-1) - y.at(i+1));
|
s = x.at(i) * (y.at(i - 1) - y.at(i + 1));
|
||||||
res += s;
|
res += s;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
sq = qFloor(qAbs(res/2.0));
|
sq = qFloor(qAbs(res / 2.0));
|
||||||
return sq;
|
return sq;
|
||||||
}
|
}
|
||||||
|
|
|
@ -29,7 +29,6 @@
|
||||||
#ifndef VOBJENGINE_H
|
#ifndef VOBJENGINE_H
|
||||||
#define VOBJENGINE_H
|
#define VOBJENGINE_H
|
||||||
|
|
||||||
|
|
||||||
#include <QPaintEngine>
|
#include <QPaintEngine>
|
||||||
#include <QPolygonF>
|
#include <QPolygonF>
|
||||||
#include <QRectF>
|
#include <QRectF>
|
||||||
|
@ -38,11 +37,13 @@
|
||||||
#include <QtGlobal>
|
#include <QtGlobal>
|
||||||
|
|
||||||
#include "delaunay.h"
|
#include "delaunay.h"
|
||||||
|
#if QT_VERSION < QT_VERSION_CHECK(5, 13, 0)
|
||||||
#include "../vmisc/defglobal.h"
|
#include "../vmisc/defglobal.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
class QTextStream;
|
class QTextStream;
|
||||||
|
|
||||||
#define MAX_POINTS 512
|
#define MAX_POINTS 512
|
||||||
|
|
||||||
class VObjEngine final : public QPaintEngine
|
class VObjEngine final : public QPaintEngine
|
||||||
{
|
{
|
||||||
|
@ -74,13 +75,13 @@ private:
|
||||||
// cppcheck-suppress unknownMacro
|
// cppcheck-suppress unknownMacro
|
||||||
Q_DISABLE_COPY_MOVE(VObjEngine) // NOLINT
|
Q_DISABLE_COPY_MOVE(VObjEngine) // NOLINT
|
||||||
QSharedPointer<QTextStream> stream;
|
QSharedPointer<QTextStream> stream;
|
||||||
quint32 globalPointsCount;
|
quint32 globalPointsCount;
|
||||||
QSharedPointer<QIODevice> outputDevice;
|
QSharedPointer<QIODevice> outputDevice;
|
||||||
del_point2d_t points[MAX_POINTS];
|
del_point2d_t points[MAX_POINTS];
|
||||||
quint32 planeCount;
|
quint32 planeCount;
|
||||||
QSize size;
|
QSize size;
|
||||||
int resolution;
|
int resolution;
|
||||||
QTransform matrix;
|
QTransform matrix;
|
||||||
|
|
||||||
auto MakePointsUnique(const QPolygonF &polygon) const -> QPolygonF;
|
auto MakePointsUnique(const QPolygonF &polygon) const -> QPolygonF;
|
||||||
auto Square(const QPolygonF &poly) const -> qint64;
|
auto Square(const QPolygonF &poly) const -> qint64;
|
||||||
|
|
|
@ -29,14 +29,15 @@
|
||||||
#ifndef VOBJPAINTDEVICE_H
|
#ifndef VOBJPAINTDEVICE_H
|
||||||
#define VOBJPAINTDEVICE_H
|
#define VOBJPAINTDEVICE_H
|
||||||
|
|
||||||
|
|
||||||
#include <QPaintDevice>
|
#include <QPaintDevice>
|
||||||
#include <QSharedPointer>
|
#include <QSharedPointer>
|
||||||
#include <QSize>
|
#include <QSize>
|
||||||
#include <QString>
|
#include <QString>
|
||||||
#include <QtGlobal>
|
#include <QtGlobal>
|
||||||
|
|
||||||
|
#if QT_VERSION < QT_VERSION_CHECK(5, 13, 0)
|
||||||
#include "../vmisc/defglobal.h"
|
#include "../vmisc/defglobal.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
class QIODevice;
|
class QIODevice;
|
||||||
class VObjEngine;
|
class VObjEngine;
|
||||||
|
@ -67,8 +68,8 @@ private:
|
||||||
// cppcheck-suppress unknownMacro
|
// cppcheck-suppress unknownMacro
|
||||||
Q_DISABLE_COPY_MOVE(VObjPaintDevice) // NOLINT
|
Q_DISABLE_COPY_MOVE(VObjPaintDevice) // NOLINT
|
||||||
QSharedPointer<VObjEngine> engine;
|
QSharedPointer<VObjEngine> engine;
|
||||||
QString fileName;
|
QString fileName;
|
||||||
uint owns_iodevice;
|
uint owns_iodevice;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // VOBJPAINTDEVICE_H
|
#endif // VOBJPAINTDEVICE_H
|
||||||
|
|
|
@ -21,7 +21,6 @@
|
||||||
#ifndef VPROPERTYFACTORYMANAGER_H
|
#ifndef VPROPERTYFACTORYMANAGER_H
|
||||||
#define VPROPERTYFACTORYMANAGER_H
|
#define VPROPERTYFACTORYMANAGER_H
|
||||||
|
|
||||||
|
|
||||||
#include <QMetaObject>
|
#include <QMetaObject>
|
||||||
#include <QObject>
|
#include <QObject>
|
||||||
#include <QString>
|
#include <QString>
|
||||||
|
@ -29,7 +28,9 @@
|
||||||
|
|
||||||
#include "vpropertyexplorer_global.h"
|
#include "vpropertyexplorer_global.h"
|
||||||
|
|
||||||
|
#if QT_VERSION < QT_VERSION_CHECK(5, 13, 0)
|
||||||
#include "../vmisc/defglobal.h"
|
#include "../vmisc/defglobal.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
namespace VPE
|
namespace VPE
|
||||||
{
|
{
|
||||||
|
@ -41,9 +42,10 @@ class VPropertyFactoryManagerPrivate;
|
||||||
class VPROPERTYEXPLORERSHARED_EXPORT VPropertyFactoryManager : public QObject
|
class VPROPERTYEXPLORERSHARED_EXPORT VPropertyFactoryManager : public QObject
|
||||||
{
|
{
|
||||||
Q_OBJECT // NOLINT
|
Q_OBJECT // NOLINT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
//! Constructor
|
//! Constructor
|
||||||
explicit VPropertyFactoryManager(QObject* parent = nullptr);
|
explicit VPropertyFactoryManager(QObject *parent = nullptr);
|
||||||
|
|
||||||
//! Destructor
|
//! Destructor
|
||||||
virtual ~VPropertyFactoryManager() override;
|
virtual ~VPropertyFactoryManager() override;
|
||||||
|
@ -51,7 +53,7 @@ public:
|
||||||
//! Register a factory to the factory manager
|
//! Register a factory to the factory manager
|
||||||
//! Note that the manager takes ownership of the factory, so don't delete it.
|
//! Note that the manager takes ownership of the factory, so don't delete it.
|
||||||
//! You can unregister a factory using unregisterFactory()
|
//! You can unregister a factory using unregisterFactory()
|
||||||
void registerFactory(const QString& type, VAbstractPropertyFactory* factory);
|
void registerFactory(const QString &type, VAbstractPropertyFactory *factory);
|
||||||
|
|
||||||
//! Removes a factory from the manager.
|
//! Removes a factory from the manager.
|
||||||
//! \param factory The factory to unregister
|
//! \param factory The factory to unregister
|
||||||
|
@ -59,7 +61,7 @@ public:
|
||||||
//! for are being removed
|
//! for are being removed
|
||||||
//! \param delete_if_unused Determines whether the factory should be deleted, if it not used anymore by this
|
//! \param delete_if_unused Determines whether the factory should be deleted, if it not used anymore by this
|
||||||
//! manager. Default: true. Otherwise, if the factory is unused by this manager, ownership is being passed on.
|
//! manager. Default: true. Otherwise, if the factory is unused by this manager, ownership is being passed on.
|
||||||
void unregisterFactory(VAbstractPropertyFactory* factory, const QString& type = QString(),
|
void unregisterFactory(VAbstractPropertyFactory *factory, const QString &type = QString(),
|
||||||
bool delete_if_unused = true);
|
bool delete_if_unused = true);
|
||||||
|
|
||||||
//! Returns whether a factory is registered (and thus owned) by this factory manager
|
//! Returns whether a factory is registered (and thus owned) by this factory manager
|
||||||
|
@ -80,20 +82,21 @@ public:
|
||||||
const QString &default_value = QString()) -> VProperty *;
|
const QString &default_value = QString()) -> VProperty *;
|
||||||
|
|
||||||
//! Returns the default manager.
|
//! Returns the default manager.
|
||||||
//static VPropertyFactoryManager* getDefaultManager();
|
// static VPropertyFactoryManager* getDefaultManager();
|
||||||
|
|
||||||
//! Returns a list of all supported property types
|
//! Returns a list of all supported property types
|
||||||
auto getSupportedTypes() -> QStringList;
|
auto getSupportedTypes() -> QStringList;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
VPropertyFactoryManagerPrivate* d_ptr;
|
VPropertyFactoryManagerPrivate *d_ptr;
|
||||||
|
|
||||||
//! The default manager
|
//! The default manager
|
||||||
static VPropertyFactoryManager* DefaultManager;
|
static VPropertyFactoryManager *DefaultManager;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Q_DISABLE_COPY_MOVE(VPropertyFactoryManager) // NOLINT
|
Q_DISABLE_COPY_MOVE(VPropertyFactoryManager) // NOLINT
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
} // namespace VPE
|
||||||
|
|
||||||
#endif // VPROPERTYFACTORYMANAGER_H
|
#endif // VPROPERTYFACTORYMANAGER_H
|
||||||
|
|
|
@ -21,7 +21,6 @@
|
||||||
#ifndef VPROPERTYTREEVIEW_H
|
#ifndef VPROPERTYTREEVIEW_H
|
||||||
#define VPROPERTYTREEVIEW_H
|
#define VPROPERTYTREEVIEW_H
|
||||||
|
|
||||||
|
|
||||||
#include <QMetaObject>
|
#include <QMetaObject>
|
||||||
#include <QObject>
|
#include <QObject>
|
||||||
#include <QString>
|
#include <QString>
|
||||||
|
@ -30,7 +29,9 @@
|
||||||
|
|
||||||
#include "vpropertyexplorer_global.h"
|
#include "vpropertyexplorer_global.h"
|
||||||
|
|
||||||
|
#if QT_VERSION < QT_VERSION_CHECK(5, 13, 0)
|
||||||
#include "../vmisc/defglobal.h"
|
#include "../vmisc/defglobal.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
namespace VPE
|
namespace VPE
|
||||||
{
|
{
|
||||||
|
@ -42,13 +43,14 @@ class VPropertyTreeViewPrivate;
|
||||||
class VPROPERTYEXPLORERSHARED_EXPORT VPropertyTreeView : public QTreeView
|
class VPROPERTYEXPLORERSHARED_EXPORT VPropertyTreeView : public QTreeView
|
||||||
{
|
{
|
||||||
Q_OBJECT // NOLINT
|
Q_OBJECT // NOLINT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
//! Default constructor
|
//! Default constructor
|
||||||
explicit VPropertyTreeView(QWidget *parent = nullptr);
|
explicit VPropertyTreeView(QWidget *parent = nullptr);
|
||||||
|
|
||||||
//! The destructor, taking a model and setting it to the tree view
|
//! The destructor, taking a model and setting it to the tree view
|
||||||
//! \param model The model to set as model for this tree view
|
//! \param model The model to set as model for this tree view
|
||||||
explicit VPropertyTreeView(VPropertyModel* model, QWidget *parent = nullptr);
|
explicit VPropertyTreeView(VPropertyModel *model, QWidget *parent = nullptr);
|
||||||
|
|
||||||
//! Destructor
|
//! Destructor
|
||||||
virtual ~VPropertyTreeView() override;
|
virtual ~VPropertyTreeView() override;
|
||||||
|
@ -56,21 +58,20 @@ public:
|
||||||
//! Sets the height for each row. Set this to 0 in order to let the standard delegate decide
|
//! Sets the height for each row. Set this to 0 in order to let the standard delegate decide
|
||||||
void setRowHeight(int height = 0, bool add_to_standard = false);
|
void setRowHeight(int height = 0, bool add_to_standard = false);
|
||||||
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
//! This method is called by the constructors to initialize the view
|
//! This method is called by the constructors to initialize the view
|
||||||
virtual void init();
|
virtual void init();
|
||||||
|
|
||||||
//! protected constructor
|
//! protected constructor
|
||||||
VPropertyTreeView(VPropertyTreeViewPrivate* d, bool init_, QWidget *parent = nullptr);
|
VPropertyTreeView(VPropertyTreeViewPrivate *d, bool init_, QWidget *parent = nullptr);
|
||||||
|
|
||||||
//! The protected data
|
//! The protected data
|
||||||
VPropertyTreeViewPrivate* d_ptr;
|
VPropertyTreeViewPrivate *d_ptr;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Q_DISABLE_COPY_MOVE(VPropertyTreeView) // NOLINT
|
Q_DISABLE_COPY_MOVE(VPropertyTreeView) // NOLINT
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace VPE
|
} // namespace VPE
|
||||||
|
|
||||||
#endif // VPROPERTYTREEVIEWEEVIEW_H
|
#endif // VPROPERTYTREEVIEWEEVIEW_H
|
||||||
|
|
|
@ -32,11 +32,13 @@
|
||||||
#include <QDialog>
|
#include <QDialog>
|
||||||
#include <QMap>
|
#include <QMap>
|
||||||
|
|
||||||
|
#if QT_VERSION < QT_VERSION_CHECK(5, 13, 0)
|
||||||
#include "../vmisc/defglobal.h"
|
#include "../vmisc/defglobal.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
namespace Ui
|
namespace Ui
|
||||||
{
|
{
|
||||||
class DialogEditLabel;
|
class DialogEditLabel;
|
||||||
}
|
}
|
||||||
|
|
||||||
struct VLabelTemplateLine;
|
struct VLabelTemplateLine;
|
||||||
|
@ -77,9 +79,9 @@ private:
|
||||||
// cppcheck-suppress unknownMacro
|
// cppcheck-suppress unknownMacro
|
||||||
Q_DISABLE_COPY_MOVE(DialogEditLabel) // NOLINT
|
Q_DISABLE_COPY_MOVE(DialogEditLabel) // NOLINT
|
||||||
Ui::DialogEditLabel *ui;
|
Ui::DialogEditLabel *ui;
|
||||||
QMenu *m_placeholdersMenu;
|
QMenu *m_placeholdersMenu;
|
||||||
const VAbstractPattern *m_doc;
|
const VAbstractPattern *m_doc;
|
||||||
const VContainer *m_data;
|
const VContainer *m_data;
|
||||||
|
|
||||||
QMap<QString, QPair<QString, QString>> m_placeholders{};
|
QMap<QString, QPair<QString, QString>> m_placeholders{};
|
||||||
|
|
||||||
|
|
|
@ -37,6 +37,10 @@
|
||||||
#include <QTableWidgetItem>
|
#include <QTableWidgetItem>
|
||||||
#include <QtGlobal>
|
#include <QtGlobal>
|
||||||
|
|
||||||
|
#if QT_VERSION < QT_VERSION_CHECK(5, 13, 0)
|
||||||
|
#include "../vmisc/defglobal.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
class VMeasurement;
|
class VMeasurement;
|
||||||
struct FormulaData;
|
struct FormulaData;
|
||||||
class VContainer;
|
class VContainer;
|
||||||
|
|
|
@ -35,6 +35,10 @@
|
||||||
#include <QString>
|
#include <QString>
|
||||||
#include <QtGlobal>
|
#include <QtGlobal>
|
||||||
|
|
||||||
|
#if QT_VERSION < QT_VERSION_CHECK(5, 13, 0)
|
||||||
|
#include "../vmisc/defglobal.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
namespace Ui
|
namespace Ui
|
||||||
{
|
{
|
||||||
class DialogUndo;
|
class DialogUndo;
|
||||||
|
|
|
@ -29,7 +29,6 @@
|
||||||
#ifndef VISTOOLARC_H
|
#ifndef VISTOOLARC_H
|
||||||
#define VISTOOLARC_H
|
#define VISTOOLARC_H
|
||||||
|
|
||||||
|
|
||||||
#include <QGraphicsItem>
|
#include <QGraphicsItem>
|
||||||
#include <QMetaObject>
|
#include <QMetaObject>
|
||||||
#include <QObject>
|
#include <QObject>
|
||||||
|
@ -37,15 +36,18 @@
|
||||||
#include <QtGlobal>
|
#include <QtGlobal>
|
||||||
|
|
||||||
#include "../vmisc/def.h"
|
#include "../vmisc/def.h"
|
||||||
|
#if QT_VERSION < QT_VERSION_CHECK(5, 13, 0)
|
||||||
#include "../vmisc/defglobal.h"
|
#include "../vmisc/defglobal.h"
|
||||||
|
#endif
|
||||||
#include "vispath.h"
|
#include "vispath.h"
|
||||||
|
|
||||||
class VisToolArc final : public VisPath
|
class VisToolArc final : public VisPath
|
||||||
{
|
{
|
||||||
Q_OBJECT // NOLINT
|
Q_OBJECT // NOLINT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit VisToolArc(const VContainer *data, QGraphicsItem *parent = nullptr);
|
explicit VisToolArc(const VContainer *data, QGraphicsItem *parent = nullptr);
|
||||||
~VisToolArc() override =default;
|
~VisToolArc() override = default;
|
||||||
|
|
||||||
void RefreshGeometry() override;
|
void RefreshGeometry() override;
|
||||||
void VisualMode(quint32 id) override;
|
void VisualMode(quint32 id) override;
|
||||||
|
@ -55,8 +57,11 @@ public:
|
||||||
void SetF1(const QString &expression);
|
void SetF1(const QString &expression);
|
||||||
void SetF2(const QString &expression);
|
void SetF2(const QString &expression);
|
||||||
|
|
||||||
auto type() const -> int override {return Type;}
|
auto type() const -> int override { return Type; }
|
||||||
enum {Type = UserType + static_cast<int>(Vis::ToolArc)};
|
enum
|
||||||
|
{
|
||||||
|
Type = UserType + static_cast<int>(Vis::ToolArc)
|
||||||
|
};
|
||||||
|
|
||||||
auto StickyEnd(qreal angle) const -> qreal;
|
auto StickyEnd(qreal angle) const -> qreal;
|
||||||
|
|
||||||
|
@ -64,10 +69,10 @@ private:
|
||||||
Q_DISABLE_COPY_MOVE(VisToolArc) // NOLINT
|
Q_DISABLE_COPY_MOVE(VisToolArc) // NOLINT
|
||||||
VScaledEllipse *m_arcCenter{nullptr};
|
VScaledEllipse *m_arcCenter{nullptr};
|
||||||
VScaledEllipse *m_f1Point{nullptr};
|
VScaledEllipse *m_f1Point{nullptr};
|
||||||
qreal m_radius{0};
|
qreal m_radius{0};
|
||||||
qreal m_f1{-1};
|
qreal m_f1{-1};
|
||||||
qreal m_f2{-1};
|
qreal m_f2{-1};
|
||||||
quint32 m_centerId{NULL_ID};
|
quint32 m_centerId{NULL_ID};
|
||||||
};
|
};
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
|
@ -29,7 +29,6 @@
|
||||||
#ifndef VISTOOLARCWITHLENGTH_H
|
#ifndef VISTOOLARCWITHLENGTH_H
|
||||||
#define VISTOOLARCWITHLENGTH_H
|
#define VISTOOLARCWITHLENGTH_H
|
||||||
|
|
||||||
|
|
||||||
#include <QGraphicsItem>
|
#include <QGraphicsItem>
|
||||||
#include <QMetaObject>
|
#include <QMetaObject>
|
||||||
#include <QObject>
|
#include <QObject>
|
||||||
|
@ -38,14 +37,17 @@
|
||||||
|
|
||||||
#include "../vmisc/def.h"
|
#include "../vmisc/def.h"
|
||||||
#include "vispath.h"
|
#include "vispath.h"
|
||||||
|
#if QT_VERSION < QT_VERSION_CHECK(5, 13, 0)
|
||||||
#include "../vmisc/defglobal.h"
|
#include "../vmisc/defglobal.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
class VisToolArcWithLength final : public VisPath
|
class VisToolArcWithLength final : public VisPath
|
||||||
{
|
{
|
||||||
Q_OBJECT // NOLINT
|
Q_OBJECT // NOLINT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit VisToolArcWithLength(const VContainer *data, QGraphicsItem *parent = nullptr);
|
explicit VisToolArcWithLength(const VContainer *data, QGraphicsItem *parent = nullptr);
|
||||||
~VisToolArcWithLength() override =default;
|
~VisToolArcWithLength() override = default;
|
||||||
|
|
||||||
void RefreshGeometry() override;
|
void RefreshGeometry() override;
|
||||||
void VisualMode(quint32 id) override;
|
void VisualMode(quint32 id) override;
|
||||||
|
@ -55,18 +57,22 @@ public:
|
||||||
void SetF1(const QString &expression);
|
void SetF1(const QString &expression);
|
||||||
void SetLength(const QString &expression);
|
void SetLength(const QString &expression);
|
||||||
|
|
||||||
auto type() const -> int override {return Type;}
|
auto type() const -> int override { return Type; }
|
||||||
enum {Type = UserType + static_cast<int>(Vis::ToolArcWithLength)};
|
enum
|
||||||
|
{
|
||||||
|
Type = UserType + static_cast<int>(Vis::ToolArcWithLength)
|
||||||
|
};
|
||||||
|
|
||||||
static auto CorrectAngle(qreal angle) -> qreal;
|
static auto CorrectAngle(qreal angle) -> qreal;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Q_DISABLE_COPY_MOVE(VisToolArcWithLength) // NOLINT
|
Q_DISABLE_COPY_MOVE(VisToolArcWithLength) // NOLINT
|
||||||
VScaledEllipse *m_arcCenter{nullptr};
|
VScaledEllipse *m_arcCenter{nullptr};
|
||||||
VScaledEllipse *m_f1Point{nullptr};
|
VScaledEllipse *m_f1Point{nullptr};
|
||||||
qreal m_radius{0};
|
qreal m_radius{0};
|
||||||
qreal m_f1{-1};
|
qreal m_f1{-1};
|
||||||
qreal m_length{0};
|
qreal m_length{0};
|
||||||
quint32 m_centerId{NULL_ID};
|
quint32 m_centerId{NULL_ID};
|
||||||
};
|
};
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
|
@ -33,7 +33,9 @@
|
||||||
#include <QIcon>
|
#include <QIcon>
|
||||||
#include <QPropertyAnimation>
|
#include <QPropertyAnimation>
|
||||||
|
|
||||||
|
#if QT_VERSION < QT_VERSION_CHECK(5, 13, 0)
|
||||||
#include "../vmisc/defglobal.h"
|
#include "../vmisc/defglobal.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
class FancyTab final : public QObject
|
class FancyTab final : public QObject
|
||||||
{
|
{
|
||||||
|
@ -41,11 +43,12 @@ class FancyTab final : public QObject
|
||||||
Q_OBJECT // NOLINT
|
Q_OBJECT // NOLINT
|
||||||
|
|
||||||
Q_PROPERTY(double fader READ fader WRITE setFader)
|
Q_PROPERTY(double fader READ fader WRITE setFader)
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit FancyTab(QWidget *tabbar);
|
explicit FancyTab(QWidget *tabbar);
|
||||||
|
|
||||||
auto fader() -> double;
|
auto fader() -> double;
|
||||||
void setFader(double value);
|
void setFader(double value);
|
||||||
|
|
||||||
void fadeIn();
|
void fadeIn();
|
||||||
void fadeOut();
|
void fadeOut();
|
||||||
|
@ -53,13 +56,13 @@ public:
|
||||||
private:
|
private:
|
||||||
// cppcheck-suppress unknownMacro
|
// cppcheck-suppress unknownMacro
|
||||||
Q_DISABLE_COPY_MOVE(FancyTab) // NOLINT
|
Q_DISABLE_COPY_MOVE(FancyTab) // NOLINT
|
||||||
QIcon m_icon;
|
QIcon m_icon;
|
||||||
QString m_text;
|
QString m_text;
|
||||||
QString m_toolTip;
|
QString m_toolTip;
|
||||||
bool m_enabled;
|
bool m_enabled;
|
||||||
QPropertyAnimation m_Animator;
|
QPropertyAnimation m_Animator;
|
||||||
QWidget *m_TabBar;
|
QWidget *m_TabBar;
|
||||||
double m_Fader;
|
double m_Fader;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // FANCYTAB_H
|
#endif // FANCYTAB_H
|
||||||
|
|
|
@ -31,14 +31,15 @@
|
||||||
#define FANCYTABWIDGET_H
|
#define FANCYTABWIDGET_H
|
||||||
|
|
||||||
#include <QIcon>
|
#include <QIcon>
|
||||||
#include <QWidget>
|
|
||||||
#include <QTimer>
|
|
||||||
#include <QPropertyAnimation>
|
#include <QPropertyAnimation>
|
||||||
|
#include <QTimer>
|
||||||
|
#include <QWidget>
|
||||||
|
|
||||||
|
#include "../vmisc/defglobal.h"
|
||||||
|
#include "fancytab.h"
|
||||||
|
|
||||||
class QPainter;
|
class QPainter;
|
||||||
|
|
||||||
#include "fancytab.h"
|
|
||||||
|
|
||||||
class FancyTabBar : public QWidget
|
class FancyTabBar : public QWidget
|
||||||
{
|
{
|
||||||
Q_OBJECT // NOLINT
|
Q_OBJECT // NOLINT
|
||||||
|
@ -69,13 +70,13 @@ public:
|
||||||
void SetCurrentIndex(int index);
|
void SetCurrentIndex(int index);
|
||||||
auto CurrentIndex() const -> int;
|
auto CurrentIndex() const -> int;
|
||||||
|
|
||||||
void SetTabToolTip(int index, const QString &toolTip);
|
void SetTabToolTip(int index, const QString &toolTip);
|
||||||
auto TabToolTip(int index) const -> QString;
|
auto TabToolTip(int index) const -> QString;
|
||||||
|
|
||||||
auto TabIcon(int index) const -> QIcon;
|
auto TabIcon(int index) const -> QIcon;
|
||||||
|
|
||||||
auto TabText(int index) const -> QString;
|
auto TabText(int index) const -> QString;
|
||||||
void SetTabText(int index, const QString &text);
|
void SetTabText(int index, const QString &text);
|
||||||
|
|
||||||
auto Count() const -> vsizetype;
|
auto Count() const -> vsizetype;
|
||||||
auto TabRect(int index) const -> QRect;
|
auto TabRect(int index) const -> QRect;
|
||||||
|
@ -101,16 +102,22 @@ private slots:
|
||||||
private:
|
private:
|
||||||
Q_DISABLE_COPY_MOVE(FancyTabBar) // NOLINT
|
Q_DISABLE_COPY_MOVE(FancyTabBar) // NOLINT
|
||||||
|
|
||||||
enum Corner { OutsideBeginning, OutsideEnd, InsideBeginning, InsideEnd };
|
enum Corner
|
||||||
|
{
|
||||||
|
OutsideBeginning,
|
||||||
|
OutsideEnd,
|
||||||
|
InsideBeginning,
|
||||||
|
InsideEnd
|
||||||
|
};
|
||||||
|
|
||||||
static const int m_rounding;
|
static const int m_rounding;
|
||||||
|
|
||||||
TabBarPosition m_position;
|
TabBarPosition m_position;
|
||||||
QRect m_hoverRect;
|
QRect m_hoverRect;
|
||||||
int m_hoverIndex;
|
int m_hoverIndex;
|
||||||
int m_currentIndex;
|
int m_currentIndex;
|
||||||
QList<FancyTab*> m_attachedTabs;
|
QList<FancyTab *> m_attachedTabs;
|
||||||
QTimer m_timerTriggerChangedSignal;
|
QTimer m_timerTriggerChangedSignal;
|
||||||
|
|
||||||
auto GetCorner(const QRect &rect, const Corner corner) const -> QPoint;
|
auto GetCorner(const QRect &rect, const Corner corner) const -> QPoint;
|
||||||
|
|
||||||
|
@ -122,7 +129,7 @@ private:
|
||||||
-> QPoint;
|
-> QPoint;
|
||||||
|
|
||||||
auto TabSizeHint(bool minimum = false) const -> QSize;
|
auto TabSizeHint(bool minimum = false) const -> QSize;
|
||||||
void PaintTab(QPainter *painter, int tabIndex) const;
|
void PaintTab(QPainter *painter, int tabIndex) const;
|
||||||
auto ValidIndex(int index) const -> bool;
|
auto ValidIndex(int index) const -> bool;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -1,17 +1,17 @@
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
**
|
**
|
||||||
** Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
|
** Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
|
||||||
** All rights reserved.
|
** All rights reserved.
|
||||||
** Contact: Nokia Corporation (qt-info@nokia.com)
|
** Contact: Nokia Corporation (qt-info@nokia.com)
|
||||||
**
|
**
|
||||||
** This file is part of a Qt Solutions component.
|
** This file is part of a Qt Solutions component.
|
||||||
**
|
**
|
||||||
** Commercial Usage
|
** Commercial Usage
|
||||||
** Licensees holding valid Qt Commercial licenses may use this file in
|
** Licensees holding valid Qt Commercial licenses may use this file in
|
||||||
** accordance with the Qt Solutions Commercial License Agreement provided
|
** accordance with the Qt Solutions Commercial License Agreement provided
|
||||||
** with the Software or, alternatively, in accordance with the terms
|
** with the Software or, alternatively, in accordance with the terms
|
||||||
** contained in a written agreement between you and Nokia.
|
** contained in a written agreement between you and Nokia.
|
||||||
**
|
**
|
||||||
** GNU Lesser General Public License Usage
|
** GNU Lesser General Public License Usage
|
||||||
** Alternatively, this file may be used under the terms of the GNU Lesser
|
** Alternatively, this file may be used under the terms of the GNU Lesser
|
||||||
** General Public License version 2.1 as published by the Free Software
|
** General Public License version 2.1 as published by the Free Software
|
||||||
|
@ -19,50 +19,51 @@
|
||||||
** packaging of this file. Please review the following information to
|
** packaging of this file. Please review the following information to
|
||||||
** ensure the GNU Lesser General Public License version 2.1 requirements
|
** ensure the GNU Lesser General Public License version 2.1 requirements
|
||||||
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
||||||
**
|
**
|
||||||
** In addition, as a special exception, Nokia gives you certain
|
** In addition, as a special exception, Nokia gives you certain
|
||||||
** additional rights. These rights are described in the Nokia Qt LGPL
|
** additional rights. These rights are described in the Nokia Qt LGPL
|
||||||
** Exception version 1.1, included in the file LGPL_EXCEPTION.txt in this
|
** Exception version 1.1, included in the file LGPL_EXCEPTION.txt in this
|
||||||
** package.
|
** package.
|
||||||
**
|
**
|
||||||
** GNU General Public License Usage
|
** GNU General Public License Usage
|
||||||
** Alternatively, this file may be used under the terms of the GNU
|
** Alternatively, this file may be used under the terms of the GNU
|
||||||
** General Public License version 3.0 as published by the Free Software
|
** General Public License version 3.0 as published by the Free Software
|
||||||
** Foundation and appearing in the file LICENSE.GPL included in the
|
** Foundation and appearing in the file LICENSE.GPL included in the
|
||||||
** packaging of this file. Please review the following information to
|
** packaging of this file. Please review the following information to
|
||||||
** ensure the GNU General Public License version 3.0 requirements will be
|
** ensure the GNU General Public License version 3.0 requirements will be
|
||||||
** met: http://www.gnu.org/copyleft/gpl.html.
|
** met: http://www.gnu.org/copyleft/gpl.html.
|
||||||
**
|
**
|
||||||
** Please note Third Party Software included with Qt Solutions may impose
|
** Please note Third Party Software included with Qt Solutions may impose
|
||||||
** additional restrictions and it is the user's responsibility to ensure
|
** additional restrictions and it is the user's responsibility to ensure
|
||||||
** that they have met the licensing requirements of the GPL, LGPL, or Qt
|
** that they have met the licensing requirements of the GPL, LGPL, or Qt
|
||||||
** Solutions Commercial license and the relevant license of the Third
|
** Solutions Commercial license and the relevant license of the Third
|
||||||
** Party Software they are using.
|
** Party Software they are using.
|
||||||
**
|
**
|
||||||
** If you are unsure which license is appropriate for your use, please
|
** If you are unsure which license is appropriate for your use, please
|
||||||
** contact Nokia at qt-info@nokia.com.
|
** contact Nokia at qt-info@nokia.com.
|
||||||
**
|
**
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
#include <QApplication>
|
#include <QApplication>
|
||||||
#include <QPainter>
|
|
||||||
#include <QPushButton>
|
|
||||||
#include <QColorDialog>
|
#include <QColorDialog>
|
||||||
#include <QtCore/QMap>
|
|
||||||
#include <QLayout>
|
|
||||||
#include <QStyle>
|
|
||||||
#include <QLabel>
|
|
||||||
#include <QToolTip>
|
|
||||||
#include <QPixmap>
|
|
||||||
#include <QFocusEvent>
|
#include <QFocusEvent>
|
||||||
#include <QPaintEvent>
|
|
||||||
#include <QGridLayout>
|
#include <QGridLayout>
|
||||||
#include <QHideEvent>
|
#include <QHideEvent>
|
||||||
#include <QKeyEvent>
|
#include <QKeyEvent>
|
||||||
#include <QShowEvent>
|
#include <QLabel>
|
||||||
|
#include <QLayout>
|
||||||
#include <QMouseEvent>
|
#include <QMouseEvent>
|
||||||
|
#include <QPaintEvent>
|
||||||
|
#include <QPainter>
|
||||||
|
#include <QPixmap>
|
||||||
|
#include <QPushButton>
|
||||||
|
#include <QShowEvent>
|
||||||
|
#include <QStyle>
|
||||||
|
#include <QToolTip>
|
||||||
|
#include <QtCore/QMap>
|
||||||
#include <cmath>
|
#include <cmath>
|
||||||
|
|
||||||
|
#include "../vmisc/defglobal.h"
|
||||||
#include "qtcolorpicker.h"
|
#include "qtcolorpicker.h"
|
||||||
|
|
||||||
/*! \class QtColorPicker
|
/*! \class QtColorPicker
|
||||||
|
@ -167,8 +168,7 @@ class ColorPickerItem : public QFrame
|
||||||
Q_OBJECT // NOLINT
|
Q_OBJECT // NOLINT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
ColorPickerItem(const QColor &color = Qt::white, const QString &text = QString(),
|
ColorPickerItem(const QColor &color = Qt::white, const QString &text = QString(), QWidget *parent = 0);
|
||||||
QWidget *parent = 0);
|
|
||||||
~ColorPickerItem();
|
~ColorPickerItem();
|
||||||
|
|
||||||
auto color() const -> QColor;
|
auto color() const -> QColor;
|
||||||
|
@ -203,8 +203,7 @@ class ColorPickerPopup : public QFrame
|
||||||
Q_OBJECT // NOLINT
|
Q_OBJECT // NOLINT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
ColorPickerPopup(int width, bool withColorDialog,
|
ColorPickerPopup(int width, bool withColorDialog, QWidget *parent = nullptr);
|
||||||
QWidget *parent = nullptr);
|
|
||||||
~ColorPickerPopup();
|
~ColorPickerPopup();
|
||||||
|
|
||||||
void insertColor(const QColor &col, const QString &text, vsizetype index);
|
void insertColor(const QColor &col, const QString &text, vsizetype index);
|
||||||
|
@ -239,7 +238,7 @@ protected:
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Q_DISABLE_COPY_MOVE(ColorPickerPopup) // NOLINT
|
Q_DISABLE_COPY_MOVE(ColorPickerPopup) // NOLINT
|
||||||
QMap<int, QMap<int, QWidget *> > widgetAt{};
|
QMap<int, QMap<int, QWidget *>> widgetAt{};
|
||||||
QList<ColorPickerItem *> items{};
|
QList<ColorPickerItem *> items{};
|
||||||
QGridLayout *grid{nullptr};
|
QGridLayout *grid{nullptr};
|
||||||
ColorPickerButton *moreButton{nullptr};
|
ColorPickerButton *moreButton{nullptr};
|
||||||
|
@ -268,8 +267,8 @@ private:
|
||||||
\sa QFrame
|
\sa QFrame
|
||||||
*/
|
*/
|
||||||
QtColorPicker::QtColorPicker(QWidget *parent, int columns, bool enableColorDialog)
|
QtColorPicker::QtColorPicker(QWidget *parent, int columns, bool enableColorDialog)
|
||||||
: QPushButton(parent),
|
: QPushButton(parent),
|
||||||
withColorDialog(enableColorDialog)
|
withColorDialog(enableColorDialog)
|
||||||
{
|
{
|
||||||
setFocusPolicy(Qt::StrongFocus);
|
setFocusPolicy(Qt::StrongFocus);
|
||||||
setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Fixed);
|
setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Fixed);
|
||||||
|
@ -287,8 +286,7 @@ QtColorPicker::QtColorPicker(QWidget *parent, int columns, bool enableColorDialo
|
||||||
|
|
||||||
// Create color grid popup and connect to it.
|
// Create color grid popup and connect to it.
|
||||||
popup = new ColorPickerPopup(columns, withColorDialog, this);
|
popup = new ColorPickerPopup(columns, withColorDialog, this);
|
||||||
connect(popup, SIGNAL(selected(const QColor &)),
|
connect(popup, SIGNAL(selected(const QColor &)), SLOT(setCurrentColor(const QColor &)));
|
||||||
SLOT(setCurrentColor(const QColor &)));
|
|
||||||
connect(popup, SIGNAL(hid()), SLOT(popupClosed()));
|
connect(popup, SIGNAL(hid()), SLOT(popupClosed()));
|
||||||
|
|
||||||
// Connect this push button's pressed() signal.
|
// Connect this push button's pressed() signal.
|
||||||
|
@ -316,14 +314,14 @@ void QtColorPicker::buttonPressed(bool toggled)
|
||||||
// Make sure the popup is inside the desktop.
|
// Make sure the popup is inside the desktop.
|
||||||
QPoint pos = rect().bottomLeft();
|
QPoint pos = rect().bottomLeft();
|
||||||
if (pos.x() < desktop.left())
|
if (pos.x() < desktop.left())
|
||||||
pos.setX(desktop.left());
|
pos.setX(desktop.left());
|
||||||
if (pos.y() < desktop.top())
|
if (pos.y() < desktop.top())
|
||||||
pos.setY(desktop.top());
|
pos.setY(desktop.top());
|
||||||
|
|
||||||
if ((pos.x() + popup->sizeHint().width()) > desktop.width())
|
if ((pos.x() + popup->sizeHint().width()) > desktop.width())
|
||||||
pos.setX(desktop.width() - popup->sizeHint().width());
|
pos.setX(desktop.width() - popup->sizeHint().width());
|
||||||
if ((pos.y() + popup->sizeHint().height()) > desktop.bottom())
|
if ((pos.y() + popup->sizeHint().height()) > desktop.bottom())
|
||||||
pos.setY(desktop.bottom() - popup->sizeHint().height());
|
pos.setY(desktop.bottom() - popup->sizeHint().height());
|
||||||
popup->move(mapToGlobal(pos));
|
popup->move(mapToGlobal(pos));
|
||||||
|
|
||||||
if (ColorPickerItem *item = popup->find(col))
|
if (ColorPickerItem *item = popup->find(col))
|
||||||
|
@ -347,15 +345,16 @@ void QtColorPicker::buttonPressed(bool toggled)
|
||||||
*/
|
*/
|
||||||
void QtColorPicker::paintEvent(QPaintEvent *e)
|
void QtColorPicker::paintEvent(QPaintEvent *e)
|
||||||
{
|
{
|
||||||
if (dirty) {
|
if (dirty)
|
||||||
|
{
|
||||||
int iconSize = style()->pixelMetric(QStyle::PM_SmallIconSize);
|
int iconSize = style()->pixelMetric(QStyle::PM_SmallIconSize);
|
||||||
QPixmap pix(iconSize, iconSize);
|
QPixmap pix(iconSize, iconSize);
|
||||||
pix.fill(palette().button().color());
|
pix.fill(palette().button().color());
|
||||||
|
|
||||||
QPainter p(&pix);
|
QPainter p(&pix);
|
||||||
|
|
||||||
int w = pix.width(); // width of cell in pixels
|
int w = pix.width(); // width of cell in pixels
|
||||||
int h = pix.height(); // height of cell in pixels
|
int h = pix.height(); // height of cell in pixels
|
||||||
p.setPen(QPen(Qt::gray));
|
p.setPen(QPen(Qt::gray));
|
||||||
p.setBrush(col);
|
p.setBrush(col);
|
||||||
p.drawRect(2, 2, w - 5, h - 5);
|
p.drawRect(2, 2, w - 5, h - 5);
|
||||||
|
@ -442,7 +441,6 @@ auto QtColorPicker::CustomColors() const -> QVector<QColor>
|
||||||
return customColor;
|
return customColor;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
Makes \a color current. If \a color is not already in the color grid, it
|
Makes \a color current. If \a color is not already in the color grid, it
|
||||||
is inserted with the text "Custom".
|
is inserted with the text "Custom".
|
||||||
|
@ -453,13 +451,13 @@ auto QtColorPicker::CustomColors() const -> QVector<QColor>
|
||||||
void QtColorPicker::setCurrentColor(const QColor &color)
|
void QtColorPicker::setCurrentColor(const QColor &color)
|
||||||
{
|
{
|
||||||
if (col == color || !color.isValid())
|
if (col == color || !color.isValid())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
ColorPickerItem *item = popup->find(color);
|
ColorPickerItem *item = popup->find(color);
|
||||||
if (!item)
|
if (!item)
|
||||||
{
|
{
|
||||||
insertColor(color, tr("Custom"));
|
insertColor(color, tr("Custom"));
|
||||||
item = popup->find(color);
|
item = popup->find(color);
|
||||||
}
|
}
|
||||||
|
|
||||||
col = color;
|
col = color;
|
||||||
|
@ -483,10 +481,11 @@ void QtColorPicker::setCurrentColor(const QColor &color)
|
||||||
void QtColorPicker::insertColor(const QColor &color, const QString &text, int index)
|
void QtColorPicker::insertColor(const QColor &color, const QString &text, int index)
|
||||||
{
|
{
|
||||||
popup->insertColor(color, text, index);
|
popup->insertColor(color, text, index);
|
||||||
if (!firstInserted) {
|
if (!firstInserted)
|
||||||
col = color;
|
{
|
||||||
setText(text);
|
col = color;
|
||||||
firstInserted = true;
|
setText(text);
|
||||||
|
firstInserted = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -517,7 +516,7 @@ auto QtColorPicker::colorDialogEnabled() const -> bool
|
||||||
\code
|
\code
|
||||||
void Drawer::mouseReleaseEvent(QMouseEvent *e)
|
void Drawer::mouseReleaseEvent(QMouseEvent *e)
|
||||||
{
|
{
|
||||||
if (e->button() & RightButton) {
|
if (e->button() & RightButton) {
|
||||||
QColor color = QtColorPicker::getColor(mapToGlobal(e->pos()));
|
QColor color = QtColorPicker::getColor(mapToGlobal(e->pos()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -555,8 +554,8 @@ auto QtColorPicker::getColor(const QPoint &point, bool allowCustomColors) -> QCo
|
||||||
Constructs the popup widget.
|
Constructs the popup widget.
|
||||||
*/
|
*/
|
||||||
ColorPickerPopup::ColorPickerPopup(int width, bool withColorDialog, QWidget *parent)
|
ColorPickerPopup::ColorPickerPopup(int width, bool withColorDialog, QWidget *parent)
|
||||||
: QFrame(parent, Qt::Popup),
|
: QFrame(parent, Qt::Popup),
|
||||||
cols(width)
|
cols(width)
|
||||||
{
|
{
|
||||||
setFrameStyle(QFrame::StyledPanel);
|
setFrameStyle(QFrame::StyledPanel);
|
||||||
setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Minimum);
|
setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Minimum);
|
||||||
|
@ -582,7 +581,6 @@ ColorPickerPopup::ColorPickerPopup(int width, bool withColorDialog, QWidget *par
|
||||||
regenerateGrid();
|
regenerateGrid();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*! \internal
|
/*! \internal
|
||||||
|
|
||||||
Destructs the popup widget.
|
Destructs the popup widget.
|
||||||
|
@ -602,8 +600,8 @@ ColorPickerPopup::~ColorPickerPopup()
|
||||||
*/
|
*/
|
||||||
auto ColorPickerPopup::find(const QColor &col) const -> ColorPickerItem *
|
auto ColorPickerPopup::find(const QColor &col) const -> ColorPickerItem *
|
||||||
{
|
{
|
||||||
auto item = std::find_if(items.begin(), items.end(),
|
auto item =
|
||||||
[col](ColorPickerItem *item){return item && item->color() == col;});
|
std::find_if(items.begin(), items.end(), [col](ColorPickerItem *item) { return item && item->color() == col; });
|
||||||
|
|
||||||
if (item != items.end())
|
if (item != items.end())
|
||||||
{
|
{
|
||||||
|
@ -666,7 +664,7 @@ void ColorPickerPopup::insertColor(const QColor &col, const QString &text, vsize
|
||||||
*/
|
*/
|
||||||
auto ColorPickerPopup::color(int index) const -> QColor
|
auto ColorPickerPopup::color(int index) const -> QColor
|
||||||
{
|
{
|
||||||
if (index < 0 || index > static_cast<int> (items.count() - 1))
|
if (index < 0 || index > static_cast<int>(items.count() - 1))
|
||||||
{
|
{
|
||||||
return QColor();
|
return QColor();
|
||||||
}
|
}
|
||||||
|
@ -675,14 +673,14 @@ auto ColorPickerPopup::color(int index) const -> QColor
|
||||||
return that->items.at(index)->color();
|
return that->items.at(index)->color();
|
||||||
}
|
}
|
||||||
|
|
||||||
auto ColorPickerPopup::CustomItems() const ->QVector<ColorPickerItem *>
|
auto ColorPickerPopup::CustomItems() const -> QVector<ColorPickerItem *>
|
||||||
{
|
{
|
||||||
QVector<ColorPickerItem *> customItems;
|
QVector<ColorPickerItem *> customItems;
|
||||||
customItems.reserve(items.size());
|
customItems.reserve(items.size());
|
||||||
|
|
||||||
for (auto *item : items)
|
for (auto *item : items)
|
||||||
{
|
{
|
||||||
if (item!= nullptr && item->text() == QCoreApplication::translate("ColorPickerPopup", "Custom"))
|
if (item != nullptr && item->text() == QCoreApplication::translate("ColorPickerPopup", "Custom"))
|
||||||
{
|
{
|
||||||
customItems.append(item);
|
customItems.append(item);
|
||||||
}
|
}
|
||||||
|
@ -700,7 +698,7 @@ void ColorPickerPopup::exec()
|
||||||
|
|
||||||
QEventLoop e;
|
QEventLoop e;
|
||||||
eventLoop = &e;
|
eventLoop = &e;
|
||||||
(void) e.exec();
|
(void)e.exec();
|
||||||
eventLoop = nullptr;
|
eventLoop = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -779,7 +777,8 @@ void ColorPickerPopup::keyPressEvent(QKeyEvent *e)
|
||||||
}
|
}
|
||||||
else if (curRow > 0)
|
else if (curRow > 0)
|
||||||
{
|
{
|
||||||
--curRow; curCol = grid->columnCount() - 1;
|
--curRow;
|
||||||
|
curCol = grid->columnCount() - 1;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case Qt::Key_Right:
|
case Qt::Key_Right:
|
||||||
|
@ -789,7 +788,8 @@ void ColorPickerPopup::keyPressEvent(QKeyEvent *e)
|
||||||
}
|
}
|
||||||
else if (curRow < grid->rowCount() - 1)
|
else if (curRow < grid->rowCount() - 1)
|
||||||
{
|
{
|
||||||
++curRow; curCol = 0;
|
++curRow;
|
||||||
|
curCol = 0;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case Qt::Key_Up:
|
case Qt::Key_Up:
|
||||||
|
@ -797,7 +797,8 @@ void ColorPickerPopup::keyPressEvent(QKeyEvent *e)
|
||||||
{
|
{
|
||||||
--curRow;
|
--curRow;
|
||||||
}
|
}
|
||||||
else curCol = 0;
|
else
|
||||||
|
curCol = 0;
|
||||||
break;
|
break;
|
||||||
case Qt::Key_Down:
|
case Qt::Key_Down:
|
||||||
if (curRow < grid->rowCount() - 1)
|
if (curRow < grid->rowCount() - 1)
|
||||||
|
@ -807,15 +808,16 @@ void ColorPickerPopup::keyPressEvent(QKeyEvent *e)
|
||||||
{
|
{
|
||||||
++curRow;
|
++curRow;
|
||||||
}
|
}
|
||||||
else for (int i = 1; i < grid->columnCount(); ++i)
|
else
|
||||||
{
|
for (int i = 1; i < grid->columnCount(); ++i)
|
||||||
if (!widgetAt[curRow + 1][i])
|
|
||||||
{
|
{
|
||||||
curCol = i - 1;
|
if (!widgetAt[curRow + 1][i])
|
||||||
++curRow;
|
{
|
||||||
break;
|
curCol = i - 1;
|
||||||
|
++curRow;
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case Qt::Key_Space:
|
case Qt::Key_Space:
|
||||||
|
@ -878,9 +880,9 @@ void ColorPickerPopup::keyPressEvent(QKeyEvent *e)
|
||||||
case Qt::Key_Escape:
|
case Qt::Key_Escape:
|
||||||
hide();
|
hide();
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
e->ignore();
|
e->ignore();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
widgetAt[curRow][curCol]->setFocus();
|
widgetAt[curRow][curCol]->setFocus();
|
||||||
|
@ -964,7 +966,8 @@ void ColorPickerPopup::regenerateGrid()
|
||||||
// When the number of columns grows, the number of rows will
|
// When the number of columns grows, the number of rows will
|
||||||
// fall. There's no way to shrink a grid, so we create a new
|
// fall. There's no way to shrink a grid, so we create a new
|
||||||
// one.
|
// one.
|
||||||
if (grid) delete grid;
|
if (grid)
|
||||||
|
delete grid;
|
||||||
grid = new QGridLayout(this);
|
grid = new QGridLayout(this);
|
||||||
grid->setContentsMargins(1, 1, 1, 1);
|
grid->setContentsMargins(1, 1, 1, 1);
|
||||||
grid->setSpacing(0);
|
grid->setSpacing(0);
|
||||||
|
@ -1014,9 +1017,11 @@ void ColorPickerPopup::getColorFromDialog()
|
||||||
Constructs a ColorPickerItem whose color is set to \a color, and
|
Constructs a ColorPickerItem whose color is set to \a color, and
|
||||||
whose name is set to \a text.
|
whose name is set to \a text.
|
||||||
*/
|
*/
|
||||||
ColorPickerItem::ColorPickerItem(const QColor &color, const QString &text,
|
ColorPickerItem::ColorPickerItem(const QColor &color, const QString &text, QWidget *parent)
|
||||||
QWidget *parent)
|
: QFrame(parent),
|
||||||
: QFrame(parent), c(color), t(text), sel(false)
|
c(color),
|
||||||
|
t(text),
|
||||||
|
sel(false)
|
||||||
{
|
{
|
||||||
setToolTip(t);
|
setToolTip(t);
|
||||||
setFixedWidth(24);
|
setFixedWidth(24);
|
||||||
|
@ -1111,17 +1116,17 @@ void ColorPickerItem::mousePressEvent(QMouseEvent *)
|
||||||
void ColorPickerItem::paintEvent(QPaintEvent *)
|
void ColorPickerItem::paintEvent(QPaintEvent *)
|
||||||
{
|
{
|
||||||
QPainter p(this);
|
QPainter p(this);
|
||||||
int w = width(); // width of cell in pixels
|
int w = width(); // width of cell in pixels
|
||||||
int h = height(); // height of cell in pixels
|
int h = height(); // height of cell in pixels
|
||||||
|
|
||||||
p.setPen( QPen( Qt::gray, 0, Qt::SolidLine ) );
|
p.setPen(QPen(Qt::gray, 0, Qt::SolidLine));
|
||||||
|
|
||||||
if (sel)
|
if (sel)
|
||||||
{
|
{
|
||||||
p.drawRect(1, 1, w - 3, h - 3);
|
p.drawRect(1, 1, w - 3, h - 3);
|
||||||
}
|
}
|
||||||
|
|
||||||
p.setPen( QPen( Qt::black, 0, Qt::SolidLine ) );
|
p.setPen(QPen(Qt::black, 0, Qt::SolidLine));
|
||||||
p.drawRect(3, 3, w - 7, h - 7);
|
p.drawRect(3, 3, w - 7, h - 7);
|
||||||
p.fillRect(QRect(4, 4, w - 8, h - 8), QBrush(c));
|
p.fillRect(QRect(4, 4, w - 8, h - 8), QBrush(c));
|
||||||
|
|
||||||
|
@ -1135,7 +1140,7 @@ void ColorPickerItem::paintEvent(QPaintEvent *)
|
||||||
|
|
||||||
*/
|
*/
|
||||||
ColorPickerButton::ColorPickerButton(QWidget *parent)
|
ColorPickerButton::ColorPickerButton(QWidget *parent)
|
||||||
: QFrame(parent)
|
: QFrame(parent)
|
||||||
{
|
{
|
||||||
setFrameStyle(StyledPanel);
|
setFrameStyle(StyledPanel);
|
||||||
}
|
}
|
||||||
|
@ -1176,10 +1181,7 @@ void ColorPickerButton::mouseReleaseEvent(QMouseEvent *e)
|
||||||
*/
|
*/
|
||||||
void ColorPickerButton::keyPressEvent(QKeyEvent *e)
|
void ColorPickerButton::keyPressEvent(QKeyEvent *e)
|
||||||
{
|
{
|
||||||
if (e->key() == Qt::Key_Up
|
if (e->key() == Qt::Key_Up || e->key() == Qt::Key_Down || e->key() == Qt::Key_Left || e->key() == Qt::Key_Right)
|
||||||
|| e->key() == Qt::Key_Down
|
|
||||||
|| e->key() == Qt::Key_Left
|
|
||||||
|| e->key() == Qt::Key_Right)
|
|
||||||
{
|
{
|
||||||
QCoreApplication::sendEvent(parent(), e);
|
QCoreApplication::sendEvent(parent(), e);
|
||||||
}
|
}
|
||||||
|
@ -1199,10 +1201,7 @@ void ColorPickerButton::keyPressEvent(QKeyEvent *e)
|
||||||
*/
|
*/
|
||||||
void ColorPickerButton::keyReleaseEvent(QKeyEvent *e)
|
void ColorPickerButton::keyReleaseEvent(QKeyEvent *e)
|
||||||
{
|
{
|
||||||
if (e->key() == Qt::Key_Up
|
if (e->key() == Qt::Key_Up || e->key() == Qt::Key_Down || e->key() == Qt::Key_Left || e->key() == Qt::Key_Right)
|
||||||
|| e->key() == Qt::Key_Down
|
|
||||||
|| e->key() == Qt::Key_Left
|
|
||||||
|| e->key() == Qt::Key_Right)
|
|
||||||
{
|
{
|
||||||
QCoreApplication::sendEvent(parent(), e);
|
QCoreApplication::sendEvent(parent(), e);
|
||||||
}
|
}
|
||||||
|
@ -1216,7 +1215,6 @@ void ColorPickerButton::keyReleaseEvent(QKeyEvent *e)
|
||||||
{
|
{
|
||||||
QFrame::keyReleaseEvent(e);
|
QFrame::keyReleaseEvent(e);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
|
@ -1257,16 +1255,15 @@ void ColorPickerButton::paintEvent(QPaintEvent *e)
|
||||||
p.setPen(pen);
|
p.setPen(pen);
|
||||||
|
|
||||||
p.drawRect(r.center().x() + offset - 4, r.center().y() + offset, 1, 1);
|
p.drawRect(r.center().x() + offset - 4, r.center().y() + offset, 1, 1);
|
||||||
p.drawRect(r.center().x() + offset , r.center().y() + offset, 1, 1);
|
p.drawRect(r.center().x() + offset, r.center().y() + offset, 1, 1);
|
||||||
p.drawRect(r.center().x() + offset + 4, r.center().y() + offset, 1, 1);
|
p.drawRect(r.center().x() + offset + 4, r.center().y() + offset, 1, 1);
|
||||||
if (hasFocus())
|
if (hasFocus())
|
||||||
{
|
{
|
||||||
p.setPen( QPen( Qt::black, 0, Qt::SolidLine ) );
|
p.setPen(QPen(Qt::black, 0, Qt::SolidLine));
|
||||||
p.drawRect(0, 0, width() - 1, height() - 1);
|
p.drawRect(0, 0, width() - 1, height() - 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
p.end();
|
p.end();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#include "qtcolorpicker.moc"
|
#include "qtcolorpicker.moc"
|
||||||
|
|
|
@ -1,17 +1,17 @@
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
**
|
**
|
||||||
** Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
|
** Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
|
||||||
** All rights reserved.
|
** All rights reserved.
|
||||||
** Contact: Nokia Corporation (qt-info@nokia.com)
|
** Contact: Nokia Corporation (qt-info@nokia.com)
|
||||||
**
|
**
|
||||||
** This file is part of a Qt Solutions component.
|
** This file is part of a Qt Solutions component.
|
||||||
**
|
**
|
||||||
** Commercial Usage
|
** Commercial Usage
|
||||||
** Licensees holding valid Qt Commercial licenses may use this file in
|
** Licensees holding valid Qt Commercial licenses may use this file in
|
||||||
** accordance with the Qt Solutions Commercial License Agreement provided
|
** accordance with the Qt Solutions Commercial License Agreement provided
|
||||||
** with the Software or, alternatively, in accordance with the terms
|
** with the Software or, alternatively, in accordance with the terms
|
||||||
** contained in a written agreement between you and Nokia.
|
** contained in a written agreement between you and Nokia.
|
||||||
**
|
**
|
||||||
** GNU Lesser General Public License Usage
|
** GNU Lesser General Public License Usage
|
||||||
** Alternatively, this file may be used under the terms of the GNU Lesser
|
** Alternatively, this file may be used under the terms of the GNU Lesser
|
||||||
** General Public License version 2.1 as published by the Free Software
|
** General Public License version 2.1 as published by the Free Software
|
||||||
|
@ -19,42 +19,44 @@
|
||||||
** packaging of this file. Please review the following information to
|
** packaging of this file. Please review the following information to
|
||||||
** ensure the GNU Lesser General Public License version 2.1 requirements
|
** ensure the GNU Lesser General Public License version 2.1 requirements
|
||||||
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
||||||
**
|
**
|
||||||
** In addition, as a special exception, Nokia gives you certain
|
** In addition, as a special exception, Nokia gives you certain
|
||||||
** additional rights. These rights are described in the Nokia Qt LGPL
|
** additional rights. These rights are described in the Nokia Qt LGPL
|
||||||
** Exception version 1.1, included in the file LGPL_EXCEPTION.txt in this
|
** Exception version 1.1, included in the file LGPL_EXCEPTION.txt in this
|
||||||
** package.
|
** package.
|
||||||
**
|
**
|
||||||
** GNU General Public License Usage
|
** GNU General Public License Usage
|
||||||
** Alternatively, this file may be used under the terms of the GNU
|
** Alternatively, this file may be used under the terms of the GNU
|
||||||
** General Public License version 3.0 as published by the Free Software
|
** General Public License version 3.0 as published by the Free Software
|
||||||
** Foundation and appearing in the file LICENSE.GPL included in the
|
** Foundation and appearing in the file LICENSE.GPL included in the
|
||||||
** packaging of this file. Please review the following information to
|
** packaging of this file. Please review the following information to
|
||||||
** ensure the GNU General Public License version 3.0 requirements will be
|
** ensure the GNU General Public License version 3.0 requirements will be
|
||||||
** met: http://www.gnu.org/copyleft/gpl.html.
|
** met: http://www.gnu.org/copyleft/gpl.html.
|
||||||
**
|
**
|
||||||
** Please note Third Party Software included with Qt Solutions may impose
|
** Please note Third Party Software included with Qt Solutions may impose
|
||||||
** additional restrictions and it is the user's responsibility to ensure
|
** additional restrictions and it is the user's responsibility to ensure
|
||||||
** that they have met the licensing requirements of the GPL, LGPL, or Qt
|
** that they have met the licensing requirements of the GPL, LGPL, or Qt
|
||||||
** Solutions Commercial license and the relevant license of the Third
|
** Solutions Commercial license and the relevant license of the Third
|
||||||
** Party Software they are using.
|
** Party Software they are using.
|
||||||
**
|
**
|
||||||
** If you are unsure which license is appropriate for your use, please
|
** If you are unsure which license is appropriate for your use, please
|
||||||
** contact Nokia at qt-info@nokia.com.
|
** contact Nokia at qt-info@nokia.com.
|
||||||
**
|
**
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
#ifndef QTCOLORPICKER_H
|
#ifndef QTCOLORPICKER_H
|
||||||
#define QTCOLORPICKER_H
|
#define QTCOLORPICKER_H
|
||||||
|
#include <QColor>
|
||||||
#include <QPushButton>
|
#include <QPushButton>
|
||||||
#include <QtCore/QString>
|
#include <QtCore/QString>
|
||||||
#include <QColor>
|
|
||||||
|
|
||||||
|
#include <QFocusEvent>
|
||||||
#include <QLabel>
|
#include <QLabel>
|
||||||
#include <QtCore/QEvent>
|
#include <QtCore/QEvent>
|
||||||
#include <QFocusEvent>
|
|
||||||
|
|
||||||
|
#if QT_VERSION < QT_VERSION_CHECK(5, 13, 0)
|
||||||
#include "../vmisc/defglobal.h"
|
#include "../vmisc/defglobal.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
class ColorPickerPopup;
|
class ColorPickerPopup;
|
||||||
class ColorPickerItem;
|
class ColorPickerItem;
|
||||||
|
@ -66,8 +68,7 @@ class QtColorPicker : public QPushButton
|
||||||
Q_PROPERTY(bool colorDialog READ colorDialogEnabled WRITE setColorDialogEnabled)
|
Q_PROPERTY(bool colorDialog READ colorDialogEnabled WRITE setColorDialogEnabled)
|
||||||
|
|
||||||
public:
|
public:
|
||||||
QtColorPicker(QWidget *parent = 0,
|
QtColorPicker(QWidget *parent = 0, int columns = -1, bool enableColorDialog = true);
|
||||||
int columns = -1, bool enableColorDialog = true);
|
|
||||||
|
|
||||||
~QtColorPicker();
|
~QtColorPicker();
|
||||||
|
|
||||||
|
|
|
@ -30,7 +30,9 @@
|
||||||
|
|
||||||
#include <QFrame>
|
#include <QFrame>
|
||||||
|
|
||||||
|
#if QT_VERSION < QT_VERSION_CHECK(5, 13, 0)
|
||||||
#include "../vmisc/defglobal.h"
|
#include "../vmisc/defglobal.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
class VElidedLabel : public QFrame
|
class VElidedLabel : public QFrame
|
||||||
{
|
{
|
||||||
|
@ -38,32 +40,33 @@ class VElidedLabel : public QFrame
|
||||||
Q_PROPERTY(QString text READ text WRITE setText)
|
Q_PROPERTY(QString text READ text WRITE setText)
|
||||||
Q_PROPERTY(bool IsElided READ IsElided)
|
Q_PROPERTY(bool IsElided READ IsElided)
|
||||||
Q_PROPERTY(bool showElided READ ShowElided WRITE SetShowElided)
|
Q_PROPERTY(bool showElided READ ShowElided WRITE SetShowElided)
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit VElidedLabel(QWidget *parent = nullptr);
|
explicit VElidedLabel(QWidget *parent = nullptr);
|
||||||
explicit VElidedLabel(const QString &text, QWidget *parent = nullptr);
|
explicit VElidedLabel(const QString &text, QWidget *parent = nullptr);
|
||||||
|
|
||||||
void setText(const QString &text);
|
void setText(const QString &text);
|
||||||
auto text() const -> const QString &;
|
auto text() const -> const QString &;
|
||||||
|
|
||||||
auto IsElided() const -> bool;
|
auto IsElided() const -> bool;
|
||||||
|
|
||||||
auto ShowElided() const -> bool;
|
auto ShowElided() const -> bool;
|
||||||
void SetShowElided(bool showElided);
|
void SetShowElided(bool showElided);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual void paintEvent(QPaintEvent *event) override;
|
virtual void paintEvent(QPaintEvent *event) override;
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void ElisionChanged(bool m_elided);
|
void ElisionChanged(bool m_elided);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// cppcheck-suppress unknownMacro
|
// cppcheck-suppress unknownMacro
|
||||||
Q_DISABLE_COPY_MOVE(VElidedLabel) // NOLINT
|
Q_DISABLE_COPY_MOVE(VElidedLabel) // NOLINT
|
||||||
bool m_elided{false};
|
bool m_elided{false};
|
||||||
bool m_showElided{true};
|
bool m_showElided{true};
|
||||||
QString m_content{};
|
QString m_content{};
|
||||||
|
|
||||||
auto DrawParagraph(QPainter &painter, const QString ¶graph, int &y, bool &didElide) -> bool;
|
auto DrawParagraph(QPainter &painter, const QString ¶graph, int &y, bool &didElide) -> bool;
|
||||||
};
|
};
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
|
@ -35,6 +35,8 @@
|
||||||
#include <QtDebug>
|
#include <QtDebug>
|
||||||
#include <chrono>
|
#include <chrono>
|
||||||
|
|
||||||
|
#include "../vmisc/defglobal.h"
|
||||||
|
|
||||||
#if (defined(Q_CC_GNU) && Q_CC_GNU < 409) && !defined(Q_CC_CLANG)
|
#if (defined(Q_CC_GNU) && Q_CC_GNU < 409) && !defined(Q_CC_CLANG)
|
||||||
// DO NOT WORK WITH GCC 4.8
|
// DO NOT WORK WITH GCC 4.8
|
||||||
#else
|
#else
|
||||||
|
@ -51,8 +53,8 @@ namespace
|
||||||
class MultiSelectCompleter : public QCompleter
|
class MultiSelectCompleter : public QCompleter
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
explicit MultiSelectCompleter(QObject* parent=nullptr);
|
explicit MultiSelectCompleter(QObject *parent = nullptr);
|
||||||
virtual ~MultiSelectCompleter() =default;
|
virtual ~MultiSelectCompleter() = default;
|
||||||
|
|
||||||
virtual auto pathFromIndex(const QModelIndex &index) const -> QString override;
|
virtual auto pathFromIndex(const QModelIndex &index) const -> QString override;
|
||||||
virtual auto splitPath(const QString &path) const -> QStringList override;
|
virtual auto splitPath(const QString &path) const -> QStringList override;
|
||||||
|
@ -60,20 +62,21 @@ public:
|
||||||
private:
|
private:
|
||||||
Q_DISABLE_COPY_MOVE(MultiSelectCompleter) // NOLINT
|
Q_DISABLE_COPY_MOVE(MultiSelectCompleter) // NOLINT
|
||||||
};
|
};
|
||||||
}
|
} // namespace
|
||||||
|
|
||||||
//MultiSelectCompleter
|
// MultiSelectCompleter
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
MultiSelectCompleter::MultiSelectCompleter(QObject *parent)
|
MultiSelectCompleter::MultiSelectCompleter(QObject *parent)
|
||||||
: QCompleter(parent)
|
: QCompleter(parent)
|
||||||
{}
|
{
|
||||||
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
auto MultiSelectCompleter::pathFromIndex(const QModelIndex &index) const -> QString
|
auto MultiSelectCompleter::pathFromIndex(const QModelIndex &index) const -> QString
|
||||||
{
|
{
|
||||||
QString path = QCompleter::pathFromIndex(index);
|
QString path = QCompleter::pathFromIndex(index);
|
||||||
|
|
||||||
QString text = static_cast<QLineEdit*>(widget())->text();
|
QString text = static_cast<QLineEdit *>(widget())->text();
|
||||||
|
|
||||||
vsizetype pos = text.lastIndexOf(',');
|
vsizetype pos = text.lastIndexOf(',');
|
||||||
if (pos >= 0)
|
if (pos >= 0)
|
||||||
|
@ -97,18 +100,20 @@ auto MultiSelectCompleter::splitPath(const QString &path) const -> QStringList
|
||||||
return QStringList(path.mid(pos));
|
return QStringList(path.mid(pos));
|
||||||
}
|
}
|
||||||
|
|
||||||
//VLineEdit
|
// VLineEdit
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
VLineEdit::VLineEdit(QWidget *parent)
|
VLineEdit::VLineEdit(QWidget *parent)
|
||||||
: QLineEdit(parent),
|
: QLineEdit(parent),
|
||||||
m_selectOnMousePress(false)
|
m_selectOnMousePress(false)
|
||||||
{}
|
{
|
||||||
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
VLineEdit::VLineEdit(const QString &contents, QWidget *parent)
|
VLineEdit::VLineEdit(const QString &contents, QWidget *parent)
|
||||||
: QLineEdit(contents, parent),
|
: QLineEdit(contents, parent),
|
||||||
m_selectOnMousePress(false)
|
m_selectOnMousePress(false)
|
||||||
{}
|
{
|
||||||
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void VLineEdit::focusInEvent(QFocusEvent *e)
|
void VLineEdit::focusInEvent(QFocusEvent *e)
|
||||||
|
@ -137,7 +142,7 @@ void VLineEdit::focusOutEvent(QFocusEvent *e)
|
||||||
void VLineEdit::mousePressEvent(QMouseEvent *e)
|
void VLineEdit::mousePressEvent(QMouseEvent *e)
|
||||||
{
|
{
|
||||||
QLineEdit::mousePressEvent(e);
|
QLineEdit::mousePressEvent(e);
|
||||||
if(m_selectOnMousePress)
|
if (m_selectOnMousePress)
|
||||||
{
|
{
|
||||||
selectAll();
|
selectAll();
|
||||||
m_selectOnMousePress = false;
|
m_selectOnMousePress = false;
|
||||||
|
@ -147,8 +152,8 @@ void VLineEdit::mousePressEvent(QMouseEvent *e)
|
||||||
// VCompleterLineEdit
|
// VCompleterLineEdit
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
VCompleterLineEdit::VCompleterLineEdit(QWidget *parent)
|
VCompleterLineEdit::VCompleterLineEdit(QWidget *parent)
|
||||||
: VLineEdit(parent),
|
: VLineEdit(parent),
|
||||||
m_model(new QStringListModel(this))
|
m_model(new QStringListModel(this))
|
||||||
{
|
{
|
||||||
setCompleter(new MultiSelectCompleter());
|
setCompleter(new MultiSelectCompleter());
|
||||||
completer()->setModel(m_model);
|
completer()->setModel(m_model);
|
||||||
|
@ -174,7 +179,7 @@ void VCompleterLineEdit::focusInEvent(QFocusEvent *e)
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void VCompleterLineEdit::ShowCompletion()
|
void VCompleterLineEdit::ShowCompletion()
|
||||||
{
|
{
|
||||||
// PrepareCompletion();
|
// PrepareCompletion();
|
||||||
|
|
||||||
// force to show all items when text is empty
|
// force to show all items when text is empty
|
||||||
completer()->setCompletionMode(text().isEmpty() ? QCompleter::UnfilteredPopupCompletion
|
completer()->setCompletionMode(text().isEmpty() ? QCompleter::UnfilteredPopupCompletion
|
||||||
|
|
|
@ -31,21 +31,25 @@
|
||||||
|
|
||||||
#include <QLineEdit>
|
#include <QLineEdit>
|
||||||
|
|
||||||
|
#if QT_VERSION < QT_VERSION_CHECK(5, 13, 0)
|
||||||
#include "../vmisc/defglobal.h"
|
#include "../vmisc/defglobal.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
class QStringListModel;
|
class QStringListModel;
|
||||||
|
|
||||||
class VLineEdit : public QLineEdit
|
class VLineEdit : public QLineEdit
|
||||||
{
|
{
|
||||||
Q_OBJECT // NOLINT
|
Q_OBJECT // NOLINT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit VLineEdit(QWidget * parent = nullptr);
|
explicit VLineEdit(QWidget *parent = nullptr);
|
||||||
explicit VLineEdit(const QString &contents, QWidget *parent = nullptr);
|
explicit VLineEdit(const QString &contents, QWidget *parent = nullptr);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual void focusInEvent(QFocusEvent *e) override;
|
virtual void focusInEvent(QFocusEvent *e) override;
|
||||||
virtual void focusOutEvent(QFocusEvent *e) override;
|
virtual void focusOutEvent(QFocusEvent *e) override;
|
||||||
virtual void mousePressEvent(QMouseEvent *e) override;
|
virtual void mousePressEvent(QMouseEvent *e) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// cppcheck-suppress unknownMacro
|
// cppcheck-suppress unknownMacro
|
||||||
Q_DISABLE_COPY_MOVE(VLineEdit) // NOLINT
|
Q_DISABLE_COPY_MOVE(VLineEdit) // NOLINT
|
||||||
|
@ -60,6 +64,7 @@ private:
|
||||||
class VCompleterLineEdit : public VLineEdit
|
class VCompleterLineEdit : public VLineEdit
|
||||||
{
|
{
|
||||||
Q_OBJECT // NOLINT
|
Q_OBJECT // NOLINT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit VCompleterLineEdit(QWidget *parent = nullptr);
|
explicit VCompleterLineEdit(QWidget *parent = nullptr);
|
||||||
|
|
||||||
|
@ -68,7 +73,7 @@ public:
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual void focusInEvent(QFocusEvent *e) override;
|
virtual void focusInEvent(QFocusEvent *e) override;
|
||||||
virtual void customEvent(QEvent* e) override;
|
virtual void customEvent(QEvent *e) override;
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void ShowCompletion();
|
void ShowCompletion();
|
||||||
|
|
|
@ -29,18 +29,19 @@
|
||||||
#ifndef VMAINGRAPHICSVIEW_H
|
#ifndef VMAINGRAPHICSVIEW_H
|
||||||
#define VMAINGRAPHICSVIEW_H
|
#define VMAINGRAPHICSVIEW_H
|
||||||
|
|
||||||
|
|
||||||
#include <QGraphicsView>
|
#include <QGraphicsView>
|
||||||
#include <QMetaObject>
|
#include <QMetaObject>
|
||||||
#include <QObject>
|
#include <QObject>
|
||||||
#include <QPointF>
|
#include <QPointF>
|
||||||
|
#include <QPointer>
|
||||||
#include <QRectF>
|
#include <QRectF>
|
||||||
#include <QString>
|
#include <QString>
|
||||||
#include <Qt>
|
#include <Qt>
|
||||||
#include <QtGlobal>
|
#include <QtGlobal>
|
||||||
#include <QPointer>
|
|
||||||
|
|
||||||
|
#if QT_VERSION < QT_VERSION_CHECK(5, 13, 0)
|
||||||
#include "../vmisc/defglobal.h"
|
#include "../vmisc/defglobal.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* This class adds ability to zoom QGraphicsView using mouse wheel. The point under cursor
|
* This class adds ability to zoom QGraphicsView using mouse wheel. The point under cursor
|
||||||
|
@ -75,8 +76,9 @@ class QPinchGesture;
|
||||||
class GraphicsViewZoom : public QObject
|
class GraphicsViewZoom : public QObject
|
||||||
{
|
{
|
||||||
Q_OBJECT // NOLINT
|
Q_OBJECT // NOLINT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit GraphicsViewZoom(QGraphicsView* view);
|
explicit GraphicsViewZoom(QGraphicsView *view);
|
||||||
void gentle_zoom(double factor);
|
void gentle_zoom(double factor);
|
||||||
void set_modifiers(Qt::KeyboardModifiers modifiers);
|
void set_modifiers(Qt::KeyboardModifiers modifiers);
|
||||||
void set_zoom_factor_base(double value);
|
void set_zoom_factor_base(double value);
|
||||||
|
@ -87,31 +89,32 @@ public slots:
|
||||||
void VerticalScrollingTime(qreal x);
|
void VerticalScrollingTime(qreal x);
|
||||||
void HorizontalScrollingTime(qreal x);
|
void HorizontalScrollingTime(qreal x);
|
||||||
void animFinished();
|
void animFinished();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual auto eventFilter(QObject *object, QEvent *event) -> bool override;
|
virtual auto eventFilter(QObject *object, QEvent *event) -> bool override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// cppcheck-suppress unknownMacro
|
// cppcheck-suppress unknownMacro
|
||||||
Q_DISABLE_COPY_MOVE(GraphicsViewZoom) // NOLINT
|
Q_DISABLE_COPY_MOVE(GraphicsViewZoom) // NOLINT
|
||||||
QGraphicsView *_view;
|
QGraphicsView *_view;
|
||||||
Qt::KeyboardModifiers _modifiers;
|
Qt::KeyboardModifiers _modifiers;
|
||||||
double _zoom_factor_base;
|
double _zoom_factor_base;
|
||||||
QPointF target_scene_pos;
|
QPointF target_scene_pos;
|
||||||
QPointF target_viewport_pos;
|
QPointF target_viewport_pos;
|
||||||
QPointer<QTimeLine> verticalScrollAnim;
|
QPointer<QTimeLine> verticalScrollAnim;
|
||||||
/** @brief _numScheduledVerticalScrollings keep number scheduled vertical scrollings. */
|
/** @brief _numScheduledVerticalScrollings keep number scheduled vertical scrollings. */
|
||||||
qreal _numScheduledVerticalScrollings;
|
qreal _numScheduledVerticalScrollings;
|
||||||
QPointer<QTimeLine> horizontalScrollAnim;
|
QPointer<QTimeLine> horizontalScrollAnim;
|
||||||
/** @brief _numScheduledHorizontalScrollings keep number scheduled horizontal scrollings. */
|
/** @brief _numScheduledHorizontalScrollings keep number scheduled horizontal scrollings. */
|
||||||
qreal _numScheduledHorizontalScrollings;
|
qreal _numScheduledHorizontalScrollings;
|
||||||
|
|
||||||
void FictiveSceneRect(QGraphicsScene *sc, QGraphicsView *view);
|
void FictiveSceneRect(QGraphicsScene *sc, QGraphicsView *view);
|
||||||
|
|
||||||
void StartVerticalScrollings(QWheelEvent* wheel_event);
|
void StartVerticalScrollings(QWheelEvent *wheel_event);
|
||||||
void StartHorizontalScrollings(QWheelEvent* wheel_event);
|
void StartHorizontalScrollings(QWheelEvent *wheel_event);
|
||||||
|
|
||||||
auto GestureEvent(QGestureEvent *event) -> bool;
|
auto GestureEvent(QGestureEvent *event) -> bool;
|
||||||
void PinchTriggered(QPinchGesture* gesture);
|
void PinchTriggered(QPinchGesture *gesture);
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -120,6 +123,7 @@ private:
|
||||||
class VMainGraphicsView : public QGraphicsView
|
class VMainGraphicsView : public QGraphicsView
|
||||||
{
|
{
|
||||||
Q_OBJECT // NOLINT
|
Q_OBJECT // NOLINT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit VMainGraphicsView(QWidget *parent = nullptr);
|
explicit VMainGraphicsView(QWidget *parent = nullptr);
|
||||||
void setShowToolOptions(bool value);
|
void setShowToolOptions(bool value);
|
||||||
|
@ -150,17 +154,18 @@ signals:
|
||||||
*
|
*
|
||||||
* Usefull when you need show dialog after working with tool visualization.
|
* Usefull when you need show dialog after working with tool visualization.
|
||||||
*/
|
*/
|
||||||
void MouseRelease();
|
void MouseRelease();
|
||||||
void itemClicked(QGraphicsItem *item);
|
void itemClicked(QGraphicsItem *item);
|
||||||
void ScaleChanged(qreal scale);
|
void ScaleChanged(qreal scale);
|
||||||
void ZoomFitBestCurrent();
|
void ZoomFitBestCurrent();
|
||||||
public slots:
|
public slots:
|
||||||
void Zoom(qreal scale);
|
void Zoom(qreal scale);
|
||||||
void ZoomIn();
|
void ZoomIn();
|
||||||
void ZoomOut();
|
void ZoomOut();
|
||||||
void ZoomOriginal();
|
void ZoomOriginal();
|
||||||
void ZoomFitBest();
|
void ZoomFitBest();
|
||||||
void ResetScrollingAnimation();
|
void ResetScrollingAnimation();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void mousePressEvent(QMouseEvent *event) override;
|
void mousePressEvent(QMouseEvent *event) override;
|
||||||
void mouseMoveEvent(QMouseEvent *event) override;
|
void mouseMoveEvent(QMouseEvent *event) override;
|
||||||
|
@ -169,14 +174,15 @@ protected:
|
||||||
void dragEnterEvent(QDragEnterEvent *event) override;
|
void dragEnterEvent(QDragEnterEvent *event) override;
|
||||||
void dragMoveEvent(QDragMoveEvent *event) override;
|
void dragMoveEvent(QDragMoveEvent *event) override;
|
||||||
void dropEvent(QDropEvent *event) override;
|
void dropEvent(QDropEvent *event) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Q_DISABLE_COPY_MOVE(VMainGraphicsView) // NOLINT
|
Q_DISABLE_COPY_MOVE(VMainGraphicsView) // NOLINT
|
||||||
GraphicsViewZoom* zoom;
|
GraphicsViewZoom *zoom;
|
||||||
bool showToolOptions;
|
bool showToolOptions;
|
||||||
bool isAllowRubberBand;
|
bool isAllowRubberBand;
|
||||||
QPoint m_ptStartPos;
|
QPoint m_ptStartPos;
|
||||||
QCursor m_oldCursor;
|
QCursor m_oldCursor;
|
||||||
Qt::CursorShape m_currentCursor;
|
Qt::CursorShape m_currentCursor;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // VMAINGRAPHICSVIEW_H
|
#endif // VMAINGRAPHICSVIEW_H
|
||||||
|
|
|
@ -35,7 +35,9 @@
|
||||||
#include <QString>
|
#include <QString>
|
||||||
#include <QtGlobal>
|
#include <QtGlobal>
|
||||||
|
|
||||||
|
#if QT_VERSION < QT_VERSION_CHECK(5, 13, 0)
|
||||||
#include "../vmisc/defglobal.h"
|
#include "../vmisc/defglobal.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
/**
|
/**
|
||||||
\brief Class showing a widget as popup window.
|
\brief Class showing a widget as popup window.
|
||||||
|
|
|
@ -30,11 +30,14 @@
|
||||||
#define TST_TAPECOMMANDLINE_H
|
#define TST_TAPECOMMANDLINE_H
|
||||||
|
|
||||||
#include "../vtest/abstracttest.h"
|
#include "../vtest/abstracttest.h"
|
||||||
|
#if QT_VERSION < QT_VERSION_CHECK(5, 13, 0)
|
||||||
#include "../vmisc/defglobal.h"
|
#include "../vmisc/defglobal.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
class TST_TapeCommandLine : public AbstractTest
|
class TST_TapeCommandLine : public AbstractTest
|
||||||
{
|
{
|
||||||
Q_OBJECT // NOLINT
|
Q_OBJECT // NOLINT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit TST_TapeCommandLine(QObject *parent = nullptr);
|
explicit TST_TapeCommandLine(QObject *parent = nullptr);
|
||||||
|
|
||||||
|
@ -46,7 +49,6 @@ private slots:
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Q_DISABLE_COPY_MOVE(TST_TapeCommandLine) // NOLINT
|
Q_DISABLE_COPY_MOVE(TST_TapeCommandLine) // NOLINT
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // TST_TAPECOMMANDLINE_H
|
#endif // TST_TAPECOMMANDLINE_H
|
||||||
|
|
|
@ -30,11 +30,14 @@
|
||||||
#define TST_VALENTINACOMMANDLINE_H
|
#define TST_VALENTINACOMMANDLINE_H
|
||||||
|
|
||||||
#include "../vtest/abstracttest.h"
|
#include "../vtest/abstracttest.h"
|
||||||
|
#if QT_VERSION < QT_VERSION_CHECK(5, 13, 0)
|
||||||
#include "../vmisc/defglobal.h"
|
#include "../vmisc/defglobal.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
class TST_ValentinaCommandLine : public AbstractTest
|
class TST_ValentinaCommandLine : public AbstractTest
|
||||||
{
|
{
|
||||||
Q_OBJECT // NOLINT
|
Q_OBJECT // NOLINT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit TST_ValentinaCommandLine(QObject *parent = nullptr);
|
explicit TST_ValentinaCommandLine(QObject *parent = nullptr);
|
||||||
|
|
||||||
|
|
|
@ -30,7 +30,9 @@
|
||||||
#define TST_ABSTRACTREGEXP_H
|
#define TST_ABSTRACTREGEXP_H
|
||||||
|
|
||||||
#include "../vtest/abstracttest.h"
|
#include "../vtest/abstracttest.h"
|
||||||
|
#if QT_VERSION < QT_VERSION_CHECK(5, 13, 0)
|
||||||
#include "../vmisc/defglobal.h"
|
#include "../vmisc/defglobal.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
#include <QPointer>
|
#include <QPointer>
|
||||||
|
|
||||||
|
@ -40,6 +42,7 @@ class VTranslateVars;
|
||||||
class TST_AbstractRegExp : public AbstractTest
|
class TST_AbstractRegExp : public AbstractTest
|
||||||
{
|
{
|
||||||
Q_OBJECT // NOLINT
|
Q_OBJECT // NOLINT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
TST_AbstractRegExp(const QString &locale, QObject *parent = nullptr);
|
TST_AbstractRegExp(const QString &locale, QObject *parent = nullptr);
|
||||||
virtual ~TST_AbstractRegExp();
|
virtual ~TST_AbstractRegExp();
|
||||||
|
@ -49,7 +52,7 @@ protected:
|
||||||
QPointer<QTranslator> m_vTranslator;
|
QPointer<QTranslator> m_vTranslator;
|
||||||
VTranslateVars *m_trMs;
|
VTranslateVars *m_trMs;
|
||||||
|
|
||||||
virtual void PrepareData()=0;
|
virtual void PrepareData() = 0;
|
||||||
virtual auto AllNames() -> QStringList = 0;
|
virtual auto AllNames() -> QStringList = 0;
|
||||||
|
|
||||||
auto LoadVariables(const QString &checkedLocale) -> int;
|
auto LoadVariables(const QString &checkedLocale) -> int;
|
||||||
|
|
|
@ -28,17 +28,20 @@
|
||||||
#ifndef TST_ABSTRACTTRANSLATION_H
|
#ifndef TST_ABSTRACTTRANSLATION_H
|
||||||
#define TST_ABSTRACTTRANSLATION_H
|
#define TST_ABSTRACTTRANSLATION_H
|
||||||
|
|
||||||
#include <QObject>
|
|
||||||
#include <QFile>
|
|
||||||
#include <QSharedPointer>
|
|
||||||
#include <QDomDocument>
|
#include <QDomDocument>
|
||||||
|
#include <QFile>
|
||||||
|
#include <QObject>
|
||||||
|
#include <QSharedPointer>
|
||||||
#include <ciso646>
|
#include <ciso646>
|
||||||
|
|
||||||
|
#if QT_VERSION < QT_VERSION_CHECK(5, 13, 0)
|
||||||
#include "../vmisc/defglobal.h"
|
#include "../vmisc/defglobal.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
class TST_AbstractTranslation : public QObject
|
class TST_AbstractTranslation : public QObject
|
||||||
{
|
{
|
||||||
Q_OBJECT // NOLINT
|
Q_OBJECT // NOLINT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit TST_AbstractTranslation(QObject *parent = nullptr);
|
explicit TST_AbstractTranslation(QObject *parent = nullptr);
|
||||||
|
|
||||||
|
|
|
@ -29,11 +29,13 @@
|
||||||
#ifndef TST_MEASUREMENTREGEXP_H
|
#ifndef TST_MEASUREMENTREGEXP_H
|
||||||
#define TST_MEASUREMENTREGEXP_H
|
#define TST_MEASUREMENTREGEXP_H
|
||||||
|
|
||||||
#include "../vmisc/defglobal.h"
|
|
||||||
#include "tst_abstractregexp.h"
|
|
||||||
|
|
||||||
#include <QPointer>
|
#include <QPointer>
|
||||||
|
|
||||||
|
#if QT_VERSION < QT_VERSION_CHECK(5, 13, 0)
|
||||||
|
#include "../vmisc/defglobal.h"
|
||||||
|
#endif
|
||||||
|
#include "tst_abstractregexp.h"
|
||||||
|
|
||||||
class QTranslator;
|
class QTranslator;
|
||||||
class VTranslateVars;
|
class VTranslateVars;
|
||||||
|
|
||||||
|
@ -41,7 +43,8 @@ class TST_MeasurementRegExp : public TST_AbstractRegExp
|
||||||
{
|
{
|
||||||
Q_OBJECT // NOLINT
|
Q_OBJECT // NOLINT
|
||||||
|
|
||||||
public : TST_MeasurementRegExp(const QString &systemCode, const QString &locale, QObject *parent = nullptr);
|
public:
|
||||||
|
TST_MeasurementRegExp(const QString &systemCode, const QString &locale, QObject *parent = nullptr);
|
||||||
virtual ~TST_MeasurementRegExp();
|
virtual ~TST_MeasurementRegExp();
|
||||||
|
|
||||||
static const QStringList pmSystems;
|
static const QStringList pmSystems;
|
||||||
|
|
|
@ -31,11 +31,14 @@
|
||||||
|
|
||||||
#include <QObject>
|
#include <QObject>
|
||||||
|
|
||||||
|
#if QT_VERSION < QT_VERSION_CHECK(5, 13, 0)
|
||||||
#include "../vmisc/defglobal.h"
|
#include "../vmisc/defglobal.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
class TST_Misc :public QObject
|
class TST_Misc : public QObject
|
||||||
{
|
{
|
||||||
Q_OBJECT // NOLINT
|
Q_OBJECT // NOLINT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit TST_Misc(QObject *parent = nullptr);
|
explicit TST_Misc(QObject *parent = nullptr);
|
||||||
|
|
||||||
|
|
|
@ -32,11 +32,14 @@
|
||||||
#include <QLocale>
|
#include <QLocale>
|
||||||
#include <QObject>
|
#include <QObject>
|
||||||
|
|
||||||
|
#if QT_VERSION < QT_VERSION_CHECK(5, 13, 0)
|
||||||
#include "../vmisc/defglobal.h"
|
#include "../vmisc/defglobal.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
class TST_QmuTokenParser : public QObject
|
class TST_QmuTokenParser : public QObject
|
||||||
{
|
{
|
||||||
Q_OBJECT // NOLINT
|
Q_OBJECT // NOLINT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit TST_QmuTokenParser(QObject *parent = nullptr);
|
explicit TST_QmuTokenParser(QObject *parent = nullptr);
|
||||||
private slots:
|
private slots:
|
||||||
|
@ -45,6 +48,7 @@ private slots:
|
||||||
void TokenFromUser_data();
|
void TokenFromUser_data();
|
||||||
void TokenFromUser();
|
void TokenFromUser();
|
||||||
void cleanupTestCase();
|
void cleanupTestCase();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// cppcheck-suppress unknownMacro
|
// cppcheck-suppress unknownMacro
|
||||||
Q_DISABLE_COPY_MOVE(TST_QmuTokenParser) // NOLINT
|
Q_DISABLE_COPY_MOVE(TST_QmuTokenParser) // NOLINT
|
||||||
|
|
|
@ -31,11 +31,14 @@
|
||||||
|
|
||||||
#include <QObject>
|
#include <QObject>
|
||||||
|
|
||||||
|
#if QT_VERSION < QT_VERSION_CHECK(5, 13, 0)
|
||||||
#include "../vmisc/defglobal.h"
|
#include "../vmisc/defglobal.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
class TST_VCommandLine : public QObject
|
class TST_VCommandLine : public QObject
|
||||||
{
|
{
|
||||||
Q_OBJECT // NOLINT
|
Q_OBJECT // NOLINT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit TST_VCommandLine(QObject *parent = nullptr);
|
explicit TST_VCommandLine(QObject *parent = nullptr);
|
||||||
|
|
||||||
|
|
|
@ -31,11 +31,14 @@
|
||||||
|
|
||||||
#include <QObject>
|
#include <QObject>
|
||||||
|
|
||||||
|
#if QT_VERSION < QT_VERSION_CHECK(5, 13, 0)
|
||||||
#include "../vmisc/defglobal.h"
|
#include "../vmisc/defglobal.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
class TST_VCubicBezierPath : public QObject
|
class TST_VCubicBezierPath : public QObject
|
||||||
{
|
{
|
||||||
Q_OBJECT // NOLINT
|
Q_OBJECT // NOLINT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit TST_VCubicBezierPath(QObject *parent = nullptr);
|
explicit TST_VCubicBezierPath(QObject *parent = nullptr);
|
||||||
|
|
||||||
|
@ -49,7 +52,6 @@ private slots:
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Q_DISABLE_COPY_MOVE(TST_VCubicBezierPath) // NOLINT
|
Q_DISABLE_COPY_MOVE(TST_VCubicBezierPath) // NOLINT
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // TST_VCUBICBEZIERPATH_H
|
#endif // TST_VCUBICBEZIERPATH_H
|
||||||
|
|
|
@ -30,17 +30,21 @@
|
||||||
|
|
||||||
#include <QObject>
|
#include <QObject>
|
||||||
|
|
||||||
|
#if QT_VERSION < QT_VERSION_CHECK(5, 13, 0)
|
||||||
#include "../vmisc/defglobal.h"
|
#include "../vmisc/defglobal.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
class TST_VDomDocument :public QObject
|
class TST_VDomDocument : public QObject
|
||||||
{
|
{
|
||||||
Q_OBJECT // NOLINT
|
Q_OBJECT // NOLINT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit TST_VDomDocument(QObject *parent = nullptr);
|
explicit TST_VDomDocument(QObject *parent = nullptr);
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void TestCompareDomElements_data();
|
void TestCompareDomElements_data();
|
||||||
void TestCompareDomElements();
|
void TestCompareDomElements();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Q_DISABLE_COPY_MOVE(TST_VDomDocument) // NOLINT
|
Q_DISABLE_COPY_MOVE(TST_VDomDocument) // NOLINT
|
||||||
};
|
};
|
||||||
|
|
|
@ -30,11 +30,14 @@
|
||||||
#define TST_VELLIPTICALARC_H
|
#define TST_VELLIPTICALARC_H
|
||||||
|
|
||||||
#include "../vtest/abstracttest.h"
|
#include "../vtest/abstracttest.h"
|
||||||
|
#if QT_VERSION < QT_VERSION_CHECK(5, 13, 0)
|
||||||
#include "../vmisc/defglobal.h"
|
#include "../vmisc/defglobal.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
class TST_VEllipticalArc : public AbstractTest
|
class TST_VEllipticalArc : public AbstractTest
|
||||||
{
|
{
|
||||||
Q_OBJECT // NOLINT
|
Q_OBJECT // NOLINT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit TST_VEllipticalArc(QObject *parent = nullptr);
|
explicit TST_VEllipticalArc(QObject *parent = nullptr);
|
||||||
|
|
||||||
|
|
|
@ -30,11 +30,14 @@
|
||||||
#define TST_VDETAIL_H
|
#define TST_VDETAIL_H
|
||||||
|
|
||||||
#include "../vtest/abstracttest.h"
|
#include "../vtest/abstracttest.h"
|
||||||
|
#if QT_VERSION < QT_VERSION_CHECK(5, 13, 0)
|
||||||
#include "../vmisc/defglobal.h"
|
#include "../vmisc/defglobal.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
class TST_VPiece : public AbstractTest
|
class TST_VPiece : public AbstractTest
|
||||||
{
|
{
|
||||||
Q_OBJECT // NOLINT
|
Q_OBJECT // NOLINT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit TST_VPiece(QObject *parent = nullptr);
|
explicit TST_VPiece(QObject *parent = nullptr);
|
||||||
|
|
||||||
|
|
|
@ -32,16 +32,20 @@
|
||||||
#include <QtCore/QObject>
|
#include <QtCore/QObject>
|
||||||
#include <QtCore/qglobal.h>
|
#include <QtCore/qglobal.h>
|
||||||
|
|
||||||
|
#if QT_VERSION < QT_VERSION_CHECK(5, 13, 0)
|
||||||
#include "../vmisc/defglobal.h"
|
#include "../vmisc/defglobal.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
class TST_VPointF : public QObject
|
class TST_VPointF : public QObject
|
||||||
{
|
{
|
||||||
Q_OBJECT // NOLINT
|
Q_OBJECT // NOLINT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit TST_VPointF(QObject *parent = nullptr);
|
explicit TST_VPointF(QObject *parent = nullptr);
|
||||||
private slots:
|
private slots:
|
||||||
void TestFlip_data();
|
void TestFlip_data();
|
||||||
void TestFlip();
|
void TestFlip();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Q_DISABLE_COPY_MOVE(TST_VPointF) // NOLINT
|
Q_DISABLE_COPY_MOVE(TST_VPointF) // NOLINT
|
||||||
};
|
};
|
||||||
|
|
|
@ -30,13 +30,16 @@
|
||||||
#define TST_VSPLINE_H
|
#define TST_VSPLINE_H
|
||||||
|
|
||||||
#include "../vtest/abstracttest.h"
|
#include "../vtest/abstracttest.h"
|
||||||
|
#if QT_VERSION < QT_VERSION_CHECK(5, 13, 0)
|
||||||
#include "../vmisc/defglobal.h"
|
#include "../vmisc/defglobal.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
class VSpline;
|
class VSpline;
|
||||||
|
|
||||||
class TST_VSpline : public AbstractTest
|
class TST_VSpline : public AbstractTest
|
||||||
{
|
{
|
||||||
Q_OBJECT // NOLINT
|
Q_OBJECT // NOLINT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit TST_VSpline(QObject *parent = nullptr);
|
explicit TST_VSpline(QObject *parent = nullptr);
|
||||||
|
|
||||||
|
|
|
@ -31,11 +31,14 @@
|
||||||
|
|
||||||
#include <QObject>
|
#include <QObject>
|
||||||
|
|
||||||
|
#if QT_VERSION < QT_VERSION_CHECK(5, 13, 0)
|
||||||
#include "../vmisc/defglobal.h"
|
#include "../vmisc/defglobal.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
class TST_VSplinePath : public QObject
|
class TST_VSplinePath : public QObject
|
||||||
{
|
{
|
||||||
Q_OBJECT // NOLINT
|
Q_OBJECT // NOLINT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit TST_VSplinePath(QObject *parent = nullptr);
|
explicit TST_VSplinePath(QObject *parent = nullptr);
|
||||||
private slots:
|
private slots:
|
||||||
|
@ -43,6 +46,7 @@ private slots:
|
||||||
void TestRotation();
|
void TestRotation();
|
||||||
void TestFlip_data();
|
void TestFlip_data();
|
||||||
void TestFlip();
|
void TestFlip();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Q_DISABLE_COPY_MOVE(TST_VSplinePath) // NOLINT
|
Q_DISABLE_COPY_MOVE(TST_VSplinePath) // NOLINT
|
||||||
};
|
};
|
||||||
|
|
|
@ -31,16 +31,20 @@
|
||||||
|
|
||||||
#include <QObject>
|
#include <QObject>
|
||||||
|
|
||||||
|
#if QT_VERSION < QT_VERSION_CHECK(5, 13, 0)
|
||||||
#include "../vmisc/defglobal.h"
|
#include "../vmisc/defglobal.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
class TST_VToolUnionDetails : public QObject
|
class TST_VToolUnionDetails : public QObject
|
||||||
{
|
{
|
||||||
Q_OBJECT // NOLINT
|
Q_OBJECT // NOLINT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit TST_VToolUnionDetails(QObject *parent = nullptr);
|
explicit TST_VToolUnionDetails(QObject *parent = nullptr);
|
||||||
private slots:
|
private slots:
|
||||||
void TestUnitingMainPaths_data();
|
void TestUnitingMainPaths_data();
|
||||||
void TestUnitingMainPaths();
|
void TestUnitingMainPaths();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Q_DISABLE_COPY_MOVE(TST_VToolUnionDetails) // NOLINT
|
Q_DISABLE_COPY_MOVE(TST_VToolUnionDetails) // NOLINT
|
||||||
};
|
};
|
||||||
|
|
|
@ -29,17 +29,20 @@
|
||||||
#ifndef TST_VTRANSLATEVARS_H
|
#ifndef TST_VTRANSLATEVARS_H
|
||||||
#define TST_VTRANSLATEVARS_H
|
#define TST_VTRANSLATEVARS_H
|
||||||
|
|
||||||
#include <QtCore/qglobal.h>
|
|
||||||
#include <QLocale>
|
#include <QLocale>
|
||||||
#include <QObject>
|
#include <QObject>
|
||||||
|
#include <QtCore/qglobal.h>
|
||||||
|
|
||||||
|
#if QT_VERSION < QT_VERSION_CHECK(5, 13, 0)
|
||||||
#include "../vmisc/defglobal.h"
|
#include "../vmisc/defglobal.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
class VTranslateVars;
|
class VTranslateVars;
|
||||||
|
|
||||||
class TST_VTranslateVars : public QObject
|
class TST_VTranslateVars : public QObject
|
||||||
{
|
{
|
||||||
Q_OBJECT // NOLINT
|
Q_OBJECT // NOLINT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit TST_VTranslateVars(QObject *parent = nullptr);
|
explicit TST_VTranslateVars(QObject *parent = nullptr);
|
||||||
private slots:
|
private slots:
|
||||||
|
@ -49,6 +52,7 @@ private slots:
|
||||||
void TestFormulaToUser_data();
|
void TestFormulaToUser_data();
|
||||||
void TestFormulaToUser();
|
void TestFormulaToUser();
|
||||||
void cleanupTestCase();
|
void cleanupTestCase();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// cppcheck-suppress unknownMacro
|
// cppcheck-suppress unknownMacro
|
||||||
Q_DISABLE_COPY_MOVE(TST_VTranslateVars) // NOLINT
|
Q_DISABLE_COPY_MOVE(TST_VTranslateVars) // NOLINT
|
||||||
|
|
Loading…
Reference in New Issue
Block a user