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()
void ChannelTree::mousePressEvent(QMouseEvent * event)
{
if (event->button() == Qt::LeftButton)
{
m_oldPosition = event->globalPos();
doMove = true;
}
else if (event->button() == Qt::RightButton)
m_parent->hide();
......@@ -52,7 +55,10 @@ void ChannelTree::mouseReleaseEvent(QMouseEvent * event)
void ChannelTree::mouseMoveEvent(QMouseEvent * event)
{
if (doMove)
m_parent->move(event->globalPos());
{
m_parent->move(m_parent->pos() + (event->globalPos() - m_oldPosition));
m_oldPosition = event->globalPos();
}
QTreeWidget::mouseMoveEvent(event);
}
......@@ -79,7 +85,10 @@ Background::~Background()
void Background::mousePressEvent(QMouseEvent * event)
{
if (event->button() == Qt::LeftButton)
{
m_oldPosition = event->globalPos();
doMove = true;
}
else if (event->button() == Qt::RightButton)
m_parent->hide();
......@@ -96,7 +105,10 @@ void Background::mouseReleaseEvent(QMouseEvent * event)
void Background::mouseMoveEvent(QMouseEvent * event)
{
if (doMove)
m_parent->move(event->globalPos());
{
m_parent->move(m_parent->pos() + (event->globalPos() - m_oldPosition));
m_oldPosition = event->globalPos();
}
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