Layout name und description persistence

This commit is contained in:
Ronan Le Tiec 2020-11-11 19:14:06 +01:00
parent 23c4f81904
commit c0c85bb2d5
4 changed files with 60 additions and 2 deletions

View File

@ -141,6 +141,31 @@ bool VPLayout::GetWarningPiecesOutOfBound() const
return m_warningPiecesOutOfBound; return m_warningPiecesOutOfBound;
} }
//---------------------------------------------------------------------------------------------------------------------
void VPLayout::SetTitle(QString title)
{
m_title = title;
}
//---------------------------------------------------------------------------------------------------------------------
QString VPLayout::GetTitle() const
{
return m_title;
}
//---------------------------------------------------------------------------------------------------------------------
void VPLayout::SetDescription(QString description)
{
m_description = description;
}
//---------------------------------------------------------------------------------------------------------------------
QString VPLayout::GetDescription() const
{
return m_description;
}
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
void VPLayout::ClearSelection() void VPLayout::ClearSelection()
{ {

View File

@ -78,6 +78,30 @@ public:
void SetWarningPiecesOutOfBound(bool state); void SetWarningPiecesOutOfBound(bool state);
bool GetWarningPiecesOutOfBound() const; bool GetWarningPiecesOutOfBound() const;
/**
* @brief SetTitle Sets the title of the layout to the given value
* @param title the title of the layout
*/
void SetTitle(QString title);
/**
* @brief GetTitle Returns the title of the layout
* @return
*/
QString GetTitle() const;
/**
* @brief SetDescription Sets the description of the layout to the given value
* @param description the description of the layout
*/
void SetDescription(QString description);
/**
* @brief GetDescription Returns the description of the layout.
* @return
*/
QString GetDescription() const;
/** /**
* @brief ClearSelection goes through the unplaced pieces and through the sheets and calls * @brief ClearSelection goes through the unplaced pieces and through the sheets and calls
* SetIsSelected(false) for the pieces that were selected. * SetIsSelected(false) for the pieces that were selected.
@ -141,6 +165,9 @@ private:
bool m_warningSuperpositionOfPieces{false}; bool m_warningSuperpositionOfPieces{false};
bool m_warningPiecesOutOfBound{false}; bool m_warningPiecesOutOfBound{false};
QString m_title{};
QString m_description{};
}; };

View File

@ -73,6 +73,8 @@ VPMainWindow::VPMainWindow(const VPCommandLinePtr &cmd, QWidget *parent) :
m_layout->SetUnit(Unit::Cm); m_layout->SetUnit(Unit::Cm);
m_layout->SetWarningSuperpositionOfPieces(true); m_layout->SetWarningSuperpositionOfPieces(true);
m_layout->SetTitle(QString("My Test Layout"));
m_layout->SetDescription(QString("Description of my Layout"));
// -------------------------------------------------------- // --------------------------------------------------------
ui->setupUi(this); ui->setupUi(this);
@ -250,6 +252,10 @@ void VPMainWindow::InitPropertyTabCurrentPiece()
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
void VPMainWindow::InitPropertyTabLayout() void VPMainWindow::InitPropertyTabLayout()
{ {
// --------------- init the title and derscription -----------------
ui->lineEditLayoutName->setText(m_layout->GetTitle());
ui->plainTextEditLayoutDescription->setPlainText(m_layout->GetDescription());
// -------------------- init the unit combobox --------------------- // -------------------- init the unit combobox ---------------------
ui->comboBoxLayoutUnit->addItem(tr("Centimeters"), QVariant(UnitsToStr(Unit::Cm))); ui->comboBoxLayoutUnit->addItem(tr("Centimeters"), QVariant(UnitsToStr(Unit::Cm)));
ui->comboBoxLayoutUnit->addItem(tr("Millimiters"), QVariant(UnitsToStr(Unit::Mm))); ui->comboBoxLayoutUnit->addItem(tr("Millimiters"), QVariant(UnitsToStr(Unit::Mm)));

View File

@ -176,7 +176,7 @@
<enum>QTabWidget::Rounded</enum> <enum>QTabWidget::Rounded</enum>
</property> </property>
<property name="currentIndex"> <property name="currentIndex">
<number>1</number> <number>3</number>
</property> </property>
<property name="iconSize"> <property name="iconSize">
<size> <size>
@ -1089,7 +1089,7 @@
<item row="0" column="1"> <item row="0" column="1">
<widget class="QLineEdit" name="lineEditLayoutName"> <widget class="QLineEdit" name="lineEditLayoutName">
<property name="text"> <property name="text">
<string>My layout</string> <string/>
</property> </property>
</widget> </widget>
</item> </item>