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 to set the ratio of width and height of the widget?
Forum Updated to NodeBB v4.3 + New Features

How to set the ratio of width and height of the widget?

Scheduled Pinned Locked Moved Unsolved General and Desktop
5 Posts 3 Posters 359 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.
  • M Offline
    M Offline
    Mikeeeeee
    wrote on 6 Sept 2019, 16:32 last edited by
    #1

    Hi!
    How to set the ratio of width and height of the widget?
    It is not works:

    ui->labelLogotip->setMinimumWidth(ui->labelLogotip->height() * 1.5);
    
    
    1 Reply Last reply
    0
    • J Offline
      J Offline
      JoeCFD
      wrote on 6 Sept 2019, 18:21 last edited by
      #2

      int QWidget::heightForWidth(int w)

      1 Reply Last reply
      0
      • M Offline
        M Offline
        Mikeeeeee
        wrote on 6 Sept 2019, 18:38 last edited by
        #3

        It is not work:

        ui->labelLogotip->heightForWidth(ui->labelLogotip->height() * 1.5);
        
        J 1 Reply Last reply 6 Sept 2019, 19:42
        0
        • M Mikeeeeee
          6 Sept 2019, 18:38

          It is not work:

          ui->labelLogotip->heightForWidth(ui->labelLogotip->height() * 1.5);
          
          J Offline
          J Offline
          JonB
          wrote on 6 Sept 2019, 19:42 last edited by JonB 9 Jun 2019, 19:45
          #4

          @mikeeeeee
          Since Qt always adopts the convention of naming setter functions set..., did you try void QSizePolicy::setHeightForWidth(bool dependent)?

          1 Reply Last reply
          1
          • M Offline
            M Offline
            Mikeeeeee
            wrote on 7 Sept 2019, 09:07 last edited by
            #5

            It's not work:

                QSizePolicy sizePolicy1;
                sizePolicy1.setHeightForWidth(2);
                ui->labelLogotip->setSizePolicy(sizePolicy1);
            
            1 Reply Last reply
            0

            5/5

            7 Sept 2019, 09:07

            • Login

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