mirror of
https://gitlab.com/pholy/OSCAR-code.git
synced 2025-04-19 04:00:45 +00:00
keyboard left/right control when graphs focused
This commit is contained in:
parent
3aac219aad
commit
e72980de11
@ -32,6 +32,7 @@ gGraphWindow::gGraphWindow(QWidget *parent, const QString & title, QGLWidget * s
|
|||||||
}
|
}
|
||||||
//setAcceptDrops(true);
|
//setAcceptDrops(true);
|
||||||
setMouseTracking(true);
|
setMouseTracking(true);
|
||||||
|
setFocusPolicy(Qt::StrongFocus);
|
||||||
}
|
}
|
||||||
|
|
||||||
gGraphWindow::gGraphWindow(QWidget *parent, const QString & title, QGLContext * context,Qt::WindowFlags f)
|
gGraphWindow::gGraphWindow(QWidget *parent, const QString & title, QGLContext * context,Qt::WindowFlags f)
|
||||||
@ -57,6 +58,7 @@ gGraphWindow::gGraphWindow(QWidget *parent, const QString & title, QGLContext *
|
|||||||
}
|
}
|
||||||
//setAcceptDrops(true);
|
//setAcceptDrops(true);
|
||||||
setMouseTracking(true);
|
setMouseTracking(true);
|
||||||
|
setFocusPolicy(Qt::StrongFocus);
|
||||||
}
|
}
|
||||||
|
|
||||||
gGraphWindow::~gGraphWindow()
|
gGraphWindow::~gGraphWindow()
|
||||||
@ -360,6 +362,30 @@ void gGraphWindow::mouseReleaseEvent(QMouseEvent * event)
|
|||||||
OnMouseRightRelease(event);
|
OnMouseRightRelease(event);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
void gGraphWindow::keyPressEvent(QKeyEvent * event)
|
||||||
|
{
|
||||||
|
bool moved=false;
|
||||||
|
if (event->key()==Qt::Key_Left) {
|
||||||
|
MoveX(40);
|
||||||
|
moved=true;
|
||||||
|
} else if (event->key()==Qt::Key_Right) {
|
||||||
|
MoveX(-40);
|
||||||
|
moved=true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (moved) {
|
||||||
|
double min=MinX();
|
||||||
|
double max=MaxX();
|
||||||
|
if (pref["LinkGraphMovement"].toBool()) {
|
||||||
|
for (list<gGraphWindow *>::iterator g=link_zoom.begin();g!=link_zoom.end();g++) {
|
||||||
|
(*g)->SetXBounds(min,max);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
event->accept();
|
||||||
|
} else {
|
||||||
|
event->ignore();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void gGraphWindow::OnMouseRightDown(QMouseEvent * event)
|
void gGraphWindow::OnMouseRightDown(QMouseEvent * event)
|
||||||
{
|
{
|
||||||
|
@ -44,6 +44,7 @@ public:
|
|||||||
virtual void mousePressEvent(QMouseEvent * event);
|
virtual void mousePressEvent(QMouseEvent * event);
|
||||||
virtual void mouseReleaseEvent(QMouseEvent * event);
|
virtual void mouseReleaseEvent(QMouseEvent * event);
|
||||||
virtual void mouseDoubleClickEvent(QMouseEvent * event);
|
virtual void mouseDoubleClickEvent(QMouseEvent * event);
|
||||||
|
virtual void keyPressEvent(QKeyEvent * event);
|
||||||
//virtual void OnMouseRightDClick(wxMouseEvent * event);
|
//virtual void OnMouseRightDClick(wxMouseEvent * event);
|
||||||
virtual void OnMouseLeftDown(QMouseEvent * event);
|
virtual void OnMouseLeftDown(QMouseEvent * event);
|
||||||
virtual void OnMouseLeftRelease (QMouseEvent * event);
|
virtual void OnMouseLeftRelease (QMouseEvent * event);
|
||||||
|
Loading…
Reference in New Issue
Block a user