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 create a QSplitter with a widget that appears only after a button click event?
Forum Updated to NodeBB v4.3 + New Features

How create a QSplitter with a widget that appears only after a button click event?

Scheduled Pinned Locked Moved Solved General and Desktop
6 Posts 3 Posters 401 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.
  • L Offline
    L Offline
    leonardoMB
    wrote on last edited by
    #1

    Hi I have a Widget that only appears after I click on a button and another that appears all the time, When I click the button this widget that appears all the time is resized to support the other. I want to create a splitter between these two, but the splitter should only appear after I click the button, How do I implement it?

    JonBJ M 2 Replies Last reply
    0
    • L leonardoMB

      @mpergand it Worked, now I have another problem with splitter. To use a Splitter I have to put the QSplitter object itself right? I mean, Can I use the two objects that makes part of the Splitter in two different gridLayout cells?

      JonBJ Online
      JonBJ Online
      JonB
      wrote on last edited by
      #6

      @leonardoMB
      No. A QSplitter is a widget itself, and can only be in one place, such as a single QGridLayout cell. Then the child widgets it manages are inside it, and hence inside that one cell.

      Depending on your needs, you could span across multiple cells. You can also of course put different widgets in different cells and control e.g. their visibility, that one only one is shown at any one time. But neither of these allow placement of splitters or their child widgets in multiple cells.

      1 Reply Last reply
      1
      • L leonardoMB

        Hi I have a Widget that only appears after I click on a button and another that appears all the time, When I click the button this widget that appears all the time is resized to support the other. I want to create a splitter between these two, but the splitter should only appear after I click the button, How do I implement it?

        JonBJ Online
        JonBJ Online
        JonB
        wrote on last edited by
        #2

        @leonardoMB
        Only show() the QSplitter in the button click handler?

        L 1 Reply Last reply
        1
        • L leonardoMB

          Hi I have a Widget that only appears after I click on a button and another that appears all the time, When I click the button this widget that appears all the time is resized to support the other. I want to create a splitter between these two, but the splitter should only appear after I click the button, How do I implement it?

          M Offline
          M Offline
          mpergand
          wrote on last edited by
          #3

          @leonardoMB
          Simply show/hide the second widget on a click to the button:

          connect(ui->pushButton,&QPushButton::clicked,this, [this](bool)
          {
              ui->widget2->setVisible(!ui->widget2->isVisible());
              });
          
          }
          
          L 1 Reply Last reply
          1
          • JonBJ JonB

            @leonardoMB
            Only show() the QSplitter in the button click handler?

            L Offline
            L Offline
            leonardoMB
            wrote on last edited by
            #4
            This post is deleted!
            1 Reply Last reply
            0
            • M mpergand

              @leonardoMB
              Simply show/hide the second widget on a click to the button:

              connect(ui->pushButton,&QPushButton::clicked,this, [this](bool)
              {
                  ui->widget2->setVisible(!ui->widget2->isVisible());
                  });
              
              }
              
              L Offline
              L Offline
              leonardoMB
              wrote on last edited by
              #5

              @mpergand it Worked, now I have another problem with splitter. To use a Splitter I have to put the QSplitter object itself right? I mean, Can I use the two objects that makes part of the Splitter in two different gridLayout cells?

              JonBJ 1 Reply Last reply
              0
              • L leonardoMB

                @mpergand it Worked, now I have another problem with splitter. To use a Splitter I have to put the QSplitter object itself right? I mean, Can I use the two objects that makes part of the Splitter in two different gridLayout cells?

                JonBJ Online
                JonBJ Online
                JonB
                wrote on last edited by
                #6

                @leonardoMB
                No. A QSplitter is a widget itself, and can only be in one place, such as a single QGridLayout cell. Then the child widgets it manages are inside it, and hence inside that one cell.

                Depending on your needs, you could span across multiple cells. You can also of course put different widgets in different cells and control e.g. their visibility, that one only one is shown at any one time. But neither of these allow placement of splitters or their child widgets in multiple cells.

                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