7#include <QtGui/qguiapplication.h>
8#include <QtGui/qscreen.h>
9#include <QtGui/qicon.h>
11#include <QtQml/qqmlinfo.h>
12#include <QtQml/qqmlfile.h>
13#include <QtQml/qqmlabstracturlinterceptor.h>
38 if (setDevicePixelRatio)
41 return setDevicePixelRatio;
103 if (
d->async != async) {
132 if (
d->sourcesize ==
size)
135 d->sourcesize =
size;
145 int width =
d->sourcesize.width();
146 int height =
d->sourcesize.height();
158 return d->sourceClipRect;
164 if (
d->sourceClipRect ==
r)
167 d->sourceClipRect =
r;
168 emit sourceClipRectChanged();
199 return d->pix.image();
205 if (
mirror ==
d->mirrorHorizontally)
208 d->mirrorHorizontally =
mirror;
219 return d->mirrorHorizontally;
225 if (
mirror ==
d->mirrorVertically)
233 emit mirrorVerticallyChanged();
239 return d->mirrorVertically;
257 emit currentFrameChanged();
263 return d->currentFrame;
269 return d->frameCount;
295 QQuickPixmap::Options options;
307 const qreal targetDevicePixelRatio = (
window() ?
window()->effectiveDevicePixelRatio() :
qApp->devicePixelRatio());
308 d->devicePixelRatio = 1.0;
309 bool updatedDevicePixelRatio =
false;
310 if (
d->sourcesize.isValid()
312 updatedDevicePixelRatio =
d->updateDevicePixelRatio(targetDevicePixelRatio);
315 if (!updatedDevicePixelRatio) {
319 targetDevicePixelRatio, &loadUrl, &
d->devicePixelRatio);
327 d->sourceClipRect.toRect(),
331 d->currentFrame,
d->frameCount,
332 d->devicePixelRatio);
334 if (
d->pix.isLoading()) {
338 static int thisRequestProgress = -1;
339 static int thisRequestFinished = -1;
340 if (thisRequestProgress == -1) {
341 thisRequestProgress =
342 QQuickImageBase::staticMetaObject.indexOfSlot(
"requestProgress(qint64,qint64)");
343 thisRequestFinished =
344 QQuickImageBase::staticMetaObject.indexOfSlot(
"requestFinished()");
347 d->pix.connectFinished(
this, thisRequestFinished);
348 d->pix.connectDownloadProgress(
this, thisRequestProgress);
359 if (
d->url.isEmpty()) {
371 if (
d->pix.isError()) {
390 if (
d->frameCount !=
d->pix.frameCount()) {
391 d->frameCount =
d->pix.frameCount();
392 emit frameCountChanged();
394 if (
d->colorSpace !=
d->pix.colorSpace()) {
395 d->colorSpace =
d->pix.colorSpace();
396 emit colorSpaceChanged();
402void QQuickImageBase::requestProgress(
qint64 received,
qint64 total)
405 if (
d->status ==
Loading && total > 0)
406 d->setProgress(
qreal(received) / total);
414 const auto oldDpr =
d->devicePixelRatio;
420 if (
d->devicePixelRatio == oldDpr)
421 d->updateDevicePixelRatio(
value.realValue);
431 if (
d->url.isValid())
438 setImplicitSize(
d->pix.width() /
d->devicePixelRatio,
d->pix.height() /
d->devicePixelRatio);
448 if (disable2xImageLoading)
459 if (atLocation > 0 && atLocation + 3 < localFile.
size()) {
460 if (localFile[atLocation + 1].
isDigit()
462 && localFile[atLocation + 3] ==
QLatin1Char(
'.')) {
463 *sourceDevicePixelRatio = localFile[atLocation + 1].digitValue();
470 if (localFileX != localFile)
495 return d->colorSpace;
504 d->providerOptions.setTargetColorSpace(
colorSpace);
505 emit colorSpaceChanged();
510#include "moc_qquickimagebase_p.cpp"
The QColorSpace class provides a color space abstraction.
The QQmlContext class defines a context within a QML engine.
static QString urlToLocalFileOrQrc(const QString &)
If url is a local file returns a path suitable for passing to QFile.
QQuickImageBase::Status status
virtual bool updateDevicePixelRatio(qreal targetDevicePixelRatio)
void setProgress(qreal value)
void setStatus(QQuickImageBase::Status value)
bool autoTransform() const
void itemChange(ItemChange change, const ItemChangeData &value) override
Called when change occurs for this item.
virtual void pixmapChange()
virtual void setMirror(bool mirror)
virtual void setAutoTransform(bool transform)
void componentComplete() override
Invoked after the root component that caused this instantiation has completed construction.
virtual void setSourceSize(const QSize &)
void asynchronousChanged()
virtual void setColorSpace(const QColorSpace &colorSpace)
void resetSourceClipRect()
void loadPixmap(const QUrl &url, LoadPixmapOptions loadOptions=NoOption)
void setSourceClipRect(const QRectF &r)
static void resolve2xLocalFile(const QUrl &url, qreal targetDevicePixelRatio, QUrl *sourceUrl, qreal *sourceDevicePixelRatio)
QRectF sourceClipRect() const
virtual void setCurrentFrame(int frame)
virtual void requestFinished()
virtual void emitAutoTransformBaseChanged()
virtual void setSource(const QUrl &url)
void sourceChanged(const QUrl &)
void setAsynchronous(bool)
QQuickImageBase(QQuickItem *parent=nullptr)
virtual void setMirrorVertically(bool mirror)
The QQuickImageProviderOptions class provides options for QQuickImageProviderWithOptions image reques...
@ UsePluginDefaultTransform
The QQuickItem class provides the most basic of all visual items in \l {Qt Quick}.
void setFlag(Flag flag, bool enabled=true)
Enables the specified flag for this item if enabled is true; if enabled is false, the flag is disable...
void componentComplete() override
\reimp Derived classes should call the base class method before adding their own actions to perform a...
QQuickWindow * window() const
Returns the window in which this item is rendered.
virtual void itemChange(ItemChange, const ItemChangeData &)
Called when change occurs for this item.
bool isComponentComplete() const
Returns true if construction of the QML component is complete; otherwise returns false.
qreal height
This property holds the height of this item.
ItemChange
Used in conjunction with QQuickItem::itemChange() to notify the item about certain types of changes.
@ ItemDevicePixelRatioHasChanged
void update()
Schedules a call to updatePaintNode() for this item.
void setImplicitSize(qreal, qreal)
\inmodule QtCore\reentrant
\inmodule QtCore\reentrant
\macro QT_RESTRICTED_CAST_FROM_ASCII
qsizetype lastIndexOf(QChar c, Qt::CaseSensitivity cs=Qt::CaseSensitive) const noexcept
qsizetype size() const
Returns the number of characters in this string.
bool endsWith(const QString &s, Qt::CaseSensitivity cs=Qt::CaseSensitive) const
Returns true if the string ends with s; otherwise returns false.
bool isEmpty() const
Returns true if the string has no characters; otherwise returns false.
static QUrl fromLocalFile(const QString &localfile)
Returns a QUrl representation of localFile, interpreted as a local file.
QString scheme() const
Returns the scheme of the URL.
QString path(ComponentFormattingOptions options=FullyDecoded) const
Returns the path of the URL.
QCache< int, Employee > cache
[0]
Combined button and popup list for selecting options.
EGLOutputLayerEXT EGLint EGLAttrib value
[5]
bool qFuzzyCompare(qfloat16 p1, qfloat16 p2) noexcept
QString qt_findAtNxFile(const QString &baseFileName, qreal targetDevicePixelRatio, qreal *sourceDevicePixelRatio)
GLint GLsizei GLsizei height
GLenum GLuint GLintptr GLsizeiptr size
[1]
GLuint GLenum GLenum transform
GLdouble GLdouble GLdouble GLdouble q
QQmlEngine * qmlEngine(const QObject *obj)
QQmlContext * qmlContext(const QObject *obj)
Q_QML_EXPORT QQmlInfo qmlWarning(const QObject *me)
QT_BEGIN_NAMESPACE bool isScalableImageFormat(const QUrl &url)
static QT_BEGIN_NAMESPACE bool isDigit(ushort ch)
QLatin1StringView QLatin1String
Q_CORE_EXPORT bool qEnvironmentVariableIsEmpty(const char *varName) noexcept
QUrl url("example.com")
[constructor-url-reference]
\inmodule QtCore \reentrant
IUIAutomationTreeWalker __RPC__deref_out_opt IUIAutomationElement ** parent