Qt 6.12 LTS is out! See what's new in the release
blog
[SOLVED] Implementing draggable windows
General and Desktop
4
Posts
2
Posters
1.9k
Views
1
Watching
-
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!
-
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();
}
}@ -
Figured it out. Thanks!