Skip to content

Commit

Permalink
Merge "Merge remote-tracking branch 'origin/5.7' into 5.8" into refs/…
Browse files Browse the repository at this point in the history
…staging/5.8
  • Loading branch information
liangqi authored and The Qt Project committed Sep 6, 2016
2 parents beaa792 + d892e6f commit 23ef3b0
Show file tree
Hide file tree
Showing 126 changed files with 1,397 additions and 1,192 deletions.
6 changes: 3 additions & 3 deletions mkspecs/features/qt_common.prf
Original file line number Diff line number Diff line change
Expand Up @@ -68,12 +68,12 @@ warnings_are_errors:warning_clean {
# If the module declares that it has does its clean-up of warnings, enable -Werror.
# This setting is compiler-dependent anyway because it depends on the version of the
# compiler.
clang:!uikit {
# Apple clang 4.0-4.2,5.0-5.1,6.0-6.4
clang {
# Apple clang 4.0-4.2,5.0-5.1,6.0-6.4,7.0-7.3
# Regular clang 3.3-3.9
apple_ver = $${QT_APPLE_CLANG_MAJOR_VERSION}.$${QT_APPLE_CLANG_MINOR_VERSION}
reg_ver = $${QT_CLANG_MAJOR_VERSION}.$${QT_CLANG_MINOR_VERSION}
contains(apple_ver, "4\\.[012]|5\\.[01]|6\\.[01234]")|contains(reg_ver, "3\\.[3-9]") {
contains(apple_ver, "4\\.[012]|5\\.[01]|6\\.[01234]|7\\.[0123]")|contains(reg_ver, "3\\.[3-9]") {
QMAKE_CXXFLAGS_WARN_ON += -Werror -Wno-error=\\$${LITERAL_HASH}warnings -Wno-error=deprecated-declarations $$WERROR
}
} else:intel_icc:linux {
Expand Down
4 changes: 3 additions & 1 deletion src/corelib/global/qcompilerdetection.h
Original file line number Diff line number Diff line change
Expand Up @@ -942,7 +942,8 @@
# endif /* VC 11 */
# if _MSC_VER >= 1800
/* C++11 features in VC12 = VC2013 */
# define Q_COMPILER_DEFAULT_MEMBERS
/* Implemented, but can't be used on move special members */
/* # define Q_COMPILER_DEFAULT_MEMBERS */
# define Q_COMPILER_DELETE_MEMBERS
# define Q_COMPILER_DELEGATING_CONSTRUCTORS
# define Q_COMPILER_EXPLICIT_CONVERSIONS
Expand All @@ -960,6 +961,7 @@
# endif /* VC 12 SP 2 RC */
# if _MSC_VER >= 1900
/* C++11 features in VC14 = VC2015 */
# define Q_COMPILER_DEFAULT_MEMBERS
# define Q_COMPILER_ALIGNAS
# define Q_COMPILER_ALIGNOF
// Partial support, insufficient for Qt
Expand Down
7 changes: 4 additions & 3 deletions src/corelib/tools/qbytearray.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -303,13 +303,14 @@ char *qstrncpy(char *dst, const char *src, uint len)
{
if (!src || !dst)
return 0;
if (len > 0) {
#if defined(_MSC_VER) && _MSC_VER >= 1400
strncpy_s(dst, len, src, len-1);
strncpy_s(dst, len, src, len - 1);
#else
strncpy(dst, src, len);
strncpy(dst, src, len);
#endif
if (len > 0)
dst[len-1] = '\0';
}
return dst;
}

Expand Down
47 changes: 27 additions & 20 deletions src/gui/image/qicon.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@
#include "private/qiconloader_p.h"
#include "qpainter.h"
#include "qfileinfo.h"
#include <qmimedatabase.h>
#include <qmimetype.h>
#include "qpixmapcache.h"
#include "qvariant.h"
#include "qcache.h"
Expand Down Expand Up @@ -839,8 +841,11 @@ QPixmap QIcon::pixmap(QWindow *window, const QSize &size, Mode mode, State state
qreal devicePixelRatio = qt_effective_device_pixel_ratio(window);

// Handle the simple normal-dpi case:
if (!(devicePixelRatio > 1.0))
return d->engine->pixmap(size, mode, state);
if (!(devicePixelRatio > 1.0)) {
QPixmap pixmap = d->engine->pixmap(size, mode, state);
pixmap.setDevicePixelRatio(1.0);
return pixmap;
}

// Try get a pixmap that is big enough to be displayed at device pixel resolution.
QPixmap pixmap = d->engine->pixmap(size * devicePixelRatio, mode, state);
Expand Down Expand Up @@ -976,6 +981,18 @@ void QIcon::addPixmap(const QPixmap &pixmap, Mode mode, State state)
d->engine->addPixmap(pixmap, mode, state);
}

static QIconEngine *iconEngineFromSuffix(const QString &fileName, const QString &suffix)
{
if (!suffix.isEmpty()) {
const int index = loader()->indexOf(suffix);
if (index != -1) {
if (QIconEnginePlugin *factory = qobject_cast<QIconEnginePlugin*>(loader()->instance(index))) {
return factory->create(fileName);
}
}
}
return nullptr;
}

/*! Adds an image from the file with the given \a fileName to the
icon, as a specialization for \a size, \a mode and \a state. The
Expand Down Expand Up @@ -1013,25 +1030,15 @@ void QIcon::addFile(const QString &fileName, const QSize &size, Mode mode, State
return;
detach();
if (!d) {

QFileInfo info(fileName);
QString suffix = info.suffix();
if (!suffix.isEmpty()) {
// first try version 2 engines..
const int index = loader()->indexOf(suffix);
if (index != -1) {
if (QIconEnginePlugin *factory = qobject_cast<QIconEnginePlugin*>(loader()->instance(index))) {
if (QIconEngine *engine = factory->create(fileName)) {
d = new QIconPrivate;
d->engine = engine;
}
}
}
}
// ...then fall back to the default engine
if (!d) {
d = new QIconPrivate;
d->engine = new QPixmapIconEngine;
}
QIconEngine *engine = iconEngineFromSuffix(fileName, info.suffix());
#ifndef QT_NO_MIMETYPE
if (!engine)
engine = iconEngineFromSuffix(fileName, QMimeDatabase().mimeTypeForFile(info).preferredSuffix());
#endif // !QT_NO_MIMETYPE
d = new QIconPrivate;
d->engine = engine ? engine : new QPixmapIconEngine;
}

d->engine->addFile(fileName, size, mode, state);
Expand Down
3 changes: 3 additions & 0 deletions src/gui/kernel/qwindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2195,6 +2195,9 @@ void QWindowPrivate::deliverUpdateRequest()
*/
void QWindow::requestUpdate()
{
Q_ASSERT_X(QThread::currentThread() == QCoreApplication::instance()->thread(),
"QWindow", "Updates can only be scheduled from the GUI (main) thread");

Q_D(QWindow);
if (d->updateRequestPending || !d->platformWindow)
return;
Expand Down
10 changes: 8 additions & 2 deletions src/gui/kernel/qwindow_p.h
Original file line number Diff line number Diff line change
Expand Up @@ -126,8 +126,14 @@ class Q_GUI_EXPORT QWindowPrivate : public QObjectPrivate
QPoint globalPosition() const {
Q_Q(const QWindow);
QPoint offset = q->position();
for (const QWindow *p = q->parent(); p; p = p->parent())
offset += p->position();
for (const QWindow *p = q->parent(); p; p = p->parent()) {
if (p->type() != Qt::ForeignWindow) {
offset += p->position();
} else { // QTBUG-43252, mapToGlobal() for foreign children.
offset += p->mapToGlobal(QPoint(0, 0));
break;
}
}
return offset;
}

Expand Down
2 changes: 1 addition & 1 deletion src/gui/opengl/qopenglframebufferobject.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1283,11 +1283,11 @@ static inline QImage qt_gl_read_framebuffer_rgba8(const QSize &size, bool includ
? context->hasExtension(QByteArrayLiteral("GL_EXT_read_format_bgra"))
: context->hasExtension(QByteArrayLiteral("GL_EXT_bgra"));

#ifndef Q_OS_IOS
const char *renderer = reinterpret_cast<const char *>(funcs->glGetString(GL_RENDERER));
const char *ver = reinterpret_cast<const char *>(funcs->glGetString(GL_VERSION));

// Blacklist GPU chipsets that have problems with their BGRA support.
#ifndef Q_OS_IOS
const bool blackListed = (qstrcmp(renderer, "PowerVR Rogue G6200") == 0
&& ::strstr(ver, "1.3") != 0) ||
(qstrcmp(renderer, "Mali-T760") == 0
Expand Down
65 changes: 33 additions & 32 deletions src/gui/painting/qdrawhelper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5555,17 +5555,17 @@ static const ProcessSpans processTextureSpans[NBlendTypes][QImage::NImageFormats
blend_src_generic, // ARGB32
blend_transformed_argb, // ARGB32_Premultiplied
blend_transformed_rgb565,
blend_src_generic,
blend_src_generic,
blend_src_generic,
blend_src_generic,
blend_src_generic,
blend_src_generic,
blend_src_generic,
blend_src_generic,
blend_src_generic,
blend_src_generic,
blend_src_generic,
blend_src_generic, // ARGB8565_Premultiplied
blend_src_generic, // RGB666
blend_src_generic, // ARGB6666_Premultiplied
blend_src_generic, // RGB555
blend_src_generic, // ARGB8555_Premultiplied
blend_src_generic, // RGB888
blend_src_generic, // RGB444
blend_src_generic, // ARGB4444_Premultiplied
blend_src_generic, // RGBX8888
blend_src_generic, // RGBA8888
blend_src_generic, // RGBA8888_Premultiplied
blend_src_generic_rgb64,
blend_src_generic_rgb64,
blend_src_generic_rgb64,
Expand All @@ -5583,16 +5583,17 @@ static const ProcessSpans processTextureSpans[NBlendTypes][QImage::NImageFormats
blend_src_generic, // ARGB32
blend_transformed_tiled_argb, // ARGB32_Premultiplied
blend_transformed_tiled_rgb565,
blend_src_generic,
blend_src_generic,
blend_src_generic,
blend_src_generic,
blend_src_generic,
blend_src_generic,
blend_src_generic,
blend_src_generic,
blend_src_generic,
blend_src_generic,
blend_src_generic, // ARGB8565_Premultiplied
blend_src_generic, // RGB666
blend_src_generic, // ARGB6666_Premultiplied
blend_src_generic, // RGB555
blend_src_generic, // ARGB8555_Premultiplied
blend_src_generic, // RGB888
blend_src_generic, // RGB444
blend_src_generic, // ARGB4444_Premultiplied
blend_src_generic, // RGBX8888
blend_src_generic, // RGBA8888
blend_src_generic, // RGBA8888_Premultiplied
blend_src_generic_rgb64,
blend_src_generic_rgb64,
blend_src_generic_rgb64,
Expand All @@ -5610,17 +5611,17 @@ static const ProcessSpans processTextureSpans[NBlendTypes][QImage::NImageFormats
blend_src_generic, // ARGB32
blend_src_generic, // ARGB32_Premultiplied
blend_transformed_bilinear_rgb565,
blend_src_generic,
blend_src_generic,
blend_src_generic,
blend_src_generic,
blend_src_generic,
blend_src_generic,
blend_src_generic,
blend_src_generic,
blend_src_generic,
blend_src_generic,
blend_src_generic,
blend_src_generic, // ARGB8565_Premultiplied
blend_src_generic, // RGB666
blend_src_generic, // ARGB6666_Premultiplied
blend_src_generic, // RGB555
blend_src_generic, // ARGB8555_Premultiplied
blend_src_generic, // RGB888
blend_src_generic, // RGB444
blend_src_generic, // ARGB4444_Premultiplied
blend_src_generic, // RGBX8888
blend_src_generic, // RGBA8888
blend_src_generic, // RGBA8888_Premultiplied
blend_src_generic_rgb64,
blend_src_generic_rgb64,
blend_src_generic_rgb64,
Expand Down
4 changes: 4 additions & 0 deletions src/gui/text/qfontdatabase.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -842,9 +842,13 @@ QStringList QPlatformFontDatabase::fallbacksForFamily(const QString &family, QFo
return retList;
}

static void initializeDb();

static QStringList fallbacksForFamily(const QString &family, QFont::Style style, QFont::StyleHint styleHint, QChar::Script script)
{
QFontDatabasePrivate *db = privateDb();
if (!db->count)
initializeDb();

const FallbacksCacheKey cacheKey = { family, style, styleHint, script };

Expand Down
5 changes: 4 additions & 1 deletion src/platformsupport/cglconvenience/cglconvenience.mm
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,11 @@ QSurfaceFormat qcgl_surfaceFormat()

QVector<NSOpenGLPixelFormatAttribute> attrs;

if (format.swapBehavior() != QSurfaceFormat::SingleBuffer)
if (format.swapBehavior() == QSurfaceFormat::DoubleBuffer
|| format.swapBehavior() == QSurfaceFormat::DefaultSwapBehavior)
attrs.append(NSOpenGLPFADoubleBuffer);
else if (format.swapBehavior() == QSurfaceFormat::TripleBuffer)
attrs.append(NSOpenGLPFATripleBuffer);

if (format.profile() == QSurfaceFormat::CoreProfile
&& ((format.majorVersion() == 3 && format.minorVersion() >= 2)
Expand Down
10 changes: 9 additions & 1 deletion src/plugins/platforms/cocoa/qcocoaglcontext.mm
Original file line number Diff line number Diff line change
Expand Up @@ -312,8 +312,16 @@ static void updateFormatFromContext(QSurfaceFormat *format)
m_format.setSamples(samples);

int doubleBuffered = -1;
int tripleBuffered = -1;
[pixelFormat getValues:&doubleBuffered forAttribute:NSOpenGLPFADoubleBuffer forVirtualScreen:0];
m_format.setSwapBehavior(doubleBuffered == 1 ? QSurfaceFormat::DoubleBuffer : QSurfaceFormat::SingleBuffer);
[pixelFormat getValues:&tripleBuffered forAttribute:NSOpenGLPFATripleBuffer forVirtualScreen:0];

if (tripleBuffered == 1)
m_format.setSwapBehavior(QSurfaceFormat::TripleBuffer);
else if (doubleBuffered == 1)
m_format.setSwapBehavior(QSurfaceFormat::DoubleBuffer);
else
m_format.setSwapBehavior(QSurfaceFormat::SingleBuffer);

int steroBuffers = -1;
[pixelFormat getValues:&steroBuffers forAttribute:NSOpenGLPFAStereo forVirtualScreen:0];
Expand Down
13 changes: 9 additions & 4 deletions src/plugins/platforms/windows/qwindowsdialoghelpers.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -750,10 +750,13 @@ void QWindowsNativeFileDialogBase::setDirectory(const QUrl &directory)

QString QWindowsNativeFileDialogBase::directory() const
{
QString result;
IShellItem *item = 0;
if (m_fileDialog && SUCCEEDED(m_fileDialog->GetFolder(&item)) && item)
return QWindowsNativeFileDialogBase::itemPath(item);
return QString();
if (m_fileDialog && SUCCEEDED(m_fileDialog->GetFolder(&item)) && item) {
result = QWindowsNativeFileDialogBase::itemPath(item);
item->Release();
}
return result;
}

void QWindowsNativeFileDialogBase::doExec(HWND owner)
Expand Down Expand Up @@ -1216,8 +1219,10 @@ QList<QUrl> QWindowsNativeSaveFileDialog::selectedFiles() const
QList<QUrl> result;
IShellItem *item = 0;
const HRESULT hr = fileDialog()->GetCurrentSelection(&item);
if (SUCCEEDED(hr) && item)
if (SUCCEEDED(hr) && item) {
result.push_back(QUrl::fromLocalFile(QWindowsNativeSaveFileDialog::itemPath(item)));
item->Release();
}
return result;
}

Expand Down
4 changes: 2 additions & 2 deletions src/printsupport/kernel/qprintengine_win.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -924,14 +924,14 @@ void QWin32PrintEnginePrivate::initialize()
Q_ASSERT(hPrinter);
Q_ASSERT(pInfo);

initHDC();

if (devMode) {
num_copies = devMode->dmCopies;
devMode->dmCollate = DMCOLLATE_TRUE;
updatePageLayout();
}

initHDC();

#if defined QT_DEBUG_DRAW || defined QT_DEBUG_METRICS
qDebug("QWin32PrintEngine::initialize()");
debugMetrics();
Expand Down
6 changes: 5 additions & 1 deletion src/printsupport/kernel/qprintengine_win_p.h
Original file line number Diff line number Diff line change
Expand Up @@ -130,10 +130,14 @@ class QWin32PrintEnginePrivate : public QAlphaPaintEnginePrivate
state(QPrinter::Idle),
resolution(0),
m_pageLayout(QPageLayout(QPageSize(QPageSize::A4), QPageLayout::Portrait, QMarginsF(0, 0, 0, 0))),
stretch_x(1), stretch_y(1), origin_x(0), origin_y(0),
dpi_x(96), dpi_y(96), dpi_display(96),
num_copies(1),
printToFile(false),
reinit(false),
embed_fonts(true)
complex_xform(false), has_pen(false), has_brush(false), has_custom_paper_size(false),
embed_fonts(true),
txop(0 /* QTransform::TxNone */)
{
}

Expand Down
2 changes: 1 addition & 1 deletion src/tools/uic/cpp/cppwriteinitialization.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2307,7 +2307,7 @@ QString WriteInitialization::trCall(const QString &str, const QString &commentHi
return QLatin1String("QString()");

QString result;
const QString comment = commentHint.isEmpty() ? QString(QLatin1Char('0')) : fixString(commentHint, m_dindent);
const QString comment = commentHint.isEmpty() ? QString(QLatin1String("Q_NULLPTR")) : fixString(commentHint, m_dindent);

if (m_option.translateFunction.isEmpty()) {
if (m_option.idBased) {
Expand Down
Loading

0 comments on commit 23ef3b0

Please sign in to comment.