summaryrefslogtreecommitdiffstats
path: root/src/client/toolbar/toolbar.cpp
diff options
context:
space:
mode:
authorSimon Rettberg2018-09-04 14:11:02 +0200
committerSimon Rettberg2018-09-04 14:11:02 +0200
commit94d1072b455f88c858e8e5c592d133c33728440e (patch)
treecb41b76c37f112e543bf6a2017154bf783f04f9a /src/client/toolbar/toolbar.cpp
parent[server] Pimp help window (diff)
downloadpvs2-94d1072b455f88c858e8e5c592d133c33728440e.tar.gz
pvs2-94d1072b455f88c858e8e5c592d133c33728440e.tar.xz
pvs2-94d1072b455f88c858e8e5c592d133c33728440e.zip
[client] Make toolbar movable by mouse
Diffstat (limited to 'src/client/toolbar/toolbar.cpp')
-rw-r--r--src/client/toolbar/toolbar.cpp13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/client/toolbar/toolbar.cpp b/src/client/toolbar/toolbar.cpp
index a3e2c31..af885fd 100644
--- a/src/client/toolbar/toolbar.cpp
+++ b/src/client/toolbar/toolbar.cpp
@@ -240,6 +240,19 @@ void Toolbar::enterEvent(QEvent* e)
QWidget::enterEvent(e);
}
+void Toolbar::mousePressEvent(QMouseEvent* e)
+{
+ _lastDragPos = e->globalPos();
+}
+
+void Toolbar::mouseMoveEvent(QMouseEvent* e)
+{
+ const QPoint currentPos = e->globalPos();
+ const QPoint offset = currentPos - _lastDragPos;
+ _lastDragPos = currentPos;
+ move(x() + offset.x(), y());
+}
+
/*
* CFG to test this
* http://git.openslx.org/tm-scripts.git/plain/server/modules/pvs2-freiburg/etc/xdg/openslx/pvs2client.ini