How to delete all children in a QSplitter however hold on to the first child?How do I copy object in Qt?How does delete[] “know” the size of the operand array?How to replace all occurrences of a character in string?How to move QSplitter?How to delete all the children of a Qt window?Detecting when QSplitter child widget is collapsedDelete all children from QVBoxLayoutHow to manage QSplitter in Qt DesignerHide QSplitter child but keep the position of the handleShow QSplitter child widgets titlebarHow do I prevent QSplitter from hiding child widgets completely?
Is it OK to throw pebbles and stones in streams, waterfalls, ponds, etc.?
Does friction always oppose motion?
Does the Grothendieck group of finitely generated modules form a commutative ring where the multiplication structure is induced from tensor product?
Why doesn't SpaceX land boosters in Africa?
Cannot overlay, because ListPlot does not draw same X range despite the same PlotRange
How to extract coefficients of a generating function like this one, using a computer?
How come having a Deathly Hallow is not a big deal?
What verb goes with "coup"?
Are there advantages in writing by hand over typing out a story?
Wings for orbital transfer bioships?
What's the idiomatic (or best) way to trim surrounding whitespace from a string?
Classify 2-dim p-adic galois representations
Why should I allow multiple IP addresses on a website for a single session?
Merging two data frames into a new one with unique items marked with 1 or 0
Finding an optimal set without forbidden subsets
When does it become illegal to exchange bitcoin for cash?
How might boat designs change in order to allow them to be pulled by dragons?
Find the closest three-digit hex colour
What's the difference between the Find Steed and Find Greater Steed spells?
Is it theoretically possible to hack printer using scanner tray?
Aligning arrays within arrays within another array
Why did the Middle Kingdom stop building pyramid tombs?
How does entropy depend on location and scale?
Existence of infinite set of positive integers s.t sum of reciprocals is rational and set of primes dividing an element is infinite
How to delete all children in a QSplitter however hold on to the first child?
How do I copy object in Qt?How does delete[] “know” the size of the operand array?How to replace all occurrences of a character in string?How to move QSplitter?How to delete all the children of a Qt window?Detecting when QSplitter child widget is collapsedDelete all children from QVBoxLayoutHow to manage QSplitter in Qt DesignerHide QSplitter child but keep the position of the handleShow QSplitter child widgets titlebarHow do I prevent QSplitter from hiding child widgets completely?
I have a custom class in which I create a QFrame
, with a QGrid Layout
, that has a QMainWindow
which has a QDockWidget
which owns an OpenGLWidget
. Now that I have all of that out of the way I can show you what it is like to create the class.
std::unique_ptr<QFrame, std::default_delete<QFrame>> MyProgram::createNewRenderWindow(bool hasFeatures)
QGridLayout *baseLayout = new QGridLayout();
auto newBaseFrame = std::make_unique<QFrame>(new QFrame);
auto newRenderView = std::make_unique<RenderView>(hasFeatures);
newBaseFrame->setFrameStyle(QFrame::StyledPanel);
newBaseFrame->setFrameShadow(QFrame::Sunken);
baseLayout->addWidget(newRenderView.release());
newBaseFrame->setLayout(baseLayout);
return newBaseFrame;
The class RenderView is the class that has a QMainWindow
with a QDockWidget
that owns an OpenGLWidget
. I then set that in a QFrame
with a QGridLayout
. Once that is returned, I set it in my gui by calling the following in my constructor:
auto mainRenderView = createNewRenderWindow(false);
ui->splitter->addWidget(mainRenderView.release());
The reason, in this case, that I pass false is because my main render view should have no features enabled in it's dock widget. So I set this one to false because it is my main render window. When I create a new render view, I set this argument to true so that I have all the features of a dock widget.
In my program, I have created a way to create more than one render view, essentially, the ability to split the render view into 4 different windows. However, the main render view is always the same. So if the user wants to add two more windows they can. I do this with the following:
std::unique_ptr<QSplitter, std::default_delete<QSplitter>> MyProgram::createNewSplitter(Qt::Orientation orientation)
auto newSplitter = std::make_unique<QSplitter>(new QSplitter);
auto newTopWindow = createNewRenderWindow(true);
auto newBottomWindow = createNewRenderWindow(true);
newSplitter->setOrientation(orientation);
newSplitter->addWidget(newTopWindow.release());
newSplitter->addWidget(newBottomWindow.release());
newSplitter->setSizes(QList<int>(HALFRENDERVIEWSIZE, HALFRENDERVIEWSIZE));
return newSplitter;
And then I add it to the splitter like this:
auto newWindows = createNewSplitter(Qt::Vertical);
ui->splitter->setOrientation(Qt::Horizontal);
ui->splitter->addWidget(newWindows.release());
ui->splitter->setSizes(QList<int>(HALFRENDERVIEWSIZE, HALFRENDERVIEWSIZE));
This will split the main view in half, and then add two render windows on the right hand side in another QSplitter
. Okay, now that I have explain all of that (hopefully well enough, the program is huge and I don't know how to create a minimal example of this). I can explain the real problem.
I can go from one render view, to two, or to three, or to four if I want to. I can go from four to three or two. However, I cannot go from four to one, three to one, or two to one. And this is a problem with the Copy Constructor as stated in the post I just linked. My first idea, was to extract the main render window from the ui->splitter
, assign it to a new object, erase all of the children, and place the extracted main window back into the ui->splitter
. However, trying that I quickly learned that once I delete the children from the ui->splitter
, I delete the children from the extracted main window.
void MyProgram::on_actionOne_View_triggered()
auto mainRenderView = std::move(ui->splitter->widget(MAINRENDERINDEX));
std::cout << mainRenderView.children().count() << " extracted children" << std::endl;
std::cout << ui->splitter->children().count() << std::endl;
qDeleteAll(ui->splitter->findChildren<QSplitter*>());
std::cout << ui->splitter->children().count() << std::endl;
qDeleteAll(ui->splitter->findChildren<QFrame*>());
std::cout << ui->splitter->children().count() <<std::endl;
std::cout << mainRenderView.children().count() << " extracted children" << std::endl;
ui->splitter->addWidget(mainRenderView.release());
The first print statement will print out 2, which tells me that I have successfully extracted the widget that I wanted. I then print out the total number of children that ui->splitter
has. Which tells me it has 4 children. I then delete all of the QSplitters
and print out the number, which leaves the QFrames
, that reports there are two QFrames
left. I then delete the QFrames
and it reports back 0 children left in the ui->splitter
. However, I then print out the children mainRenderView
has and it reports back 0. Then it tries to insert the extracted widget into the ui->splitter
and crashes the program since there is nothing to insert.
What is the best way to do this? I have toyed with the idea of creating my own copy method, however I have read you just don't do that. Is there anyway to delete all of the children and go back to the starting state that the program launches in?
c++ qt copy
add a comment |
I have a custom class in which I create a QFrame
, with a QGrid Layout
, that has a QMainWindow
which has a QDockWidget
which owns an OpenGLWidget
. Now that I have all of that out of the way I can show you what it is like to create the class.
std::unique_ptr<QFrame, std::default_delete<QFrame>> MyProgram::createNewRenderWindow(bool hasFeatures)
QGridLayout *baseLayout = new QGridLayout();
auto newBaseFrame = std::make_unique<QFrame>(new QFrame);
auto newRenderView = std::make_unique<RenderView>(hasFeatures);
newBaseFrame->setFrameStyle(QFrame::StyledPanel);
newBaseFrame->setFrameShadow(QFrame::Sunken);
baseLayout->addWidget(newRenderView.release());
newBaseFrame->setLayout(baseLayout);
return newBaseFrame;
The class RenderView is the class that has a QMainWindow
with a QDockWidget
that owns an OpenGLWidget
. I then set that in a QFrame
with a QGridLayout
. Once that is returned, I set it in my gui by calling the following in my constructor:
auto mainRenderView = createNewRenderWindow(false);
ui->splitter->addWidget(mainRenderView.release());
The reason, in this case, that I pass false is because my main render view should have no features enabled in it's dock widget. So I set this one to false because it is my main render window. When I create a new render view, I set this argument to true so that I have all the features of a dock widget.
In my program, I have created a way to create more than one render view, essentially, the ability to split the render view into 4 different windows. However, the main render view is always the same. So if the user wants to add two more windows they can. I do this with the following:
std::unique_ptr<QSplitter, std::default_delete<QSplitter>> MyProgram::createNewSplitter(Qt::Orientation orientation)
auto newSplitter = std::make_unique<QSplitter>(new QSplitter);
auto newTopWindow = createNewRenderWindow(true);
auto newBottomWindow = createNewRenderWindow(true);
newSplitter->setOrientation(orientation);
newSplitter->addWidget(newTopWindow.release());
newSplitter->addWidget(newBottomWindow.release());
newSplitter->setSizes(QList<int>(HALFRENDERVIEWSIZE, HALFRENDERVIEWSIZE));
return newSplitter;
And then I add it to the splitter like this:
auto newWindows = createNewSplitter(Qt::Vertical);
ui->splitter->setOrientation(Qt::Horizontal);
ui->splitter->addWidget(newWindows.release());
ui->splitter->setSizes(QList<int>(HALFRENDERVIEWSIZE, HALFRENDERVIEWSIZE));
This will split the main view in half, and then add two render windows on the right hand side in another QSplitter
. Okay, now that I have explain all of that (hopefully well enough, the program is huge and I don't know how to create a minimal example of this). I can explain the real problem.
I can go from one render view, to two, or to three, or to four if I want to. I can go from four to three or two. However, I cannot go from four to one, three to one, or two to one. And this is a problem with the Copy Constructor as stated in the post I just linked. My first idea, was to extract the main render window from the ui->splitter
, assign it to a new object, erase all of the children, and place the extracted main window back into the ui->splitter
. However, trying that I quickly learned that once I delete the children from the ui->splitter
, I delete the children from the extracted main window.
void MyProgram::on_actionOne_View_triggered()
auto mainRenderView = std::move(ui->splitter->widget(MAINRENDERINDEX));
std::cout << mainRenderView.children().count() << " extracted children" << std::endl;
std::cout << ui->splitter->children().count() << std::endl;
qDeleteAll(ui->splitter->findChildren<QSplitter*>());
std::cout << ui->splitter->children().count() << std::endl;
qDeleteAll(ui->splitter->findChildren<QFrame*>());
std::cout << ui->splitter->children().count() <<std::endl;
std::cout << mainRenderView.children().count() << " extracted children" << std::endl;
ui->splitter->addWidget(mainRenderView.release());
The first print statement will print out 2, which tells me that I have successfully extracted the widget that I wanted. I then print out the total number of children that ui->splitter
has. Which tells me it has 4 children. I then delete all of the QSplitters
and print out the number, which leaves the QFrames
, that reports there are two QFrames
left. I then delete the QFrames
and it reports back 0 children left in the ui->splitter
. However, I then print out the children mainRenderView
has and it reports back 0. Then it tries to insert the extracted widget into the ui->splitter
and crashes the program since there is nothing to insert.
What is the best way to do this? I have toyed with the idea of creating my own copy method, however I have read you just don't do that. Is there anyway to delete all of the children and go back to the starting state that the program launches in?
c++ qt copy
Never done this myself with Qt but I would expect that you need to usesetParent
on your first child to move it from the splitter to another parent (do not delete your first child).
– Eelke
Mar 26 at 5:48
add a comment |
I have a custom class in which I create a QFrame
, with a QGrid Layout
, that has a QMainWindow
which has a QDockWidget
which owns an OpenGLWidget
. Now that I have all of that out of the way I can show you what it is like to create the class.
std::unique_ptr<QFrame, std::default_delete<QFrame>> MyProgram::createNewRenderWindow(bool hasFeatures)
QGridLayout *baseLayout = new QGridLayout();
auto newBaseFrame = std::make_unique<QFrame>(new QFrame);
auto newRenderView = std::make_unique<RenderView>(hasFeatures);
newBaseFrame->setFrameStyle(QFrame::StyledPanel);
newBaseFrame->setFrameShadow(QFrame::Sunken);
baseLayout->addWidget(newRenderView.release());
newBaseFrame->setLayout(baseLayout);
return newBaseFrame;
The class RenderView is the class that has a QMainWindow
with a QDockWidget
that owns an OpenGLWidget
. I then set that in a QFrame
with a QGridLayout
. Once that is returned, I set it in my gui by calling the following in my constructor:
auto mainRenderView = createNewRenderWindow(false);
ui->splitter->addWidget(mainRenderView.release());
The reason, in this case, that I pass false is because my main render view should have no features enabled in it's dock widget. So I set this one to false because it is my main render window. When I create a new render view, I set this argument to true so that I have all the features of a dock widget.
In my program, I have created a way to create more than one render view, essentially, the ability to split the render view into 4 different windows. However, the main render view is always the same. So if the user wants to add two more windows they can. I do this with the following:
std::unique_ptr<QSplitter, std::default_delete<QSplitter>> MyProgram::createNewSplitter(Qt::Orientation orientation)
auto newSplitter = std::make_unique<QSplitter>(new QSplitter);
auto newTopWindow = createNewRenderWindow(true);
auto newBottomWindow = createNewRenderWindow(true);
newSplitter->setOrientation(orientation);
newSplitter->addWidget(newTopWindow.release());
newSplitter->addWidget(newBottomWindow.release());
newSplitter->setSizes(QList<int>(HALFRENDERVIEWSIZE, HALFRENDERVIEWSIZE));
return newSplitter;
And then I add it to the splitter like this:
auto newWindows = createNewSplitter(Qt::Vertical);
ui->splitter->setOrientation(Qt::Horizontal);
ui->splitter->addWidget(newWindows.release());
ui->splitter->setSizes(QList<int>(HALFRENDERVIEWSIZE, HALFRENDERVIEWSIZE));
This will split the main view in half, and then add two render windows on the right hand side in another QSplitter
. Okay, now that I have explain all of that (hopefully well enough, the program is huge and I don't know how to create a minimal example of this). I can explain the real problem.
I can go from one render view, to two, or to three, or to four if I want to. I can go from four to three or two. However, I cannot go from four to one, three to one, or two to one. And this is a problem with the Copy Constructor as stated in the post I just linked. My first idea, was to extract the main render window from the ui->splitter
, assign it to a new object, erase all of the children, and place the extracted main window back into the ui->splitter
. However, trying that I quickly learned that once I delete the children from the ui->splitter
, I delete the children from the extracted main window.
void MyProgram::on_actionOne_View_triggered()
auto mainRenderView = std::move(ui->splitter->widget(MAINRENDERINDEX));
std::cout << mainRenderView.children().count() << " extracted children" << std::endl;
std::cout << ui->splitter->children().count() << std::endl;
qDeleteAll(ui->splitter->findChildren<QSplitter*>());
std::cout << ui->splitter->children().count() << std::endl;
qDeleteAll(ui->splitter->findChildren<QFrame*>());
std::cout << ui->splitter->children().count() <<std::endl;
std::cout << mainRenderView.children().count() << " extracted children" << std::endl;
ui->splitter->addWidget(mainRenderView.release());
The first print statement will print out 2, which tells me that I have successfully extracted the widget that I wanted. I then print out the total number of children that ui->splitter
has. Which tells me it has 4 children. I then delete all of the QSplitters
and print out the number, which leaves the QFrames
, that reports there are two QFrames
left. I then delete the QFrames
and it reports back 0 children left in the ui->splitter
. However, I then print out the children mainRenderView
has and it reports back 0. Then it tries to insert the extracted widget into the ui->splitter
and crashes the program since there is nothing to insert.
What is the best way to do this? I have toyed with the idea of creating my own copy method, however I have read you just don't do that. Is there anyway to delete all of the children and go back to the starting state that the program launches in?
c++ qt copy
I have a custom class in which I create a QFrame
, with a QGrid Layout
, that has a QMainWindow
which has a QDockWidget
which owns an OpenGLWidget
. Now that I have all of that out of the way I can show you what it is like to create the class.
std::unique_ptr<QFrame, std::default_delete<QFrame>> MyProgram::createNewRenderWindow(bool hasFeatures)
QGridLayout *baseLayout = new QGridLayout();
auto newBaseFrame = std::make_unique<QFrame>(new QFrame);
auto newRenderView = std::make_unique<RenderView>(hasFeatures);
newBaseFrame->setFrameStyle(QFrame::StyledPanel);
newBaseFrame->setFrameShadow(QFrame::Sunken);
baseLayout->addWidget(newRenderView.release());
newBaseFrame->setLayout(baseLayout);
return newBaseFrame;
The class RenderView is the class that has a QMainWindow
with a QDockWidget
that owns an OpenGLWidget
. I then set that in a QFrame
with a QGridLayout
. Once that is returned, I set it in my gui by calling the following in my constructor:
auto mainRenderView = createNewRenderWindow(false);
ui->splitter->addWidget(mainRenderView.release());
The reason, in this case, that I pass false is because my main render view should have no features enabled in it's dock widget. So I set this one to false because it is my main render window. When I create a new render view, I set this argument to true so that I have all the features of a dock widget.
In my program, I have created a way to create more than one render view, essentially, the ability to split the render view into 4 different windows. However, the main render view is always the same. So if the user wants to add two more windows they can. I do this with the following:
std::unique_ptr<QSplitter, std::default_delete<QSplitter>> MyProgram::createNewSplitter(Qt::Orientation orientation)
auto newSplitter = std::make_unique<QSplitter>(new QSplitter);
auto newTopWindow = createNewRenderWindow(true);
auto newBottomWindow = createNewRenderWindow(true);
newSplitter->setOrientation(orientation);
newSplitter->addWidget(newTopWindow.release());
newSplitter->addWidget(newBottomWindow.release());
newSplitter->setSizes(QList<int>(HALFRENDERVIEWSIZE, HALFRENDERVIEWSIZE));
return newSplitter;
And then I add it to the splitter like this:
auto newWindows = createNewSplitter(Qt::Vertical);
ui->splitter->setOrientation(Qt::Horizontal);
ui->splitter->addWidget(newWindows.release());
ui->splitter->setSizes(QList<int>(HALFRENDERVIEWSIZE, HALFRENDERVIEWSIZE));
This will split the main view in half, and then add two render windows on the right hand side in another QSplitter
. Okay, now that I have explain all of that (hopefully well enough, the program is huge and I don't know how to create a minimal example of this). I can explain the real problem.
I can go from one render view, to two, or to three, or to four if I want to. I can go from four to three or two. However, I cannot go from four to one, three to one, or two to one. And this is a problem with the Copy Constructor as stated in the post I just linked. My first idea, was to extract the main render window from the ui->splitter
, assign it to a new object, erase all of the children, and place the extracted main window back into the ui->splitter
. However, trying that I quickly learned that once I delete the children from the ui->splitter
, I delete the children from the extracted main window.
void MyProgram::on_actionOne_View_triggered()
auto mainRenderView = std::move(ui->splitter->widget(MAINRENDERINDEX));
std::cout << mainRenderView.children().count() << " extracted children" << std::endl;
std::cout << ui->splitter->children().count() << std::endl;
qDeleteAll(ui->splitter->findChildren<QSplitter*>());
std::cout << ui->splitter->children().count() << std::endl;
qDeleteAll(ui->splitter->findChildren<QFrame*>());
std::cout << ui->splitter->children().count() <<std::endl;
std::cout << mainRenderView.children().count() << " extracted children" << std::endl;
ui->splitter->addWidget(mainRenderView.release());
The first print statement will print out 2, which tells me that I have successfully extracted the widget that I wanted. I then print out the total number of children that ui->splitter
has. Which tells me it has 4 children. I then delete all of the QSplitters
and print out the number, which leaves the QFrames
, that reports there are two QFrames
left. I then delete the QFrames
and it reports back 0 children left in the ui->splitter
. However, I then print out the children mainRenderView
has and it reports back 0. Then it tries to insert the extracted widget into the ui->splitter
and crashes the program since there is nothing to insert.
What is the best way to do this? I have toyed with the idea of creating my own copy method, however I have read you just don't do that. Is there anyway to delete all of the children and go back to the starting state that the program launches in?
c++ qt copy
c++ qt copy
asked Mar 25 at 17:27
SailanarmoSailanarmo
4734 silver badges16 bronze badges
4734 silver badges16 bronze badges
Never done this myself with Qt but I would expect that you need to usesetParent
on your first child to move it from the splitter to another parent (do not delete your first child).
– Eelke
Mar 26 at 5:48
add a comment |
Never done this myself with Qt but I would expect that you need to usesetParent
on your first child to move it from the splitter to another parent (do not delete your first child).
– Eelke
Mar 26 at 5:48
Never done this myself with Qt but I would expect that you need to use
setParent
on your first child to move it from the splitter to another parent (do not delete your first child).– Eelke
Mar 26 at 5:48
Never done this myself with Qt but I would expect that you need to use
setParent
on your first child to move it from the splitter to another parent (do not delete your first child).– Eelke
Mar 26 at 5:48
add a comment |
0
active
oldest
votes
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55343403%2fhow-to-delete-all-children-in-a-qsplitter-however-hold-on-to-the-first-child%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
0
active
oldest
votes
0
active
oldest
votes
active
oldest
votes
active
oldest
votes
Is this question similar to what you get asked at work? Learn more about asking and sharing private information with your coworkers using Stack Overflow for Teams.
Is this question similar to what you get asked at work? Learn more about asking and sharing private information with your coworkers using Stack Overflow for Teams.
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55343403%2fhow-to-delete-all-children-in-a-qsplitter-however-hold-on-to-the-first-child%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Never done this myself with Qt but I would expect that you need to use
setParent
on your first child to move it from the splitter to another parent (do not delete your first child).– Eelke
Mar 26 at 5:48