Answer the question
In order to leave comments, you need to log in
How to make a frameless Qt draggable window?
I know about ways by type
void mousePressEvent(QMouseEvent *evt)
{
oldPos = evt->globalPos();
}
void mouseMoveEvent(QMouseEvent *evt)
{
const QPoint delta = evt->globalPos() - oldPos;
if (locked)
// if locked, ignore delta on y axis, stay at the top
move(x()+delta.x(), y());
else
move(x()+delta.x(), y()+delta.y());
oldPos = evt->globalPos();
}
Answer the question
In order to leave comments, you need to log in
Relatively recently, this thing appeared: https://www.qt.io/blog/custom-window-decorations
Before 5.15 there was no easy way, so if you need an older version, you can not reinvent the wheel, but take a ready-made implementation: https://github.com/search?q=Qt+frameless
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question