PDA

View Full Version : New instance of UI to inherit the current event



kiboi
23rd October 2012, 08:33
Hi all! I'm currently designing a UI placed on the 1st tabwidget. I get the instance of the UI in the 1st tab in order to appear on the 2nd tab having the same UI. if i had an event done in the 1st tab, how can i let the event pass into the new instance of UI in the 2nd tab???

Added after 4 minutes:

By the way, im using multiple instance of the UI and want to pass the event so that, what ever i made on the 1st tab, it should also appear on the 2nd tab, since they have the same ui. thanks!

Zlatomir
23rd October 2012, 10:20
You can use signal-slot and connect same slot of both ui class instances to the same signals, maybe you need to do this in the parent when you create both instances - this depends on your "event" and design of your code, or maybe you need the parent to have signals for events and each tab will emit a signal to parent and that parent signal is connected to both slots that actually change the widgets...
I think you are the one that can choose the best option for this, because you know your design and code, for us it might sound strange from beginning (same ui appear twice).

Anyway i have to add only that you can connect signal to another signal... so the: emit signal that is connected to extra "parent" (or maybe mainwindow?) signal that is connected to both slots in each ui instance is doable and this way you don't hold cross references (or pointers) to the ui instances.

kiboi
23rd October 2012, 11:13
thanks! yes it sound strange... im having a progress bar for both tabs. so if i have an ongoing process in 1st tab, when i transferred to 2nd tab, the status of the progress bar must also appear and vice versa.