Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. [SOLVED] Size of layout elements
Qt 6.12 LTS is out! See what's new in the release blog

[SOLVED] Size of layout elements

Scheduled Pinned Locked Moved QML and Qt Quick
4 Posts 2 Posters 2.4k Views 1 Watching
  • 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.
  • ? Offline
    ? Offline
    A Former User
    wrote on last edited by
    #1

    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
    0
    • ? Offline
      ? Offline
      A Former User
      wrote on last edited by
      #2

      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.

      1 Reply Last reply
      0
      • ? Offline
        ? Offline
        A Former User
        wrote on last edited by
        #3

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

        1 Reply Last reply
        0
        • ? Offline
          ? Offline
          A Former User
          wrote on last edited by
          #4

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

          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
          • Unsolved