[Interest] How to move a QWidget based application out of the screen?

Francisco Ares frares at gmail.com
Wed Aug 29 02:02:36 CEST 2018


Hi, all.

I am working on a monitor for the "rdesktop" application. It will have a
tiny window, horizontally centered at the bottom of the screen, with a few
buttons on it, and, while "rdesktop" is running, I have planned for it to
hide, moving partially out of the screen, leaving just 1 pixel line, just
enough to receive a mouse "enterEvent" and then rise to its normal position.

But I could not move the widget out of the screen. I'm using this:

    QRect r = rect();
    QRect d = qApp->desktop()->availableGeometry(-1);
    setGeometry( ( d.width() - r.width() ) / 2, d.height() - 1 , r.width(),
r.height() );

To get it to the initial position, it works perfectly with this:

    QRect r = rect();
    QRect d = qApp->desktop()->availableGeometry(-1);
    setGeometry( ( d.width() - r.width() ) / 2, d.height() - r.height(),
r.width(), r.height() );

Am I missing something?

I'm using Qt 5.9.6 in Linux (Gentoo) OS.

Thanks!
Francisco
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20180828/58ea1abe/attachment.html>


More information about the Interest mailing list