Persistence of sheet name

This commit is contained in:
Ronan Le Tiec 2020-11-21 13:45:26 +01:00
parent 898a5a92c3
commit b606497c48
6 changed files with 39 additions and 1 deletions

View File

@ -83,6 +83,15 @@ void VPCarrousel::Refresh()
RefreshOrientation();
}
//---------------------------------------------------------------------------------------------------------------------
void VPCarrousel::RefreshFocusedSheetName()
{
// FIXME : This implementation will need a refactoring when we have multiple sheets, now it's not very nice!!
ui->comboBoxPieceList->setItemText(1, tr("Pieces of ") + m_layout->GetFocusedSheet()->GetName());
}
//---------------------------------------------------------------------------------------------------------------------
void VPCarrousel::Clear()
{

View File

@ -65,6 +65,11 @@ public:
*/
void Refresh();
/**
* @brief RefreshFocusedSheetName refreshes the name of the focused sheet
*/
void RefreshFocusedSheetName();
/**
* @brief Clear Clears the carrousel (removes everything)
*/

View File

@ -258,6 +258,12 @@ void VPGraphicsPiece::paint(QPainter *painter, const QStyleOptionGraphicsItem *o
// TODO Detail & Piece Label
// QPointF position = m_piece->GetPatternTextPosition();
// QStringList texts = m_piece->GetPatternText();
// painter->drawText();
// when using m_piece->GetItem(), the results were quite bad

View File

@ -1041,6 +1041,17 @@ void VPMainWindow::on_comboBoxLayoutUnit_currentIndexChanged(int index)
SetPropertyTabTilesData();
}
//---------------------------------------------------------------------------------------------------------------------
void VPMainWindow::on_lineEditSheetName_textChanged(const QString &text)
{
m_layout->GetFocusedSheet()->SetName(text);
if(m_carrousel != nullptr)
{
m_carrousel->RefreshFocusedSheetName();
}
}
//---------------------------------------------------------------------------------------------------------------------
void VPMainWindow::on_comboBoxSheetTemplate_currentIndexChanged(int index)
{

View File

@ -285,6 +285,13 @@ private slots:
*/
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
*/
void on_lineEditSheetName_textChanged(const QString &text);
/**
* @brief on_comboBoxLayoutTemplate_currentIndexChanged When the template is
* changed in the sheet property tab.

View File

@ -176,7 +176,7 @@
<enum>QTabWidget::Rounded</enum>
</property>
<property name="currentIndex">
<number>2</number>
<number>1</number>
</property>
<property name="iconSize">
<size>