Qt

From HerzbubeWiki
Jump to navigation Jump to search

This page is about the platform-independent C++ library / toolkit Qt.

This page is a stub. I once worked extensively with Qt for several years, all that is left from this time are some handwritten notes that I transcribed here. I'm not even sure whether the information on this page is still correct or relevant.


Layout

QLayout queries widgets according to the following algorithm:

  • QSizePolicy comes first
    • Ignore: The widget gets as much space as possible, the only limit is maximumSize
    • Fixed : The widget gets exactly sizeHint() space
    • All others
      • Query sizeHint()
      • Distribute space according to the actual QSizePolicy of all widgets
      • Minimum size
        • If minimumSize() is set, the minimum size the widget gets is minimumSize()
        • If minimumSize() is not set, the minimum size the widget gets is minimumSizeHint()
        • In both cases: If the result is 0 the widget gets no space
      • Maximum size
        • The maximum size the widget gets is maximumSize()
        • If the result is QWIDGETSIZE_MAX, the maximum size the widget gets is unlimited
    • sizeHint() and minimumSizeHint()
      • Widget without a layout
        • The widget must calculate the size hint by itself
        • The default implementation provides a size hint = QSize(), i.e. no size hint
      • Widget with a layout
        • The layout provides the size hints
  • After QSizePolicy comes ... what?