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. Screnschoting desktop...
Qt 6.11 is out! See what's new in the release blog

Screnschoting desktop...

Scheduled Pinned Locked Moved Unsolved General and Desktop
2 Posts 2 Posters 259 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.
  • D Offline
    D Offline
    Dariusz
    wrote on last edited by
    #1

    Hey

    I'm trying to screnschot desktop behind widget location >

        def getImage(self) -> QPixmap:
                r = self.rect()
                po = self.pos()
                p = self.screen().grabWindow(0, abs(po.x()), abs(po.y()), abs(r.width()), abs(r.height()))
                self.label.setPixmap(p)
                return p
    

    But the problem that I have is, if I have 2/3/4 screens and I move my widget out of main screen. The coordinates are no longer correct to take screnschot and I end up with scrazy pics. If I have 1 screen above other one in physical space and so on.
    Any idea how to convert coordinatest to correct screen coordinate to get correct x/y coords?

    1 Reply Last reply
    0
    • Chris KawaC Offline
      Chris KawaC Offline
      Chris Kawa
      Lifetime Qt Champion
      wrote on last edited by Chris Kawa
      #2

      grabWindow() works in the screen's coordinates and pos() is in absolute coordinates, so get the screen's geometry() and subtract the top left corner coordinates of it from your rectangle pos.

      1 Reply Last reply
      2

      • Login

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