Fixed label update on clicking OK in pattern properties dialog and the label is hidden when there is no text on it

--HG--
branch : feature
This commit is contained in:
BojanKverh 2016-07-30 13:21:03 +02:00
parent a3f4c6da0d
commit a1c905381b
4 changed files with 22 additions and 1 deletions

View file

@ -188,6 +188,9 @@ DialogPatternProperties::DialogPatternProperties(const QString &filePath, VPatte
connect(ui->lineEditPatternNumber, &QLineEdit::editingFinished, this, &DialogPatternProperties::GeneralInfoChanged);
connect(ui->lineEditCompanyName, &QLineEdit::editingFinished, this, &DialogPatternProperties::GeneralInfoChanged);
connect(ui->lineEditCustomerName, &QLineEdit::editingFinished, this, &DialogPatternProperties::GeneralInfoChanged);
connect(ui->lineEditSize, &QLineEdit::editingFinished, this, &DialogPatternProperties::GeneralInfoChanged);
connect(ui->checkBoxShowDate, &QCheckBox::stateChanged, this, &DialogPatternProperties::GeneralInfoChanged);
connect(ui->checkBoxShowMeasurements, &QCheckBox::stateChanged, this, &DialogPatternProperties::GeneralInfoChanged);
}
//---------------------------------------------------------------------------------------------------------------------

View file

@ -293,6 +293,16 @@ void VTextGraphicsItem::UpdateData(const VAbstractPattern* pDoc)
m_tm.Update(pDoc);
}
//---------------------------------------------------------------------------------------------------------------------
/**
* @brief VTextGraphicsItem::GetTextLines returns the number of lines of text to show
* @return number of lines of text
*/
int VTextGraphicsItem::GetTextLines() const
{
return m_tm.GetCount();
}
//---------------------------------------------------------------------------------------------------------------------
/**
* @brief VTextGraphicsItem::GetFontSize returns the currently used text base font size

View file

@ -69,6 +69,7 @@ public:
bool IsContained(QRectF rectBB, qreal dRot, qreal& dX, qreal& dY) const;
void UpdateData(const QString& qsName, const VPatternPieceData& data);
void UpdateData(const VAbstractPattern* pDoc);
int GetTextLines() const;
protected:
void mousePressEvent(QGraphicsSceneMouseEvent* pME);

View file

@ -748,7 +748,14 @@ void VToolDetail::UpdatePatternInfo()
patternInfo->setPos(pt);
patternInfo->setRotation(geom.GetRotation());
patternInfo->Update();
patternInfo->show();
if (patternInfo->GetTextLines() > 0)
{
patternInfo->show();
}
else
{
patternInfo->hide();
}
}
else
{