Moving a widget automatically out of the way of main window?
-
I have a Qt Widget created with a class. In my program, I have two windows: a main window and a widget that shows information about the main window in real time. Showing the widget is pretty straightforward:
otherWindow = new otherWindow //otherWindow is the class of the widget
otherWindow.show();The problem is that the widget appears on top of the main window. This isn't really a problem per se, as the user can just move it out of the way, but is there a way to make the other window appear, say next to the main window rather than on top of it?
-
Shouldn't be too hard. You can simply move() the secondary window, e.g. in its showEvent() function. All you need to know is the position and the size of the primary window, of course. But I assume the primary window is the parent of the secondary window, so you can simply use parent() to get a pointer.