Layout properties.

This commit is contained in:
Roman Telezhynskyi 2021-08-25 16:58:50 +03:00
parent 4646b6c1fb
commit d32bbfcfd4
53 changed files with 2438 additions and 1625 deletions

View File

@ -151,6 +151,12 @@ void VPCarrouselPieceList::startDrag(Qt::DropActions supportedActions)
{
m_carrousel->Refresh();
piece->SetSelected(true);
VPLayoutPtr layout = piece->Layout();
if (not layout.isNull())
{
emit layout->PieceSelectionChanged(piece);
}
}
}
}

View File

@ -40,7 +40,7 @@ PuzzlePreferencesLayoutPage::PuzzlePreferencesLayoutPage(QWidget *parent) :
InitLayoutUnits();
VAbstractLayoutDialog::InitTemplates(ui->comboBoxSheetTemplates);
VAbstractLayoutDialog::InitTemplates(ui->comboBoxTileTemplates);
VAbstractLayoutDialog::InitTileTemplates(ui->comboBoxTileTemplates);
MinimumSheetPaperSize();
MinimumTilePaperSize();
@ -225,7 +225,7 @@ void PuzzlePreferencesLayoutPage::ConvertPaperSize()
ui->doubleSpinBoxTileMarginTop->setValue(newTileTopMargin);
ui->doubleSpinBoxTileMarginBottom->setValue(newTileBottomMargin);
ui->doubleSpinBoxPiecesGap->setMaximum(UnitConvertor(50, Unit::Cm, layoutUnit));
ui->doubleSpinBoxPiecesGap->setMaximum(UnitConvertor(VPSettings::GetMaxLayoutPieceGap(), Unit::Cm, layoutUnit));
ui->doubleSpinBoxPiecesGap->setValue(newGap);
}
@ -610,7 +610,7 @@ void PuzzlePreferencesLayoutPage::ReadSettings()
ui->checkBoxWarningPiecesOutOfBound->setChecked(settings->GetLayoutWarningPiecesOutOfBound());
ui->checkBoxFollowGrainline->setChecked(settings->GetLayoutFollowGrainline());
ui->doubleSpinBoxPiecesGap->setMaximum(UnitConvertor(50, Unit::Cm, LayoutUnit()));
ui->doubleSpinBoxPiecesGap->setMaximum(UnitConvertor(VPSettings::GetMaxLayoutPieceGap(), Unit::Px, LayoutUnit()));
SetPieceGap(settings->GetLayoutPieceGap());
FindSheetTemplate();
@ -637,7 +637,7 @@ void PuzzlePreferencesLayoutPage::FindTemplate(QComboBox *box, qreal width, qrea
if (QSizeF(width, height) == tmplSize || QSizeF(height, width) == tmplSize)
{
box->blockSignals(true);
const int index = ui->comboBoxTileTemplates->findData(i);
const int index = box->findData(i);
if (index != -1)
{
box->setCurrentIndex(index);

View File

@ -90,6 +90,8 @@ signals:
void PieceTransformationChanged(const VPPiecePtr &piece);
void TransformationOriginChanged();
void SheetListChanged();
void PieceSelectionChanged(const VPPiecePtr &piece);
void LayoutChanged();
protected:
explicit VPLayout(QUndoStack *undoStack);

View File

@ -100,8 +100,8 @@ void VPLayoutSettings::SetTilesSize(qreal width, qreal height)
//---------------------------------------------------------------------------------------------------------------------
void VPLayoutSettings::SetTilesSizeConverted(qreal width, qreal height)
{
m_tilesSize.setWidth(UnitConvertor(width, GetUnit(), Unit::Px));
m_tilesSize.setHeight(UnitConvertor(height, GetUnit(), Unit::Px));
m_tilesSize.setWidth(UnitConvertor(width, m_unit, Unit::Px));
m_tilesSize.setHeight(UnitConvertor(height, m_unit, Unit::Px));
}
//---------------------------------------------------------------------------------------------------------------------
@ -142,12 +142,6 @@ auto VPLayoutSettings::GetTilesSizeConverted() const -> QSizeF
return GetTilesSize(GetUnit());
}
//---------------------------------------------------------------------------------------------------------------------
auto VPLayoutSettings::GetTilesOrientation() -> PageOrientation
{
return m_tilesSize.height() >= m_tilesSize.width() ? PageOrientation::Portrait : PageOrientation::Landscape;
}
//---------------------------------------------------------------------------------------------------------------------
void VPLayoutSettings::SetTilesMargins(qreal left, qreal top, qreal right, qreal bottom)
{
@ -497,21 +491,6 @@ auto VPLayoutSettings::GetSheetSizeConverted() const -> QSizeF
return convertedSize;
}
//---------------------------------------------------------------------------------------------------------------------
auto VPLayoutSettings::GetOrientation() -> PageOrientation
{
return m_orientation;
}
//---------------------------------------------------------------------------------------------------------------------
void VPLayoutSettings::SetOrientation(PageOrientation orientation)
{
if(orientation != m_orientation)
{
m_orientation = orientation;
}
}
//---------------------------------------------------------------------------------------------------------------------
void VPLayoutSettings::SetSheetMargins(qreal left, qreal top, qreal right, qreal bottom)
{

View File

@ -191,12 +191,6 @@ public:
*/
auto GetTilesSizeConverted() const -> QSizeF;
/**
* @brief GetOrientation Returns the orientation of the tiles
* @return orientation of the tiles
*/
auto GetTilesOrientation() -> PageOrientation;
/**
* @brief SetTilesMargins, set the margins of the tiles, the values have to be in Unit::Px
* @param left in Unit::Px
@ -332,18 +326,6 @@ public:
*/
auto GetSheetSizeConverted() const -> QSizeF;
/**
* @brief GetOrientation Returns the orientation of the sheet
* @return orientation of the sheet
*/
auto GetOrientation() -> PageOrientation;
/**
* @brief SetOrientation Sets the orientation of the sheet to the given value
* @param orientation the new page orientation
*/
void SetOrientation(PageOrientation orientation);
/**
* @brief SetSheetMargins, set the margins of the sheet, the values have to be in Unit::Px
* @param left in Unit::Px
@ -488,11 +470,6 @@ private:
*/
QSizeF m_size{};
/**
* @brief holds the orientation of the sheet
*/
PageOrientation m_orientation {PageOrientation::Portrait};
// margins
/**
* @brief m_margins the margins in Unit::Px

View File

@ -28,6 +28,7 @@
#include "vpsheet.h"
#include "vplayout.h"
#include "vppiece.h"
//---------------------------------------------------------------------------------------------------------------------
VPSheet::VPSheet(const VPLayoutPtr &layout) :
@ -45,8 +46,6 @@ auto VPSheet::GetLayout() const -> VPLayoutPtr
//---------------------------------------------------------------------------------------------------------------------
auto VPSheet::GetPieces() const -> QList<VPPiecePtr>
{
QList<VPPiecePtr> list;
VPLayoutPtr layout = GetLayout();
if (not layout.isNull())
{
@ -56,6 +55,31 @@ auto VPSheet::GetPieces() const -> QList<VPPiecePtr>
return {};
}
//---------------------------------------------------------------------------------------------------------------------
auto VPSheet::GetSelectedPieces() const -> QList<VPPiecePtr>
{
VPLayoutPtr layout = GetLayout();
if (not layout.isNull())
{
QList<VPPiecePtr> list = layout->PiecesForSheet(m_uuid);
QList<VPPiecePtr> selected;
selected.reserve(list.size());
for (const auto& piece : list)
{
if (not piece.isNull() && piece->IsSelected())
{
selected.append(piece);
}
}
return selected;
}
return {};
}
//---------------------------------------------------------------------------------------------------------------------
auto VPSheet::GetName() const -> QString
{

View File

@ -55,6 +55,8 @@ public:
auto GetPieces() const -> QList<VPPiecePtr>;
auto GetSelectedPieces() const -> QList<VPPiecePtr>;
/**
* @brief GetName Returns the name of the sheet
* @return the name

View File

@ -76,7 +76,7 @@ VPGraphicsPiece::VPGraphicsPiece(const VPPiecePtr &piece, QGraphicsItem *parent)
//---------------------------------------------------------------------------------------------------------------------
auto VPGraphicsPiece::GetPiece() -> VPPiecePtr
{
return m_piece;
return m_piece.toStrongRef();
}
//---------------------------------------------------------------------------------------------------------------------
@ -245,7 +245,7 @@ void VPGraphicsPiece::PaintPiece(QPainter *painter)
if (painter != nullptr)
{
painter->save();
painter->setBrush(isSelected() ? selectionBrush : noBrush);
painter->setBrush(piece->IsSelected() ? selectionBrush : noBrush);
painter->drawPath(m_seamLine);
painter->restore();
}
@ -362,55 +362,48 @@ void VPGraphicsPiece::PaintPiece(QPainter *painter)
//---------------------------------------------------------------------------------------------------------------------
void VPGraphicsPiece::GroupMove(const QPointF &pos)
{
if (scene() != nullptr)
VPPiecePtr piece = m_piece.toStrongRef();
if (piece.isNull())
{
QList<QGraphicsItem *> list = scene()->selectedItems();
return;
}
if (list.isEmpty())
VPLayoutPtr layout = piece->Layout();
if (layout.isNull())
{
return;
}
auto PreparePieces = [layout]()
{
QList<VPPiecePtr> pieces;
VPSheetPtr sheet = layout->GetFocusedSheet();
if (not sheet.isNull())
{
return;
return sheet->GetSelectedPieces();
}
VPPiecePtr piece = m_piece.toStrongRef();
if (piece.isNull())
{
return;
}
return pieces;
};
VPLayoutPtr layout = piece->Layout();
if (layout.isNull())
{
return;
}
QList<VPPiecePtr> pieces = PreparePieces();
QPointF newPos = pos - m_moveStartPoint;
auto PreparePieces = [list]()
{
QVector<VPPiecePtr> pieces;
for (auto *item : list)
{
if (item->type() == VPGraphicsPiece::Type)
{
auto *pieceItem = dynamic_cast<VPGraphicsPiece*>(item);
pieces.append(pieceItem->GetPiece());
}
}
if (qFuzzyIsNull(newPos.x()) && qFuzzyIsNull(newPos.y()))
{
return;
}
return pieces;
};
QVector<VPPiecePtr> pieces = PreparePieces();
QPointF newPos = pos - m_moveStartPoint;
if (pieces.size() == 1)
{
auto *command = new VPUndoPieceMove(pieces.first(), newPos.x(), newPos.y(), allowChangeMerge);
layout->UndoStack()->push(command);
}
else if (pieces.size() > 1)
{
auto *command = new VPUndoPiecesMove(pieces, newPos.x(), newPos.y(), allowChangeMerge);
layout->UndoStack()->push(command);
}
if (pieces.size() == 1)
{
auto *command = new VPUndoPieceMove(pieces.first(), newPos.x(), newPos.y(), allowChangeMerge);
layout->UndoStack()->push(command);
}
else if (pieces.size() > 1)
{
auto *command = new VPUndoPiecesMove(pieces, newPos.x(), newPos.y(), allowChangeMerge);
layout->UndoStack()->push(command);
}
}
@ -435,8 +428,13 @@ auto VPGraphicsPiece::itemChange(GraphicsItemChange change, const QVariant &valu
VPPiecePtr piece = m_piece.toStrongRef();
if (not piece.isNull())
{
emit PieceSelectionChanged();
piece->SetSelected(value.toBool());
VPLayoutPtr layout = piece->Layout();
if (not layout.isNull())
{
emit layout->PieceSelectionChanged(piece);
}
}
}
}

View File

@ -52,7 +52,6 @@ public:
enum { Type = UserType + static_cast<int>(PGraphicsItem::Piece)};
signals:
void PieceSelectionChanged();
void HideTransformationHandles(bool hide);
void PieceTransformationChanged();

View File

@ -37,6 +37,7 @@
#include "../vmisc/compatibility.h"
#include "../vwidgets/global.h"
#include "../layout/vplayout.h"
#include "../layout/vppiece.h"
#include "../undocommands/vpundopiecerotate.h"
#include "../undocommands/vpundooriginmove.h"
#include "vpgraphicspiece.h"
@ -479,16 +480,21 @@ void VPGraphicsPieceControls::mouseMoveEvent(QGraphicsSceneMouseEvent *event)
{
auto PreparePieces = [this]()
{
QVector<VPPiecePtr> pieces;
for (auto *item : m_selectedPieces)
QList<VPPiecePtr> pieces;
VPLayoutPtr layout = m_layout.toStrongRef();
if (not layout.isNull())
{
pieces.append(item->GetPiece());
VPSheetPtr sheet = layout->GetFocusedSheet();
if (not sheet.isNull())
{
pieces = sheet->GetSelectedPieces();
}
}
return pieces;
};
QVector<VPPiecePtr> pieces = PreparePieces();
QList<VPPiecePtr> pieces = PreparePieces();
VPLayoutPtr layout = m_layout.toStrongRef();
if (not layout.isNull())
@ -662,7 +668,7 @@ auto VPGraphicsPieceControls::ControllersRect() const -> QRectF
//---------------------------------------------------------------------------------------------------------------------
auto VPGraphicsPieceControls::ArrowPath() const -> QPainterPath
{
const qreal scale = SceneScale(scene());
const qreal scale = SceneScale(scene())/2;
QPainterPath arrow;
QRectF pieceRect = ControllersRect();
@ -764,23 +770,17 @@ auto VPGraphicsPieceControls::ArrowPath() const -> QPainterPath
}
//---------------------------------------------------------------------------------------------------------------------
auto VPGraphicsPieceControls::SelectedPieces() const -> QVector<VPGraphicsPiece *>
auto VPGraphicsPieceControls::SelectedPieces() const -> QList<VPPiecePtr>
{
QVector<VPGraphicsPiece *> pieces;
QGraphicsScene *scene = this->scene();
if (scene != nullptr)
QList<VPPiecePtr> pieces;
VPLayoutPtr layout = m_layout.toStrongRef();
if (not layout.isNull())
{
QList<QGraphicsItem *> list = scene->selectedItems();
for (auto *item : list)
VPSheetPtr sheet = layout->GetFocusedSheet();
if (not sheet.isNull())
{
if (item->type() == VPGraphicsPiece::Type)
{
auto *pieceItem = dynamic_cast<VPGraphicsPiece*>(item);
if (pieceItem != nullptr)
{
pieces.append(pieceItem);
}
}
pieces = sheet->GetSelectedPieces();
}
}
@ -788,12 +788,15 @@ auto VPGraphicsPieceControls::SelectedPieces() const -> QVector<VPGraphicsPiece
}
//---------------------------------------------------------------------------------------------------------------------
auto VPGraphicsPieceControls::PiecesBoundingRect(const QVector<VPGraphicsPiece *> &selectedPieces) -> QRectF
auto VPGraphicsPieceControls::PiecesBoundingRect(const QList<VPPiecePtr> &selectedPieces) -> QRectF
{
QRectF rect;
for (auto *item : selectedPieces)
for (const auto& item : selectedPieces)
{
rect = rect.united(item->sceneBoundingRect());
if (not item.isNull())
{
rect = rect.united(item->MappedDetailBoundingRect());
}
}
return rect;

View File

@ -114,7 +114,7 @@ private:
VPTransformationOrigon m_savedOrigin{};
bool m_originSaved{false};
bool allowChangeMerge{false};
QVector<VPGraphicsPiece *> m_selectedPieces{};
QList<VPPiecePtr> m_selectedPieces{};
bool m_ignorePieceTransformation{false};
auto TopLeftControl(QPainter *painter = nullptr) const -> QPainterPath;
@ -130,8 +130,8 @@ private:
auto HandleCorner(const QPointF &pos) const -> int;
auto SelectedPieces() const -> QVector<VPGraphicsPiece *>;
static auto PiecesBoundingRect(const QVector<VPGraphicsPiece *> &selectedPieces) -> QRectF;
auto SelectedPieces() const -> QList<VPPiecePtr>;
static auto PiecesBoundingRect(const QList<VPPiecePtr> &selectedPieces) -> QRectF;
};
#endif // VPGRAPHICSPIECECONTROLS_H

View File

@ -113,10 +113,6 @@ auto VPGraphicsSheet::GetSheetRect() const -> QRectF
QPoint topLeft = QPoint(0,0);
QSizeF size = layout->LayoutSettings().GetSheetSize();
if(layout->LayoutSettings().GetOrientation() == PageOrientation::Landscape)
{
size.transpose();
}
QRectF rect = QRectF(topLeft, size);
return rect;
}
@ -130,17 +126,17 @@ auto VPGraphicsSheet::GetMarginsRect() const -> QRectF
return {};
}
QMarginsF margins = layout->LayoutSettings().GetSheetMargins();
QSizeF size = layout->LayoutSettings().GetSheetSize();
if(layout->LayoutSettings().GetOrientation() == PageOrientation::Landscape)
if (not layout->LayoutSettings().IgnoreMargins())
{
size.transpose();
QMarginsF margins = layout->LayoutSettings().GetSheetMargins();
QRectF rect = QRectF(QPointF(margins.left(), margins.top()),
QPointF(size.width()-margins.right(), size.height()-margins.bottom()));
return rect;
}
QRectF rect = QRectF(QPointF(margins.left(),margins.top()),
QPointF(size.width()-margins.right(), size.height()-margins.bottom()));
return rect;
return QRectF(0, 0, size.width(), size.height());
}
//---------------------------------------------------------------------------------------------------------------------

View File

@ -13,13 +13,7 @@ VPGraphicsTileGrid::VPGraphicsTileGrid(const VPLayoutPtr &layout, VPTileFactory
}
//---------------------------------------------------------------------------------------------------------------------
VPGraphicsTileGrid::~VPGraphicsTileGrid()
{
}
//---------------------------------------------------------------------------------------------------------------------
QRectF VPGraphicsTileGrid::boundingRect() const
auto VPGraphicsTileGrid::boundingRect() const -> QRectF
{
VPLayoutPtr layout = m_layout.toStrongRef();
if(not layout.isNull() && layout->LayoutSettings().GetShowTiles())

View File

@ -42,7 +42,7 @@ class VPGraphicsTileGrid : public QGraphicsItem
{
public:
explicit VPGraphicsTileGrid(const VPLayoutPtr &layout, VPTileFactory *tileFactory, QGraphicsItem *parent = nullptr);
~VPGraphicsTileGrid();
~VPGraphicsTileGrid()=default;
QRectF boundingRect() const override;
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) override;

View File

@ -70,6 +70,8 @@ VPMainGraphicsView::VPMainGraphicsView(const VPLayoutPtr &layout, VPTileFactory
SCASSERT(not m_layout.isNull())
setScene(m_scene);
connect(m_scene, &VMainGraphicsScene::ItemClicked, this, &VPMainGraphicsView::on_ItemClicked);
m_graphicsSheet = new VPGraphicsSheet(m_layout);
m_graphicsSheet->setPos(0, 0);
m_scene->addItem(m_graphicsSheet);
@ -262,6 +264,8 @@ void VPMainGraphicsView::keyPressEvent(QKeyEvent *event)
VPLayoutPtr layout = m_layout.toStrongRef();
if (not layout.isNull())
{
emit layout->PieceSelectionChanged(piece);
auto *command = new VPUndoMovePieceOnSheet(VPSheetPtr(), piece);
layout->UndoStack()->push(command);
}
@ -429,11 +433,12 @@ void VPMainGraphicsView::RestoreOrigin() const
origin.custom = false;
QRectF boundingRect;
for (auto *graphicsPiece : m_graphicsPieces)
QList<VPPiecePtr> selectedPieces = sheet->GetSelectedPieces();
for (const auto& piece : selectedPieces)
{
if (graphicsPiece->isSelected())
if (piece->IsSelected())
{
boundingRect = boundingRect.united(graphicsPiece->sceneBoundingRect());
boundingRect = boundingRect.united(piece->MappedDetailBoundingRect());
}
}
origin.origin = boundingRect.center();
@ -444,6 +449,60 @@ void VPMainGraphicsView::RestoreOrigin() const
}
}
//---------------------------------------------------------------------------------------------------------------------
void VPMainGraphicsView::on_ItemClicked(QGraphicsItem *item)
{
if (item == nullptr || (item->type() != VPGraphicsPiece::Type &&
item->type() != VPGraphicsPieceControls::Type &&
item->type() != VPGraphicsTransformationOrigin::Type))
{
VPLayoutPtr layout = m_layout.toStrongRef();
if (not layout.isNull())
{
VPSheetPtr sheet = layout->GetFocusedSheet();
if (not sheet.isNull())
{
QList<VPPiecePtr> selectedPieces = sheet->GetSelectedPieces();
for (const auto& piece : selectedPieces)
{
if (piece->IsSelected())
{
piece->SetSelected(false);
}
}
if (not selectedPieces.isEmpty())
{
emit layout->PieceSelectionChanged(VPPiecePtr());
}
}
}
}
else
{
if (item->type() == VPGraphicsPiece::Type)
{
auto *pieceItem = dynamic_cast<VPGraphicsPiece*>(item);
if (pieceItem != nullptr)
{
VPPiecePtr piece = pieceItem->GetPiece();
if (not piece.isNull())
{
if (not piece->IsSelected())
{
piece->SetSelected(true);
VPLayoutPtr layout = m_layout.toStrongRef();
if (not layout.isNull())
{
emit layout->PieceSelectionChanged(piece);
}
}
}
}
}
}
}
//---------------------------------------------------------------------------------------------------------------------
void VPMainGraphicsView::ConnectPiece(VPGraphicsPiece *piece)
{
@ -453,7 +512,7 @@ void VPMainGraphicsView::ConnectPiece(VPGraphicsPiece *piece)
connect(layout.get(), &VPLayout::PieceTransformationChanged, piece,
&VPGraphicsPiece::on_RefreshPiece);
connect(piece, &VPGraphicsPiece::PieceSelectionChanged,
connect(layout.get(), &VPLayout::PieceSelectionChanged,
m_rotationControls, &VPGraphicsPieceControls::on_UpdateControls);
connect(piece, &VPGraphicsPiece::PieceTransformationChanged,
m_rotationControls, &VPGraphicsPieceControls::on_UpdateControls);
@ -485,19 +544,21 @@ void VPMainGraphicsView::RotatePiecesByAngle(qreal angle)
auto PreparePieces = [this]()
{
QVector<VPPiecePtr> pieces;
for (auto *item : m_graphicsPieces)
QList<VPPiecePtr> pieces;
VPLayoutPtr layout = m_layout.toStrongRef();
if (not layout.isNull())
{
if (item->isSelected())
VPSheetPtr sheet = layout->GetFocusedSheet();
if (not sheet.isNull())
{
pieces.append(item->GetPiece());
pieces = sheet->GetSelectedPieces();
}
}
return pieces;
};
QVector<VPPiecePtr> pieces = PreparePieces();
QList<VPPiecePtr> pieces = PreparePieces();
if (pieces.size() == 1)
{
@ -535,19 +596,21 @@ void VPMainGraphicsView::TranslatePiecesOn(qreal dx, qreal dy)
auto PreparePieces = [this]()
{
QVector<VPPiecePtr> pieces;
for (auto *graphicsPiece : m_graphicsPieces)
QList<VPPiecePtr> pieces;
VPLayoutPtr layout = m_layout.toStrongRef();
if (not layout.isNull())
{
if (graphicsPiece->isSelected())
VPSheetPtr sheet = layout->GetFocusedSheet();
if (not sheet.isNull())
{
pieces.append(graphicsPiece->GetPiece());
pieces = sheet->GetSelectedPieces();
}
}
return pieces;
};
QVector<VPPiecePtr> pieces = PreparePieces();
QList<VPPiecePtr> pieces = PreparePieces();
if (pieces.size() == 1)
{
auto *command = new VPUndoPieceMove(pieces.first(), dx, dy, m_allowChangeMerge);

View File

@ -95,6 +95,7 @@ protected:
private slots:
void RestoreOrigin() const;
void on_ItemClicked(QGraphicsItem* item);
private:
Q_DISABLE_COPY(VPMainGraphicsView)

View File

@ -5,10 +5,6 @@
<file>puzzleicon/64x64/iconCurrentPiece.png</file>
<file>puzzleicon/64x64/iconLayers.png</file>
<file>puzzleicon/64x64/iconTiles.png</file>
<file>puzzleicon/64x64/iconLandscape.png</file>
<file>puzzleicon/64x64/iconPortrait.png</file>
<file>puzzleicon/64x64/iconGrainlineVertical.png</file>
<file>puzzleicon/64x64/iconGrainlineHorizontal.png</file>
<file>puzzleicon/64x64/iconProperties.png</file>
<file>puzzleicon/svg/icon_scissors.svg</file>
<file>puzzleicon/svg/icon_scissors_vertical.svg</file>
@ -18,10 +14,6 @@
<file>puzzleicon/svg/cursor_rotate.svg</file>
<file>puzzleicon/svg/icon_rotate_90_anticlockwise.svg</file>
<file>puzzleicon/svg/icon_rotate_90_clockwise.svg</file>
<file>puzzleicon/64x64/iconRotate90Anticlockwise.png</file>
<file>puzzleicon/64x64/iconRotate90Clockwise.png</file>
<file>puzzleicon/64x64/iconRotateGrainlineHorizontal.png</file>
<file>puzzleicon/64x64/iconRotateGrainlineVertical.png</file>
<file>puzzleicon/svg/icon_rotate_grainline_horizontal.svg</file>
<file>puzzleicon/svg/icon_rotate_grainline_vertical.svg</file>
</qresource>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 979 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 984 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 980 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.6 KiB

View File

@ -59,7 +59,7 @@ void VPUndoMovePieceOnSheet::undo()
if (not activateSheet.isNull())
{
layout = activateSheet->GetLayout();
if (not layout.isNull() && not activateSheet->TrashSheet())
if (not layout.isNull() && not activateSheet->TrashSheet() && layout->GetFocusedSheet() != activateSheet)
{
layout->SetFocusedSheet(activateSheet);
}
@ -69,10 +69,12 @@ void VPUndoMovePieceOnSheet::undo()
if (not piece.isNull())
{
piece->SetSheet(sourceSheet);
piece->SetSelected(false);
if (not layout.isNull())
{
emit layout->PieceSheetChanged(piece);
emit layout->PieceSelectionChanged(piece);
}
}
}
@ -92,7 +94,7 @@ void VPUndoMovePieceOnSheet::redo()
if (not activateSheet.isNull())
{
layout = activateSheet->GetLayout();
if (not layout.isNull() && not activateSheet->TrashSheet())
if (not layout.isNull() && not activateSheet->TrashSheet() && layout->GetFocusedSheet() != activateSheet)
{
layout->SetFocusedSheet(activateSheet);
}

View File

@ -59,7 +59,10 @@ void VPUndoOriginMove::undo()
return;
}
layout->SetFocusedSheet(sheet);
if (layout->GetFocusedSheet() != sheet)
{
layout->SetFocusedSheet(sheet);
}
sheet->SetTransformationOrigin(m_oldOrigin);
layout->TransformationOriginChanged();
@ -80,7 +83,10 @@ void VPUndoOriginMove::redo()
return;
}
layout->SetFocusedSheet(sheet);
if (layout->GetFocusedSheet() != sheet)
{
layout->SetFocusedSheet(sheet);
}
sheet->SetTransformationOrigin(m_origin);
emit layout->TransformationOriginChanged();

View File

@ -59,7 +59,10 @@ void VPUndoPieceMove::undo()
return;
}
layout->SetFocusedSheet(piece->Sheet());
if (layout->GetFocusedSheet() != piece->Sheet())
{
layout->SetFocusedSheet(piece->Sheet());
}
piece->SetMatrix(m_oldTransform);
emit layout->PieceTransformationChanged(piece);
@ -80,7 +83,10 @@ void VPUndoPieceMove::redo()
return;
}
layout->SetFocusedSheet(piece->Sheet());
if (layout->GetFocusedSheet() != piece->Sheet())
{
layout->SetFocusedSheet(piece->Sheet());
}
piece->Translate(m_dx, m_dy);
emit layout->PieceTransformationChanged(piece);
@ -117,7 +123,7 @@ auto VPUndoPieceMove::id() const -> int
// move pieces
//---------------------------------------------------------------------------------------------------------------------
VPUndoPiecesMove::VPUndoPiecesMove(const QVector<VPPiecePtr> &pieces, qreal dx, qreal dy, bool allowMerge,
VPUndoPiecesMove::VPUndoPiecesMove(const QList<VPPiecePtr> &pieces, qreal dx, qreal dy, bool allowMerge,
QUndoCommand *parent)
: VPUndoCommand(allowMerge, parent),
m_dx(dx),
@ -149,7 +155,11 @@ void VPUndoPiecesMove::undo()
return;
}
layout->SetFocusedSheet(Sheet());
VPSheetPtr sheet = Sheet();
if (layout->GetFocusedSheet() != sheet)
{
layout->SetFocusedSheet(sheet);
}
for (const auto& piece : m_pieces)
{
@ -179,7 +189,11 @@ void VPUndoPiecesMove::redo()
return;
}
layout->SetFocusedSheet(Sheet());
VPSheetPtr sheet = Sheet();
if (layout->GetFocusedSheet() != sheet)
{
layout->SetFocusedSheet(sheet);
}
for (const auto& piece : m_pieces)
{

View File

@ -38,7 +38,7 @@ class VPUndoPieceMove : public VPUndoCommand
{
Q_OBJECT
public:
explicit VPUndoPieceMove(const VPPiecePtr &piece, qreal dx, qreal dy, bool allowMerge,
explicit VPUndoPieceMove(const VPPiecePtr &piece, qreal dx, qreal dy, bool allowMerge = false,
QUndoCommand *parent = nullptr);
virtual ~VPUndoPieceMove()=default;
@ -84,7 +84,7 @@ class VPUndoPiecesMove : public VPUndoCommand
{
Q_OBJECT
public:
explicit VPUndoPiecesMove(const QVector<VPPiecePtr> &pieces, qreal dx, qreal dy, bool allowMerge,
explicit VPUndoPiecesMove(const QList<VPPiecePtr> &pieces, qreal dx, qreal dy, bool allowMerge = false,
QUndoCommand *parent = nullptr);
virtual ~VPUndoPiecesMove()=default;

View File

@ -59,7 +59,10 @@ void VPUndoPieceRotate::undo()
return;
}
layout->SetFocusedSheet(piece->Sheet());
if (layout->GetFocusedSheet() != piece->Sheet())
{
layout->SetFocusedSheet(piece->Sheet());
}
piece->SetMatrix(m_oldTransform);
emit layout->PieceTransformationChanged(piece);
@ -80,7 +83,10 @@ void VPUndoPieceRotate::redo()
return;
}
layout->SetFocusedSheet(piece->Sheet());
if (layout->GetFocusedSheet() != piece->Sheet())
{
layout->SetFocusedSheet(piece->Sheet());
}
piece->Rotate(m_origin, m_angle);
emit layout->PieceTransformationChanged(piece);
@ -116,7 +122,7 @@ auto VPUndoPieceRotate::id() const -> int
// rotate pieces
//---------------------------------------------------------------------------------------------------------------------
VPUndoPiecesRotate::VPUndoPiecesRotate(const QVector<VPPiecePtr> &pieces, const QPointF &origin, qreal angle,
VPUndoPiecesRotate::VPUndoPiecesRotate(const QList<VPPiecePtr> &pieces, const QPointF &origin, qreal angle,
bool allowMerge, QUndoCommand *parent)
: VPUndoCommand(allowMerge, parent),
m_origin(origin),
@ -148,7 +154,11 @@ void VPUndoPiecesRotate::undo()
return;
}
layout->SetFocusedSheet(Sheet());
VPSheetPtr sheet = Sheet();
if (layout->GetFocusedSheet() != sheet)
{
layout->SetFocusedSheet(sheet);
}
for (const auto& piece : m_pieces)
{
@ -178,7 +188,11 @@ void VPUndoPiecesRotate::redo()
return;
}
layout->SetFocusedSheet(Sheet());
VPSheetPtr sheet = Sheet();
if (layout->GetFocusedSheet() != sheet)
{
layout->SetFocusedSheet(sheet);
}
for (const auto& piece : m_pieces)
{

View File

@ -38,7 +38,7 @@ class VPUndoPieceRotate : public VPUndoCommand
{
Q_OBJECT
public:
VPUndoPieceRotate(const VPPiecePtr &piece, const QPointF &origin, qreal angle, bool allowMerge,
VPUndoPieceRotate(const VPPiecePtr &piece, const QPointF &origin, qreal angle, bool allowMerge = false,
QUndoCommand *parent = nullptr);
virtual ~VPUndoPieceRotate()=default;
@ -85,8 +85,8 @@ class VPUndoPiecesRotate : public VPUndoCommand
{
Q_OBJECT
public:
explicit VPUndoPiecesRotate(const QVector<VPPiecePtr> &pieces, const QPointF &origin, qreal angle, bool allowMerge,
QUndoCommand *parent = nullptr);
explicit VPUndoPiecesRotate(const QList<VPPiecePtr> &pieces, const QPointF &origin, qreal angle,
bool allowMerge = false, QUndoCommand *parent = nullptr);
virtual ~VPUndoPiecesRotate()=default;
virtual void undo() override;

View File

@ -44,10 +44,6 @@ void VPExporter::Export(VPLayout* layout, LayoutExportFormats format, VPMainGrap
SetFileName(fileName);
QSizeF size = QSizeF(layout->GetFocusedSheet()->GetLayout()->LayoutSettings().GetSheetSize());
if(layout->GetFocusedSheet()->GetLayout()->LayoutSettings().GetOrientation() == PageOrientation::Landscape)
{
size.transpose();
}
const QRectF rect = QRectF(0, 0, size.width(), size.height());
SetImageRect(rect);

File diff suppressed because it is too large Load Diff

View File

@ -45,6 +45,7 @@
#include "../vlayout/vlayoutdef.h"
#include "../vwidgets/vabstractmainwindow.h"
#include "../vmisc/vlockguard.h"
#include "../vlayout/dialogs/vabstractlayoutdialog.h"
namespace Ui
{
@ -154,40 +155,24 @@ private slots:
void on_actionAboutPuzzle_triggered();
/**
* @brief on_comboBoxLayoutUnit_currentIndexChanged When the unit is changed in
* @brief on_LayoutUnitChanged When the unit is changed in
* the layout property tab.
* The slot is automatically connected through name convention.
* @param index the index of the selected unit
*/
void on_comboBoxLayoutUnit_currentIndexChanged(int index);
/**
* @brief on_lineEditSheetName_textChanged When the name of the sheet is changed
* in the sheet layout tab
* @param text name of the sheet
*/
void on_lineEditSheetName_textChanged(const QString &text);
/**
* @brief on_comboBoxLayoutTemplate_currentIndexChanged When the template is
* changed in the sheet property tab.
* The slot is automatically connected through name convention.
* @param index the index of the selected templated
*/
void on_comboBoxSheetTemplate_currentIndexChanged(int index);
void on_LayoutUnitChanged(int index);
/**
* @brief on_SheetSizeChanged When the width or the length has been changed in
* the sheet property tab
* @param changedViaSizeCombobox true if the change happened through the combobox
*/
void on_SheetSizeChanged(bool changedViaSizeCombobox = true);
void on_SheetSizeChanged();
/**
* @brief on_SheetOrientationChanged When one of the radio boxes for the sheet
* orientation has been clicked
*/
void on_SheetOrientationChanged();
void on_SheetOrientationChanged(bool checked);
/**
* @brief on_pushButtonLayoutRemoveUnusedLength_clicked When the button
@ -225,40 +210,17 @@ private slots:
*/
void on_doubleSpinBoxSheetGridRowHeight_valueChanged(double value);
/**
* @brief LayoutFollowGrainlineChanged When one of the radio boxes for the
* "Follow grainline" has been clicked in the sheet property tab.
*/
void on_SheetFollowGrainlineChanged();
/**
* @brief on_doubleSpinBoxLayoutPiecesGap_valueChanged When the "pieces gap"
* value is changed in the layout property tab.
* The slot is automatically connected through name convention.
* @param value the new value of the pieces gap
*/
void on_doubleSpinBoxSheetPiecesGap_valueChanged(double value);
/**
* @brief on_comboBoxTilesTemplate_currentIndexChanged When the template is
* changed in the tiles property tab.
* The slot is automatically connected through name convention.
* @param index the index of the selected templated
*/
void on_comboBoxTilesTemplate_currentIndexChanged(int index);
/**
* @brief on_TilesSizeChanged When the width or the length has been changed in
* the tiles property tab
* @param changedViaSizeCombobox true if the change happened through the combobox
*/
void on_TilesSizeChanged(bool changedViaSizeCombobox = true);
void on_TilesSizeChanged();
/**
* @brief on_TilesOrientationChanged When one of the radio boxes for the tiles
* orientation has been clicked
*/
void on_TilesOrientationChanged();
void on_TilesOrientationChanged(bool checked);
/**
* @brief on_TilesMarginChanged When one of the margin values has been changed
@ -266,44 +228,11 @@ private slots:
*/
void on_TilesMarginChanged();
/**
* @brief on_checkBoxTilesShowTiles_toggled When the checkbox "show tiles" is
* clicked
* @param checked show tiles
*/
void on_checkBoxTilesShowTiles_toggled(bool checked);
/**
* @brief on_pushButtonTilesExport_clicked When the export tiles button is clicked
*/
void on_pushButtonTilesExport_clicked();
/**
* @brief on_checkBoxLayoutWarningPiecesSuperposition_toggled When the
* "Warning when pieces superposition" checkbox value in the layout
* property tab is toggled.
* The slot is automatically connected through name convention.
* @param checked the new checked value
*/
void on_checkBoxLayoutWarningPiecesSuperposition_toggled(bool checked);
/**
* @brief on_checkBoxLayoutWarningPiecesOutOfBound_toggled When the
* "Warning when pieces out of bound" checkbox value in the layout property
* tab is toggled.
* The slot is automatically connected through name convention.
* @param checked the new checked value
*/
void on_checkBoxLayoutWarningPiecesOutOfBound_toggled(bool checked);
/**
* @brief on_checkBoxLayoutStickyEdges_toggled When the "Sticky edges"
* checkbox value in the layout property tab is toggled.
* The slot is automatically connected through name convention.
* @param checked the new checked value
*/
void on_checkBoxSheetStickyEdges_toggled(bool checked);
/**
* @brief on_pushButtonLayoutExport_clicked When the button
* "Export layout" in the layout property is clicked.
@ -327,30 +256,6 @@ private slots:
*/
void on_checkBoxCurrentPieceMirrorPiece_toggled(bool checked);
/**
* @brief on_pushButtonCurrentPieceRotate90Antilockwise_clicked When the 90
* anticlockwise angle button is clicked
*/
void on_pushButtonCurrentPieceRotate90Anticlockwise_clicked();
/**
* @brief on_pushButtonCurrentPieceRotate90Clockwise_clicked When the 90
* clockwise angle button is clicked
*/
void on_pushButtonCurrentPieceRotate90Clockwise_clicked();
/**
* @brief on_pushButtonCurrentPieceRotateGrainlineVertical_clicked
* When the grainline vertical angle button is clicked
*/
void on_pushButtonCurrentPieceRotateGrainlineVertical_clicked();
/**
* @brief on_pushButtonCurrentPieceRotateGrainlineHorizontal_clicked
* When the grainline horizontal angle button is clicked
*/
void on_pushButtonCurrentPieceRotateGrainlineHorizontal_clicked();
/**
* @brief on_doubleSpinBoxCurrentPieceAngle_valueChanged When the
* "Current Piece Angle" value in the current piece property is changed
@ -359,12 +264,6 @@ private slots:
*/
void on_doubleSpinBoxCurrentPieceAngle_valueChanged(double value);
/**
* @brief on_CurrentPiecePositionChanged When the positionX or the positionY
* is changed in the current piece tab
*/
void on_CurrentPiecePositionEdited();
/**
* @brief CarrouselLocationChanged When the piece carrousel's location
* has been changed
@ -377,16 +276,6 @@ private slots:
*/
void on_PieceSelectionChanged();
/**
* @brief on_PiecePositionChanged When the current piece position has changed
*/
void on_PiecePositionChanged();
/**
* @brief on_PieceRotationChanged When the current piece rotation has changed
*/
void on_PieceRotationChanged();
/**
* @brief on_ScaleChanged When the scale of the graphic view is changed
*/
@ -406,6 +295,14 @@ private slots:
void on_actionAddSheet_triggered();
void on_ApplyPieceTransformation();
void on_ResetPieceTransformationSettings();
void on_RelativeTranslationChanged(bool checked);
void on_ConvertPaperSize();
#if defined(Q_OS_MAC)
void AboutToShowDockMenu();
#endif //defined(Q_OS_MAC)
@ -422,7 +319,6 @@ private:
QUndoStack *m_undoStack;
VPLayoutPtr m_layout;
QList<VPPiece *>m_selectedPieces{QList<VPPiece *>()};
VPTileFactory *m_tileFactory{nullptr};
@ -449,6 +345,9 @@ private:
QAction *undoAction{nullptr};
QAction *redoAction{nullptr};
Unit m_oldPieceTranslationUnit{Unit::Mm};
Unit m_oldLayoutUnit{Unit::Mm};
/**
* @brief CreatePiece creates a piece from the given VLayoutPiece data
* @param rawPiece the raw piece data
@ -535,22 +434,6 @@ private:
*/
void SetPropertyTabLayoutData();
/**
* @brief SetDoubleSpinBoxValue sets the given spinbox to the given value.
* the signals are blocked before changing the value and unblocked after
* @param spinBox pointer to spinbox
* @param value spinbox value
*/
void SetDoubleSpinBoxValue(QDoubleSpinBox *spinBox, qreal value);
/**
* @brief SetCheckBoxValue sets the given checkbox to the given value.
* the signals are blocked before changing the value and unblocked after
* @param checkbox pointer to checkbox
* @param value checkbox value
*/
void SetCheckBoxValue(QCheckBox *checkbox, bool value);
void ReadSettings();
void WriteSettings();
@ -567,6 +450,34 @@ private:
auto IsLayoutReadOnly() const -> bool;
void ConnectToPreferences(const QSharedPointer<DialogPuzzlePreferences> &preferences);
auto SelectedPieces() const -> QList<VPPiecePtr>;
auto TranslateUnit() const -> Unit;
auto LayoutUnit() const -> Unit;
QSizeF Template(VAbstractLayoutDialog::PaperSizeTemplate t) const;
QSizeF SheetTemplate() const;
QSizeF TileTemplate() const;
void SheetSize(const QSizeF &size);
void TileSize(const QSizeF &size);
void CorrectPaperDecimals();
void SheetPaperSizeChanged();
void TilePaperSizeChanged();
void MinimumSheetPaperSize();
void MinimumTilePaperSize();
void FindTemplate(QComboBox *box, qreal width, qreal height);
void FindSheetTemplate();
void FindTileTemplate();
void CorrectTileMaxMargins();
void CorrectSheetMaxMargins();
void CorrectMaxMargins();
};
#endif // VPMAINWINDOW_H

File diff suppressed because it is too large Load Diff

View File

@ -273,6 +273,13 @@ auto VPSettings::GetLayoutFollowGrainline() const -> bool
return value(*settingLayoutFollowGrainline, false).toBool();
}
//---------------------------------------------------------------------------------------------------------------------
qreal VPSettings::GetMaxLayoutPieceGap()
{
return UnitConvertor(50, Unit::Cm, Unit::Px);
}
//---------------------------------------------------------------------------------------------------------------------
void VPSettings::SetLayoutPieceGap(qreal value)
{
setValue(*settingLayoutPieceGap, value);

View File

@ -90,6 +90,7 @@ public:
void SetLayoutFollowGrainline(bool value);
auto GetLayoutFollowGrainline() const -> bool;
static auto GetMaxLayoutPieceGap() -> qreal;
void SetLayoutPieceGap(qreal value);
auto GetLayoutPieceGap() const -> qreal;

View File

@ -22,44 +22,39 @@ void VPTileFactory::refreshTileInfos()
VPLayoutPtr layout = m_layout.toStrongRef();
if(not layout.isNull())
{
PageOrientation tilesOrientation = layout->LayoutSettings().GetTilesOrientation();
QSizeF tilesSize = layout->LayoutSettings().GetTilesSize();
QSizeF tilesSize = layout->LayoutSettings().GetTilesSize();
QMarginsF tilesMargins = layout->LayoutSettings().GetTilesMargins();
// sets the drawing height
m_drawingAreaHeight = (tilesOrientation == PageOrientation::Portrait)?
tilesSize.height() : tilesSize.width();
m_drawingAreaHeight -=
tilesMargins.top() + tilesMargins.bottom() + m_infoStripeWidth;
m_drawingAreaHeight = tilesSize.height();
// sets the drawing width
m_drawingAreaWidth = (tilesOrientation == PageOrientation::Portrait)?
tilesSize.width() : tilesSize.height();
m_drawingAreaWidth -=
tilesMargins.left() + tilesMargins.right() + m_infoStripeWidth;
QSizeF sheetSize = layout->LayoutSettings().GetSheetSize();
qreal totalDrawingWidth = 0;
qreal totaldrawingHeight = 0;
if(layout->LayoutSettings().GetOrientation() == PageOrientation::Portrait)
if (not layout->LayoutSettings().IgnoreTilesMargins())
{
totalDrawingWidth = sheetSize.width();
totaldrawingHeight = sheetSize.height();
m_drawingAreaHeight -= tilesMargins.top() + tilesMargins.bottom() + m_infoStripeWidth;
}
else
{
totalDrawingWidth = sheetSize.height();
totaldrawingHeight = sheetSize.width();
m_drawingAreaHeight += m_infoStripeWidth;
}
m_nbCol = qCeil(totalDrawingWidth/m_drawingAreaWidth);
m_nbRow = qCeil(totaldrawingHeight/m_drawingAreaHeight);
// sets the drawing width
m_drawingAreaWidth = tilesSize.width();
if (not layout->LayoutSettings().IgnoreTilesMargins())
{
m_drawingAreaWidth -= tilesMargins.left() + tilesMargins.right() + m_infoStripeWidth;
}
else
{
m_drawingAreaWidth += m_infoStripeWidth;
}
QSizeF sheetSize = layout->LayoutSettings().GetSheetSize();
m_nbCol = qCeil(sheetSize.width()/m_drawingAreaWidth);
m_nbRow = qCeil(sheetSize.height()/m_drawingAreaHeight);
}
}
//---------------------------------------------------------------------------------------------------------------------
void VPTileFactory::drawTile(QPainter *painter, VPMainGraphicsView *graphicsView, int row, int col)
{

View File

@ -147,8 +147,6 @@ void VPLayoutFileWriter::WriteFile(const VPLayoutPtr &layout, QIODevice *file)
.arg(APP_VERSION_STR));
WriteLayout(layout);
writeEndDocument();
file->close();
}
//---------------------------------------------------------------------------------------------------------------------

View File

@ -149,7 +149,7 @@ DialogSaveLayout::DialogSaveLayout(int count, Draw mode, const QString &fileName
ui->lineEditPath->setText(VAbstractValApplication::VApp()->ValentinaSettings()->GetPathLayout());
InitTemplates(ui->comboBoxTemplates);
InitTileTemplates(ui->comboBoxTemplates);
connect(ui->toolButtonScaleConnected, &QToolButton::clicked, this, &DialogSaveLayout::ToggleScaleConnection);
@ -163,20 +163,6 @@ DialogSaveLayout::DialogSaveLayout(int count, Draw mode, const QString &fileName
ShowExample();//Show example for current format.
}
//---------------------------------------------------------------------------------------------------------------------
void DialogSaveLayout::InitTemplates(QComboBox *comboBoxTemplates)
{
SCASSERT(comboBoxTemplates != nullptr)
VAbstractLayoutDialog::InitTemplates(comboBoxTemplates);
// remove unused formats
for (int i = static_cast<int>(PaperSizeTemplate::Roll24in); i <= static_cast<int>(PaperSizeTemplate::Custom); ++i)
{
comboBoxTemplates->removeItem(comboBoxTemplates->findData(i));
}
}
//---------------------------------------------------------------------------------------------------------------------
void DialogSaveLayout::SelectFormat(LayoutExportFormats format)

View File

@ -83,7 +83,6 @@ public:
protected:
virtual void showEvent(QShowEvent *event) override;
void InitTemplates(QComboBox *comboBoxTemplates);
private slots:
void Save();

View File

@ -84,6 +84,23 @@ void VAbstractLayoutDialog::InitTemplates(QComboBox *comboBoxTemplates)
comboBoxTemplates->setCurrentIndex(-1);
}
//---------------------------------------------------------------------------------------------------------------------
void VAbstractLayoutDialog::InitTileTemplates(QComboBox *comboBoxTemplates, bool keepCustom)
{
SCASSERT(comboBoxTemplates != nullptr)
InitTemplates(comboBoxTemplates);
// remove unused formats
for (int i = static_cast<int>(PaperSizeTemplate::Roll24in); i <= static_cast<int>(PaperSizeTemplate::Custom); ++i)
{
if (keepCustom && i == static_cast<int>(PaperSizeTemplate::Custom))
{
continue;
}
comboBoxTemplates->removeItem(comboBoxTemplates->findData(i));
}
}
//---------------------------------------------------------------------------------------------------------------------
auto VAbstractLayoutDialog::GetTemplateSize(PaperSizeTemplate tmpl, Unit unit) -> QSizeF
{

View File

@ -62,6 +62,7 @@ public:
static auto GetTemplateSize(PaperSizeTemplate tmpl, Unit unit) -> QSizeF;
static void InitTemplates(QComboBox *comboBoxTemplates);
static void InitTileTemplates(QComboBox *comboBoxTemplates, bool keepCustom = false);
protected:
typedef QStringList FormatsVector;

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

View File

@ -102,5 +102,8 @@
<file alias="16x16/actions/view-refresh.png">icons/win.icon.theme/16x16/actions/view-refresh.png</file>
<file alias="24x24/actions/view-refresh.png">icons/win.icon.theme/24x24/actions/view-refresh.png</file>
<file alias="32x32/actions/view-refresh.png">icons/win.icon.theme/32x32/actions/view-refresh.png</file>
<file alias="16x16/actions/object-rotate-right.png">icons/win.icon.theme/16x16/actions/object-rotate-right.png</file>
<file alias="24x24/actions/object-rotate-right.png">icons/win.icon.theme/24x24/actions/object-rotate-right.png</file>
<file alias="32x32/actions/object-rotate-right.png">icons/win.icon.theme/32x32/actions/object-rotate-right.png</file>
</qresource>
</RCC>