Why so complicated?
Why not just call updateMoveState directly from send_move_signal?
Cheers,
_
Why so complicated?
Why not just call updateMoveState directly from send_move_signal?
Cheers,
_
Thanks for your answer ,
I just started learning to make Mdi Apps ,
so, yes my solutions might be complicated
how can i do it ??
I tried this :
Qt Code:
def send_move_signal(self): currentMdi = self.mdiArea.activeSubWindow() currentMdi.updateMoveState()To copy to clipboard, switch view to plain text mode
But Got error : " QMdiSubWindow " has no attribute updateMoveState
If i created an instance to the last opened MdiSubWindow it will work only on the last one but i want this signal to act on the current active Window
Thanks,
Ah, I would have assumed that Python's duck typing would recognize the method in your subclass.
Then, how about this:
- connect the button to all MdiWid instances
- inside updateMoveState() you check if this is the active window. If yes you do something, if not you ignore the method call
Cheers,
_
That doesn't make any sense.
You have an instance of your sub window class for every sub window.
A window that doesn't exist isn't there at all.
In C++ that would be a cast, look for whatever mechanism Python uses for such type conversions.
Cheers,
_
here's the function that load the document ( QWidget ) :
Qt Code:
def load(self): ImageProject = OIWid() self.mdiArea.addSubWindow(ImageProject)To copy to clipboard, switch view to plain text mode
i skipped details , but that's it. it's the code that load my widget.
if i make ImageProject an instance variable of my main class ( QMainWindow ) : self.ImageProject instead of ImageProject,
the last opened Project would be self.ImageProject and not the current active window !
Last edited by Qtdigitex; 18th July 2016 at 22:22.
In you first post you had a class MdiWid, but I can't see that being used in your newest code snippet.
Cheers,
_
Hi , i finaly found the solution :
i only needed to use the QMdiSubWindow's method : widget() to be able to acess my currently opened widget's methods and signals ...
SO it will become :
Qt Code:
self.mdiArea.activeSubWindow().widget().update_move_state()To copy to clipboard, switch view to plain text mode
instead of :
Qt Code:
self.mdiArea.activeSubWindow().update_move_state()To copy to clipboard, switch view to plain text mode
Bookmarks