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. Size of the child widget is always fixed in MainWindow constructor.

Size of the child widget is always fixed in MainWindow constructor.

Scheduled Pinned Locked Moved Unsolved General and Desktop
3 Posts 2 Posters 332 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.
  • S Offline
    S Offline
    Simula
    wrote on last edited by
    #1

    Hi.

    I have this setup in UI designer

    designer setup

    And I'm trying to get the size of the OpenGLWidget in MainWindow contructor but I always get the fixed size of a very small window (100,30) instead of a normal size of my widget. Even when the first auto resize event happens the widget size is still the same.

    Only when I manually resize the window, does the size change to the normal size e.g. (900,600)

    How do I get the proper size of my widget control when I start the program?

    Thanks.

    JonBJ 1 Reply Last reply
    0
    • S Simula

      Hi.

      I have this setup in UI designer

      designer setup

      And I'm trying to get the size of the OpenGLWidget in MainWindow contructor but I always get the fixed size of a very small window (100,30) instead of a normal size of my widget. Even when the first auto resize event happens the widget size is still the same.

      Only when I manually resize the window, does the size change to the normal size e.g. (900,600)

      How do I get the proper size of my widget control when I start the program?

      Thanks.

      JonBJ Offline
      JonBJ Offline
      JonB
      wrote on last edited by
      #2

      @Simula
      I don't know anything specific about "OpenGLWidget", but in Qt you don't get widget sizes during constructors. I don't know when your "first auto resize event happens". In general, you have to wait for showEvent() to get any reliable idea of widget sizes, as that's when everything sizes/readjusts.

      1 Reply Last reply
      2
      • S Offline
        S Offline
        Simula
        wrote on last edited by
        #3

        Thanks, that was it.

        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