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

        this->topToolBar->removeAction(backToMainVert);
        slidingStacked->slideInIdx(0);
The problem is that the first time I switch to the second page, 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 go to the second page, the backBarButton never appears.

Any idea what I'm missing here please ?

Thanks in advance, I'm stuck.

Miky Mike
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

        this->topToolBar->removeAction(backToMainVert);
        slidingStacked->slideInIdx(0);
The problem is that the first time I switch to the second page, 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 go to the second page, the backBarButton never appears.

Any idea what I'm missing here please ?

Thanks in advance, I'm stuck.

Miky Mike