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. How can I make the child control display more area than the parent control?

How can I make the child control display more area than the parent control?

Scheduled Pinned Locked Moved Unsolved General and Desktop
4 Posts 3 Posters 286 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.
  • H Offline
    H Offline
    HuXiaoer
    wrote on last edited by
    #1
    auto btn = new QPushButton(parent);
    btn->setFixedSize(100,100);
    auto lab = new Qlabel(btn);
    lab->setFixedSize(200,200);
    lab->setStyleSheet("color:#000000");
    

    How can I make the child control display more area than the parent control?
    I expect the result to be a 200X200 black area,and btn is below lab.

    jsulmJ 1 Reply Last reply
    0
    • H HuXiaoer
      auto btn = new QPushButton(parent);
      btn->setFixedSize(100,100);
      auto lab = new Qlabel(btn);
      lab->setFixedSize(200,200);
      lab->setStyleSheet("color:#000000");
      

      How can I make the child control display more area than the parent control?
      I expect the result to be a 200X200 black area,and btn is below lab.

      jsulmJ Online
      jsulmJ Online
      jsulm
      Lifetime Qt Champion
      wrote on last edited by
      #2

      @HuXiaoer You can't. Child is inside parent and as such it can't be bigger than its parent.

      https://forum.qt.io/topic/113070/qt-code-of-conduct

      H 1 Reply Last reply
      0
      • jsulmJ jsulm

        @HuXiaoer You can't. Child is inside parent and as such it can't be bigger than its parent.

        H Offline
        H Offline
        HuXiaoer
        wrote on last edited by
        #3

        @jsulm ok!~ Thank you for your answer.

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

          Hi,

          @jsulm correctly noted, your child can't be bigger than your parent however you can use a QScrollArea to put more widgets in the child and then scroll through it to show the ones you want.

          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