git-svn-id: svn://db.shs.com.ru/libs@299 a8b55f48-bf90-11e4-a774-851b48703e85

This commit is contained in:
2017-10-21 15:41:12 +00:00
parent c3c0bcd1fb
commit 7a43895b07
4 changed files with 90 additions and 32 deletions

View File

@@ -30,11 +30,13 @@ class BlockView: public QGraphicsView
Q_PROPERTY(bool postMoveConnect READ isPostMoveConnectEnabled WRITE setPostMoveConnectEnabled)
Q_PROPERTY(bool connectByMouse READ isConnectByMouseEnabled WRITE setConnectByMouseEnabled)
Q_PROPERTY(bool navigationEnabled READ isNavigationEnabled WRITE setNavigationEnabled)
Q_PROPERTY(bool navigateAnimationEnabled READ isNavigateAnimationEnabled WRITE setNavigateAnimationEnabled)
Q_PROPERTY(bool traceConsiderBuses READ isTraceConsiderBuses WRITE setTraceConsiderBuses)
Q_PROPERTY(bool pinMulticonnect READ isPinMulticonnectEnabled WRITE setPinMulticonnectEnabled)
Q_PROPERTY(bool miniMap READ isMiniMapEnabled WRITE setMiniMapEnabled)
Q_PROPERTY(double _thumb READ _thumb WRITE _setThumb DESIGNABLE false SCRIPTABLE false)
Q_PROPERTY(QRectF _nav READ _nav WRITE _setNav DESIGNABLE false SCRIPTABLE false)
public:
BlockView(QWidget * parent = 0);
@@ -52,6 +54,7 @@ public:
bool isSnapToGrid() const {return grid_snap;}
bool isPostMoveConnectEnabled() const {return pm_connect;}
bool isNavigationEnabled() const {return navigation;}
bool isNavigateAnimationEnabled() const {return is_nav_anim;}
bool isConnectByMouseEnabled() const {return m_connect;}
bool isTraceConsiderBuses() const {return m_trace_with_buses;}
bool isPinMulticonnectEnabled() const {return m_pin_mc;}
@@ -77,7 +80,7 @@ protected:
void stopTimer(int & tid);
void restartTimer(int & tid, int msecs);
void timerEvent(QTimerEvent * e);
void wheelEvent(QWheelEvent * event);
void wheelEvent(QWheelEvent * e);
void mousePressEvent(QMouseEvent * event);
void mouseMoveEvent(QMouseEvent * event);
void keyPressEvent(QKeyEvent * event);
@@ -108,6 +111,8 @@ protected:
QList<BlockItem * > selectedBlocks() const;
QList<QGraphicsItem * > selectedDecors() const;
double _thumb() const {return _talpha;}
QRectF _nav() const;
void animateNav(QRectF d);
void scrollFromThumb();
void deleteCopyTemp();
void emitActionEvent(BlockItemBase::Action action, QList<QGraphicsItem * > items);
@@ -129,15 +134,16 @@ protected:
QPoint press_point, screen_point, thumb_press;
QPointF scene_point, trace_from, last_trace_from, trace_to, copy_dp;
QRect thumb_sr, thumb_vr;
QRectF nav_target;
QSizeF thumb_size;
QPen grid_pen;
SelectionMode smode;
QImage im_scene;
QWidget widget_thumb;
Qt::KeyboardModifiers mm_mods;
QPropertyAnimation thumb_anim;
int timer_thumb, thumb_hide_delay;
bool mm_drag, new_bus, new_branch, moved, mm_cancel, iconnect, mm_copy, mm_thumb, ae_enabled;
QPropertyAnimation thumb_anim, nav_anim;
int timer_thumb, thumb_hide_delay, thick;
bool mm_drag, new_bus, new_branch, moved, mm_cancel, iconnect, mm_copy, mm_thumb, ae_enabled, is_nav_anim;
bool grid_visible, grid_snap, pm_connect, navigation, m_connect, m_trace_with_buses, m_pin_mc, minimap;
double grid_step, grid_points, cur_scl, _talpha, thumb_scl;
@@ -153,6 +159,7 @@ protected slots:
void removeJunk();
void sceneSelectionChanged();
void _setThumb(double v);
void _setNav(QRectF v);
public slots:
void setGridPen(const QPen & pen) {grid_pen = pen; _updateBack();}
@@ -162,6 +169,7 @@ public slots:
void setGridPointsWidth(double width_) {grid_points = width_; _updateBack();}
void setPostMoveConnectEnabled(bool on) {pm_connect = on;}
void setNavigationEnabled(bool on) {navigation = on;}
void setNavigateAnimationEnabled(bool on) {is_nav_anim = on;}
void setConnectByMouseEnabled(bool on) {m_connect = on;}
void setTraceConsiderBuses(bool on) {m_trace_with_buses = on;}
void setPinMulticonnectEnabled(bool on) {m_pin_mc = on;}