Qt Forum

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

    Update: Forum Guidelines & Code of Conduct


    Qt World Summit: Early-Bird Tickets

    [SOLVED] Size of layout elements

    QML and Qt Quick
    2
    4
    1495
    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.
    • D
      david.luggen last edited by

      Hi there

      I'm looking for the bling thing that tells me what size an element in a layout posseses. Let's assume I have a QHBoxLayout with two widgets in it. The first one has a strech of 1 the second doens't has a strech. So that would mean that the second widget is at it's minimal size. Now I want to know what size widget one has, cause this could change accordingly to the window size.

      I tried already QWidget->size(), QWidget->geometry(), QWidget->width() and QWidget->height() but I always get the same resolution, 640x480 which doesn't have any relation to anything of my layout or window settings.

      Thx for help

      1 Reply Last reply Reply Quote 0
      • D
        dmcr last edited by

        Hello,

        QWidget->size() is correct.
        However did you get this property before the widget is displayed?
        In this case, you'll get a value which have no relation with the one once showed.

        dmcr

        1 Reply Last reply Reply Quote 0
        • D
          david.luggen last edited by

          Ah yeah, that's the point, I have to show it before. Thx!

          1 Reply Last reply Reply Quote 0
          • D
            dmcr last edited by

            Could you then put [SOLVED] in the title of the post? :)

            dmcr

            1 Reply Last reply Reply Quote 0
            • First post
              Last post