12#include <private/qtextengine_p.h>
21 qreal targetDevicePixelRatio,
22 qreal *sourceDevicePixelRatio)
26 QString localFile = baseFileName;
28 localFile = localFile.
sliced(6);
30 localFile = localFile.
sliced(3);
33 qreal *sourceDevicePixelRatio);
34 return qt_findAtNxFile(localFile, targetDevicePixelRatio, sourceDevicePixelRatio);
39 if (
path.startsWith(
":/"_L1))
47 qreal sourcePixelRatio = 1.0;
53 if (
data.userType() == QMetaType::QPixmap ||
data.userType() == QMetaType::QImage)
55 else if (
data.metaType() == QMetaType::fromType<QByteArray>())
60 return T(
":/qt-project.org/styles/commonstyle/images/file-16.png"_L1);
64 if (sourcePixelRatio != 1.0)
65 result.setDevicePixelRatio(sourcePixelRatio);
79 if (!hasWidth || !hasHeight) {
81 const QSizeF sourceSize =
source.deviceIndependentSize();
120 return getSize<QImage>(doc, imageFormat);
121 return getSize<QPixmap>(doc, imageFormat);
128 return getAs<QImage>(doc, imageFormat);
137 const QImage image = getAs<QImage>(doc, imageFormat,
p->device()->devicePixelRatio());
140 const QPixmap pixmap = getAs<QPixmap>(doc, imageFormat,
p->device()->devicePixelRatio());
147#include "moc_qtextimagehandler_p.cpp"
QPaintDevice * paintDevice() const
Returns the paint device used to render the document's layout.
static QCoreApplication * instance() noexcept
Returns a pointer to the application's QCoreApplication (or QGuiApplication/QApplication) instance.
QThread * thread() const
Returns the thread in which the object lives.
The QPainter class performs low-level painting on widgets and other paint devices.
Returns a copy of the pixmap that is transformed using the given transformation transform and transfo...
\inmodule QtCore\reentrant
constexpr void setWidth(qreal w) noexcept
Sets the width to the given finite width.
constexpr qreal width() const noexcept
Returns the width.
constexpr qreal height() const noexcept
Returns the height.
\macro QT_RESTRICTED_CAST_FROM_ASCII
bool startsWith(const QString &s, Qt::CaseSensitivity cs=Qt::CaseSensitive) const
Returns true if the string starts with s; otherwise returns false.
QString sliced(qsizetype pos) const
\reentrant \inmodule QtGui
QAbstractTextDocumentLayout * documentLayout() const
Returns the document layout for this document.
QVariant resource(int type, const QUrl &name) const
Returns data of the specified type from the resource with the given name.
void addResource(int type, const QUrl &name, const QVariant &resource)
Adds the resource resource to the resource cache, using type and name as identifiers.
QTextImageFormat toImageFormat() const
Returns this format as an image format.
virtual void drawObject(QPainter *p, const QRectF &rect, QTextDocument *doc, int posInDocument, const QTextFormat &format) override
Draws this text object using the specified painter.
virtual QSizeF intrinsicSize(QTextDocument *doc, int posInDocument, const QTextFormat &format) override
The intrinsicSize() function returns the size of the text object represented by format in the given d...
QTextImageHandler(QObject *parent=nullptr)
QImage image(QTextDocument *doc, const QTextImageFormat &imageFormat)
static QThread * currentThread()
Combined button and popup list for selecting options.
int qRound(qfloat16 d) noexcept
Q_GUI_EXPORT int qt_defaultDpi()
QString qt_findAtNxFile(const QString &baseFileName, qreal targetDevicePixelRatio, qreal *sourceDevicePixelRatio)
GLint GLsizei GLsizei height
GLenum GLuint GLintptr GLsizeiptr size
[1]
GLint GLsizei GLsizei GLenum GLenum GLsizei void * data
GLint GLsizei GLsizei GLenum format
GLsizei GLsizei GLchar * source
GLsizei const GLchar *const * path
GLenum GLenum GLenum GLenum GLenum scale
static QSize getSize(QTextDocument *doc, const QTextImageFormat &format)
static QUrl fromLocalfileOrResources(QString path)
static T getAs(QTextDocument *doc, const QTextImageFormat &format, const qreal devicePixelRatio=1.0)
static QString findAtNxFileOrResource(const QString &baseFileName, qreal targetDevicePixelRatio, qreal *sourceDevicePixelRatio)
QUrl url("example.com")
[constructor-url-reference]
IUIAutomationTreeWalker __RPC__deref_out_opt IUIAutomationElement ** parent