Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Graphics
digiKam
Commits
34ac47af
Commit
34ac47af
authored
Jun 15, 2021
by
Anjani Kumar
Browse files
Add QT_VERSION checks for QWheelEvent
parent
b4d1e739
Changes
5
Hide whitespace changes
Inline
Side-by-side
core/dplugins/generic/view/glviewer/glviewerwidget.cpp
View file @
34ac47af
...
...
@@ -721,7 +721,15 @@ void GLViewerWidget::wheelEvent(QWheelEvent* e)
case
GLViewerWidget
::
Private
::
zoomImage
:
{
setCursor
(
d
->
zoomCursor
);
#if (QT_VERSION >= QT_VERSION_CHECK(5, 14, 0))
zoom
(
e
->
angleDelta
().
y
(),
e
->
position
().
toPoint
(),
d
->
zoomfactor_scrollwheel
);
#else
zoom
(
e
->
angleDelta
().
y
(),
e
->
pos
(),
d
->
zoomfactor_scrollwheel
);
#endif
break
;
}
...
...
core/libs/widgets/graphicsview/graphicsdimgview.cpp
View file @
34ac47af
...
...
@@ -397,14 +397,23 @@ void GraphicsDImgView::wheelEvent(QWheelEvent* e)
else
if
(
e
->
modifiers
()
&
Qt
::
ControlModifier
)
{
// When zooming with the mouse-wheel, the image center is kept fixed.
QPoint
point
;
#if (QT_VERSION >= QT_VERSION_CHECK(5, 14, 0))
point
=
e
->
position
().
toPoint
();
#else
point
=
e
->
pos
();
#endif
if
(
e
->
angleDelta
().
y
()
<
0
)
{
d
->
layout
->
decreaseZoom
(
e
->
position
().
toPoint
()
);
d
->
layout
->
decreaseZoom
(
point
);
}
else
if
(
e
->
angleDelta
().
y
()
>
0
)
{
d
->
layout
->
increaseZoom
(
e
->
position
().
toPoint
()
);
d
->
layout
->
increaseZoom
(
point
);
}
return
;
...
...
core/libs/widgets/itemview/itemviewcategorized.cpp
View file @
34ac47af
...
...
@@ -939,9 +939,16 @@ void ItemViewCategorized::wheelEvent(QWheelEvent* event)
if
(
verticalScrollBarPolicy
()
==
Qt
::
ScrollBarAlwaysOff
&&
event
->
angleDelta
().
y
()
!=
0
)
{
#if (QT_VERSION >= QT_VERSION_CHECK(5, 12, 0))
QWheelEvent
n
(
event
->
position
(),
event
->
globalPosition
(),
event
->
pixelDelta
(),
event
->
angleDelta
(),
event
->
buttons
(),
event
->
modifiers
(),
event
->
phase
(),
event
->
inverted
(),
event
->
source
());
#else
QWheelEvent
n
(
event
->
pos
(),
event
->
globalPos
(),
event
->
angleDelta
().
y
(),
event
->
buttons
(),
event
->
modifiers
(),
Qt
::
Horizontal
);
#endif
QApplication
::
sendEvent
(
horizontalScrollBar
(),
&
n
);
event
->
setAccepted
(
n
.
isAccepted
());
}
...
...
core/utilities/fuzzysearch/sketchwidget.cpp
View file @
34ac47af
...
...
@@ -559,7 +559,21 @@ void SketchWidget::mouseMoveEvent(QMouseEvent* e)
void
SketchWidget
::
wheelEvent
(
QWheelEvent
*
e
)
{
if
(
rect
().
contains
(
e
->
position
().
toPoint
().
x
(),
e
->
position
().
toPoint
().
y
()))
int
x
,
y
;
#if (QT_VERSION >= QT_VERSION_CHECK(5, 14, 0))
x
=
e
->
position
().
toPoint
().
x
();
y
=
e
->
position
().
toPoint
().
y
();
#else
x
=
e
->
x
();
y
=
e
->
y
();
#endif
if
(
rect
().
contains
(
x
,
y
))
{
int
size
=
d
->
penWidth
;
int
decr
=
(
e
->
modifiers
()
&
Qt
::
SHIFT
)
?
1
:
10
;
...
...
core/utilities/setup/collections/dwitemdelegatepool.cpp
View file @
34ac47af
...
...
@@ -228,9 +228,19 @@ bool DWItemDelegateEventListener::eventFilter(QObject* watched, QEvent* event)
case
QEvent
::
Wheel
:
{
QWheelEvent
*
const
wheelEvent
=
static_cast
<
QWheelEvent
*>
(
event
);
#if (QT_VERSION >= QT_VERSION_CHECK(5, 12, 0))
QWheelEvent
evt
(
wheelEvent
->
position
(),
wheelEvent
->
globalPosition
(),
wheelEvent
->
pixelDelta
(),
wheelEvent
->
angleDelta
(),
wheelEvent
->
buttons
(),
wheelEvent
->
modifiers
(),
wheelEvent
->
phase
(),
wheelEvent
->
inverted
(),
wheelEvent
->
source
());
#else
QWheelEvent
evt
(
viewport
->
mapFromGlobal
(
wheelEvent
->
globalPos
()),
wheelEvent
->
angleDelta
().
y
(),
wheelEvent
->
buttons
(),
wheelEvent
->
modifiers
(),
wheelEvent
->
orientation
());
#endif
QApplication
::
sendEvent
(
viewport
,
&
evt
);
break
;
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment