Commit 9268b78d authored by Florent D'Halluin's avatar Florent D'Halluin
Browse files

[yavgui] Allow drawing of looping transitions.

Right-click, drag out of the state and back, release.

* yavgui/src/g_state.cc,
* yavgui/src/g_state.hh: Do that.
parent 92540851
2009-08-09 d-halluin <d-halluin@lrde.epita.fr>
[yavgui] Allow drawing of looping transitions.
Right-click, drag out of the state and back, release.
* yavgui/src/g_state.cc,
* yavgui/src/g_state.hh: Do that.
2009-08-09 d-halluin <d-halluin@lrde.epita.fr>
 
[yavgui] Set ZValue upon (de)selection.
......
......@@ -49,6 +49,7 @@ namespace gui
index_ (index),
selected_ (false),
drawing_transition_ (false),
drawing_transition_enable_self_ (false),
looping_transitions_ (0)
{
setCursor (QCursor (Qt::ArrowCursor));
......@@ -236,6 +237,7 @@ namespace gui
if (event->button () == Qt::RightButton)
{
drawing_transition_ = true;
drawing_transition_enable_self_ = false;
mouse_pos_ = event->pos();
update_bounding_rect_();
update();
......@@ -251,7 +253,7 @@ namespace gui
{
drawing_transition_ = false;
GState* s = dynamic_cast<GState*>(scene()->itemAt(event->scenePos()));
if (s && s != this)
if (s && (s != this || drawing_transition_enable_self_))
{
QString str;
......@@ -260,6 +262,7 @@ namespace gui
emit addTransition(s, str);
}
update();
}
QGraphicsItem::mouseReleaseEvent(event);
}
......@@ -276,6 +279,8 @@ namespace gui
{
event->ignore();
mouse_pos_ = event->pos();
if (qAbs(mouse_pos_.x()) + qAbs(mouse_pos_.y()) > radius_)
drawing_transition_enable_self_ = true;
update_bounding_rect_();
update();
return;
......
......@@ -141,6 +141,7 @@ namespace gui
// True if a transition is being drawn.
bool drawing_transition_;
bool drawing_transition_enable_self_;
QPointF mouse_pos_;
int looping_transitions_;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment