PDA

View Full Version : QWorkspace



fellobo
28th April 2006, 17:44
I have a QWorkspace that has MDI's within them. I have a grab the signal sent out and plug it into a slot when one of the MDI's is activated this passes me the QWidget of the MDI that is activated but I want to know the QWidget of the MDI that just lost focus (or the one that gets deactivated.)

Looking at the code it looks like they just go and deactivate all other windows and I don't see them sending any signals out of the window loosing focus. Does anyone know of how they do this?

jacek
28th April 2006, 18:00
Maybe it will be enough if you just save a pointer to the current active window somewhere?

fellobo
28th April 2006, 18:28
Yes, thanks for the comments, I did this but thought it would be nice to have a signal/slot available....

Another questions:
What about close; if someone closes a MDI child does it send out an event closeAcitveWindow()? Or how do you realize if something is closed?

I know I can go through the list of windows but really would like to have a QWorkspace send out a signal telling me that something was closed!

fellobo
28th April 2006, 19:30
So I finally found the way to do this and in retrospect I can't see why I didn't see this before. But what I did is in the QWidget that I add to the workspace I overwrote the closeEvent and then sent out a signal saying that I was closing. Then I connected that with my mainwindow to get the event. It wasn't the ideal solution but it will work.

jpn
28th April 2006, 19:31
Another questions:
What about close; if someone closes a MDI child does it send out an event closeAcitveWindow()? Or how do you realize if something is closed?

One simple solution could be to install an event filter on all MDI childs and detect the close event that way.



I know I can go through the list of windows but really would like to have a QWorkspace send out a signal telling me that something was closed!
Agreed. QWorkspace could provide more signals, indeed..