QGIS API Documentation 3.41.0-Master (fda2aa46e9a)
Loading...
Searching...
No Matches
qgstableview.cpp
Go to the documentation of this file.
1/***************************************************************************
2 qgstableview.cpp
3 ---------------
4 begin : March 2022
5 copyright : (C) 2022 by Nyall Dawson
6 email : nyall dot dawson at gmail dot com
7 ***************************************************************************
8 * *
9 * This program is free software; you can redistribute it and/or modify *
10 * it under the terms of the GNU General Public License as published by *
11 * the Free Software Foundation; either version 2 of the License, or *
12 * (at your option) any later version. *
13 * *
14 ***************************************************************************/
15
16#include "qgstableview.h"
17#include "moc_qgstableview.cpp"
18
19#include <QWheelEvent>
20
22 : QTableView( parent )
23{
24
25}
26
27void QgsTableView::wheelEvent( QWheelEvent *event )
28{
29 if ( event->modifiers() & Qt::ShiftModifier )
30 {
31 // a wheel event with the shift modifier switches a vertical scroll to a horizontal scroll (or vice versa)
32 const QPoint invertedPixelDelta = QPoint( event->pixelDelta().y(), event->pixelDelta().x() );
33 const QPoint invertedAngleDelta = QPoint( event->angleDelta().y(), event->angleDelta().x() );
34
35 QWheelEvent axisSwappedScrollEvent( event->position(), event->position(),
36 invertedPixelDelta, invertedAngleDelta,
37 event->buttons(), event->modifiers() & ~Qt::ShiftModifier, event->phase(),
38 event->inverted(), event->source() );
39 QTableView::wheelEvent( &axisSwappedScrollEvent );
40 }
41 else
42 {
43 QTableView::wheelEvent( event );
44 }
45}
QgsTableView(QWidget *parent=nullptr)
Constructor for QgsTableView.
void wheelEvent(QWheelEvent *event) override