Results 1 to 7 of 7

Thread: Selecting screen on the application starts

  1. #1
    Join Date
    Jan 2006
    Location
    Sta. Eugènia de Berga (Vic - Barcelona - Spain)
    Posts
    869
    Thanks
    69
    Thanked 59 Times in 57 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Selecting screen on the application starts

    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,
    Òscar Llarch i Galán

  2. #2
    Join Date
    Mar 2007
    Location
    Ukraine, Odessa
    Posts
    140
    Thanks
    15
    Thanked 11 Times in 10 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Windows

    Default Re: Selecting screen on the application starts

    QApplication::desktop ()->numScreens () gets number of screens. I suppose that you should keep digging QDesktopWidget reference to do what you want
    C++ & AMD forever

  3. #3
    Join Date
    Jan 2006
    Location
    Sta. Eugènia de Berga (Vic - Barcelona - Spain)
    Posts
    869
    Thanks
    69
    Thanked 59 Times in 57 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: Selecting screen on the application starts

    Hi,

    Thanks, I was searching for "display", "screen" and had not think on "desktop".
    Òscar Llarch i Galán

  4. #4
    Join Date
    Jan 2006
    Location
    Sta. Eugènia de Berga (Vic - Barcelona - Spain)
    Posts
    869
    Thanks
    69
    Thanked 59 Times in 57 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: Selecting screen on the application starts

    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,
    Òscar Llarch i Galán

  5. #5
    Join Date
    Jan 2006
    Location
    Sta. Eugènia de Berga (Vic - Barcelona - Spain)
    Posts
    869
    Thanks
    69
    Thanked 59 Times in 57 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: Selecting screen on the application starts

    Hi,

    Qt Code:
    1. myMainWindow mainWindow(app.desktop()->screen(iScreen));
    To copy to clipboard, switch view to plain text mode 


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

    Thanks,
    Òscar Llarch i Galán

  6. #6
    Join Date
    Jan 2006
    Location
    Sta. Eugènia de Berga (Vic - Barcelona - Spain)
    Posts
    869
    Thanks
    69
    Thanked 59 Times in 57 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: Selecting screen on the application starts

    Hi,

    I have a problem,
    The problem is that "isVirtualDesktop" is returning me true, and the number of screens return me 2.
    Qt Code:
    1. bool b = app.desktop()->isVirtualDesktop(); //true
    2. QWidget* pDesktop0 = app.desktop()->screen(0);
    3. QWidget* pDesktop1 = app.desktop()->screen(1);
    To copy to clipboard, switch view to plain text mode 

    pDesktop0 and pDesktop1 point to the same memory data.
    Òscar Llarch i Galán

  7. #7
    Join Date
    Jan 2006
    Location
    Sta. Eugènia de Berga (Vic - Barcelona - Spain)
    Posts
    869
    Thanks
    69
    Thanked 59 Times in 57 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: Selecting screen on the application starts

    Hi,

    Finally I solved this problem on Virtual Desktops:

    Qt Code:
    1. QRect qAvGeometry = app.desktop()->availableGeometry(0);
    2. //Move the MainWindow to left by horizontal pixels(horizontal resolution)
    3. mainWindow.move((iScreen-1)*(qAvGeometry.width()+1),0);
    To copy to clipboard, switch view to plain text mode 
    Òscar Llarch i Galán

Similar Threads

  1. QSkinWindows Classes
    By kernel_panic in forum Qt-based Software
    Replies: 45
    Last Post: 20th April 2010, 13:35
  2. Setting manually cursor position on multi screen systems
    By irreriwan in forum Qt Programming
    Replies: 0
    Last Post: 4th March 2008, 10:47
  3. getting problem in running qtopia home screen application
    By afgan_rajesh in forum Qt for Embedded and Mobile
    Replies: 0
    Last Post: 31st January 2008, 08:01
  4. Replies: 3
    Last Post: 8th December 2006, 19:51
  5. Starting application in full screen
    By safknw in forum Qt Programming
    Replies: 3
    Last Post: 12th May 2006, 19:02

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.