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. Take a screenshot of current monitor
Forum Updated to NodeBB v4.3 + New Features

Take a screenshot of current monitor

Scheduled Pinned Locked Moved General and Desktop
3 Posts 2 Posters 1.1k 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.
  • M Offline
    M Offline
    MarianaB
    wrote on last edited by
    #1

    I have three monitors and when I start my QT application, it starts on the monitor where the mouse cursor is in. Is there a way to specify the monitor number when taking a screenshot with QScreen::grabWindow() (on QT5)?
    I tried this but it does not work (the taken screenshot is always of the primary monitor).
    @
    QDesktopWidget* desktop = QApplication::desktop();
    QPixmap screenShot;
    QScreen* myScreen = QApplication::screens()[desktop->screenNumber(m_mainAreaWidget)];

    if (myScreen)
    {
    screenShot = myScreen->grabWindow(desktop->screen(desktop->screenNumber(m_mainAreaWidget))->winId());
    }@

    1 Reply Last reply
    0
    • H Offline
      H Offline
      hpollak
      wrote on last edited by
      #2

      Which OS to you use?

      1 Reply Last reply
      0
      • M Offline
        M Offline
        MarianaB
        wrote on last edited by
        #3

        Windows 7, with Visual studio 2013.

        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