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. Screenshot secondary monitor

Screenshot secondary monitor

Scheduled Pinned Locked Moved Solved General and Desktop
3 Posts 2 Posters 1.6k Views
  • 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.
  • Y Offline
    Y Offline
    Yakov Eremin
    wrote on last edited by Yakov Eremin
    #1
    QScreen *screen = QGuiApplication::screens().last();
    QPixmap screenPixmap = screen->grabWindow(0, 0, 0, screen->size().width(), screen->size().height());
    ui->label->setPixmap(screenPixmap.scaled(size(), Qt::KeepAspectRatio, Qt::SmoothTransformation));
    

    QGuiApplication::screens().size() prints 2;

    Not important, is it QGuiApplication::screens().last() or QGuiApplication::screens().first, it shows same picture (primary screen).
    If primary screen at left, I can take texture of secondary with positive X offset, if primary at right, with negative X offset.

    Question: Is it a bug, and how I can to understand position of primary screen, is it left from secondary or not.

    Same problem on Qt4: http://lists.qt-project.org/pipermail/qt-interest-old/2010-October/028182.html
    OS X 10.10, Qt 5.5.1, example project: https://dl.dropboxusercontent.com/u/4852026/Multiscreen.zip

    1 Reply Last reply
    0
    • M Offline
      M Offline
      mchinand
      wrote on last edited by
      #2

      For the second screen (or both) use the following:

      QPixmap screenPixmap = screen->grabWindow(0, screen->geometry().x(), screen->geometry().y(), screen->size().width(), screen->size().height());
      
      Y 1 Reply Last reply
      1
      • M mchinand

        For the second screen (or both) use the following:

        QPixmap screenPixmap = screen->grabWindow(0, screen->geometry().x(), screen->geometry().y(), screen->size().width(), screen->size().height());
        
        Y Offline
        Y Offline
        Yakov Eremin
        wrote on last edited by Yakov Eremin
        #3

        @mchinand thank you, it works.

        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