Important: Please read the Qt Code of Conduct -

The naming history of 'QLayout::getContentsMargins()' member?

  • In Qt API, the getter function does not seem to use 'get' for its prefix, generally. But when reading Qt code, I met '
    getContentsMargins()'. Is there anybody know how come this member is named? ( though I believe trolls can answer this :-) )

  • Most probably because it doesn't return anything (as a getter is usually expected to do), but uses out-parameters instead.
    void QWidget::getContentsMargins(int *left, int *top, int *right, int *bottom) const
    In addition, there is a "conventional" contentsMargin() getter.
    QMargins QWidget::contentsMargins() const

  • I see. Thanks!

Log in to reply