Can't resize QWindow

  • I want to create a QWindow which size is 1920*1080 but I can't,the result is here
    alt text

    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;
        qDebug()<<QString("The width of screen is %1 and height is %2").
        qDebug()<<QString("The width of QWindow is %1 and height is %2").
        qDebug()<<QString("The tolerance width of QWindow is %1 and height is %2").
        return a.exec();

    Who can tell me why I can't create a 1920*1080 QWindow?

  • Lifetime Qt Champion

    Your screen is not big enough.
    So window is re scaled to fit 1366x768
    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?

  • Lifetime Qt Champion

    @MartinChan-0 said in Can't resize 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 use


    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~

  • Lifetime Qt Champion

    Ok, that way.
    Well then set Minimum should work just fine.

Log in to reply

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.