Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
VLC
Manage
Activity
Members
Labels
Plan
Issues
4k
Issue boards
Milestones
Code
Merge requests
434
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Analyze
Contributor analytics
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
VideoLAN
VLC
Commits
1f9699c6
Commit
1f9699c6
authored
2 years ago
by
Benjamin Arnaud
Committed by
Hugo Beauzée-Luyssen
2 years ago
Browse files
Options
Downloads
Patches
Plain Diff
qt/QmlMenuPositioner: Fix the QMenu positioning
parent
7ebb2d48
No related branches found
No related tags found
1 merge request
!1884
qt/QmlMenuPositioner: Fix the QMenu positioning
Pipeline
#220442
passed with stage
in 24 minutes and 7 seconds
Changes
1
Pipelines
2
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
modules/gui/qt/menus/qml_menu_wrapper.cpp
+21
-3
21 additions, 3 deletions
modules/gui/qt/menus/qml_menu_wrapper.cpp
with
21 additions
and
3 deletions
modules/gui/qt/menus/qml_menu_wrapper.cpp
+
21
−
3
View file @
1f9699c6
...
...
@@ -35,7 +35,9 @@
#include
"playlist/playlist_model.hpp"
#include
"dialogs/dialogs_provider.hpp"
// Qt includes
#include
<QSignalMapper>
#include
<QScreen>
namespace
{
...
...
@@ -386,12 +388,28 @@ bool QmlMenuPositioner::eventFilter(QObject * object, QEvent * event)
{
if
(
event
->
type
()
==
QEvent
::
Resize
)
{
QScreen
*
screen
=
QGuiApplication
::
screenAt
(
m_position
);
if
(
screen
==
nullptr
)
return
QObject
::
eventFilter
(
object
,
event
);
QMenu
*
menu
=
static_cast
<
QMenu
*>
(
object
);
int
x
=
m_position
.
x
();
int
y
=
m_position
.
y
();
int
width
=
menu
->
width
();
int
height
=
menu
->
height
();
QRect
geometry
=
screen
->
availableGeometry
();
int
x
=
geometry
.
x
();
int
y
=
geometry
.
y
();
// NOTE: We want a position within the screen boundaries.
x
=
qBound
(
x
,
m_position
.
x
(),
x
+
geometry
.
width
()
-
width
);
y
=
qBound
(
y
,
m_position
.
y
()
-
height
,
y
+
geometry
.
height
()
-
height
);
menu
->
move
(
QPoint
(
x
,
y
-
menu
->
height
()
));
menu
->
move
(
QPoint
(
x
,
y
));
}
return
QObject
::
eventFilter
(
object
,
event
);
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment