int instead ptrdiff_t.

--HG--
branch : develop
This commit is contained in:
dismine 2014-10-05 23:25:07 +03:00
parent ee26922f94
commit 3590ebac74
11 changed files with 34 additions and 34 deletions

View File

@ -192,7 +192,7 @@ void DialogDetail::setDetails(const VDetail &value)
{ {
details = value; details = value;
ui.listWidget->clear(); ui.listWidget->clear();
for (ptrdiff_t i = 0; i < details.CountNode(); ++i) for (int i = 0; i < details.CountNode(); ++i)
{ {
NewItem(details.at(i).getId(), details.at(i).getTypeTool(), details.at(i).getTypeNode(), details.at(i).getMx(), NewItem(details.at(i).getId(), details.at(i).getTypeTool(), details.at(i).getTypeNode(), details.at(i).getMx(),
details.at(i).getMy()); details.at(i).getMy());

View File

@ -104,7 +104,7 @@ bool DialogUnionDetails::CheckObject(const quint32 &id, const quint32 &idDetail)
* @param index index of edge * @param index index of edge
*/ */
void DialogUnionDetails::ChoosedDetail(const quint32 &id, const SceneObject &type, quint32 &idDetail, void DialogUnionDetails::ChoosedDetail(const quint32 &id, const SceneObject &type, quint32 &idDetail,
ptrdiff_t &index) int &index)
{ {
if (idDetail == 0) if (idDetail == 0)
{ {

View File

@ -48,8 +48,8 @@ public:
quint32 getD1() const; quint32 getD1() const;
quint32 getD2() const; quint32 getD2() const;
ptrdiff_t getIndexD1() const; int getIndexD1() const;
ptrdiff_t getIndexD2() const; int getIndexD2() const;
public slots: public slots:
void ChosenObject(quint32 id, const SceneObject &type); void ChosenObject(quint32 id, const SceneObject &type);
virtual void UpdateList(); virtual void UpdateList();
@ -60,10 +60,10 @@ private:
Ui::DialogUnionDetails *ui; Ui::DialogUnionDetails *ui;
/** @brief indexD1 index edge first detail */ /** @brief indexD1 index edge first detail */
ptrdiff_t indexD1; int indexD1;
/** @brief indexD2 index edge second detail */ /** @brief indexD2 index edge second detail */
ptrdiff_t indexD2; int indexD2;
/** @brief d1 id first detail */ /** @brief d1 id first detail */
quint32 d1; quint32 d1;
@ -85,7 +85,7 @@ private:
bool CheckObject(const quint32 &id, const quint32 &idDetail) const; bool CheckObject(const quint32 &id, const quint32 &idDetail) const;
void ChoosedDetail(const quint32 &id, const SceneObject &type, quint32 &idDetail, void ChoosedDetail(const quint32 &id, const SceneObject &type, quint32 &idDetail,
ptrdiff_t &index); int &index);
}; };
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
@ -113,7 +113,7 @@ inline quint32 DialogUnionDetails::getD2() const
* @brief getIndexD1 return index edge first detail * @brief getIndexD1 return index edge first detail
* @return index * @return index
*/ */
inline ptrdiff_t DialogUnionDetails::getIndexD1() const inline int DialogUnionDetails::getIndexD1() const
{ {
return indexD1; return indexD1;
} }
@ -123,7 +123,7 @@ inline ptrdiff_t DialogUnionDetails::getIndexD1() const
* @brief getIndexD2 return index edge second detail * @brief getIndexD2 return index edge second detail
* @return index * @return index
*/ */
inline ptrdiff_t DialogUnionDetails::getIndexD2() const inline int DialogUnionDetails::getIndexD2() const
{ {
return indexD2; return indexD2;
} }

View File

@ -93,13 +93,13 @@ public:
* @param indx index node in list. * @param indx index node in list.
* @return node * @return node
*/ */
VNodeDetail & operator[](ptrdiff_t indx); VNodeDetail & operator[](int indx);
/** /**
* @brief at find node by index in list. * @brief at find node by index in list.
* @param indx index node in list. * @param indx index node in list.
* @return const node. * @return const node.
*/ */
const VNodeDetail & at ( ptrdiff_t indx ) const; const VNodeDetail & at ( int indx ) const;
/** /**
* @brief getName return detail name. * @brief getName return detail name.
* @return name. * @return name.
@ -175,7 +175,7 @@ public:
* @param id object (arc, point, spline, splinePath) id. * @param id object (arc, point, spline, splinePath) id.
* @return index in list or -1 id can't find. * @return index in list or -1 id can't find.
*/ */
ptrdiff_t indexOfNode(const quint32 &id) const; int indexOfNode(const quint32 &id) const;
/** /**
* @brief id return id detail in list data. * @brief id return id detail in list data.
* @return id. * @return id.
@ -201,7 +201,7 @@ public:
* @param p2 id second point. * @param p2 id second point.
* @return edge index or -1 if points don't located on edge * @return edge index or -1 if points don't located on edge
*/ */
ptrdiff_t Edge(const quint32 &p1, const quint32 &p2)const; int Edge(const quint32 &p1, const quint32 &p2)const;
/** /**
* @brief NodeOnEdge return nodes located on edge with index. * @brief NodeOnEdge return nodes located on edge with index.
* @param index index of edge. * @param index index of edge.

View File

@ -43,7 +43,7 @@ QPainterPath VEquidistant::ContourPath(const quint32 &idDetail, const VContainer
VDetail detail = data->GetDetail(idDetail); VDetail detail = data->GetDetail(idDetail);
QVector<QPointF> points; QVector<QPointF> points;
QVector<QPointF> pointsEkv; QVector<QPointF> pointsEkv;
for (ptrdiff_t i = 0; i< detail.CountNode(); ++i) for (int i = 0; i< detail.CountNode(); ++i)
{ {
switch (detail.at(i).getTypeTool()) switch (detail.at(i).getTypeTool())
{ {

View File

@ -172,13 +172,13 @@ VSplinePath &VSplinePath::operator =(const VSplinePath &path)
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
VSplinePoint & VSplinePath::operator[](ptrdiff_t indx) VSplinePoint & VSplinePath::operator[](int indx)
{ {
return d->path[indx]; return d->path[indx];
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
const VSplinePoint &VSplinePath::at(ptrdiff_t indx) const const VSplinePoint &VSplinePath::at(int indx) const
{ {
return d->path[indx]; return d->path[indx];
} }

View File

@ -143,13 +143,13 @@ public:
* @param indx index in list. * @param indx index in list.
* @return spline point. * @return spline point.
*/ */
VSplinePoint &operator[](ptrdiff_t indx); VSplinePoint &operator[](int indx);
/** /**
* @brief at return spline point by index. * @brief at return spline point by index.
* @param indx index in list. * @param indx index in list.
* @return spline point. * @return spline point.
*/ */
const VSplinePoint &at(ptrdiff_t indx) const; const VSplinePoint &at(int indx) const;
/** /**
* @brief CutSplinePath cut spline path into two. This method don't return two spline path. You must create spline * @brief CutSplinePath cut spline path into two. This method don't return two spline path. You must create spline
* paths by yourself. * paths by yourself.

View File

@ -76,7 +76,7 @@ VToolDetail::VToolDetail(VPattern *doc, VContainer *data, const quint32 &id, con
:VAbstractTool(doc, data, id), QGraphicsPathItem(parent), dialog(nullptr), sceneDetails(scene) :VAbstractTool(doc, data, id), QGraphicsPathItem(parent), dialog(nullptr), sceneDetails(scene)
{ {
VDetail detail = data->GetDetail(id); VDetail detail = data->GetDetail(id);
for (ptrdiff_t i = 0; i< detail.CountNode(); ++i) for (int i = 0; i< detail.CountNode(); ++i)
{ {
switch (detail.at(i).getTypeTool()) switch (detail.at(i).getTypeTool())
{ {
@ -148,7 +148,7 @@ void VToolDetail::Create(DialogTool *dialog, VMainGraphicsScene *scene, VPattern
VDetail detail = dialogTool->getDetails(); VDetail detail = dialogTool->getDetails();
VDetail det; VDetail det;
qApp->getUndoStack()->beginMacro("add detail"); qApp->getUndoStack()->beginMacro("add detail");
for (ptrdiff_t i = 0; i< detail.CountNode(); ++i) for (int i = 0; i< detail.CountNode(); ++i)
{ {
quint32 id = 0; quint32 id = 0;
switch (detail.at(i).getTypeTool()) switch (detail.at(i).getTypeTool())
@ -285,7 +285,7 @@ void VToolDetail::AddToFile()
doc->SetAttribute(domElement, AttrClosed, detail.getClosed()); doc->SetAttribute(domElement, AttrClosed, detail.getClosed());
doc->SetAttribute(domElement, AttrWidth, detail.getWidth()); doc->SetAttribute(domElement, AttrWidth, detail.getWidth());
for (ptrdiff_t i = 0; i < detail.CountNode(); ++i) for (int i = 0; i < detail.CountNode(); ++i)
{ {
AddNode(doc, domElement, detail.at(i)); AddNode(doc, domElement, detail.at(i));
} }
@ -310,7 +310,7 @@ void VToolDetail::RefreshDataInFile()
doc->SetAttribute(domElement, AttrClosed, QString().setNum(det.getClosed())); doc->SetAttribute(domElement, AttrClosed, QString().setNum(det.getClosed()));
doc->SetAttribute(domElement, AttrWidth, QString().setNum(det.getWidth())); doc->SetAttribute(domElement, AttrWidth, QString().setNum(det.getWidth()));
doc->RemoveAllChild(domElement); doc->RemoveAllChild(domElement);
for (ptrdiff_t i = 0; i < det.CountNode(); ++i) for (int i = 0; i < det.CountNode(); ++i)
{ {
AddNode(doc, domElement, det.at(i)); AddNode(doc, domElement, det.at(i));
} }
@ -434,7 +434,7 @@ void VToolDetail::contextMenuEvent(QGraphicsSceneContextMenuEvent *event)
void VToolDetail::RemoveReferens() void VToolDetail::RemoveReferens()
{ {
VDetail detail = VAbstractTool::data.GetDetail(id); VDetail detail = VAbstractTool::data.GetDetail(id);
for (ptrdiff_t i = 0; i< detail.CountNode(); ++i) for (int i = 0; i< detail.CountNode(); ++i)
{ {
doc->DecrementReferens(detail.at(i).getId()); doc->DecrementReferens(detail.at(i).getId());
} }

View File

@ -90,7 +90,7 @@ VToolUnionDetails::VToolUnionDetails(VPattern *doc, VContainer *data, const quin
* @param angle angle rotation. * @param angle angle rotation.
*/ */
void VToolUnionDetails::AddToNewDetail(QObject *tool, VPattern *doc, VContainer *data, VDetail &newDetail, void VToolUnionDetails::AddToNewDetail(QObject *tool, VPattern *doc, VContainer *data, VDetail &newDetail,
const VDetail &det, const ptrdiff_t &i, const quint32 &idTool, const qreal &dx, const VDetail &det, const int &i, const quint32 &idTool, const qreal &dx,
const qreal &dy, const quint32 &pRotate, const qreal &angle) const qreal &dy, const quint32 &pRotate, const qreal &angle)
{ {
quint32 id = 0, idObject = 0; quint32 id = 0, idObject = 0;
@ -273,7 +273,7 @@ void VToolUnionDetails::AddToNewDetail(QObject *tool, VPattern *doc, VContainer
* @param pRotate point rotation. * @param pRotate point rotation.
* @param angle angle rotation. * @param angle angle rotation.
*/ */
void VToolUnionDetails::UpdatePoints(const quint32 &idDetail, VContainer *data, const VDetail &det, const ptrdiff_t &i, void VToolUnionDetails::UpdatePoints(const quint32 &idDetail, VContainer *data, const VDetail &det, const int &i,
quint32 &idCount, const qreal &dx, const qreal &dy, const quint32 &pRotate, quint32 &idCount, const qreal &dx, const qreal &dy, const quint32 &pRotate,
const qreal &angle) const qreal &angle)
{ {
@ -518,11 +518,11 @@ VToolUnionDetails* VToolUnionDetails::Create(const quint32 _id, const VDetail &d
unionDetails = new VToolUnionDetails(doc, data, id, d1, d2, indexD1, indexD2, typeCreation, doc); unionDetails = new VToolUnionDetails(doc, data, id, d1, d2, indexD1, indexD2, typeCreation, doc);
QHash<quint32, VDataTool*>* tools = doc->getTools(); QHash<quint32, VDataTool*>* tools = doc->getTools();
tools->insert(id, unionDetails); tools->insert(id, unionDetails);
for (ptrdiff_t i = 0; i < d1.CountNode(); ++i) for (int i = 0; i < d1.CountNode(); ++i)
{ {
doc->IncrementReferens(d1.at(i).getId()); doc->IncrementReferens(d1.at(i).getId());
} }
for (ptrdiff_t i = 0; i < d2.CountNode(); ++i) for (int i = 0; i < d2.CountNode(); ++i)
{ {
doc->IncrementReferens(d2.at(i).getId()); doc->IncrementReferens(d2.at(i).getId());
} }
@ -650,7 +650,7 @@ void VToolUnionDetails::FindJ(const qint32 &pointsD2, const VDetail &d2, const q
VNodeDetail node1; VNodeDetail node1;
VNodeDetail node2; VNodeDetail node2;
d2.NodeOnEdge(indexD2, node1, node2); d2.NodeOnEdge(indexD2, node1, node2);
ptrdiff_t k = d2.RemoveEdge(indexD2).indexOfNode(node2.getId()); int k = d2.RemoveEdge(indexD2).indexOfNode(node2.getId());
if (k == d2.RemoveEdge(indexD2).CountNode()-1) if (k == d2.RemoveEdge(indexD2).CountNode()-1)
{ {
j = 0; j = 0;
@ -778,7 +778,7 @@ void VToolUnionDetails::AddDetail(QDomElement &domElement, VDetail &d)
{ {
QDomElement det = doc->createElement(TagDetail); QDomElement det = doc->createElement(TagDetail);
for (ptrdiff_t i = 0; i < d.CountNode(); ++i) for (int i = 0; i < d.CountNode(); ++i)
{ {
AddNode(det, d.at(i)); AddNode(det, d.at(i));
} }
@ -818,7 +818,7 @@ QDomNode VToolUnionDetails::UpdateDetail(const QDomNode &domNode, const VDetail
if (domElement.tagName() == VToolUnionDetails::TagDetail) if (domElement.tagName() == VToolUnionDetails::TagDetail)
{ {
doc->removeAllChilds(domElement);//delete all nodes in detail doc->removeAllChilds(domElement);//delete all nodes in detail
for (ptrdiff_t i = 0; i < d.CountNode(); ++i) for (int i = 0; i < d.CountNode(); ++i)
{ {
AddNode(domElement, d.at(i));//rewrite nodes of detail AddNode(domElement, d.at(i));//rewrite nodes of detail
} }

View File

@ -69,9 +69,9 @@ public:
static const QString NodeTypeContour; static const QString NodeTypeContour;
static const QString NodeTypeModeling; static const QString NodeTypeModeling;
static void AddToNewDetail(QObject *tool, VPattern *doc, VContainer *data, VDetail &newDetail, static void AddToNewDetail(QObject *tool, VPattern *doc, VContainer *data, VDetail &newDetail,
const VDetail &det, const ptrdiff_t &i, const quint32 &idTool, const qreal &dx = 0, const VDetail &det, const int &i, const quint32 &idTool, const qreal &dx = 0,
const qreal &dy = 0, const quint32 &pRotate = 0, const qreal &angle = 0); const qreal &dy = 0, const quint32 &pRotate = 0, const qreal &angle = 0);
static void UpdatePoints(const quint32 &idDetail, VContainer *data, const VDetail &det, const ptrdiff_t &i, static void UpdatePoints(const quint32 &idDetail, VContainer *data, const VDetail &det, const int &i,
quint32 &idCount, const qreal &dx = 0, const qreal &dy = 0, const quint32 &pRotate = 0, quint32 &idCount, const qreal &dx = 0, const qreal &dy = 0, const quint32 &pRotate = 0,
const qreal &angle = 0); const qreal &angle = 0);
static void BiasRotatePoint(VPointF *point, const qreal &dx, const qreal &dy, const QPointF &pRotate, static void BiasRotatePoint(VPointF *point, const qreal &dx, const qreal &dy, const QPointF &pRotate,

View File

@ -50,7 +50,7 @@ void SaveDetailOptions::undo()
{ {
SaveDet(domElement, oldDet); SaveDet(domElement, oldDet);
doc->RemoveAllChild(domElement); doc->RemoveAllChild(domElement);
for (ptrdiff_t i = 0; i < oldDet.CountNode(); ++i) for (int i = 0; i < oldDet.CountNode(); ++i)
{ {
VToolDetail::AddNode(doc, domElement, oldDet.at(i)); VToolDetail::AddNode(doc, domElement, oldDet.at(i));
} }
@ -85,7 +85,7 @@ void SaveDetailOptions::redo()
{ {
SaveDet(domElement, newDet); SaveDet(domElement, newDet);
doc->RemoveAllChild(domElement); doc->RemoveAllChild(domElement);
for (ptrdiff_t i = 0; i < newDet.CountNode(); ++i) for (int i = 0; i < newDet.CountNode(); ++i)
{ {
VToolDetail::AddNode(doc, domElement, newDet.at(i)); VToolDetail::AddNode(doc, domElement, newDet.at(i));
} }