Solved Can't resize QWindow
-
I want to create a QWindow which size is 1920*1080 but I can't,the result is here
Here is my test code:
#include <QGuiApplication> #include <QWindow> #include <QApplication> #include <QDesktopWidget> #include <QDebug> int main(int argc, char *argv[]) { QApplication a(argc, argv); QWindow win; win.resize(1920,1080); win.show(); qDebug()<<QString("The width of screen is %1 and height is %2"). arg(QApplication::desktop()->width()). arg(QApplication::desktop()->height()); qDebug()<<QString("The width of QWindow is %1 and height is %2"). arg(win.width()). arg(win.height()); qDebug()<<QString("The tolerance width of QWindow is %1 and height is %2"). arg(win.maximumWidth()). arg(win.maximumHeight()); return a.exec(); }
Who can tell me why I can't create a 1920*1080 QWindow?
-
hi
Your screen is not big enough.
So window is re scaled to fit 1366x768
try
setFixedSize(1920, 1080); -
I use the subclass of QWindow rather than QWidget,so it didn't have a setFixedSize function...So using the subclass of QWidget is the only way to solve this problem?
-
@MartinChan-0 said in Can't resize QWindow:
QWindow
I have not used QWindow as its used for openGL and native windows.
If you need such features, QWidgets will not work.Why do u want the window to be bigger than the MAX screen ?
-
@mrjj
Firstly,I find a easy way to solve this problem :-) ,you can set a minimum size of a QWindow usewin.minimumSize(QSize(1920,1080));
to set its size.
Secondly, I use it because I want to generate a 1920*1080 picture ,and I have to use OpenGL to draw it (to do some job like anti-aliasing)
Thank you @mrjj anyway~
-
@MartinChan-0
Ok, that way.
Well then set Minimum should work just fine.