Merge remote-tracking branch 'origin/5.12' into 5.13

Change-Id: Ibce9bfef928ce39070183c488ce86ae32e5ea705
This commit is contained in:
Qt Forward Merge Bot 2019-04-28 01:00:26 +02:00
commit 9f1a1e320c
13 changed files with 113 additions and 33 deletions

View File

@ -17,7 +17,7 @@ QMAKE_EXTENSION_SHLIB = dylib
QMAKE_EXTENSIONS_AUX_SHLIB = tbd
QMAKE_LIBDIR =
# qtConfLibrary_openglMakeSpec will prefix the proper SDK sysroot
# sdk.prf will prefix the proper SDK sysroot
QMAKE_INCDIR_OPENGL = \
/System/Library/Frameworks/OpenGL.framework/Headers \
/System/Library/Frameworks/AGL.framework/Headers/

View File

@ -33,6 +33,13 @@ QMAKE_MAC_SDK_PATH = $$xcodeSDKInfo(Path)
QMAKE_MAC_SDK_PLATFORM_PATH = $$xcodeSDKInfo(PlatformPath)
QMAKE_MAC_SDK_VERSION = $$xcodeSDKInfo(SDKVersion)
isEmpty(QMAKE_EXPORT_INCDIR_OPENGL) {
QMAKE_EXPORT_INCDIR_OPENGL = $$QMAKE_INCDIR_OPENGL
sysrootified =
for(val, QMAKE_INCDIR_OPENGL): sysrootified += $${QMAKE_MAC_SDK_PATH}$$val
QMAKE_INCDIR_OPENGL = $$sysrootified
}
QMAKESPEC_NAME = $$basename(QMAKESPEC)
# Resolve SDK version of various tools

View File

@ -790,6 +790,11 @@ defineTest(qtConfLibrary_makeSpec) {
!qtConfResolvePathIncs($${1}.includedir, $$eval(QMAKE_INCDIR_$$spec), $$2): \
return(false)
!isEmpty(QMAKE_EXPORT_INCDIR_$$spec) {
$${1}.exportincludedir = $$eval(QMAKE_EXPORT_INCDIR_$$spec)
export($${1}.exportincludedir)
}
# note that the object is re-exported, because we resolve the libraries.
return(true)
@ -957,7 +962,8 @@ defineTest(qtConfExportLibrary) {
}
defines = $$eval($${spfx}.defines)
!isEmpty(defines): qtConfOutputVar(assign, $$output, QMAKE_DEFINES_$$NAME, $$defines)
includes = $$eval($${spfx}.includedir)
includes = $$eval($${spfx}.exportincludedir)
isEmpty(includes): includes = $$eval($${spfx}.includedir)
!isEmpty(includes): qtConfOutputVar(assign, $$output, QMAKE_INCDIR_$$NAME, $$includes)
uses = $$eval($${lpfx}.dependencies)
!isEmpty(uses) {

View File

@ -844,10 +844,16 @@ QFile::copy(const QString &newName)
error = true;
}
}
if (!error && !out.rename(newName)) {
error = true;
close();
d->setError(QFile::CopyError, tr("Cannot create %1 for output").arg(newName));
if (!error) {
// Sync to disk if possible. Ignore errors (e.g. not supported).
d->fileEngine->syncToDisk();
if (!out.rename(newName)) {
error = true;
close();
d->setError(QFile::CopyError, tr("Cannot create %1 for output").arg(newName));
}
}
#ifdef QT_NO_TEMPORARYFILE
if (error)

View File

@ -775,6 +775,7 @@ void QProcessPrivate::Channel::clear()
/*!
\class QProcess::CreateProcessArguments
\inmodule QtCore
\note This struct is only available on the Windows platform.
This struct is a representation of all parameters of the Windows API

View File

@ -1456,6 +1456,7 @@ bool QCborStreamWriter::endMap()
/*!
\class QCborStreamReader::StringResult
\inmodule QtCore
This class is returned by readString() and readByteArray(), with either the
contents of the string that was read or an indication that the parsing is

View File

@ -448,7 +448,7 @@
],
"sources": [
{ "type": "pkgConfig", "args": "gl", "condition": "!config.darwin" },
{ "type": "openglMakeSpec" }
{ "type": "makeSpec", "spec": "OPENGL" }
]
},
"opengl_es2": {

View File

@ -15,17 +15,6 @@ defineTest(qtConfLibrary_freetype) {
return(true)
}
defineTest(qtConfLibrary_openglMakeSpec) {
darwin:sdk {
sysrootified =
for(val, QMAKE_INCDIR_OPENGL): sysrootified += $${QMAKE_MAC_SDK_PATH}$$val
QMAKE_INCDIR_OPENGL = $$sysrootified
}
$${1}.spec = OPENGL
!qtConfLibrary_makeSpec($$1, $$2): return(false)
return(true)
}
# Check for Direct X shader compiler 'fxc'.
# Up to Direct X SDK June 2010 and for MinGW, this is pointed to by the
# DXSDK_DIR variable. Starting with Windows Kit 8, it is included in

View File

@ -1366,7 +1366,7 @@ bool QOpenGLDebugLogger::initialize()
#define GET_DEBUG_PROC_ADDRESS(procName) \
d->procName = reinterpret_cast< qt_ ## procName ## _t >( \
d->context->getProcAddress(#procName) \
d->context->getProcAddress(d->context->isOpenGLES() ? (#procName "KHR") : (#procName)) \
);
GET_DEBUG_PROC_ADDRESS(glDebugMessageControl);

View File

@ -145,6 +145,9 @@ struct QTextLayoutStruct {
inline QFixed absoluteY() const
{ return frameY + y; }
inline QFixed contentHeight() const
{ return pageHeight - pageBottomMargin - pageTopMargin; }
inline int currentPage() const
{ return pageHeight == 0 ? 0 : (absoluteY() / pageHeight).truncate(); }
@ -2701,7 +2704,7 @@ void QTextDocumentLayoutPrivate::layoutBlock(const QTextBlock &bl, int blockPosi
getLineHeightParams(blockFormat, line, scaling, &lineAdjustment, &lineBreakHeight, &lineHeight, &lineBottom);
while (layoutStruct->pageHeight > 0 && layoutStruct->absoluteY() + lineBreakHeight > layoutStruct->pageBottom &&
layoutStruct->pageHeight >= lineBreakHeight) {
layoutStruct->contentHeight() >= lineBreakHeight) {
layoutStruct->newPage();
floatMargins(layoutStruct->y, layoutStruct, &left, &right);

View File

@ -137,8 +137,7 @@ void emit_results_ready(const QHostInfo &hostInfo, const QObject *receiver,
\inmodule QtNetwork
\ingroup network
QHostInfo uses the lookup mechanisms provided by the operating
system to find the IP address(es) associated with a host name,
QHostInfo finds the IP address(es) associated with a host name,
or the host name associated with an IP address.
The class provides two static convenience functions: one that
works asynchronously and emits a signal once the host is found,
@ -173,6 +172,11 @@ void emit_results_ready(const QHostInfo &hostInfo, const QObject *receiver,
To retrieve the name of the local host, use the static
QHostInfo::localHostName() function.
QHostInfo uses the mechanisms provided by the operating system
to perform the lookup. As per {https://tools.ietf.org/html/rfc6724}{RFC 6724}
there is no guarantee that all IP addresses registered for a domain or
host will be returned.
\note Since Qt 4.6.1 QHostInfo is using multiple threads for DNS lookup
instead of one dedicated DNS thread. This improves performance,
but also changes the order of signal emissions when using lookupHost()
@ -180,7 +184,8 @@ void emit_results_ready(const QHostInfo &hostInfo, const QObject *receiver,
\note Since Qt 4.6.3 QHostInfo is using a small internal 60 second DNS cache
for performance improvements.
\sa QAbstractSocket, {http://www.rfc-editor.org/rfc/rfc3492.txt}{RFC 3492}
\sa QAbstractSocket, {http://www.rfc-editor.org/rfc/rfc3492.txt}{RFC 3492},
{https://tools.ietf.org/html/rfc6724}{RFC 6724}
*/
static int nextId()

View File

@ -184,9 +184,11 @@ static HCURSOR createBitmapCursor(const QCursor &cursor, qreal scaleFactor = 1)
return createBitmapCursor(bbits, mbits, cursor.hotSpot(), invb, invm);
}
static QSize systemCursorSize(const QPlatformScreen *screen = nullptr)
static QSize systemCursorSize() { return QSize(GetSystemMetrics(SM_CXCURSOR), GetSystemMetrics(SM_CYCURSOR)); }
static QSize screenCursorSize(const QPlatformScreen *screen = nullptr)
{
const QSize primaryScreenCursorSize(GetSystemMetrics(SM_CXCURSOR), GetSystemMetrics(SM_CYCURSOR));
const QSize primaryScreenCursorSize = systemCursorSize();
if (screen) {
// Correct the size if the DPI value of the screen differs from
// that of the primary screen.
@ -212,7 +214,7 @@ static inline QSize standardCursorSize() { return QSize(32, 32); }
// createBitmapCursor() only work for standard sizes (32,48,64...), which does
// not work when scaling the 16x16 openhand cursor bitmaps to 150% (resulting
// in a non-standard 24x24 size).
static QWindowsCursor::PixmapCursor createPixmapCursorFromData(const QSize &systemCursorSize,
static QWindowsCursor::PixmapCursor createPixmapCursorFromData(const QSize &screenCursorSize,
// The cursor size the bitmap is targeted for
const QSize &bitmapTargetCursorSize,
// The actual size of the bitmap data
@ -222,7 +224,7 @@ static QWindowsCursor::PixmapCursor createPixmapCursorFromData(const QSize &syst
QPixmap rawImage = QPixmap::fromImage(QBitmap::fromData(QSize(bitmapSize, bitmapSize), bits).toImage());
rawImage.setMask(QBitmap::fromData(QSize(bitmapSize, bitmapSize), maskBits));
const qreal factor = qreal(systemCursorSize.width()) / qreal(bitmapTargetCursorSize.width());
const qreal factor = qreal(screenCursorSize.width()) / qreal(bitmapTargetCursorSize.width());
// Scale images if the cursor size is significantly different, starting with 150% where the system cursor
// size is 48.
if (qAbs(factor - 1.0) > 0.4) {
@ -402,13 +404,13 @@ QWindowsCursor::PixmapCursor QWindowsCursor::customCursor(Qt::CursorShape cursor
switch (cursorShape) {
case Qt::SplitVCursor:
return createPixmapCursorFromData(systemCursorSize(screen), standardCursorSize(), 32, vsplit_bits, vsplitm_bits);
return createPixmapCursorFromData(screenCursorSize(screen), standardCursorSize(), 32, vsplit_bits, vsplitm_bits);
case Qt::SplitHCursor:
return createPixmapCursorFromData(systemCursorSize(screen), standardCursorSize(), 32, hsplit_bits, hsplitm_bits);
return createPixmapCursorFromData(screenCursorSize(screen), standardCursorSize(), 32, hsplit_bits, hsplitm_bits);
case Qt::OpenHandCursor:
return createPixmapCursorFromData(systemCursorSize(screen), standardCursorSize(), 16, openhand_bits, openhandm_bits);
return createPixmapCursorFromData(screenCursorSize(screen), standardCursorSize(), 16, openhand_bits, openhandm_bits);
case Qt::ClosedHandCursor:
return createPixmapCursorFromData(systemCursorSize(screen), standardCursorSize(), 16, closedhand_bits, closedhandm_bits);
return createPixmapCursorFromData(screenCursorSize(screen), standardCursorSize(), 16, closedhand_bits, closedhandm_bits);
case Qt::DragCopyCursor:
return QWindowsCursor::PixmapCursor(QPixmap(copyDragCursorXpmC), QPoint(0, 0));
case Qt::DragMoveCursor:
@ -454,7 +456,7 @@ QWindowsCursor::PixmapCursor QWindowsCursor::customCursor(Qt::CursorShape cursor
{ Qt::DragLinkCursor, 64, "draglinkcursor_64.png", 0, 0 }
};
const QSize cursorSize = systemCursorSize(screen);
const QSize cursorSize = screenCursorSize(screen);
const QWindowsCustomPngCursor *sEnd = pngCursors + sizeof(pngCursors) / sizeof(pngCursors[0]);
const QWindowsCustomPngCursor *bestFit = nullptr;
int sizeDelta = INT_MAX;
@ -507,7 +509,7 @@ HCURSOR QWindowsCursor::createCursorFromShape(Qt::CursorShape cursorShape, const
switch (cursorShape) {
case Qt::BlankCursor: {
QImage blank = QImage(systemCursorSize(screen), QImage::Format_Mono);
QImage blank = QImage(systemCursorSize(), QImage::Format_Mono);
blank.fill(0); // ignore color table
return createBitmapCursor(blank, blank);
}

View File

@ -59,6 +59,8 @@ private slots:
void imageAtRightAlignedTab();
void blockVisibility();
void largeImage();
private:
QTextDocument *doc;
};
@ -347,5 +349,63 @@ void tst_QTextDocumentLayout::blockVisibility()
QCOMPARE(doc->size(), halfSize);
}
void tst_QTextDocumentLayout::largeImage()
{
auto img = QImage(400, 500, QImage::Format_ARGB32_Premultiplied);
img.fill(Qt::black);
{
QTextDocument document;
document.addResource(QTextDocument::ImageResource,
QUrl("data://test.png"), QVariant(img));
document.setPageSize({500, 504});
auto html = "<img src=\"data://test.png\">";
document.setHtml(html);
QCOMPARE(document.pageCount(), 2);
}
{
QTextDocument document;
document.addResource(QTextDocument::ImageResource,
QUrl("data://test.png"), QVariant(img));
document.setPageSize({500, 508});
auto html = "<img src=\"data://test.png\">";
document.setHtml(html);
QCOMPARE(document.pageCount(), 1);
}
{
QTextDocument document;
document.addResource(QTextDocument::ImageResource,
QUrl("data://test.png"), QVariant(img));
document.setPageSize({585, 250});
auto html = "<img src=\"data://test.png\">";
document.setHtml(html);
QCOMPARE(document.pageCount(), 3);
}
{
QTextDocument document;
document.addResource(QTextDocument::ImageResource,
QUrl("data://test.png"), QVariant(img));
document.setPageSize({585, 258});
auto html = "<img src=\"data://test.png\">";
document.setHtml(html);
QCOMPARE(document.pageCount(), 2);
}
}
QTEST_MAIN(tst_QTextDocumentLayout)
#include "tst_qtextdocumentlayout.moc"