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. Customed QWidget can't get the size after layout by calling adjustSize()
QtWS25 Last Chance

Customed QWidget can't get the size after layout by calling adjustSize()

Scheduled Pinned Locked Moved Unsolved General and Desktop
pyqtpyqt5qgraphicsviewqwidgetcustom qwidget
5 Posts 2 Posters 795 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.
  • D Offline
    D Offline
    darrenleeleelee1
    wrote on last edited by
    #1

    When using normal QWidget(not customed) can get the size in a layout by calling adjustSize(), but I am wondering how to do the same thing in a Customed QWidget.
    (QWidget may be a QLbael, or QGraphicsView etc.)

    Pl45m4P 1 Reply Last reply
    0
    • D darrenleeleelee1

      When using normal QWidget(not customed) can get the size in a layout by calling adjustSize(), but I am wondering how to do the same thing in a Customed QWidget.
      (QWidget may be a QLbael, or QGraphicsView etc.)

      Pl45m4P Offline
      Pl45m4P Offline
      Pl45m4
      wrote on last edited by Pl45m4
      #2

      @darrenleeleelee1

      I'm not sure if understood your question right, but it makes no difference whether you have a standard QWidget or any custom QWidget derived class.
      Every QWidget function will also work for custom widgets.


      If debugging is the process of removing software bugs, then programming must be the process of putting them in.

      ~E. W. Dijkstra

      1 Reply Last reply
      0
      • D Offline
        D Offline
        darrenleeleelee1
        wrote on last edited by
        #3

        @Pl45m4 but my custom qwidget when I call adjustSize() it became QtCore.QSize(), but if is normal one that it will return a specific size which is the correct size in layout.

        Pl45m4P 1 Reply Last reply
        0
        • D darrenleeleelee1

          @Pl45m4 but my custom qwidget when I call adjustSize() it became QtCore.QSize(), but if is normal one that it will return a specific size which is the correct size in layout.

          Pl45m4P Offline
          Pl45m4P Offline
          Pl45m4
          wrote on last edited by
          #4

          @darrenleeleelee1

          • https://doc.qt.io/qt-5/qwidget.html#adjustSize

          Does your custom widget have a valid parent or a sizeHint set?


          If debugging is the process of removing software bugs, then programming must be the process of putting them in.

          ~E. W. Dijkstra

          D 1 Reply Last reply
          0
          • Pl45m4P Pl45m4

            @darrenleeleelee1

            • https://doc.qt.io/qt-5/qwidget.html#adjustSize

            Does your custom widget have a valid parent or a sizeHint set?

            D Offline
            D Offline
            darrenleeleelee1
            wrote on last edited by darrenleeleelee1
            #5

            @Pl45m4 no but I don't know how to do that sizeHint() can return the right size in a layout.and I have a valid parent.

            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