Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. How setStylesheet ocuppy resolution 1366 by 254 only

How setStylesheet ocuppy resolution 1366 by 254 only

Scheduled Pinned Locked Moved General and Desktop
5 Posts 2 Posters 769 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • H Offline
    H Offline
    houmingc
    wrote on last edited by
    #1

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

    MainWindow w;
    w.setStyleSheet("background-image:url(:/file/left.png)");
    w.setFixedSize(1366,1016);
    //254 x 4
    
    1 Reply Last reply
    0
    • Chris KawaC Offline
      Chris KawaC Offline
      Chris Kawa
      Lifetime Qt Champion
      wrote on last edited by
      #2

      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");
      
      1 Reply Last reply
      0
      • H Offline
        H Offline
        houmingc
        wrote on last edited by
        #3

        Chris thanks

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

        1 Reply Last reply
        0
        • Chris KawaC Offline
          Chris KawaC Offline
          Chris Kawa
          Lifetime Qt Champion
          wrote on last edited by
          #4

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

          1 Reply Last reply
          0
          • H Offline
            H Offline
            houmingc
            wrote on last edited by houmingc
            #5

            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
            w.setFixedWidth(1366);

            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?

            1 Reply Last reply
            0

            • Login

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • Users
            • Groups
            • Search
            • Get Qt Extensions
            • Unsolved