Creating events instead of signals/slots
-
@Volker:I had done that earlier.How well can I organise these so as to have the control to close my other windows?Just like as we have goto in C.
-
It's the same task as if you had events dropping in.
EDIT:
And as C++ is a superset of C, you have goto - if you really want to use this. -
Can I traverse from 1st MainWindow to some 15th MainWindow that I have in my application?How well can I do this with signals?
-
What do you mean with "traverse"? Call each of them in sequence?
Of course you can do this. Qt does it all the time. Slots are invoked in the order the connections are created, so that would also "traverse".
-
The GUI should respond depending upon the event received from the C running as back-end.
-
OK, here's what I would do, and then I think I'll quit responding to this thread.
I would create a single QObject that is responsible for the communication with the C-based backend. This object receives the call-backs or events or whatever you call them from the backend, and emits corresponding signals for these events. The different windows connect to this object's signals to learn about the data they are interested in.
-
-
[quote author="Revu" date="1301986907"]@Andre:Thank you for your response.Could you explain the same with a code snippet please.So that I can understand better.[/quote]
Not without knowing what your back end looks like and how to communicate with it, no. And to be honest, I don't think I can or want to do that even if you provided the needed code and documentation. I think the concept should be clear though?
-
I have multiple screens for a outgoing call like Idle,Dial,Progress and Connect screen.My backend controller program is in C.I need to change from Idle to Dial.After I enter the number show progress screen and finally connect screen after the call is established.Based on the events I get from C,my screen will change.Its like with button click I will wait for an event and then display the screen.While showing the other screen,am closing the current(using signal and slot mechanism).So how could I do that with events.
-
Now you are just asking the same question all over again. Sorry, but you really have to do your actual work yourself. Many people have already chimed in to try to help you, but if you just keep repeating your question, we're getting nowhere.
Perhaps a simple state machine is what you want? The different events from your backend could trigger state changes (read the documentation on QStateMachine before asking here how that works!) and your different states could determine what screen is visible.
-
Another solution (which I personally prefer) is to make a "Controller" object (derived from QObject) which encapsulates the non Qt interface (your C-backend) in a "facade design pattern":http://en.wikipedia.org/wiki/Facade_pattern . This goes to the direction -Andrea- Andre posted before the state machine.
This controller object then sends signals which can be connected to anyone, who needs to know them... This is something we do often here with COM interfaces we have to use. It works well.
Edit: my name is Andre