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. QVBoxLayout over QLabel ?
Forum Update on Monday, May 27th 2025

QVBoxLayout over QLabel ?

Scheduled Pinned Locked Moved Unsolved General and Desktop
6 Posts 3 Posters 1.5k 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.
  • cpperC Offline
    cpperC Offline
    cpper
    wrote on last edited by
    #1

    Is there a way to display a QVBoxLayout which includes widgets as QPushbutton QCheckbox over a QLabel which inludes a QPixmap ?

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi,

      Do you want a widget with an image background ? If so, the simple way would be through a style sheet using background-image

      Hope it helps.

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      cpperC 1 Reply Last reply
      1
      • SGaistS SGaist

        Hi,

        Do you want a widget with an image background ? If so, the simple way would be through a style sheet using background-image

        Hope it helps.

        cpperC Offline
        cpperC Offline
        cpper
        wrote on last edited by
        #3

        @SGaist Not really, sorry I wasn't clear enough.

        I have a QLabel which displays a QPixmap. Over the QLabel(in the foreground / "at the top") I'd like to display a vertical layout(consisting of a button and a checkbox, if it matters).

        1 Reply Last reply
        0
        • Chris KawaC Offline
          Chris KawaC Offline
          Chris Kawa
          Lifetime Qt Champion
          wrote on last edited by
          #4

          Not sure I understand but...

          QPushButton* pb = new QPushButton("foo");
          QCheckBox* cb = new QCheckBox("bar");
          QLabel* label = new QLabel();
          label->setPixmap("bazz.png");
          
          QVBoxLayout* lay = new QVBoxLayout();
          lay->addWidget(pb);
          lay->addWidget(cb);
          lay->addWidget(label);
          
          1 Reply Last reply
          1
          • cpperC Offline
            cpperC Offline
            cpper
            wrote on last edited by cpper
            #5

            Since my mad paint skills are far better than my English, I'll try to express my wish trough a picture. As you can see, the QLabel is in the background and QVBoxLayout in the foreground. This is what I'm trying to achieve.

            1 Reply Last reply
            0
            • SGaistS Offline
              SGaistS Offline
              SGaist
              Lifetime Qt Champion
              wrote on last edited by
              #6

              If I guess the goal of your application correctly, you should rather consider the Graphics View framework. A QGraphicsPixmapItem and a QGraphicsWidgetItem on top and you'll likely have less trouble implementing animations.

              Interested in AI ? www.idiap.ch
              Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

              1 Reply Last reply
              1

              • Login

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