Qt - new widget display not apparent?
I'm coming from Android d开发者_运维百科evelopment, and their approach to opening a new "activity" from a current one seems logical, and documented. Qt's does not.
Let's say I have the exact "QTabsExample", and inside one of these tabs is a button. On button click, I want to get rid of all the tabs and open a different view...let's say an image view. Why does there not seem to be one example out there for this? Please help!
I believe you would want to use a QStackedWidget in this case. A QStackedWidget
manages a number of same sized "screens" that you can switch between, each having its own set of display widgets and buttons. Here is an S60 example, hopefully it will apply to your situation but you should be able to find more info on using QStackedWidget
s.
If you want to remove the container of the widget a better solution is to send a signal to the window and the window will then swap the main containers, otherwise things can get nasty if you try to delete / remove the parent object from the child action method.
精彩评论