PDA

View Full Version : Selecting screen on the application starts



^NyAw^
11th March 2008, 17:18
Hi,

Has Qt any functions to enumerate the displays on a system and to force an application to start on the first or second display?

Thanks,

THRESHE
11th March 2008, 17:48
QApplication::desktop ()->numScreens () gets number of screens. I suppose that you should keep digging QDesktopWidget reference to do what you want

^NyAw^
11th March 2008, 17:58
Hi,

Thanks, I was searching for "display", "screen" and had not think on "desktop".

^NyAw^
11th March 2008, 18:08
Hi,

The problem is, how can I force my application to start to the second display?

I'm creating an application that have no frame, so it can't be moved by mouse to the other display.

Thanks,

^NyAw^
11th March 2008, 18:42
Hi,



myMainWindow mainWindow(app.desktop()->screen(iScreen));



I can take the desktop as a widget an set it as the parent of my QMainWindow.

Thanks,

^NyAw^
11th March 2008, 22:33
Hi,

I have a problem,
The problem is that "isVirtualDesktop" is returning me true, and the number of screens return me 2.


bool b = app.desktop()->isVirtualDesktop(); //true
QWidget* pDesktop0 = app.desktop()->screen(0);
QWidget* pDesktop1 = app.desktop()->screen(1);


pDesktop0 and pDesktop1 point to the same memory data.

^NyAw^
11th March 2008, 23:20
Hi,

Finally I solved this problem on Virtual Desktops:



QRect qAvGeometry = app.desktop()->availableGeometry(0);
//Move the MainWindow to left by horizontal pixels(horizontal resolution)
mainWindow.move((iScreen-1)*(qAvGeometry.width()+1),0);