What does ScopeFrame derive from?
Cheers,
_
What does ScopeFrame derive from?
Cheers,
_
							
						
					
					
						
    
    
    
    
    
  Whoops sorry it would have been better to tell straight away. Ui_radarScopeFrame is a Qt designer generated class, as you would have guessed.
Qt Code:
 def __init__(self, init_contacts, parent=None): self.setupUi(self) self.scene = RadarScene(init_contacts, self) self.scopeView.setScene(self.scene) ## ... etc. ...To copy to clipboard, switch view to plain text mode
Which template is this based on?
Dialog?
Dialogs are traditionally kept on top of their parent.
Any normal widget created without a parent will also become a top level window.
Cheers,
_
							
						
					
					
						
    
    
    
    
    
  Ui_... also is a QWidget. If I set no parent, I only get a working window if I keep a reference to it in main, otherwise it closes straight away. So I would need to build a list of opened windows, detect which one closes (how actually?) to remove the reference. Incidentally, no menu bar in the new windows. All correct?
And so, there is no way to stop stay-on-top for child windows?
Strange, a normal widget should not even show up as a window if it has a parent, it should become part of the parent.
Your setWindowFlags call probably allows that even when given a parent.
That "close if not referenced" thing is an artifact introduced by Python. Since it is a garbage collector oriented language, all unreference objects get deleted at some point.
I am not sure what you mean with "no menu bar", you are deriving from QWidget, menu bar's is a feature of QMainWindow
Cheers,
_
							
						
					
					
						
    
    
    
    
    
  Yes, it behaves as you say when I do not set it.
Yes I had guessed that, but of course I cannot do without it.
Perhaps a WM thing as well: when parent is main window, the app menu bar is available there as well.
Thank you very much for all your answers.
							
						
					
					
						
    
    
    
    
    
  
    
    
    
    
  Can't you parent these widgets to some other QObject like the application instance? You can still close them with the main window by connecting their close() slot to a signal that you emit yourself from inside the main window closeEvent() handler. The behaviour is the same.
As for the on-top behaviour, when the widgets are not parented to the main window anymore, I think setting WA_ShowWithoutActivating on the new widget 'before' showing it, then showing it and then using activateWindow() on the main window (or whatever widget was at the top before the creation of this new widget) to ensure it continues as the top window, is worth a try.
http://stackoverflow.com/a/1022121/4206247
Last edited by Kryzon; 14th August 2015 at 20:58.
Bookmarks