summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSimon Rettberg2018-09-04 14:11:02 +0200
committerSimon Rettberg2018-09-04 14:11:02 +0200
commit94d1072b455f88c858e8e5c592d133c33728440e (patch)
treecb41b76c37f112e543bf6a2017154bf783f04f9a
parent[server] Pimp help window (diff)
downloadpvs2-94d1072b455f88c858e8e5c592d133c33728440e.tar.gz
pvs2-94d1072b455f88c858e8e5c592d133c33728440e.tar.xz
pvs2-94d1072b455f88c858e8e5c592d133c33728440e.zip
[client] Make toolbar movable by mouse
-rw-r--r--gui/client/toolbar.ui18
-rw-r--r--src/client/toolbar/toolbar.cpp13
-rw-r--r--src/client/toolbar/toolbar.h5
3 files changed, 30 insertions, 6 deletions
diff --git a/gui/client/toolbar.ui b/gui/client/toolbar.ui
index 062d0e8..cec570f 100644
--- a/gui/client/toolbar.ui
+++ b/gui/client/toolbar.ui
@@ -158,12 +158,20 @@ QCheckBox::indicator:checked:pressed {
</item>
<item>
<widget class="QLabel" name="icon_pvs">
+ <property name="font">
+ <font>
+ <pointsize>10</pointsize>
+ <weight>75</weight>
+ <italic>true</italic>
+ <bold>true</bold>
+ <kerning>true</kerning>
+ </font>
+ </property>
+ <property name="styleSheet">
+ <string notr="true">color:#05f;</string>
+ </property>
<property name="text">
- <string notr="true">&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.0//EN&quot; &quot;http://www.w3.org/TR/REC-html40/strict.dtd&quot;&gt;
-&lt;html&gt;&lt;head&gt;&lt;meta name=&quot;qrichtext&quot; content=&quot;1&quot; /&gt;&lt;style type=&quot;text/css&quot;&gt;
-p, li { white-space: pre-wrap; }
-&lt;/style&gt;&lt;/head&gt;&lt;body style=&quot; font-family:'Ubuntu'; font-size:11pt; font-weight:400; font-style:normal;&quot;&gt;
-&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-family:'DejaVu Sans'; font-size:10pt; font-weight:600; font-style:italic; color:#0055ff;&quot;&gt;PVS&lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
+ <string notr="true">PVS</string>
</property>
</widget>
</item>
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
diff --git a/src/client/toolbar/toolbar.h b/src/client/toolbar/toolbar.h
index fd1d993..7826499 100644
--- a/src/client/toolbar/toolbar.h
+++ b/src/client/toolbar/toolbar.h
@@ -57,10 +57,13 @@ private:
VncWindow *_vnc;
bool _isManagerPc;
const QPixmap _cam32, _beWatchedEye;
+ QPoint _lastDragPos;
int centerPos, yPos, yPosHidden;
- void enterEvent(QEvent* e);
+ void enterEvent(QEvent* e) override;
+ void mousePressEvent(QMouseEvent* event) override;
+ void mouseMoveEvent(QMouseEvent* event) override;
QList<Room> myRooms();
bool isManagerPc();
QString identifyMgrIP();