QT getting the screen resolution without the extended monitor

前端 未结 1 1056
忘掉有多难
忘掉有多难 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)
提交回复
热议问题