Fix build with MSVC.

This commit is contained in:
Roman Telezhynskyi 2022-11-22 17:01:01 +02:00
parent de664c3aa0
commit 78a123b266
5 changed files with 19 additions and 19 deletions

View File

@ -428,7 +428,7 @@ void VWidgetBackgroundImages::MoveImageOnTop()
if (item != nullptr) if (item != nullptr)
{ {
QUuid id = item->data(Qt::UserRole).toUuid(); QUuid id = item->data(Qt::UserRole).toUuid();
auto *command = new ZValueMoveBackgroundImage(id, ZValueMove::Top, m_doc); auto *command = new ZValueMoveBackgroundImage(id, ZValueMoveType::Top, m_doc);
VAbstractApplication::VApp()->getUndoStack()->push(command); VAbstractApplication::VApp()->getUndoStack()->push(command);
} }
} }
@ -446,7 +446,7 @@ void VWidgetBackgroundImages::MoveImageUp()
if (item != nullptr) if (item != nullptr)
{ {
QUuid id = item->data(Qt::UserRole).toUuid(); QUuid id = item->data(Qt::UserRole).toUuid();
auto *command = new ZValueMoveBackgroundImage(id, ZValueMove::Up, m_doc); auto *command = new ZValueMoveBackgroundImage(id, ZValueMoveType::Up, m_doc);
VAbstractApplication::VApp()->getUndoStack()->push(command); VAbstractApplication::VApp()->getUndoStack()->push(command);
} }
} }
@ -464,7 +464,7 @@ void VWidgetBackgroundImages::MoveImageDown()
if (item != nullptr) if (item != nullptr)
{ {
QUuid id = item->data(Qt::UserRole).toUuid(); QUuid id = item->data(Qt::UserRole).toUuid();
auto *command = new ZValueMoveBackgroundImage(id, ZValueMove::Down, m_doc); auto *command = new ZValueMoveBackgroundImage(id, ZValueMoveType::Down, m_doc);
VAbstractApplication::VApp()->getUndoStack()->push(command); VAbstractApplication::VApp()->getUndoStack()->push(command);
} }
} }
@ -482,7 +482,7 @@ void VWidgetBackgroundImages::MoveImageBottom()
if (item != nullptr) if (item != nullptr)
{ {
QUuid id = item->data(Qt::UserRole).toUuid(); QUuid id = item->data(Qt::UserRole).toUuid();
auto *command = new ZValueMoveBackgroundImage(id, ZValueMove::Bottom, m_doc); auto *command = new ZValueMoveBackgroundImage(id, ZValueMoveType::Bottom, m_doc);
VAbstractApplication::VApp()->getUndoStack()->push(command); VAbstractApplication::VApp()->getUndoStack()->push(command);
} }
} }

View File

@ -525,16 +525,16 @@ void VBackgroundImageItem::keyPressEvent(QKeyEvent *event)
(event->modifiers() & Qt::ControlModifier) ? ScaleImageByFactor(0.5) : ScaleImageByAdjustSize(-2); (event->modifiers() & Qt::ControlModifier) ? ScaleImageByFactor(0.5) : ScaleImageByAdjustSize(-2);
return; return;
case Qt::Key_Home: case Qt::Key_Home:
ZValueMove(static_cast<int>(ZValueMove::Top)); MoveImageZValue(static_cast<int>(ZValueMoveType::Top));
return; return;
case Qt::Key_PageUp: case Qt::Key_PageUp:
ZValueMove(static_cast<int>(ZValueMove::Up)); MoveImageZValue(static_cast<int>(ZValueMoveType::Up));
return; return;
case Qt::Key_PageDown: case Qt::Key_PageDown:
ZValueMove(static_cast<int>(ZValueMove::Down)); MoveImageZValue(static_cast<int>(ZValueMoveType::Down));
return; return;
case Qt::Key_End: case Qt::Key_End:
ZValueMove(static_cast<int>(ZValueMove::Bottom)); MoveImageZValue(static_cast<int>(ZValueMoveType::Bottom));
return; return;
default: default:
break; break;
@ -713,9 +713,9 @@ void VBackgroundImageItem::ScaleImageByFactor(qreal factor)
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
void VBackgroundImageItem::ZValueMove(int move) void VBackgroundImageItem::MoveImageZValue(int move)
{ {
auto zMove = static_cast<enum ZValueMove>(move); auto zMove = static_cast<ZValueMoveType>(move);
VAbstractApplication::VApp()->getUndoStack()->push(new ZValueMoveBackgroundImage(m_image.Id(), zMove, m_doc)); VAbstractApplication::VApp()->getUndoStack()->push(new ZValueMoveBackgroundImage(m_image.Id(), zMove, m_doc));
} }

View File

@ -129,7 +129,7 @@ private:
void RotateImageByAngle(qreal angle); void RotateImageByAngle(qreal angle);
void ScaleImageByAdjustSize(qreal value); void ScaleImageByAdjustSize(qreal value);
void ScaleImageByFactor(qreal factor); void ScaleImageByFactor(qreal factor);
void ZValueMove(int move); void MoveImageZValue(int move);
void UpdateSceneRect(); void UpdateSceneRect();

View File

@ -49,7 +49,7 @@ auto CorrectedZValues(const QList<QVector<QUuid>> &order) -> QHash<QUuid, qreal>
} // namespace } // namespace
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
ZValueMoveBackgroundImage::ZValueMoveBackgroundImage(QUuid id, ZValueMove move, VAbstractPattern *doc, ZValueMoveBackgroundImage::ZValueMoveBackgroundImage(QUuid id, ZValueMoveType move, VAbstractPattern *doc,
QUndoCommand *parent) QUndoCommand *parent)
: VUndoCommand(QDomElement(), doc, parent), : VUndoCommand(QDomElement(), doc, parent),
m_id(id), m_id(id),
@ -112,12 +112,12 @@ void ZValueMoveBackgroundImage::redo()
QList<QVector<QUuid>> order; QList<QVector<QUuid>> order;
if (m_move == ZValueMove::Top) if (m_move == ZValueMoveType::Top)
{ {
order = Levels(images, true); order = Levels(images, true);
order.prepend({m_id}); order.prepend({m_id});
} }
else if (m_move == ZValueMove::Up) else if (m_move == ZValueMoveType::Up)
{ {
for (auto &image: images) for (auto &image: images)
{ {
@ -129,7 +129,7 @@ void ZValueMoveBackgroundImage::redo()
order = Levels(images, false); order = Levels(images, false);
} }
else if (m_move == ZValueMove::Down) else if (m_move == ZValueMoveType::Down)
{ {
for (auto &image: images) for (auto &image: images)
{ {
@ -141,7 +141,7 @@ void ZValueMoveBackgroundImage::redo()
order = Levels(images, false); order = Levels(images, false);
} }
else if (m_move == ZValueMove::Bottom) else if (m_move == ZValueMoveType::Bottom)
{ {
order = Levels(images, true); order = Levels(images, true);
order.append({m_id}); order.append({m_id});

View File

@ -34,7 +34,7 @@
#include "../vmisc/defglobal.h" #include "../vmisc/defglobal.h"
#endif // QT_VERSION < QT_VERSION_CHECK(5, 13, 0) #endif // QT_VERSION < QT_VERSION_CHECK(5, 13, 0)
enum class ZValueMove enum class ZValueMoveType
{ {
Top, Top,
Up, Up,
@ -45,7 +45,7 @@ enum class ZValueMove
class ZValueMoveBackgroundImage : public VUndoCommand class ZValueMoveBackgroundImage : public VUndoCommand
{ {
public: public:
ZValueMoveBackgroundImage(QUuid id, ZValueMove move, VAbstractPattern *doc, QUndoCommand *parent = nullptr); ZValueMoveBackgroundImage(QUuid id, ZValueMoveType move, VAbstractPattern *doc, QUndoCommand *parent = nullptr);
~ZValueMoveBackgroundImage() override =default; ~ZValueMoveBackgroundImage() override =default;
void undo() override; void undo() override;
void redo() override; void redo() override;
@ -53,7 +53,7 @@ private:
// cppcheck-suppress unknownMacro // cppcheck-suppress unknownMacro
Q_DISABLE_COPY_MOVE(ZValueMoveBackgroundImage) // NOLINT Q_DISABLE_COPY_MOVE(ZValueMoveBackgroundImage) // NOLINT
QUuid m_id; QUuid m_id;
ZValueMove m_move; ZValueMoveType m_move;
QHash<QUuid, qreal> m_oldValues{}; QHash<QUuid, qreal> m_oldValues{};
}; };