PDA

View Full Version : Manage controls inside QTabWidget tabs area directly form QWidget derivated object



Suppaman
7th May 2013, 08:35
Hi all

I created an application using QTabWidget as main control. I have some tabs and I associated to each tab a QWidget derivated object through QT Designer (Selected tab control -> Promote to -> Name of my QWidget derivated class). This way I have my derivated class created and loaded directly using the .xml form file. Now I have an additonal need. I want to manage each control inside my tab widget direcly from the QWidget derivated control. Just to explain better I have a button control inside the tab area called "MyButton". If I created the private slot function "on_MyButton_clicked()" inside the QWidget derivated object (tha we can call "MyTabPanel" for example) it doesn't work (the function is not called if I click the button). On the contrary it work if I move and manage this function inside the main class of the window application. Is there some way to have "redirected" all the events regarding the controls inside the tab widget area to the connected QWidegt derivated object associated to the tab?

Thank you

Santosh Reddy
10th May 2013, 10:15
If I created the private slot function "on_MyButton_clicked()" inside the QWidget derivated object (tha we can call "MyTabPanel" for example) it doesn't work (the function is not called if I click the button).
How are you making the connection?


Is there some way to have "redirected" all the events regarding the controls inside the tab widget area to the connected QWidegt derivated object associated to the tab?
First thing signal/slots are different from events. You can send both events and signals to any known QObject derived object. So answer your question, Yes it is possible.

Suppaman
10th May 2013, 10:20
Hi

Thank you for your reply. After some tries I found using QStackedWidget component can manage "internal" widgets as I need. I only have to add a "manager" like the tabs for switch between various window windgets but this is not a big problem. This allow me to use all the advantage of "automitic" signal/slot connection offered using QT Designer tool. :)