Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved

    Call for Presentations - Qt World Summit

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

    General and Desktop
    3
    5
    135
    Loading More Posts
    • 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
      Mikeeeeee last edited by

      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 Reply Quote 0
      • JoeCFD
        JoeCFD last edited by

        int QWidget::heightForWidth(int w)

        1 Reply Last reply Reply Quote 0
        • M
          Mikeeeeee last edited by

          It is not work:

          ui->labelLogotip->heightForWidth(ui->labelLogotip->height() * 1.5);
          
          JonB 1 Reply Last reply Reply Quote 0
          • JonB
            JonB @Mikeeeeee last edited by JonB

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

            1 Reply Last reply Reply Quote 1
            • M
              Mikeeeeee last edited by

              It's not work:

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