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. [Linux CentOS Stream 9] grabWindow doesn't work with Qt 6.4.2 on CentOS Stream 9 if graphics driver are not installed
Qt 6.11 is out! See what's new in the release blog

[Linux CentOS Stream 9] grabWindow doesn't work with Qt 6.4.2 on CentOS Stream 9 if graphics driver are not installed

Scheduled Pinned Locked Moved Unsolved General and Desktop
6 Posts 3 Posters 1.7k Views 2 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.
  • N Offline
    N Offline
    nitingera
    wrote on last edited by nitingera
    #1

    The grabWindow() method doesn't work on CentOS stream 9 if graphics driver are not installed.
    I tried on a machine with CentOS Stream9 with graphics driver (NVidia) installed and it works perfectly fine. However, I am trying it on a VM and the size of pixmap returned through grabWindow() call is 0.
    The sibling geometry returns the correct value.
    Also tried passing QWidget::winId() to the grabWindow method but still the same result.

    Any input related to this will be appreciated.

    This is the sample code I tried to get the screenshot of multiple monitors attached

    void Widget::on_pushButton_clicked()
    {
        QScreen *screen =  QGuiApplication::primaryScreen();
    
        if(screen)
        {
            QImage m_image = QImage(screen->virtualGeometry().width(), screen->virtualGeometry().height(), QImage::Format_ARGB32_Premultiplied);
            QPainter painter(&m_image);
            for(QScreen* sibling : screen->virtualSiblings())
            {
                qDebug() << "sibling geometry:" << sibling->geometry();
    
                QPixmap pix = sibling->grabWindow();
                qDebug() << "pix:" << pix.size();
    
                painter.drawImage(sibling->geometry().x(), sibling->geometry().y(), pix.toImage());
            }
        }
    }
    
    1 Reply Last reply
    0
    • jsulmJ Offline
      jsulmJ Offline
      jsulm
      Lifetime Qt Champion
      wrote on last edited by
      #2

      What graphics subsystem do you use in the VM? Wayland? X11? Something else? What graphics driver is used in the VM (depends on what virtualization software you're using)?

      https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      0
      • N Offline
        N Offline
        nitingera
        wrote on last edited by
        #3

        I am using VMWare Player
        VGA compatible controller: VMware SVGA II Adapter
        However, I get this issue on an actual hardware as well if graphics driver are not installed.
        Tried on an actual hardware with Radeon RX 6600

        Graphic Card: AMD Radeon RX 6600 (radeonsi, navi23, LLVM 17.0.6, DRM 3.54, 5.14.0-446.el9.x86_64)(AMD)
        Driver: 4.6 (Compatibility Profile) Mesa 23.3.3
        Using X11

        1 Reply Last reply
        0
        • Axel SpoerlA Offline
          Axel SpoerlA Offline
          Axel Spoerl
          Moderators
          wrote on last edited by
          #4

          Are VMWare tools installed?
          I have taken screenshots from VMs many times, using all kinds of virtualization software from openBox, to Parallels and VMWare.
          If memory serves well, VMWare really wants its tools installed for drivers to work correctly.

          Software Engineer
          The Qt Company, Oslo

          1 Reply Last reply
          0
          • N Offline
            N Offline
            nitingera
            wrote on last edited by
            #5

            I am just using VM for testing.. As I mentioned, I also have the issue on actual hardware machines when graphics drivers are not installed. I tried on a workstation with the following configuration
            Graphic Card: AMD Radeon RX 6600 (radeonsi, navi23, LLVM 17.0.6, DRM 3.54, 5.14.0-446.el9.x86_64)(AMD)
            Driver: 4.6 (Compatibility Profile) Mesa 23.3.3

            As the graphics driver is not installed, grabWindow() command fails and returns a pixmap of size 0

            Axel SpoerlA 1 Reply Last reply
            0
            • N nitingera

              I am just using VM for testing.. As I mentioned, I also have the issue on actual hardware machines when graphics drivers are not installed. I tried on a workstation with the following configuration
              Graphic Card: AMD Radeon RX 6600 (radeonsi, navi23, LLVM 17.0.6, DRM 3.54, 5.14.0-446.el9.x86_64)(AMD)
              Driver: 4.6 (Compatibility Profile) Mesa 23.3.3

              As the graphics driver is not installed, grabWindow() command fails and returns a pixmap of size 0

              Axel SpoerlA Offline
              Axel SpoerlA Offline
              Axel Spoerl
              Moderators
              wrote on last edited by
              #6

              @nitingera said in [Linux CentOS Stream 9] grabWindow doesn't work with Qt 6.4.2 on CentOS Stream 9 if graphics driver are not installed:

              As the graphics driver is not installed, grabWindow() command fails and returns a pixmap of size 0

              Then install the graphics driver...

              Software Engineer
              The Qt Company, Oslo

              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