In my application, I have QTabWidget with 3 pages with controls designed in it, using Qt creator 2.4.1. now I want to separate the functionality of these pages from MainWindow by creating new classes.
My question is how to access the MainWindow::ui instance in my new class ? which is declared in private.
it is a qt-desktop application and platform is qt 4.8.1/win 7.
You can not directly access ui of MainWindow in your tabs. As your QTabWidget is child of MainWindow (This is how it should be implemented and assume you did so).
But you can achieve this by Signals and Slots.You can perform operations in your MainWindow by writing slots to signals emitted from individual tabs.
OR
You can write a method on the MainWindow which will operate on it’s UI. And call it from the tab widget by-