SetMinimumHeight() problem - widget is minimizing



  • Hi,
    I have problem with setMinimumHeight function.

    When I create new widget I set size policy to expanding (horizontal and vertical). I have function where I set custom size of widget by setting minimum and maximum height of widget to the same size and then minimum and maximum sizes are restored to default values.

    @
    void MyWidget::setActive(bool isActive)
    {
    ...
    //first part
    setMaximumHeight(customHeight);
    setMinimumHeight(customHeight);

    QApplication::processEvents();
    //second part
    setMaximumHeight(2000);
    setMinimumHeight(1);
    QApplication::processEvents();
    

    }
    @

    In first part I want to resize widget (it is my widget - inheriting QDockWidget - so I can't do this by using function resize).
    I do it by setting minimum and maximum height to the same value.
    In second part I restore default minimum and maximum values, because I want to have possibility to resize that widget manually.
    But setting minimum height to minimum (for some reasons I should set it to 1 not to 0) causes that my widget is resizing to that height and I don't know why.


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.