How setStylesheet ocuppy resolution 1366 by 254 only

  • My picture resolution is 1366 by 254.
    Would like setStyleSheet to occupy 1366 by 254 and mainwindow size is 1366 by 1016.

    MainWindow w;
    //254 x 4

  • Moderators

    I'm not sure I understand you correctly but do you mean you don't want the image to repeat? If so then set the repeat mode:

    w.setStyleSheet("background-image:url(:/file/left.png); background-repeat: no-repeat");

  • Chris thanks

    want setStyleSheet to occupy top quarter of the mainWindow.
    MainWindow size is 1366 by 1016

  • Moderators

    So... have you tried my suggestion? It should do what you want.

  • yes i have,
    w.setStyleSheet("background-image:url(:/file/left.png); background-repeat: no-repeat");

    It only fills up PC monitor width, thus i add setFixedWidth to set the width i want

    On my laptop it work perfectly, but when i cross-compile and test it on the ARM target.
    The mainwindow is expanded over the whole screen. Is there any workaround?

Log in to reply

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