QT getting the screen resolution without the extended monitor

前端 未结 1 1058
忘掉有多难
忘掉有多难 2020-12-10 11:35
QDesktopWidget desktop;

int desktopHeight=desktop.geometry().height();
int desktopWidth=desktop.geometry().width();
this->resize(desktopWidth,desktopHeight);
         


        
1条回答
  •  失恋的感觉
    2020-12-10 12:22

    You pretty much had it, just give the screen ID of your main monitor to the geometry() call.

    QDesktopWidget widget;
    QRect mainScreenSize = widget.availableGeometry(widget.primaryScreen()); // or screenGeometry(), depending on your needs
    

    0 讨论(0)
提交回复
热议问题