Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Qt for Python
  4. Insert QLabel in QFrame

Insert QLabel in QFrame

Scheduled Pinned Locked Moved Solved Qt for Python
4 Posts 2 Posters 2.9k Views
  • 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.
  • C Offline
    C Offline
    celke
    wrote on 31 Oct 2021, 10:34 last edited by
    #1

    I am trying to insert Qlabels in a QFrame by doing so:

        frame = QFrame()
    
        QLabel("Title",frame)
        QLabel("Year",frame)
    

    However, only the last added label is visible, is there something missing ?

    E 1 Reply Last reply 31 Oct 2021, 10:50
    0
    • C celke
      31 Oct 2021, 10:34

      I am trying to insert Qlabels in a QFrame by doing so:

          frame = QFrame()
      
          QLabel("Title",frame)
          QLabel("Year",frame)
      

      However, only the last added label is visible, is there something missing ?

      E Offline
      E Offline
      eyllanesc
      wrote on 31 Oct 2021, 10:50 last edited by
      #2

      @celke What happens is that one of them is on top of the other. Use layout:

      frame = QFrame()
      
      title_label = QLabel("Title")
      year_label = QLabel("Year")
      
      lay = QVBoxLayout(frame)
      lay.addWidget(title_label)
      lay.addWidget(year_label)
      
      1 Reply Last reply
      2
      • C Offline
        C Offline
        celke
        wrote on 31 Oct 2021, 11:11 last edited by
        #3

        This works perfect, thanks

        E 1 Reply Last reply 31 Oct 2021, 11:12
        0
        • C celke
          31 Oct 2021, 11:11

          This works perfect, thanks

          E Offline
          E Offline
          eyllanesc
          wrote on 31 Oct 2021, 11:12 last edited by
          #4
          This post is deleted!
          1 Reply Last reply
          0

          4/4

          31 Oct 2021, 11:12

          • Login

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