A Manic Developer's Place

Qt get screen size and set window location

June 6, 2016

Linux Qt


    WidgetMainWindow w;

    QRect rec = QApplication::desktop()->screenGeometry();
    int height = rec.height();
    int width = rec.width();
    w.setGeometry(width - 450, 10, 450, 700);
    w.show();

ManicDev on Github

-----BEGIN GEEK CODE BLOCK-----
Version: 3.1
GCS/O d-pu s-:+++ a+ C+++ UL+++ P- L++ E--- W+++ N o-- K--? w++ O M+ V PS PE Y+ PGP t+ 5? X+ R tv- b+ DI- D++ G e+ h++ r++ z
------END GEEK CODE BLOCK------