[SOLVED] Implementing draggable windows
-
wrote on 18 Apr 2014, 01:38 last edited by
Hello!
I have been playing around with making frameless windows. When you remove the OS-given frame from a window, you lose the ability to drag the window around the screen. How can I reimplement this feature?
Thanks!
-
wrote on 18 Apr 2014, 04:10 last edited by
Well you can implement something like this:
@void Dialog::mouseMoveEvent(QMouseEvent *event)
{
if(event->buttons() & Qt::LeftButton)
{
this->move(event->globalPos() - cursorPos);
}
}void Dialog::mousePressEvent(QMouseEvent *event)
{
if(event->buttons() & Qt::LeftButton)
{
cursorPos = event->pos();
}
}@ -
wrote on 18 Apr 2014, 04:36 last edited by
Figured it out. Thanks!
-
wrote on 18 Apr 2014, 05:37 last edited by
You're welcome. Don't forget mark thread as solved :) .
1/4