QDesktopWidget desktop;
int desktopHeight=desktop.geometry().height();
int desktopWidth=desktop.geometry().width();
this->resize(desktopWidth,desktopHeight);
for example my main monitor resolution is 1024 x 768 and my extended monitor resolution is 800x600. the value i get from desktop height and width is the sum of the two monitor resolution. i only need to get the main monitor resolution. can somebody tell me how? thanks. I'm using qt 4.7.3
edit: I'm using dual screen, particularly in cashier ordering the main monitor is seen by the cashier and the extended are seen by the costumer.
To keep a custom resolution in Full Screen mode:Go to your virtual machine's configuration > Options > Full Screen. Expand Advanced Settings menu, then select Keep ratio from the Scale to fit screen drop-down menu: Start your virtual machine in Full Screen mode. Restart Windows.
Qt includes a very simple method to get the size of the screen (width and height). Here it is: QSize size = qApp->screens()[0]->size(); Note that this function works perfectly in Android and iOS too.
If your monitor is having problems with resolution, it's probably your graphics card! If you're getting a display, but it isn't displaying properly, it's probably just a matter of updating your graphics card's driver. If you're not getting a display at all, find your monitor in these guides and see if there's a fix.
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With