how to use the following documentation? void QWidget::setMaximumSize(int maxw, int maxh).



  • how to use the following documentation? void QWidget::setMaximumSize(int maxw, int maxh).
    In other words, I Qwindow that I want to set the max. size. As of now, when a user presses the top max button on the window menu, the entire program fills the screen. I want to prevent the program from filling the whole screen. The documentation that I have posted above seems to be the answer, however, I do not know how to code and implement this document into my actual program. Forgive me, in that I am fairly new to qt.


  • Moderators

    @Recency
    you need to call setMaximumSize() on the widget which acts as your window.
    Additionally you might need to disable the maximize button when the screen size is bigger than the maximum size.



  • Thank you. I have retrieved the following code that worked.
    setWindowFlags(windowFlags() ^ Qt::WindowMaximizeButtonHint);
    However, I am very lost in the understanding of qt's documentations. Are there any tutorial books or instruction that you may have for advice.


  • Qt Champions 2016

    @Recency
    Hi
    This one
    http://www.bogotobogo.com/cplusplus/files/c-gui-programming-with-qt-4-2ndedition.pdf
    Is pretty nice for introduction. Its Qt4 but most is still the same in Qt5.



  • Thanks to everyone. This was my first post to this site and it has been very educational.

    Although disabling the max. button does work, what I was looking for was the following code.
    this->setMaximumSize(int( 400), int(234) );
    The key word "CALL" that you have stated gives a lot of meaning to the qt documentations.
    Again many thanks.


  • Qt Champions 2016

    @Recency
    Hi
    If inside the class, you do not need "this", also why are you using int() ?
    Wont this
    setMaximumSize(400,234 );

    just compile and run too?



  • setMaximumSize(400,234 );
    Much Cleaner Indeed

    Many Thanks


Log in to reply
 

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