mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2026-09-27 20:44:13 +02:00
Merge pull request #1059 from ispyisail/fix/ctrl-shift-pan-stuck
Fix the folio staying in pan mode after Ctrl+Shift+M
This commit is contained in:
@@ -390,6 +390,7 @@ void DiagramView::handleTextDrop(QDropEvent *e) {
|
||||
*/
|
||||
void DiagramView::setVisualisationMode()
|
||||
{
|
||||
m_ctrl_shift_panning = false;
|
||||
setDragMode(ScrollHandDrag);
|
||||
applyReadOnly();
|
||||
setInteractive(false);
|
||||
@@ -401,6 +402,7 @@ void DiagramView::setVisualisationMode()
|
||||
*/
|
||||
void DiagramView::setSelectionMode()
|
||||
{
|
||||
m_ctrl_shift_panning = false;
|
||||
setDragMode(RubberBandDrag);
|
||||
setInteractive(true);
|
||||
applyReadOnly();
|
||||
@@ -631,6 +633,12 @@ void DiagramView::mousePressEvent(QMouseEvent *e)
|
||||
{
|
||||
e->ignore();
|
||||
|
||||
//Ctrl+Shift panning whose key release was missed (see
|
||||
//focusOutEvent()): a click without them ends it
|
||||
if (m_ctrl_shift_panning && !isCtrlShifting(e)) {
|
||||
setSelectionMode();
|
||||
}
|
||||
|
||||
if (m_fresh_focus_in)
|
||||
{
|
||||
switchToVisualisationModeIfNeeded(e);
|
||||
@@ -1031,6 +1039,23 @@ void DiagramView::focusInEvent(QFocusEvent *e) {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@brief DiagramView::focusOutEvent
|
||||
Leave the Ctrl+Shift panning: without the focus, the view will not see
|
||||
Ctrl or Shift being released, which is what normally ends it. A
|
||||
Ctrl+Shift shortcut that opens a window (Ctrl+Shift+M, the command
|
||||
search) left the view panning, ignoring clicks on the folio, on Windows,
|
||||
where no other key release reached the view to end it.
|
||||
@param e
|
||||
*/
|
||||
void DiagramView::focusOutEvent(QFocusEvent *e)
|
||||
{
|
||||
if (m_ctrl_shift_panning) {
|
||||
setSelectionMode();
|
||||
}
|
||||
PaletteGraphicsView::focusOutEvent(e);
|
||||
}
|
||||
|
||||
/**
|
||||
@brief DiagramView::focusNextPrevChild
|
||||
By default, QWidget intercepts Tab/Shift+Tab to move keyboard focus to
|
||||
@@ -1638,6 +1663,7 @@ bool DiagramView::switchToVisualisationModeIfNeeded(QInputEvent *e) {
|
||||
if (isCtrlShifting(e) && !selectedItemHasFocus()) {
|
||||
if (dragMode() != QGraphicsView::ScrollHandDrag) {
|
||||
setVisualisationMode();
|
||||
m_ctrl_shift_panning = true;
|
||||
return(true);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -76,6 +76,9 @@ class DiagramView : public PaletteGraphicsView
|
||||
QPointF m_drag_last_pos;
|
||||
bool m_fresh_focus_in,
|
||||
m_first_activation = true;
|
||||
/// True while the view pans because Ctrl+Shift is held, as opposed
|
||||
/// to the visualisation mode chosen from the toolbar.
|
||||
bool m_ctrl_shift_panning = false;
|
||||
QList<QAction *> m_separators;
|
||||
QPolygonF m_free_rubberband;
|
||||
bool m_free_rubberbanding = false;
|
||||
@@ -113,6 +116,7 @@ class DiagramView : public PaletteGraphicsView
|
||||
void contextMenuEvent(QContextMenuEvent *) override;
|
||||
void wheelEvent(QWheelEvent *) override;
|
||||
void focusInEvent(QFocusEvent *) override;
|
||||
void focusOutEvent(QFocusEvent *) override;
|
||||
void keyPressEvent(QKeyEvent *) override;
|
||||
void keyReleaseEvent(QKeyEvent *) override;
|
||||
bool event(QEvent *) override;
|
||||
|
||||
Reference in New Issue
Block a user