Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Qt5 documentation QLayout.getContentsMargins()
Forum Updated to NodeBB v4.3 + New Features

Qt5 documentation QLayout.getContentsMargins()

Scheduled Pinned Locked Moved General and Desktop
4 Posts 2 Posters 2.2k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • V Offline
    V Offline
    VinsS
    wrote on last edited by
    #1

    Hi,
    In the doc [1], the method getContentsMargins() of QLayout take four arguments and doesn't return nothing.

    Is it a bug in the doc ?

    If I do:

    (PyQt user)
    layout = QtWidgets.QGridLayout()
    print('Margins:', layout.getContentsMargins())

    Margins: (9, 9, 9, 9)

    [1] http://qt-project.org/doc/qt-5.0/qtwidgets/qlayout.html

    1 Reply Last reply
    0
    • raven-worxR Offline
      raven-worxR Offline
      raven-worx
      Moderators
      wrote on last edited by
      #2

      the method takes pointers (IN parameters):
      @
      int left,
      int top,
      int right,
      int bottom,
      layout->getContentsMargins(&left,&top,&right,&bottom);
      qDebug() << left << top << right << bottom; //variables contain margin values
      @
      the method sets the values on the pointers (if they are not NULL).
      So it's not a bug ;)

      Note: there is also another method which return a QMargins object: QLayout::contentsMargins()

      --- SUPPORT REQUESTS VIA CHAT WILL BE IGNORED ---
      If you have a question please use the forum so others can benefit from the solution in the future

      1 Reply Last reply
      0
      • V Offline
        V Offline
        VinsS
        wrote on last edited by
        #3

        Ok, the usage is just different by the language C++ >> Python.

        Thanks.

        vince

        1 Reply Last reply
        0
        • raven-worxR Offline
          raven-worxR Offline
          raven-worx
          Moderators
          wrote on last edited by
          #4

          ye...seems like the python binding doesn't take arguments for getContentsMargins() and returns a list with 4 elements.

          --- SUPPORT REQUESTS VIA CHAT WILL BE IGNORED ---
          If you have a question please use the forum so others can benefit from the solution in the future

          1 Reply Last reply
          0

          • Login

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • Users
          • Groups
          • Search
          • Get Qt Extensions
          • Unsolved