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?

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

Scheduled Pinned Locked Moved Unsolved General and Desktop
5 Posts 3 Posters 347 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 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
    • JoeCFDJ Online
      JoeCFDJ Online
      JoeCFD
      wrote on last edited by
      #2

      int QWidget::heightForWidth(int w)

      1 Reply Last reply
      0
      • M Offline
        M Offline
        Mikeeeeee
        wrote on last edited by
        #3

        It is not work:

        ui->labelLogotip->heightForWidth(ui->labelLogotip->height() * 1.5);
        
        JonBJ 1 Reply Last reply
        0
        • M Mikeeeeee

          It is not work:

          ui->labelLogotip->heightForWidth(ui->labelLogotip->height() * 1.5);
          
          JonBJ Offline
          JonBJ Offline
          JonB
          wrote on last edited by JonB
          #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 last edited by
            #5

            It's not work:

                QSizePolicy sizePolicy1;
                sizePolicy1.setHeightForWidth(2);
                ui->labelLogotip->setSizePolicy(sizePolicy1);
            
            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