quickview中的item可以直接grabtoimage,但是qquickwidget中的item执行grabtoimage时会提示item not visible
//m_contentView就是qquickwidget
//找到一个objectName为testObject的item
QQuickItem* pItem = m_contentView->rootObject()->findChild<QQuickItem*>("testObject");
QPointF itemPos = pItem->mapToScene(QPointF(0,0));
QPixmap windowImage = m_contentView->grab(QRect(itemPos.x(), itemPos.y(), pItem->width(), pItem->height()));
long long now = SCTimeUtils::currentTimeMillis();
windowImage.save(QString("%1.png").arg(now));
// QSharedPointer<QQuickItemGrabResult> result = pItem->grabToImage();
// connect(result.data(), &QQuickItemGrabResult::ready, [=](){
// CLog::log(QString("grabToImage ok"), LOG_PARAM);
// });