PDA

View Full Version : A Qwidget , setparent and Qwindow flags problem.



tonnot
17th August 2011, 13:54
I have a custom Qwidget with movement capabilities (using the mouse).
Ok, this QWidget works fine when it is inserted into any other widget, that is, I can move it inside the limits of the widget where I placed it.
Now I'd want to do the same but having this custom QWidget floating on the desktop.

Ok, I have a UI where I have the custom Widget (I prefer to use the designer to design my interface). Now my questions are :
- Can I 'load' only my Custom Widget ? (I dont want neither need the main QWidget)
(Now I have the problem that my Custom widget is moving inside the Ui main QWidget )
- And how can I can say it 'Your parent is this application, but your 'free world' is the desktop'
I hope you understand what I want . Thanks.

wysota
17th August 2011, 22:49
- Can I 'load' only my Custom Widget ? (I dont want neither need the main QWidget)
Load it where?


- And how can I can say it 'Your parent is this application, but your 'free world' is the desktop'
If I understand correctly what you want then you can't. The only thing you can do is to make your widget a classic window and set a hint on it to bypass the window manager. Then you can use approaches such as these mentioned below to operate on the widget.


Moving widgets
http://labs.qt.nokia.com/2009/03/20/moving-top-level-window-by-dragging/

tonnot
18th August 2011, 07:26
Thanks WY.
Anwsering you, to the first. Imagine I have a ui with 25 Qframes (each one for a specific purpose and with different buttons and other widgets). Imagine I want to show a dialog with the Qframe 12 (only). A solution can be : 1.- hide de tab widget where I have organized my 25 Qframes. 2.- Set the parent of Qframe 12 to main layout. 3.- Show the dialog.
I have 24 unused frames. This is the reason because I'd like to have a way to 'load' only the Qframe12.

To the second:
I have now this :

A_analyzer = new A_analyzer(qApp->activeWindow());
Inside A_analyzer constuctor :

Qt::WindowFlags flags = 0;
flags = Qt::SplashScreen;
this->setWindowFlags(flags);
this->move(0,0)

Ok, I see my widget-window without title (this is what I want). But, it would not have to be contained by qApp->activeWindow() ??? this->move(0,0) place the window at top-left of the screen, not at 0,0 of the activeWindow. Maybe the flag SplashScreen let my 'window' can live into the whole desktop?????

Thanks