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. [SOLVED] setContentsMargins() not working?
Forum Updated to NodeBB v4.3 + New Features

[SOLVED] setContentsMargins() not working?

Scheduled Pinned Locked Moved General and Desktop
3 Posts 2 Posters 5.4k 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.
  • J Offline
    J Offline
    jesuisbenjamin
    wrote on last edited by
    #1

    I am working on an application built this way:
    @
    QApplication
    |_ QMainwindow
    |_ QScrollArea (central widget)
    |_ QFrame (child of scroll area)
    |_ QFrame
    | |_ QLabel
    | |_ QPixmap
    |_ QFrame
    | |_ QLabel
    | |_ QPixmap
    |_ QFrame
    |_ ect...
    @
    I want there to be no margins between the sub-QFrames and their QLabels and equally between QLabels and their QPixmap. The latter seems to occur naturally, but no amount of effort seems to help me reduce the margin of the QFrames with their child QLabel. I have been able to test that by applying a Style Sheet to the components. I have requested to reduce the sub-QFrame's margins with QFrame.setContentsMargins(0, 0, 0, 0) and with its layout's QBoxLayout.setSpacing(0). In spite of all this, margins persist i showing up.

    What can I do?

    Thanks.

    1 Reply Last reply
    0
    • D Offline
      D Offline
      dbzhang800
      wrote on last edited by
      #2

      @
      QLayout::setContentsMargins()
      @

      1 Reply Last reply
      0
      • J Offline
        J Offline
        jesuisbenjamin
        wrote on last edited by
        #3

        It works thanks :)

        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