Commit c5144037 authored by Carsten Fuhrmann's avatar Carsten Fuhrmann

moving the window do not jump to the mouse anymore

parent 69296e5a
...@@ -35,7 +35,10 @@ ChannelTree::~ChannelTree() ...@@ -35,7 +35,10 @@ ChannelTree::~ChannelTree()
void ChannelTree::mousePressEvent(QMouseEvent * event) void ChannelTree::mousePressEvent(QMouseEvent * event)
{ {
if (event->button() == Qt::LeftButton) if (event->button() == Qt::LeftButton)
doMove = true; {
m_oldPosition = event->globalPos();
doMove = true;
}
else if (event->button() == Qt::RightButton) else if (event->button() == Qt::RightButton)
m_parent->hide(); m_parent->hide();
...@@ -52,7 +55,10 @@ void ChannelTree::mouseReleaseEvent(QMouseEvent * event) ...@@ -52,7 +55,10 @@ void ChannelTree::mouseReleaseEvent(QMouseEvent * event)
void ChannelTree::mouseMoveEvent(QMouseEvent * event) void ChannelTree::mouseMoveEvent(QMouseEvent * event)
{ {
if (doMove) if (doMove)
m_parent->move(event->globalPos()); {
m_parent->move(m_parent->pos() + (event->globalPos() - m_oldPosition));
m_oldPosition = event->globalPos();
}
QTreeWidget::mouseMoveEvent(event); QTreeWidget::mouseMoveEvent(event);
} }
...@@ -79,7 +85,10 @@ Background::~Background() ...@@ -79,7 +85,10 @@ Background::~Background()
void Background::mousePressEvent(QMouseEvent * event) void Background::mousePressEvent(QMouseEvent * event)
{ {
if (event->button() == Qt::LeftButton) if (event->button() == Qt::LeftButton)
{
m_oldPosition = event->globalPos();
doMove = true; doMove = true;
}
else if (event->button() == Qt::RightButton) else if (event->button() == Qt::RightButton)
m_parent->hide(); m_parent->hide();
...@@ -96,7 +105,10 @@ void Background::mouseReleaseEvent(QMouseEvent * event) ...@@ -96,7 +105,10 @@ void Background::mouseReleaseEvent(QMouseEvent * event)
void Background::mouseMoveEvent(QMouseEvent * event) void Background::mouseMoveEvent(QMouseEvent * event)
{ {
if (doMove) if (doMove)
m_parent->move(event->globalPos()); {
m_parent->move(m_parent->pos() + (event->globalPos() - m_oldPosition));
m_oldPosition = event->globalPos();
}
QLabel::mouseMoveEvent(event); QLabel::mouseMoveEvent(event);
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment