mirror of
https://github.com/qgis/QGIS.git
synced 2025-04-15 00:04:00 -04:00
Update cursor on alt press/release for zoom tool
This commit is contained in:
parent
7974597c08
commit
dc0425abee
@ -31,6 +31,10 @@ class QgsLayoutViewToolZoom : QgsLayoutViewTool
|
||||
|
||||
virtual void layoutReleaseEvent( QgsLayoutViewMouseEvent *event );
|
||||
|
||||
virtual void keyPressEvent( QKeyEvent *event );
|
||||
|
||||
virtual void keyReleaseEvent( QKeyEvent *event );
|
||||
|
||||
virtual void deactivate();
|
||||
|
||||
|
||||
|
@ -108,7 +108,7 @@ void QgsLayoutViewTool::activate()
|
||||
if ( mAction )
|
||||
mAction->setChecked( true );
|
||||
|
||||
mView->setCursor( mCursor );
|
||||
mView->viewport()->setCursor( mCursor );
|
||||
emit activated();
|
||||
}
|
||||
|
||||
|
@ -96,6 +96,28 @@ void QgsLayoutViewToolZoom::layoutReleaseEvent( QgsLayoutViewMouseEvent *event )
|
||||
view()->fitInView( newBoundsRect, Qt::KeepAspectRatio );
|
||||
}
|
||||
|
||||
void QgsLayoutViewToolZoom::keyPressEvent( QKeyEvent *event )
|
||||
{
|
||||
//respond to changes in the alt key status and update cursor accordingly
|
||||
if ( ! event->isAutoRepeat() )
|
||||
{
|
||||
QPixmap zoomQPixmap = QPixmap( ( const char ** )( ( event->modifiers() & Qt::AltModifier ) ? zoom_out : zoom_in ) );
|
||||
QCursor zoomCursor = QCursor( zoomQPixmap, 7, 7 );
|
||||
view()->viewport()->setCursor( zoomCursor );
|
||||
}
|
||||
}
|
||||
|
||||
void QgsLayoutViewToolZoom::keyReleaseEvent( QKeyEvent *event )
|
||||
{
|
||||
//respond to changes in the alt key status and update cursor accordingly
|
||||
if ( !event->isAutoRepeat() )
|
||||
{
|
||||
QPixmap zoomQPixmap = QPixmap( ( const char ** )( ( event->modifiers() & Qt::AltModifier ) ? zoom_out : zoom_in ) );
|
||||
QCursor zoomCursor = QCursor( zoomQPixmap, 7, 7 );
|
||||
view()->viewport()->setCursor( zoomCursor );
|
||||
}
|
||||
}
|
||||
|
||||
void QgsLayoutViewToolZoom::deactivate()
|
||||
{
|
||||
if ( mMarqueeZoom )
|
||||
|
@ -42,6 +42,8 @@ class GUI_EXPORT QgsLayoutViewToolZoom : public QgsLayoutViewTool
|
||||
void layoutPressEvent( QgsLayoutViewMouseEvent *event ) override;
|
||||
void layoutMoveEvent( QgsLayoutViewMouseEvent *event ) override;
|
||||
void layoutReleaseEvent( QgsLayoutViewMouseEvent *event ) override;
|
||||
void keyPressEvent( QKeyEvent *event ) override;
|
||||
void keyReleaseEvent( QKeyEvent *event ) override;
|
||||
void deactivate() override;
|
||||
|
||||
private:
|
||||
|
Loading…
x
Reference in New Issue
Block a user