Label cannot be moved outside of parent bounding box. Moving cursor is on when moving label. Name of detail moved to Pattern Piece Data tab. Hopefully all warnings removed
--HG-- branch : feature
This commit is contained in:
parent
cdd3e03e53
commit
aa1d1f8ce1
|
@ -658,8 +658,6 @@ void VPattern::ParseDetailElement(const QDomElement &domElement, const Document
|
||||||
}
|
}
|
||||||
else if (element.tagName() == TagData)
|
else if (element.tagName() == TagData)
|
||||||
{
|
{
|
||||||
QString qsName = element.attribute(AttrName, "");
|
|
||||||
detail.GetPatternPieceData().SetName(qsName);
|
|
||||||
QString qsLetter = element.attribute(AttrLetter, "");
|
QString qsLetter = element.attribute(AttrLetter, "");
|
||||||
detail.GetPatternPieceData().SetLetter(qsLetter);
|
detail.GetPatternPieceData().SetLetter(qsLetter);
|
||||||
QPointF ptPos;
|
QPointF ptPos;
|
||||||
|
|
|
@ -350,7 +350,6 @@
|
||||||
</xs:complexType>
|
</xs:complexType>
|
||||||
</xs:element>
|
</xs:element>
|
||||||
</xs:sequence>
|
</xs:sequence>
|
||||||
<xs:attribute name="name" type="xs:string"></xs:attribute>
|
|
||||||
<xs:attribute name="letter" type="xs:string"></xs:attribute>
|
<xs:attribute name="letter" type="xs:string"></xs:attribute>
|
||||||
<xs:attribute name="fontSize" type="xs:unsignedInt"></xs:attribute>
|
<xs:attribute name="fontSize" type="xs:unsignedInt"></xs:attribute>
|
||||||
<xs:attribute name="mx" type="xs:double"></xs:attribute>
|
<xs:attribute name="mx" type="xs:double"></xs:attribute>
|
||||||
|
|
|
@ -241,6 +241,8 @@ int VPoster::CountColumns(int width) const
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
PosterData VPoster::Cut(int i, int j, const QRect &imageRect) const
|
PosterData VPoster::Cut(int i, int j, const QRect &imageRect) const
|
||||||
{
|
{
|
||||||
|
Q_UNUSED(imageRect);
|
||||||
|
|
||||||
const int x = j*PageRect().width() - j*static_cast<int>(allowence);
|
const int x = j*PageRect().width() - j*static_cast<int>(allowence);
|
||||||
const int y = i*PageRect().height() - i*static_cast<int>(allowence);
|
const int y = i*PageRect().height() - i*static_cast<int>(allowence);
|
||||||
|
|
||||||
|
|
|
@ -29,15 +29,15 @@
|
||||||
#include "vpatternpiecedata.h"
|
#include "vpatternpiecedata.h"
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
VPatternPieceData::VPatternPieceData() :
|
MaterialCutPlacement::MaterialCutPlacement()
|
||||||
m_ptPos(0, 0)
|
:m_eMaterial(MaterialType::mtFabric), m_qsMaterialUserDef(), m_iCutNumber(0), m_ePlacement(PlacementType::ptNone)
|
||||||
{
|
{}
|
||||||
m_iFontSize = MIN_FONT_SIZE;
|
|
||||||
// 0 means unknown width
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
m_dLabelWidth = 0;
|
VPatternPieceData::VPatternPieceData()
|
||||||
m_dLabelHeight = 0;
|
:m_qsLetter(), m_conMCP(), m_ptPos(0, 0), m_dLabelWidth(0), m_dLabelHeight(0),
|
||||||
m_dRotation = 0;
|
m_iFontSize(MIN_FONT_SIZE), m_dRotation(0)
|
||||||
}
|
{}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
VPatternPieceData::~VPatternPieceData()
|
VPatternPieceData::~VPatternPieceData()
|
||||||
|
@ -91,7 +91,6 @@ void VPatternPieceData::RemoveMCP(int i)
|
||||||
void VPatternPieceData::Clear()
|
void VPatternPieceData::Clear()
|
||||||
{
|
{
|
||||||
m_qsLetter.clear();
|
m_qsLetter.clear();
|
||||||
m_qsName.clear();
|
|
||||||
m_conMCP.clear();
|
m_conMCP.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -107,18 +106,6 @@ void VPatternPieceData::SetLetter(QString qsLetter)
|
||||||
m_qsLetter = qsLetter.left(3);
|
m_qsLetter = qsLetter.left(3);
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
|
||||||
const QString& VPatternPieceData::GetName() const
|
|
||||||
{
|
|
||||||
return m_qsName;
|
|
||||||
}
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
|
||||||
void VPatternPieceData::SetName(QString qsName)
|
|
||||||
{
|
|
||||||
m_qsName = qsName;
|
|
||||||
}
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
QPointF VPatternPieceData::GetPos() const
|
QPointF VPatternPieceData::GetPos() const
|
||||||
{
|
{
|
||||||
|
|
|
@ -55,6 +55,8 @@ struct MaterialCutPlacement
|
||||||
QString m_qsMaterialUserDef;
|
QString m_qsMaterialUserDef;
|
||||||
int m_iCutNumber;
|
int m_iCutNumber;
|
||||||
PlacementType m_ePlacement;
|
PlacementType m_ePlacement;
|
||||||
|
|
||||||
|
MaterialCutPlacement();
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef QList<MaterialCutPlacement> MCPContainer;
|
typedef QList<MaterialCutPlacement> MCPContainer;
|
||||||
|
@ -81,8 +83,6 @@ public:
|
||||||
// methods, which operate on other members
|
// methods, which operate on other members
|
||||||
const QString& GetLetter() const;
|
const QString& GetLetter() const;
|
||||||
void SetLetter(QString qsLetter);
|
void SetLetter(QString qsLetter);
|
||||||
const QString& GetName() const;
|
|
||||||
void SetName(QString qsName);
|
|
||||||
|
|
||||||
// methods, which set up label parameters
|
// methods, which set up label parameters
|
||||||
QPointF GetPos() const;
|
QPointF GetPos() const;
|
||||||
|
@ -97,9 +97,6 @@ public:
|
||||||
void SetRotation(qreal dRot);
|
void SetRotation(qreal dRot);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
/** @brief Pattern piece name
|
|
||||||
*/
|
|
||||||
QString m_qsName;
|
|
||||||
/** @brief Pattern piece letter (should be no more than 3 letters)
|
/** @brief Pattern piece letter (should be no more than 3 letters)
|
||||||
*/
|
*/
|
||||||
QString m_qsLetter;
|
QString m_qsLetter;
|
||||||
|
|
|
@ -44,15 +44,16 @@
|
||||||
* @param parent parent widget
|
* @param parent parent widget
|
||||||
*/
|
*/
|
||||||
DialogDetail::DialogDetail(const VContainer *data, const quint32 &toolId, QWidget *parent)
|
DialogDetail::DialogDetail(const VContainer *data, const quint32 &toolId, QWidget *parent)
|
||||||
:DialogTool(data, toolId, parent), ui(), detail(VDetail()), supplement(true), closed(true), flagWidth(true)
|
:DialogTool(data, toolId, parent), ui(), detail(VDetail()), supplement(true), closed(true), flagWidth(true),
|
||||||
|
m_bAddMode(true), m_qslMaterials(), m_qslPlacements(), m_conMCP(), m_oldData(), m_oldGeom()
|
||||||
{
|
{
|
||||||
ui.setupUi(this);
|
ui.setupUi(this);
|
||||||
|
|
||||||
#if QT_VERSION >= QT_VERSION_CHECK(5, 2, 0)
|
#if QT_VERSION >= QT_VERSION_CHECK(5, 2, 0)
|
||||||
ui.lineEditNameDetail->setClearButtonEnabled(true);
|
ui.lineEditName->setClearButtonEnabled(true);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
labelEditNamePoint = ui.labelEditNameDetail;
|
labelEditNamePoint = ui.labelEditName;
|
||||||
ui.labelUnit->setText( VDomDocument::UnitsToStr(qApp->patternUnit(), true));
|
ui.labelUnit->setText( VDomDocument::UnitsToStr(qApp->patternUnit(), true));
|
||||||
ui.labelUnitX->setText(VDomDocument::UnitsToStr(qApp->patternUnit(), true));
|
ui.labelUnitX->setText(VDomDocument::UnitsToStr(qApp->patternUnit(), true));
|
||||||
ui.labelUnitY->setText(VDomDocument::UnitsToStr(qApp->patternUnit(), true));
|
ui.labelUnitY->setText(VDomDocument::UnitsToStr(qApp->patternUnit(), true));
|
||||||
|
@ -85,7 +86,7 @@ DialogDetail::DialogDetail(const VContainer *data, const quint32 &toolId, QWidge
|
||||||
connect(ui.checkBoxSeams, &QCheckBox::clicked, this, &DialogDetail::ClickedSeams);
|
connect(ui.checkBoxSeams, &QCheckBox::clicked, this, &DialogDetail::ClickedSeams);
|
||||||
connect(ui.checkBoxClosed, &QCheckBox::clicked, this, &DialogDetail::ClickedClosed);
|
connect(ui.checkBoxClosed, &QCheckBox::clicked, this, &DialogDetail::ClickedClosed);
|
||||||
connect(ui.checkBoxReverse, &QCheckBox::clicked, this, &DialogDetail::ClickedReverse);
|
connect(ui.checkBoxReverse, &QCheckBox::clicked, this, &DialogDetail::ClickedReverse);
|
||||||
connect(ui.lineEditNameDetail, &QLineEdit::textChanged, this, &DialogDetail::NameDetailChanged);
|
connect(ui.lineEditName, &QLineEdit::textChanged, this, &DialogDetail::NameDetailChanged);
|
||||||
|
|
||||||
connect(ui.toolButtonDelete, &QToolButton::clicked, this, &DialogDetail::DeleteItem);
|
connect(ui.toolButtonDelete, &QToolButton::clicked, this, &DialogDetail::DeleteItem);
|
||||||
connect(ui.toolButtonUp, &QToolButton::clicked, this, &DialogDetail::ScrollUp);
|
connect(ui.toolButtonUp, &QToolButton::clicked, this, &DialogDetail::ScrollUp);
|
||||||
|
@ -355,19 +356,24 @@ VDetail DialogDetail::CreateDetail() const
|
||||||
detail.append( qvariant_cast<VNodeDetail>(item->data(Qt::UserRole)));
|
detail.append( qvariant_cast<VNodeDetail>(item->data(Qt::UserRole)));
|
||||||
}
|
}
|
||||||
detail.setWidth(ui.doubleSpinBoxSeams->value());
|
detail.setWidth(ui.doubleSpinBoxSeams->value());
|
||||||
detail.setName(ui.lineEditNameDetail->text());
|
detail.setName(ui.lineEditName->text());
|
||||||
detail.setSeamAllowance(supplement);
|
detail.setSeamAllowance(supplement);
|
||||||
detail.setClosed(closed);
|
detail.setClosed(closed);
|
||||||
|
|
||||||
detail.GetPatternPieceData().SetLetter(ui.lineEditLetter->text());
|
detail.GetPatternPieceData().SetLetter(ui.lineEditLetter->text());
|
||||||
detail.GetPatternPieceData().SetName(ui.lineEditName->text());
|
|
||||||
|
|
||||||
for (int i = 0; i < m_conMCP.count(); ++i)
|
for (int i = 0; i < m_conMCP.count(); ++i)
|
||||||
{
|
{
|
||||||
detail.GetPatternPieceData().Append(m_conMCP[i]);
|
detail.GetPatternPieceData().Append(m_conMCP[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
detail.GetPatternPieceData().SetPos(m_ptPos);
|
detail.GetPatternPieceData().SetPos(m_oldData.GetPos());
|
||||||
|
detail.GetPatternPieceData().SetLabelWidth(m_oldData.GetLabelWidth());
|
||||||
|
detail.GetPatternPieceData().SetLabelHeight(m_oldData.GetLabelHeight());
|
||||||
|
detail.GetPatternPieceData().SetFontSize(m_oldData.GetFontSize());
|
||||||
|
detail.GetPatternPieceData().SetRotation(m_oldData.GetRotation());
|
||||||
|
|
||||||
|
detail.GetPatternInfo() = m_oldGeom;
|
||||||
|
|
||||||
return detail;
|
return detail;
|
||||||
}
|
}
|
||||||
|
@ -416,7 +422,7 @@ void DialogDetail::setDetail(const VDetail &value)
|
||||||
NewItem(node.getId(), node.getTypeTool(), node.getTypeNode(), node.getMx(),
|
NewItem(node.getId(), node.getTypeTool(), node.getTypeNode(), node.getMx(),
|
||||||
node.getMy(), node.getReverse());
|
node.getMy(), node.getReverse());
|
||||||
}
|
}
|
||||||
ui.lineEditNameDetail->setText(detail.getName());
|
ui.lineEditName->setText(detail.getName());
|
||||||
ui.checkBoxSeams->setChecked(detail.getSeamAllowance());
|
ui.checkBoxSeams->setChecked(detail.getSeamAllowance());
|
||||||
ui.checkBoxClosed->setChecked(detail.getClosed());
|
ui.checkBoxClosed->setChecked(detail.getClosed());
|
||||||
ClickedClosed(detail.getClosed());
|
ClickedClosed(detail.getClosed());
|
||||||
|
@ -427,7 +433,6 @@ void DialogDetail::setDetail(const VDetail &value)
|
||||||
ui.toolButtonDelete->setEnabled(true);
|
ui.toolButtonDelete->setEnabled(true);
|
||||||
|
|
||||||
ui.lineEditLetter->setText(detail.GetPatternPieceData().GetLetter());
|
ui.lineEditLetter->setText(detail.GetPatternPieceData().GetLetter());
|
||||||
ui.lineEditName->setText(detail.GetPatternPieceData().GetName());
|
|
||||||
|
|
||||||
m_conMCP.clear();
|
m_conMCP.clear();
|
||||||
for (int i = 0; i < detail.GetPatternPieceData().GetMCPCount(); ++i)
|
for (int i = 0; i < detail.GetPatternPieceData().GetMCPCount(); ++i)
|
||||||
|
@ -436,7 +441,8 @@ void DialogDetail::setDetail(const VDetail &value)
|
||||||
}
|
}
|
||||||
|
|
||||||
UpdateList();
|
UpdateList();
|
||||||
m_ptPos = detail.GetPatternPieceData().GetPos();
|
m_oldData = detail.GetPatternPieceData();
|
||||||
|
m_oldGeom = detail.GetPatternInfo();
|
||||||
|
|
||||||
ValidObjects(DetailIsValid());
|
ValidObjects(DetailIsValid());
|
||||||
}
|
}
|
||||||
|
|
|
@ -33,6 +33,7 @@
|
||||||
#include "dialogtool.h"
|
#include "dialogtool.h"
|
||||||
#include "../vpatterndb/vdetail.h"
|
#include "../vpatterndb/vdetail.h"
|
||||||
#include "../vpatterndb/vpatternpiecedata.h"
|
#include "../vpatterndb/vpatternpiecedata.h"
|
||||||
|
#include "../vpatterndb/vpatterninfogeometry.h"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief The DialogDetail class dialog for ToolDetai. Help create detail and edit option.
|
* @brief The DialogDetail class dialog for ToolDetai. Help create detail and edit option.
|
||||||
|
@ -92,7 +93,8 @@ private:
|
||||||
QStringList m_qslPlacements;
|
QStringList m_qslPlacements;
|
||||||
// temporary container for Material/Cut/Placement 3-tuples
|
// temporary container for Material/Cut/Placement 3-tuples
|
||||||
MCPContainer m_conMCP;
|
MCPContainer m_conMCP;
|
||||||
QPointF m_ptPos;
|
VPatternPieceData m_oldData;
|
||||||
|
VPatternInfoGeometry m_oldGeom;
|
||||||
|
|
||||||
|
|
||||||
bool DetailIsValid() const;
|
bool DetailIsValid() const;
|
||||||
|
|
|
@ -191,74 +191,7 @@
|
||||||
</property>
|
</property>
|
||||||
<layout class="QVBoxLayout" name="verticalLayout">
|
<layout class="QVBoxLayout" name="verticalLayout">
|
||||||
<item>
|
<item>
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
<layout class="QHBoxLayout" name="horizontalLayout"/>
|
||||||
<item>
|
|
||||||
<widget class="QLabel" name="labelEditNameDetail">
|
|
||||||
<property name="sizePolicy">
|
|
||||||
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
|
|
||||||
<horstretch>0</horstretch>
|
|
||||||
<verstretch>0</verstretch>
|
|
||||||
</sizepolicy>
|
|
||||||
</property>
|
|
||||||
<property name="palette">
|
|
||||||
<palette>
|
|
||||||
<active>
|
|
||||||
<colorrole role="WindowText">
|
|
||||||
<brush brushstyle="SolidPattern">
|
|
||||||
<color alpha="255">
|
|
||||||
<red>255</red>
|
|
||||||
<green>0</green>
|
|
||||||
<blue>0</blue>
|
|
||||||
</color>
|
|
||||||
</brush>
|
|
||||||
</colorrole>
|
|
||||||
</active>
|
|
||||||
<inactive>
|
|
||||||
<colorrole role="WindowText">
|
|
||||||
<brush brushstyle="SolidPattern">
|
|
||||||
<color alpha="255">
|
|
||||||
<red>255</red>
|
|
||||||
<green>0</green>
|
|
||||||
<blue>0</blue>
|
|
||||||
</color>
|
|
||||||
</brush>
|
|
||||||
</colorrole>
|
|
||||||
</inactive>
|
|
||||||
<disabled>
|
|
||||||
<colorrole role="WindowText">
|
|
||||||
<brush brushstyle="SolidPattern">
|
|
||||||
<color alpha="255">
|
|
||||||
<red>159</red>
|
|
||||||
<green>158</green>
|
|
||||||
<blue>158</blue>
|
|
||||||
</color>
|
|
||||||
</brush>
|
|
||||||
</colorrole>
|
|
||||||
</disabled>
|
|
||||||
</palette>
|
|
||||||
</property>
|
|
||||||
<property name="locale">
|
|
||||||
<locale language="English" country="UnitedStates"/>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string>Name of detail:</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QLineEdit" name="lineEditNameDetail">
|
|
||||||
<property name="sizePolicy">
|
|
||||||
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
|
|
||||||
<horstretch>0</horstretch>
|
|
||||||
<verstretch>0</verstretch>
|
|
||||||
</sizepolicy>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string>Detail</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QCheckBox" name="checkBoxSeams">
|
<widget class="QCheckBox" name="checkBoxSeams">
|
||||||
|
@ -457,25 +390,25 @@
|
||||||
<layout class="QGridLayout" name="gridLayout_2">
|
<layout class="QGridLayout" name="gridLayout_2">
|
||||||
<item row="0" column="0">
|
<item row="0" column="0">
|
||||||
<widget class="QWidget" name="widget" native="true">
|
<widget class="QWidget" name="widget" native="true">
|
||||||
<widget class="QLabel" name="label_6">
|
<widget class="QLabel" name="labelEditName">
|
||||||
<property name="geometry">
|
<property name="geometry">
|
||||||
<rect>
|
<rect>
|
||||||
<x>9</x>
|
<x>10</x>
|
||||||
<y>38</y>
|
<y>40</y>
|
||||||
<width>40</width>
|
<width>101</width>
|
||||||
<height>16</height>
|
<height>16</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Name:</string>
|
<string>Name of detail:</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
<widget class="QLineEdit" name="lineEditName">
|
<widget class="QLineEdit" name="lineEditName">
|
||||||
<property name="geometry">
|
<property name="geometry">
|
||||||
<rect>
|
<rect>
|
||||||
<x>55</x>
|
<x>110</x>
|
||||||
<y>38</y>
|
<y>40</y>
|
||||||
<width>125</width>
|
<width>151</width>
|
||||||
<height>23</height>
|
<height>23</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
|
@ -586,9 +519,9 @@
|
||||||
<widget class="QLineEdit" name="lineEditLetter">
|
<widget class="QLineEdit" name="lineEditLetter">
|
||||||
<property name="geometry">
|
<property name="geometry">
|
||||||
<rect>
|
<rect>
|
||||||
<x>55</x>
|
<x>110</x>
|
||||||
<y>9</y>
|
<y>10</y>
|
||||||
<width>125</width>
|
<width>151</width>
|
||||||
<height>23</height>
|
<height>23</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
|
@ -633,7 +566,6 @@
|
||||||
<tabstop>doubleSpinBoxBiasX</tabstop>
|
<tabstop>doubleSpinBoxBiasX</tabstop>
|
||||||
<tabstop>doubleSpinBoxBiasY</tabstop>
|
<tabstop>doubleSpinBoxBiasY</tabstop>
|
||||||
<tabstop>checkBoxReverse</tabstop>
|
<tabstop>checkBoxReverse</tabstop>
|
||||||
<tabstop>lineEditNameDetail</tabstop>
|
|
||||||
<tabstop>checkBoxSeams</tabstop>
|
<tabstop>checkBoxSeams</tabstop>
|
||||||
<tabstop>doubleSpinBoxSeams</tabstop>
|
<tabstop>doubleSpinBoxSeams</tabstop>
|
||||||
<tabstop>toolButtonDown</tabstop>
|
<tabstop>toolButtonDown</tabstop>
|
||||||
|
|
|
@ -33,6 +33,7 @@
|
||||||
#include <QTransform>
|
#include <QTransform>
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
|
|
||||||
|
#include "../vmisc/def.h"
|
||||||
#include "vtextgraphicsitem.h"
|
#include "vtextgraphicsitem.h"
|
||||||
|
|
||||||
#define RESIZE_SQUARE 30
|
#define RESIZE_SQUARE 30
|
||||||
|
@ -46,14 +47,20 @@
|
||||||
#define SPACING 2
|
#define SPACING 2
|
||||||
#define TOP_Z 2
|
#define TOP_Z 2
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
TextLine::TextLine()
|
||||||
|
:m_qsText(), m_iFontSize(MIN_FONT_SIZE), m_eFontWeight(QFont::Normal), m_eStyle(QFont::StyleNormal),
|
||||||
|
m_eAlign(Qt::AlignCenter), m_iHeight(0)
|
||||||
|
{}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
VTextGraphicsItem::VTextGraphicsItem(QGraphicsItem* pParent)
|
VTextGraphicsItem::VTextGraphicsItem(QGraphicsItem* pParent)
|
||||||
: QGraphicsObject(pParent)
|
:QGraphicsObject(pParent), m_eMode(VTextGraphicsItem::mNormal), m_bReleased(false),
|
||||||
|
m_ptStartPos(), m_ptStart(), m_ptRotCenter(), m_szStart(), m_dRotation(0), m_dAngle(0),
|
||||||
|
m_rectResize(), m_iMinH(MIN_H), m_rectBoundingBox(), m_font(), m_liLines(), m_liOutput()
|
||||||
|
|
||||||
{
|
{
|
||||||
m_eMode = mNormal;
|
|
||||||
m_bReleased = false;
|
|
||||||
m_rectBoundingBox.setTopLeft(QPointF(0, 0));
|
m_rectBoundingBox.setTopLeft(QPointF(0, 0));
|
||||||
m_iMinH = MIN_H;
|
|
||||||
SetSize(MIN_W, m_iMinH);
|
SetSize(MIN_W, m_iMinH);
|
||||||
setZValue(TOP_Z);
|
setZValue(TOP_Z);
|
||||||
}
|
}
|
||||||
|
@ -219,6 +226,7 @@ void VTextGraphicsItem::mousePressEvent(QGraphicsSceneMouseEvent *pME)
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
m_eMode = mMove;
|
m_eMode = mMove;
|
||||||
|
SetOverrideCursor(cursorArrowCloseHand, 1, 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
setZValue(TOP_Z + 1);
|
setZValue(TOP_Z + 1);
|
||||||
|
@ -231,16 +239,27 @@ void VTextGraphicsItem::mouseMoveEvent(QGraphicsSceneMouseEvent* pME)
|
||||||
{
|
{
|
||||||
QPointF ptDiff = pME->scenePos() - m_ptStart;
|
QPointF ptDiff = pME->scenePos() - m_ptStart;
|
||||||
if (m_eMode == mMove)
|
if (m_eMode == mMove)
|
||||||
|
{
|
||||||
|
QPointF pt = m_ptStartPos + ptDiff;
|
||||||
|
pt.setX(pt.x() + m_rectBoundingBox.width()/2);
|
||||||
|
pt.setY(pt.y() + m_rectBoundingBox.height()/2);
|
||||||
|
if (parentItem()->boundingRect().contains(pt) == true)
|
||||||
{
|
{
|
||||||
setPos(m_ptStartPos + ptDiff);
|
setPos(m_ptStartPos + ptDiff);
|
||||||
UpdateBox();
|
UpdateBox();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
else if (m_eMode == mResize)
|
else if (m_eMode == mResize)
|
||||||
{
|
{
|
||||||
|
QPointF pt = m_ptStartPos;
|
||||||
|
pt.setX(pt.x() + (m_szStart.width() + ptDiff.x())/2);
|
||||||
|
pt.setY(pt.y() + (m_szStart.height() + ptDiff.y())/2);
|
||||||
|
if (parentItem()->boundingRect().contains(pt) == true) {
|
||||||
SetSize(m_szStart.width() + ptDiff.x(), m_szStart.height() + ptDiff.y());
|
SetSize(m_szStart.width() + ptDiff.x(), m_szStart.height() + ptDiff.y());
|
||||||
Update();
|
Update();
|
||||||
emit SignalShrink();
|
emit SignalShrink();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
else if (m_eMode == mRotate)
|
else if (m_eMode == mRotate)
|
||||||
{
|
{
|
||||||
if (fabs(m_dAngle) < 0.01)
|
if (fabs(m_dAngle) < 0.01)
|
||||||
|
@ -260,6 +279,7 @@ void VTextGraphicsItem::mouseReleaseEvent(QGraphicsSceneMouseEvent* pME)
|
||||||
{
|
{
|
||||||
if (pME->button() == Qt::LeftButton)
|
if (pME->button() == Qt::LeftButton)
|
||||||
{
|
{
|
||||||
|
RestoreOverrideCursor(cursorArrowCloseHand);
|
||||||
double dDist = fabs(pME->scenePos().x() - m_ptStart.x()) + fabs(pME->scenePos().y() - m_ptStart.y());
|
double dDist = fabs(pME->scenePos().x() - m_ptStart.x()) + fabs(pME->scenePos().y() - m_ptStart.y());
|
||||||
bool bShort = (dDist < 2);
|
bool bShort = (dDist < 2);
|
||||||
|
|
||||||
|
@ -289,6 +309,7 @@ void VTextGraphicsItem::mouseReleaseEvent(QGraphicsSceneMouseEvent* pME)
|
||||||
if (bShort == true)
|
if (bShort == true)
|
||||||
{
|
{
|
||||||
m_eMode = mMove;
|
m_eMode = mMove;
|
||||||
|
SetOverrideCursor(cursorArrowCloseHand, 1, 1);
|
||||||
UpdateBox();
|
UpdateBox();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
|
@ -41,6 +41,8 @@ struct TextLine
|
||||||
QFont::Style m_eStyle;
|
QFont::Style m_eStyle;
|
||||||
Qt::Alignment m_eAlign;
|
Qt::Alignment m_eAlign;
|
||||||
int m_iHeight;
|
int m_iHeight;
|
||||||
|
|
||||||
|
TextLine();
|
||||||
};
|
};
|
||||||
|
|
||||||
class VTextGraphicsItem : public QGraphicsObject
|
class VTextGraphicsItem : public QGraphicsObject
|
||||||
|
|
|
@ -81,7 +81,8 @@ const QString VToolDetail::NodeSplinePath = QStringLiteral("NodeSplinePath");
|
||||||
VToolDetail::VToolDetail(VAbstractPattern *doc, VContainer *data, const quint32 &id, const Source &typeCreation,
|
VToolDetail::VToolDetail(VAbstractPattern *doc, VContainer *data, const quint32 &id, const Source &typeCreation,
|
||||||
VMainGraphicsScene *scene, const QString &drawName, QGraphicsItem *parent)
|
VMainGraphicsScene *scene, const QString &drawName, QGraphicsItem *parent)
|
||||||
:VAbstractTool(doc, data, id), VNoBrushScalePathItem(parent), dialog(nullptr), sceneDetails(scene),
|
:VAbstractTool(doc, data, id), VNoBrushScalePathItem(parent), dialog(nullptr), sceneDetails(scene),
|
||||||
drawName(drawName), seamAllowance(new VNoBrushScalePathItem(this))
|
drawName(drawName), seamAllowance(new VNoBrushScalePathItem(this)), dataLabel(new VTextGraphicsItem(this)),
|
||||||
|
patternInfo(new VTextGraphicsItem(this))
|
||||||
{
|
{
|
||||||
VDetail detail = data->GetDetail(id);
|
VDetail detail = data->GetDetail(id);
|
||||||
for (int i = 0; i< detail.CountNode(); ++i)
|
for (int i = 0; i< detail.CountNode(); ++i)
|
||||||
|
@ -130,13 +131,11 @@ VToolDetail::VToolDetail(VAbstractPattern *doc, VContainer *data, const quint32
|
||||||
}
|
}
|
||||||
setAcceptHoverEvents(true);
|
setAcceptHoverEvents(true);
|
||||||
|
|
||||||
dataLabel = new VTextGraphicsItem(this);
|
|
||||||
connect(dataLabel, &VTextGraphicsItem::SignalMoved, this, &VToolDetail::SaveMoveDetail);
|
connect(dataLabel, &VTextGraphicsItem::SignalMoved, this, &VToolDetail::SaveMoveDetail);
|
||||||
connect(dataLabel, &VTextGraphicsItem::SignalResized, this, &VToolDetail::SaveResizeDetail);
|
connect(dataLabel, &VTextGraphicsItem::SignalResized, this, &VToolDetail::SaveResizeDetail);
|
||||||
connect(dataLabel, &VTextGraphicsItem::SignalRotated, this, &VToolDetail::SaveRotationDetail);
|
connect(dataLabel, &VTextGraphicsItem::SignalRotated, this, &VToolDetail::SaveRotationDetail);
|
||||||
//connect(dataLabel, &VTextGraphicsItem::SignalShrink, this, &VToolDetail::UpdateAll);
|
//connect(dataLabel, &VTextGraphicsItem::SignalShrink, this, &VToolDetail::UpdateAll);
|
||||||
|
|
||||||
patternInfo = new VTextGraphicsItem(this);
|
|
||||||
connect(patternInfo, &VTextGraphicsItem::SignalMoved, this, &VToolDetail::SaveMovePattern);
|
connect(patternInfo, &VTextGraphicsItem::SignalMoved, this, &VToolDetail::SaveMovePattern);
|
||||||
connect(patternInfo, &VTextGraphicsItem::SignalResized, this, &VToolDetail::SaveResizePattern);
|
connect(patternInfo, &VTextGraphicsItem::SignalResized, this, &VToolDetail::SaveResizePattern);
|
||||||
connect(patternInfo, &VTextGraphicsItem::SignalRotated, this, &VToolDetail::SaveRotationPattern);
|
connect(patternInfo, &VTextGraphicsItem::SignalRotated, this, &VToolDetail::SaveRotationPattern);
|
||||||
|
@ -354,7 +353,6 @@ void VToolDetail::AddToFile()
|
||||||
QDomElement domData = doc->createElement(VAbstractPattern::TagData);
|
QDomElement domData = doc->createElement(VAbstractPattern::TagData);
|
||||||
const VPatternPieceData& data = detail.GetPatternPieceData();
|
const VPatternPieceData& data = detail.GetPatternPieceData();
|
||||||
doc->SetAttribute(domData, VAbstractPattern::AttrLetter, data.GetLetter());
|
doc->SetAttribute(domData, VAbstractPattern::AttrLetter, data.GetLetter());
|
||||||
doc->SetAttribute(domData, VAbstractPattern::AttrName, data.GetName());
|
|
||||||
doc->SetAttribute(domData, AttrMx, data.GetPos().x());
|
doc->SetAttribute(domData, AttrMx, data.GetPos().x());
|
||||||
doc->SetAttribute(domData, AttrMy, data.GetPos().y());
|
doc->SetAttribute(domData, AttrMy, data.GetPos().y());
|
||||||
doc->SetAttribute(domData, AttrWidth, data.GetLabelWidth());
|
doc->SetAttribute(domData, AttrWidth, data.GetLabelWidth());
|
||||||
|
@ -411,8 +409,6 @@ void VToolDetail::RefreshDataInFile()
|
||||||
|
|
||||||
QDomElement domData = doc->createElement(VAbstractPattern::TagData);
|
QDomElement domData = doc->createElement(VAbstractPattern::TagData);
|
||||||
const VPatternPieceData& data = det.GetPatternPieceData();
|
const VPatternPieceData& data = det.GetPatternPieceData();
|
||||||
doc->SetAttribute(domData, VAbstractPattern::AttrLetter, data.GetLetter());
|
|
||||||
doc->SetAttribute(domData, VAbstractPattern::AttrName, data.GetName());
|
|
||||||
doc->SetAttribute(domData, AttrMx, data.GetPos().x());
|
doc->SetAttribute(domData, AttrMx, data.GetPos().x());
|
||||||
doc->SetAttribute(domData, AttrMy, data.GetPos().y());
|
doc->SetAttribute(domData, AttrMy, data.GetPos().y());
|
||||||
doc->SetAttribute(domData, AttrWidth, data.GetLabelWidth());
|
doc->SetAttribute(domData, AttrWidth, data.GetLabelWidth());
|
||||||
|
@ -675,7 +671,7 @@ void VToolDetail::UpdateLabel()
|
||||||
const VDetail detail = VAbstractTool::data.GetDetail(id);
|
const VDetail detail = VAbstractTool::data.GetDetail(id);
|
||||||
|
|
||||||
const VPatternPieceData& data = detail.GetPatternPieceData();
|
const VPatternPieceData& data = detail.GetPatternPieceData();
|
||||||
if (data.GetLetter().isEmpty() == false || data.GetName().isEmpty() == false || data.GetMCPCount() > 0)
|
if (data.GetLetter().isEmpty() == false || detail.getName().isEmpty() == false || data.GetMCPCount() > 0)
|
||||||
{
|
{
|
||||||
//dataLabel->Reset();
|
//dataLabel->Reset();
|
||||||
|
|
||||||
|
@ -695,7 +691,7 @@ void VToolDetail::UpdateLabel()
|
||||||
tl.m_eStyle = QFont::StyleNormal;
|
tl.m_eStyle = QFont::StyleNormal;
|
||||||
tl.m_iFontSize = 6;
|
tl.m_iFontSize = 6;
|
||||||
dataLabel->AddLine(tl);
|
dataLabel->AddLine(tl);
|
||||||
tl.m_qsText = data.GetName();
|
tl.m_qsText = detail.getName();
|
||||||
tl.m_eAlign = Qt::AlignCenter;
|
tl.m_eAlign = Qt::AlignCenter;
|
||||||
tl.m_eFontWeight = QFont::DemiBold;
|
tl.m_eFontWeight = QFont::DemiBold;
|
||||||
tl.m_iFontSize = 2;
|
tl.m_iFontSize = 2;
|
||||||
|
|
|
@ -139,7 +139,6 @@ void SaveDetailOptions::SavePatternPieceData(QDomElement &domElement, const VDet
|
||||||
QDomElement domData = doc->createElement(VAbstractPattern::TagData);
|
QDomElement domData = doc->createElement(VAbstractPattern::TagData);
|
||||||
const VPatternPieceData& data = det.GetPatternPieceData();
|
const VPatternPieceData& data = det.GetPatternPieceData();
|
||||||
doc->SetAttribute(domData, VAbstractPattern::AttrLetter, data.GetLetter());
|
doc->SetAttribute(domData, VAbstractPattern::AttrLetter, data.GetLetter());
|
||||||
doc->SetAttribute(domData, VAbstractPattern::AttrName, data.GetName());
|
|
||||||
doc->SetAttribute(domData, AttrMx, data.GetPos().x());
|
doc->SetAttribute(domData, AttrMx, data.GetPos().x());
|
||||||
doc->SetAttribute(domData, AttrMy, data.GetPos().y());
|
doc->SetAttribute(domData, AttrMy, data.GetPos().y());
|
||||||
doc->SetAttribute(domData, VToolDetail::AttrWidth, data.GetLabelWidth());
|
doc->SetAttribute(domData, VToolDetail::AttrWidth, data.GetLabelWidth());
|
||||||
|
|
Loading…
Reference in New Issue
Block a user