codeslicer
17th February 2008, 19:01
Is there any way I can "natively" move a QWidget? For example, Windows can use the gray rectangle when you move a window, while an X11 setup with Compiz can use Wobbly Windows. On X11(Ubuntu 7.10), moving the window by just using:
void myapp::mousePressEvent(QMouseEvent *event) {
if (event->button() == Qt::LeftButton) {
dragPosition = event->globalPos() - frameGeometry().topLeft();
event->accept();
}
}
void myapp::mouseMoveEvent(QMouseEvent *event) {
if (event->buttons() & Qt::LeftButton) {
move(event->globalPos() - dragPosition);
event->accept();
}
}
makes it directly paint every time it is dragged, however moving it while pressing and holding the Alt-key yields the wobbly effect. Is there any way I can natively move the window without requiring the user to, for example, hold the Alt key, or is this out of the question?
Thanks in advance ~codeslicer
void myapp::mousePressEvent(QMouseEvent *event) {
if (event->button() == Qt::LeftButton) {
dragPosition = event->globalPos() - frameGeometry().topLeft();
event->accept();
}
}
void myapp::mouseMoveEvent(QMouseEvent *event) {
if (event->buttons() & Qt::LeftButton) {
move(event->globalPos() - dragPosition);
event->accept();
}
}
makes it directly paint every time it is dragged, however moving it while pressing and holding the Alt-key yields the wobbly effect. Is there any way I can natively move the window without requiring the user to, for example, hold the Alt key, or is this out of the question?
Thanks in advance ~codeslicer