I'm not sure if I can fully expain what is this question,but please read on.
Here,I'm creating a frameless window.
MyWindow
::MyWindow(QWidget *parent
) :{
ui.setupUi(this);
setWindowFlags(Qt::FramelessWindowHint);
setAttribute(Qt::WA_TranslucentBackground);
setAttribute(Qt::WA_NoMousePropagation);
resizeHandle = new ResizeHandle(this);
resizeHandle->setCursor(Qt::SizeVerCursor);
...
connect(resizeHandle, SIGNAL(sizeChanged(QPoint&)), this, SLOT(rearrange(QPoint&)));
}
MyWindow::MyWindow(QWidget *parent) :
QMainWindow(parent)
{
ui.setupUi(this);
setWindowFlags(Qt::FramelessWindowHint);
setAttribute(Qt::WA_TranslucentBackground);
setAttribute(Qt::WA_NoMousePropagation);
resizeHandle = new ResizeHandle(this);
resizeHandle->setCursor(Qt::SizeVerCursor);
...
connect(resizeHandle, SIGNAL(sizeChanged(QPoint&)), this, SLOT(rearrange(QPoint&)));
}
To copy to clipboard, switch view to plain text mode

At the bottom,there's the resizeHandle.When I press on it,I can drag it.Then it will emit sizeChanged(QPoint&) signal,indicating how much I drag(usually 1 to 3 pixel per SIGNAL).Then I resize MyWindow in rearrange(QPoint&):
void MyWindow::rearrange(QPoint& newSize)
{
int newH = newSize.ry();
resize(this->width(), this->height() + newH);
QFrame* footer
= ui.
footerFrame;
footer->setGeometry(footer->x(), footer->y() + newH, footer->width(), footer->height());
....
}
void MyWindow::rearrange(QPoint& newSize)
{
int newH = newSize.ry();
resize(this->width(), this->height() + newH);
QFrame* footer = ui.footerFrame;
footer->setGeometry(footer->x(), footer->y() + newH, footer->width(), footer->height());
....
}
To copy to clipboard, switch view to plain text mode
Here is what it looks like when I resizing:

Seems like a glitch.It's not always this dramatic,but it appears even when I'm dragging slowly.Anyway,it's all about the effect.
Maybe I'm missing something when I implement such kind of function.Should I use so-called double-buffer or something,and how?
Bookmarks