Stopped graph reorder below empty spacer widget

This commit is contained in:
Mark Watkins 2011-07-28 22:44:53 +10:00
parent 3df94fffcd
commit 5a8c4baf38

View File

@ -296,7 +296,9 @@ void gGraphWindow::mouseMoveEvent(QMouseEvent * event)
if (event->y()>m_scrY) { if (event->y()>m_scrY) {
//qDebug() << "Swap Down"; //qDebug() << "Swap Down";
int i=splitter->indexOf(this); int i=splitter->indexOf(this);
splitter->insertWidget(i+1,this); if (i<splitter->count()-2) {
splitter->insertWidget(i+1,this);
}
} else if (event->y()<0) { } else if (event->y()<0) {
//qDebug() << "Swap up"; //qDebug() << "Swap up";
@ -343,8 +345,6 @@ void gGraphWindow::mouseMoveEvent(QMouseEvent * event)
qint64 minx=min_x; qint64 minx=min_x;
double dx=max_x-minx; // zoom rect width; double dx=max_x-minx; // zoom rect width;
// Could smarten this up by remembering where the mouse was clicked on the foobar
double gx=dx*m_foobar_pos; double gx=dx*m_foobar_pos;
qx-=gx; qx-=gx;
@ -654,12 +654,15 @@ void gGraphWindow::OnMouseLeftDown(QMouseEvent * event)
void gGraphWindow::OnMouseLeftRelease(QMouseEvent * event) void gGraphWindow::OnMouseLeftRelease(QMouseEvent * event)
{ {
if (m_dragGraph) { if (m_dragGraph) {
// Graph Reorder Magic
if (splitter && currentWidget && LastGraphLDown) { if (splitter && currentWidget && LastGraphLDown) {
if (LastGraphLDown!=currentWidget) { if (LastGraphLDown!=currentWidget) {
int newidx=splitter->indexOf(currentWidget); //int newidx=splitter->indexOf(currentWidget);
//int idx=splitter->indexOf(LastGraphLDown); //if (qobject_cast<gGraphWindow *>(splitter->widget(newidx))) {
splitter->insertWidget(newidx,LastGraphLDown); // splitter->insertWidget(newidx,LastGraphLDown);
//}
return; return;
} }
} }
m_dragGraph=false; m_dragGraph=false;
@ -739,10 +742,9 @@ void gGraphWindow::OnMouseLeftRelease(QMouseEvent * event)
//xp=0; //xp=0;
double zoom_fact=0.5; double zoom_fact=0.5;
if (event->modifiers() & Qt::ControlModifier) zoom_fact=0.25; if (event->modifiers() & Qt::ControlModifier) zoom_fact=0.25;
ZoomX(zoom_fact,xp); //event.GetX()); // adds origin to zoom in.. Doesn't look that cool. ZoomX(zoom_fact,xp);
did_draw=true; did_draw=true;
} }
//}
} }
m_drag_foobar=false; m_drag_foobar=false;
@ -760,7 +762,6 @@ void gGraphWindow::OnMouseLeftRelease(QMouseEvent * event)
} }
} }
} }
//}
LastGraphLDown=NULL; LastGraphLDown=NULL;
} }