Documentation for widgets.

--HG--
branch : develop
This commit is contained in:
dismine 2014-01-27 14:27:26 +02:00
parent b711410ee6
commit b96f83f238
12 changed files with 267 additions and 223 deletions

View File

@ -26,13 +26,6 @@
** **
*************************************************************************/ *************************************************************************/
/*
doubledelegate.cpp
A delegate that allows the user to change integer values from the model
using a spin box widget.
*/
#include "doubledelegate.h" #include "doubledelegate.h"
#include <QDoubleSpinBox> #include <QDoubleSpinBox>

View File

@ -32,48 +32,58 @@
#include <QItemDelegate> #include <QItemDelegate>
/** /**
* @brief The DoubleSpinBoxDelegate class * @brief The DoubleSpinBoxDelegate class a delegate that allows the user to change integer values from the model
* using a spin box widget.
*/ */
class DoubleSpinBoxDelegate : public QItemDelegate class DoubleSpinBoxDelegate : public QItemDelegate
{ {
Q_OBJECT Q_OBJECT
public: public:
/** /**
* @brief DoubleSpinBoxDelegate * @brief DoubleSpinBoxDelegate constructor.
* @param parent * @param parent parent object.
*/ */
DoubleSpinBoxDelegate(QObject *parent = 0): QItemDelegate(parent), lastValue(-10001.0){} DoubleSpinBoxDelegate(QObject *parent = 0): QItemDelegate(parent), lastValue(-10001.0){}
/** /**
* @brief createEditor * @brief createEditorReturns the widget used to edit the item specified by index for editing. The parent widget and
* @param parent * style option are used to control how the editor widget appears.
* @param option * @param parent parent widget.
* @param index * @param option item options.
* @return * @param index index of data item.
* @return editor to be used for editing the data item.
*/ */
QWidget *createEditor(QWidget *parent, const QStyleOptionViewItem &option, const QModelIndex &index) const; QWidget *createEditor(QWidget *parent, const QStyleOptionViewItem &option, const QModelIndex &index) const;
/** /**
* @brief setEditorData * @brief setEditorData sets the data to be displayed and edited by the editor from the data model item specified by
* @param editor * the model index.
* @param index * @param editor editor.
* @param index index of data item.
*/ */
void setEditorData(QWidget *editor, const QModelIndex &index) const; void setEditorData(QWidget *editor, const QModelIndex &index) const;
/** /**
* @brief setModelData * @brief setModelData gets data from the editor widget and stores it in the specified model at the item index.
* @param editor * @param editor editor.
* @param model * @param model model.
* @param index * @param index index of data item.
*/ */
void setModelData(QWidget *editor, QAbstractItemModel *model, const QModelIndex &index) const; void setModelData(QWidget *editor, QAbstractItemModel *model, const QModelIndex &index) const;
/** /**
* @brief updateEditorGeometry * @brief updateEditorGeometry updates the editor for the item specified by index according to the style option
* @param editor * given.
* @param option * @param editor editor.
* @param index * @param option item options.
* @param index index of data item.
*/ */
void updateEditorGeometry(QWidget *editor, const QStyleOptionViewItem &option, const QModelIndex &index) const; void updateEditorGeometry(QWidget *editor, const QStyleOptionViewItem &option, const QModelIndex &index) const;
public slots: public slots:
/**
* @brief commitAndCloseEditor commit value if changed.
*/
void commitAndCloseEditor(); void commitAndCloseEditor();
private: private:
/**
* @brief lastValue last saved value.
*/
qreal lastValue; qreal lastValue;
}; };

View File

@ -32,24 +32,24 @@
#include <QApplication> #include <QApplication>
/** /**
* @brief The VApplication class * @brief The VApplication class reimplamentation QApplication class.
*/ */
class VApplication : public QApplication class VApplication : public QApplication
{ {
Q_OBJECT Q_OBJECT
public: public:
/** /**
* @brief VApplication * @brief VApplication constructor.
* @param argc * @param argc number arguments.
* @param argv * @param argv command line.
*/ */
VApplication(int &argc, char ** argv): QApplication(argc, argv){} VApplication(int &argc, char ** argv): QApplication(argc, argv){}
virtual ~VApplication() {} virtual ~VApplication() {}
/** /**
* @brief notify * @brief notify Reimplemented from QApplication::notify().
* @param receiver * @param receiver receiver.
* @param event * @param event event.
* @return * @return value that is returned from the receiver's event handler.
*/ */
virtual bool notify(QObject * receiver, QEvent * event); virtual bool notify(QObject * receiver, QEvent * event);
}; };

View File

@ -34,99 +34,100 @@
#include "../geometry/vsplinepath.h" #include "../geometry/vsplinepath.h"
/** /**
* @brief The VControlPointSpline class * @brief The VControlPointSpline class control spline point.
*/ */
class VControlPointSpline : public QObject, public QGraphicsEllipseItem class VControlPointSpline : public QObject, public QGraphicsEllipseItem
{ {
Q_OBJECT Q_OBJECT
public: public:
/** /**
* @brief VControlPointSpline * @brief VControlPointSpline constructor.
* @param indexSpline * @param indexSpline index spline in list.
* @param position * @param position position point in spline.
* @param controlPoint * @param controlPoint control point.
* @param splinePoint * @param splinePoint spline point.
* @param parent * @param parent parent object.
*/ */
VControlPointSpline(const qint32 &indexSpline, SplinePoint::Position position, VControlPointSpline(const qint32 &indexSpline, SplinePoint::Position position,
const QPointF &controlPoint, const QPointF &splinePoint, const QPointF &controlPoint, const QPointF &splinePoint,
QGraphicsItem * parent = 0); QGraphicsItem * parent = 0);
signals: signals:
/** /**
* @brief ControlPointChangePosition * @brief ControlPointChangePosition emit when control point change position.
* @param indexSpline * @param indexSpline index spline in list.
* @param position * @param position position point in spline.
* @param pos * @param pos new posotion.
*/ */
void ControlPointChangePosition(const qint32 &indexSpline, SplinePoint::Position position, void ControlPointChangePosition(const qint32 &indexSpline, SplinePoint::Position position,
const QPointF pos); const QPointF pos);
public slots: public slots:
/** /**
* @brief RefreshLine * @brief RefreshLine refresh line control point.
* @param indexSpline * @param indexSpline index spline in list.
* @param pos * @param pos position point in spline.
* @param controlPoint * @param controlPoint control point.
* @param splinePoint * @param splinePoint spline point.
*/ */
void RefreshLine(const qint32 &indexSpline, SplinePoint::Position pos, const QPointF &controlPoint, void RefreshLine(const qint32 &indexSpline, SplinePoint::Position pos, const QPointF &controlPoint,
const QPointF &splinePoint); const QPointF &splinePoint);
/** /**
* @brief setEnabledPoint * @brief setEnabledPoint disable or enable control point.
* @param enable * @param enable true - enable.
*/ */
void setEnabledPoint(bool enable); void setEnabledPoint(bool enable);
protected: protected:
/** /**
* @brief radius * @brief radius radius circle.
*/ */
qreal radius; qreal radius;
/** /**
* @brief controlLine * @brief controlLine pointer to line control point.
*/ */
QGraphicsLineItem *controlLine; QGraphicsLineItem *controlLine;
/** /**
* @brief hoverMoveEvent handle hover move events. * @brief hoverMoveEvent handle hover move events.
* @param event * @param event hover move event.
*/ */
virtual void hoverMoveEvent ( QGraphicsSceneHoverEvent * event ); virtual void hoverMoveEvent ( QGraphicsSceneHoverEvent * event );
/** /**
* @brief hoverLeaveEvent handle hover leave events. * @brief hoverLeaveEvent handle hover leave events.
* @param event * @param event hover leave event.
*/ */
virtual void hoverLeaveEvent ( QGraphicsSceneHoverEvent * event ); virtual void hoverLeaveEvent ( QGraphicsSceneHoverEvent * event );
/** /**
* @brief itemChange * @brief itemChange handle item change.
* @param change * @param change change.
* @param value * @param value value.
* @return * @return value.
*/ */
QVariant itemChange ( GraphicsItemChange change, const QVariant &value ); QVariant itemChange ( GraphicsItemChange change, const QVariant &value );
private: private:
Q_DISABLE_COPY(VControlPointSpline) Q_DISABLE_COPY(VControlPointSpline)
/** /**
* @brief indexSpline * @brief indexSpline index spline in list..
*/ */
qint32 indexSpline; qint32 indexSpline;
/** /**
* @brief position * @brief position position point in spline.
*/ */
SplinePoint::Position position; SplinePoint::Position position;
//TODO LineIntersectCircle, ClosestPoint, addVector can be replaced by static methods of VAbstractTool class.
/** /**
* @brief LineIntersectCircle * @brief LineIntersectCircle find point intersection line and circle.
* @param center * @param center arc center.
* @param radius * @param radius arc radius.
* @param line * @param line line
* @param p1 * @param p1 first intersection point.
* @param p2 * @param p2 second intersection point.
* @return * @return 0 - intersection doesn't exist, 1 - one intersection point, 2 - two intersection points.
*/ */
qint32 LineIntersectCircle(const QPointF &center, qreal radius, const QLineF &line, QPointF &p1, qint32 LineIntersectCircle(const QPointF &center, qreal radius, const QLineF &line, QPointF &p1,
QPointF &p2) const; QPointF &p2) const;
/** /**
* @brief ClosestPoint * @brief ClosestPoint find point projection of point onto line.
* @param line * @param line line.
* @param p * @param p point.
* @return * @return point on line or extended line if origin size too small.
*/ */
QPointF ClosestPoint(const QLineF &line, const QPointF &p) const; QPointF ClosestPoint(const QLineF &line, const QPointF &p) const;
/** /**

View File

@ -32,57 +32,65 @@
#include <QGraphicsSimpleTextItem> #include <QGraphicsSimpleTextItem>
/** /**
* @brief The VGraphicsSimpleTextItem class * @brief The VGraphicsSimpleTextItem class pointer label.
*/ */
class VGraphicsSimpleTextItem : public QObject, public QGraphicsSimpleTextItem class VGraphicsSimpleTextItem : public QObject, public QGraphicsSimpleTextItem
{ {
Q_OBJECT Q_OBJECT
public: public:
/** /**
* @brief VGraphicsSimpleTextItem * @brief VGraphicsSimpleTextItem default constructor.
* @param parent * @param parent parent object.
*/ */
VGraphicsSimpleTextItem(QGraphicsItem * parent = 0); VGraphicsSimpleTextItem(QGraphicsItem * parent = 0);
/** /**
* @brief VGraphicsSimpleTextItem * @brief VGraphicsSimpleTextItem constructor.
* @param text * @param text text.
* @param parent * @param parent parent object.
*/ */
VGraphicsSimpleTextItem( const QString & text, QGraphicsItem * parent = 0 ); VGraphicsSimpleTextItem( const QString & text, QGraphicsItem * parent = 0 );
/** /**
* @brief FontSize * @brief FontSize return label font size.
* @return * @return font size.
*/ */
qint32 FontSize()const {return fontSize;} qint32 FontSize()const {return fontSize;}
signals: signals:
/** /**
* @brief NameChangePosition * @brief NameChangePosition emit when label change position.
* @param pos * @param pos new posotion.
*/ */
void NameChangePosition(const QPointF pos); void NameChangePosition(const QPointF pos);
/**
* @brief ShowContextMenu emit when need show tool context menu.
* @param event context menu event.
*/
void ShowContextMenu(QGraphicsSceneContextMenuEvent *event); void ShowContextMenu(QGraphicsSceneContextMenuEvent *event);
protected: protected:
/** /**
* @brief itemChange * @brief itemChange handle item change.
* @param change * @param change change.
* @param value * @param value value.
* @return * @return value.
*/ */
QVariant itemChange ( GraphicsItemChange change, const QVariant &value ); QVariant itemChange ( GraphicsItemChange change, const QVariant &value );
/** /**
* @brief hoverMoveEvent handle hover move events. * @brief hoverMoveEvent handle hover move events.
* @param event * @param event hover move event.
*/ */
virtual void hoverMoveEvent ( QGraphicsSceneHoverEvent * event ); virtual void hoverMoveEvent ( QGraphicsSceneHoverEvent * event );
/** /**
* @brief hoverLeaveEvent handle hover leave events. * @brief hoverLeaveEvent handle hover leave events.
* @param event * @param event hover leave event.
*/ */
virtual void hoverLeaveEvent ( QGraphicsSceneHoverEvent * event ); virtual void hoverLeaveEvent ( QGraphicsSceneHoverEvent * event );
/**
* @brief contextMenuEvent handle context menu events.
* @param event context menu event.
*/
virtual void contextMenuEvent ( QGraphicsSceneContextMenuEvent * event ); virtual void contextMenuEvent ( QGraphicsSceneContextMenuEvent * event );
private: private:
/** /**
* @brief fontSize * @brief fontSize label font size.
*/ */
qint32 fontSize; qint32 fontSize;
}; };

View File

@ -33,95 +33,88 @@
#include <QObject> #include <QObject>
/** /**
* @brief VItem клас, що реалізує деталь на сцені. * @brief VItem class detail on layout table.
*/ */
class VItem : public QObject, public QGraphicsPathItem class VItem : public QObject, public QGraphicsPathItem
{ {
Q_OBJECT Q_OBJECT
public: public:
/** /**
* @brief VItem конструктор за замовчуванням * @brief VItem default constructor.
*Конструктор генерує пусту деталь з номером в списку, що дорівнює 0.
*/ */
VItem ():numInOutList(0), paper(0){} VItem ():numInOutList(0), paper(0){}
/** /**
* @brief VItem конструктор * @brief VItem constructor.
* @param numInList номер в списку деталей, що передається у вікно де * @param numInList index in list of details.
*укладаються деталі. * @param parent parent object.
* @param parent батьківський об'єкт на сцені для даного. За замовчуванням немає. */
*/
VItem (int numInList, QGraphicsItem * parent = 0):QGraphicsPathItem (parent), numInOutList(numInList), VItem (int numInList, QGraphicsItem * parent = 0):QGraphicsPathItem (parent), numInOutList(numInList),
paper(0){} paper(0){}
/** /**
* @brief VItem конструктор * @brief VItem constructor.
* @param path зображення що буде показуватися на сцені - обєкт класу QPainterPath. * @param path detail path.
* @param numInList номер в списку деталей, що передається у вікно де * @param numInList index in list of details.
*укладаються деталі. * @param parent parent object.
* @param parent батьківський об'єкт на сцені для даного. За замовчуванням немає. */
*/
VItem ( const QPainterPath & path, int numInList, QGraphicsItem * parent = 0 ); VItem ( const QPainterPath & path, int numInList, QGraphicsItem * parent = 0 );
/** /**
* @brief Rotate повертає об'єкт на кут в градусах * @brief Rotate rotate detail on angle in degree.
* @param angle кут в градусах на який повертається деталь. * @param angle angle in degree.
*/ */
void Rotate ( qreal angle ); void Rotate ( qreal angle );
/** /**
* @brief getPaper * @brief getPaper return pointer to paper sheet.
* @return * @return pointer to paper sheet.
*/ */
QGraphicsRectItem *getPaper() const {return paper;} QGraphicsRectItem *getPaper() const {return paper;}
/** /**
* @brief setPaper * @brief setPaper set pointer to paper sheet.
* @param value * @param value pointer to paper sheet.
*/ */
void setPaper(QGraphicsRectItem *value) {paper = value;} void setPaper(QGraphicsRectItem *value) {paper = value;}
public slots: public slots:
/** /**
* @brief LengthChanged слот який обробляє сигнал зміни довжини листа. * @brief LengthChanged handle signal change paper length.
*/ */
void LengthChanged(); void LengthChanged();
/** /**
* @brief SetIndexInList встановлює номер деталі в списку деталей. * @brief SetIndexInList set detail index in list.
* @param index номер в списку. * @param index index in list.
*/ */
inline void SetIndexInList( qint32 index ) {numInOutList = index;} inline void SetIndexInList( qint32 index ) {numInOutList = index;}
protected: protected:
/** /**
* @brief itemChange модифікація стандартного методу itemChange. Виконується перехоплення зміни * @brief itemChange handle item change.
*положення і зміни батька. * @param change change.
* @param change * @param value value.
* @param value * @return value.
* @return
*/ */
QVariant itemChange ( GraphicsItemChange change, const QVariant &value ); QVariant itemChange ( GraphicsItemChange change, const QVariant &value );
/** /**
* @brief checkItemChange перевіряє вихід деталі за рамки листа і факт колізії. Посилає відповідні * @brief checkItemChange change item change. If detail create colission or moved out paper emit signal.
*сигнали.
*/ */
void checkItemChange (); void checkItemChange ();
private: private:
Q_DISABLE_COPY(VItem) Q_DISABLE_COPY(VItem)
/** /**
* @brief numInOutList для зберігання інформації про колізії від кожної деталі необхідно знати її * @brief numInOutList index in list.
*номер.
*/ */
qint32 numInOutList; qint32 numInOutList;
/** /**
* @brief paper * @brief paper pointer to paper item.
*/ */
QGraphicsRectItem* paper; QGraphicsRectItem* paper;
signals: signals:
/** /**
* @brief itemOut сигнал виходу за межі листа. Посилається у будь-якому випадку. * @brief itemOut emit if detail moved out paper. Detail send this signal each time when was moved.
* @param numInOutList номер деталі яка вийшла за межі листа або тепер знаходиться в межах листа. * @param numInOutList index in list.
* @param flag був вихід чи ні. * @param flag true if moved out. false if not.
*/ */
void itemOut ( int numInOutList, bool flag ); void itemOut ( int numInOutList, bool flag );
/** /**
* @brief itemColliding сигнал колізії деталі з іншими. Посилається як для додавання деталі до * @brief itemColliding emit if change create colission.
*списку тих що перетинаються, так і для виключення його з такого. * @param list list with all colission detalis.
* @param list список усіх деталей які приймають участь в колізії включаючи самого себе. * @param number 1 - colission exist, 0 - colission doesn't exist.
* @param number 1 - перетин є, 0 - перетину немає.
*/ */
void itemColliding ( QList<QGraphicsItem *> list, int number ); void itemColliding ( QList<QGraphicsItem *> list, int number );
}; };

View File

@ -33,49 +33,57 @@
#include "../options.h" #include "../options.h"
/** /**
* @brief The VMainGraphicsScene class * @brief The VMainGraphicsScene class main scene.
*/ */
class VMainGraphicsScene : public QGraphicsScene class VMainGraphicsScene : public QGraphicsScene
{ {
Q_OBJECT Q_OBJECT
public: public:
/** /**
* @brief VMainGraphicsScene * @brief VMainGraphicsScene default constructor.
*/ */
VMainGraphicsScene(); VMainGraphicsScene();
/** /**
* @brief VMainGraphicsScene * @brief VMainGraphicsScene constructor.
* @param sceneRect * @param sceneRect scene rect.
* @param parent * @param parent parent object.
*/ */
VMainGraphicsScene(const QRectF & sceneRect, QObject * parent = 0); VMainGraphicsScene(const QRectF & sceneRect, QObject * parent = 0);
/** /**
* @brief getHorScrollBar * @brief getHorScrollBar return scene horizontal scrollbar.
* @return * @return horizontal scrollbar.
*/ */
inline qint32 getHorScrollBar() const {return horScrollBar;} inline qint32 getHorScrollBar() const {return horScrollBar;}
/** /**
* @brief setHorScrollBar * @brief setHorScrollBar set scene horizontal scrollbar.
* @param value * @param value horizontal scrollbar.
*/ */
inline void setHorScrollBar(const qint32 &value) {horScrollBar = value;} inline void setHorScrollBar(const qint32 &value) {horScrollBar = value;}
/** /**
* @brief getVerScrollBar * @brief getVerScrollBar return scene vertical scrollbar.
* @return * @return vertical scrollbar.
*/ */
inline qint32 getVerScrollBar() const {return verScrollBar;} inline qint32 getVerScrollBar() const {return verScrollBar;}
/** /**
* @brief setVerScrollBar * @brief setVerScrollBar set scene vertical scrollbar.
* @param value * @param value vertical scrollbar.
*/ */
inline void setVerScrollBar(const qint32 &value) {verScrollBar = value;} inline void setVerScrollBar(const qint32 &value) {verScrollBar = value;}
/**
* @brief transform return view transformation.
* @return view transformation.
*/
QTransform transform() const; QTransform transform() const;
/**
* @brief setTransform set view transformation.
* @param transform view transformation.
*/
void setTransform(const QTransform &transform); void setTransform(const QTransform &transform);
public slots: public slots:
/** /**
* @brief ChoosedItem * @brief ChoosedItem emit ChoosedObject signal.
* @param id * @param id object id.
* @param type * @param type object scene type.
*/ */
void ChoosedItem(qint64 id, const Scene::Scenes &type); void ChoosedItem(qint64 id, const Scene::Scenes &type);
/** /**
@ -85,50 +93,53 @@ public slots:
void SetFactor(qreal factor); void SetFactor(qreal factor);
protected: protected:
/** /**
* @brief mouseMoveEvent * @brief mouseMoveEvent handle mouse move events.
* @param event * @param event mouse move event.
*/ */
void mouseMoveEvent(QGraphicsSceneMouseEvent* event); void mouseMoveEvent(QGraphicsSceneMouseEvent* event);
/** /**
* @brief mousePressEvent * @brief mousePressEvent mouse press events.
* @param event * @param event mouse press event
*/ */
void mousePressEvent(QGraphicsSceneMouseEvent *event); void mousePressEvent(QGraphicsSceneMouseEvent *event);
signals: signals:
/** /**
* @brief mouseMove * @brief mouseMove send new mouse position.
* @param scenePos * @param scenePos new mouse position.
*/ */
void mouseMove(QPointF scenePos); void mouseMove(QPointF scenePos);
/** /**
* @brief mousePress * @brief mousePress send new mouse press position.
* @param scenePos * @param scenePos new mouse press position.
*/ */
void mousePress(QPointF scenePos); void mousePress(QPointF scenePos);
/** /**
* @brief ChoosedObject * @brief ChoosedObject send option choosed object.
* @param id * @param id object id.
* @param type * @param type object scene type.
*/ */
void ChoosedObject(qint64 id, Scene::Scenes type); void ChoosedObject(qint64 id, Scene::Scenes type);
/** /**
* @brief NewFactor * @brief NewFactor send new scale factor.
* @param factor scene scale factor. * @param factor scene scale factor.
*/ */
void NewFactor(qreal factor); void NewFactor(qreal factor);
private: private:
/** /**
* @brief horScrollBar * @brief horScrollBar value horizontal scroll bar.
*/ */
qint32 horScrollBar; qint32 horScrollBar;
/** /**
* @brief verScrollBar * @brief verScrollBar value vertical scroll bar.
*/ */
qint32 verScrollBar; qint32 verScrollBar;
/** /**
* @brief scaleFactor * @brief scaleFactor scale factor.
*/ */
qreal scaleFactor; qreal scaleFactor;
/**
* @brief _transform view transform value.
*/
QTransform _transform; QTransform _transform;
}; };

View File

@ -32,29 +32,33 @@
#include <QGraphicsView> #include <QGraphicsView>
/** /**
* @brief The VMainGraphicsView class * @brief The VMainGraphicsView class main scene view.
*/ */
class VMainGraphicsView : public QGraphicsView class VMainGraphicsView : public QGraphicsView
{ {
Q_OBJECT Q_OBJECT
public: public:
/** /**
* @brief VMainGraphicsView * @brief VMainGraphicsView constructor.
* @param parent * @param parent parent object.
*/ */
explicit VMainGraphicsView(QWidget *parent = 0); explicit VMainGraphicsView(QWidget *parent = 0);
signals: signals:
/** /**
* @brief NewFactor * @brief NewFactor send new scale factor.
* @param factor scene scale factor. * @param factor scene scale factor.
*/ */
void NewFactor(qreal factor); void NewFactor(qreal factor);
public slots: public slots:
/** /**
* @brief scalingTime * @brief scalingTime call each time when need handle scaling.
* @param x * @param x
*/ */
void scalingTime(qreal x); void scalingTime(qreal x);
/**
* @brief scrollingTime call each time when need handle scrolling.
* @param x
*/
void scrollingTime(qreal x); void scrollingTime(qreal x);
/** /**
* @brief animFinished * @brief animFinished
@ -62,23 +66,23 @@ public slots:
void animFinished(); void animFinished();
protected: protected:
/** /**
* @brief wheelEvent обробник повороту колеса мишки. * @brief wheelEvent handle wheel events.
* @param event передається подія. * @param event wheel event.
*/ */
void wheelEvent ( QWheelEvent * event ); void wheelEvent ( QWheelEvent * event );
/** /**
* @brief mousePressEvent * @brief mousePressEvent handle mouse press events.
* @param mousePress * @param mousePress mouse press event.
*/ */
void mousePressEvent(QMouseEvent *mousePress); void mousePressEvent(QMouseEvent *mousePress);
/** /**
* @brief mouseReleaseEvent handle mouse release events. * @brief mouseReleaseEvent handle mouse release events.
* @param event * @param event mouse release event.
*/ */
void mouseReleaseEvent(QMouseEvent *event); void mouseReleaseEvent(QMouseEvent *event);
private: private:
/** /**
* @brief _numScheduledScalings * @brief _numScheduledScalings keep number scheduled scalings.
*/ */
qint32 _numScheduledScalings; qint32 _numScheduledScalings;
}; };

View File

@ -34,52 +34,62 @@
namespace SimpleArc namespace SimpleArc
{ {
/** /**
* @brief The Translation enum * @brief The Translation enum position point.
*/ */
enum Translation { FirstPoint, ForthPoint }; enum Translation { FirstPoint, ForthPoint };
Q_DECLARE_FLAGS(Translations, Translation) Q_DECLARE_FLAGS(Translations, Translation)
} }
Q_DECLARE_OPERATORS_FOR_FLAGS( SimpleArc::Translations ) Q_DECLARE_OPERATORS_FOR_FLAGS( SimpleArc::Translations )
/**
* @brief The VSimpleArc class for simple arc. This object used when we cut arc and want show peaces.
*/
class VSimpleArc : public QObject, public QGraphicsPathItem class VSimpleArc : public QObject, public QGraphicsPathItem
{ {
Q_OBJECT Q_OBJECT
public: public:
/**
* @brief VSimpleArc constructor.
* @param id arc id.
* @param currentColor current color.
* @param factor scale factor.
* @param parent parent object.
*/
VSimpleArc(qint64 id, Qt::GlobalColor *currentColor, qreal *factor = 0, QObject *parent = 0); VSimpleArc(qint64 id, Qt::GlobalColor *currentColor, qreal *factor = 0, QObject *parent = 0);
signals: signals:
/** /**
* @brief Choosed * @brief Choosed send id when clicked.
* @param id * @param id arc id.
*/ */
void Choosed(qint64 id); void Choosed(qint64 id);
protected: protected:
/** /**
* @brief mouseReleaseEvent handle mouse release events. * @brief mouseReleaseEvent handle mouse release events.
* @param event * @param event mouse release event.
*/ */
virtual void mouseReleaseEvent ( QGraphicsSceneMouseEvent * event ); virtual void mouseReleaseEvent ( QGraphicsSceneMouseEvent * event );
/** /**
* @brief hoverMoveEvent handle hover move events. * @brief hoverMoveEvent handle hover move events.
* @param event * @param event hover move event.
*/ */
virtual void hoverMoveEvent ( QGraphicsSceneHoverEvent * event ); virtual void hoverMoveEvent ( QGraphicsSceneHoverEvent * event );
/** /**
* @brief hoverLeaveEvent handle hover leave events. * @brief hoverLeaveEvent handle hover leave events.
* @param event * @param event hover leave event.
*/ */
virtual void hoverLeaveEvent ( QGraphicsSceneHoverEvent * event ); virtual void hoverLeaveEvent ( QGraphicsSceneHoverEvent * event );
private: private:
Q_DISABLE_COPY(VSimpleArc) Q_DISABLE_COPY(VSimpleArc)
/** /**
* @brief id * @brief id arc id.
*/ */
qint64 id; qint64 id;
/** /**
* @brief factor * @brief factor scale factor.
*/ */
qreal *factor; qreal *factor;
/** /**
* @brief currentColor * @brief currentColor current color.
*/ */
Qt::GlobalColor *currentColor; Qt::GlobalColor *currentColor;
}; };

View File

@ -34,7 +34,7 @@
namespace SimpleSpline namespace SimpleSpline
{ {
/** /**
* @brief The Translation enum * @brief The Translation enum position point.
*/ */
enum Translation { FirstPoint, ForthPoint }; enum Translation { FirstPoint, ForthPoint };
Q_DECLARE_FLAGS(Translations, Translation) Q_DECLARE_FLAGS(Translations, Translation)
@ -42,54 +42,54 @@ namespace SimpleSpline
Q_DECLARE_OPERATORS_FOR_FLAGS( SimpleSpline::Translations ) Q_DECLARE_OPERATORS_FOR_FLAGS( SimpleSpline::Translations )
/** /**
* @brief The VSimpleSpline class * @brief The VSimpleSpline class for simple spline. This object used when we cut spline and want show peaces.
*/ */
class VSimpleSpline : public QObject, public QGraphicsPathItem class VSimpleSpline : public QObject, public QGraphicsPathItem
{ {
Q_OBJECT Q_OBJECT
public: public:
/** /**
* @brief VSimpleSpline * @brief VSimpleSpline constructor.
* @param id * @param id spline id.
* @param factor scene scale factor. * @param factor scene scale factor.
* @param currentColor * @param currentColor current color.
* @param parent * @param parent parent object.
*/ */
VSimpleSpline(qint64 id, Qt::GlobalColor *currentColor, qreal *factor = 0, QObject *parent = 0); VSimpleSpline(qint64 id, Qt::GlobalColor *currentColor, qreal *factor = 0, QObject *parent = 0);
signals: signals:
/** /**
* @brief Choosed * @brief Choosed send id when clicked.
* @param id * @param id spline id.
*/ */
void Choosed(qint64 id); void Choosed(qint64 id);
protected: protected:
/** /**
* @brief mouseReleaseEvent handle mouse release events. * @brief mouseReleaseEvent handle mouse release events.
* @param event * @param event mouse release event.
*/ */
virtual void mouseReleaseEvent ( QGraphicsSceneMouseEvent * event ); virtual void mouseReleaseEvent ( QGraphicsSceneMouseEvent * event );
/** /**
* @brief hoverMoveEvent handle hover move events. * @brief hoverMoveEvent handle hover move events.
* @param event * @param event hover move event.
*/ */
virtual void hoverMoveEvent ( QGraphicsSceneHoverEvent * event ); virtual void hoverMoveEvent ( QGraphicsSceneHoverEvent * event );
/** /**
* @brief hoverLeaveEvent handle hover leave events. * @brief hoverLeaveEvent handle hover leave events.
* @param event * @param event hover leave event.
*/ */
virtual void hoverLeaveEvent ( QGraphicsSceneHoverEvent * event ); virtual void hoverLeaveEvent ( QGraphicsSceneHoverEvent * event );
private: private:
Q_DISABLE_COPY(VSimpleSpline) Q_DISABLE_COPY(VSimpleSpline)
/** /**
* @brief id * @brief id spline id.
*/ */
qint64 id; qint64 id;
/** /**
* @brief factor * @brief factor scale factor.
*/ */
qreal *factor; qreal *factor;
/** /**
* @brief currentColor * @brief currentColor current color.
*/ */
Qt::GlobalColor *currentColor; Qt::GlobalColor *currentColor;
}; };

View File

@ -32,29 +32,43 @@
#include <QGraphicsPathItem> #include <QGraphicsPathItem>
#include "../tools/vabstracttool.h" #include "../tools/vabstracttool.h"
/**
* @brief The VSimpleSplinePath class for simple spline path. This object used when we cut spline path and want show
* peaces.
*/
class VSimpleSplinePath : public VAbstractTool, public QGraphicsPathItem class VSimpleSplinePath : public VAbstractTool, public QGraphicsPathItem
{ {
Q_OBJECT Q_OBJECT
public: public:
/**
* @brief VSimpleSplinePath constructor.
* @param doc dom document container.
* @param data container with variables.
* @param id spline path id.
* @param factor scale factor.
*/
VSimpleSplinePath(VDomDocument *doc, VContainer *data, qint64 id, qreal *factor); VSimpleSplinePath(VDomDocument *doc, VContainer *data, qint64 id, qreal *factor);
protected: protected:
/** /**
* @brief mouseReleaseEvent handle mouse release events. * @brief mouseReleaseEvent handle mouse release events.
* @param event * @param event mouse release event.
*/ */
virtual void mouseReleaseEvent ( QGraphicsSceneMouseEvent * event ); virtual void mouseReleaseEvent ( QGraphicsSceneMouseEvent * event );
/** /**
* @brief hoverMoveEvent handle hover move events. * @brief hoverMoveEvent handle hover move events.
* @param event * @param event hover move event.
*/ */
virtual void hoverMoveEvent ( QGraphicsSceneHoverEvent * event ); virtual void hoverMoveEvent ( QGraphicsSceneHoverEvent * event );
/** /**
* @brief hoverLeaveEvent handle hover leave events. * @brief hoverLeaveEvent handle hover leave events.
* @param event * @param event hover leave event.
*/ */
virtual void hoverLeaveEvent ( QGraphicsSceneHoverEvent * event ); virtual void hoverLeaveEvent ( QGraphicsSceneHoverEvent * event );
private: private:
Q_DISABLE_COPY(VSimpleSplinePath) Q_DISABLE_COPY(VSimpleSplinePath)
/**
* @brief factor scale factor.
*/
qreal *factor; qreal *factor;
}; };

View File

@ -32,72 +32,72 @@
#include <QGraphicsView> #include <QGraphicsView>
/** /**
* @brief The VTableGraphicsView class * @brief The VTableGraphicsView class table layout view.
*/ */
class VTableGraphicsView : public QGraphicsView class VTableGraphicsView : public QGraphicsView
{ {
Q_OBJECT Q_OBJECT
public: public:
/** /**
* @brief The typeMove_e enum * @brief The typeMove_e enum type items moves.
*/ */
enum typeMove_e { Left, Right, Up, Down }; enum typeMove_e { Left, Right, Up, Down };
VTableGraphicsView(QGraphicsScene* pScene, QWidget *parent = 0); VTableGraphicsView(QGraphicsScene* pScene, QWidget *parent = 0);
signals: signals:
/** /**
* @brief itemChect Сигнал, що посилається коли змінюється стан вибору деталі. * @brief itemChect emit after change selection state detail.
* @param flag Зберігає стан вибору деталі: false - знайдено, true - не знайдено. * @param flag false - selected, true - don't selected.
*/ */
void itemChect( bool flag ); void itemChect( bool flag );
public slots: public slots:
/** /**
* @brief selectionChanged Слот виконується при зміні стану вибору деталей. * @brief selectionChanged handle selection change.
*/ */
void selectionChanged(); void selectionChanged();
/** /**
* @brief rotateItems слот, який виконується при натисненні кнопки повороту деталі. * @brief rotateItems handle rotatation detail.
*/ */
inline void rotateItems() {rotateIt();} inline void rotateItems() {rotateIt();}
/** /**
* @brief MirrorItem дзеркалить об'єкт відносно вертикальної вісі семетрії об'єкта. * @brief MirrorItem mirror detail.
*/ */
void MirrorItem(); void MirrorItem();
/** /**
* @brief ZoomIn збільшує масштаб листа. * @brief ZoomIn zoom in paper scale.
*/ */
inline void ZoomIn() {scale(1.1, 1.1);} inline void ZoomIn() {scale(1.1, 1.1);}
/** /**
* @brief ZoomOut зменшує масштаб листа. * @brief ZoomOut zoom out paper scale.
*/ */
inline void ZoomOut() {scale(1/1.1, 1/1.1);} inline void ZoomOut() {scale(1/1.1, 1/1.1);}
protected: protected:
/** /**
* @brief wheelEvent обробник повороту колеса мишки. * @brief wheelEvent handle wheel events.
* @param event передається подія. * @param event wheel event.
*/ */
void wheelEvent ( QWheelEvent * event ); void wheelEvent ( QWheelEvent * event );
/** /**
* @brief mousePressEvent обробник натиснення кнопки миші. * @brief mousePressEvent handle mouse press events.
* @param mousePress передається подія. * @param mousePress mouse press event.
*/ */
void mousePressEvent(QMouseEvent *mousePress); void mousePressEvent(QMouseEvent *mousePress);
/** /**
* @brief mouseReleaseEvent handle mouse release events. обробник відпускання кнопки миші. * @brief mouseReleaseEvent handle mouse release events.
* @param event передається подія * @param event mouse release event.
*/ */
void mouseReleaseEvent ( QMouseEvent * event ); void mouseReleaseEvent ( QMouseEvent * event );
/** /**
* @brief keyPressEvent обробник натиснення клавіші. * @brief keyPressEvent handle key press events.
* @param event передається подія. * @param event key press event.
*/ */
void keyPressEvent ( QKeyEvent * event ); void keyPressEvent ( QKeyEvent * event );
/** /**
* @brief rotateIt виконує поворот вибраних деталей на 180 градусів. * @brief rotateIt rotate selected details on 180 degree.
*/ */
void rotateIt(); void rotateIt();
/** /**
* @brief MoveItem переміщує виділені об'єкти сцени. * @brief MoveItem move selected detail.
* @param move напрямок переміщення. * @param move type of move.
*/ */
void MoveItem( VTableGraphicsView::typeMove_e move ); void MoveItem( VTableGraphicsView::typeMove_e move );