Documentation for widgets.
--HG-- branch : develop
This commit is contained in:
parent
b711410ee6
commit
b96f83f238
|
@ -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 <QDoubleSpinBox>
|
||||
|
|
|
@ -32,48 +32,58 @@
|
|||
#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
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
/**
|
||||
* @brief DoubleSpinBoxDelegate
|
||||
* @param parent
|
||||
* @brief DoubleSpinBoxDelegate constructor.
|
||||
* @param parent parent object.
|
||||
*/
|
||||
DoubleSpinBoxDelegate(QObject *parent = 0): QItemDelegate(parent), lastValue(-10001.0){}
|
||||
/**
|
||||
* @brief createEditor
|
||||
* @param parent
|
||||
* @param option
|
||||
* @param index
|
||||
* @return
|
||||
* @brief createEditorReturns the widget used to edit the item specified by index for editing. The parent widget and
|
||||
* style option are used to control how the editor widget appears.
|
||||
* @param parent parent widget.
|
||||
* @param option item options.
|
||||
* @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;
|
||||
/**
|
||||
* @brief setEditorData
|
||||
* @param editor
|
||||
* @param index
|
||||
* @brief setEditorData sets the data to be displayed and edited by the editor from the data model item specified by
|
||||
* the model index.
|
||||
* @param editor editor.
|
||||
* @param index index of data item.
|
||||
*/
|
||||
void setEditorData(QWidget *editor, const QModelIndex &index) const;
|
||||
/**
|
||||
* @brief setModelData
|
||||
* @param editor
|
||||
* @param model
|
||||
* @param index
|
||||
* @brief setModelData gets data from the editor widget and stores it in the specified model at the item index.
|
||||
* @param editor editor.
|
||||
* @param model model.
|
||||
* @param index index of data item.
|
||||
*/
|
||||
void setModelData(QWidget *editor, QAbstractItemModel *model, const QModelIndex &index) const;
|
||||
/**
|
||||
* @brief updateEditorGeometry
|
||||
* @param editor
|
||||
* @param option
|
||||
* @param index
|
||||
* @brief updateEditorGeometry updates the editor for the item specified by index according to the style option
|
||||
* given.
|
||||
* @param editor editor.
|
||||
* @param option item options.
|
||||
* @param index index of data item.
|
||||
*/
|
||||
void updateEditorGeometry(QWidget *editor, const QStyleOptionViewItem &option, const QModelIndex &index) const;
|
||||
public slots:
|
||||
/**
|
||||
* @brief commitAndCloseEditor commit value if changed.
|
||||
*/
|
||||
void commitAndCloseEditor();
|
||||
private:
|
||||
/**
|
||||
* @brief lastValue last saved value.
|
||||
*/
|
||||
qreal lastValue;
|
||||
};
|
||||
|
||||
|
|
|
@ -32,24 +32,24 @@
|
|||
#include <QApplication>
|
||||
|
||||
/**
|
||||
* @brief The VApplication class
|
||||
* @brief The VApplication class reimplamentation QApplication class.
|
||||
*/
|
||||
class VApplication : public QApplication
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
/**
|
||||
* @brief VApplication
|
||||
* @param argc
|
||||
* @param argv
|
||||
* @brief VApplication constructor.
|
||||
* @param argc number arguments.
|
||||
* @param argv command line.
|
||||
*/
|
||||
VApplication(int &argc, char ** argv): QApplication(argc, argv){}
|
||||
virtual ~VApplication() {}
|
||||
/**
|
||||
* @brief notify
|
||||
* @param receiver
|
||||
* @param event
|
||||
* @return
|
||||
* @brief notify Reimplemented from QApplication::notify().
|
||||
* @param receiver receiver.
|
||||
* @param event event.
|
||||
* @return value that is returned from the receiver's event handler.
|
||||
*/
|
||||
virtual bool notify(QObject * receiver, QEvent * event);
|
||||
};
|
||||
|
|
|
@ -34,99 +34,100 @@
|
|||
#include "../geometry/vsplinepath.h"
|
||||
|
||||
/**
|
||||
* @brief The VControlPointSpline class
|
||||
* @brief The VControlPointSpline class control spline point.
|
||||
*/
|
||||
class VControlPointSpline : public QObject, public QGraphicsEllipseItem
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
/**
|
||||
* @brief VControlPointSpline
|
||||
* @param indexSpline
|
||||
* @param position
|
||||
* @param controlPoint
|
||||
* @param splinePoint
|
||||
* @param parent
|
||||
* @brief VControlPointSpline constructor.
|
||||
* @param indexSpline index spline in list.
|
||||
* @param position position point in spline.
|
||||
* @param controlPoint control point.
|
||||
* @param splinePoint spline point.
|
||||
* @param parent parent object.
|
||||
*/
|
||||
VControlPointSpline(const qint32 &indexSpline, SplinePoint::Position position,
|
||||
const QPointF &controlPoint, const QPointF &splinePoint,
|
||||
QGraphicsItem * parent = 0);
|
||||
signals:
|
||||
/**
|
||||
* @brief ControlPointChangePosition
|
||||
* @param indexSpline
|
||||
* @param position
|
||||
* @param pos
|
||||
* @brief ControlPointChangePosition emit when control point change position.
|
||||
* @param indexSpline index spline in list.
|
||||
* @param position position point in spline.
|
||||
* @param pos new posotion.
|
||||
*/
|
||||
void ControlPointChangePosition(const qint32 &indexSpline, SplinePoint::Position position,
|
||||
const QPointF pos);
|
||||
public slots:
|
||||
/**
|
||||
* @brief RefreshLine
|
||||
* @param indexSpline
|
||||
* @param pos
|
||||
* @param controlPoint
|
||||
* @param splinePoint
|
||||
* @brief RefreshLine refresh line control point.
|
||||
* @param indexSpline index spline in list.
|
||||
* @param pos position point in spline.
|
||||
* @param controlPoint control point.
|
||||
* @param splinePoint spline point.
|
||||
*/
|
||||
void RefreshLine(const qint32 &indexSpline, SplinePoint::Position pos, const QPointF &controlPoint,
|
||||
const QPointF &splinePoint);
|
||||
/**
|
||||
* @brief setEnabledPoint
|
||||
* @param enable
|
||||
* @brief setEnabledPoint disable or enable control point.
|
||||
* @param enable true - enable.
|
||||
*/
|
||||
void setEnabledPoint(bool enable);
|
||||
protected:
|
||||
/**
|
||||
* @brief radius
|
||||
* @brief radius radius circle.
|
||||
*/
|
||||
qreal radius;
|
||||
/**
|
||||
* @brief controlLine
|
||||
* @brief controlLine pointer to line control point.
|
||||
*/
|
||||
QGraphicsLineItem *controlLine;
|
||||
/**
|
||||
* @brief hoverMoveEvent handle hover move events.
|
||||
* @param event
|
||||
* @param event hover move event.
|
||||
*/
|
||||
virtual void hoverMoveEvent ( QGraphicsSceneHoverEvent * event );
|
||||
/**
|
||||
* @brief hoverLeaveEvent handle hover leave events.
|
||||
* @param event
|
||||
* @param event hover leave event.
|
||||
*/
|
||||
virtual void hoverLeaveEvent ( QGraphicsSceneHoverEvent * event );
|
||||
/**
|
||||
* @brief itemChange
|
||||
* @param change
|
||||
* @param value
|
||||
* @return
|
||||
* @brief itemChange handle item change.
|
||||
* @param change change.
|
||||
* @param value value.
|
||||
* @return value.
|
||||
*/
|
||||
QVariant itemChange ( GraphicsItemChange change, const QVariant &value );
|
||||
private:
|
||||
Q_DISABLE_COPY(VControlPointSpline)
|
||||
/**
|
||||
* @brief indexSpline
|
||||
* @brief indexSpline index spline in list..
|
||||
*/
|
||||
qint32 indexSpline;
|
||||
/**
|
||||
* @brief position
|
||||
* @brief position position point in spline.
|
||||
*/
|
||||
SplinePoint::Position position;
|
||||
//TODO LineIntersectCircle, ClosestPoint, addVector can be replaced by static methods of VAbstractTool class.
|
||||
/**
|
||||
* @brief LineIntersectCircle
|
||||
* @param center
|
||||
* @param radius
|
||||
* @param line
|
||||
* @param p1
|
||||
* @param p2
|
||||
* @return
|
||||
* @brief LineIntersectCircle find point intersection line and circle.
|
||||
* @param center arc center.
|
||||
* @param radius arc radius.
|
||||
* @param line line
|
||||
* @param p1 first intersection point.
|
||||
* @param p2 second intersection point.
|
||||
* @return 0 - intersection doesn't exist, 1 - one intersection point, 2 - two intersection points.
|
||||
*/
|
||||
qint32 LineIntersectCircle(const QPointF ¢er, qreal radius, const QLineF &line, QPointF &p1,
|
||||
QPointF &p2) const;
|
||||
/**
|
||||
* @brief ClosestPoint
|
||||
* @param line
|
||||
* @param p
|
||||
* @return
|
||||
* @brief ClosestPoint find point projection of point onto line.
|
||||
* @param line line.
|
||||
* @param p point.
|
||||
* @return point on line or extended line if origin size too small.
|
||||
*/
|
||||
QPointF ClosestPoint(const QLineF &line, const QPointF &p) const;
|
||||
/**
|
||||
|
|
|
@ -32,57 +32,65 @@
|
|||
#include <QGraphicsSimpleTextItem>
|
||||
|
||||
/**
|
||||
* @brief The VGraphicsSimpleTextItem class
|
||||
* @brief The VGraphicsSimpleTextItem class pointer label.
|
||||
*/
|
||||
class VGraphicsSimpleTextItem : public QObject, public QGraphicsSimpleTextItem
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
/**
|
||||
* @brief VGraphicsSimpleTextItem
|
||||
* @param parent
|
||||
* @brief VGraphicsSimpleTextItem default constructor.
|
||||
* @param parent parent object.
|
||||
*/
|
||||
VGraphicsSimpleTextItem(QGraphicsItem * parent = 0);
|
||||
/**
|
||||
* @brief VGraphicsSimpleTextItem
|
||||
* @param text
|
||||
* @param parent
|
||||
* @brief VGraphicsSimpleTextItem constructor.
|
||||
* @param text text.
|
||||
* @param parent parent object.
|
||||
*/
|
||||
VGraphicsSimpleTextItem( const QString & text, QGraphicsItem * parent = 0 );
|
||||
/**
|
||||
* @brief FontSize
|
||||
* @return
|
||||
* @brief FontSize return label font size.
|
||||
* @return font size.
|
||||
*/
|
||||
qint32 FontSize()const {return fontSize;}
|
||||
signals:
|
||||
/**
|
||||
* @brief NameChangePosition
|
||||
* @param pos
|
||||
* @brief NameChangePosition emit when label change position.
|
||||
* @param pos new posotion.
|
||||
*/
|
||||
void NameChangePosition(const QPointF pos);
|
||||
/**
|
||||
* @brief ShowContextMenu emit when need show tool context menu.
|
||||
* @param event context menu event.
|
||||
*/
|
||||
void ShowContextMenu(QGraphicsSceneContextMenuEvent *event);
|
||||
protected:
|
||||
/**
|
||||
* @brief itemChange
|
||||
* @param change
|
||||
* @param value
|
||||
* @return
|
||||
* @brief itemChange handle item change.
|
||||
* @param change change.
|
||||
* @param value value.
|
||||
* @return value.
|
||||
*/
|
||||
QVariant itemChange ( GraphicsItemChange change, const QVariant &value );
|
||||
/**
|
||||
* @brief hoverMoveEvent handle hover move events.
|
||||
* @param event
|
||||
* @param event hover move event.
|
||||
*/
|
||||
virtual void hoverMoveEvent ( QGraphicsSceneHoverEvent * event );
|
||||
/**
|
||||
* @brief hoverLeaveEvent handle hover leave events.
|
||||
* @param event
|
||||
* @param event hover leave event.
|
||||
*/
|
||||
virtual void hoverLeaveEvent ( QGraphicsSceneHoverEvent * event );
|
||||
/**
|
||||
* @brief contextMenuEvent handle context menu events.
|
||||
* @param event context menu event.
|
||||
*/
|
||||
virtual void contextMenuEvent ( QGraphicsSceneContextMenuEvent * event );
|
||||
private:
|
||||
/**
|
||||
* @brief fontSize
|
||||
* @brief fontSize label font size.
|
||||
*/
|
||||
qint32 fontSize;
|
||||
};
|
||||
|
|
|
@ -33,95 +33,88 @@
|
|||
#include <QObject>
|
||||
|
||||
/**
|
||||
* @brief VItem клас, що реалізує деталь на сцені.
|
||||
* @brief VItem class detail on layout table.
|
||||
*/
|
||||
class VItem : public QObject, public QGraphicsPathItem
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
/**
|
||||
* @brief VItem конструктор за замовчуванням
|
||||
*Конструктор генерує пусту деталь з номером в списку, що дорівнює 0.
|
||||
* @brief VItem default constructor.
|
||||
*/
|
||||
VItem ():numInOutList(0), paper(0){}
|
||||
/**
|
||||
* @brief VItem конструктор
|
||||
* @param numInList номер в списку деталей, що передається у вікно де
|
||||
*укладаються деталі.
|
||||
* @param parent батьківський об'єкт на сцені для даного. За замовчуванням немає.
|
||||
* @brief VItem constructor.
|
||||
* @param numInList index in list of details.
|
||||
* @param parent parent object.
|
||||
*/
|
||||
VItem (int numInList, QGraphicsItem * parent = 0):QGraphicsPathItem (parent), numInOutList(numInList),
|
||||
paper(0){}
|
||||
/**
|
||||
* @brief VItem конструктор
|
||||
* @param path зображення що буде показуватися на сцені - об’єкт класу QPainterPath.
|
||||
* @param numInList номер в списку деталей, що передається у вікно де
|
||||
*укладаються деталі.
|
||||
* @param parent батьківський об'єкт на сцені для даного. За замовчуванням немає.
|
||||
* @brief VItem constructor.
|
||||
* @param path detail path.
|
||||
* @param numInList index in list of details.
|
||||
* @param parent parent object.
|
||||
*/
|
||||
VItem ( const QPainterPath & path, int numInList, QGraphicsItem * parent = 0 );
|
||||
/**
|
||||
* @brief Rotate повертає об'єкт на кут в градусах
|
||||
* @param angle кут в градусах на який повертається деталь.
|
||||
* @brief Rotate rotate detail on angle in degree.
|
||||
* @param angle angle in degree.
|
||||
*/
|
||||
void Rotate ( qreal angle );
|
||||
/**
|
||||
* @brief getPaper
|
||||
* @return
|
||||
* @brief getPaper return pointer to paper sheet.
|
||||
* @return pointer to paper sheet.
|
||||
*/
|
||||
QGraphicsRectItem *getPaper() const {return paper;}
|
||||
/**
|
||||
* @brief setPaper
|
||||
* @param value
|
||||
* @brief setPaper set pointer to paper sheet.
|
||||
* @param value pointer to paper sheet.
|
||||
*/
|
||||
void setPaper(QGraphicsRectItem *value) {paper = value;}
|
||||
public slots:
|
||||
/**
|
||||
* @brief LengthChanged слот який обробляє сигнал зміни довжини листа.
|
||||
* @brief LengthChanged handle signal change paper length.
|
||||
*/
|
||||
void LengthChanged();
|
||||
/**
|
||||
* @brief SetIndexInList встановлює номер деталі в списку деталей.
|
||||
* @param index номер в списку.
|
||||
* @brief SetIndexInList set detail index in list.
|
||||
* @param index index in list.
|
||||
*/
|
||||
inline void SetIndexInList( qint32 index ) {numInOutList = index;}
|
||||
protected:
|
||||
/**
|
||||
* @brief itemChange модифікація стандартного методу itemChange. Виконується перехоплення зміни
|
||||
*положення і зміни батька.
|
||||
* @param change
|
||||
* @param value
|
||||
* @return
|
||||
* @brief itemChange handle item change.
|
||||
* @param change change.
|
||||
* @param value value.
|
||||
* @return 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 ();
|
||||
private:
|
||||
Q_DISABLE_COPY(VItem)
|
||||
/**
|
||||
* @brief numInOutList для зберігання інформації про колізії від кожної деталі необхідно знати її
|
||||
*номер.
|
||||
* @brief numInOutList index in list.
|
||||
*/
|
||||
qint32 numInOutList;
|
||||
/**
|
||||
* @brief paper
|
||||
* @brief paper pointer to paper item.
|
||||
*/
|
||||
QGraphicsRectItem* paper;
|
||||
signals:
|
||||
/**
|
||||
* @brief itemOut сигнал виходу за межі листа. Посилається у будь-якому випадку.
|
||||
* @param numInOutList номер деталі яка вийшла за межі листа або тепер знаходиться в межах листа.
|
||||
* @param flag був вихід чи ні.
|
||||
* @brief itemOut emit if detail moved out paper. Detail send this signal each time when was moved.
|
||||
* @param numInOutList index in list.
|
||||
* @param flag true if moved out. false if not.
|
||||
*/
|
||||
void itemOut ( int numInOutList, bool flag );
|
||||
/**
|
||||
* @brief itemColliding сигнал колізії деталі з іншими. Посилається як для додавання деталі до
|
||||
*списку тих що перетинаються, так і для виключення його з такого.
|
||||
* @param list список усіх деталей які приймають участь в колізії включаючи самого себе.
|
||||
* @param number 1 - перетин є, 0 - перетину немає.
|
||||
* @brief itemColliding emit if change create colission.
|
||||
* @param list list with all colission detalis.
|
||||
* @param number 1 - colission exist, 0 - colission doesn't exist.
|
||||
*/
|
||||
void itemColliding ( QList<QGraphicsItem *> list, int number );
|
||||
};
|
||||
|
|
|
@ -33,49 +33,57 @@
|
|||
#include "../options.h"
|
||||
|
||||
/**
|
||||
* @brief The VMainGraphicsScene class
|
||||
* @brief The VMainGraphicsScene class main scene.
|
||||
*/
|
||||
class VMainGraphicsScene : public QGraphicsScene
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
/**
|
||||
* @brief VMainGraphicsScene
|
||||
* @brief VMainGraphicsScene default constructor.
|
||||
*/
|
||||
VMainGraphicsScene();
|
||||
/**
|
||||
* @brief VMainGraphicsScene
|
||||
* @param sceneRect
|
||||
* @param parent
|
||||
* @brief VMainGraphicsScene constructor.
|
||||
* @param sceneRect scene rect.
|
||||
* @param parent parent object.
|
||||
*/
|
||||
VMainGraphicsScene(const QRectF & sceneRect, QObject * parent = 0);
|
||||
/**
|
||||
* @brief getHorScrollBar
|
||||
* @return
|
||||
* @brief getHorScrollBar return scene horizontal scrollbar.
|
||||
* @return horizontal scrollbar.
|
||||
*/
|
||||
inline qint32 getHorScrollBar() const {return horScrollBar;}
|
||||
/**
|
||||
* @brief setHorScrollBar
|
||||
* @param value
|
||||
* @brief setHorScrollBar set scene horizontal scrollbar.
|
||||
* @param value horizontal scrollbar.
|
||||
*/
|
||||
inline void setHorScrollBar(const qint32 &value) {horScrollBar = value;}
|
||||
/**
|
||||
* @brief getVerScrollBar
|
||||
* @return
|
||||
* @brief getVerScrollBar return scene vertical scrollbar.
|
||||
* @return vertical scrollbar.
|
||||
*/
|
||||
inline qint32 getVerScrollBar() const {return verScrollBar;}
|
||||
/**
|
||||
* @brief setVerScrollBar
|
||||
* @param value
|
||||
* @brief setVerScrollBar set scene vertical scrollbar.
|
||||
* @param value vertical scrollbar.
|
||||
*/
|
||||
inline void setVerScrollBar(const qint32 &value) {verScrollBar = value;}
|
||||
/**
|
||||
* @brief transform return view transformation.
|
||||
* @return view transformation.
|
||||
*/
|
||||
QTransform transform() const;
|
||||
/**
|
||||
* @brief setTransform set view transformation.
|
||||
* @param transform view transformation.
|
||||
*/
|
||||
void setTransform(const QTransform &transform);
|
||||
public slots:
|
||||
/**
|
||||
* @brief ChoosedItem
|
||||
* @param id
|
||||
* @param type
|
||||
* @brief ChoosedItem emit ChoosedObject signal.
|
||||
* @param id object id.
|
||||
* @param type object scene type.
|
||||
*/
|
||||
void ChoosedItem(qint64 id, const Scene::Scenes &type);
|
||||
/**
|
||||
|
@ -85,50 +93,53 @@ public slots:
|
|||
void SetFactor(qreal factor);
|
||||
protected:
|
||||
/**
|
||||
* @brief mouseMoveEvent
|
||||
* @param event
|
||||
* @brief mouseMoveEvent handle mouse move events.
|
||||
* @param event mouse move event.
|
||||
*/
|
||||
void mouseMoveEvent(QGraphicsSceneMouseEvent* event);
|
||||
/**
|
||||
* @brief mousePressEvent
|
||||
* @param event
|
||||
* @brief mousePressEvent mouse press events.
|
||||
* @param event mouse press event
|
||||
*/
|
||||
void mousePressEvent(QGraphicsSceneMouseEvent *event);
|
||||
signals:
|
||||
/**
|
||||
* @brief mouseMove
|
||||
* @param scenePos
|
||||
* @brief mouseMove send new mouse position.
|
||||
* @param scenePos new mouse position.
|
||||
*/
|
||||
void mouseMove(QPointF scenePos);
|
||||
/**
|
||||
* @brief mousePress
|
||||
* @param scenePos
|
||||
* @brief mousePress send new mouse press position.
|
||||
* @param scenePos new mouse press position.
|
||||
*/
|
||||
void mousePress(QPointF scenePos);
|
||||
/**
|
||||
* @brief ChoosedObject
|
||||
* @param id
|
||||
* @param type
|
||||
* @brief ChoosedObject send option choosed object.
|
||||
* @param id object id.
|
||||
* @param type object scene type.
|
||||
*/
|
||||
void ChoosedObject(qint64 id, Scene::Scenes type);
|
||||
/**
|
||||
* @brief NewFactor
|
||||
* @brief NewFactor send new scale factor.
|
||||
* @param factor scene scale factor.
|
||||
*/
|
||||
void NewFactor(qreal factor);
|
||||
private:
|
||||
/**
|
||||
* @brief horScrollBar
|
||||
* @brief horScrollBar value horizontal scroll bar.
|
||||
*/
|
||||
qint32 horScrollBar;
|
||||
/**
|
||||
* @brief verScrollBar
|
||||
* @brief verScrollBar value vertical scroll bar.
|
||||
*/
|
||||
qint32 verScrollBar;
|
||||
/**
|
||||
* @brief scaleFactor
|
||||
* @brief scaleFactor scale factor.
|
||||
*/
|
||||
qreal scaleFactor;
|
||||
/**
|
||||
* @brief _transform view transform value.
|
||||
*/
|
||||
QTransform _transform;
|
||||
};
|
||||
|
||||
|
|
|
@ -32,29 +32,33 @@
|
|||
#include <QGraphicsView>
|
||||
|
||||
/**
|
||||
* @brief The VMainGraphicsView class
|
||||
* @brief The VMainGraphicsView class main scene view.
|
||||
*/
|
||||
class VMainGraphicsView : public QGraphicsView
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
/**
|
||||
* @brief VMainGraphicsView
|
||||
* @param parent
|
||||
* @brief VMainGraphicsView constructor.
|
||||
* @param parent parent object.
|
||||
*/
|
||||
explicit VMainGraphicsView(QWidget *parent = 0);
|
||||
signals:
|
||||
/**
|
||||
* @brief NewFactor
|
||||
* @brief NewFactor send new scale factor.
|
||||
* @param factor scene scale factor.
|
||||
*/
|
||||
void NewFactor(qreal factor);
|
||||
public slots:
|
||||
/**
|
||||
* @brief scalingTime
|
||||
* @brief scalingTime call each time when need handle scaling.
|
||||
* @param x
|
||||
*/
|
||||
void scalingTime(qreal x);
|
||||
/**
|
||||
* @brief scrollingTime call each time when need handle scrolling.
|
||||
* @param x
|
||||
*/
|
||||
void scrollingTime(qreal x);
|
||||
/**
|
||||
* @brief animFinished
|
||||
|
@ -62,23 +66,23 @@ public slots:
|
|||
void animFinished();
|
||||
protected:
|
||||
/**
|
||||
* @brief wheelEvent обробник повороту колеса мишки.
|
||||
* @param event передається подія.
|
||||
* @brief wheelEvent handle wheel events.
|
||||
* @param event wheel event.
|
||||
*/
|
||||
void wheelEvent ( QWheelEvent * event );
|
||||
/**
|
||||
* @brief mousePressEvent
|
||||
* @param mousePress
|
||||
* @brief mousePressEvent handle mouse press events.
|
||||
* @param mousePress mouse press event.
|
||||
*/
|
||||
void mousePressEvent(QMouseEvent *mousePress);
|
||||
/**
|
||||
* @brief mouseReleaseEvent handle mouse release events.
|
||||
* @param event
|
||||
* @param event mouse release event.
|
||||
*/
|
||||
void mouseReleaseEvent(QMouseEvent *event);
|
||||
private:
|
||||
/**
|
||||
* @brief _numScheduledScalings
|
||||
* @brief _numScheduledScalings keep number scheduled scalings.
|
||||
*/
|
||||
qint32 _numScheduledScalings;
|
||||
};
|
||||
|
|
|
@ -34,52 +34,62 @@
|
|||
namespace SimpleArc
|
||||
{
|
||||
/**
|
||||
* @brief The Translation enum
|
||||
* @brief The Translation enum position point.
|
||||
*/
|
||||
enum Translation { FirstPoint, ForthPoint };
|
||||
Q_DECLARE_FLAGS(Translations, Translation)
|
||||
}
|
||||
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
|
||||
{
|
||||
Q_OBJECT
|
||||
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);
|
||||
signals:
|
||||
/**
|
||||
* @brief Choosed
|
||||
* @param id
|
||||
* @brief Choosed send id when clicked.
|
||||
* @param id arc id.
|
||||
*/
|
||||
void Choosed(qint64 id);
|
||||
protected:
|
||||
/**
|
||||
* @brief mouseReleaseEvent handle mouse release events.
|
||||
* @param event
|
||||
* @param event mouse release event.
|
||||
*/
|
||||
virtual void mouseReleaseEvent ( QGraphicsSceneMouseEvent * event );
|
||||
/**
|
||||
* @brief hoverMoveEvent handle hover move events.
|
||||
* @param event
|
||||
* @param event hover move event.
|
||||
*/
|
||||
virtual void hoverMoveEvent ( QGraphicsSceneHoverEvent * event );
|
||||
/**
|
||||
* @brief hoverLeaveEvent handle hover leave events.
|
||||
* @param event
|
||||
* @param event hover leave event.
|
||||
*/
|
||||
virtual void hoverLeaveEvent ( QGraphicsSceneHoverEvent * event );
|
||||
private:
|
||||
Q_DISABLE_COPY(VSimpleArc)
|
||||
/**
|
||||
* @brief id
|
||||
* @brief id arc id.
|
||||
*/
|
||||
qint64 id;
|
||||
/**
|
||||
* @brief factor
|
||||
* @brief factor scale factor.
|
||||
*/
|
||||
qreal *factor;
|
||||
/**
|
||||
* @brief currentColor
|
||||
* @brief currentColor current color.
|
||||
*/
|
||||
Qt::GlobalColor *currentColor;
|
||||
};
|
||||
|
|
|
@ -34,7 +34,7 @@
|
|||
namespace SimpleSpline
|
||||
{
|
||||
/**
|
||||
* @brief The Translation enum
|
||||
* @brief The Translation enum position point.
|
||||
*/
|
||||
enum Translation { FirstPoint, ForthPoint };
|
||||
Q_DECLARE_FLAGS(Translations, Translation)
|
||||
|
@ -42,54 +42,54 @@ namespace SimpleSpline
|
|||
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
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
/**
|
||||
* @brief VSimpleSpline
|
||||
* @param id
|
||||
* @brief VSimpleSpline constructor.
|
||||
* @param id spline id.
|
||||
* @param factor scene scale factor.
|
||||
* @param currentColor
|
||||
* @param parent
|
||||
* @param currentColor current color.
|
||||
* @param parent parent object.
|
||||
*/
|
||||
VSimpleSpline(qint64 id, Qt::GlobalColor *currentColor, qreal *factor = 0, QObject *parent = 0);
|
||||
signals:
|
||||
/**
|
||||
* @brief Choosed
|
||||
* @param id
|
||||
* @brief Choosed send id when clicked.
|
||||
* @param id spline id.
|
||||
*/
|
||||
void Choosed(qint64 id);
|
||||
protected:
|
||||
/**
|
||||
* @brief mouseReleaseEvent handle mouse release events.
|
||||
* @param event
|
||||
* @param event mouse release event.
|
||||
*/
|
||||
virtual void mouseReleaseEvent ( QGraphicsSceneMouseEvent * event );
|
||||
/**
|
||||
* @brief hoverMoveEvent handle hover move events.
|
||||
* @param event
|
||||
* @param event hover move event.
|
||||
*/
|
||||
virtual void hoverMoveEvent ( QGraphicsSceneHoverEvent * event );
|
||||
/**
|
||||
* @brief hoverLeaveEvent handle hover leave events.
|
||||
* @param event
|
||||
* @param event hover leave event.
|
||||
*/
|
||||
virtual void hoverLeaveEvent ( QGraphicsSceneHoverEvent * event );
|
||||
private:
|
||||
Q_DISABLE_COPY(VSimpleSpline)
|
||||
/**
|
||||
* @brief id
|
||||
* @brief id spline id.
|
||||
*/
|
||||
qint64 id;
|
||||
/**
|
||||
* @brief factor
|
||||
* @brief factor scale factor.
|
||||
*/
|
||||
qreal *factor;
|
||||
/**
|
||||
* @brief currentColor
|
||||
* @brief currentColor current color.
|
||||
*/
|
||||
Qt::GlobalColor *currentColor;
|
||||
};
|
||||
|
|
|
@ -32,29 +32,43 @@
|
|||
#include <QGraphicsPathItem>
|
||||
#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
|
||||
{
|
||||
Q_OBJECT
|
||||
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);
|
||||
protected:
|
||||
/**
|
||||
* @brief mouseReleaseEvent handle mouse release events.
|
||||
* @param event
|
||||
* @param event mouse release event.
|
||||
*/
|
||||
virtual void mouseReleaseEvent ( QGraphicsSceneMouseEvent * event );
|
||||
/**
|
||||
* @brief hoverMoveEvent handle hover move events.
|
||||
* @param event
|
||||
* @param event hover move event.
|
||||
*/
|
||||
virtual void hoverMoveEvent ( QGraphicsSceneHoverEvent * event );
|
||||
/**
|
||||
* @brief hoverLeaveEvent handle hover leave events.
|
||||
* @param event
|
||||
* @param event hover leave event.
|
||||
*/
|
||||
virtual void hoverLeaveEvent ( QGraphicsSceneHoverEvent * event );
|
||||
private:
|
||||
Q_DISABLE_COPY(VSimpleSplinePath)
|
||||
/**
|
||||
* @brief factor scale factor.
|
||||
*/
|
||||
qreal *factor;
|
||||
};
|
||||
|
||||
|
|
|
@ -32,72 +32,72 @@
|
|||
#include <QGraphicsView>
|
||||
|
||||
/**
|
||||
* @brief The VTableGraphicsView class
|
||||
* @brief The VTableGraphicsView class table layout view.
|
||||
*/
|
||||
class VTableGraphicsView : public QGraphicsView
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
/**
|
||||
* @brief The typeMove_e enum
|
||||
* @brief The typeMove_e enum type items moves.
|
||||
*/
|
||||
enum typeMove_e { Left, Right, Up, Down };
|
||||
VTableGraphicsView(QGraphicsScene* pScene, QWidget *parent = 0);
|
||||
signals:
|
||||
/**
|
||||
* @brief itemChect Сигнал, що посилається коли змінюється стан вибору деталі.
|
||||
* @param flag Зберігає стан вибору деталі: false - знайдено, true - не знайдено.
|
||||
* @brief itemChect emit after change selection state detail.
|
||||
* @param flag false - selected, true - don't selected.
|
||||
*/
|
||||
void itemChect( bool flag );
|
||||
public slots:
|
||||
/**
|
||||
* @brief selectionChanged Слот виконується при зміні стану вибору деталей.
|
||||
* @brief selectionChanged handle selection change.
|
||||
*/
|
||||
void selectionChanged();
|
||||
/**
|
||||
* @brief rotateItems слот, який виконується при натисненні кнопки повороту деталі.
|
||||
* @brief rotateItems handle rotatation detail.
|
||||
*/
|
||||
inline void rotateItems() {rotateIt();}
|
||||
/**
|
||||
* @brief MirrorItem дзеркалить об'єкт відносно вертикальної вісі семетрії об'єкта.
|
||||
* @brief MirrorItem mirror detail.
|
||||
*/
|
||||
void MirrorItem();
|
||||
/**
|
||||
* @brief ZoomIn збільшує масштаб листа.
|
||||
* @brief ZoomIn zoom in paper scale.
|
||||
*/
|
||||
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);}
|
||||
protected:
|
||||
/**
|
||||
* @brief wheelEvent обробник повороту колеса мишки.
|
||||
* @param event передається подія.
|
||||
* @brief wheelEvent handle wheel events.
|
||||
* @param event wheel event.
|
||||
*/
|
||||
void wheelEvent ( QWheelEvent * event );
|
||||
/**
|
||||
* @brief mousePressEvent обробник натиснення кнопки миші.
|
||||
* @param mousePress передається подія.
|
||||
* @brief mousePressEvent handle mouse press events.
|
||||
* @param mousePress mouse press event.
|
||||
*/
|
||||
void mousePressEvent(QMouseEvent *mousePress);
|
||||
/**
|
||||
* @brief mouseReleaseEvent handle mouse release events. обробник відпускання кнопки миші.
|
||||
* @param event передається подія
|
||||
* @brief mouseReleaseEvent handle mouse release events.
|
||||
* @param event mouse release event.
|
||||
*/
|
||||
void mouseReleaseEvent ( QMouseEvent * event );
|
||||
/**
|
||||
* @brief keyPressEvent обробник натиснення клавіші.
|
||||
* @param event передається подія.
|
||||
* @brief keyPressEvent handle key press events.
|
||||
* @param event key press event.
|
||||
*/
|
||||
void keyPressEvent ( QKeyEvent * event );
|
||||
/**
|
||||
* @brief rotateIt виконує поворот вибраних деталей на 180 градусів.
|
||||
* @brief rotateIt rotate selected details on 180 degree.
|
||||
*/
|
||||
void rotateIt();
|
||||
/**
|
||||
* @brief MoveItem переміщує виділені об'єкти сцени.
|
||||
* @param move напрямок переміщення.
|
||||
* @brief MoveItem move selected detail.
|
||||
* @param move type of move.
|
||||
*/
|
||||
void MoveItem( VTableGraphicsView::typeMove_e move );
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user