Setting geometry to match embedded device in Qt Designer
-
My Embedded device is a 7 inch display at 800 by 480 and my computer is at a different resolution. How do I change the dimensions of the geometry to match my 7 inch display?
Even when I set my parent Widget to 800 by 480, it does not reflect the dimensions of the device itself. How do I change that in Qt Designer?
-
use fullscreen funtion can be a solution?
otherwise use something like:
@
QApplication a(argc,argv);
Menu b;
b.resize(a.desktop()->width(), a.desktop()->height());
b.show();
return a.exec();
@ -
Hmm, is line number 3 ok? Because I don't think desktop has the method width() or height().
I've tried Full Screen, the problem is with QtDesigner. There should be a an option to set the canvas in terms of inches.
-
Yes its correct desktop return a QDesktopWidget that inherit QWidget and have width and height method. Maybe you have to include the QDesktopWidget header to build correctly.
For the inched in designer i don't know if there's an option. -
Hi,
I was able to resolve this using QPaintDevice and setting the Device profile to match the DPI of the device.
@ qDebug()<<"Logical DPI "<<QPaintDevice::logicalDpiX()<<"x"<<QPaintDevice::logicalDpiY();
qDebug()<<"Physical DPI"<<QPaintDevice::physicalDpiX()<<"x"<<QPaintDevice::physicalDpiY();@The device had 72 DPI and I set this in the device profile of Qt Designer (Tools>Options>Designer) .
Required restarting Qt Creator before applying.