diff --git a/src/app/puzzle/vpcarrousel.cpp b/src/app/puzzle/vpcarrousel.cpp index 1c231d27e..d1f8f588f 100644 --- a/src/app/puzzle/vpcarrousel.cpp +++ b/src/app/puzzle/vpcarrousel.cpp @@ -103,7 +103,8 @@ void VPCarrousel::Refresh() ui->comboBoxPieceList->blockSignals(false); } - on_ActivePieceListChanged(index != -1 ? index: 0); + ui->comboBoxPieceList->setCurrentIndex(-1); + ui->comboBoxPieceList->setCurrentIndex(index != -1 ? index : 0); RefreshOrientation(); } diff --git a/src/app/puzzle/vpmainwindow.cpp b/src/app/puzzle/vpmainwindow.cpp index c17c54eac..0f82c5b40 100644 --- a/src/app/puzzle/vpmainwindow.cpp +++ b/src/app/puzzle/vpmainwindow.cpp @@ -69,17 +69,7 @@ VPMainWindow::VPMainWindow(const VPCommandLinePtr &cmd, QWidget *parent) : m_cmd(cmd), m_statusLabel(new QLabel(this)) { - // create a standard sheet - auto *sheet = new VPSheet(m_layout); - sheet->SetName(QObject::tr("Sheet 1")); - m_layout->AddSheet(sheet); - m_layout->SetFocusedSheet(); - -// // ----- for test purposes, to be removed------------------ - sheet->SetSheetMarginsConverted(1, 1, 1, 1); - sheet->SetSheetSizeConverted(84.1, 118.9); - sheet->SetPiecesGapConverted(1); - + // // ----- for test purposes, to be removed------------------ m_layout->SetUnit(Unit::Cm); m_layout->SetWarningSuperpositionOfPieces(true); m_layout->SetTitle(QString("My Test Layout")); @@ -94,6 +84,9 @@ VPMainWindow::VPMainWindow(const VPCommandLinePtr &cmd, QWidget *parent) : ui->setupUi(this); + // create a standard sheet + AddSheet(); + // init the tile factory m_tileFactory = new VPTileFactory(m_layout, VPApplication::VApp()->Settings()); m_tileFactory->refreshTileInfos(); @@ -1088,6 +1081,20 @@ void VPMainWindow::CreateWindowMenu(QMenu *menu) } } +//--------------------------------------------------------------------------------------------------------------------- +void VPMainWindow::AddSheet() +{ + auto *sheet = new VPSheet(m_layout); + sheet->SetName(QObject::tr("Sheet %1").arg(m_layout->GetSheets().size()+1)); + m_layout->AddSheet(sheet); + m_layout->SetFocusedSheet(); + +// // ----- for test purposes, to be removed------------------ + sheet->SetSheetMarginsConverted(1, 1, 1, 1); + sheet->SetSheetSizeConverted(84.1, 118.9); + sheet->SetPiecesGapConverted(1); +} + //--------------------------------------------------------------------------------------------------------------------- void VPMainWindow::on_actionNew_triggered() { @@ -1867,6 +1874,13 @@ void VPMainWindow::ToolBarStyles() ToolBarStyle(ui->toolBarZoom); } +//--------------------------------------------------------------------------------------------------------------------- +void VPMainWindow::on_actionAddSheet_triggered() +{ + AddSheet(); + m_carrousel->Refresh(); +} + //--------------------------------------------------------------------------------------------------------------------- #if defined(Q_OS_MAC) void VPMainWindow::AboutToShowDockMenu() diff --git a/src/app/puzzle/vpmainwindow.h b/src/app/puzzle/vpmainwindow.h index 6d7d62c30..2783bbbfa 100644 --- a/src/app/puzzle/vpmainwindow.h +++ b/src/app/puzzle/vpmainwindow.h @@ -106,7 +106,7 @@ protected: virtual void changeEvent(QEvent* event) override; virtual QStringList RecentFileList() const override; - private slots: +private slots: /** * @brief on_actionOpen_triggered When the menu action File > Open is * triggered. @@ -400,6 +400,8 @@ protected: void ToolBarStyles(); + void on_actionAddSheet_triggered(); + #if defined(Q_OS_MAC) void AboutToShowDockMenu(); #endif //defined(Q_OS_MAC) @@ -551,6 +553,8 @@ private: void generateTiledPdf(QString fileName); void CreateWindowMenu(QMenu *menu); + + void AddSheet(); }; #endif // VPMAINWINDOW_H diff --git a/src/app/puzzle/vpmainwindow.ui b/src/app/puzzle/vpmainwindow.ui index 4ac7e21d7..30f148558 100644 --- a/src/app/puzzle/vpmainwindow.ui +++ b/src/app/puzzle/vpmainwindow.ui @@ -62,6 +62,7 @@ &Edit + @@ -668,7 +669,7 @@ 0 - -170 + 0 342 870 @@ -1761,6 +1762,11 @@ Preferences + + + Add Sheet + + diff --git a/src/libs/vlayout/vlayoutpiece.cpp b/src/libs/vlayout/vlayoutpiece.cpp index 7b24260cd..fe93188c4 100644 --- a/src/libs/vlayout/vlayoutpiece.cpp +++ b/src/libs/vlayout/vlayoutpiece.cpp @@ -1186,7 +1186,7 @@ void VLayoutPiece::DrawMiniature(QPainter &painter) const { painter.drawPath(ContourPath()); - for (auto &path : d->m_internalPaths) + for (const auto &path : d->m_internalPaths) { painter.save(); @@ -1199,7 +1199,7 @@ void VLayoutPiece::DrawMiniature(QPainter &painter) const painter.restore(); } - for (auto &label : d->m_placeLabels) + for (const auto &label : d->m_placeLabels) { painter.drawPath(VPlaceLabelItem::LabelShapePath(label.shape)); }