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. grabtoimage() and scale produces two overlapping images?

grabtoimage() and scale produces two overlapping images?

Scheduled Pinned Locked Moved Solved General and Desktop
2 Posts 1 Posters 276 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.
  • PowerNowP Offline
    PowerNowP Offline
    PowerNow
    wrote on last edited by PowerNow
    #1

    Hi, if I use grabtoimage() in C++ for a scaled QQuickItem I get two overapping images. One with scale=1 the other one with the scale used in Qml.

    Item {
        id: iItem
        objectname: "oItem"
        width: 200
        height: 200
        scale: 0.5
    }
    
    QQuickItem *visPlc= m_pRootObj->findChild<QQuickItem*>("oItem");
    
    QEventLoop loop;
    QSharedPointer<QQuickItemGrabResult> grabRes = visPlc->grabToImage();
    loop.connect(grabRes.data(), &QQuickItemGrabResult::ready, &loop, &QEventLoop::quit);
    loop.exec();
    loop.exit();
    

    Is there a way only to get the scaled item?

    1 Reply Last reply
    0
    • PowerNowP Offline
      PowerNowP Offline
      PowerNow
      wrote on last edited by
      #2

      For who is interested, I changed the following:

      Wrong double images:

      Item {
          id: iItem1
          objectname: "oItem"
          width: iItem2.width
          height: iItem2.height
          scale: 0.5 // moved to iItem2
      
         Item {
             id: iItem2
             width: 200
             height: 200
         }
      }
      

      Single image:

      Item {
          id: iItem1
          objectname: "oItem"
          width: iItem2.width
          height: iItem2.height
      
         Item {
             id: iItem2
             width: 200
             height: 200
             scale: 0.5
         }
      }
      
      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