Merge remote-tracking branch 'origin/5.6' into 5.7

Conflicts:
	mkspecs/features/mac/default_pre.prf
	mkspecs/macx-ios-clang/features/resolve_config.prf
	qtbase.pro

Change-Id: I65b5ebca4942a4f295bdd4ac1568e5c347333aea
This commit is contained in:
Liang Qi 2016-10-01 22:15:55 +02:00
commit 3e949b75fd
35 changed files with 92991 additions and 97 deletions

7
doc/doc.pro Normal file
View File

@ -0,0 +1,7 @@
TEMPLATE = aux
global_docs.files = $$PWD/global
global_docs.path = $$[QT_INSTALL_DOCS]
INSTALLS += global_docs
!prefix_build:!equals(OUT_PWD, $$PWD): \
COPIES += global_docs

View File

@ -31,6 +31,8 @@ QMAKE_LIBS_DYNLOAD =
QMAKE_LIBS_OPENGL = -framework OpenGL -framework AGL
QMAKE_LIBS_THREAD =
QMAKE_ACTOOL = actool
QMAKE_DSYMUTIL = dsymutil
QMAKE_STRIP = strip
QMAKE_STRIPFLAGS_LIB += -S -x

View File

@ -0,0 +1,109 @@
# QMAKE_ASSET_CATALOGS
# Paths to xcassets directories to be compiled
#
# QMAKE_ASSET_CATALOGS_BUILD_PATH
# Location which asset catalogs will be compiled to.
# If the current target is an app bundle, defaults to its Resources directory.
# Otherwise, this value must be set manually.
#
# QMAKE_ASSET_CATALOGS_APP_ICON
# Name of the icon resource in the asset catalogs that will be used as the app icon.
# Defaults to AppIcon.
#
# QMAKE_ASSET_CATALOGS_INSTALL_PATH
# Base path to install files to. Falls back to a path relative to the target install path,
# based on QMAKE_ASSET_CATALOGS_BUILD_PATH.
!have_target|if(!build_pass:!isEmpty(BUILDS)): \
return()
!isEmpty(QMAKE_ASSET_CATALOGS) {
load(resolve_target)
isEmpty(QMAKE_ASSET_CATALOGS_BUILD_PATH) {
!isEmpty(QMAKE_RESOLVED_BUNDLE):equals(TEMPLATE, app):app_bundle {
macos: \
QMAKE_ASSET_CATALOGS_BUILD_PATH = $$QMAKE_RESOLVED_BUNDLE/Contents/Resources
else: \
QMAKE_ASSET_CATALOGS_BUILD_PATH = $$QMAKE_RESOLVED_BUNDLE
} else {
error("QMAKE_ASSET_CATALOGS_BUILD_PATH must be set when using QMAKE_ASSET_CATALOGS.")
}
}
QMAKE_ASSET_CATALOGS_BUILD_PATH = $$clean_path($$QMAKE_ASSET_CATALOGS_BUILD_PATH)
macx-xcode {
!isEmpty(QMAKE_ASSET_CATALOGS_APP_ICON) {
asset_catalog_appicon.name = "ASSETCATALOG_COMPILER_APPICON_NAME"
asset_catalog_appicon.value = $$QMAKE_ASSET_CATALOGS_APP_ICON
QMAKE_MAC_XCODE_SETTINGS += asset_catalog_appicon
}
asset_catalog_compiler.files = $$QMAKE_ASSET_CATALOGS
macos: asset_catalog_compiler.path = Contents/Resources
QMAKE_BUNDLE_DATA += asset_catalog_compiler
} else {
!isEmpty(QMAKE_ASSET_CATALOGS_APP_ICON) {
asset_catalog_app_icon_arg = \
--app-icon $$shell_quote($$QMAKE_ASSET_CATALOGS_APP_ICON)
}
asset_catalog_compiler.target = $$OUT_PWD/asset_catalog_compiler.Info.plist
asset_catalog_compiler.commands = $$shell_quote($$QMAKE_ACTOOL) \
$$asset_catalog_app_icon_arg \
--output-partial-info-plist $$shell_quote($$asset_catalog_compiler.target) \
--platform $${version_identifier} \
--minimum-deployment-target $${deployment_target} \
--compile $$shell_quote($$QMAKE_ASSET_CATALOGS_BUILD_PATH)
for (catalog, QMAKE_ASSET_CATALOGS) {
asset_catalog_compiler.commands += $${catalog}
asset_catalog_compiler.depends += $$files($$catalog/*, true)
}
actool_output_files = $$system(\
mkdir -p $$system_quote($$QMAKE_ASSET_CATALOGS_BUILD_PATH) && \
/usr/libexec/PlistBuddy -c \'Print :com.apple.actool.compilation-results:output-files\' \
/dev/stdin <<< $($${asset_catalog_compiler.commands} 2>/dev/null) | grep \'^ .*$\', lines)
for (output_file, actool_output_files) {
!equals(output_file, $$asset_catalog_compiler.target): \
actool_output_files_rel += $$relative_path($$output_file, $$QMAKE_ASSET_CATALOGS_BUILD_PATH)
}
QMAKE_EXTRA_TARGETS += asset_catalog_compiler
PRE_TARGETDEPS += $$asset_catalog_compiler.target
isEmpty(QMAKE_ASSET_CATALOGS_INSTALL_PATH) {
!isEmpty(target.path): \
QMAKE_ASSET_CATALOGS_INSTALL_PATH = $${target.path}/
QMAKE_ASSET_CATALOGS_INSTALL_PATH = $${QMAKE_ASSET_CATALOGS_INSTALL_PATH}$$relative_path(\
$$QMAKE_ASSET_CATALOGS_BUILD_PATH, $$absolute_path($$DESTDIR, $$OUT_PWD))
}
for (ac_install_file, actool_output_files_rel) {
asset_catalogs_files.files += \
$$QMAKE_ASSET_CATALOGS_BUILD_PATH/$$ac_install_file
}
contains(INSTALLS, target): asset_catalogs_files.depends += install_target
asset_catalogs_files.path = $$QMAKE_ASSET_CATALOGS_INSTALL_PATH
asset_catalogs_files.CONFIG += no_check_exist
INSTALLS += asset_catalogs_files
}
} else: macx-xcode {
# Backwards compatibility
for (bundle_data, QMAKE_BUNDLE_DATA) {
for (bundle_file, $${bundle_data}.files) {
!contains(bundle_file, .*\.xcassets$): next()
warning("*.xcassets in QMAKE_BUNDLE_DATA is deprecated. Use QMAKE_ASSET_CATALOGS instead.")
!exists($$absolute_path($$bundle_file/AppIcon.appiconset, $$_PRO_FILE_PWD_)): next()
asset_catalog_appicon.name = "ASSETCATALOG_COMPILER_APPICON_NAME"
asset_catalog_appicon.value = "AppIcon"
QMAKE_MAC_XCODE_SETTINGS += asset_catalog_appicon
break()
}
!isEmpty(asset_catalog_appicon.name): break()
}
}

View File

@ -1,4 +1,4 @@
CONFIG = rez $$CONFIG
CONFIG = asset_catalogs rez $$CONFIG
load(default_pre)
isEmpty(QMAKE_XCODE_DEVELOPER_PATH) {
@ -33,6 +33,8 @@ isEmpty(QMAKE_TARGET_BUNDLE_PREFIX) {
cache(QMAKE_TARGET_BUNDLE_PREFIX)
}
QMAKE_ASSET_CATALOGS_APP_ICON = AppIcon
# Make the default debug info format for static debug builds
# DWARF instead of DWARF with dSYM. This cuts down build times
# for application debug builds significantly, as Xcode doesn't

View File

@ -37,7 +37,7 @@ QMAKE_INCDIR_OPENGL = $$sysrootified
QMAKESPEC_NAME = $$basename(QMAKESPEC)
# Resolve SDK version of various tools
for(tool, $$list(QMAKE_CC QMAKE_CXX QMAKE_FIX_RPATH QMAKE_AR QMAKE_RANLIB QMAKE_LINK QMAKE_LINK_SHLIB)) {
for(tool, $$list(QMAKE_CC QMAKE_CXX QMAKE_FIX_RPATH QMAKE_AR QMAKE_RANLIB QMAKE_LINK QMAKE_LINK_SHLIB QMAKE_ACTOOL)) {
tool_variable = QMAKE_MAC_SDK.$${QMAKESPEC_NAME}.$${QMAKE_MAC_SDK}.$${tool}
!isEmpty($$tool_variable) {
$$tool = $$eval($$tool_variable)

View File

@ -24,21 +24,6 @@ macx-xcode {
ios_device_family.value = $$QMAKE_IOS_TARGETED_DEVICE_FAMILY
QMAKE_MAC_XCODE_SETTINGS += ios_device_family
# If QMAKE_BUNDLE_DATA contains an asset catalog that includes an
# AppIcon.appiconset, we configure Xcode to use it for app icons.
for(bundle_data, QMAKE_BUNDLE_DATA) {
for(bundle_file, $${bundle_data}.files) {
!contains(bundle_file, .*\.xcassets$): next()
!exists($$absolute_path($$bundle_file/AppIcon.appiconset, $$_PRO_FILE_PWD_)): next()
asset_catalog_appicon.name = "ASSETCATALOG_COMPILER_APPICON_NAME"
asset_catalog_appicon.value = "AppIcon"
QMAKE_MAC_XCODE_SETTINGS += asset_catalog_appicon
break()
}
!isEmpty(asset_catalog_appicon.name): break()
}
# Set up default 4-inch iPhone/iPod launch image so that our apps
# support the full screen resolution of those devices.
qmake_launch_image = Default-568h@2x.png

View File

@ -30,7 +30,11 @@ macx-xcode {
QMAKE_MAC_XCODE_SETTINGS += library_suffix_simulator
CONFIG *= xcode_dynamic_library_suffix
} else {
addExclusiveBuilds(simulator, device)
# Switch the order to make sure that the first Makefile target is the right one
!contains(QT_CONFIG, simulator_and_device):contains(QMAKE_MAC_SDK, ^$${simulator.sdk}.*): \
addExclusiveBuilds(simulator, device)
else: \
addExclusiveBuilds(device, simulator)
}
equals(TEMPLATE, subdirs) {

View File

@ -50,6 +50,7 @@ QMAKE_CXXFLAGS_DEPS = $$QMAKE_CFLAGS_DEPS
QMAKE_CXXFLAGS_WARN_ON = $$QMAKE_CFLAGS_WARN_ON
QMAKE_CXXFLAGS_WARN_OFF = $$QMAKE_CFLAGS_WARN_OFF
QMAKE_CXXFLAGS_RELEASE = $$QMAKE_CFLAGS_RELEASE
QMAKE_CXXFLAGS_RELEASE_WITH_DEBUGINFO = $$QMAKE_CFLAGS_RELEASE_WITH_DEBUGINFO
QMAKE_CXXFLAGS_DEBUG = $$QMAKE_CFLAGS_DEBUG
QMAKE_CXXFLAGS_YACC = $$QMAKE_CFLAGS_YACC
QMAKE_CXXFLAGS_THREAD = $$QMAKE_CFLAGS_THREAD

View File

@ -409,7 +409,9 @@ QByteArray QMakeEvaluator::getCommandOutput(const QString &args) const
if (!errout.isEmpty()) {
if (errout.endsWith('\n'))
errout.chop(1);
m_handler->message(QMakeHandler::EvalError, QString::fromLocal8Bit(errout));
m_handler->message(
QMakeHandler::EvalError | (m_cumulative ? QMakeHandler::CumulativeEvalMessage : 0),
QString::fromLocal8Bit(errout));
}
# endif
out = proc.readAllStandardOutput();

View File

@ -2037,7 +2037,7 @@ QMakeEvaluator::VisitReturn QMakeEvaluator::evaluateFileInto(
void QMakeEvaluator::message(int type, const QString &msg) const
{
if (!m_skipLevel)
m_handler->message(type, msg,
m_handler->message(type | (m_cumulative ? QMakeHandler::CumulativeEvalMessage : 0), msg,
m_current.line ? m_current.pro->fileName() : QString(),
m_current.line != 0xffff ? m_current.line : -1);
}

View File

@ -60,6 +60,7 @@ bool QMakeVfs::writeFile(const QString &fn, QIODevice::OpenMode mode, bool exe,
else
*cont = contents;
Q_UNUSED(errStr)
Q_UNUSED(exe)
return true;
#else
QFileInfo qfi(fn);

View File

@ -4,7 +4,7 @@
load(qt_parts)
SUBDIRS += qmake/qmake-aux.pro
SUBDIRS += qmake/qmake-aux.pro doc
cross_compile: CONFIG += nostrip
@ -173,10 +173,6 @@ mkspecs.files = \
mkspecs.files -= $$PWD/mkspecs/modules $$PWD/mkspecs/modules-inst
INSTALLS += mkspecs
global_docs.files = $$PWD/doc/global
global_docs.path = $$[QT_INSTALL_DOCS]
INSTALLS += global_docs
OTHER_FILES += \
configure \
header.BSD \

View File

@ -2069,6 +2069,9 @@ QFontEngine *QTextEngine::fontEngine(const QScriptItem &si, QFixed *ascent, QFix
font = font.resolve(fnt);
}
engine = font.d->engineForScript(script);
if (engine)
engine->ref.ref();
QTextCharFormat::VerticalAlignment valign = f.verticalAlignment();
if (valign == QTextCharFormat::AlignSuperScript || valign == QTextCharFormat::AlignSubScript) {
if (font.pointSize() != -1)
@ -2076,16 +2079,14 @@ QFontEngine *QTextEngine::fontEngine(const QScriptItem &si, QFixed *ascent, QFix
else
font.setPixelSize((font.pixelSize() * 2) / 3);
scaledEngine = font.d->engineForScript(script);
if (scaledEngine)
scaledEngine->ref.ref();
}
if (engine)
engine->ref.ref();
if (feCache.prevFontEngine)
releaseCachedFontEngine(feCache.prevFontEngine);
feCache.prevFontEngine = engine;
if (scaledEngine)
scaledEngine->ref.ref();
if (feCache.prevScaledFontEngine)
releaseCachedFontEngine(feCache.prevScaledFontEngine);
feCache.prevScaledFontEngine = scaledEngine;

View File

@ -49,6 +49,7 @@
const char kImePlatformDataInputView[] = "inputView";
const char kImePlatformDataInputAccessoryView[] = "inputAccessoryView";
const char kImePlatformDataHideShortcutsBar[] = "hideShortcutsBar";
const char kImePlatformDataReturnKeyType[] = "returnKeyType";
QT_BEGIN_NAMESPACE

View File

@ -519,6 +519,7 @@ bool QIOSMenu::eventFilter(QObject *obj, QEvent *event)
QVariantMap imPlatformData = queryEvent->value(Qt::ImPlatformData).toMap();
imPlatformData.insert(kImePlatformDataInputView, QVariant::fromValue(static_cast<void *>(m_pickerView)));
imPlatformData.insert(kImePlatformDataInputAccessoryView, QVariant::fromValue(static_cast<void *>(m_pickerView.toolbar)));
imPlatformData.insert(kImePlatformDataHideShortcutsBar, true);
queryEvent->setValue(Qt::ImPlatformData, imPlatformData);
queryEvent->setValue(Qt::ImEnabled, true);

View File

@ -236,6 +236,17 @@
self.inputView = [[[WrapperView alloc] initWithView:inputView] autorelease];
if (UIView *accessoryView = static_cast<UIView *>(platformData.value(kImePlatformDataInputAccessoryView).value<void *>()))
self.inputAccessoryView = [[[WrapperView alloc] initWithView:accessoryView] autorelease];
if (QSysInfo::MacintoshVersion >= QSysInfo::MV_IOS_9_0) {
if (platformData.value(kImePlatformDataHideShortcutsBar).toBool()) {
// According to the docs, leadingBarButtonGroups/trailingBarButtonGroups should be set to nil to hide the shortcuts bar.
// However, starting with iOS 10, the API has been surrounded with NS_ASSUME_NONNULL, which contradicts this and causes
// compiler warnings. And assigning just an empty array causes layout asserts. Hence, we assign empty button groups instead.
UIBarButtonItemGroup *leading = [[[UIBarButtonItemGroup alloc] initWithBarButtonItems:@[] representativeItem:nil] autorelease];
UIBarButtonItemGroup *trailing = [[[UIBarButtonItemGroup alloc] initWithBarButtonItems:@[] representativeItem:nil] autorelease];
self.inputAssistantItem.leadingBarButtonGroups = @[leading];
self.inputAssistantItem.trailingBarButtonGroups = @[trailing];
}
}
self.undoManager.groupsByEvent = NO;
[self rebuildUndoStack];

View File

@ -359,17 +359,27 @@ void QXcbCursor::changeCursor(QCursor *cursor, QWindow *widget)
return;
xcb_cursor_t c = XCB_CURSOR_NONE;
bool isBitmapCursor = false;
if (cursor) {
const QXcbCursorCacheKey key(*cursor);
CursorHash::iterator it = m_cursorHash.find(key);
if (it == m_cursorHash.end()) {
const Qt::CursorShape shape = cursor->shape();
it = m_cursorHash.insert(key, shape == Qt::BitmapCursor ? createBitmapCursor(cursor) : createFontCursor(shape));
const Qt::CursorShape shape = cursor->shape();
isBitmapCursor = shape == Qt::BitmapCursor;
if (!isBitmapCursor) {
const QXcbCursorCacheKey key(*cursor);
CursorHash::iterator it = m_cursorHash.find(key);
if (it == m_cursorHash.end()) {
it = m_cursorHash.insert(key, createFontCursor(shape));
}
c = it.value();
} else {
// Do not cache bitmap cursors, as otherwise they have unclear
// lifetime (we effectively leak xcb_cursor_t).
c = createBitmapCursor(cursor);
}
c = it.value();
}
w->setCursor(c);
w->setCursor(c, isBitmapCursor);
}
static int cursorIdForShape(int cshape)

View File

@ -322,6 +322,7 @@ QXcbWindow::QXcbWindow(QWindow *window)
, m_lastWindowStateEvent(-1)
, m_syncState(NoSyncNeeded)
, m_pendingSyncRequest(0)
, m_currentBitmapCursor(XCB_CURSOR_NONE)
{
setConnection(xcbScreen()->connection());
}
@ -596,6 +597,9 @@ void QXcbWindow::create()
QXcbWindow::~QXcbWindow()
{
if (m_currentBitmapCursor != XCB_CURSOR_NONE) {
xcb_free_cursor(xcb_connection(), m_currentBitmapCursor);
}
if (window()->type() != Qt::ForeignWindow)
destroy();
else {
@ -2665,10 +2669,22 @@ bool QXcbWindow::setMouseGrabEnabled(bool grab)
return result;
}
void QXcbWindow::setCursor(xcb_cursor_t cursor)
void QXcbWindow::setCursor(xcb_cursor_t cursor, bool isBitmapCursor)
{
xcb_change_window_attributes(xcb_connection(), m_window, XCB_CW_CURSOR, &cursor);
xcb_flush(xcb_connection());
xcb_connection_t *conn = xcb_connection();
xcb_change_window_attributes(conn, m_window, XCB_CW_CURSOR, &cursor);
xcb_flush(conn);
if (m_currentBitmapCursor != XCB_CURSOR_NONE) {
xcb_free_cursor(conn, m_currentBitmapCursor);
}
if (isBitmapCursor) {
m_currentBitmapCursor = cursor;
} else {
m_currentBitmapCursor = XCB_CURSOR_NONE;
}
}
void QXcbWindow::windowEvent(QEvent *event)

View File

@ -103,7 +103,7 @@ public:
bool setKeyboardGrabEnabled(bool grab) Q_DECL_OVERRIDE;
bool setMouseGrabEnabled(bool grab) Q_DECL_OVERRIDE;
void setCursor(xcb_cursor_t cursor);
void setCursor(xcb_cursor_t cursor, bool isBitmapCursor);
QSurfaceFormat format() const Q_DECL_OVERRIDE;
@ -271,6 +271,7 @@ protected:
SyncState m_syncState;
QXcbSyncWindowRequest *m_pendingSyncRequest;
xcb_cursor_t m_currentBitmapCursor;
};
QT_END_NAMESPACE

View File

@ -130,57 +130,57 @@ do {\
#endif // !QT_NO_EXCEPTIONS
#define QTRY_LOOP_IMPL(__expr, __timeoutValue, __step) \
if (!(__expr)) { \
#define QTRY_LOOP_IMPL(expr, timeoutValue, step) \
if (!(expr)) { \
QTest::qWait(0); \
} \
int __i = 0; \
for (; __i < __timeoutValue && !(__expr); __i += __step) { \
QTest::qWait(__step); \
int qt_test_i = 0; \
for (; qt_test_i < timeoutValue && !(expr); qt_test_i += step) { \
QTest::qWait(step); \
}
#define QTRY_TIMEOUT_DEBUG_IMPL(__expr, __timeoutValue, __step)\
if (!(__expr)) { \
QTRY_LOOP_IMPL((__expr), (2 * __timeoutValue), __step);\
if (__expr) { \
#define QTRY_TIMEOUT_DEBUG_IMPL(expr, timeoutValue, step)\
if (!(expr)) { \
QTRY_LOOP_IMPL((expr), (2 * timeoutValue), step);\
if (expr) { \
QString msg = QString::fromUtf8("QTestLib: This test case check (\"%1\") failed because the requested timeout (%2 ms) was too short, %3 ms would have been sufficient this time."); \
msg = msg.arg(QString::fromUtf8(#__expr)).arg(__timeoutValue).arg(__timeoutValue + __i); \
msg = msg.arg(QString::fromUtf8(#expr)).arg(timeoutValue).arg(timeoutValue + qt_test_i); \
QFAIL(qPrintable(msg)); \
} \
}
#define QTRY_IMPL(__expr, __timeout)\
const int __step = 50; \
const int __timeoutValue = __timeout; \
QTRY_LOOP_IMPL((__expr), __timeoutValue, __step); \
QTRY_TIMEOUT_DEBUG_IMPL((__expr), __timeoutValue, __step)\
#define QTRY_IMPL(expr, timeout)\
const int qt_test_step = 50; \
const int qt_test_timeoutValue = timeout; \
QTRY_LOOP_IMPL((expr), qt_test_timeoutValue, qt_test_step); \
QTRY_TIMEOUT_DEBUG_IMPL((expr), qt_test_timeoutValue, qt_test_step)\
// Will try to wait for the expression to become true while allowing event processing
#define QTRY_VERIFY_WITH_TIMEOUT(__expr, __timeout) \
#define QTRY_VERIFY_WITH_TIMEOUT(expr, timeout) \
do { \
QTRY_IMPL((__expr), __timeout);\
QVERIFY(__expr); \
QTRY_IMPL((expr), timeout);\
QVERIFY(expr); \
} while (0)
#define QTRY_VERIFY(__expr) QTRY_VERIFY_WITH_TIMEOUT((__expr), 5000)
#define QTRY_VERIFY(expr) QTRY_VERIFY_WITH_TIMEOUT((expr), 5000)
// Will try to wait for the expression to become true while allowing event processing
#define QTRY_VERIFY2_WITH_TIMEOUT(__expr, __messageExpression, __timeout) \
#define QTRY_VERIFY2_WITH_TIMEOUT(expr, messageExpression, timeout) \
do { \
QTRY_IMPL((__expr), __timeout);\
QVERIFY2(__expr, __messageExpression); \
QTRY_IMPL((expr), timeout);\
QVERIFY2(expr, messageExpression); \
} while (0)
#define QTRY_VERIFY2(__expr, __messageExpression) QTRY_VERIFY2_WITH_TIMEOUT((__expr), (__messageExpression), 5000)
#define QTRY_VERIFY2(expr, messageExpression) QTRY_VERIFY2_WITH_TIMEOUT((expr), (messageExpression), 5000)
// Will try to wait for the comparison to become successful while allowing event processing
#define QTRY_COMPARE_WITH_TIMEOUT(__expr, __expected, __timeout) \
#define QTRY_COMPARE_WITH_TIMEOUT(expr, expected, timeout) \
do { \
QTRY_IMPL(((__expr) == (__expected)), __timeout);\
QCOMPARE((__expr), __expected); \
QTRY_IMPL(((expr) == (expected)), timeout);\
QCOMPARE((expr), expected); \
} while (0)
#define QTRY_COMPARE(__expr, __expected) QTRY_COMPARE_WITH_TIMEOUT((__expr), __expected, 5000)
#define QTRY_COMPARE(expr, expected) QTRY_COMPARE_WITH_TIMEOUT((expr), expected, 5000)
#define QSKIP_INTERNAL(statement) \
do {\

View File

@ -306,6 +306,8 @@ void QLayoutItem::invalidate()
/*!
If this item is a QLayout, it is returned as a QLayout; otherwise
0 is returned. This function provides type-safe casting.
\sa spacerItem(), widget()
*/
QLayout * QLayoutItem::layout()
{
@ -315,6 +317,8 @@ QLayout * QLayoutItem::layout()
/*!
If this item is a QSpacerItem, it is returned as a QSpacerItem;
otherwise 0 is returned. This function provides type-safe casting.
\sa layout(), widget()
*/
QSpacerItem * QLayoutItem::spacerItem()
{
@ -345,8 +349,14 @@ QSpacerItem * QSpacerItem::spacerItem()
*/
/*!
If this item is a QWidget, it is returned as a QWidget; otherwise
0 is returned. This function provides type-safe casting.
If this item manages a QWidget, returns that widget. Otherwise,
\c nullptr is returned.
\note While the functions layout() and spacerItem() perform casts, this
function returns another object: QLayout and QSpacerItem inherit QLayoutItem,
while QWidget does not.
\sa layout(), spacerItem()
*/
QWidget * QLayoutItem::widget()
{

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -135,6 +135,7 @@ private slots:
void cursorInNonStopChars();
void nbsp();
void noModificationOfInputString();
void superscriptCrash_qtbug53911();
private:
QFont testFont;
@ -2197,5 +2198,61 @@ void tst_QTextLayout::noModificationOfInputString()
}
}
void tst_QTextLayout::superscriptCrash_qtbug53911()
{
static int fontSizes = 64;
static QString layoutText = "THIS IS SOME EXAMPLE TEXT THIS IS SOME EXAMPLE TEXT";
QList<QTextLayout*> textLayouts;
for (int i = 0; i < fontSizes; ++i) {
for (int j = 0; j < 4; ++j) {
QTextLayout* newTextLayout = new QTextLayout();
newTextLayout->setText(layoutText);
QList<QTextLayout::FormatRange> formatRanges;
QTextLayout::FormatRange formatRange;
formatRange.format.setFont(QFont());
formatRange.format.setFontPointSize(i + 5);
switch (j) {
case 0:
formatRange.format.setFontWeight(QFont::Normal);
formatRange.format.setFontItalic(false);
break;
case 1:
formatRange.format.setFontWeight(QFont::Bold);
formatRange.format.setFontItalic(false);
break;
case 2:
formatRange.format.setFontWeight(QFont::Bold);
formatRange.format.setFontItalic(true);
break;
case 3:
formatRange.format.setFontWeight(QFont::Normal);
formatRange.format.setFontItalic(true);
break;
}
formatRange.format.setVerticalAlignment( QTextCharFormat::AlignSuperScript);
formatRange.start = 0;
formatRange.length = layoutText.size();
formatRanges << formatRange;
newTextLayout->setAdditionalFormats(formatRanges);
textLayouts.push_front(newTextLayout);
}
}
// This loop would crash before fix for QTBUG-53911
foreach (QTextLayout *textLayout, textLayouts) {
textLayout->beginLayout();
while (textLayout->createLine().isValid());
textLayout->endLayout();
}
qDeleteAll(textLayouts);
}
QTEST_MAIN(tst_QTextLayout)
#include "tst_qtextlayout.moc"

View File

@ -490,12 +490,12 @@ void tst_QStyleSheetStyle::widgetStyle()
window1->setStyleSheet(""); // remove stylesheet
QCOMPARE(window1->style(), qApp->style()); // is this cool or what
QCOMPARE(widget1->style(), qApp->style()); // annoying child follows...
QStyle *wndStyle = QStyleFactory::create("Windows");
window1->setStyle(wndStyle);
QScopedPointer<QStyle> wndStyle(QStyleFactory::create("Windows"));
window1->setStyle(wndStyle.data());
QCOMPARE(window1->style()->metaObject()->className(), "QStyleSheetStyle"); // auto wraps it
QCOMPARE(widget1->style(), window1->style()); // and auto propagates to child
qApp->setStyleSheet(""); // remove the app stylesheet
QCOMPARE(window1->style(), wndStyle); // auto dewrap
QCOMPARE(window1->style(), wndStyle.data()); // auto dewrap
QCOMPARE(widget1->style(), qApp->style()); // and child state is restored
window1->setStyle(0); // let sanity prevail
qApp->setStyle(0);

View File

@ -702,8 +702,8 @@ void tst_QAbstractSlider::wheelEvent_data()
QTest::addColumn<int>("wheelScrollLines");
QTest::addColumn<bool>("withModifiers"); // use keyboard modifiers while scrolling? (CTRL and SHIFT)
QTest::addColumn<int>("deltaMultiple"); // multiples of WHEEL_DELTA
QTest::addColumn<int>("sliderOrientation");
QTest::addColumn<int>("wheelOrientation");
QTest::addColumn<Qt::Orientation>("sliderOrientation");
QTest::addColumn<Qt::Orientation>("wheelOrientation");
QTest::addColumn<int>("expectedSliderPosition");
QTest::addColumn<QPoint>("distanceFromBottomRight"); // mpointer's distance from bottom-right corner of widget
@ -716,8 +716,8 @@ void tst_QAbstractSlider::wheelEvent_data()
<< 20 // wheel scroll lines
<< false // with modifiers
<< 1 // delta
<< int(Qt::Vertical) // orientation of slider
<< int(Qt::Vertical) // orientation of wheel
<< Qt::Vertical // orientation of slider
<< Qt::Vertical // orientation of wheel
<< 20 // expected position after
<< QPoint(0,0);
@ -730,8 +730,8 @@ void tst_QAbstractSlider::wheelEvent_data()
<< 20 // wheel scroll lines
<< false // with modifiers
<< 1 // delta
<< int(Qt::Vertical) // orientation of slider
<< int(Qt::Vertical) // orientation of wheel
<< Qt::Vertical // orientation of slider
<< Qt::Vertical // orientation of wheel
#ifndef Q_OS_MAC
<< 1 // expected position after
#else
@ -748,8 +748,8 @@ void tst_QAbstractSlider::wheelEvent_data()
<< 20 // wheel scroll lines
<< false // with modifiers
<< 1 // delta
<< int(Qt::Horizontal) // orientation of slider
<< int(Qt::Vertical) // orientation of wheel
<< Qt::Horizontal // orientation of slider
<< Qt::Vertical // orientation of wheel
#ifndef Q_OS_MAC
<< 1 // expected position after
#else
@ -767,8 +767,8 @@ void tst_QAbstractSlider::wheelEvent_data()
<< 20 // wheel scroll lines
<< false // with modifiers
<< 1 // delta
<< int(Qt::Horizontal) // orientation of slider
<< int(Qt::Vertical) // orientation of wheel
<< Qt::Horizontal // orientation of slider
<< Qt::Vertical // orientation of wheel
#ifndef Q_OS_MAC
<< 1 // expected position after
#else
@ -786,8 +786,8 @@ void tst_QAbstractSlider::wheelEvent_data()
<< 20 // wheel scroll lines
<< false // with modifiers
<< -1 // delta
<< int(Qt::Horizontal) // orientation of slider
<< int(Qt::Horizontal) // orientation of wheel
<< Qt::Horizontal // orientation of slider
<< Qt::Horizontal // orientation of wheel
<< 30 // expected position after
<< QPoint(1,1);
@ -800,8 +800,8 @@ void tst_QAbstractSlider::wheelEvent_data()
<< 1 // wheel scroll lines
<< false // with modifiers
<< -2 // delta
<< int(Qt::Horizontal) // orientation of slider
<< int(Qt::Horizontal) // orientation of wheel
<< Qt::Horizontal // orientation of slider
<< Qt::Horizontal // orientation of wheel
<< 100 // expected position after
<< QPoint(0,0);
@ -814,8 +814,8 @@ void tst_QAbstractSlider::wheelEvent_data()
<< 1 // wheel scroll lines
<< false // with modifiers
<< 2 // delta
<< int(Qt::Horizontal) // orientation of slider
<< int(Qt::Horizontal) // orientation of wheel
<< Qt::Horizontal // orientation of slider
<< Qt::Horizontal // orientation of wheel
<< 0 // expected position after
<< QPoint(0,0);
@ -828,8 +828,8 @@ void tst_QAbstractSlider::wheelEvent_data()
<< 20 // wheel scroll lines
<< true // with modifiers
<< -1 // delta
<< int(Qt::Horizontal) // orientation of slider
<< int(Qt::Horizontal) // orientation of wheel
<< Qt::Horizontal // orientation of slider
<< Qt::Horizontal // orientation of wheel
<< 90 // expected position after
<< QPoint(0,0);
@ -846,8 +846,8 @@ void tst_QAbstractSlider::wheelEvent()
QFETCH(int,wheelScrollLines);
QFETCH(bool,withModifiers);
QFETCH(int,deltaMultiple);
QFETCH(int,sliderOrientation);
QFETCH(int,wheelOrientation);
QFETCH(Qt::Orientation, sliderOrientation);
QFETCH(Qt::Orientation, wheelOrientation);
QFETCH(int,expectedSliderPosition);
QFETCH(QPoint,distanceFromBottomRight);
@ -855,18 +855,16 @@ void tst_QAbstractSlider::wheelEvent()
QVERIFY(applicationInstance != 0);
QApplication::setWheelScrollLines(wheelScrollLines);
Qt::Orientation orientation = *reinterpret_cast<Qt::Orientation*>(&sliderOrientation);
slider->setRange(minimum,maximum);
slider->setSliderPosition(initialSliderPosition);
slider->setSingleStep(singleStep);
slider->setPageStep(pageStep);
slider->setInvertedControls(invertedControls);
slider->setOrientation(orientation);
slider->setOrientation(sliderOrientation);
Qt::KeyboardModifier k = withModifiers ? Qt::ControlModifier : Qt::NoModifier;
orientation = *reinterpret_cast<Qt::Orientation*>(&wheelOrientation);
QWheelEvent event(slider->rect().bottomRight() + distanceFromBottomRight, WHEEL_DELTA * deltaMultiple,
Qt::NoButton, k, orientation);
Qt::NoButton, k, wheelOrientation);
QVERIFY(applicationInstance->sendEvent(slider,&event));
#ifdef Q_OS_MAC
QEXPECT_FAIL("Normal data page", "QTBUG-23679", Continue);
@ -878,7 +876,7 @@ void tst_QAbstractSlider::wheelEvent()
slider->setSliderPosition(initialSliderPosition);
k = withModifiers ? Qt::ShiftModifier : Qt::NoModifier;
event = QWheelEvent(slider->rect().bottomRight() + distanceFromBottomRight, WHEEL_DELTA * deltaMultiple,
Qt::NoButton, k, orientation);
Qt::NoButton, k, wheelOrientation);
QSignalSpy spy1(slider, SIGNAL(actionTriggered(int)));
QSignalSpy spy2(slider, SIGNAL(valueChanged(int)));
QVERIFY(applicationInstance->sendEvent(slider,&event));