Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc-2-2
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Redmine
Redmine
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
videolan
vlc-2-2
Commits
6b2d303b
Commit
6b2d303b
authored
Dec 05, 2012
by
Alexander Terentyev
Committed by
Jean-Baptiste Kempf
Feb 07, 2013
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Qt: Add moving main window on any part of a window
Signed-off-by:
Jean-Baptiste Kempf
<
jb@videolan.org
>
parent
59c5c14c
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
44 additions
and
0 deletions
+44
-0
modules/gui/qt4/main_interface.cpp
modules/gui/qt4/main_interface.cpp
+35
-0
modules/gui/qt4/main_interface.hpp
modules/gui/qt4/main_interface.hpp
+9
-0
No files found.
modules/gui/qt4/main_interface.cpp
View file @
6b2d303b
...
...
@@ -326,6 +326,11 @@ void MainInterface::computeMinimumSize()
setMinimumWidth
(
minWidth
);
}
inline
void
MainInterface
::
moveWindow
(
int
offsetX
,
int
offsetY
)
{
move
(
x
()
+
offsetX
,
y
()
+
offsetY
);
}
/*****************************
* Main UI handling *
*****************************/
...
...
@@ -1387,6 +1392,36 @@ bool MainInterface::eventFilter( QObject *obj, QEvent *event )
}
}
void
MainInterface
::
mousePressEvent
(
QMouseEvent
*
event
)
{
b_customMoving
=
Qt
::
LeftButton
==
event
->
button
();
lastCustomMovePos
=
event
->
globalPos
();
}
void
MainInterface
::
mouseMoveEvent
(
QMouseEvent
*
event
)
{
if
(
b_customMoving
)
{
moveWindow
(
event
->
globalX
()
-
lastCustomMovePos
.
x
(),
event
->
globalY
()
-
lastCustomMovePos
.
y
()
);
lastCustomMovePos
=
event
->
globalPos
();
}
}
void
MainInterface
::
mouseReleaseEvent
(
QMouseEvent
*
event
)
{
if
(
b_customMoving
)
{
moveWindow
(
event
->
globalX
()
-
lastCustomMovePos
.
x
(),
event
->
globalY
()
-
lastCustomMovePos
.
y
()
);
}
b_customMoving
=
false
;
}
void
MainInterface
::
toolBarConfUpdated
()
{
QApplication
::
postEvent
(
this
,
new
QEvent
(
MainInterface
::
ToolbarsNeedRebuild
)
);
...
...
modules/gui/qt4/main_interface.hpp
View file @
6b2d303b
...
...
@@ -105,6 +105,9 @@ protected:
virtual
void
keyPressEvent
(
QKeyEvent
*
);
virtual
void
wheelEvent
(
QWheelEvent
*
);
virtual
bool
eventFilter
(
QObject
*
,
QEvent
*
);
virtual
void
mousePressEvent
(
QMouseEvent
*
);
virtual
void
mouseMoveEvent
(
QMouseEvent
*
);
virtual
void
mouseReleaseEvent
(
QMouseEvent
*
);
private:
/* Main Widgets Creation */
...
...
@@ -127,6 +130,9 @@ private:
void
setInterfaceFullScreen
(
bool
);
void
computeMinimumSize
();
/* */
inline
void
moveWindow
(
int
offsetX
,
int
offsetY
);
/* */
QSettings
*
settings
;
QSystemTrayIcon
*
sysTray
;
...
...
@@ -155,6 +161,8 @@ private:
QMap
<
QWidget
*
,
QSize
>
stackWidgetsSizes
;
QPoint
lastCustomMovePos
;
/* Flags */
unsigned
i_notificationSetting
;
/// Systray Notifications
bool
b_autoresize
;
///< persistent resizable window
...
...
@@ -173,6 +181,7 @@ private:
bool
b_hasPausedWhenMinimized
;
bool
b_statusbarVisible
;
bool
b_customMoving
;
///< Is the window moving by dragging ?
#ifdef WIN32
HIMAGELIST
himl
;
...
...
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