Merged in BojanKverh/valentina-issue24a/feature (pull request #138)
Improvements for feature "New feature: Label on detail" ref #24. --HG-- branch : develop
This commit is contained in:
commit
7dd88da82d
|
@ -43,6 +43,7 @@
|
|||
#include <QVBoxLayout>
|
||||
#include <QDirIterator>
|
||||
#include <QFormLayout>
|
||||
#include <QPushButton>
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
ConfigurationPage::ConfigurationPage(QWidget *parent)
|
||||
|
|
|
@ -39,6 +39,8 @@
|
|||
#include <QLineEdit>
|
||||
#include <QVBoxLayout>
|
||||
#include <QFormLayout>
|
||||
#include <QMessageBox>
|
||||
#include <QPushButton>
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
PatternPage::PatternPage(QWidget *parent):
|
||||
|
@ -50,16 +52,20 @@ PatternPage::PatternPage(QWidget *parent):
|
|||
graphOutputCheck(nullptr),
|
||||
undoGroup(nullptr),
|
||||
undoCount(nullptr),
|
||||
countStepsLabel(nullptr)
|
||||
countStepsLabel(nullptr),
|
||||
userMaterialsGroup(nullptr),
|
||||
userMaterialClearButton(nullptr)
|
||||
{
|
||||
QGroupBox *userGroup = UserGroup();
|
||||
QGroupBox *graphOutputGroup = GraphOutputGroup();
|
||||
QGroupBox *undoGroup = UndoGroup();
|
||||
QGroupBox *userMatGroup = UserMaterialGroup();
|
||||
|
||||
QVBoxLayout *mainLayout = new QVBoxLayout;
|
||||
mainLayout->addWidget(userGroup);
|
||||
mainLayout->addWidget(graphOutputGroup);
|
||||
mainLayout->addWidget(undoGroup);
|
||||
mainLayout->addWidget(userMatGroup);
|
||||
mainLayout->addStretch(1);
|
||||
setLayout(mainLayout);
|
||||
}
|
||||
|
@ -81,6 +87,16 @@ void PatternPage::Apply()
|
|||
settings->SetUndoCount(undoCount->value());
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void PatternPage::ClearUserDefinedMaterials()
|
||||
{
|
||||
VSettings* pSet = qApp->ValentinaSettings();
|
||||
pSet->ClearUserDefinedMaterial();
|
||||
pSet->sync();
|
||||
QString qsMsg = tr("All user defined materials have been deleted!");
|
||||
QMessageBox::information(this, QApplication::applicationName(), qsMsg);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void PatternPage::changeEvent(QEvent *event)
|
||||
{
|
||||
|
@ -152,6 +168,21 @@ QGroupBox *PatternPage::UndoGroup()
|
|||
return undoGroup;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
QGroupBox *PatternPage::UserMaterialGroup()
|
||||
{
|
||||
userMaterialsGroup = new QGroupBox(tr("User defined materials"));
|
||||
userMaterialClearButton = new QPushButton(tr("Delete all"));
|
||||
connect(userMaterialClearButton, &QPushButton::clicked, this, &PatternPage::ClearUserDefinedMaterials);
|
||||
|
||||
QHBoxLayout* pLayout = new QHBoxLayout;
|
||||
pLayout->addWidget(userMaterialClearButton);
|
||||
pLayout->addStretch(1);
|
||||
|
||||
userMaterialsGroup->setLayout(pLayout);
|
||||
return userMaterialsGroup;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void PatternPage::RetranslateUi()
|
||||
{
|
||||
|
|
|
@ -37,6 +37,7 @@ class QSpinBox;
|
|||
class QGroupBox;
|
||||
class QLineEdit;
|
||||
class QLabel;
|
||||
class QPushButton;
|
||||
|
||||
class PatternPage : public QWidget
|
||||
{
|
||||
|
@ -44,6 +45,8 @@ class PatternPage : public QWidget
|
|||
public:
|
||||
explicit PatternPage(QWidget *parent = nullptr);
|
||||
void Apply();
|
||||
public slots:
|
||||
void ClearUserDefinedMaterials();
|
||||
protected:
|
||||
virtual void changeEvent(QEvent* event) Q_DECL_OVERRIDE;
|
||||
private:
|
||||
|
@ -56,9 +59,13 @@ private:
|
|||
QGroupBox *undoGroup;
|
||||
QSpinBox *undoCount;
|
||||
QLabel *countStepsLabel;
|
||||
QGroupBox *userMaterialsGroup;
|
||||
QPushButton* userMaterialClearButton;
|
||||
|
||||
QGroupBox *UserGroup() Q_REQUIRED_RESULT;
|
||||
QGroupBox *GraphOutputGroup() Q_REQUIRED_RESULT;
|
||||
QGroupBox *UndoGroup() Q_REQUIRED_RESULT;
|
||||
QGroupBox *UserMaterialGroup() Q_REQUIRED_RESULT;
|
||||
|
||||
void RetranslateUi();
|
||||
};
|
||||
|
|
|
@ -1139,8 +1139,11 @@
|
|||
</item>
|
||||
<item row="6" column="1">
|
||||
<widget class="QLineEdit" name="lineEditSize">
|
||||
<property name="toolTip">
|
||||
<string>Use %size% and %height% to insert pattern size and height</string>
|
||||
</property>
|
||||
<property name="maxLength">
|
||||
<number>30</number>
|
||||
<number>40</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
|
|
|
@ -1222,6 +1222,7 @@ void MainWindow::changeEvent(QEvent *event)
|
|||
helpLabel->setText(QObject::tr("Changes applied."));
|
||||
patternPieceLabel->setText(tr("Pattern Piece:"));
|
||||
UpdateWindowTitle();
|
||||
emit sceneDetails->LanguageChanged();
|
||||
}
|
||||
// remember to call base class implementation
|
||||
QMainWindow::changeEvent(event);
|
||||
|
@ -2805,6 +2806,7 @@ void MainWindow::ChangedSize(const QString & text)
|
|||
if (UpdateMeasurements(AbsoluteMPath(curFile, doc->MPath()), text.toInt(), static_cast<int>(pattern->height())))
|
||||
{
|
||||
doc->LiteParseTree(Document::LiteParse);
|
||||
emit sceneDetails->DimensionsChanged();
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -2833,6 +2835,7 @@ void MainWindow::ChangedHeight(const QString &text)
|
|||
if (UpdateMeasurements(AbsoluteMPath(curFile, doc->MPath()), static_cast<int>(pattern->size()), text.toInt()))
|
||||
{
|
||||
doc->LiteParseTree(Document::LiteParse);
|
||||
emit sceneDetails->DimensionsChanged();
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -470,7 +470,7 @@ void MainWindowsNoGUI::PrepareDetailsForLayout(const QHash<quint32, VDetail> *de
|
|||
{
|
||||
date = QDate::currentDate();
|
||||
}
|
||||
det.SetPatternInfo(pDoc, geom, qApp->font());
|
||||
det.SetPatternInfo(pDoc, geom, qApp->font(), pattern->size(), pattern->height());
|
||||
}
|
||||
det.setWidth(qApp->toPixel(d.getWidth()));
|
||||
det.CreateTextItems();
|
||||
|
|
|
@ -689,7 +689,10 @@ void VPattern::ParseDetailElement(const QDomElement &domElement, const Document
|
|||
MaterialCutPlacement mcp;
|
||||
QDomElement domMCP = nodeListMCP.at(iMCP).toElement();
|
||||
mcp.m_eMaterial = MaterialType(GetParametrUInt(domMCP, AttrMaterial, 0));
|
||||
if (mcp.m_eMaterial == MaterialType::mtUserDefined)
|
||||
{
|
||||
mcp.m_qsMaterialUserDef = GetParametrString(domMCP, AttrUserDefined, "");
|
||||
}
|
||||
mcp.m_iCutNumber = GetParametrUInt(domMCP, AttrCutNumber, 0);
|
||||
mcp.m_ePlacement = PlacementType(GetParametrUInt(domMCP, AttrPlacement, 0));
|
||||
detail.GetPatternPieceData().Append(mcp);
|
||||
|
|
|
@ -153,7 +153,8 @@ void VLayoutDetail::SetDetail(const QString& qsName, const VPatternPieceData& da
|
|||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VLayoutDetail::SetPatternInfo(const VAbstractPattern* pDoc, const VPatternInfoGeometry& geom, const QFont &font)
|
||||
void VLayoutDetail::SetPatternInfo(const VAbstractPattern* pDoc, const VPatternInfoGeometry& geom, const QFont &font,
|
||||
qreal dSize, qreal dHeight)
|
||||
{
|
||||
d->patternGeom = geom;
|
||||
qreal dAng = qDegreesToRadians(geom.GetRotation());
|
||||
|
@ -173,7 +174,7 @@ void VLayoutDetail::SetPatternInfo(const VAbstractPattern* pDoc, const VPatternI
|
|||
d->m_tmPattern.SetFont(font);
|
||||
d->m_tmPattern.SetFontSize(geom.GetFontSize());
|
||||
|
||||
d->m_tmPattern.Update(pDoc);
|
||||
d->m_tmPattern.Update(pDoc, dSize, dHeight);
|
||||
// generate lines of text
|
||||
d->m_tmPattern.SetFontSize(geom.GetFontSize());
|
||||
d->m_tmPattern.FitFontSize(geom.GetLabelWidth(), geom.GetLabelHeight());
|
||||
|
|
|
@ -77,7 +77,8 @@ public:
|
|||
|
||||
void SetDetail(const QString &qsName, const VPatternPieceData& data, const QFont& font);
|
||||
|
||||
void SetPatternInfo(const VAbstractPattern* pDoc, const VPatternInfoGeometry& geom, const QFont& font);
|
||||
void SetPatternInfo(const VAbstractPattern* pDoc, const VPatternInfoGeometry& geom, const QFont& font,
|
||||
qreal dSize, qreal dHeight);
|
||||
|
||||
QTransform GetMatrix() const;
|
||||
void SetMatrix(const QTransform &matrix);
|
||||
|
|
|
@ -1,8 +1,37 @@
|
|||
/************************************************************************
|
||||
**
|
||||
** @file vpatternpiecedata.cpp
|
||||
** @author Bojan Kverh
|
||||
** @date July 19, 2016
|
||||
**
|
||||
** @brief
|
||||
** @copyright
|
||||
** This source code is part of the Valentine project, a pattern making
|
||||
** program, whose allow create and modeling patterns of clothing.
|
||||
** Copyright (C) 2013-2015 Valentina project
|
||||
** <https://bitbucket.org/dismine/valentina> All Rights Reserved.
|
||||
**
|
||||
** Valentina is free software: you can redistribute it and/or modify
|
||||
** it under the terms of the GNU General Public License as published by
|
||||
** the Free Software Foundation, either version 3 of the License, or
|
||||
** (at your option) any later version.
|
||||
**
|
||||
** Valentina is distributed in the hope that it will be useful,
|
||||
** but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
** GNU General Public License for more details.
|
||||
**
|
||||
** You should have received a copy of the GNU General Public License
|
||||
** along with Valentina. If not, see <http://www.gnu.org/licenses/>.
|
||||
**
|
||||
*************************************************************************/
|
||||
|
||||
#include <QDate>
|
||||
#include <QFileInfo>
|
||||
#include <QFontMetrics>
|
||||
#include <QLatin1String>
|
||||
#include <QRegularExpression>
|
||||
#include <QApplication>
|
||||
|
||||
#include "../ifc/xml/vabstractpattern.h"
|
||||
#include "../vpatterndb/vpatternpiecedata.h"
|
||||
|
@ -212,6 +241,11 @@ void VTextManager::Update(const QString& qsName, const VPatternPieceData& data)
|
|||
AddLine(tl);
|
||||
}
|
||||
// MCP
|
||||
QStringList qslMaterials;
|
||||
qslMaterials << QApplication::translate("Detail", "Fabric", 0)
|
||||
<< QApplication::translate("Detail", "Lining", 0)
|
||||
<< QApplication::translate("Detail", "Interfacing", 0)
|
||||
<< QApplication::translate("Detail", "Interlining", 0);
|
||||
QString qsText = tr("Cut %1 on %2%3");
|
||||
QStringList qslPlace;
|
||||
qslPlace << "" << QLatin1String(" ") + tr("on Fold");
|
||||
|
@ -222,7 +256,16 @@ void VTextManager::Update(const QString& qsName, const VPatternPieceData& data)
|
|||
MaterialCutPlacement mcp = data.GetMCP(i);
|
||||
if (mcp.m_iCutNumber > 0)
|
||||
{
|
||||
tl.m_qsText = qsText.arg(mcp.m_iCutNumber).arg(mcp.m_qsMaterialUserDef).
|
||||
QString qsMat;
|
||||
if (mcp.m_eMaterial == MaterialType::mtUserDefined)
|
||||
{
|
||||
qsMat = mcp.m_qsMaterialUserDef;
|
||||
}
|
||||
else
|
||||
{
|
||||
qsMat = qslMaterials[int(mcp.m_eMaterial)];
|
||||
}
|
||||
tl.m_qsText = qsText.arg(mcp.m_iCutNumber).arg(qsMat).
|
||||
arg(qslPlace[int(mcp.m_ePlacement)]);
|
||||
AddLine(tl);
|
||||
}
|
||||
|
@ -234,7 +277,7 @@ void VTextManager::Update(const QString& qsName, const VPatternPieceData& data)
|
|||
* @brief VTextManager::Update updates the text lines with pattern info
|
||||
* @param pDoc pointer to the abstract pattern object
|
||||
*/
|
||||
void VTextManager::Update(const VAbstractPattern *pDoc)
|
||||
void VTextManager::Update(const VAbstractPattern *pDoc, qreal dSize, qreal dHeight)
|
||||
{
|
||||
Clear();
|
||||
TextLine tl;
|
||||
|
@ -281,6 +324,8 @@ void VTextManager::Update(const VAbstractPattern *pDoc)
|
|||
tl.m_qsText = pDoc->GetPatternSize();
|
||||
if (tl.m_qsText.isEmpty() == false)
|
||||
{
|
||||
tl.m_qsText.replace(QApplication::translate("Detail", "%size%", 0), QString::number(dSize));
|
||||
tl.m_qsText.replace(QApplication::translate("Detail", "%height%", 0), QString::number(dHeight));
|
||||
tl.m_eFontWeight = QFont::Normal;
|
||||
tl.m_eStyle = QFont::StyleNormal;
|
||||
tl.m_iFontSize = 0;
|
||||
|
|
|
@ -1,3 +1,31 @@
|
|||
/************************************************************************
|
||||
**
|
||||
** @file vpatternpiecedata.cpp
|
||||
** @author Bojan Kverh
|
||||
** @date July 19, 2016
|
||||
**
|
||||
** @brief
|
||||
** @copyright
|
||||
** This source code is part of the Valentine project, a pattern making
|
||||
** program, whose allow create and modeling patterns of clothing.
|
||||
** Copyright (C) 2013-2015 Valentina project
|
||||
** <https://bitbucket.org/dismine/valentina> All Rights Reserved.
|
||||
**
|
||||
** Valentina is free software: you can redistribute it and/or modify
|
||||
** it under the terms of the GNU General Public License as published by
|
||||
** the Free Software Foundation, either version 3 of the License, or
|
||||
** (at your option) any later version.
|
||||
**
|
||||
** Valentina is distributed in the hope that it will be useful,
|
||||
** but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
** GNU General Public License for more details.
|
||||
**
|
||||
** You should have received a copy of the GNU General Public License
|
||||
** along with Valentina. If not, see <http://www.gnu.org/licenses/>.
|
||||
**
|
||||
*************************************************************************/
|
||||
|
||||
#ifndef VTEXTMANAGER_H
|
||||
#define VTEXTMANAGER_H
|
||||
|
||||
|
@ -57,7 +85,7 @@ public:
|
|||
bool IsBigEnough(qreal fW, qreal fH, int iFontSize);
|
||||
void FitFontSize(qreal fW, qreal fH);
|
||||
void Update(const QString& qsName, const VPatternPieceData& data);
|
||||
void Update(const VAbstractPattern* pDoc);
|
||||
void Update(const VAbstractPattern* pDoc, qreal dSize, qreal dHeight);
|
||||
|
||||
protected:
|
||||
static QStringList SplitString(const QString& qs, qreal fW, const QFontMetrics& fm);
|
||||
|
|
|
@ -70,6 +70,7 @@ const QString VCommonSettings::SettingGeneralToolbarsState = QString
|
|||
const QString VCommonSettings::SettingPreferenceDialogSize = QStringLiteral("preferenceDialogSize");
|
||||
const QString VCommonSettings::SettingLatestSkippedVersion = QStringLiteral("lastestSkippedVersion");
|
||||
const QString VCommonSettings::SettingDateOfLastRemind = QStringLiteral("dateOfLastRemind");
|
||||
const QString VCommonSettings::SettingUserDefinedMaterials = QStringLiteral("configuration/userDefinedMaterials");
|
||||
|
||||
static const QString commonIniFilename = QStringLiteral("common");
|
||||
|
||||
|
@ -464,3 +465,24 @@ void VCommonSettings::SetDateOfLastRemind(const QDate &date)
|
|||
settings.setValue(SettingDateOfLastRemind, date);
|
||||
settings.sync();
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
QStringList VCommonSettings::GetUserDefinedMaterials() const
|
||||
{
|
||||
return value(SettingUserDefinedMaterials).toStringList();
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VCommonSettings::AddUserDefinedMaterial(QString qsMaterial)
|
||||
{
|
||||
QStringList qsl = GetUserDefinedMaterials();
|
||||
qsl << qsMaterial;
|
||||
setValue(SettingUserDefinedMaterials, qsl);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VCommonSettings::ClearUserDefinedMaterial()
|
||||
{
|
||||
QStringList qsl;
|
||||
setValue(SettingUserDefinedMaterials, qsl);
|
||||
}
|
||||
|
|
|
@ -118,6 +118,10 @@ public:
|
|||
QDate GetDateOfLastRemind() const;
|
||||
void SetDateOfLastRemind(const QDate &date);
|
||||
|
||||
QStringList GetUserDefinedMaterials() const;
|
||||
void AddUserDefinedMaterial(QString qsMaterial);
|
||||
void ClearUserDefinedMaterial();
|
||||
|
||||
private:
|
||||
Q_DISABLE_COPY(VCommonSettings)
|
||||
|
||||
|
@ -146,6 +150,7 @@ private:
|
|||
static const QString SettingPreferenceDialogSize;
|
||||
static const QString SettingLatestSkippedVersion;
|
||||
static const QString SettingDateOfLastRemind;
|
||||
static const QString SettingUserDefinedMaterials;
|
||||
};
|
||||
|
||||
#endif // VCOMMONSETTINGS_H
|
||||
|
|
|
@ -598,3 +598,4 @@ void VSettings::SetMultiplier(quint8 value)
|
|||
{
|
||||
setValue(SettingMultiplier, value);
|
||||
}
|
||||
|
||||
|
|
|
@ -124,9 +124,22 @@ DialogDetail::DialogDetail(const VContainer *data, const quint32 &toolId, QWidge
|
|||
connect(ui.toolButtonUp, &QToolButton::clicked, this, &DialogDetail::ScrollUp);
|
||||
connect(ui.toolButtonDown, &QToolButton::clicked, this, &DialogDetail::ScrollDown);
|
||||
|
||||
m_qslMaterials << tr("Fabric") << tr("Lining") << tr("Interfacing") << tr("Interlining");
|
||||
m_qslMaterials << QApplication::translate("Detail", "Fabric", 0)
|
||||
<< QApplication::translate("Detail", "Lining", 0)
|
||||
<< QApplication::translate("Detail", "Interfacing", 0)
|
||||
<< QApplication::translate("Detail", "Interlining", 0);
|
||||
|
||||
for (int i = 0; i < m_qslMaterials.count(); ++i)
|
||||
{
|
||||
ui.comboBoxMaterial->addItem(m_qslMaterials[i], i);
|
||||
}
|
||||
|
||||
QStringList qsl = qApp->Settings()->GetUserDefinedMaterials();
|
||||
for (int i = 0; i < qsl.count(); ++i)
|
||||
{
|
||||
ui.comboBoxMaterial->addItem(qsl[i], int(MaterialType::mtUserDefined));
|
||||
}
|
||||
|
||||
ui.comboBoxMaterial->addItems(m_qslMaterials);
|
||||
m_qslPlacements << tr("None") << tr("Cut on fold");
|
||||
ui.comboBoxPlacement->addItems(m_qslPlacements);
|
||||
|
||||
|
@ -134,6 +147,7 @@ DialogDetail::DialogDetail(const VContainer *data, const quint32 &toolId, QWidge
|
|||
connect(ui.pushButtonCancel, &QPushButton::clicked, this, &DialogDetail::Cancel);
|
||||
connect(ui.pushButtonRemove, &QPushButton::clicked, this, &DialogDetail::Remove);
|
||||
connect(ui.listWidgetMCP, &QListWidget::itemClicked, this, &DialogDetail::SetEditMode);
|
||||
connect(ui.comboBoxMaterial, &QComboBox::currentTextChanged, this, &DialogDetail::MaterialChanged);
|
||||
SetAddMode();
|
||||
|
||||
ui.tabWidget->setCurrentIndex(0);
|
||||
|
@ -235,13 +249,33 @@ void DialogDetail::UpdateList()
|
|||
void DialogDetail::AddUpdate()
|
||||
{
|
||||
MaterialCutPlacement mcp;
|
||||
mcp.m_qsMaterialUserDef = ui.comboBoxMaterial->currentText();
|
||||
mcp.m_eMaterial = MaterialType::mtUserDefined;
|
||||
for (int i = 0; i < m_qslMaterials.count(); ++i)
|
||||
{
|
||||
if (mcp.m_qsMaterialUserDef == m_qslMaterials[i])
|
||||
QStringList qslUserMaterials = qApp->Settings()->GetUserDefinedMaterials();
|
||||
|
||||
int i = ui.comboBoxMaterial->currentData().toInt();
|
||||
QString qsMat = ui.comboBoxMaterial->currentText();
|
||||
if (i < m_qslMaterials.count() && qsMat == m_qslMaterials[i])
|
||||
{
|
||||
mcp.m_eMaterial = MaterialType(i);
|
||||
mcp.m_qsMaterialUserDef.clear();
|
||||
}
|
||||
else
|
||||
{
|
||||
mcp.m_eMaterial = MaterialType::mtUserDefined;
|
||||
mcp.m_qsMaterialUserDef = qsMat;
|
||||
// check if we have new user defined material
|
||||
bool bFound = false;
|
||||
for (int i = 0; i < qslUserMaterials.count() && bFound == false; ++i)
|
||||
{
|
||||
if (mcp.m_qsMaterialUserDef == qslUserMaterials[i])
|
||||
{
|
||||
bFound = true;
|
||||
}
|
||||
}
|
||||
if (bFound == false)
|
||||
{
|
||||
qApp->Settings()->AddUserDefinedMaterial(mcp.m_qsMaterialUserDef);
|
||||
qApp->Settings()->sync();
|
||||
ui.comboBoxMaterial->addItem(mcp.m_qsMaterialUserDef, int(MaterialType::mtUserDefined));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -306,6 +340,12 @@ void DialogDetail::NameDetailChanged()
|
|||
CheckState();
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void DialogDetail::MaterialChanged()
|
||||
{
|
||||
ui.pushButtonAdd->setEnabled(ui.comboBoxMaterial->currentText().isEmpty() == false);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
/**
|
||||
* @brief NewItem add new object (point, arc, spline or spline path) to list
|
||||
|
@ -413,8 +453,6 @@ VDetail DialogDetail::CreateDetail() const
|
|||
detail.GetPatternPieceData().SetRotation(m_oldData.GetRotation());
|
||||
detail.GetPatternPieceData().SetVisible(ui.checkBoxDetail->isChecked());
|
||||
|
||||
qDebug() << "DD VISIBLE" << detail.GetPatternPieceData().IsVisible();
|
||||
|
||||
detail.GetPatternInfo() = m_oldGeom;
|
||||
detail.GetPatternInfo().SetVisible(ui.checkBoxPattern->isChecked());
|
||||
|
||||
|
@ -780,7 +818,22 @@ void DialogDetail::SetEditMode()
|
|||
ui.pushButtonRemove->show();
|
||||
|
||||
MaterialCutPlacement mcp = m_conMCP.at(iR);
|
||||
if (mcp.m_eMaterial == MaterialType::mtUserDefined)
|
||||
{
|
||||
int iRow = qApp->Settings()->GetUserDefinedMaterials().indexOf(mcp.m_qsMaterialUserDef);
|
||||
if (iRow >= 0)
|
||||
{
|
||||
ui.comboBoxMaterial->setCurrentIndex(iRow + m_qslMaterials.count());
|
||||
}
|
||||
else
|
||||
{
|
||||
ui.comboBoxMaterial->setCurrentText(mcp.m_qsMaterialUserDef);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
ui.comboBoxMaterial->setCurrentIndex(int(mcp.m_eMaterial));
|
||||
}
|
||||
ui.spinBoxCutNumber->setValue(mcp.m_iCutNumber);
|
||||
ui.comboBoxPlacement->setCurrentIndex(int(mcp.m_ePlacement));
|
||||
|
||||
|
|
|
@ -84,6 +84,7 @@ protected slots:
|
|||
|
||||
private slots:
|
||||
void NameDetailChanged();
|
||||
void MaterialChanged();
|
||||
private:
|
||||
|
||||
/** @brief ui keeps information about user interface */
|
||||
|
|
|
@ -305,7 +305,8 @@
|
|||
</property>
|
||||
<property name="icon">
|
||||
<iconset theme="go-down">
|
||||
<normaloff>.</normaloff>.</iconset>
|
||||
<normaloff/>
|
||||
</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
|
@ -319,7 +320,8 @@
|
|||
</property>
|
||||
<property name="icon">
|
||||
<iconset theme="go-up">
|
||||
<normaloff>.</normaloff>.</iconset>
|
||||
<normaloff/>
|
||||
</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
|
@ -419,6 +421,9 @@
|
|||
</item>
|
||||
<item row="0" column="2" colspan="2">
|
||||
<widget class="QComboBox" name="comboBoxMaterial">
|
||||
<property name="toolTip">
|
||||
<string>You can choose one of the predefined materials or enter a new one</string>
|
||||
</property>
|
||||
<property name="editable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
|
|
|
@ -229,6 +229,23 @@ void VTextGraphicsItem::SetSize(qreal fW, qreal fH)
|
|||
return;
|
||||
}
|
||||
|
||||
if (fW > parentItem()->boundingRect().width())
|
||||
{
|
||||
fW = parentItem()->boundingRect().width();
|
||||
}
|
||||
if (fW < MIN_W)
|
||||
{
|
||||
fW = MIN_W;
|
||||
}
|
||||
if (fH > parentItem()->boundingRect().height())
|
||||
{
|
||||
fH = parentItem()->boundingRect().height();
|
||||
}
|
||||
if (fH < m_iMinH)
|
||||
{
|
||||
fH = m_iMinH;
|
||||
}
|
||||
|
||||
m_rectBoundingBox.setTopLeft(QPointF(0, 0));
|
||||
m_rectBoundingBox.setWidth(fW);
|
||||
m_rectBoundingBox.setHeight(fH);
|
||||
|
@ -308,9 +325,9 @@ void VTextGraphicsItem::UpdateData(const QString &qsName, const VPatternPieceDat
|
|||
* @brief VTextGraphicsItem::UpdateData Updates the pattern label
|
||||
* @param pDoc pointer to the pattern object
|
||||
*/
|
||||
void VTextGraphicsItem::UpdateData(const VAbstractPattern* pDoc)
|
||||
void VTextGraphicsItem::UpdateData(const VAbstractPattern* pDoc, qreal dSize, qreal dHeight)
|
||||
{
|
||||
m_tm.Update(pDoc);
|
||||
m_tm.Update(pDoc, dSize, dHeight);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
|
|
|
@ -88,7 +88,7 @@ public:
|
|||
void Update();
|
||||
bool IsContained(QRectF rectBB, qreal dRot, qreal& dX, qreal& dY) const;
|
||||
void UpdateData(const QString& qsName, const VPatternPieceData& data);
|
||||
void UpdateData(const VAbstractPattern* pDoc);
|
||||
void UpdateData(const VAbstractPattern* pDoc, qreal dSize, qreal dHeight);
|
||||
int GetTextLines() const;
|
||||
|
||||
protected:
|
||||
|
|
|
@ -205,6 +205,11 @@ VToolDetail::VToolDetail(VAbstractPattern *doc, VContainer *data, const quint32
|
|||
connect(doc, &VAbstractPattern::patternChanged, this, &VToolDetail::UpdatePatternInfo);
|
||||
connect(doc, &VAbstractPattern::CheckLayout, this, &VToolDetail::UpdateLabel);
|
||||
connect(doc, &VAbstractPattern::CheckLayout, this, &VToolDetail::UpdatePatternInfo);
|
||||
|
||||
connect(sceneDetails, &VMainGraphicsScene::DimensionsChanged, this, &VToolDetail::UpdateLabel);
|
||||
connect(sceneDetails, &VMainGraphicsScene::DimensionsChanged, this, &VToolDetail::UpdatePatternInfo);
|
||||
connect(sceneDetails, &VMainGraphicsScene::LanguageChanged, this, &VToolDetail::retranslateUi);
|
||||
|
||||
UpdateLabel();
|
||||
UpdatePatternInfo();
|
||||
}
|
||||
|
@ -443,7 +448,14 @@ void VToolDetail::AddToFile()
|
|||
MaterialCutPlacement mcp = data.GetMCP(i);
|
||||
QDomElement domMCP = doc->createElement(VAbstractPattern::TagMCP);
|
||||
doc->SetAttribute(domMCP, VAbstractPattern::AttrMaterial, int(mcp.m_eMaterial));
|
||||
if (mcp.m_eMaterial == MaterialType::mtUserDefined)
|
||||
{
|
||||
doc->SetAttribute(domMCP, VAbstractPattern::AttrUserDefined, mcp.m_qsMaterialUserDef);
|
||||
}
|
||||
else
|
||||
{
|
||||
domMCP.removeAttribute(VAbstractPattern::AttrUserDefined);
|
||||
}
|
||||
doc->SetAttribute(domMCP, VAbstractPattern::AttrCutNumber, mcp.m_iCutNumber);
|
||||
doc->SetAttribute(domMCP, VAbstractPattern::AttrPlacement, int(mcp.m_ePlacement));
|
||||
domData.appendChild(domMCP);
|
||||
|
@ -502,7 +514,14 @@ void VToolDetail::RefreshDataInFile()
|
|||
MaterialCutPlacement mcp = data.GetMCP(i);
|
||||
QDomElement domMCP = doc->createElement(VAbstractPattern::TagMCP);
|
||||
doc->SetAttribute(domMCP, VAbstractPattern::AttrMaterial, int(mcp.m_eMaterial));
|
||||
if (mcp.m_eMaterial == MaterialType::mtUserDefined)
|
||||
{
|
||||
doc->SetAttribute(domMCP, VAbstractPattern::AttrUserDefined, mcp.m_qsMaterialUserDef);
|
||||
}
|
||||
else
|
||||
{
|
||||
domMCP.removeAttribute(VAbstractPattern::AttrUserDefined);
|
||||
}
|
||||
doc->SetAttribute(domMCP, VAbstractPattern::AttrCutNumber, mcp.m_iCutNumber);
|
||||
doc->SetAttribute(domMCP, VAbstractPattern::AttrPlacement, int(mcp.m_ePlacement));
|
||||
domData.appendChild(domMCP);
|
||||
|
@ -763,8 +782,8 @@ void VToolDetail::UpdateLabel()
|
|||
QPointF pt = data.GetPos();
|
||||
QRectF rectBB;
|
||||
rectBB.setTopLeft(pt);
|
||||
rectBB.setWidth(data.GetLabelWidth());
|
||||
rectBB.setHeight(data.GetLabelHeight());
|
||||
rectBB.setWidth(dataLabel->boundingRect().width());
|
||||
rectBB.setHeight(dataLabel->boundingRect().height());
|
||||
qreal dX;
|
||||
qreal dY;
|
||||
if (dataLabel->IsContained(rectBB, data.GetRotation(), dX, dY) == false)
|
||||
|
@ -804,13 +823,13 @@ void VToolDetail::UpdatePatternInfo()
|
|||
fnt.setPixelSize(iFS);
|
||||
patternInfo->SetFont(fnt);
|
||||
patternInfo->SetSize(geom.GetLabelWidth(), geom.GetLabelHeight());
|
||||
patternInfo->UpdateData(doc);
|
||||
patternInfo->UpdateData(doc, getData()->size(), getData()->height());
|
||||
|
||||
QPointF pt = geom.GetPos();
|
||||
QRectF rectBB;
|
||||
rectBB.setTopLeft(pt);
|
||||
rectBB.setWidth(geom.GetLabelWidth());
|
||||
rectBB.setHeight(geom.GetLabelHeight());
|
||||
rectBB.setWidth(patternInfo->boundingRect().width());
|
||||
rectBB.setHeight(patternInfo->boundingRect().height());
|
||||
qreal dX;
|
||||
qreal dY;
|
||||
if (patternInfo->IsContained(rectBB, geom.GetRotation(), dX, dY) == false)
|
||||
|
@ -1122,3 +1141,10 @@ void VToolDetail::UpdateAll()
|
|||
sceneDetails->update();
|
||||
update();
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VToolDetail::retranslateUi()
|
||||
{
|
||||
UpdateLabel();
|
||||
UpdatePatternInfo();
|
||||
}
|
||||
|
|
|
@ -99,6 +99,7 @@ public slots:
|
|||
virtual void AllowSelecting(bool enabled) Q_DECL_OVERRIDE;
|
||||
virtual void ResetChildren(QGraphicsItem* pItem);
|
||||
virtual void UpdateAll();
|
||||
virtual void retranslateUi();
|
||||
protected:
|
||||
virtual void paint(QPainter *painter, const QStyleOptionGraphicsItem *option,
|
||||
QWidget *widget) Q_DECL_OVERRIDE;
|
||||
|
|
|
@ -161,7 +161,16 @@ void SaveDetailOptions::SavePatternPieceData(QDomElement &domElement, const VDet
|
|||
MaterialCutPlacement mcp = data.GetMCP(i);
|
||||
QDomElement domMCP = doc->createElement(VAbstractPattern::TagMCP);
|
||||
doc->SetAttribute(domMCP, VAbstractPattern::AttrMaterial, int(mcp.m_eMaterial));
|
||||
if (mcp.m_eMaterial == MaterialType::mtUserDefined)
|
||||
{
|
||||
qDebug() << "USER DEFINED MATERIAL";
|
||||
doc->SetAttribute(domMCP, VAbstractPattern::AttrUserDefined, mcp.m_qsMaterialUserDef);
|
||||
}
|
||||
else
|
||||
{
|
||||
qDebug() << "PREDEFINED MATERIAL";
|
||||
domMCP.removeAttribute(VAbstractPattern::AttrUserDefined);
|
||||
}
|
||||
doc->SetAttribute(domMCP, VAbstractPattern::AttrCutNumber, mcp.m_iCutNumber);
|
||||
doc->SetAttribute(domMCP, VAbstractPattern::AttrPlacement, int(mcp.m_ePlacement));
|
||||
domData.appendChild(domMCP);
|
||||
|
|
|
@ -146,6 +146,9 @@ signals:
|
|||
void EnableNodePointItemHover(bool enabled);
|
||||
void EnableDetailItemHover(bool enabled);
|
||||
void EnableLineItemHover(bool enabled);
|
||||
void DimensionsChanged();
|
||||
void LanguageChanged();
|
||||
|
||||
private:
|
||||
/** @brief horScrollBar value horizontal scroll bar. */
|
||||
qint32 horScrollBar;
|
||||
|
|
Loading…
Reference in New Issue
Block a user