4#include <private/qtquickglobal_p.h>
10#if QT_CONFIG(quick_shadereffect)
14#include <QtQml/QQmlEngine>
15#include <QtQml/QQmlInfo>
17#include <private/qquickpixmapcache_p.h>
18#include <private/qquickitem_p.h>
19#include <private/qsgcontext_p.h>
20#include <private/qsgadaptationlayer_p.h>
176 qWarning() <<
"saveToFile can only save to a file on the local filesystem";
182#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
183#if QT_DEPRECATED_SINCE(5, 15)
190 return std::as_const(*this).saveToFile(
fileName);
198 d->ensureImageInCache();
216 if (
d->qmlEngine &&
d->callback.isCallable()) {
217 d->callback.call(
QJSValueList() <<
d->qmlEngine->newQObject(
this));
227void QQuickItemGrabResult::setup()
240 d->itemSize =
QSizeF(
d->item->width(),
d->item->height());
243void QQuickItemGrabResult::render()
249 d->texture->setRect(
QRectF(0,
d->itemSize.height(),
d->itemSize.width(), -
d->itemSize.height()));
253 d->texture->scheduleUpdate();
254 d->texture->updateTexture();
255 d->image =
d->texture->toImage();
258 d->texture =
nullptr;
271 if (
size.width() < 1 ||
size.height() < 1) {
277 qmlWarning(
item) <<
"grabToImage: item is not attached to a window";
294 d->textureSize =
size;
372 qmlWarning(
this) <<
"grabToImage: item has no QML engine";
377 qmlWarning(
this) <<
"grabToImage: 'callback' is not a function";
385 if (
size.width() < 1 ||
size.height() < 1) {
386 qmlWarning(
this) <<
"grabToImage: item has invalid dimensions";
391 qmlWarning(
this) <<
"grabToImage: item is not attached to a window";
404 d->callback = callback;
410#include "moc_qquickitemgrabresult.cpp"
static void postEvent(QObject *receiver, QEvent *event, int priority=Qt::NormalEventPriority)
Type
This enum type defines the valid event types in Qt.
The QJSValue class acts as a container for Qt/JavaScript data types.
bool isCallable() const
Returns true if this QJSValue is a function, otherwise returns false.
static QMetaObject::Connection connect(const QObject *sender, const char *signal, const QObject *receiver, const char *member, Qt::ConnectionType=Qt::AutoConnection)
\threadsafe
virtual bool event(QEvent *event)
This virtual function receives events to an object and should return true if the event e was recogniz...
void deleteLater()
\threadsafe
The QQmlEngine class provides an environment for instantiating QML components.
QQuickItemGrabResultPrivate()
QPointer< QQuickWindow > window
~QQuickItemGrabResultPrivate()
QPointer< QQuickItem > item
void ensureImageInCache() const
QQuickPixmap * cacheEntry
static QQuickItemGrabResult * create(QQuickItem *item, const QSize &size)
QUrl url
\qmlproperty url QtQuick::ItemGrabResult::url
void ready()
This signal is emitted when the grab has completed.
Q_INVOKABLE bool saveToFile(const QString &fileName) const
\qmlmethod bool QtQuick::ItemGrabResult::saveToFile(fileName)
QImage image
\qmlproperty variant QtQuick::ItemGrabResult::image
bool event(QEvent *) override
void refFromEffectItem(bool hide)
QSGTransformNode * itemNode()
static QQuickItemPrivate * get(QQuickItem *item)
The QQuickItem class provides the most basic of all visual items in \l {Qt Quick}.
QSharedPointer< QQuickItemGrabResult > grabToImage(const QSize &targetSize=QSize())
Grabs the item into an in-memory image.
QQuickWindow * window() const
Returns the window in which this item is rendered.
qreal width
This property holds the width of this item.
qreal height
This property holds the height of this item.
static const QLatin1String itemGrabberScheme
static QWindow * renderWindowFor(QQuickWindow *win, QPoint *offset=nullptr)
Returns the real window that win is being rendered to, if any.
static QQuickWindowPrivate * get(QQuickWindow *c)
QSGRenderContext * context
void beforeSynchronizing()
This signal is emitted before the scene graph is synchronized with the QML state.
void update()
Schedules the window to render another frame.
void afterRendering()
\qmlsignal QtQuick::Window::beforeRendering()
\inmodule QtCore\reentrant
virtual QSGLayer * createLayer(QSGRenderContext *renderContext)=0
virtual QSize minimumFBOSize() const
QSGContext * sceneGraphContext() const
constexpr int height() const noexcept
Returns the height.
constexpr int width() const noexcept
Returns the width.
\macro QT_RESTRICTED_CAST_FROM_ASCII
static QString number(int, int base=10)
This is an overloaded member function, provided for convenience. It differs from the above function o...
void setFragment(const QString &fragment, ParsingMode mode=TolerantMode)
Sets the fragment of the URL to fragment.
bool isEmpty() const
Returns true if the URL has no data; otherwise returns false.
void setScheme(const QString &scheme)
Sets the scheme of the URL to scheme.
void setPath(const QString &path, ParsingMode mode=DecodedMode)
Sets the path of the URL to path.
QString toLocalFile() const
Returns the path of this URL formatted as a local file path.
static auto fromValue(T &&value) noexcept(std::is_nothrow_copy_constructible_v< T > &&Private::CanUseInternalSpace< T >) -> std::enable_if_t< std::conjunction_v< std::is_copy_constructible< T >, std::is_destructible< T > >, QVariant >
Combined button and popup list for selecting options.
QList< QJSValue > QJSValueList
constexpr const T & qMax(const T &a, const T &b)
GLenum GLuint GLintptr GLsizeiptr size
[1]
QQmlEngine * qmlEngine(const QObject *obj)
Q_QML_EXPORT QQmlInfo qmlWarning(const QObject *me)
QT_BEGIN_NAMESPACE const QEvent::Type Event_Grab_Completed
myObject disconnect()
[26]
IUIAutomationTreeWalker __RPC__deref_out_opt IUIAutomationElement ** parent