PDA

View Full Version : Displaying on multiple desktops?



nupul
4th May 2006, 05:26
I have two desktops. I wish that a particular widget (say Mod2) window appear on the 2nd desktop screen....i.e. a screen different from the one where the main application (say Mod1) resides. My app desires this peculiar behavior.

I went through the docs and read through QDesktopWidget which gives me access to the screen info, but couldn't find a way to make the widget appear on a different desktop!

How should I achieve this?

Thanks

Nupul.

ChristianEhrlicher
4th May 2006, 07:21
Did you try to move the widget?
You get the screen coordinates of your second screen - so it should be possible to simply call QWidget:move with those corredinates.

nupul
4th May 2006, 08:47
Did you try to move the widget?
You get the screen coordinates of your second screen - so it should be possible to simply call QWidget:move with those corredinates.


nope...didn't think of this ;)

I thought there would be some direct way to open the widget window onto the second screen...but am still not able to understand your soln...ummm some code could help ;)

Thanks

ChristianEhrlicher
4th May 2006, 09:06
For me I have two desktops:
QDesktopWidget::screenGeometry(0) returns 0,0 / 1279/1023
QDesktopWidget::screenGeometry(1) returns -1024,120 / -1,887

If I now want to move my widget to screen 1, I just have to call QWidget::move() with a point inside -1024,120 / -1,887

Take a look at qt4-src/examples/tutorial/t1 - a 'hello.move(-800,500);' after hello.show() does the trick.

nupul
4th May 2006, 12:28
Thanks a lot!!! But there is a doubt still lingering on....My app opens another app...something like a desklet-viewer. This desklet-viewer is invoked via QProcess....and I would like to have this process show up on the other desktop....how can i achieve this?

:confused:

Nupul

Chicken Blood Machine
4th May 2006, 18:48
Thanks a lot!!! But there is a doubt still lingering on....My app opens another app...something like a desklet-viewer. This desklet-viewer is invoked via QProcess....and I would like to have this process show up on the other desktop....how can i achieve this?

:confused:

Nupul

This highly depends. Are you on Linux or Windows? Is your desklet-viewer written in Qt or some other toolkit? Qt apps accept the standard X11 command line arguments like -geometry. this can be used to position your new process window.

nupul
5th May 2006, 09:43
This highly depends. Are you on Linux or Windows? Is your desklet-viewer written in Qt or some other toolkit? Qt apps accept the standard X11 command line arguments like -geometry. this can be used to position your new process window.

I am using linux SUSE 10. (AFAIK windows doesn't support the multiple desktop option as yet...:D)

The desklet-viewer is an external application NOT written in Qt....i think it's in gtk. I can use kstart for this (to launch an app on another desktop), but it then becomes too KDE specific. There also another tool 'wmctrl' to use, but it can't start a process on another desktop, it can only move "windows" to another desktop. The round about is to start the application, get the window Id and then move :eek: but I don't want to do this....any solution that Qt can provide?

Thanks

Nupul

Chicken Blood Machine
6th May 2006, 04:44
I am using linux SUSE 10. (AFAIK windows doesn't support the multiple desktop option as yet...:D)

The desklet-viewer is an external application NOT written in Qt....i think it's in gtk. I can use kstart for this (to launch an app on another desktop), but it then becomes too KDE specific. There also another tool 'wmctrl' to use, but it can't start a process on another desktop, it can only move "windows" to another desktop. The round about is to start the application, get the window Id and then move :eek: but I don't want to do this....any solution that Qt can provide?

Thanks

Nupul
No, Qt can't control your GTK app.

nupul
6th May 2006, 19:03
hmmm....seems I'll just use the external programs kstart and wmctrl for this...the former can launch process on another desktop, without changing the existing desktop...the latter can't do this, but can move any "window" onto another desktop...:(

but no qualms....i learnt how to do the latter with Qt...above.

Thanks a lot CBM and Christian!!

Nupul.

PS:If you know some more external progs as above...do lemme know ;)