Skip to content
  • 0 Votes
    3 Posts
    784 Views
    CJhaC

    @Christian-Ehrlicher Ok. I understand, I will add my check boxes in a different function and not during showEvent().

    I tried setting layoutSizeConstraint to different values for the vertical layout, the QScrollArea as well as for the widget itself, because of QScrollArea my widget is always resized to a small size when shown for the first time, this is why I tried to add and resize the widget during showEvent() myself. According to Qt's documentation:

    If a scroll area is used to display the contents of a widget that contains child widgets arranged in a layout, it is important to realize that the size policy of the layout will also determine the size of the widget. This is especially useful to know if you intend to dynamically change the contents of the layout. In such cases, setting the layout's size constraint property to one which provides constraints on the minimum and/or maximum size of the layout (e.g., QLayout::SetMinAndMaxSize) will cause the size of the scroll area to be updated whenever the contents of the layout changes.

    But this is not working for me, I am setting the size constraint to QLayout::SetMinAndMaxSize but the QScrollArea remains at the minimum size when shown for the first time.

  • Help with QWidget::show()

    Solved General and Desktop
    17
    0 Votes
    17 Posts
    3k Views
    JonBJ

    @mmikeinsantarosa
    Indeed, that is how Qt documentation lays out its methods.

    To reiterate something @Christian-Ehrlicher said. In Qt nomenclature:

    Methods ending in Event (showEvent(), mouseMoveEvent()) are not signals. Instead they are protected virtual methods. You must sub-class and override if you want to access them.

    Signals tend to be named as the past tense of something that has happened (clicked(), customContextMenuRequested()). You cannot override them. You can connect() to them, without needing to sub-class.

    And slots are just named as an action to be performed (show(), setDiabled()).

  • 0 Votes
    23 Posts
    3k Views
    D

    thanks guy I get my goal by the other way

  • 0 Votes
    1 Posts
    558 Views
    No one has replied