Customed QWidget can't get the size after layout by calling adjustSize()
-
wrote on 26 Jun 2021, 10:27 last edited by
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.) -
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.)wrote on 26 Jun 2021, 12:14 last edited by Pl45m4I'm not sure if understood your question right, but it makes no difference whether you have a standard
QWidget
or any customQWidget
derived class.
Every QWidget function will also work for custom widgets. -
wrote on 26 Jun 2021, 12:19 last edited by
@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.
-
@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.
wrote on 26 Jun 2021, 12:28 last edited byDoes your custom widget have a valid parent or a sizeHint set?
-
Does your custom widget have a valid parent or a sizeHint set?
wrote on 26 Jun 2021, 12:34 last edited by darrenleeleelee1@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.
5/5