Refactoring.
Code style.
This commit is contained in:
parent
807964e019
commit
bc1f47921f
|
@ -27,16 +27,16 @@
|
||||||
*************************************************************************/
|
*************************************************************************/
|
||||||
#include "vpcarrousel.h"
|
#include "vpcarrousel.h"
|
||||||
#include "ui_vpcarrousel.h"
|
#include "ui_vpcarrousel.h"
|
||||||
#include <QVBoxLayout>
|
#include <QFontMetrics>
|
||||||
#include <QMessageBox>
|
#include <QMessageBox>
|
||||||
#include <QScrollBar>
|
#include <QScrollBar>
|
||||||
#include <QFontMetrics>
|
#include <QVBoxLayout>
|
||||||
|
|
||||||
#if QT_VERSION < QT_VERSION_CHECK(5, 7, 0)
|
#if QT_VERSION < QT_VERSION_CHECK(5, 7, 0)
|
||||||
#include "../vmisc/backport/qoverload.h"
|
#include "../vmisc/backport/qoverload.h"
|
||||||
#endif // QT_VERSION < QT_VERSION_CHECK(5, 7, 0)
|
#endif // QT_VERSION < QT_VERSION_CHECK(5, 7, 0)
|
||||||
#include "../layout/vpsheet.h"
|
|
||||||
#include "../layout/vplayout.h"
|
#include "../layout/vplayout.h"
|
||||||
|
#include "../layout/vpsheet.h"
|
||||||
|
|
||||||
#include <QLoggingCategory>
|
#include <QLoggingCategory>
|
||||||
#include <QMenu>
|
#include <QMenu>
|
||||||
|
@ -51,8 +51,8 @@ Q_LOGGING_CATEGORY(pCarrousel, "p.carrousel") // NOLINT
|
||||||
QT_WARNING_POP
|
QT_WARNING_POP
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
VPCarrousel::VPCarrousel(const VPLayoutPtr &layout, QWidget *parent) :
|
VPCarrousel::VPCarrousel(const VPLayoutPtr &layout, QWidget *parent)
|
||||||
QWidget(parent),
|
: QWidget(parent),
|
||||||
ui(new Ui::VPCarrousel),
|
ui(new Ui::VPCarrousel),
|
||||||
m_layout(layout)
|
m_layout(layout)
|
||||||
{
|
{
|
||||||
|
|
|
@ -27,17 +27,17 @@
|
||||||
*************************************************************************/
|
*************************************************************************/
|
||||||
|
|
||||||
#include "vplayout.h"
|
#include "vplayout.h"
|
||||||
#include "vppiece.h"
|
#include "../ifc/exception/vexception.h"
|
||||||
#include "vpsheet.h"
|
|
||||||
#include "../vpapplication.h"
|
|
||||||
#include "../vptilefactory.h"
|
|
||||||
#include "../ifc/xml/vwatermarkconverter.h"
|
#include "../ifc/xml/vwatermarkconverter.h"
|
||||||
#include "../vformat/vwatermark.h"
|
#include "../vformat/vwatermark.h"
|
||||||
#include "../ifc/exception/vexception.h"
|
#include "../vpapplication.h"
|
||||||
|
#include "../vptilefactory.h"
|
||||||
|
#include "vppiece.h"
|
||||||
|
#include "vpsheet.h"
|
||||||
|
|
||||||
#include <QLoggingCategory>
|
#include <QLoggingCategory>
|
||||||
#include <QUndoStack>
|
|
||||||
#include <QPixmapCache>
|
#include <QPixmapCache>
|
||||||
|
#include <QUndoStack>
|
||||||
|
|
||||||
QT_WARNING_PUSH
|
QT_WARNING_PUSH
|
||||||
QT_WARNING_DISABLE_CLANG("-Wmissing-prototypes")
|
QT_WARNING_DISABLE_CLANG("-Wmissing-prototypes")
|
||||||
|
@ -48,10 +48,10 @@ Q_LOGGING_CATEGORY(pLayout, "p.layout") // NOLINT
|
||||||
QT_WARNING_POP
|
QT_WARNING_POP
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
VPLayout::VPLayout(QUndoStack *undoStack) :
|
VPLayout::VPLayout(QUndoStack *undoStack)
|
||||||
m_undoStack(undoStack)
|
: m_undoStack(undoStack)
|
||||||
{
|
{
|
||||||
SCASSERT(m_undoStack != nullptr)
|
SCASSERT(m_undoStack != nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
@ -60,6 +60,7 @@ VPLayout::~VPLayout()
|
||||||
delete m_tileFactory;
|
delete m_tileFactory;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
auto VPLayout::CreateLayout(QUndoStack *undoStack) -> VPLayoutPtr
|
auto VPLayout::CreateLayout(QUndoStack *undoStack) -> VPLayoutPtr
|
||||||
{
|
{
|
||||||
SCASSERT(undoStack != nullptr)
|
SCASSERT(undoStack != nullptr)
|
||||||
|
@ -79,8 +80,8 @@ auto VPLayout::CreateLayout(QUndoStack *undoStack) -> VPLayoutPtr
|
||||||
|
|
||||||
layout->LayoutSettings().SetShowTiles(settings->GetLayoutTileShowTiles());
|
layout->LayoutSettings().SetShowTiles(settings->GetLayoutTileShowTiles());
|
||||||
layout->LayoutSettings().SetShowWatermark(settings->GetLayoutTileShowWatermark());
|
layout->LayoutSettings().SetShowWatermark(settings->GetLayoutTileShowWatermark());
|
||||||
layout->LayoutSettings().SetTilesSize(QSizeF(settings->GetLayoutTilePaperWidth(),
|
layout->LayoutSettings().SetTilesSize(
|
||||||
settings->GetLayoutTilePaperHeight()));
|
QSizeF(settings->GetLayoutTilePaperWidth(), settings->GetLayoutTilePaperHeight()));
|
||||||
layout->LayoutSettings().SetIgnoreTilesMargins(settings->GetLayoutTileIgnoreMargins());
|
layout->LayoutSettings().SetIgnoreTilesMargins(settings->GetLayoutTileIgnoreMargins());
|
||||||
layout->LayoutSettings().SetTilesMargins(settings->GetLayoutTileMargins());
|
layout->LayoutSettings().SetTilesMargins(settings->GetLayoutTileMargins());
|
||||||
|
|
||||||
|
@ -204,7 +205,8 @@ auto VPLayout::IsSheetsUniform() const -> bool
|
||||||
|
|
||||||
QSizeF sheetSize = sheet->GetSheetSize().toSize();
|
QSizeF sheetSize = sheet->GetSheetSize().toSize();
|
||||||
|
|
||||||
return std::all_of(sheets.begin(), sheets.end(), [sheetSize](const VPSheetPtr &sheet)
|
return std::all_of(sheets.begin(), sheets.end(),
|
||||||
|
[sheetSize](const VPSheetPtr &sheet)
|
||||||
{
|
{
|
||||||
if (sheet.isNull())
|
if (sheet.isNull())
|
||||||
{
|
{
|
||||||
|
|
|
@ -32,8 +32,8 @@
|
||||||
#include <QMap>
|
#include <QMap>
|
||||||
#include <QUuid>
|
#include <QUuid>
|
||||||
|
|
||||||
#include "vplayoutsettings.h"
|
|
||||||
#include "layoutdef.h"
|
#include "layoutdef.h"
|
||||||
|
#include "vplayoutsettings.h"
|
||||||
|
|
||||||
class VPPiece;
|
class VPPiece;
|
||||||
class VPSheet;
|
class VPSheet;
|
||||||
|
@ -44,6 +44,7 @@ struct VWatermarkData;
|
||||||
class VPLayout : public QObject
|
class VPLayout : public QObject
|
||||||
{
|
{
|
||||||
Q_OBJECT // NOLINT
|
Q_OBJECT // NOLINT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
~VPLayout() override;
|
~VPLayout() override;
|
||||||
|
|
||||||
|
|
|
@ -27,15 +27,14 @@
|
||||||
*************************************************************************/
|
*************************************************************************/
|
||||||
#include "vpsheet.h"
|
#include "vpsheet.h"
|
||||||
|
|
||||||
#include "vplayout.h"
|
#include "../scene/vpgraphicspiece.h"
|
||||||
#include "vppiece.h"
|
#include "../scene/vpgraphicspiececontrols.h"
|
||||||
|
#include "../scene/vpgraphicssheet.h"
|
||||||
|
#include "../scene/vpgraphicstilegrid.h"
|
||||||
#include "../vpapplication.h"
|
#include "../vpapplication.h"
|
||||||
#include "../vwidgets/vmaingraphicsscene.h"
|
#include "../vwidgets/vmaingraphicsscene.h"
|
||||||
#include "../scene/vpgraphicssheet.h"
|
#include "vplayout.h"
|
||||||
#include "../scene/vpgraphicspiece.h"
|
#include "vppiece.h"
|
||||||
#include "../scene/vpgraphicstilegrid.h"
|
|
||||||
#include "../scene/vpgraphicspiececontrols.h"
|
|
||||||
#include "../scene/vpgraphicstilegrid.h"
|
|
||||||
|
|
||||||
// VPSheetSceneData
|
// VPSheetSceneData
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
@ -60,10 +59,10 @@ VPSheetSceneData::VPSheetSceneData(const VPLayoutPtr &layout, const QUuid &sheet
|
||||||
m_rotationOrigin->setVisible(false);
|
m_rotationOrigin->setVisible(false);
|
||||||
m_scene->addItem(m_rotationOrigin);
|
m_scene->addItem(m_rotationOrigin);
|
||||||
|
|
||||||
QObject::connect(m_rotationControls, &VPGraphicsPieceControls::ShowOrigin,
|
QObject::connect(m_rotationControls, &VPGraphicsPieceControls::ShowOrigin, m_rotationOrigin,
|
||||||
m_rotationOrigin, &VPGraphicsTransformationOrigin::on_ShowOrigin);
|
&VPGraphicsTransformationOrigin::on_ShowOrigin);
|
||||||
QObject::connect(m_rotationControls, &VPGraphicsPieceControls::TransformationOriginChanged,
|
QObject::connect(m_rotationControls, &VPGraphicsPieceControls::TransformationOriginChanged, m_rotationOrigin,
|
||||||
m_rotationOrigin, &VPGraphicsTransformationOrigin::SetTransformationOrigin);
|
&VPGraphicsTransformationOrigin::SetTransformationOrigin);
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
@ -305,20 +304,17 @@ void VPSheetSceneData::ConnectPiece(VPGraphicsPiece *piece)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
QObject::connect(layout.data(), &VPLayout::PieceTransformationChanged, piece,
|
QObject::connect(layout.data(), &VPLayout::PieceTransformationChanged, piece, &VPGraphicsPiece::on_RefreshPiece);
|
||||||
&VPGraphicsPiece::on_RefreshPiece);
|
QObject::connect(layout.data(), &VPLayout::PieceZValueChanged, piece, &VPGraphicsPiece::PieceZValueChanged);
|
||||||
QObject::connect(layout.data(), &VPLayout::PieceZValueChanged, piece,
|
QObject::connect(layout.data(), &VPLayout::PieceSelectionChanged, m_rotationControls,
|
||||||
&VPGraphicsPiece::PieceZValueChanged);
|
&VPGraphicsPieceControls::on_UpdateControls);
|
||||||
QObject::connect(layout.data(), &VPLayout::PieceSelectionChanged,
|
QObject::connect(layout.data(), &VPLayout::PiecePositionValidityChanged, piece, &VPGraphicsPiece::on_RefreshPiece);
|
||||||
m_rotationControls, &VPGraphicsPieceControls::on_UpdateControls);
|
QObject::connect(piece, &VPGraphicsPiece::PieceTransformationChanged, m_rotationControls,
|
||||||
QObject::connect(layout.data(), &VPLayout::PiecePositionValidityChanged,
|
&VPGraphicsPieceControls::on_UpdateControls);
|
||||||
piece, &VPGraphicsPiece::on_RefreshPiece);
|
QObject::connect(piece, &VPGraphicsPiece::HideTransformationHandles, m_rotationControls,
|
||||||
QObject::connect(piece, &VPGraphicsPiece::PieceTransformationChanged,
|
&VPGraphicsPieceControls::on_HideHandles);
|
||||||
m_rotationControls, &VPGraphicsPieceControls::on_UpdateControls);
|
QObject::connect(piece, &VPGraphicsPiece::HideTransformationHandles, m_rotationOrigin,
|
||||||
QObject::connect(piece, &VPGraphicsPiece::HideTransformationHandles,
|
&VPGraphicsTransformationOrigin::on_HideHandles);
|
||||||
m_rotationControls, &VPGraphicsPieceControls::on_HideHandles);
|
|
||||||
QObject::connect(piece, &VPGraphicsPiece::HideTransformationHandles,
|
|
||||||
m_rotationOrigin, &VPGraphicsTransformationOrigin::on_HideHandles);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// VPSheet
|
// VPSheet
|
||||||
|
@ -571,7 +567,6 @@ void VPSheet::ValidatePieceOutOfBound(const VPPiecePtr &piece) const
|
||||||
emit layout->PiecePositionValidityChanged(piece);
|
emit layout->PiecePositionValidityChanged(piece);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
@ -774,8 +769,7 @@ void VPSheet::SetSheetSize(const QSizeF &size)
|
||||||
void VPSheet::SetSheetSizeConverted(const QSizeF &size)
|
void VPSheet::SetSheetSizeConverted(const QSizeF &size)
|
||||||
{
|
{
|
||||||
Unit unit = SheetUnits();
|
Unit unit = SheetUnits();
|
||||||
m_size = QSizeF(UnitConvertor(size.width(), unit, Unit::Px),
|
m_size = QSizeF(UnitConvertor(size.width(), unit, Unit::Px), UnitConvertor(size.height(), unit, Unit::Px));
|
||||||
UnitConvertor(size.height(), unit, Unit::Px));
|
|
||||||
|
|
||||||
if (m_sceneData != nullptr)
|
if (m_sceneData != nullptr)
|
||||||
{
|
{
|
||||||
|
@ -793,10 +787,8 @@ auto VPSheet::GetSheetSize() const -> QSizeF
|
||||||
auto VPSheet::GetSheetSizeConverted() const -> QSizeF
|
auto VPSheet::GetSheetSizeConverted() const -> QSizeF
|
||||||
{
|
{
|
||||||
Unit unit = SheetUnits();
|
Unit unit = SheetUnits();
|
||||||
QSizeF convertedSize = QSizeF(
|
QSizeF convertedSize =
|
||||||
UnitConvertor(m_size.width(), Unit::Px, unit),
|
QSizeF(UnitConvertor(m_size.width(), Unit::Px, unit), UnitConvertor(m_size.height(), Unit::Px, unit));
|
||||||
UnitConvertor(m_size.height(), Unit::Px, unit)
|
|
||||||
);
|
|
||||||
|
|
||||||
return convertedSize;
|
return convertedSize;
|
||||||
}
|
}
|
||||||
|
|
|
@ -612,9 +612,16 @@ void VApplication::BeginLogging()
|
||||||
void VApplication::ClearOldLogs()
|
void VApplication::ClearOldLogs()
|
||||||
{
|
{
|
||||||
const QString workingDirectory = QDir::currentPath(); // Save the app working directory
|
const QString workingDirectory = QDir::currentPath(); // Save the app working directory
|
||||||
QDir logsDir(LogDirPath());
|
const QString logDirPath = LogDirPath();
|
||||||
|
QDir logsDir(logDirPath);
|
||||||
|
|
||||||
|
if (!logsDir.exists())
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
logsDir.setNameFilters(QStringList(QStringLiteral("*.log")));
|
logsDir.setNameFilters(QStringList(QStringLiteral("*.log")));
|
||||||
QDir::setCurrent(LogDirPath());
|
QDir::setCurrent(logDirPath);
|
||||||
|
|
||||||
// Restore working directory
|
// Restore working directory
|
||||||
auto restore = qScopeGuard([workingDirectory] { QDir::setCurrent(workingDirectory); });
|
auto restore = qScopeGuard([workingDirectory] { QDir::setCurrent(workingDirectory); });
|
||||||
|
|
|
@ -32,6 +32,7 @@
|
||||||
#include <QLineF>
|
#include <QLineF>
|
||||||
#include <QSharedData>
|
#include <QSharedData>
|
||||||
#include <QtDebug>
|
#include <QtDebug>
|
||||||
|
#include <QtGlobal>
|
||||||
|
|
||||||
#include "../qmuparser/qmutokenparser.h"
|
#include "../qmuparser/qmutokenparser.h"
|
||||||
#include "../vmisc/def.h"
|
#include "../vmisc/def.h"
|
||||||
|
|
|
@ -408,8 +408,6 @@ void VLayoutExporter::ExportToHPGL2(const QVector<VLayoutPiece> &details) const
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
auto VLayoutExporter::SupportPDFConversion() -> bool
|
auto VLayoutExporter::SupportPDFConversion() -> bool
|
||||||
{
|
{
|
||||||
bool res = false;
|
|
||||||
|
|
||||||
QProcess proc;
|
QProcess proc;
|
||||||
#if defined(Q_OS_WIN) || defined(Q_OS_OSX)
|
#if defined(Q_OS_WIN) || defined(Q_OS_OSX)
|
||||||
// Seek pdftops in app bundle or near valentina.exe
|
// Seek pdftops in app bundle or near valentina.exe
|
||||||
|
@ -421,13 +419,11 @@ auto VLayoutExporter::SupportPDFConversion() -> bool
|
||||||
const int timeout = 15000;
|
const int timeout = 15000;
|
||||||
if (proc.waitForStarted(timeout) && (proc.waitForFinished(timeout) || proc.state() == QProcess::NotRunning))
|
if (proc.waitForStarted(timeout) && (proc.waitForFinished(timeout) || proc.state() == QProcess::NotRunning))
|
||||||
{
|
{
|
||||||
res = true;
|
return true;
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
qDebug() << *PDFTOPS << "error" << proc.error() << proc.errorString();
|
qDebug() << *PDFTOPS << "error" << proc.error() << proc.errorString();
|
||||||
}
|
return false;
|
||||||
return res;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
|
@ -29,13 +29,13 @@
|
||||||
#include "dialogexporttocsv.h"
|
#include "dialogexporttocsv.h"
|
||||||
#include "ui_dialogexporttocsv.h"
|
#include "ui_dialogexporttocsv.h"
|
||||||
|
|
||||||
#include "../vcommonsettings.h"
|
|
||||||
#include "../qxtcsvmodel.h"
|
#include "../qxtcsvmodel.h"
|
||||||
#include "../vabstractapplication.h"
|
#include "../vabstractapplication.h"
|
||||||
|
#include "../vcommonsettings.h"
|
||||||
|
|
||||||
|
#include <QDebug>
|
||||||
#include <QPushButton>
|
#include <QPushButton>
|
||||||
#include <QShowEvent>
|
#include <QShowEvent>
|
||||||
#include <QDebug>
|
|
||||||
|
|
||||||
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
|
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
|
||||||
#include "../vtextcodec.h"
|
#include "../vtextcodec.h"
|
||||||
|
@ -71,7 +71,8 @@ DialogExportToCSV::DialogExportToCSV(QWidget *parent)
|
||||||
|
|
||||||
QPushButton *bDefaults = ui->buttonBox->button(QDialogButtonBox::RestoreDefaults);
|
QPushButton *bDefaults = ui->buttonBox->button(QDialogButtonBox::RestoreDefaults);
|
||||||
SCASSERT(bDefaults != nullptr)
|
SCASSERT(bDefaults != nullptr)
|
||||||
connect(bDefaults, &QPushButton::clicked, this, [this]()
|
connect(bDefaults, &QPushButton::clicked, this,
|
||||||
|
[this]()
|
||||||
{
|
{
|
||||||
ui->comboBoxCodec->blockSignals(true);
|
ui->comboBoxCodec->blockSignals(true);
|
||||||
ui->checkBoxWithHeader->blockSignals(true);
|
ui->checkBoxWithHeader->blockSignals(true);
|
||||||
|
|
|
@ -33,7 +33,7 @@
|
||||||
#include <QTimer>
|
#include <QTimer>
|
||||||
|
|
||||||
#if QT_VERSION < QT_VERSION_CHECK(5, 13, 0)
|
#if QT_VERSION < QT_VERSION_CHECK(5, 13, 0)
|
||||||
#include "../vmisc/defglobal.h"
|
#include "../defglobal.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
enum class VColorSheme
|
enum class VColorSheme
|
||||||
|
|
|
@ -32,37 +32,37 @@
|
||||||
#include <QCursor>
|
#include <QCursor>
|
||||||
#include <QEvent>
|
#include <QEvent>
|
||||||
#include <QFlags>
|
#include <QFlags>
|
||||||
|
#include <QGestureEvent>
|
||||||
#include <QGraphicsItem>
|
#include <QGraphicsItem>
|
||||||
#include <QGraphicsScene>
|
#include <QGraphicsScene>
|
||||||
#include <QLineF>
|
#include <QLineF>
|
||||||
#include <QList>
|
#include <QList>
|
||||||
#include <QMessageLogger>
|
#include <QMessageLogger>
|
||||||
|
#include <QMimeData>
|
||||||
|
#include <QMimeDatabase>
|
||||||
#include <QMouseEvent>
|
#include <QMouseEvent>
|
||||||
|
#include <QOpenGLWidget>
|
||||||
#include <QPainter>
|
#include <QPainter>
|
||||||
#include <QPoint>
|
#include <QPoint>
|
||||||
|
#include <QScreen>
|
||||||
#include <QScrollBar>
|
#include <QScrollBar>
|
||||||
|
#include <QThread>
|
||||||
#include <QTimeLine>
|
#include <QTimeLine>
|
||||||
#include <QTransform>
|
#include <QTransform>
|
||||||
#include <QWheelEvent>
|
#include <QWheelEvent>
|
||||||
#include <QWidget>
|
#include <QWidget>
|
||||||
#include <QThread>
|
|
||||||
#include <QGestureEvent>
|
|
||||||
#include <QScreen>
|
|
||||||
#include <QOpenGLWidget>
|
|
||||||
#include <QMimeData>
|
|
||||||
#include <QMimeDatabase>
|
|
||||||
#include <QtMath>
|
#include <QtMath>
|
||||||
|
|
||||||
|
#include "../ifc/xml/utils.h"
|
||||||
|
#include "../vmisc/compatibility.h"
|
||||||
#include "../vmisc/def.h"
|
#include "../vmisc/def.h"
|
||||||
#include "vmaingraphicsscene.h"
|
#include "../vmisc/literals.h"
|
||||||
#include "vsimplecurve.h"
|
|
||||||
#include "vcontrolpointspline.h"
|
|
||||||
#include "../vmisc/vabstractapplication.h"
|
#include "../vmisc/vabstractapplication.h"
|
||||||
#include "../vmisc/vcommonsettings.h"
|
#include "../vmisc/vcommonsettings.h"
|
||||||
#include "../vmisc/literals.h"
|
|
||||||
#include "../vmisc/compatibility.h"
|
|
||||||
#include "global.h"
|
#include "global.h"
|
||||||
#include "../ifc/xml/utils.h"
|
#include "vcontrolpointspline.h"
|
||||||
|
#include "vmaingraphicsscene.h"
|
||||||
|
#include "vsimplecurve.h"
|
||||||
|
|
||||||
namespace
|
namespace
|
||||||
{
|
{
|
||||||
|
@ -133,7 +133,7 @@ auto PrioritizeItems(const QList<QGraphicsItem *> &list) -> QList<QGraphicsItem
|
||||||
|
|
||||||
return prioritized + nonPrioritized;
|
return prioritized + nonPrioritized;
|
||||||
}
|
}
|
||||||
}
|
} // namespace
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
GraphicsViewZoom::GraphicsViewZoom(QGraphicsView *view)
|
GraphicsViewZoom::GraphicsViewZoom(QGraphicsView *view)
|
||||||
|
@ -174,8 +174,8 @@ void GraphicsViewZoom::gentle_zoom(double factor)
|
||||||
FictiveSceneRect(_view->scene(), _view);
|
FictiveSceneRect(_view->scene(), _view);
|
||||||
}
|
}
|
||||||
_view->centerOn(target_scene_pos);
|
_view->centerOn(target_scene_pos);
|
||||||
QPointF delta_viewport_pos = target_viewport_pos - QPointF(_view->viewport()->width() / 2.0,
|
QPointF delta_viewport_pos =
|
||||||
_view->viewport()->height() / 2.0);
|
target_viewport_pos - QPointF(_view->viewport()->width() / 2.0, _view->viewport()->height() / 2.0);
|
||||||
QPointF viewport_center = _view->mapFromScene(target_scene_pos) - delta_viewport_pos;
|
QPointF viewport_center = _view->mapFromScene(target_scene_pos) - delta_viewport_pos;
|
||||||
_view->centerOn(_view->mapToScene(viewport_center.toPoint()));
|
_view->centerOn(_view->mapToScene(viewport_center.toPoint()));
|
||||||
// In the end we just set correct scene size
|
// In the end we just set correct scene size
|
||||||
|
@ -379,8 +379,8 @@ void GraphicsViewZoom::StartHorizontalScrollings(QWheelEvent *wheel_event)
|
||||||
{
|
{
|
||||||
if (not wheel_event->pixelDelta().isNull())
|
if (not wheel_event->pixelDelta().isNull())
|
||||||
{ // Native scrolling animation
|
{ // Native scrolling animation
|
||||||
_view->horizontalScrollBar()->setValue(qCeil(_view->horizontalScrollBar()->value() -
|
_view->horizontalScrollBar()->setValue(
|
||||||
ScrollingSteps(wheel_event)));
|
qCeil(_view->horizontalScrollBar()->value() - ScrollingSteps(wheel_event)));
|
||||||
animFinished();
|
animFinished();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -602,10 +602,9 @@ void VMainGraphicsView::mouseMoveEvent(QMouseEvent *event)
|
||||||
{
|
{
|
||||||
QCursor cur = viewport()->cursor();
|
QCursor cur = viewport()->cursor();
|
||||||
// No way to restore bitmap from shape and we really don't need this for now.
|
// No way to restore bitmap from shape and we really don't need this for now.
|
||||||
if (m_currentCursor != Qt::BitmapCursor
|
if (m_currentCursor != Qt::BitmapCursor && cur.shape() == Qt::BitmapCursor &&
|
||||||
&& cur.shape() == Qt::BitmapCursor
|
cur.pixmap().cacheKey() != QPixmapFromCache(cursorArrowOpenHand).cacheKey() &&
|
||||||
&& cur.pixmap().cacheKey() != QPixmapFromCache(cursorArrowOpenHand).cacheKey()
|
cur.pixmap().cacheKey() != QPixmapFromCache(cursorArrowCloseHand).cacheKey())
|
||||||
&& cur.pixmap().cacheKey() != QPixmapFromCache(cursorArrowCloseHand).cacheKey())
|
|
||||||
{
|
{
|
||||||
viewport()->setCursor(m_currentCursor);
|
viewport()->setCursor(m_currentCursor);
|
||||||
}
|
}
|
||||||
|
@ -748,8 +747,7 @@ void VMainGraphicsView::EnsureItemVisibleWithDelay(const QGraphicsItem *item, un
|
||||||
const QRectF itemRect = item->mapToScene(item->boundingRect()).boundingRect();
|
const QRectF itemRect = item->mapToScene(item->boundingRect()).boundingRect();
|
||||||
|
|
||||||
// If item's rect is bigger than view's rect ensureVisible works very unstable.
|
// If item's rect is bigger than view's rect ensureVisible works very unstable.
|
||||||
if (itemRect.height() + 2*ymargin < viewRect.height() &&
|
if (itemRect.height() + 2 * ymargin < viewRect.height() && itemRect.width() + 2 * xmargin < viewRect.width())
|
||||||
itemRect.width() + 2*xmargin < viewRect.width())
|
|
||||||
{
|
{
|
||||||
EnsureVisibleWithDelay(item, msecs, xmargin, ymargin);
|
EnsureVisibleWithDelay(item, msecs, xmargin, ymargin);
|
||||||
}
|
}
|
||||||
|
@ -759,8 +757,8 @@ void VMainGraphicsView::EnsureItemVisibleWithDelay(const QGraphicsItem *item, un
|
||||||
VMainGraphicsScene *currentScene = qobject_cast<VMainGraphicsScene *>(item->scene());
|
VMainGraphicsScene *currentScene = qobject_cast<VMainGraphicsScene *>(item->scene());
|
||||||
SCASSERT(currentScene);
|
SCASSERT(currentScene);
|
||||||
const QPointF cursorPosition = currentScene->getScenePos();
|
const QPointF cursorPosition = currentScene->getScenePos();
|
||||||
EnsureVisibleWithDelay(QRectF(cursorPosition.x()-5/scale, cursorPosition.y()-5/scale, 10/scale, 10/scale),
|
EnsureVisibleWithDelay(
|
||||||
msecs);
|
QRectF(cursorPosition.x() - 5 / scale, cursorPosition.y() - 5 / scale, 10 / scale, 10 / scale), msecs);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -50,7 +50,6 @@
|
||||||
#include "../vmisc/svgfont/vsvgfontdatabase.h"
|
#include "../vmisc/svgfont/vsvgfontdatabase.h"
|
||||||
#include "../vmisc/vabstractvalapplication.h"
|
#include "../vmisc/vabstractvalapplication.h"
|
||||||
#include "vtextgraphicsitem.h"
|
#include "vtextgraphicsitem.h"
|
||||||
#include <QtMath>
|
|
||||||
|
|
||||||
namespace
|
namespace
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue
Block a user