mardi 21 avril 2015

Qt - Toggle A QAction To Set QStackedWidget's Current Widget

So what I am trying to do is when I press the showMenu (QAction), the container (QStackedWidget) changes the current widget to menuWidget AND when I press it again it hides.

Ok so I have managed to get this code:

connect(showMenu, SIGNAL(triggered()), map, SLOT(map()));
map->setMapping(menuWidget, container);
Object::connect(map, SIGNAL(mapped(QWidget *)), container, SLOT(setCurrentWidget(QWidget *)));

also if I run:

container->setCurrentWidget(menuWidget);

directly, it works fine, so I have not messed up in that way.

Aucun commentaire:

Enregistrer un commentaire