Unselect graph when selecting from another one, switch from Control to Shift key

This commit is contained in:
Mark Watkins 2014-07-19 23:09:08 +10:00
parent 8599598607
commit 3fe43ef621
2 changed files with 20 additions and 6 deletions

View File

@ -1061,7 +1061,7 @@ void gGraph::keyReleaseEvent(QKeyEvent *event)
if (!m_graphview) return; if (!m_graphview) return;
if (m_graphview->selectionInProgress() && m_graphview->metaSelect()) { if (m_graphview->selectionInProgress() && m_graphview->metaSelect()) {
if (!(event->modifiers() & Qt::ControlModifier)) { if (!(event->modifiers() & Qt::ShiftModifier)) {
} }
} }

View File

@ -1384,11 +1384,19 @@ void gGraphView::mousePressEvent(QMouseEvent *event)
} }
{ {
if (m_metaselect) {
if (m_selected_graph) {
m_selected_graph->m_selecting_area = false;
}
}
// send event to graph.. // send event to graph..
m_point_clicked = QPoint(event->x(), event->y()); m_point_clicked = QPoint(event->x(), event->y());
//QMouseEvent e(event->type(),m_point_clicked,event->button(),event->buttons(),event->modifiers()); //QMouseEvent e(event->type(),m_point_clicked,event->button(),event->buttons(),event->modifiers());
m_button_down = true; m_button_down = true;
m_metaselect = event->modifiers() && Qt::ControlModifier; m_metaselect = event->modifiers() && Qt::ShiftModifier;
m_horiz_travel = 0; m_horiz_travel = 0;
m_graph_index = i; m_graph_index = i;
m_selected_graph = m_graphs[i]; m_selected_graph = m_graphs[i];
@ -1441,11 +1449,16 @@ void gGraphView::mousePressEvent(QMouseEvent *event)
} }
{ {
if (m_metaselect) {
if (m_selected_graph) {
m_selected_graph->m_selecting_area = false;
}
}
// send event to graph.. // send event to graph..
m_point_clicked = QPoint(event->x(), event->y()); m_point_clicked = QPoint(event->x(), event->y());
//QMouseEvent e(event->type(),m_point_clicked,event->button(),event->buttons(),event->modifiers()); //QMouseEvent e(event->type(),m_point_clicked,event->button(),event->buttons(),event->modifiers());
m_button_down = true; m_button_down = true;
m_metaselect = event->modifiers() && Qt::ControlModifier; m_metaselect = event->modifiers() && Qt::ShiftModifier;
m_horiz_travel = 0; m_horiz_travel = 0;
m_graph_index = i; m_graph_index = i;
@ -1559,7 +1572,7 @@ void gGraphView::mouseReleaseEvent(QMouseEvent *event)
// The graph that got the button press gets the release event // The graph that got the button press gets the release event
if (m_button_down) { if (m_button_down) {
m_button_down = false; m_button_down = false;
m_metaselect = event->modifiers() & Qt::ControlModifier; m_metaselect = event->modifiers() & Qt::ShiftModifier;
if (m_metaselect) { if (m_metaselect) {
m_point_released = event->pos(); m_point_released = event->pos();
@ -1571,7 +1584,7 @@ void gGraphView::mouseReleaseEvent(QMouseEvent *event)
void gGraphView::keyReleaseEvent(QKeyEvent *event) void gGraphView::keyReleaseEvent(QKeyEvent *event)
{ {
if (m_metaselect && !(event->modifiers() & Qt::ControlModifier)) { if (m_metaselect && !(event->modifiers() & Qt::ShiftModifier)) {
QMouseEvent mevent(QEvent::MouseButtonRelease, m_point_released, Qt::LeftButton, Qt::LeftButton, event->modifiers()); QMouseEvent mevent(QEvent::MouseButtonRelease, m_point_released, Qt::LeftButton, Qt::LeftButton, event->modifiers());
if (m_graph_index>=0) if (m_graph_index>=0)
m_graphs[m_graph_index]->mouseReleaseEvent(&mevent); m_graphs[m_graph_index]->mouseReleaseEvent(&mevent);
@ -1791,8 +1804,9 @@ void gGraphView::wheelEvent(QWheelEvent *event)
void gGraphView::keyPressEvent(QKeyEvent *event) void gGraphView::keyPressEvent(QKeyEvent *event)
{ {
if (m_button_down) { if (m_button_down) {
m_metaselect = event->modifiers() & Qt::ControlModifier; m_metaselect = event->modifiers() & Qt::ShiftModifier;
} }
if (event->key() == Qt::Key_Tab) { if (event->key() == Qt::Key_Tab) {
event->ignore(); event->ignore();
return; return;