Enhancement. Disable a label options if a label template is empty.

Many user confused by not visible label even if "all" data filed. Valentina
should warn about this situation and force user to fill a label template.

--HG--
branch : develop
This commit is contained in:
Roman Telezhynskyi 2018-01-14 18:19:43 +02:00
parent 4e79aaa77f
commit dd6cc1edc6
4 changed files with 24 additions and 4 deletions

View File

@ -79,6 +79,15 @@ QString GetFormulaFromUser(QPlainTextEdit *textEdit)
} }
} }
//---------------------------------------------------------------------------------------------------------------------
DialogSeamAllowance::DialogSeamAllowance(const VContainer *data, const VAbstractPattern *doc, const quint32 &toolId,
QWidget *parent)
: DialogSeamAllowance(data, toolId, parent)
{
SCASSERT(doc != nullptr)
uiTabLabels->groupBoxPatternLabel->setEnabled(not doc->GetPatternLabelTemplate().isEmpty());
}
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
DialogSeamAllowance::DialogSeamAllowance(const VContainer *data, const quint32 &toolId, QWidget *parent) DialogSeamAllowance::DialogSeamAllowance(const VContainer *data, const quint32 &toolId, QWidget *parent)
: DialogTool(data, toolId, parent), : DialogTool(data, toolId, parent),
@ -323,6 +332,8 @@ void DialogSeamAllowance::SetPiece(const VPiece &piece)
uiTabLabels->checkBoxFold->setChecked(m_oldData.IsOnFold()); uiTabLabels->checkBoxFold->setChecked(m_oldData.IsOnFold());
m_templateLines = m_oldData.GetLabelTemplate(); m_templateLines = m_oldData.GetLabelTemplate();
uiTabLabels->groupBoxDetailLabel->setEnabled(not m_templateLines.isEmpty());
uiTabGrainline->comboBoxArrow->setCurrentIndex(int(piece.GetGrainlineGeometry().GetArrowType())); uiTabGrainline->comboBoxArrow->setCurrentIndex(int(piece.GetGrainlineGeometry().GetArrowType()));
uiTabLabels->groupBoxDetailLabel->setChecked(m_oldData.IsVisible()); uiTabLabels->groupBoxDetailLabel->setChecked(m_oldData.IsVisible());
@ -2264,6 +2275,7 @@ void DialogSeamAllowance::EditLabel()
if (QDialog::Accepted == editor.exec()) if (QDialog::Accepted == editor.exec())
{ {
m_templateLines = editor.GetTemplate(); m_templateLines = editor.GetTemplate();
uiTabLabels->groupBoxDetailLabel->setEnabled(not m_templateLines.isEmpty());
} }
} }

View File

@ -56,6 +56,8 @@ class DialogSeamAllowance : public DialogTool
Q_OBJECT Q_OBJECT
public: public:
DialogSeamAllowance(const VContainer *data, const VAbstractPattern *doc, const quint32 &toolId,
QWidget *parent = nullptr);
DialogSeamAllowance(const VContainer *data, const quint32 &toolId, QWidget *parent = nullptr); DialogSeamAllowance(const VContainer *data, const quint32 &toolId, QWidget *parent = nullptr);
virtual ~DialogSeamAllowance(); virtual ~DialogSeamAllowance();

View File

@ -55,7 +55,7 @@
<item> <item>
<widget class="QPushButton" name="pushButtonEditPieceLabel"> <widget class="QPushButton" name="pushButtonEditPieceLabel">
<property name="toolTip"> <property name="toolTip">
<string>Edit pattern label</string> <string>Edit piece label template</string>
</property> </property>
<property name="text"> <property name="text">
<string>Edit template</string> <string>Edit template</string>
@ -237,7 +237,10 @@
</property> </property>
<widget class="QGroupBox" name="groupBoxDetailLabel"> <widget class="QGroupBox" name="groupBoxDetailLabel">
<property name="enabled"> <property name="enabled">
<bool>true</bool> <bool>false</bool>
</property>
<property name="toolTip">
<string>Options to control position a detail label. &lt;b&gt;Not available if a detail label template is empty&lt;/b&gt;.</string>
</property> </property>
<property name="title"> <property name="title">
<string>Detail label visible</string> <string>Detail label visible</string>
@ -946,7 +949,10 @@
</widget> </widget>
<widget class="QGroupBox" name="groupBoxPatternLabel"> <widget class="QGroupBox" name="groupBoxPatternLabel">
<property name="enabled"> <property name="enabled">
<bool>true</bool> <bool>false</bool>
</property>
<property name="toolTip">
<string>Options to control position a pattern label. &lt;b&gt;Not available if a pattern label template is empty&lt;/b&gt;.</string>
</property> </property>
<property name="title"> <property name="title">
<string>Pattern label visible</string> <string>Pattern label visible</string>

View File

@ -1430,7 +1430,7 @@ void VToolSeamAllowance::SaveDialogChange(const QString &undoText)
void VToolSeamAllowance::ShowOptions() void VToolSeamAllowance::ShowOptions()
{ {
QSharedPointer<DialogSeamAllowance> dialog = QSharedPointer<DialogSeamAllowance> dialog =
QSharedPointer<DialogSeamAllowance>(new DialogSeamAllowance(getData(), m_id, qApp->getMainWindow())); QSharedPointer<DialogSeamAllowance>(new DialogSeamAllowance(getData(), doc, m_id, qApp->getMainWindow()));
dialog->EnableApply(true); dialog->EnableApply(true);
m_dialog = dialog; m_dialog = dialog;
m_dialog->setModal(true); m_dialog->setModal(true);