Merge "Merge remote-tracking branch 'origin/5.6' into 5.7" into refs/staging/5.7

This commit is contained in:
Timur Pocheptsov 2016-04-05 07:01:49 +00:00 committed by The Qt Project
commit a2970719c2
74 changed files with 545 additions and 162 deletions

View File

@ -39,6 +39,9 @@ if (CMAKE_VERBOSE_MAKEFILE)
list(APPEND BUILD_OPTIONS_LIST "-DCMAKE_VERBOSE_MAKEFILE=1") list(APPEND BUILD_OPTIONS_LIST "-DCMAKE_VERBOSE_MAKEFILE=1")
endif() endif()
if (NO_GUI)
list(APPEND BUILD_OPTIONS_LIST "-DNO_GUI=True")
endif()
if (NO_WIDGETS) if (NO_WIDGETS)
list(APPEND BUILD_OPTIONS_LIST "-DNO_WIDGETS=True") list(APPEND BUILD_OPTIONS_LIST "-DNO_WIDGETS=True")
endif() endif()

View File

@ -982,13 +982,16 @@ struct QMessagePattern {
// 0 terminated arrays of literal tokens / literal or placeholder tokens // 0 terminated arrays of literal tokens / literal or placeholder tokens
const char **literals; const char **literals;
const char **tokens; const char **tokens;
QString timeFormat; QList<QString> timeArgs; // timeFormats in sequence of %{time
#ifndef QT_BOOTSTRAPPED #ifndef QT_BOOTSTRAPPED
QElapsedTimer timer; QElapsedTimer timer;
#endif #endif
#ifdef QLOGGING_HAVE_BACKTRACE #ifdef QLOGGING_HAVE_BACKTRACE
QString backtraceSeparator; struct BacktraceParams {
int backtraceDepth; QString backtraceSeparator;
int backtraceDepth;
};
QList<BacktraceParams> backtraceArgs; // backtrace argumens in sequence of %{backtrace
#endif #endif
bool fromEnvironment; bool fromEnvironment;
@ -1000,10 +1003,6 @@ QBasicMutex QMessagePattern::mutex;
QMessagePattern::QMessagePattern() QMessagePattern::QMessagePattern()
: literals(0) : literals(0)
, tokens(0) , tokens(0)
#ifdef QLOGGING_HAVE_BACKTRACE
, backtraceSeparator(QLatin1Char('|'))
, backtraceDepth(5)
#endif
, fromEnvironment(false) , fromEnvironment(false)
{ {
#ifndef QT_BOOTSTRAPPED #ifndef QT_BOOTSTRAPPED
@ -1106,10 +1105,14 @@ void QMessagePattern::setPattern(const QString &pattern)
tokens[i] = timeTokenC; tokens[i] = timeTokenC;
int spaceIdx = lexeme.indexOf(QChar::fromLatin1(' ')); int spaceIdx = lexeme.indexOf(QChar::fromLatin1(' '));
if (spaceIdx > 0) if (spaceIdx > 0)
timeFormat = lexeme.mid(spaceIdx + 1, lexeme.length() - spaceIdx - 2); timeArgs.append(lexeme.mid(spaceIdx + 1, lexeme.length() - spaceIdx - 2));
else
timeArgs.append(QString());
} else if (lexeme.startsWith(QLatin1String(backtraceTokenC))) { } else if (lexeme.startsWith(QLatin1String(backtraceTokenC))) {
#ifdef QLOGGING_HAVE_BACKTRACE #ifdef QLOGGING_HAVE_BACKTRACE
tokens[i] = backtraceTokenC; tokens[i] = backtraceTokenC;
QString backtraceSeparator = QStringLiteral("|");
int backtraceDepth = 5;
QRegularExpression depthRx(QStringLiteral(" depth=(?|\"([^\"]*)\"|([^ }]*))")); QRegularExpression depthRx(QStringLiteral(" depth=(?|\"([^\"]*)\"|([^ }]*))"));
QRegularExpression separatorRx(QStringLiteral(" separator=(?|\"([^\"]*)\"|([^ }]*))")); QRegularExpression separatorRx(QStringLiteral(" separator=(?|\"([^\"]*)\"|([^ }]*))"));
QRegularExpressionMatch m = depthRx.match(lexeme); QRegularExpressionMatch m = depthRx.match(lexeme);
@ -1123,6 +1126,10 @@ void QMessagePattern::setPattern(const QString &pattern)
m = separatorRx.match(lexeme); m = separatorRx.match(lexeme);
if (m.hasMatch()) if (m.hasMatch())
backtraceSeparator = m.captured(1); backtraceSeparator = m.captured(1);
BacktraceParams backtraceParams;
backtraceParams.backtraceDepth = backtraceDepth;
backtraceParams.backtraceSeparator = backtraceSeparator;
backtraceArgs.append(backtraceParams);
#else #else
error += QStringLiteral("QT_MESSAGE_PATTERN: %{backtrace} is not supported by this Qt build\n"); error += QStringLiteral("QT_MESSAGE_PATTERN: %{backtrace} is not supported by this Qt build\n");
#endif #endif
@ -1265,13 +1272,29 @@ QString qFormatLogMessage(QtMsgType type, const QMessageLogContext &context, con
bool skip = false; bool skip = false;
#ifndef QT_BOOTSTRAPPED
int timeArgsIdx = 0;
#ifdef QLOGGING_HAVE_BACKTRACE
int backtraceArgsIdx = 0;
#endif
#endif
// we do not convert file, function, line literals to local encoding due to overhead // we do not convert file, function, line literals to local encoding due to overhead
for (int i = 0; pattern->tokens[i] != 0; ++i) { for (int i = 0; pattern->tokens[i] != 0; ++i) {
const char *token = pattern->tokens[i]; const char *token = pattern->tokens[i];
if (token == endifTokenC) { if (token == endifTokenC) {
skip = false; skip = false;
} else if (skip) { } else if (skip) {
// do nothing // we skip adding messages, but we have to iterate over
// timeArgsIdx and backtraceArgsIdx anyway
#ifndef QT_BOOTSTRAPPED
if (token == timeTokenC)
timeArgsIdx++;
#ifdef QLOGGING_HAVE_BACKTRACE
else if (token == backtraceTokenC)
backtraceArgsIdx++;
#endif
#endif
} else if (token == messageTokenC) { } else if (token == messageTokenC) {
message.append(str); message.append(str);
} else if (token == categoryTokenC) { } else if (token == categoryTokenC) {
@ -1309,11 +1332,15 @@ QString qFormatLogMessage(QtMsgType type, const QMessageLogContext &context, con
message.append(QString::number(qlonglong(QThread::currentThread()->currentThread()), 16)); message.append(QString::number(qlonglong(QThread::currentThread()->currentThread()), 16));
#ifdef QLOGGING_HAVE_BACKTRACE #ifdef QLOGGING_HAVE_BACKTRACE
} else if (token == backtraceTokenC) { } else if (token == backtraceTokenC) {
QVarLengthArray<void*, 32> buffer(7 + pattern->backtraceDepth); QMessagePattern::BacktraceParams backtraceParams = pattern->backtraceArgs.at(backtraceArgsIdx);
QString backtraceSeparator = backtraceParams.backtraceSeparator;
int backtraceDepth = backtraceParams.backtraceDepth;
backtraceArgsIdx++;
QVarLengthArray<void*, 32> buffer(7 + backtraceDepth);
int n = backtrace(buffer.data(), buffer.size()); int n = backtrace(buffer.data(), buffer.size());
if (n > 0) { if (n > 0) {
int numberPrinted = 0; int numberPrinted = 0;
for (int i = 0; i < n && numberPrinted < pattern->backtraceDepth; ++i) { for (int i = 0; i < n && numberPrinted < backtraceDepth; ++i) {
QScopedPointer<char*, QScopedPointerPodDeleter> strings(backtrace_symbols(buffer.data() + i, 1)); QScopedPointer<char*, QScopedPointerPodDeleter> strings(backtrace_symbols(buffer.data() + i, 1));
QString trace = QString::fromLatin1(strings.data()[0]); QString trace = QString::fromLatin1(strings.data()[0]);
// The results of backtrace_symbols looks like this: // The results of backtrace_symbols looks like this:
@ -1343,7 +1370,7 @@ QString qFormatLogMessage(QtMsgType type, const QMessageLogContext &context, con
} }
if (numberPrinted > 0) if (numberPrinted > 0)
message.append(pattern->backtraceSeparator); message.append(backtraceSeparator);
if (function.isEmpty()) { if (function.isEmpty()) {
if (numberPrinted == 0 && context.function) if (numberPrinted == 0 && context.function)
@ -1357,27 +1384,29 @@ QString qFormatLogMessage(QtMsgType type, const QMessageLogContext &context, con
} else { } else {
if (numberPrinted == 0) if (numberPrinted == 0)
continue; continue;
message += pattern->backtraceSeparator + QLatin1String("???"); message += backtraceSeparator + QLatin1String("???");
} }
numberPrinted++; numberPrinted++;
} }
} }
#endif #endif
} else if (token == timeTokenC) { } else if (token == timeTokenC) {
if (pattern->timeFormat == QLatin1String("process")) { QString timeFormat = pattern->timeArgs.at(timeArgsIdx);
quint64 ms = pattern->timer.elapsed(); timeArgsIdx++;
message.append(QString::asprintf("%6d.%03d", uint(ms / 1000), uint(ms % 1000))); if (timeFormat == QLatin1String("process")) {
} else if (pattern->timeFormat == QLatin1String("boot")) { quint64 ms = pattern->timer.elapsed();
message.append(QString::asprintf("%6d.%03d", uint(ms / 1000), uint(ms % 1000)));
} else if (timeFormat == QLatin1String("boot")) {
// just print the milliseconds since the elapsed timer reference // just print the milliseconds since the elapsed timer reference
// like the Linux kernel does // like the Linux kernel does
QElapsedTimer now; QElapsedTimer now;
now.start(); now.start();
uint ms = now.msecsSinceReference(); uint ms = now.msecsSinceReference();
message.append(QString::asprintf("%6d.%03d", uint(ms / 1000), uint(ms % 1000))); message.append(QString::asprintf("%6d.%03d", uint(ms / 1000), uint(ms % 1000)));
} else if (pattern->timeFormat.isEmpty()) { } else if (timeFormat.isEmpty()) {
message.append(QDateTime::currentDateTime().toString(Qt::ISODate)); message.append(QDateTime::currentDateTime().toString(Qt::ISODate));
} else { } else {
message.append(QDateTime::currentDateTime().toString(pattern->timeFormat)); message.append(QDateTime::currentDateTime().toString(timeFormat));
} }
#endif #endif
} else if (token == ifCategoryTokenC) { } else if (token == ifCategoryTokenC) {

View File

@ -701,7 +701,7 @@ qint64 QProcessPrivate::writeToStdin(const char *data, qint64 maxlen)
void QProcessPrivate::terminateProcess() void QProcessPrivate::terminateProcess()
{ {
#if defined (QPROCESS_DEBUG) #if defined (QPROCESS_DEBUG)
qDebug("QProcessPrivate::killProcess()"); qDebug("QProcessPrivate::terminateProcess()");
#endif #endif
if (pid) if (pid)
::kill(pid_t(pid), SIGTERM); ::kill(pid_t(pid), SIGTERM);

View File

@ -1232,7 +1232,7 @@ public:
inline void destroyIter() { _destroyIter(&_iterator); } inline void destroyIter() { _destroyIter(&_iterator); }
inline VariantData getCurrentKey() const { return _getKey(&_iterator, _metaType_id_key, _metaType_flags_value); } inline VariantData getCurrentKey() const { return _getKey(&_iterator, _metaType_id_key, _metaType_flags_key); }
inline VariantData getCurrentValue() const { return _getValue(&_iterator, _metaType_id_value, _metaType_flags_value); } inline VariantData getCurrentValue() const { return _getValue(&_iterator, _metaType_id_value, _metaType_flags_value); }
inline void find(const VariantData &key) inline void find(const VariantData &key)

View File

@ -104,35 +104,22 @@ QImageData::QImageData()
{ {
} }
/*! \fn QImageData * QImageData::create(const QSize &size, QImage::Format format, int numColors) /*! \fn QImageData * QImageData::create(const QSize &size, QImage::Format format)
\internal \internal
Creates a new image data. Creates a new image data.
Returns 0 if invalid parameters are give or anything else failed. Returns 0 if invalid parameters are give or anything else failed.
*/ */
QImageData * QImageData::create(const QSize &size, QImage::Format format, int numColors) QImageData * QImageData::create(const QSize &size, QImage::Format format)
{ {
if (!size.isValid() || numColors < 0 || format == QImage::Format_Invalid) if (!size.isValid() || format == QImage::Format_Invalid)
return 0; // invalid parameter(s) return 0; // invalid parameter(s)
uint width = size.width(); uint width = size.width();
uint height = size.height(); uint height = size.height();
uint depth = qt_depthForFormat(format); uint depth = qt_depthForFormat(format);
switch (format) {
case QImage::Format_Mono:
case QImage::Format_MonoLSB:
numColors = 2;
break;
case QImage::Format_Indexed8:
numColors = qBound(0, numColors, 256);
break;
default:
numColors = 0;
break;
}
const int bytes_per_line = ((width * depth + 31) >> 5) << 2; // bytes per scanline (must be multiple of 4) const int bytes_per_line = ((width * depth + 31) >> 5) << 2; // bytes per scanline (must be multiple of 4)
// sanity check for potential overflows // sanity check for potential overflows
@ -144,13 +131,16 @@ QImageData * QImageData::create(const QSize &size, QImage::Format format, int nu
return 0; return 0;
QScopedPointer<QImageData> d(new QImageData); QScopedPointer<QImageData> d(new QImageData);
d->colortable.resize(numColors);
if (depth == 1) { switch (format) {
case QImage::Format_Mono:
case QImage::Format_MonoLSB:
d->colortable.resize(2);
d->colortable[0] = QColor(Qt::black).rgba(); d->colortable[0] = QColor(Qt::black).rgba();
d->colortable[1] = QColor(Qt::white).rgba(); d->colortable[1] = QColor(Qt::white).rgba();
} else { break;
for (int i = 0; i < numColors; ++i) default:
d->colortable[i] = 0; break;
} }
d->width = width; d->width = width;
@ -779,7 +769,7 @@ QImage::QImage() Q_DECL_NOEXCEPT
QImage::QImage(int width, int height, Format format) QImage::QImage(int width, int height, Format format)
: QPaintDevice() : QPaintDevice()
{ {
d = QImageData::create(QSize(width, height), format, 0); d = QImageData::create(QSize(width, height), format);
} }
/*! /*!
@ -794,7 +784,7 @@ QImage::QImage(int width, int height, Format format)
QImage::QImage(const QSize &size, Format format) QImage::QImage(const QSize &size, Format format)
: QPaintDevice() : QPaintDevice()
{ {
d = QImageData::create(size, format, 0); d = QImageData::create(size, format);
} }
@ -838,6 +828,17 @@ QImageData *QImageData::create(uchar *data, int width, int height, int bpl, QIm
d->cleanupFunction = cleanupFunction; d->cleanupFunction = cleanupFunction;
d->cleanupInfo = cleanupInfo; d->cleanupInfo = cleanupInfo;
switch (format) {
case QImage::Format_Mono:
case QImage::Format_MonoLSB:
d->colortable.resize(2);
d->colortable[0] = QColor(Qt::black).rgba();
d->colortable[1] = QColor(Qt::white).rgba();
break;
default:
break;
}
return d; return d;
} }
@ -2242,7 +2243,15 @@ QRgb QImage::pixel(int x, int y) const
case Format_MonoLSB: case Format_MonoLSB:
return d->colortable.at((*(s + (x >> 3)) >> (x & 7)) & 1); return d->colortable.at((*(s + (x >> 3)) >> (x & 7)) & 1);
case Format_Indexed8: case Format_Indexed8:
return d->colortable.at((int)s[x]); {
int index = (int)s[x];
if (index < d->colortable.size()) {
return d->colortable.at(index);
} else {
qWarning("QImage::pixel: color table index %d out of range.", index);
return 0;
}
}
case Format_RGB32: case Format_RGB32:
return 0xff000000 | reinterpret_cast<const QRgb *>(s)[x]; return 0xff000000 | reinterpret_cast<const QRgb *>(s)[x];
case Format_ARGB32: // Keep old behaviour. case Format_ARGB32: // Keep old behaviour.

View File

@ -63,7 +63,7 @@ class QImageWriter;
struct Q_GUI_EXPORT QImageData { // internal image data struct Q_GUI_EXPORT QImageData { // internal image data
QImageData(); QImageData();
~QImageData(); ~QImageData();
static QImageData *create(const QSize &size, QImage::Format format, int numColors = 0); static QImageData *create(const QSize &size, QImage::Format format);
static QImageData *create(uchar *data, int w, int h, int bpl, QImage::Format format, bool readOnly, QImageCleanupFunction cleanupFunction = 0, void *cleanupInfo = 0); static QImageData *create(uchar *data, int w, int h, int bpl, QImage::Format format, bool readOnly, QImageCleanupFunction cleanupFunction = 0, void *cleanupInfo = 0);
QAtomicInt ref; QAtomicInt ref;

View File

@ -1287,9 +1287,13 @@ static inline QImage qt_gl_read_framebuffer_rgba8(const QSize &size, bool includ
const char *renderer = reinterpret_cast<const char *>(funcs->glGetString(GL_RENDERER)); const char *renderer = reinterpret_cast<const char *>(funcs->glGetString(GL_RENDERER));
const char *ver = reinterpret_cast<const char *>(funcs->glGetString(GL_VERSION)); const char *ver = reinterpret_cast<const char *>(funcs->glGetString(GL_VERSION));
// Blacklist PowerVR Rogue G6200 as it has problems with its BGRA support. // Blacklist GPU chipsets that have problems with their BGRA support.
const bool blackListed = (qstrcmp(renderer, "PowerVR Rogue G6200") == 0 const bool blackListed = (qstrcmp(renderer, "PowerVR Rogue G6200") == 0
&& ::strstr(ver, "1.3") != 0); && ::strstr(ver, "1.3") != 0) ||
(qstrcmp(renderer, "Mali-T760") == 0
&& ::strstr(ver, "3.1") != 0) ||
(qstrcmp(renderer, "Mali-T720") == 0
&& ::strstr(ver, "3.1") != 0);
const bool supports_bgra = has_bgra_ext && !blackListed; const bool supports_bgra = has_bgra_ext && !blackListed;

View File

@ -693,8 +693,10 @@ static void makeDistanceField(QDistanceFieldData *data, const QPainterPath &path
static bool imageHasNarrowOutlines(const QImage &im) static bool imageHasNarrowOutlines(const QImage &im)
{ {
if (im.isNull()) if (im.isNull() || im.width() < 1 || im.height() < 1)
return false; return false;
else if (im.width() == 1 || im.height() == 1)
return true;
int minHThick = 999; int minHThick = 999;
int minVThick = 999; int minVThick = 999;

View File

@ -1222,6 +1222,11 @@ int QFontEngine::glyphCount() const
return count; return count;
} }
Qt::HANDLE QFontEngine::handle() const
{
return Q_NULLPTR;
}
const uchar *QFontEngine::getCMap(const uchar *table, uint tableSize, bool *isSymbolFont, int *cmapSize) const uchar *QFontEngine::getCMap(const uchar *table, uint tableSize, bool *isSymbolFont, int *cmapSize)
{ {
const uchar *header = table; const uchar *header = table;

View File

@ -1782,6 +1782,12 @@ void QFontEngineFT::unlockAlphaMapForGlyph()
QFontEngine::unlockAlphaMapForGlyph(); QFontEngine::unlockAlphaMapForGlyph();
} }
static inline bool is2dRotation(const QTransform &t)
{
return qFuzzyCompare(t.m11(), t.m22()) && qFuzzyCompare(t.m12(), -t.m21())
&& qFuzzyCompare(t.m11()*t.m22() - t.m12()*t.m21(), 1.0);
}
QFontEngineFT::Glyph *QFontEngineFT::loadGlyphFor(glyph_t g, QFontEngineFT::Glyph *QFontEngineFT::loadGlyphFor(glyph_t g,
QFixed subPixelPosition, QFixed subPixelPosition,
GlyphFormat format, GlyphFormat format,
@ -1795,7 +1801,7 @@ QFontEngineFT::Glyph *QFontEngineFT::loadGlyphFor(glyph_t g,
Glyph *glyph = glyphSet != 0 ? glyphSet->getGlyph(g, subPixelPosition) : 0; Glyph *glyph = glyphSet != 0 ? glyphSet->getGlyph(g, subPixelPosition) : 0;
if (!glyph || glyph->format != format || (!fetchBoundingBox && !glyph->data)) { if (!glyph || glyph->format != format || (!fetchBoundingBox && !glyph->data)) {
QScopedValueRollback<HintStyle> saved_default_hint_style(default_hint_style); QScopedValueRollback<HintStyle> saved_default_hint_style(default_hint_style);
if (t.type() >= QTransform::TxScale) if (t.type() >= QTransform::TxScale && !is2dRotation(t))
default_hint_style = HintNone; // disable hinting if the glyphs are transformed default_hint_style = HintNone; // disable hinting if the glyphs are transformed
lockFace(); lockFace();
@ -2007,6 +2013,11 @@ QFontEngine *QFontEngineFT::cloneWithSize(qreal pixelSize) const
} }
} }
Qt::HANDLE QFontEngineFT::handle() const
{
return non_locked_face();
}
QT_END_NAMESPACE QT_END_NAMESPACE
#endif // QT_NO_FREETYPE #endif // QT_NO_FREETYPE

View File

@ -288,6 +288,7 @@ private:
void setDefaultHintStyle(HintStyle style) Q_DECL_OVERRIDE; void setDefaultHintStyle(HintStyle style) Q_DECL_OVERRIDE;
QFontEngine *cloneWithSize(qreal pixelSize) const Q_DECL_OVERRIDE; QFontEngine *cloneWithSize(qreal pixelSize) const Q_DECL_OVERRIDE;
Qt::HANDLE handle() const Q_DECL_OVERRIDE;
bool initFromFontEngine(const QFontEngineFT *fontEngine); bool initFromFontEngine(const QFontEngineFT *fontEngine);
HintStyle defaultHintStyle() const { return default_hint_style; } HintStyle defaultHintStyle() const { return default_hint_style; }

View File

@ -235,6 +235,8 @@ public:
virtual QFontEngine *cloneWithSize(qreal /*pixelSize*/) const { return 0; } virtual QFontEngine *cloneWithSize(qreal /*pixelSize*/) const { return 0; }
virtual Qt::HANDLE handle() const;
void *harfbuzzFont() const; void *harfbuzzFont() const;
void *harfbuzzFace() const; void *harfbuzzFace() const;
bool supportsScript(QChar::Script script) const; bool supportsScript(QChar::Script script) const;

View File

@ -746,6 +746,11 @@ QFontEngine *QCoreTextFontEngine::cloneWithSize(qreal pixelSize) const
return new QCoreTextFontEngine(cgFont, newFontDef); return new QCoreTextFontEngine(cgFont, newFontDef);
} }
Qt::HANDLE QCoreTextFontEngine::handle() const
{
return (Qt::HANDLE)ctfont;
}
bool QCoreTextFontEngine::supportsTransformation(const QTransform &transform) const bool QCoreTextFontEngine::supportsTransformation(const QTransform &transform) const
{ {
if (transform.type() < QTransform::TxScale) if (transform.type() < QTransform::TxScale)

View File

@ -108,6 +108,7 @@ public:
bool supportsTransformation(const QTransform &transform) const Q_DECL_OVERRIDE; bool supportsTransformation(const QTransform &transform) const Q_DECL_OVERRIDE;
QFontEngine *cloneWithSize(qreal pixelSize) const Q_DECL_OVERRIDE; QFontEngine *cloneWithSize(qreal pixelSize) const Q_DECL_OVERRIDE;
Qt::HANDLE handle() const Q_DECL_OVERRIDE;
int glyphMargin(QFontEngine::GlyphFormat format) Q_DECL_OVERRIDE { Q_UNUSED(format); return 0; } int glyphMargin(QFontEngine::GlyphFormat format) Q_DECL_OVERRIDE { Q_UNUSED(format); return 0; }
QFontEngine::Properties properties() const Q_DECL_OVERRIDE; QFontEngine::Properties properties() const Q_DECL_OVERRIDE;

View File

@ -70,6 +70,12 @@ QEglFSKmsCursor::QEglFSKmsCursor(QEglFSKmsScreen *screen)
, m_cursorImage(0, 0, 0, 0, 0, 0) , m_cursorImage(0, 0, 0, 0, 0, 0)
, m_visible(true) , m_visible(true)
{ {
QByteArray hideCursorVal = qgetenv("QT_QPA_EGLFS_HIDECURSOR");
if (!hideCursorVal.isEmpty())
m_visible = hideCursorVal.toInt() == 0;
if (!m_visible)
return;
uint64_t width, height; uint64_t width, height;
if ((drmGetCap(m_screen->device()->fd(), DRM_CAP_CURSOR_WIDTH, &width) == 0) if ((drmGetCap(m_screen->device()->fd(), DRM_CAP_CURSOR_WIDTH, &width) == 0)
&& (drmGetCap(m_screen->device()->fd(), DRM_CAP_CURSOR_HEIGHT, &height) == 0)) { && (drmGetCap(m_screen->device()->fd(), DRM_CAP_CURSOR_HEIGHT, &height) == 0)) {

View File

@ -1331,7 +1331,7 @@ void QWindowsNativeFileDialogBase::setLabelText(QFileDialogOptions::DialogLabel
static inline bool isClsid(const QString &s) static inline bool isClsid(const QString &s)
{ {
// detect "374DE290-123F-4565-9164-39C4925E467B". // detect "374DE290-123F-4565-9164-39C4925E467B".
static const QRegularExpression pattern(QLatin1String("[0-9A-Fa-f]{8}-[0-9A-Fa-f]{4}-[0-9A-Fa-f]{4}-[0-9A-Fa-f]{4}-[0-9A-Fa-f]{8}")); static const QRegularExpression pattern(QLatin1String("\\A[0-9A-Fa-f]{8}-[0-9A-Fa-f]{4}-[0-9A-Fa-f]{4}-[0-9A-Fa-f]{4}-[0-9A-Fa-f]{12}\\z"));
Q_ASSERT(pattern.isValid()); Q_ASSERT(pattern.isValid());
return pattern.match(s).hasMatch(); return pattern.match(s).hasMatch();
} }
@ -2179,6 +2179,7 @@ namespace QWindowsDialogs {
// QWindowsDialogHelperBase creation functions // QWindowsDialogHelperBase creation functions
bool useHelper(QPlatformTheme::DialogType type) bool useHelper(QPlatformTheme::DialogType type)
{ {
#if !defined(_WIN32_WCE) || _WIN32_WCE < 0x800
if (QWindowsIntegration::instance()->options() & QWindowsIntegration::NoNativeDialogs) if (QWindowsIntegration::instance()->options() & QWindowsIntegration::NoNativeDialogs)
return false; return false;
switch (type) { switch (type) {
@ -2197,10 +2198,14 @@ bool useHelper(QPlatformTheme::DialogType type)
break; break;
} }
return false; return false;
#else
return false;
#endif // !defined(_WIN32_WCE) || _WIN32_WCE < 0x800
} }
QPlatformDialogHelper *createHelper(QPlatformTheme::DialogType type) QPlatformDialogHelper *createHelper(QPlatformTheme::DialogType type)
{ {
#if !defined(_WIN32_WCE) || _WIN32_WCE < 0x800
if (QWindowsIntegration::instance()->options() & QWindowsIntegration::NoNativeDialogs) if (QWindowsIntegration::instance()->options() & QWindowsIntegration::NoNativeDialogs)
return 0; return 0;
switch (type) { switch (type) {
@ -2228,6 +2233,9 @@ QPlatformDialogHelper *createHelper(QPlatformTheme::DialogType type)
break; break;
} }
return 0; return 0;
#else
return 0;
#endif // !defined(_WIN32_WCE) || _WIN32_WCE < 0x800
} }
} // namespace QWindowsDialogs } // namespace QWindowsDialogs

View File

@ -1260,6 +1260,11 @@ QFontEngine *QWindowsFontEngine::cloneWithSize(qreal pixelSize) const
return fontEngine; return fontEngine;
} }
Qt::HANDLE QWindowsFontEngine::handle() const
{
return hfont;
}
void QWindowsFontEngine::initFontInfo(const QFontDef &request, void QWindowsFontEngine::initFontInfo(const QFontDef &request,
int dpi) int dpi)
{ {

View File

@ -114,6 +114,7 @@ public:
glyph_metrics_t alphaMapBoundingBox(glyph_t glyph, QFixed, const QTransform &matrix, GlyphFormat) Q_DECL_OVERRIDE; glyph_metrics_t alphaMapBoundingBox(glyph_t glyph, QFixed, const QTransform &matrix, GlyphFormat) Q_DECL_OVERRIDE;
QFontEngine *cloneWithSize(qreal pixelSize) const Q_DECL_OVERRIDE; QFontEngine *cloneWithSize(qreal pixelSize) const Q_DECL_OVERRIDE;
Qt::HANDLE handle() const Q_DECL_OVERRIDE;
bool supportsTransformation(const QTransform &transform) const Q_DECL_OVERRIDE; bool supportsTransformation(const QTransform &transform) const Q_DECL_OVERRIDE;
#ifndef Q_CC_MINGW #ifndef Q_CC_MINGW

View File

@ -645,6 +645,11 @@ QFontEngine *QWindowsFontEngineDirectWrite::cloneWithSize(qreal pixelSize) const
return fontEngine; return fontEngine;
} }
Qt::HANDLE QWindowsFontEngineDirectWrite::handle() const
{
return m_directWriteFontFace;
}
void QWindowsFontEngineDirectWrite::initFontInfo(const QFontDef &request, void QWindowsFontEngineDirectWrite::initFontInfo(const QFontDef &request,
int dpi) int dpi)
{ {

View File

@ -98,6 +98,7 @@ public:
QImage alphaRGBMapForGlyph(glyph_t t, QFixed subPixelPosition, const QTransform &xform) Q_DECL_OVERRIDE; QImage alphaRGBMapForGlyph(glyph_t t, QFixed subPixelPosition, const QTransform &xform) Q_DECL_OVERRIDE;
QFontEngine *cloneWithSize(qreal pixelSize) const Q_DECL_OVERRIDE; QFontEngine *cloneWithSize(qreal pixelSize) const Q_DECL_OVERRIDE;
Qt::HANDLE handle() const Q_DECL_OVERRIDE;
const QSharedPointer<QWindowsFontEngineData> &fontEngineData() const { return m_fontEngineData; } const QSharedPointer<QWindowsFontEngineData> &fontEngineData() const { return m_fontEngineData; }

View File

@ -54,6 +54,8 @@
#include <QtGui/QPalette> #include <QtGui/QPalette>
#include <QtGui/QGuiApplication> #include <QtGui/QGuiApplication>
#include <private/qhighdpiscaling_p.h>
#include <algorithm> #include <algorithm>
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE
@ -165,7 +167,8 @@ Q_CORE_EXPORT QLocale qt_localeFromLCID(LCID id); // from qlocale_win.cpp
HIMC QWindowsInputContext::m_defaultContext = 0; HIMC QWindowsInputContext::m_defaultContext = 0;
QWindowsInputContext::CompositionContext::CompositionContext() : QWindowsInputContext::CompositionContext::CompositionContext() :
hwnd(0), haveCaret(false), position(0), isComposing(false) hwnd(0), haveCaret(false), position(0), isComposing(false),
factor(1)
{ {
} }
@ -274,9 +277,12 @@ void QWindowsInputContext::cursorRectChanged()
if (!m_compositionContext.hwnd) if (!m_compositionContext.hwnd)
return; return;
const QInputMethod *inputMethod = QGuiApplication::inputMethod(); const QInputMethod *inputMethod = QGuiApplication::inputMethod();
const QRect cursorRectangle = inputMethod->cursorRectangle().toRect(); const QRectF cursorRectangleF = inputMethod->cursorRectangle();
if (!cursorRectangle.isValid()) if (!cursorRectangleF.isValid())
return; return;
const QRect cursorRectangle =
QRectF(cursorRectangleF.topLeft() * m_compositionContext.factor,
cursorRectangleF.size() * m_compositionContext.factor).toRect();
qCDebug(lcQpaInputMethods) << __FUNCTION__<< cursorRectangle; qCDebug(lcQpaInputMethods) << __FUNCTION__<< cursorRectangle;
@ -394,7 +400,7 @@ bool QWindowsInputContext::startComposition(HWND hwnd)
qCDebug(lcQpaInputMethods) << __FUNCTION__ << fo << window << "language=" << m_languageId; qCDebug(lcQpaInputMethods) << __FUNCTION__ << fo << window << "language=" << m_languageId;
if (!fo || QWindowsWindow::handleOf(window) != hwnd) if (!fo || QWindowsWindow::handleOf(window) != hwnd)
return false; return false;
initContext(hwnd, fo); initContext(hwnd, QHighDpiScaling::factor(window), fo);
startContextComposition(); startContextComposition();
return true; return true;
} }
@ -526,12 +532,13 @@ bool QWindowsInputContext::endComposition(HWND hwnd)
return true; return true;
} }
void QWindowsInputContext::initContext(HWND hwnd, QObject *focusObject) void QWindowsInputContext::initContext(HWND hwnd, qreal factor, QObject *focusObject)
{ {
if (m_compositionContext.hwnd) if (m_compositionContext.hwnd)
doneContext(); doneContext();
m_compositionContext.hwnd = hwnd; m_compositionContext.hwnd = hwnd;
m_compositionContext.focusObject = focusObject; m_compositionContext.focusObject = focusObject;
m_compositionContext.factor = factor;
// Create a hidden caret which is kept at the microfocus // Create a hidden caret which is kept at the microfocus
// position in update(). This is important for some // position in update(). This is important for some
// Chinese input methods. // Chinese input methods.

View File

@ -65,6 +65,7 @@ class QWindowsInputContext : public QPlatformInputContext
int position; int position;
bool isComposing; bool isComposing;
QPointer<QObject> focusObject; QPointer<QObject> focusObject;
qreal factor;
}; };
public: public:
explicit QWindowsInputContext(); explicit QWindowsInputContext();
@ -94,7 +95,7 @@ private slots:
void cursorRectChanged(); void cursorRectChanged();
private: private:
void initContext(HWND hwnd, QObject *focusObject); void initContext(HWND hwnd, qreal factor, QObject *focusObject);
void doneContext(); void doneContext();
void startContextComposition(); void startContextComposition();
void endContextComposition(); void endContextComposition();

View File

@ -277,6 +277,8 @@ int runMoc(int argc, char **argv)
QStringLiteral("Read additional options from option-file.")); QStringLiteral("Read additional options from option-file."));
const QStringList arguments = argumentsFromCommandLineAndFile(app.arguments()); const QStringList arguments = argumentsFromCommandLineAndFile(app.arguments());
if (arguments.isEmpty())
return 1;
parser.process(arguments); parser.process(arguments);

View File

@ -89,6 +89,7 @@
#include "qgraphicswidget.h" #include "qgraphicswidget.h"
#include "qgraphicsgridlayoutengine_p.h" #include "qgraphicsgridlayoutengine_p.h"
#include "qgraphicslayoutstyleinfo_p.h" #include "qgraphicslayoutstyleinfo_p.h"
#include "qscopedpointer.h"
#ifdef QT_DEBUG #ifdef QT_DEBUG
# include <QtCore/qdebug.h> # include <QtCore/qdebug.h>
#endif #endif
@ -98,10 +99,10 @@ QT_BEGIN_NAMESPACE
class QGraphicsGridLayoutPrivate : public QGraphicsLayoutPrivate class QGraphicsGridLayoutPrivate : public QGraphicsLayoutPrivate
{ {
public: public:
QGraphicsGridLayoutPrivate(): m_styleInfo(0) { } QGraphicsGridLayoutPrivate() { }
QGraphicsLayoutStyleInfo *styleInfo() const; QGraphicsLayoutStyleInfo *styleInfo() const;
mutable QGraphicsLayoutStyleInfo *m_styleInfo; mutable QScopedPointer<QGraphicsLayoutStyleInfo> m_styleInfo;
QGraphicsGridLayoutEngine engine; QGraphicsGridLayoutEngine engine;
#ifdef QGRIDLAYOUTENGINE_DEBUG #ifdef QGRIDLAYOUTENGINE_DEBUG
@ -113,8 +114,8 @@ public:
QGraphicsLayoutStyleInfo *QGraphicsGridLayoutPrivate::styleInfo() const QGraphicsLayoutStyleInfo *QGraphicsGridLayoutPrivate::styleInfo() const
{ {
if (!m_styleInfo) if (!m_styleInfo)
m_styleInfo = new QGraphicsLayoutStyleInfo(this); m_styleInfo.reset(new QGraphicsLayoutStyleInfo(this));
return m_styleInfo; return m_styleInfo.data();
} }
/*! /*!

View File

@ -122,6 +122,7 @@
#include "qgraphicswidget.h" #include "qgraphicswidget.h"
#include "qgraphicsgridlayoutengine_p.h" #include "qgraphicsgridlayoutengine_p.h"
#include "qgraphicslayoutstyleinfo_p.h" #include "qgraphicslayoutstyleinfo_p.h"
#include "qscopedpointer.h"
#ifdef QT_DEBUG #ifdef QT_DEBUG
#include <QtCore/qdebug.h> #include <QtCore/qdebug.h>
#endif #endif
@ -132,8 +133,7 @@ class QGraphicsLinearLayoutPrivate : public QGraphicsLayoutPrivate
{ {
public: public:
QGraphicsLinearLayoutPrivate(Qt::Orientation orientation) QGraphicsLinearLayoutPrivate(Qt::Orientation orientation)
: orientation(orientation), : orientation(orientation)
m_styleInfo(0)
{ } { }
void removeGridItem(QGridLayoutItem *gridItem); void removeGridItem(QGridLayoutItem *gridItem);
@ -143,7 +143,7 @@ public:
int gridColumn(int index) const; int gridColumn(int index) const;
Qt::Orientation orientation; Qt::Orientation orientation;
mutable QGraphicsLayoutStyleInfo *m_styleInfo; mutable QScopedPointer<QGraphicsLayoutStyleInfo> m_styleInfo;
QGraphicsGridLayoutEngine engine; QGraphicsGridLayoutEngine engine;
}; };
@ -178,8 +178,8 @@ int QGraphicsLinearLayoutPrivate::gridColumn(int index) const
QGraphicsLayoutStyleInfo *QGraphicsLinearLayoutPrivate::styleInfo() const QGraphicsLayoutStyleInfo *QGraphicsLinearLayoutPrivate::styleInfo() const
{ {
if (!m_styleInfo) if (!m_styleInfo)
m_styleInfo = new QGraphicsLayoutStyleInfo(this); m_styleInfo.reset(new QGraphicsLayoutStyleInfo(this));
return m_styleInfo; return m_styleInfo.data();
} }
/*! /*!

View File

@ -3831,7 +3831,7 @@ QTransform QGraphicsView::transform() const
} }
/*! /*!
Returns a matrix that maps viewport coordinates to scene coordinates. Returns a matrix that maps scene coordinates to viewport coordinates.
\sa mapToScene(), mapFromScene() \sa mapToScene(), mapFromScene()
*/ */

View File

@ -2981,7 +2981,11 @@ void QAbstractItemView::keyboardSearch(const QString &search)
: d->model->index(0, 0, d->root); : d->model->index(0, 0, d->root);
bool skipRow = false; bool skipRow = false;
bool keyboardTimeWasValid = d->keyboardInputTime.isValid(); bool keyboardTimeWasValid = d->keyboardInputTime.isValid();
qint64 keyboardInputTimeElapsed = d->keyboardInputTime.restart(); qint64 keyboardInputTimeElapsed;
if (keyboardTimeWasValid)
keyboardInputTimeElapsed = d->keyboardInputTime.restart();
else
d->keyboardInputTime.start();
if (search.isEmpty() || !keyboardTimeWasValid if (search.isEmpty() || !keyboardTimeWasValid
|| keyboardInputTimeElapsed > QApplication::keyboardInputInterval()) { || keyboardInputTimeElapsed > QApplication::keyboardInputInterval()) {
d->keyboardInput = search; d->keyboardInput = search;

View File

@ -1024,7 +1024,11 @@ void QTreeView::keyboardSearch(const QString &search)
bool skipRow = false; bool skipRow = false;
bool keyboardTimeWasValid = d->keyboardInputTime.isValid(); bool keyboardTimeWasValid = d->keyboardInputTime.isValid();
qint64 keyboardInputTimeElapsed = d->keyboardInputTime.restart(); qint64 keyboardInputTimeElapsed;
if (keyboardTimeWasValid)
keyboardInputTimeElapsed = d->keyboardInputTime.restart();
else
d->keyboardInputTime.start();
if (search.isEmpty() || !keyboardTimeWasValid if (search.isEmpty() || !keyboardTimeWasValid
|| keyboardInputTimeElapsed > QApplication::keyboardInputInterval()) { || keyboardInputTimeElapsed > QApplication::keyboardInputInterval()) {
d->keyboardInput = search; d->keyboardInput = search;

View File

@ -1616,7 +1616,7 @@ void QCommonStyle::drawControl(ControlElement element, const QStyleOption *opt,
if (!hasArrow) { if (!hasArrow) {
proxy()->drawItemPixmap(p, pr, Qt::AlignCenter, pm); proxy()->drawItemPixmap(p, pr, Qt::AlignCenter, pm);
} else { } else {
drawArrow(this, toolbutton, pr, p, widget); drawArrow(proxy(), toolbutton, pr, p, widget);
} }
alignment |= Qt::AlignCenter; alignment |= Qt::AlignCenter;
} else { } else {
@ -1626,7 +1626,7 @@ void QCommonStyle::drawControl(ControlElement element, const QStyleOption *opt,
if (!hasArrow) { if (!hasArrow) {
proxy()->drawItemPixmap(p, QStyle::visualRect(opt->direction, rect, pr), Qt::AlignCenter, pm); proxy()->drawItemPixmap(p, QStyle::visualRect(opt->direction, rect, pr), Qt::AlignCenter, pm);
} else { } else {
drawArrow(this, toolbutton, pr, p, widget); drawArrow(proxy(), toolbutton, pr, p, widget);
} }
alignment |= Qt::AlignLeft | Qt::AlignVCenter; alignment |= Qt::AlignLeft | Qt::AlignVCenter;
} }
@ -1637,7 +1637,7 @@ void QCommonStyle::drawControl(ControlElement element, const QStyleOption *opt,
} else { } else {
rect.translate(shiftX, shiftY); rect.translate(shiftX, shiftY);
if (hasArrow) { if (hasArrow) {
drawArrow(this, toolbutton, rect, p, widget); drawArrow(proxy(), toolbutton, rect, p, widget);
} else { } else {
proxy()->drawItemPixmap(p, rect, Qt::AlignCenter, pm); proxy()->drawItemPixmap(p, rect, Qt::AlignCenter, pm);
} }

View File

@ -4954,6 +4954,9 @@ QRect QMacStyle::subElementRect(SubElement sr, const QStyleOption *opt,
break; break;
} }
case SE_ProgressBarGroove: case SE_ProgressBarGroove:
// Wrong in the secondary dimension, but accurate enough in the main dimension.
rect = opt->rect;
break;
case SE_ProgressBarLabel: case SE_ProgressBarLabel:
break; break;
case SE_ProgressBarContents: case SE_ProgressBarContents:

View File

@ -193,7 +193,7 @@ class QScrollTimer : public QAbstractAnimation
{ {
public: public:
QScrollTimer(QScrollerPrivate *_d) QScrollTimer(QScrollerPrivate *_d)
: d(_d), ignoreUpdate(false), skip(0) : QAbstractAnimation(_d), d(_d), ignoreUpdate(false), skip(0)
{ } { }
int duration() const Q_DECL_OVERRIDE int duration() const Q_DECL_OVERRIDE

View File

@ -2194,27 +2194,25 @@ QVariant QPlainTextEdit::inputMethodQuery(Qt::InputMethodQuery property) const
/*!\internal /*!\internal
*/ */
QVariant QPlainTextEdit::inputMethodQuery(Qt::InputMethodQuery property, QVariant argument) const QVariant QPlainTextEdit::inputMethodQuery(Qt::InputMethodQuery query, QVariant argument) const
{ {
Q_D(const QPlainTextEdit); Q_D(const QPlainTextEdit);
QVariant v; if (query == Qt::ImHints)
switch (property) { return QWidget::inputMethodQuery(query);
case Qt::ImHints: const QVariant v = d->control->inputMethodQuery(query, argument);
v = QWidget::inputMethodQuery(property); const QPointF offset = contentOffset();
break; switch (v.type()) {
case QVariant::RectF:
return v.toRectF().translated(offset);
case QVariant::PointF:
return v.toPointF() + offset;
case QVariant::Rect:
return v.toRect().translated(offset.toPoint());
case QVariant::Point:
return v.toPoint() + offset.toPoint();
default: default:
v = d->control->inputMethodQuery(property, argument); break;
const QPoint offset(-d->horizontalOffset(), -0);
if (v.type() == QVariant::RectF)
v = v.toRectF().toRect().translated(offset);
else if (v.type() == QVariant::PointF)
v = v.toPointF().toPoint() + offset;
else if (v.type() == QVariant::Rect)
v = v.toRect().translated(offset);
else if (v.type() == QVariant::Point)
v = v.toPoint() + offset;
} }
return v; return v;
} }

View File

@ -161,7 +161,7 @@ bool QProgressBarPrivate::repaintRequired() const
QStyleOptionProgressBar opt; QStyleOptionProgressBar opt;
q->initStyleOption(&opt); q->initStyleOption(&opt);
int cw = q->style()->pixelMetric(QStyle::PM_ProgressBarChunkWidth, &opt, q); int cw = q->style()->pixelMetric(QStyle::PM_ProgressBarChunkWidth, &opt, q);
QRect groove = q->style()->subElementRect(QStyle::SE_ProgressBarGroove, &opt, q); QRect groove = q->style()->subElementRect(QStyle::SE_ProgressBarGroove, &opt, q);
// This expression is basically // This expression is basically
// (valueDifference / (maximum - minimum) > cw / groove.width()) // (valueDifference / (maximum - minimum) > cw / groove.width())
// transformed to avoid integer division. // transformed to avoid integer division.

View File

@ -70,6 +70,23 @@
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE
QMovableTabWidget::QMovableTabWidget(QWidget *parent)
: QWidget(parent)
{
}
void QMovableTabWidget::setPixmap(const QPixmap &pixmap)
{
m_pixmap = pixmap;
update();
}
void QMovableTabWidget::paintEvent(QPaintEvent *e)
{
Q_UNUSED(e);
QPainter p(this);
p.drawPixmap(0, 0, m_pixmap);
}
inline static bool verticalTabs(QTabBar::Shape shape) inline static bool verticalTabs(QTabBar::Shape shape)
{ {
@ -1992,13 +2009,14 @@ void QTabBarPrivate::setupMovableTab()
{ {
Q_Q(QTabBar); Q_Q(QTabBar);
if (!movingTab) if (!movingTab)
movingTab = new QWidget(q); movingTab = new QMovableTabWidget(q);
int taboverlap = q->style()->pixelMetric(QStyle::PM_TabBarTabOverlap, 0 ,q); int taboverlap = q->style()->pixelMetric(QStyle::PM_TabBarTabOverlap, 0 ,q);
QRect grabRect = q->tabRect(pressedIndex); QRect grabRect = q->tabRect(pressedIndex);
grabRect.adjust(-taboverlap, 0, taboverlap, 0); grabRect.adjust(-taboverlap, 0, taboverlap, 0);
QPixmap grabImage(grabRect.size()); QPixmap grabImage(grabRect.size() * q->devicePixelRatioF());
grabImage.setDevicePixelRatio(q->devicePixelRatioF());
grabImage.fill(Qt::transparent); grabImage.fill(Qt::transparent);
QStylePainter p(&grabImage, q); QStylePainter p(&grabImage, q);
p.initFrom(q); p.initFrom(q);
@ -2009,11 +2027,8 @@ void QTabBarPrivate::setupMovableTab()
p.drawControl(QStyle::CE_TabBarTab, tab); p.drawControl(QStyle::CE_TabBarTab, tab);
p.end(); p.end();
QPalette pal; movingTab->setPixmap(grabImage);
pal.setBrush(QPalette::All, QPalette::Window, grabImage);
movingTab->setPalette(pal);
movingTab->setGeometry(grabRect); movingTab->setGeometry(grabRect);
movingTab->setAutoFillBackground(true);
movingTab->raise(); movingTab->raise();
// Re-arrange widget order to avoid overlaps // Re-arrange widget order to avoid overlaps

View File

@ -67,6 +67,19 @@
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE
class QMovableTabWidget : public QWidget
{
public:
explicit QMovableTabWidget(QWidget *parent = Q_NULLPTR);
void setPixmap(const QPixmap &pixmap);
protected:
void paintEvent(QPaintEvent *e) Q_DECL_OVERRIDE;
private:
QPixmap m_pixmap;
};
class QTabBarPrivate : public QWidgetPrivate class QTabBarPrivate : public QWidgetPrivate
{ {
Q_DECLARE_PUBLIC(QTabBar) Q_DECLARE_PUBLIC(QTabBar)
@ -207,7 +220,7 @@ public:
int switchTabCurrentIndex; int switchTabCurrentIndex;
int switchTabTimerId; int switchTabTimerId;
QWidget *movingTab; QMovableTabWidget *movingTab;
#ifdef Q_DEAD_CODE_FROM_QT4_MAC #ifdef Q_DEAD_CODE_FROM_QT4_MAC
int previousPressedIndex; int previousPressedIndex;
#endif #endif

View File

@ -1727,24 +1727,22 @@ QVariant QTextEdit::inputMethodQuery(Qt::InputMethodQuery property) const
QVariant QTextEdit::inputMethodQuery(Qt::InputMethodQuery query, QVariant argument) const QVariant QTextEdit::inputMethodQuery(Qt::InputMethodQuery query, QVariant argument) const
{ {
Q_D(const QTextEdit); Q_D(const QTextEdit);
QVariant v; if (query == Qt::ImHints)
switch (query) { return QWidget::inputMethodQuery(query);
case Qt::ImHints: const QVariant v = d->control->inputMethodQuery(query, argument);
v = QWidget::inputMethodQuery(query); const QPointF offset(-d->horizontalOffset(), -d->verticalOffset());
break; switch (v.type()) {
case QVariant::RectF:
return v.toRectF().translated(offset);
case QVariant::PointF:
return v.toPointF() + offset;
case QVariant::Rect:
return v.toRect().translated(offset.toPoint());
case QVariant::Point:
return v.toPoint() + offset.toPoint();
default: default:
v = d->control->inputMethodQuery(query, argument); break;
const QPoint offset(-d->horizontalOffset(), -d->verticalOffset());
if (v.type() == QVariant::RectF)
v = v.toRectF().toRect().translated(offset);
else if (v.type() == QVariant::PointF)
v = v.toPointF().toPoint() + offset;
else if (v.type() == QVariant::Rect)
v = v.toRect().translated(offset);
else if (v.type() == QVariant::Point)
v = v.toPoint() + offset;
} }
return v; return v;
} }

View File

@ -24,7 +24,7 @@ ios: SUBDIRS = corelib gui
wince: SUBDIRS -= printsupport wince: SUBDIRS -= printsupport
cross_compile: SUBDIRS -= tools cmake installed_cmake cross_compile: SUBDIRS -= tools cmake installed_cmake
!qtHaveModule(opengl): SUBDIRS -= opengl !qtHaveModule(opengl): SUBDIRS -= opengl
!qtHaveModule(gui): SUBDIRS -= gui cmake installed_cmake !qtHaveModule(gui): SUBDIRS -= gui
!qtHaveModule(widgets): SUBDIRS -= widgets !qtHaveModule(widgets): SUBDIRS -= widgets
!qtHaveModule(printsupport): SUBDIRS -= printsupport !qtHaveModule(printsupport): SUBDIRS -= printsupport
!qtHaveModule(concurrent): SUBDIRS -= concurrent !qtHaveModule(concurrent): SUBDIRS -= concurrent

View File

@ -116,13 +116,18 @@ endif()
set(qt_module_includes set(qt_module_includes
Core QObject Core QObject
Gui QImage
Network QHostInfo Network QHostInfo
Sql QSqlError Sql QSqlError
Test QTestEventList Test QTestEventList
Xml QDomDocument Xml QDomDocument
) )
if (NOT NO_GUI)
list(APPEND qt_module_includes
Gui QImage
)
endif()
if (NOT NO_WIDGETS) if (NOT NO_WIDGETS)
list(APPEND qt_module_includes list(APPEND qt_module_includes
Widgets QWidget Widgets QWidget

View File

@ -34,7 +34,9 @@ macro(test_testlib_project _module)
endmacro() endmacro()
add_subdirectory(core_only) add_subdirectory(core_only)
add_subdirectory(gui) if(NOT NO_GUI)
add_subdirectory(gui)
endif()
if(NOT NO_WIDGETS) if(NOT NO_WIDGETS)
add_subdirectory(widgets) add_subdirectory(widgets)
endif() endif()

View File

@ -774,6 +774,17 @@ void tst_qmessagehandler::qMessagePattern_data()
<< true << (QList<QByteArray>() << true << (QList<QByteArray>()
<< ('/' + QDateTime::currentDateTime().toString("yyyy - MM - d").toUtf8() + "/qDebug")); << ('/' + QDateTime::currentDateTime().toString("yyyy - MM - d").toUtf8() + "/qDebug"));
QTest::newRow("time-time") << "/%{time yyyy - MM - d}/%{time dd-MM-yy}/%{message}"
<< true << (QList<QByteArray>()
<< ('/' + QDateTime::currentDateTime().toString("yyyy - MM - d").toUtf8()
+ '/' + QDateTime::currentDateTime().toString("dd-MM-yy").toUtf8()
+ "/qDebug"));
QTest::newRow("skipped-time-shown-time")
<< "/%{if-warning}%{time yyyy - MM - d}%{endif}%{if-debug}%{time dd-MM-yy}%{endif}/%{message}"
<< true << (QList<QByteArray>()
<< ('/' + QDateTime::currentDateTime().toString("dd-MM-yy").toUtf8() + "/qDebug"));
// %{time} should have a padding of 6 so if it takes less than 10 seconds to show // %{time} should have a padding of 6 so if it takes less than 10 seconds to show
// the first message, there should be 5 spaces // the first message, there should be 5 spaces
QTest::newRow("time-process") << "<%{time process}>%{message}" << true << (QList<QByteArray>() QTest::newRow("time-process") << "<%{time process}>%{message}" << true << (QList<QByteArray>()

View File

@ -1,2 +0,0 @@
[testRuntimeDirectory]
rhel-7.1

View File

@ -54,6 +54,7 @@ private slots:
void qvariantCast(); void qvariantCast();
void constPointer(); void constPointer();
void constQPointer();
}; };
void tst_QPointer::constructors() void tst_QPointer::constructors()
@ -397,6 +398,21 @@ void tst_QPointer::constPointer()
delete fp.data(); delete fp.data();
} }
void tst_QPointer::constQPointer()
{
// Check that const QPointers work. It's a bit weird to mark a pointer
// const if its value can change, but the shallow-const principle in C/C++
// allows this, and people use it, so document it with a test.
//
// It's unlikely that this test will fail in and out of itself, but it
// presents the use-case to static and dynamic checkers that can raise
// a warning (hopefully) should this become an issue.
QObject *o = new QObject(this);
const QPointer<QObject> p = o;
delete o;
QVERIFY(!p);
}
QTEST_MAIN(tst_QPointer) QTEST_MAIN(tst_QPointer)
#include "tst_qpointer.moc" #include "tst_qpointer.moc"

View File

@ -276,6 +276,8 @@ private slots:
void compareSanity_data(); void compareSanity_data();
void compareSanity(); void compareSanity();
void accessSequentialContainerKey();
private: private:
void dataStream_data(QDataStream::Version version); void dataStream_data(QDataStream::Version version);
void loadQVariantFromDataStream(QDataStream::Version version); void loadQVariantFromDataStream(QDataStream::Version version);
@ -4763,5 +4765,30 @@ void tst_QVariant::compareSanity()
} }
} }
void tst_QVariant::accessSequentialContainerKey()
{
QString nameResult;
{
QMap<QString, QObject*> mapping;
QString name = QString::fromLatin1("Seven");
mapping.insert(name, Q_NULLPTR);
QVariant variant = QVariant::fromValue(mapping);
QAssociativeIterable iterable = variant.value<QAssociativeIterable>();
QAssociativeIterable::const_iterator iit = iterable.begin();
const QAssociativeIterable::const_iterator end = iterable.end();
for ( ; iit != end; ++iit) {
nameResult += iit.key().toString();
}
} // Destroy mapping
// Regression test for QTBUG-52246 - no memory corruption/double deletion
// of the string key.
QCOMPARE(nameResult, QStringLiteral("Seven"));
}
QTEST_MAIN(tst_QVariant) QTEST_MAIN(tst_QVariant)
#include "tst_qvariant.moc" #include "tst_qvariant.moc"

View File

@ -193,6 +193,7 @@ private slots:
void metadataPassthrough(); void metadataPassthrough();
void pixelColor(); void pixelColor();
void pixel();
private: private:
const QString m_prefix; const QString m_prefix;
@ -3085,5 +3086,33 @@ void tst_QImage::pixelColor()
QCOMPARE(t.pixel(0,0), argb32pm.pixel(0,0)); QCOMPARE(t.pixel(0,0), argb32pm.pixel(0,0));
} }
void tst_QImage::pixel()
{
{
QImage mono(1, 1, QImage::Format_Mono);
QImage monolsb(1, 1, QImage::Format_MonoLSB);
QImage indexed(1, 1, QImage::Format_Indexed8);
mono.fill(0);
monolsb.fill(0);
indexed.fill(0);
QCOMPARE(QColor(mono.pixel(0, 0)), QColor(Qt::black));
QCOMPARE(QColor(monolsb.pixel(0, 0)), QColor(Qt::black));
indexed.pixel(0, 0); // Don't crash
}
{
uchar a = 0;
QImage mono(&a, 1, 1, QImage::Format_Mono);
QImage monolsb(&a, 1, 1, QImage::Format_MonoLSB);
QImage indexed(&a, 1, 1, QImage::Format_Indexed8);
QCOMPARE(QColor(mono.pixel(0, 0)), QColor(Qt::black));
QCOMPARE(QColor(monolsb.pixel(0, 0)), QColor(Qt::black));
indexed.pixel(0, 0); // Don't crash
}
}
QTEST_GUILESS_MAIN(tst_QImage) QTEST_GUILESS_MAIN(tst_QImage)
#include "tst_qimage.moc" #include "tst_qimage.moc"

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 KiB

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.7 KiB

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.9 KiB

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.1 KiB

After

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.4 KiB

After

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 KiB

After

Width:  |  Height:  |  Size: 1.3 KiB

View File

@ -1,5 +1,3 @@
[testInputEvents]
rhel-7.1
[positioning:default] [positioning:default]
ubuntu-14.04 ubuntu-14.04
[modalWindowPosition] [modalWindowPosition]

View File

@ -603,7 +603,7 @@ void tst_QLocalSocket::readBufferOverflow()
serverSocket->write(buffer, dataBufferSize); serverSocket->write(buffer, dataBufferSize);
#ifndef Q_OS_WIN #ifndef Q_OS_WIN
// The data is not immediately sent, but buffered. // The data is not immediately sent, but buffered.
// On Windows, the flushing is done asynchronously by a separate thread. // On Windows, the flushing is done by an asynchronous write operation.
// However, this operation will never complete as long as the data is not // However, this operation will never complete as long as the data is not
// read by the other end, so the call below always times out. // read by the other end, so the call below always times out.
// On Unix, the flushing is synchronous and thus needs to be done before // On Unix, the flushing is synchronous and thus needs to be done before

View File

@ -1,5 +1,3 @@
[]
rhel-7.1
[glWidgetRendering] [glWidgetRendering]
windows windows
[glFBORendering] [glFBORendering]

Binary file not shown.

Before

Width:  |  Height:  |  Size: 169 B

After

Width:  |  Height:  |  Size: 78 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 169 B

After

Width:  |  Height:  |  Size: 75 B

View File

@ -9,7 +9,7 @@ save
setFont "sansserif" 12 normal setFont "sansserif" 12 normal
drawStaticText 0 40 "sansserif 12pt, normal" drawStaticText 0 40 "sansserif 12pt, normal"
setFont "sansserif" 10 bold setFont "sansserif" 12 bold
drawStaticText 0 60 "sansserif 12pt, bold" drawStaticText 0 60 "sansserif 12pt, bold"
setFont "sansserif" 10 bold italic setFont "sansserif" 10 bold italic
@ -25,7 +25,7 @@ save
setFont "sansserif" 12 normal setFont "sansserif" 12 normal
drawStaticText 0 40 "alpha sansserif 12pt, normal" drawStaticText 0 40 "alpha sansserif 12pt, normal"
setFont "sansserif" 10 bold setFont "sansserif" 12 bold
drawStaticText 0 60 "alpha sansserif 12pt, bold" drawStaticText 0 60 "alpha sansserif 12pt, bold"
setFont "sansserif" 10 bold italic setFont "sansserif" 10 bold italic
@ -43,7 +43,7 @@ save
setFont "sansserif" 12 normal setFont "sansserif" 12 normal
drawStaticText 0 40 "scaled sansserif 12pt, normal" drawStaticText 0 40 "scaled sansserif 12pt, normal"
setFont "sansserif" 10 bold setFont "sansserif" 12 bold
drawStaticText 0 60 "scaled sansserif 12pt, bold" drawStaticText 0 60 "scaled sansserif 12pt, bold"
setFont "sansserif" 10 bold italic setFont "sansserif" 10 bold italic
@ -61,7 +61,7 @@ save
setFont "sansserif" 12 normal setFont "sansserif" 12 normal
drawStaticText 0 40 "flipped sansserif 12pt, normal" drawStaticText 0 40 "flipped sansserif 12pt, normal"
setFont "sansserif" 10 bold setFont "sansserif" 12 bold
drawStaticText 0 60 "flipped sansserif 12pt, bold" drawStaticText 0 60 "flipped sansserif 12pt, bold"
setFont "sansserif" 10 bold italic setFont "sansserif" 10 bold italic
@ -75,16 +75,16 @@ save
rotate 185 rotate 185
setFont "sansserif" 10 normal setFont "sansserif" 10 normal
drawStaticText 0 20 "scaled sansserif 10pt, normal" drawStaticText 0 20 "rotated sansserif 10pt, normal"
setFont "sansserif" 12 normal setFont "sansserif" 12 normal
drawStaticText 0 40 "scaled sansserif 12pt, normal" drawStaticText 0 40 "rotated sansserif 12pt, normal"
setFont "sansserif" 10 bold setFont "sansserif" 12 bold
drawStaticText 0 60 "scaled sansserif 12pt, bold" drawStaticText 0 60 "rotated sansserif 12pt, bold"
setFont "sansserif" 10 bold italic setFont "sansserif" 10 bold italic
drawStaticText 0 80 "scaled sansserif 10pt, bold italic" drawStaticText 0 80 "rotated sansserif 10pt, bold italic"
restore restore
translate 0 100 translate 0 100
@ -100,7 +100,7 @@ save
setFont "sansserif" 12 normal setFont "sansserif" 12 normal
drawStaticText 0 20 "gradient sansserif 12pt, normal" drawStaticText 0 20 "gradient sansserif 12pt, normal"
setFont "sansserif" 10 bold setFont "sansserif" 12 bold
drawStaticText 0 40 "gradient sansserif 12pt, bold" drawStaticText 0 40 "gradient sansserif 12pt, bold"
setFont "sansserif" 10 bold italic setFont "sansserif" 10 bold italic

View File

@ -77,16 +77,16 @@ save
rotate 185 rotate 185
setFont "sansserif" 10 normal setFont "sansserif" 10 normal
drawText 0 20 "scaled sansserif 10pt, normal" drawText 0 20 "rotated sansserif 10pt, normal"
setFont "sansserif" 12 normal setFont "sansserif" 12 normal
drawText 0 40 "scaled sansserif 12pt, normal" drawText 0 40 "rotated sansserif 12pt, normal"
setFont "sansserif" 12 bold setFont "sansserif" 12 bold
drawText 0 60 "scaled sansserif 12pt, bold" drawText 0 60 "rotated sansserif 12pt, bold"
setFont "sansserif" 10 bold italic setFont "sansserif" 10 bold italic
drawText 0 80 "scaled sansserif 10pt, bold italic" drawText 0 80 "rotated sansserif 10pt, bold italic"
restore restore
translate 0 100 translate 0 100

View File

@ -622,6 +622,8 @@ private slots:
void unnamedNamespaceObjectsAndGadgets(); void unnamedNamespaceObjectsAndGadgets();
void veryLongStringData(); void veryLongStringData();
void gadgetHierarchy(); void gadgetHierarchy();
void optionsFileError_data();
void optionsFileError();
signals: signals:
void sigWithUnsignedArg(unsigned foo); void sigWithUnsignedArg(unsigned foo);
@ -3497,6 +3499,31 @@ void tst_Moc::gadgetHierarchy()
QCOMPARE(GrandParentGadget::DerivedGadget::staticMetaObject.superClass(), &GrandParentGadget::BaseGadget::staticMetaObject); QCOMPARE(GrandParentGadget::DerivedGadget::staticMetaObject.superClass(), &GrandParentGadget::BaseGadget::staticMetaObject);
} }
void tst_Moc::optionsFileError_data()
{
QTest::addColumn<QString>("optionsArgument");
QTest::newRow("no filename") << QStringLiteral("@");
QTest::newRow("nonexistent file") << QStringLiteral("@letshuntasnark");
}
void tst_Moc::optionsFileError()
{
#ifdef MOC_CROSS_COMPILED
QSKIP("Not tested when cross-compiled");
#endif
#if !defined(QT_NO_PROCESS)
QFETCH(QString, optionsArgument);
QProcess p;
p.start(m_moc, QStringList(optionsArgument));
QVERIFY(p.waitForFinished());
QCOMPARE(p.exitCode(), 1);
QVERIFY(p.readAllStandardOutput().isEmpty());
const QByteArray err = p.readAllStandardError();
QVERIFY(err.contains("moc: "));
QVERIFY(!err.contains("QCommandLineParser"));
#endif
}
QTEST_MAIN(tst_Moc) QTEST_MAIN(tst_Moc)
// the generated code must compile with QT_NO_KEYWORDS // the generated code must compile with QT_NO_KEYWORDS

View File

@ -1,7 +1,3 @@
[task256466_wrongStyle] [task256466_wrongStyle]
opensuse-13.1 opensuse-13.1
rhel-7.1 rhel-7.1
[setFont]
ubuntu-14.04
redhatenterpriselinuxworkstation-6.6
rhel-7.1

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.3 KiB

After

Width:  |  Height:  |  Size: 6.2 KiB

View File

@ -1,8 +1,2 @@
[panGesture:Two finger] [panGesture:Two finger]
xcb xcb
[swipeGesture:SmallDirectionChange]
rhel-7.1
[swipeGesture:Line]
rhel-7.1
[pinchGesture:Standard]
rhel-7.1

View File

@ -32,7 +32,6 @@ osx
osx osx
[widgetAt] [widgetAt]
osx osx
rhel-7.1
[sheetOpacity] [sheetOpacity]
osx osx
[resizeEvent] [resizeEvent]
@ -65,10 +64,8 @@ osx
osx osx
[taskQTBUG_4055_sendSyntheticEnterLeave] [taskQTBUG_4055_sendSyntheticEnterLeave]
osx osx
rhel-7.1
[syntheticEnterLeave] [syntheticEnterLeave]
osx osx
rhel-7.1
[maskedUpdate] [maskedUpdate]
osx osx
[hideWhenFocusWidgetIsChild] [hideWhenFocusWidgetIsChild]

View File

@ -456,6 +456,8 @@ private slots:
void qmlSetParentHelper(); void qmlSetParentHelper();
void testForOutsideWSRangeFlag();
private: private:
bool ensureScreenSize(int width, int height); bool ensureScreenSize(int width, int height);
QWidget *testWidget; QWidget *testWidget;
@ -10544,5 +10546,69 @@ void tst_QWidget::qmlSetParentHelper()
#endif #endif
} }
void tst_QWidget::testForOutsideWSRangeFlag()
{
// QTBUG-49445
{
QWidget widget;
widget.resize(0, 0);
widget.show();
QTest::qWait(100); // Wait for a while...
QVERIFY(!widget.windowHandle()->isExposed()); // The window should not be visible
QVERIFY(widget.isVisible()); // The widget should be in visible state
}
{
QWidget widget;
QWidget native(&widget);
native.setAttribute(Qt::WA_NativeWindow);
native.resize(0, 0);
widget.show();
QVERIFY(QTest::qWaitForWindowExposed(&widget));
QVERIFY(!native.windowHandle()->isExposed());
}
{
QWidget widget;
QWidget native(&widget);
widget.show();
QVERIFY(QTest::qWaitForWindowExposed(&widget));
QVERIFY(native.isVisible());
native.resize(0, 0);
native.setAttribute(Qt::WA_NativeWindow);
QTest::qWait(100); // Wait for a while...
QVERIFY(!native.windowHandle()->isExposed());
}
// QTBUG-48321
{
QWidget widget;
QWidget native(&widget);
native.setAttribute(Qt::WA_NativeWindow);
widget.show();
QVERIFY(QTest::qWaitForWindowExposed(&widget));
QVERIFY(native.windowHandle()->isExposed());
native.resize(0, 0);
QTest::qWait(100); // Wait for a while...
QVERIFY(!native.windowHandle()->isExposed());
}
// QTBUG-51788
{
QWidget widget;
widget.setLayout(new QGridLayout);
widget.layout()->addWidget(new QLineEdit);
widget.resize(0, 0);
widget.show();
// The layout should change the size, so the widget must be visible!
QVERIFY(QTest::qWaitForWindowExposed(&widget));
}
}
QTEST_MAIN(tst_QWidget) QTEST_MAIN(tst_QWidget)
#include "tst_qwidget.moc" #include "tst_qwidget.moc"

View File

@ -124,6 +124,8 @@ private slots:
void defaultFont(); void defaultFont();
void testDrawingShortcuts(); void testDrawingShortcuts();
void testFrameOnlyAroundContents(); void testFrameOnlyAroundContents();
void testProxyCalled();
private: private:
void lineUpLayoutTest(QStyle *); void lineUpLayoutTest(QStyle *);
QWidget *testWidget; QWidget *testWidget;
@ -789,5 +791,51 @@ void tst_QStyle::testFrameOnlyAroundContents()
} }
class ProxyTest: public QProxyStyle
{
Q_OBJECT
public:
ProxyTest(QStyle *style = 0)
:QProxyStyle(style)
, called(false)
{}
void drawPrimitive(PrimitiveElement pe, const QStyleOption *opt, QPainter *p, const QWidget *w) const Q_DECL_OVERRIDE {
called = true;
return QProxyStyle::drawPrimitive(pe, opt, p, w);
}
mutable bool called;
};
void tst_QStyle::testProxyCalled()
{
QToolButton b;
b.setArrowType(Qt::DownArrow);
QStyleOptionToolButton opt;
opt.init(&b);
opt.features |= QStyleOptionToolButton::Arrow;
QPixmap surface(QSize(200, 200));
QPainter painter(&surface);
QStringList keys = QStyleFactory::keys();
QVector<QStyle*> styles;
styles.reserve(keys.size() + 1);
styles << new QCommonStyle();
Q_FOREACH (const QString &key, keys) {
styles << QStyleFactory::create(key);
}
Q_FOREACH (QStyle *style, styles) {
ProxyTest testStyle;
testStyle.setBaseStyle(style);
style->drawControl(QStyle::CE_ToolButtonLabel, &opt, &painter, &b);
QVERIFY(testStyle.called);
delete style;
}
}
QTEST_MAIN(tst_QStyle) QTEST_MAIN(tst_QStyle)
#include "tst_qstyle.moc" #include "tst_qstyle.moc"

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.8 KiB

After

Width:  |  Height:  |  Size: 2.2 KiB

View File

@ -1,2 +0,0 @@
[setSystemMenu]
rhel-7.1

View File

@ -1,5 +1,2 @@
[task258920_mouseBorder] [task258920_mouseBorder]
osx osx
rhel-7.1
[pushButtonPopulateOnAboutToShow]
rhel-7.1

View File

@ -149,6 +149,7 @@ private slots:
#ifndef QT_NO_CONTEXTMENU #ifndef QT_NO_CONTEXTMENU
void contextMenu(); void contextMenu();
#endif #endif
void inputMethodCursorRect();
private: private:
void createSelection(); void createSelection();
@ -1722,5 +1723,17 @@ void tst_QPlainTextEdit::contextMenu()
} }
#endif // QT_NO_CONTEXTMENU #endif // QT_NO_CONTEXTMENU
// QTBUG-51923: Verify that the cursor rectangle returned by the input
// method query correctly reflects the viewport offset.
void tst_QPlainTextEdit::inputMethodCursorRect()
{
ed->setPlainText("Line1\nLine2Line3\nLine3");
ed->moveCursor(QTextCursor::End);
const QRectF cursorRect = ed->cursorRect();
const QVariant cursorRectV = ed->inputMethodQuery(Qt::ImCursorRectangle);
QCOMPARE(cursorRectV.type(), QVariant::RectF);
QCOMPARE(cursorRectV.toRect(), cursorRect.toRect());
}
QTEST_MAIN(tst_QPlainTextEdit) QTEST_MAIN(tst_QPlainTextEdit)
#include "tst_qplaintextedit.moc" #include "tst_qplaintextedit.moc"

View File

@ -186,6 +186,7 @@ private slots:
void inputMethodQuery(); void inputMethodQuery();
void inputMethodQueryImHints_data(); void inputMethodQueryImHints_data();
void inputMethodQueryImHints(); void inputMethodQueryImHints();
void inputMethodCursorRect();
void highlightLongLine(); void highlightLongLine();
@ -2468,6 +2469,18 @@ void tst_QTextEdit::inputMethodQueryImHints()
QCOMPARE(static_cast<Qt::InputMethodHints>(value.toInt()), hints); QCOMPARE(static_cast<Qt::InputMethodHints>(value.toInt()), hints);
} }
// QTBUG-51923: Verify that the cursor rectangle returned by the input
// method query correctly reflects the viewport offset.
void tst_QTextEdit::inputMethodCursorRect()
{
ed->setPlainText("Line1\nLine2Line3\nLine3");
ed->moveCursor(QTextCursor::End);
const QRectF cursorRect = ed->cursorRect();
const QVariant cursorRectV = ed->inputMethodQuery(Qt::ImCursorRectangle);
QCOMPARE(cursorRectV.type(), QVariant::RectF);
QCOMPARE(cursorRectV.toRect(), cursorRect.toRect());
}
void tst_QTextEdit::highlightLongLine() void tst_QTextEdit::highlightLongLine()
{ {
QTextEdit edit; QTextEdit edit;

View File

@ -1,4 +1,4 @@
QT += testlib QT = core testlib
TEMPLATE = app TEMPLATE = app
TARGET = tst_bench_qcoreapplication TARGET = tst_bench_qcoreapplication

View File

@ -1,5 +1,6 @@
TARGET = tst_bench_qvariant TARGET = tst_bench_qvariant
QT += testlib QT += testlib
!qtHaveModule(gui): QT -= gui
CONFIG += release CONFIG += release
#CONFIG += debug #CONFIG += debug

View File

@ -27,7 +27,9 @@
****************************************************************************/ ****************************************************************************/
#include <QtCore> #include <QtCore>
#include <QtGui/QPixmap> #ifdef QT_GUI_LIB
# include <QtGui/QPixmap>
#endif
#include <qtest.h> #include <qtest.h>
#define ITERATION_COUNT 1e5 #define ITERATION_COUNT 1e5
@ -42,7 +44,9 @@ private slots:
void floatVariantCreation(); void floatVariantCreation();
void rectVariantCreation(); void rectVariantCreation();
void stringVariantCreation(); void stringVariantCreation();
#ifdef QT_GUI_LIB
void pixmapVariantCreation(); void pixmapVariantCreation();
#endif
void stringListVariantCreation(); void stringListVariantCreation();
void bigClassVariantCreation(); void bigClassVariantCreation();
void smallClassVariantCreation(); void smallClassVariantCreation();
@ -153,10 +157,12 @@ void tst_qvariant::stringVariantCreation()
variantCreation<QString>(QString()); variantCreation<QString>(QString());
} }
#ifdef QT_GUI_LIB
void tst_qvariant::pixmapVariantCreation() void tst_qvariant::pixmapVariantCreation()
{ {
variantCreation<QPixmap>(QPixmap()); variantCreation<QPixmap>(QPixmap());
} }
#endif
void tst_qvariant::stringListVariantCreation() void tst_qvariant::stringListVariantCreation()
{ {

View File

@ -1,8 +1,7 @@
TEMPLATE = app TEMPLATE = app
TARGET = tst_bench_qnetworkdiskcache TARGET = tst_bench_qnetworkdiskcache
QT += gui # for QDesktopServices QT = core network testlib
QT += network testlib
CONFIG += release CONFIG += release

View File

@ -1,3 +1,3 @@
TARGET = tst_bench_qnetworkreply_from_cache TARGET = tst_bench_qnetworkreply_from_cache
QT += network testlib QT = core network testlib
SOURCES += tst_qnetworkreply_from_cache.cpp SOURCES += tst_qnetworkreply_from_cache.cpp