Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Detect multiple monitors
Forum Updated to NodeBB v4.3 + New Features

Detect multiple monitors

Scheduled Pinned Locked Moved General and Desktop
3 Posts 3 Posters 3.0k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    A Offline
    ArchGabe
    wrote on 30 Oct 2013, 13:08 last edited by
    #1

    Hi guys,

    I need to detect multiple monitors on my applictation. My code is already done so I need to do minimal changes on it in order to open the application on a second screen, if it is present.
    I already know about QWdiget and QDesktopWidget, but I need some exemples of how to insert those functions in my code or an alternative to them.

    Thank you in advance,

    1 Reply Last reply
    0
    • M Offline
      M Offline
      mcosta
      wrote on 30 Oct 2013, 16:27 last edited by
      #2

      Hi,

      what means "I need to detect multiple monitors"?

      With QDesktopWidget::screenCount() returns the number of screens available on the system

      @
      QDesktopWidget dw;
      if (dw.screenCount() > 1) {
      // Multiple screen
      }
      else {
      // Single screen
      }
      @

      However multiple monitors detecting depends on Window Manager settings (Virtual Desktop, Multiple Desktop, ...)

      Once your problem is solved don't forget to:

      • Mark the thread as SOLVED using the Topic Tool menu
      • Vote up the answer(s) that helped you to solve the issue

      You can embed images using (http://imgur.com/) or (http://postimage.org/)

      1 Reply Last reply
      1
      • E Offline
        E Offline
        Edward Heretsch
        wrote on 26 Dec 2020, 08:34 last edited by
        #3

        For readers who are finding their way to this topic, QDesktopWidget is depracated. Instead QGuiApplication should be used.

        1 Reply Last reply
        0

        • Login

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • Users
        • Groups
        • Search
        • Get Qt Extensions
        • Unsolved