Qt Pb with QAction, QToolBar, QToolButton
I got a problem here.
I'm building a Qt app that uses slidingStackedWidgets in order to slide from one page to another one.
I have 2 toolBars, a topToolBar and a bottomToolBar that do not slide when the central widget moves.
So I have declared a QAction in my mainWindow.h
@ QAction *backToMainVert;@
And in my mainWindow.cpp, when I call the second view by clicking a button, I call a slideInAdd() method that goes like this:
slidingStacked->slideInIdx(1); //this takes me back to my second page
backToMainVert = this->topToolBar->addWidget(backBarButton);
//this adds a backButton to the topToolBar@
Now the backBarButton is connected to a slideToMain() method which, when triggered takes me back to my first page and removes the backBarButton from the topToolBar
The first time I switch to the second page, no problem, my button is created and displayed on my topToolBar.
When I click the backBarButton, it goes back to the first page.
BUT the second time I want to return from the first page to the second page, the backBarButton never appears.
Uh, maybe this can help, here is the way I instantiate my backBarButton :
@backBarButton = new QToolButton(this);
"background-position: center center;"
"color : white;"
"color : white;");@
Any idea what I'm missing here please ?
Thanks in advance, I'm stuck.
there is code missing to have more knowledge on your problem:
how do you slide back and what do you do in that code (esp. with the back button)
I'm not sure, what removeAction does exactly (with the action and the button)