ui: restrict subwindow movement
restrict subwindow movement to mainwindow to make sure you cant move it were you dont see it
This commit is contained in:
@@ -20,6 +20,7 @@
|
||||
|
||||
.DS_Store
|
||||
.idea
|
||||
.vscode
|
||||
|
||||
/ide_plugins/vs/vs2015/SourcetrailPlugin/SourcetrailPlugin/bin
|
||||
/ide_plugins/vs/vs2015/SourcetrailPlugin/SourcetrailPlugin/obj
|
||||
@@ -55,6 +56,7 @@ sourcetrail.srctrlprj
|
||||
compile_commands.json
|
||||
|
||||
Makefile
|
||||
CMakeLists.txt.user*
|
||||
/__pycache__/
|
||||
|
||||
/deployment/windows/wixSetup/bin
|
||||
|
||||
@@ -409,8 +409,26 @@ void QtWindow::mouseMoveEvent(QMouseEvent* event)
|
||||
{
|
||||
if (event->buttons() & Qt::LeftButton && m_mousePressedInWindow)
|
||||
{
|
||||
move(event->globalPos() - m_dragPosition);
|
||||
event->accept();
|
||||
if (m_isSubWindow)
|
||||
{
|
||||
QPoint pos = event->globalPos() - m_dragPosition;
|
||||
QRect parentRect = parentWidget()->rect();
|
||||
|
||||
if (pos.x() < parentRect.left())
|
||||
{
|
||||
pos.setX(parentRect.left());
|
||||
}
|
||||
pos.setX(qBound(parentRect.left(), parentRect.right() - width(), pos.x()));
|
||||
pos.setY(qBound(parentRect.top(), parentRect.bottom() - height(), pos.y()));
|
||||
|
||||
move(pos);
|
||||
event->accept();
|
||||
}
|
||||
else
|
||||
{
|
||||
move(event->globalPos() - m_dragPosition);
|
||||
event->accept();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user