mirror of
https://github.com/tumic0/QtPBFImagePlugin.git
synced 2024-11-24 03:35:54 +01:00
Added support for Qt6
Minimal Qt version is now Qt 5.12
This commit is contained in:
parent
9b63d1d362
commit
60691060ea
@ -51,7 +51,7 @@ repository.
|
|||||||
|
|
||||||
## Build
|
## Build
|
||||||
### Requirements
|
### Requirements
|
||||||
* Qt >= 5.4 (5.6 for HiDPI support)
|
* Qt5 >= 5.12 or Qt6
|
||||||
* Google Protocol Buffers (protobuf-lite)
|
* Google Protocol Buffers (protobuf-lite)
|
||||||
* Zlib
|
* Zlib
|
||||||
|
|
||||||
|
@ -20,8 +20,7 @@ HEADERS += src/pbfhandler.h \
|
|||||||
src/textpointitem.h \
|
src/textpointitem.h \
|
||||||
src/font.h \
|
src/font.h \
|
||||||
src/textitem.h \
|
src/textitem.h \
|
||||||
src/sprites.h \
|
src/sprites.h
|
||||||
src/config.h
|
|
||||||
SOURCES += src/pbfplugin.cpp \
|
SOURCES += src/pbfplugin.cpp \
|
||||||
src/pbfhandler.cpp \
|
src/pbfhandler.cpp \
|
||||||
src/gzip.cpp \
|
src/gzip.cpp \
|
||||||
|
10
src/config.h
10
src/config.h
@ -1,10 +0,0 @@
|
|||||||
#ifndef CONFIG_H
|
|
||||||
#define CONFIG_H
|
|
||||||
|
|
||||||
#include <QtGlobal>
|
|
||||||
|
|
||||||
#if QT_VERSION >= QT_VERSION_CHECK(5, 6, 0)
|
|
||||||
#define ENABLE_HIDPI
|
|
||||||
#endif // QT >= 5.6
|
|
||||||
|
|
||||||
#endif // CONFIG_H
|
|
@ -34,10 +34,14 @@ static QColor interpolate(const QPair<qreal, QColor> &p0,
|
|||||||
? progress / difference
|
? progress / difference
|
||||||
: (pow(base, progress) - 1) / (pow(base, difference) - 1);
|
: (pow(base, progress) - 1) / (pow(base, difference) - 1);
|
||||||
|
|
||||||
|
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
|
||||||
qreal p0h, p0s, p0l, p0a;
|
qreal p0h, p0s, p0l, p0a;
|
||||||
p0.second.getHslF(&p0h, &p0s, &p0l, &p0a);
|
|
||||||
qreal p1h, p1s, p1l, p1a;
|
qreal p1h, p1s, p1l, p1a;
|
||||||
|
#else // QT6
|
||||||
|
float p0h, p0s, p0l, p0a;
|
||||||
|
float p1h, p1s, p1l, p1a;
|
||||||
|
#endif // QT6
|
||||||
|
p0.second.getHslF(&p0h, &p0s, &p0l, &p0a);
|
||||||
p1.second.getHslF(&p1h, &p1s, &p1l, &p1a);
|
p1.second.getHslF(&p1h, &p1s, &p1l, &p1a);
|
||||||
|
|
||||||
/* Qt returns a hue of -1 for achromatic colors. We convert it to a hue of 1
|
/* Qt returns a hue of -1 for achromatic colors. We convert it to a hue of 1
|
||||||
|
@ -100,7 +100,7 @@ PBF::Layer::Layer(const vector_tile::Tile_Layer *data) : _data(data)
|
|||||||
_features.reserve(data->features_size());
|
_features.reserve(data->features_size());
|
||||||
for (int i = 0; i < data->features_size(); i++)
|
for (int i = 0; i < data->features_size(); i++)
|
||||||
_features.append(Feature(&(data->features(i)), this));
|
_features.append(Feature(&(data->features(i)), this));
|
||||||
qSort(_features.begin(), _features.end());
|
std::sort(_features.begin(), _features.end());
|
||||||
}
|
}
|
||||||
|
|
||||||
PBF::PBF(const vector_tile::Tile &tile)
|
PBF::PBF(const vector_tile::Tile &tile)
|
||||||
|
@ -5,6 +5,7 @@
|
|||||||
#include <QJsonArray>
|
#include <QJsonArray>
|
||||||
#include <QFileInfo>
|
#include <QFileInfo>
|
||||||
#include <QDir>
|
#include <QDir>
|
||||||
|
#include <QRegularExpression>
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
#include "text.h"
|
#include "text.h"
|
||||||
#include "color.h"
|
#include "color.h"
|
||||||
@ -138,22 +139,46 @@ bool Style::Layer::Filter::match(const PBF::Feature &feature) const
|
|||||||
if (!(v = feature.value(_kv.first)))
|
if (!(v = feature.value(_kv.first)))
|
||||||
return false;
|
return false;
|
||||||
else
|
else
|
||||||
|
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
|
||||||
return *v > _kv.second;
|
return *v > _kv.second;
|
||||||
|
#else // QT6
|
||||||
|
return (QVariant::compare(*v, _kv.second)
|
||||||
|
== QPartialOrdering::Greater);
|
||||||
|
#endif // QT6
|
||||||
case GE:
|
case GE:
|
||||||
if (!(v = feature.value(_kv.first)))
|
{if (!(v = feature.value(_kv.first)))
|
||||||
return false;
|
return false;
|
||||||
else
|
else {
|
||||||
|
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
|
||||||
return *v >= _kv.second;
|
return *v >= _kv.second;
|
||||||
|
#else // QT6
|
||||||
|
QPartialOrdering res = QVariant::compare(*v, _kv.second);
|
||||||
|
return (res == QPartialOrdering::Greater
|
||||||
|
|| res == QPartialOrdering::Equivalent);
|
||||||
|
#endif // QT6
|
||||||
|
}}
|
||||||
case LT:
|
case LT:
|
||||||
if (!(v = feature.value(_kv.first)))
|
if (!(v = feature.value(_kv.first)))
|
||||||
return false;
|
return false;
|
||||||
else
|
else
|
||||||
|
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
|
||||||
return *v < _kv.second;
|
return *v < _kv.second;
|
||||||
|
#else // QT6
|
||||||
|
return (QVariant::compare(*v, _kv.second)
|
||||||
|
== QPartialOrdering::Less);
|
||||||
|
#endif // QT6
|
||||||
case LE:
|
case LE:
|
||||||
if (!(v = feature.value(_kv.first)))
|
{if (!(v = feature.value(_kv.first)))
|
||||||
return false;
|
return false;
|
||||||
else
|
else {
|
||||||
|
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
|
||||||
return *v <= _kv.second;
|
return *v <= _kv.second;
|
||||||
|
#else // QT6
|
||||||
|
QPartialOrdering res = QVariant::compare(*v, _kv.second);
|
||||||
|
return (res == QPartialOrdering::Less
|
||||||
|
|| res == QPartialOrdering::Equivalent);
|
||||||
|
#endif // QT6
|
||||||
|
}}
|
||||||
case In:
|
case In:
|
||||||
if (!(v = feature.value(_kv.first)))
|
if (!(v = feature.value(_kv.first)))
|
||||||
return _not;
|
return _not;
|
||||||
@ -180,15 +205,15 @@ bool Style::Layer::Filter::match(const PBF::Feature &feature) const
|
|||||||
|
|
||||||
QString Style::Layer::Template::value(int zoom, const PBF::Feature &feature) const
|
QString Style::Layer::Template::value(int zoom, const PBF::Feature &feature) const
|
||||||
{
|
{
|
||||||
QRegExp rx = QRegExp("\\{[^\\}]*\\}");
|
QRegularExpression rx("(\\{[^\\}]*\\})");
|
||||||
QString text(_field.value(zoom));
|
QString text(_field.value(zoom));
|
||||||
|
QRegularExpressionMatchIterator it = rx.globalMatch(text);
|
||||||
QStringList keys;
|
QStringList keys;
|
||||||
int pos = 0;
|
|
||||||
|
|
||||||
while ((pos = rx.indexIn(text, pos)) != -1) {
|
while (it.hasNext()) {
|
||||||
QString match = rx.capturedTexts().first();
|
QRegularExpressionMatch match = it.next();
|
||||||
keys.append(match.mid(1, match.size() - 2));
|
QString val = match.captured(1);
|
||||||
pos += rx.matchedLength();
|
keys.append(val.mid(1, val.size() - 2));
|
||||||
}
|
}
|
||||||
for (int i = 0; i < keys.size(); i++) {
|
for (int i = 0; i < keys.size(); i++) {
|
||||||
const QString &key = keys.at(i);
|
const QString &key = keys.at(i);
|
||||||
@ -575,22 +600,15 @@ bool Style::load(const QString &fileName)
|
|||||||
|
|
||||||
QDir styleDir = QFileInfo(fileName).absoluteDir();
|
QDir styleDir = QFileInfo(fileName).absoluteDir();
|
||||||
loadSprites(styleDir, "sprite.json", "sprite.png", _sprites);
|
loadSprites(styleDir, "sprite.json", "sprite.png", _sprites);
|
||||||
#ifdef ENABLE_HIDPI
|
|
||||||
loadSprites(styleDir, "sprite@2x.json", "sprite@2x.png", _sprites2x);
|
loadSprites(styleDir, "sprite@2x.json", "sprite@2x.png", _sprites2x);
|
||||||
#endif // ENABLE_HIDPI
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
const Sprites &Style::sprites(const QPointF &scale) const
|
const Sprites &Style::sprites(const QPointF &scale) const
|
||||||
{
|
{
|
||||||
#ifdef ENABLE_HIDPI
|
|
||||||
return (scale.x() > 1.0 || scale.y() > 1.0)
|
return (scale.x() > 1.0 || scale.y() > 1.0)
|
||||||
&& !_sprites2x.isNull() ? _sprites2x : _sprites;
|
&& !_sprites2x.isNull() ? _sprites2x : _sprites;
|
||||||
#else // ENABLE_HIDPI
|
|
||||||
Q_UNUSED(scale);
|
|
||||||
return _sprites;
|
|
||||||
#endif // ENABLE_HIDPI
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Style::setupLayer(Tile &tile, const Layer &layer) const
|
void Style::setupLayer(Tile &tile, const Layer &layer) const
|
||||||
|
@ -12,7 +12,6 @@
|
|||||||
#include <QBrush>
|
#include <QBrush>
|
||||||
#include <QFont>
|
#include <QFont>
|
||||||
#include "pbf.h"
|
#include "pbf.h"
|
||||||
#include "config.h"
|
|
||||||
#include "text.h"
|
#include "text.h"
|
||||||
#include "function.h"
|
#include "function.h"
|
||||||
#include "sprites.h"
|
#include "sprites.h"
|
||||||
@ -179,10 +178,7 @@ private:
|
|||||||
Tile &tile) const;
|
Tile &tile) const;
|
||||||
|
|
||||||
QVector<Layer> _layers;
|
QVector<Layer> _layers;
|
||||||
Sprites _sprites;
|
Sprites _sprites, _sprites2x;
|
||||||
#ifdef ENABLE_HIDPI
|
|
||||||
Sprites _sprites2x;
|
|
||||||
#endif // QT >= 5.6
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // STYLE_H
|
#endif // STYLE_H
|
||||||
|
@ -3,25 +3,62 @@
|
|||||||
#include "textpathitem.h"
|
#include "textpathitem.h"
|
||||||
|
|
||||||
|
|
||||||
|
#if QT_VERSION < QT_VERSION_CHECK(5, 15, 0)
|
||||||
|
#define INTERSECTS intersect
|
||||||
|
#else // QT 5.15
|
||||||
|
#define INTERSECTS intersects
|
||||||
|
#endif // QT 5.15
|
||||||
|
|
||||||
static bool intersection(const QLineF &line, const QRectF &rect,
|
static bool intersection(const QLineF &line, const QRectF &rect,
|
||||||
QPointF *p)
|
QPointF *p)
|
||||||
{
|
{
|
||||||
if (line.intersect(QLineF(rect.topLeft(), rect.topRight()), p)
|
if (line.INTERSECTS(QLineF(rect.topLeft(), rect.topRight()), p)
|
||||||
== QLineF::BoundedIntersection)
|
== QLineF::BoundedIntersection)
|
||||||
return true;
|
return true;
|
||||||
if (line.intersect(QLineF(rect.topLeft(), rect.bottomLeft()), p)
|
if (line.INTERSECTS(QLineF(rect.topLeft(), rect.bottomLeft()), p)
|
||||||
== QLineF::BoundedIntersection)
|
== QLineF::BoundedIntersection)
|
||||||
return true;
|
return true;
|
||||||
if (line.intersect(QLineF(rect.bottomRight(), rect.bottomLeft()), p)
|
if (line.INTERSECTS(QLineF(rect.bottomRight(), rect.bottomLeft()), p)
|
||||||
== QLineF::BoundedIntersection)
|
== QLineF::BoundedIntersection)
|
||||||
return true;
|
return true;
|
||||||
if (line.intersect(QLineF(rect.bottomRight(), rect.topRight()), p)
|
if (line.INTERSECTS(QLineF(rect.bottomRight(), rect.topRight()), p)
|
||||||
== QLineF::BoundedIntersection)
|
== QLineF::BoundedIntersection)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static bool intersection(const QLineF &line, const QRectF &rect, QPointF *p1,
|
||||||
|
QPointF *p2)
|
||||||
|
{
|
||||||
|
QPointF *p = p1;
|
||||||
|
|
||||||
|
if (line.INTERSECTS(QLineF(rect.topLeft(), rect.topRight()), p)
|
||||||
|
== QLineF::BoundedIntersection)
|
||||||
|
p = p2;
|
||||||
|
if (line.INTERSECTS(QLineF(rect.topLeft(), rect.bottomLeft()), p)
|
||||||
|
== QLineF::BoundedIntersection) {
|
||||||
|
if (p == p2)
|
||||||
|
return true;
|
||||||
|
p = p2;
|
||||||
|
}
|
||||||
|
if (line.INTERSECTS(QLineF(rect.bottomRight(), rect.bottomLeft()), p)
|
||||||
|
== QLineF::BoundedIntersection) {
|
||||||
|
if (p == p2)
|
||||||
|
return true;
|
||||||
|
p = p2;
|
||||||
|
}
|
||||||
|
if (line.INTERSECTS(QLineF(rect.bottomRight(), rect.topRight()), p)
|
||||||
|
== QLineF::BoundedIntersection) {
|
||||||
|
if (p == p2)
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
Q_ASSERT(p != p2);
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
static QPainterPath subpath(const QList<QLineF> &lines, int start, int end,
|
static QPainterPath subpath(const QList<QLineF> &lines, int start, int end,
|
||||||
qreal cut)
|
qreal cut)
|
||||||
{
|
{
|
||||||
@ -62,8 +99,8 @@ static QList<QLineF> lineString(const QPainterPath &path,
|
|||||||
const QRectF &boundingRect)
|
const QRectF &boundingRect)
|
||||||
{
|
{
|
||||||
QList<QLineF> lines;
|
QList<QLineF> lines;
|
||||||
int start = 0, end = path.elementCount() - 1;
|
int start = -1, end = -1;
|
||||||
QPointF p;
|
|
||||||
|
|
||||||
for (int i = 0; i < path.elementCount(); i++) {
|
for (int i = 0; i < path.elementCount(); i++) {
|
||||||
if (boundingRect.contains(path.elementAt(i))) {
|
if (boundingRect.contains(path.elementAt(i))) {
|
||||||
@ -78,17 +115,31 @@ static QList<QLineF> lineString(const QPainterPath &path,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (start > 0) {
|
if (start < 0) {
|
||||||
QLineF l(path.elementAt(start-1), path.elementAt(start));
|
QPointF p1, p2;
|
||||||
if (intersection(l, boundingRect, &p))
|
|
||||||
lines.append(QLineF(p, path.elementAt(start)));
|
for (int i = 1; i < path.elementCount(); i++) {
|
||||||
}
|
QLineF l(path.elementAt(i-1), path.elementAt(i));
|
||||||
for (int i = start + 1; i <= end; i++)
|
if (intersection(l, boundingRect, &p1, &p2)) {
|
||||||
lines.append(QLineF(path.elementAt(i-1), path.elementAt(i)));
|
lines.append(QLineF(p1, p2));
|
||||||
if (end < path.elementCount() - 1) {
|
break;
|
||||||
QLineF l(path.elementAt(end), path.elementAt(end+1));
|
}
|
||||||
if (intersection(l, boundingRect, &p))
|
}
|
||||||
lines.append(QLineF(path.elementAt(end), p));
|
} else {
|
||||||
|
QPointF p;
|
||||||
|
|
||||||
|
if (start > 0) {
|
||||||
|
QLineF l(path.elementAt(start-1), path.elementAt(start));
|
||||||
|
if (intersection(l, boundingRect, &p))
|
||||||
|
lines.append(QLineF(p, path.elementAt(start)));
|
||||||
|
}
|
||||||
|
for (int i = start + 1; i <= end; i++)
|
||||||
|
lines.append(QLineF(path.elementAt(i-1), path.elementAt(i)));
|
||||||
|
if (end < path.elementCount() - 1) {
|
||||||
|
QLineF l(path.elementAt(end), path.elementAt(end+1));
|
||||||
|
if (intersection(l, boundingRect, &p))
|
||||||
|
lines.append(QLineF(path.elementAt(end), p));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return lines;
|
return lines;
|
||||||
@ -98,6 +149,8 @@ static QPainterPath textPath(const QPainterPath &path, qreal textWidth,
|
|||||||
qreal maxAngle, qreal charWidth, const QRectF &tileRect)
|
qreal maxAngle, qreal charWidth, const QRectF &tileRect)
|
||||||
{
|
{
|
||||||
QList<QLineF> lines(lineString(path, tileRect));
|
QList<QLineF> lines(lineString(path, tileRect));
|
||||||
|
if (lines.isEmpty())
|
||||||
|
return QPainterPath();
|
||||||
qreal length = 0;
|
qreal length = 0;
|
||||||
qreal angle = lines.first().angle();
|
qreal angle = lines.first().angle();
|
||||||
int last = 0;
|
int last = 0;
|
||||||
@ -159,7 +212,7 @@ void TextPathItem::paint(QPainter *painter) const
|
|||||||
//painter->drawPath(_shape);
|
//painter->drawPath(_shape);
|
||||||
|
|
||||||
QFontMetrics fm(font());
|
QFontMetrics fm(font());
|
||||||
int textWidth = fm.width(text());
|
int textWidth = fm.boundingRect(text()).width();
|
||||||
|
|
||||||
qreal factor = (textWidth) / qMax(_path.length(), (qreal)textWidth);
|
qreal factor = (textWidth) / qMax(_path.length(), (qreal)textWidth);
|
||||||
qreal percent = (1.0 - factor) / 2.0;
|
qreal percent = (1.0 - factor) / 2.0;
|
||||||
@ -186,7 +239,7 @@ void TextPathItem::paint(QPainter *painter) const
|
|||||||
painter->drawText(QPoint(1, fm.descent()), text().at(i));
|
painter->drawText(QPoint(1, fm.descent()), text().at(i));
|
||||||
painter->setTransform(t);
|
painter->setTransform(t);
|
||||||
|
|
||||||
int width = fm.charWidth(text(), i);
|
int width = fm.horizontalAdvance(text().at(i));
|
||||||
percent += ((qreal)width / (qreal)textWidth) * factor;
|
percent += ((qreal)width / (qreal)textWidth) * factor;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -203,7 +256,7 @@ void TextPathItem::paint(QPainter *painter) const
|
|||||||
painter->drawText(QPoint(0, fm.descent()), text().at(i));
|
painter->drawText(QPoint(0, fm.descent()), text().at(i));
|
||||||
painter->setTransform(t);
|
painter->setTransform(t);
|
||||||
|
|
||||||
int width = fm.charWidth(text(), i);
|
int width = fm.horizontalAdvance(text().at(i));
|
||||||
percent += ((qreal)width / (qreal)textWidth) * factor;
|
percent += ((qreal)width / (qreal)textWidth) * factor;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
#include <QPainter>
|
#include <QPainter>
|
||||||
#include <QtMath>
|
#include <QtMath>
|
||||||
#include <QStaticText>
|
#include <QStaticText>
|
||||||
#include "config.h"
|
|
||||||
#include "textpointitem.h"
|
#include "textpointitem.h"
|
||||||
|
|
||||||
|
|
||||||
@ -50,16 +49,10 @@ QRectF TextPointItem::fuzzyBoundingRect() const
|
|||||||
return QRectF(0, 0, width, lines * fs * 1.6);
|
return QRectF(0, 0, width, lines * fs * 1.6);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
QRectF TextPointItem::moveTextRect(const QRectF &rect) const
|
QRectF TextPointItem::moveTextRect(const QRectF &rect) const
|
||||||
{
|
{
|
||||||
#ifdef ENABLE_HIDPI
|
|
||||||
QRectF iconRect = _icon.isNull() ? QRectF()
|
QRectF iconRect = _icon.isNull() ? QRectF()
|
||||||
: QRectF(QPointF(0, 0), QSizeF(_icon.size()) / _icon.devicePixelRatioF());
|
: QRectF(QPointF(0, 0), QSizeF(_icon.size()) / _icon.devicePixelRatioF());
|
||||||
#else // ENABLE_HIDPI
|
|
||||||
QRectF iconRect = _icon.isNull() ? QRectF() : QRectF(QPointF(0, 0),
|
|
||||||
QSizeF(_icon.size()));
|
|
||||||
#endif // ENABLE_HIDPI
|
|
||||||
QRectF textRect(rect);
|
QRectF textRect(rect);
|
||||||
|
|
||||||
switch (_anchor) {
|
switch (_anchor) {
|
||||||
@ -96,12 +89,8 @@ TextPointItem::TextPointItem(const QString &text, const QPointF &pos,
|
|||||||
_boundingRect = moveTextRect(_textRect);
|
_boundingRect = moveTextRect(_textRect);
|
||||||
|
|
||||||
if (!_icon.isNull()) {
|
if (!_icon.isNull()) {
|
||||||
#ifdef ENABLE_HIDPI
|
|
||||||
QRectF iconRect(QPointF(0, 0), QSizeF(_icon.size())
|
QRectF iconRect(QPointF(0, 0), QSizeF(_icon.size())
|
||||||
/ _icon.devicePixelRatioF());
|
/ _icon.devicePixelRatioF());
|
||||||
#else // ENABLE_HIDPI
|
|
||||||
QRectF iconRect(QPointF(0, 0), QSizeF(_icon.size()));
|
|
||||||
#endif // ENABLE_HIDPI
|
|
||||||
iconRect.moveCenter(pos);
|
iconRect.moveCenter(pos);
|
||||||
_boundingRect |= iconRect;
|
_boundingRect |= iconRect;
|
||||||
}
|
}
|
||||||
@ -127,14 +116,9 @@ void TextPointItem::paint(QPainter *painter) const
|
|||||||
|
|
||||||
if (!_icon.isNull()) {
|
if (!_icon.isNull()) {
|
||||||
textRect = moveTextRect(painter->boundingRect(_textRect, FLAGS, text()));
|
textRect = moveTextRect(painter->boundingRect(_textRect, FLAGS, text()));
|
||||||
#ifdef ENABLE_HIDPI
|
|
||||||
painter->drawImage(_pos - QPointF(_icon.width()
|
painter->drawImage(_pos - QPointF(_icon.width()
|
||||||
/ _icon.devicePixelRatioF() / 2, _icon.height()
|
/ _icon.devicePixelRatioF() / 2, _icon.height()
|
||||||
/ _icon.devicePixelRatioF() / 2), _icon);
|
/ _icon.devicePixelRatioF() / 2), _icon);
|
||||||
#else // ENABLE_HIDPI
|
|
||||||
painter->drawImage(_pos - QPointF(_icon.width() / 2,
|
|
||||||
_icon.height() / 2), _icon);
|
|
||||||
#endif // ENABLE_HIDPI
|
|
||||||
} else
|
} else
|
||||||
textRect = _boundingRect;
|
textRect = _boundingRect;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user