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

This commit is contained in:
Liang Qi 2016-10-06 18:15:17 +00:00 committed by The Qt Project
commit 2e749afc5a
68 changed files with 189476 additions and 196 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

@ -33,6 +33,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 = sdk rez $$CONFIG
CONFIG = asset_catalogs sdk 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

@ -31,7 +31,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

@ -2,9 +2,5 @@ CONFIG += qpa/basicunixfontdatabase
qtConfig(fontconfig) {
DEFINES += Q_FONTCONFIGDATABASE
QMAKE_USE_PRIVATE += fontconfig/linkonly
} else:!android {
fonts.path = $$[QT_INSTALL_LIBS]/fonts
fonts.files = $$QT_SOURCE_TREE/lib/fonts/*
INSTALLS += fonts
}

View File

@ -29,21 +29,6 @@ macx-xcode {
QMAKE_MAC_XCODE_SETTINGS += device_family
ios {
# 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

@ -8,4 +8,10 @@ xcodebuild {
load(resolve_config)
!macx-xcode:xcodebuild: addExclusiveBuilds(simulator, device)
!macx-xcode:xcodebuild {
# Switch the order to make sure that the first Makefile target is the right one
!qtConfig(simulator_and_device):contains(QMAKE_MAC_SDK, ^$${simulator.sdk}.*): \
addExclusiveBuilds(simulator, device)
else: \
addExclusiveBuilds(device, simulator)
}

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

@ -468,7 +468,9 @@ QByteArray QMakeEvaluator::getCommandOutput(const QString &args, int *exitCode)
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
@ -84,10 +84,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

@ -9,12 +9,12 @@
<signal name="AddAccessible">
<arg name="nodeAdded" type="((so)(so)a(so)assusau)"/>
<annotation name="org.qtproject.QtDBus.QtTypeName.In0" value="QSpiAccessibleCacheItem"/>
<annotation name="org.qtproject.QtDBus.QtTypeName.Out0" value="QSpiAccessibleCacheItem"/>
</signal>
<signal name="RemoveAccessible">
<arg name="nodeRemoved" type="(so)"/>
<annotation name="org.qtproject.QtDBus.QtTypeName.In0" value="QSpiObjectReference"/>
<annotation name="org.qtproject.QtDBus.QtTypeName.Out0" value="QSpiObjectReference"/>
</signal>
</interface>

View File

@ -3441,7 +3441,7 @@ Q_GLOBAL_STATIC(AndroidRandomStorage, randomTLS)
pseudo random integers to be returned by qrand().
The sequence of random numbers generated is deterministic per thread. For example,
if two threads call qsrand(1) and subsequently calls qrand(), the threads will get
if two threads call qsrand(1) and subsequently call qrand(), the threads will get
the same random number sequence.
\sa qrand()

View File

@ -1761,17 +1761,6 @@
\value Key_Zoom
\value Key_Exit
\value Key_Cancel
\value Key_MicVolumeUp
\value Key_Find
\value Key_Open
\value Key_MicVolumeDown
\value Key_New
\value Key_Settings
\value Key_Redo
\value Key_Exit
\value Key_Info
\value Key_Undo
\value Key_Guide
\sa QKeyEvent::key()
*/
@ -2300,7 +2289,7 @@
\enum Qt::ItemSelectionMode
This enum is used in QGraphicsItem, QGraphicsScene and QGraphicsView to
specify how items are selected, or how to determine if a shapes and items
specify how items are selected, or how to determine if shapes and items
collide.
\value ContainsItemShape The output list contains only items whose

View File

@ -120,6 +120,14 @@ static void checkWarnMessage(const QIODevice *device, const char *function, cons
} \
} while (0)
#define CHECK_MAXBYTEARRAYSIZE(function) \
do { \
if (maxSize >= MaxByteArraySize) { \
checkWarnMessage(this, #function, "maxSize argument exceeds QByteArray size limit"); \
maxSize = MaxByteArraySize - 1; \
} \
} while (0)
#define CHECK_WRITABLE(function, returnType) \
do { \
if ((d->openMode & WriteOnly) == 0) { \
@ -1178,10 +1186,7 @@ QByteArray QIODevice::read(qint64 maxSize)
}
CHECK_MAXLEN(read, result);
if (maxSize >= MaxByteArraySize) {
checkWarnMessage(this, "read", "maxSize argument exceeds QByteArray size limit");
maxSize = MaxByteArraySize - 1;
}
CHECK_MAXBYTEARRAYSIZE(read);
result.resize(int(maxSize));
qint64 readBytes = read(result.data(), result.size());
@ -1402,17 +1407,13 @@ QByteArray QIODevice::readLine(qint64 maxSize)
QByteArray result;
CHECK_MAXLEN(readLine, result);
CHECK_MAXBYTEARRAYSIZE(readLine);
#if defined QIODEVICE_DEBUG
printf("%p QIODevice::readLine(%lld), d->pos = %lld, d->buffer.size() = %lld\n",
this, maxSize, d->pos, d->buffer.size());
#endif
if (maxSize >= MaxByteArraySize) {
qWarning("QIODevice::read: maxSize argument exceeds QByteArray size limit");
maxSize = MaxByteArraySize - 1;
}
result.resize(int(maxSize));
qint64 readBytes = 0;
if (!result.size()) {

View File

@ -180,7 +180,7 @@ static inline HRESULT _await_impl(const Microsoft::WRL::ComPtr<T> &asyncOp, Awai
t.start();
switch (awaitStyle) {
case ProcessMainThreadEvents:
while (SUCCEEDED(hr = asyncInfo->get_Status(&status)) && status == Started) {
while (SUCCEEDED(hr = asyncInfo->get_Status(&status)) && status == AsyncStatus::Started) {
QCoreApplication::processEvents();
if (timeout && t.hasExpired(timeout))
return ERROR_TIMEOUT;
@ -188,7 +188,7 @@ static inline HRESULT _await_impl(const Microsoft::WRL::ComPtr<T> &asyncOp, Awai
break;
case ProcessThreadEvents:
if (QAbstractEventDispatcher *dispatcher = QThread::currentThread()->eventDispatcher()) {
while (SUCCEEDED(hr = asyncInfo->get_Status(&status)) && status == Started) {
while (SUCCEEDED(hr = asyncInfo->get_Status(&status)) && status == AsyncStatus::Started) {
dispatcher->processEvents(QEventLoop::AllEvents);
if (timeout && t.hasExpired(timeout))
return ERROR_TIMEOUT;
@ -198,7 +198,7 @@ static inline HRESULT _await_impl(const Microsoft::WRL::ComPtr<T> &asyncOp, Awai
// fall through
default:
case YieldThread:
while (SUCCEEDED(hr = asyncInfo->get_Status(&status)) && status == Started) {
while (SUCCEEDED(hr = asyncInfo->get_Status(&status)) && status == AsyncStatus::Started) {
QThread::yieldCurrentThread();
if (timeout && t.hasExpired(timeout))
return ERROR_TIMEOUT;
@ -206,7 +206,7 @@ static inline HRESULT _await_impl(const Microsoft::WRL::ComPtr<T> &asyncOp, Awai
break;
}
if (FAILED(hr) || status != Completed) {
if (FAILED(hr) || status != AsyncStatus::Completed) {
HRESULT ec;
hr = asyncInfo->get_ErrorCode(&ec);
if (FAILED(hr))

View File

@ -370,7 +370,7 @@ void **QListData::erase(void **xi)
application must interface with a C API.
\note Iterators into a QLinkedList and references into
heap-allocating QLists remain valid long as the referenced items
heap-allocating QLists remain valid as long as the referenced items
remain in the container. This is not true for iterators and
references into a QVector and non-heap-allocating QLists.

View File

@ -77,7 +77,7 @@
application must interface with a C API.
\note Iterators into a QLinkedList and references into
heap-allocating QLists remain valid long as the referenced items
heap-allocating QLists remain valid as long as the referenced items
remain in the container. This is not true for iterators and
references into a QVector and non-heap-allocating QLists.

View File

@ -2067,6 +2067,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)
@ -2074,16 +2077,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

@ -348,7 +348,7 @@ static inline void qt_mac_waitForMoreEvents(NSString *runLoopMode = NSDefaultRun
bool QCocoaEventDispatcher::processEvents(QEventLoop::ProcessEventsFlags flags)
{
Q_D(QCocoaEventDispatcher);
d->interrupt = false;
QBoolBlocker interruptBlocker(d->interrupt, false);
bool interruptLater = false;
QtCocoaInterruptDispatcher::cancelInterruptLater();

View File

@ -739,7 +739,10 @@ static bool _q_dontOverrideCtrlLMB = false;
- (void)handleMouseEvent:(NSEvent *)theEvent
{
bool isTabletEvent = [self handleTabletEvent: theEvent];
// Tablet events may come in via the mouse event handlers,
// check if this is a valid tablet event first.
if ([self handleTabletEvent: theEvent])
return;
QPointF qtWindowPoint;
QPointF qtScreenPoint;
@ -768,8 +771,8 @@ static bool _q_dontOverrideCtrlLMB = false;
nativeDrag->setLastMouseEvent(theEvent, self);
Qt::KeyboardModifiers keyboardModifiers = [QNSView convertKeyModifiers:[theEvent modifierFlags]];
QWindowSystemInterface::handleMouseEvent(targetView->m_window, timestamp, qtWindowPoint, qtScreenPoint, m_buttons, keyboardModifiers,
isTabletEvent ? Qt::MouseEventSynthesizedByQt : Qt::MouseEventNotSynthesized);
QWindowSystemInterface::handleMouseEvent(targetView->m_window, timestamp, qtWindowPoint, qtScreenPoint,
m_buttons, keyboardModifiers, Qt::MouseEventNotSynthesized);
}
- (void)handleFrameStrutMouseEvent:(NSEvent *)theEvent

View File

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

View File

@ -521,6 +521,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

@ -275,8 +275,6 @@ QXcbClipboard::QXcbClipboard(QXcbConnection *c)
{
Q_ASSERT(QClipboard::Clipboard == 0);
Q_ASSERT(QClipboard::Selection == 1);
m_xClipboard[QClipboard::Clipboard] = 0;
m_xClipboard[QClipboard::Selection] = 0;
m_clientClipboard[QClipboard::Clipboard] = 0;
m_clientClipboard[QClipboard::Selection] = 0;
m_timestamp[QClipboard::Clipboard] = XCB_CURRENT_TIME;
@ -329,6 +327,10 @@ QXcbClipboard::~QXcbClipboard()
}
free(reply);
}
if (m_clientClipboard[QClipboard::Clipboard] != m_clientClipboard[QClipboard::Selection])
delete m_clientClipboard[QClipboard::Clipboard];
delete m_clientClipboard[QClipboard::Selection];
}
void QXcbClipboard::incrTransactionPeeker(xcb_generic_event_t *ge, bool &accepted)
@ -378,9 +380,9 @@ QMimeData * QXcbClipboard::mimeData(QClipboard::Mode mode)
return m_clientClipboard[mode];
} else {
if (!m_xClipboard[mode])
m_xClipboard[mode] = new QXcbClipboardMime(mode, this);
m_xClipboard[mode].reset(new QXcbClipboardMime(mode, this));
return m_xClipboard[mode];
return m_xClipboard[mode].data();
}
}
@ -730,7 +732,7 @@ void QXcbClipboard::handleXFixesSelectionRequest(xcb_xfixes_selection_notify_eve
// here we care only about the xfixes events that come from non Qt processes
if (event->owner != XCB_NONE && event->owner != owner()) {
if (!m_xClipboard[mode]) {
m_xClipboard[mode] = new QXcbClipboardMime(mode, this);
m_xClipboard[mode].reset(new QXcbClipboardMime(mode, this));
} else {
m_xClipboard[mode]->reset();
}

View File

@ -98,7 +98,7 @@ private:
QClipboard::Mode modeForAtom(xcb_atom_t atom) const;
// Selection and Clipboard
QXcbClipboardMime *m_xClipboard[2];
QScopedPointer<QXcbClipboardMime> m_xClipboard[2];
QMimeData *m_clientClipboard[2];
xcb_timestamp_t m_timestamp[2];

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

@ -326,6 +326,7 @@ QXcbWindow::QXcbWindow(QWindow *window)
, m_lastWindowStateEvent(-1)
, m_syncState(NoSyncNeeded)
, m_pendingSyncRequest(0)
, m_currentBitmapCursor(XCB_CURSOR_NONE)
{
setConnection(xcbScreen()->connection());
}
@ -600,6 +601,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 {
@ -2679,10 +2683,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;
@ -272,6 +272,7 @@ protected:
SyncState m_syncState;
QXcbSyncWindowRequest *m_pendingSyncRequest;
xcb_cursor_t m_currentBitmapCursor;
};
QT_END_NAMESPACE

View File

@ -94,7 +94,7 @@ QString QSqlRecordPrivate::createField(int index, const QString &prefix) const
view within the database). QSqlRecord supports adding and
removing fields as well as setting and retrieving field values.
The values of a record's fields' can be set by name or position
The values of a record's fields can be set by name or position
with setValue(); if you want to set a field to null use
setNull(). To find the position of a field by name use indexOf(),
and to find the name of a field at a particular position use

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

@ -204,7 +204,10 @@ static QString classNameForInterface(const QString &interface, ClassType classTy
return retval;
}
static QByteArray qtTypeName(const QString &signature, const QDBusIntrospection::Annotations &annotations, int paramId = -1, const char *direction = "Out")
// ### Qt6 Remove the two isSignal ifs
// They are only here because before signal arguments where previously searched as "In" so to maintain compatibility
// we first search for "Out" and if not found we search for "In"
static QByteArray qtTypeName(const QString &signature, const QDBusIntrospection::Annotations &annotations, int paramId = -1, const char *direction = "Out", bool isSignal = false)
{
int type = QDBusMetaType::signatureToType(signature.toLatin1());
if (type == QVariant::Invalid) {
@ -221,9 +224,15 @@ static QByteArray qtTypeName(const QString &signature, const QDBusIntrospection:
qttype = annotations.value(oldAnnotationName);
if (qttype.isEmpty()) {
fprintf(stderr, "Got unknown type `%s'\n", qPrintable(signature));
fprintf(stderr, "You should add <annotation name=\"%s\" value=\"<type>\"/> to the XML description\n",
qPrintable(annotationName));
if (!isSignal || qstrcmp(direction, "Out") == 0) {
fprintf(stderr, "Got unknown type `%s'\n", qPrintable(signature));
fprintf(stderr, "You should add <annotation name=\"%s\" value=\"<type>\"/> to the XML description\n",
qPrintable(annotationName));
}
if (isSignal)
return qtTypeName(signature, annotations, paramId, "In", isSignal);
exit(1);
}
@ -323,6 +332,23 @@ static void writeArgList(QTextStream &ts, const QStringList &argNames,
}
}
static void writeSignalArgList(QTextStream &ts, const QStringList &argNames,
const QDBusIntrospection::Annotations &annotations,
const QDBusIntrospection::Arguments &outputArgs)
{
bool first = true;
int argPos = 0;
for (int i = 0; i < outputArgs.count(); ++i) {
const QDBusIntrospection::Argument &arg = outputArgs.at(i);
QString type = constRefArg(qtTypeName(arg.type, annotations, i, "Out", true /* isSignal */));
if (!first)
ts << ", ";
ts << type << argNames.at(argPos++);
first = false;
}
}
static QString propertyGetter(const QDBusIntrospection::Property &property)
{
QString getter = property.annotations.value(QLatin1String("org.qtproject.QtDBus.PropertyGetter"));
@ -637,7 +663,7 @@ static void writeProxy(const QString &filename, const QDBusIntrospection::Interf
hs << "void " << signal.name << "(";
QStringList argNames = makeArgNames(signal.outputArgs);
writeArgList(hs, argNames, signal.annotations, signal.outputArgs);
writeSignalArgList(hs, argNames, signal.annotations, signal.outputArgs);
hs << ");" << endl; // finished for header
}
@ -981,7 +1007,7 @@ static void writeAdaptor(const QString &filename, const QDBusIntrospection::Inte
hs << "void " << signal.name << "(";
QStringList argNames = makeArgNames(signal.outputArgs);
writeArgList(hs, argNames, signal.annotations, signal.outputArgs);
writeSignalArgList(hs, argNames, signal.annotations, signal.outputArgs);
hs << ");" << endl; // finished for header
}

View File

@ -903,15 +903,13 @@ bool QFileSystemModel::setData(const QModelIndex &idx, const QVariant &value, in
QFileSystemModelPrivate::QFileSystemNode *parentNode = indexNode->parent;
int visibleLocation = parentNode->visibleLocation(parentNode->children.value(indexNode->fileName)->fileName);
d->addNode(parentNode, newName,indexNode->info->fileInfo());
parentNode->visibleChildren.removeAt(visibleLocation);
QFileSystemModelPrivate::QFileSystemNode * oldValue = parentNode->children.value(oldName);
parentNode->children[newName] = oldValue;
QFileInfo info(parentPath, newName);
oldValue->fileName = newName;
oldValue->parent = parentNode;
#ifndef QT_NO_FILESYSTEMWATCHER
oldValue->populate(d->fileInfoGatherer.getInfo(info));
oldValue->populate(d->fileInfoGatherer.getInfo(QFileInfo(parentPath, newName)));
#endif
oldValue->isVisible = true;

View File

@ -253,7 +253,7 @@
\snippet shareddirmodel/main.cpp 0
The model is set up to use data from a certain file system. The call to
\l{QFileSystemModel::}{setRootPath()} tell the model which drive on the
\l{QFileSystemModel::}{setRootPath()} tells the model which drive on the
file system to expose to the views.
We create two views so that we can examine the items held in the model in two
@ -304,7 +304,7 @@
signals and slots mechanism.
This section describes some basic concepts that are central to the way
item of data are accessed by other components via a model class. More
items of data are accessed by other components via a model class. More
advanced concepts are discussed in later sections.
\section3 Model indexes
@ -1869,7 +1869,7 @@
\codeline
\snippet qsortfilterproxymodel/main.cpp 1
Since proxy models are inherit from QAbstractItemModel, they can be connected to
Since proxy models inherit from QAbstractItemModel, they can be connected to
any kind of view, and can be shared between views. They can also be used to
process the information obtained from other proxy models in a pipeline arrangement.

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()
{

View File

@ -769,7 +769,6 @@ void qDrawPlainRect(QPainter *p, const QRect &r, const QColor &c,
\fn void qDrawBorderPixmap(QPainter *painter, const QRect &target, const QMargins &margins, const QPixmap &pixmap)
\relates <qdrawutil.h>
\since 4.6
\overload
\brief The qDrawBorderPixmap function is for drawing a pixmap into
the margins of a rectangle.

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

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

@ -4925,7 +4925,7 @@ void tst_QNetworkReply::ioGetFromBuiltinHttp()
const int maxRate = rate * 1024 * (100+allowedDeviation) / 100;
qDebug() << minRate << "<="<< server.transferRate << "<=" << maxRate << '?';
// The test takes too long to run if sending enough data to overwhelm the
// reciever's kernel buffers.
// receiver's kernel buffers.
//QEXPECT_FAIL("http+limited", "Limiting is broken right now, check QTBUG-15065", Continue);
//QEXPECT_FAIL("https+limited", "Limiting is broken right now, check QTBUG-15065", Continue);
//QVERIFY(server.transferRate >= minRate && server.transferRate <= maxRate);

View File

@ -1357,6 +1357,7 @@ void tst_QFiledialog::widgetlessNativeDialog()
QVERIFY(!model);
QPushButton *button = fd.findChild<QPushButton*>();
QVERIFY(!button);
QApplication::setAttribute(Qt::AA_DontUseNativeDialogs, true);
}
void tst_QFiledialog::selectedFilesWithoutWidgets()

View File

@ -488,12 +488,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

@ -1217,7 +1217,7 @@ void tst_QCompleter::task178797_activatedOnReturn()
words << "foobar1" << "foobar2";
QLineEdit ledit;
setFrameless(&ledit);
QCompleter *completer = new QCompleter(words);
QCompleter *completer = new QCompleter(words, &ledit);
ledit.setCompleter(completer);
QSignalSpy spy(completer, SIGNAL(activated(QString)));
QCOMPARE(spy.count(), 0);
@ -1324,7 +1324,7 @@ public:
task250064_TextEdit()
{
completer = new QCompleter;
completer = new QCompleter(this);
completer->setWidget(this);
}

View File

@ -377,8 +377,8 @@ static QString glue(const QString &s1, const QString &s2)
void tst_QUndoGroup::checkSignals()
{
QUndoGroup group;
QAction *undo_action = group.createUndoAction(0, QString("foo"));
QAction *redo_action = group.createRedoAction(0, QString("bar"));
const QScopedPointer<QAction> undo_action(group.createUndoAction(0, QString("foo")));
const QScopedPointer<QAction> redo_action(group.createRedoAction(0, QString("bar")));
QSignalSpy indexChangedSpy(&group, SIGNAL(indexChanged(int)));
QSignalSpy cleanChangedSpy(&group, SIGNAL(cleanChanged(bool)));
QSignalSpy canUndoChangedSpy(&group, SIGNAL(canUndoChanged(bool)));
@ -590,9 +590,6 @@ void tst_QUndoGroup::checkSignals()
true, // indexChanged
true, // undoChanged
true) // redoChanged
delete undo_action;
delete redo_action;
}
void tst_QUndoGroup::addStackAndDie()
@ -629,8 +626,8 @@ void tst_QUndoGroup::commandTextFormat()
qApp->installTranslator(&translator);
QUndoGroup group;
QAction *undo_action = group.createUndoAction(0);
QAction *redo_action = group.createRedoAction(0);
const QScopedPointer<QAction> undo_action(group.createUndoAction(0));
const QScopedPointer<QAction> redo_action(group.createRedoAction(0));
QCOMPARE(undo_action->text(), QString("Undo-default-text"));
QCOMPARE(redo_action->text(), QString("Redo-default-text"));

View File

@ -257,8 +257,8 @@ static QString glue(const QString &s1, const QString &s2)
static void checkState(QSignalSpy &redoTextChangedSpy,
QSignalSpy &canRedoChangedSpy,
QSignalSpy &undoTextChangedSpy,
QAction *const redoAction,
QAction *const undoAction,
const QScopedPointer<QAction> &redoAction,
const QScopedPointer<QAction> &undoAction,
QSignalSpy &canUndoChangedSpy,
QSignalSpy &cleanChangedSpy,
QSignalSpy &indexChangedSpy,
@ -327,8 +327,8 @@ static void checkState(QSignalSpy &redoTextChangedSpy,
void tst_QUndoStack::undoRedo()
{
QUndoStack stack;
QAction *undoAction = stack.createUndoAction(0, QString("foo"));
QAction *redoAction = stack.createRedoAction(0, QString("bar"));
const QScopedPointer<QAction> undoAction(stack.createUndoAction(0, QString("foo")));
const QScopedPointer<QAction> redoAction(stack.createRedoAction(0, QString("bar")));
QSignalSpy indexChangedSpy(&stack, SIGNAL(indexChanged(int)));
QSignalSpy cleanChangedSpy(&stack, SIGNAL(cleanChanged(bool)));
QSignalSpy canUndoChangedSpy(&stack, SIGNAL(canUndoChanged(bool)));
@ -688,8 +688,8 @@ void tst_QUndoStack::undoRedo()
void tst_QUndoStack::setIndex()
{
QUndoStack stack;
QAction *undoAction = stack.createUndoAction(0, QString("foo"));
QAction *redoAction = stack.createRedoAction(0, QString("bar"));
const QScopedPointer<QAction> undoAction(stack.createUndoAction(0, QString("foo")));
const QScopedPointer<QAction> redoAction(stack.createRedoAction(0, QString("bar")));
QSignalSpy indexChangedSpy(&stack, SIGNAL(indexChanged(int)));
QSignalSpy cleanChangedSpy(&stack, SIGNAL(cleanChanged(bool)));
QSignalSpy canUndoChangedSpy(&stack, SIGNAL(canUndoChanged(bool)));
@ -952,8 +952,8 @@ void tst_QUndoStack::setIndex()
void tst_QUndoStack::setClean()
{
QUndoStack stack;
QAction *undoAction = stack.createUndoAction(0, QString("foo"));
QAction *redoAction = stack.createRedoAction(0, QString("bar"));
const QScopedPointer<QAction> undoAction(stack.createUndoAction(0, QString("foo")));
const QScopedPointer<QAction> redoAction(stack.createRedoAction(0, QString("bar")));
QSignalSpy indexChangedSpy(&stack, SIGNAL(indexChanged(int)));
QSignalSpy cleanChangedSpy(&stack, SIGNAL(cleanChanged(bool)));
QSignalSpy canUndoChangedSpy(&stack, SIGNAL(canUndoChanged(bool)));
@ -1205,8 +1205,8 @@ void tst_QUndoStack::setClean()
void tst_QUndoStack::clear()
{
QUndoStack stack;
QAction *undoAction = stack.createUndoAction(this, QString("foo"));
QAction *redoAction = stack.createRedoAction(this, QString("bar"));
const QScopedPointer<QAction> undoAction(stack.createUndoAction(0, QString("foo")));
const QScopedPointer<QAction> redoAction(stack.createRedoAction(0, QString("bar")));
QSignalSpy indexChangedSpy(&stack, SIGNAL(indexChanged(int)));
QSignalSpy cleanChangedSpy(&stack, SIGNAL(cleanChanged(bool)));
QSignalSpy canUndoChangedSpy(&stack, SIGNAL(canUndoChanged(bool)));
@ -1403,8 +1403,8 @@ void tst_QUndoStack::clear()
void tst_QUndoStack::childCommand()
{
QUndoStack stack;
QAction *undoAction = stack.createUndoAction(0, QString("foo"));
QAction *redoAction = stack.createRedoAction(0, QString("bar"));
const QScopedPointer<QAction> undoAction(stack.createUndoAction(0, QString("foo")));
const QScopedPointer<QAction> redoAction(stack.createRedoAction(0, QString("bar")));
QSignalSpy indexChangedSpy(&stack, SIGNAL(indexChanged(int)));
QSignalSpy cleanChangedSpy(&stack, SIGNAL(cleanChanged(bool)));
QSignalSpy canUndoChangedSpy(&stack, SIGNAL(canUndoChanged(bool)));
@ -1508,16 +1508,13 @@ void tst_QUndoStack::childCommand()
true, // indexChanged
true, // undoChanged
true); // redoChanged
delete undoAction;
delete redoAction;
}
void tst_QUndoStack::macroBeginEnd()
{
QUndoStack stack;
QAction *undoAction = stack.createUndoAction(0, QString("foo"));
QAction *redoAction = stack.createRedoAction(0, QString("bar"));
const QScopedPointer<QAction> undoAction(stack.createUndoAction(0, QString("foo")));
const QScopedPointer<QAction> redoAction(stack.createRedoAction(0, QString("bar")));
QSignalSpy indexChangedSpy(&stack, SIGNAL(indexChanged(int)));
QSignalSpy cleanChangedSpy(&stack, SIGNAL(cleanChanged(bool)));
QSignalSpy canUndoChangedSpy(&stack, SIGNAL(canUndoChanged(bool)));
@ -1978,16 +1975,13 @@ void tst_QUndoStack::macroBeginEnd()
true, // indexChanged
true, // undoChanged
true); // redoChanged
delete undoAction;
delete redoAction;
}
void tst_QUndoStack::compression()
{
QUndoStack stack;
QAction *undoAction = stack.createUndoAction(0, QString("foo"));
QAction *redoAction = stack.createRedoAction(0, QString("bar"));
const QScopedPointer<QAction> undoAction(stack.createUndoAction(0, QString("foo")));
const QScopedPointer<QAction> redoAction(stack.createRedoAction(0, QString("bar")));
QSignalSpy indexChangedSpy(&stack, SIGNAL(indexChanged(int)));
QSignalSpy cleanChangedSpy(&stack, SIGNAL(cleanChanged(bool)));
QSignalSpy canUndoChangedSpy(&stack, SIGNAL(canUndoChanged(bool)));
@ -2423,16 +2417,13 @@ void tst_QUndoStack::compression()
true, // indexChanged
true, // undoChanged
true); // redoChanged
delete undoAction;
delete redoAction;
}
void tst_QUndoStack::undoLimit()
{
QUndoStack stack;
QAction *undoAction = stack.createUndoAction(0, QString("foo"));
QAction *redoAction = stack.createRedoAction(0, QString("bar"));
const QScopedPointer<QAction> undoAction(stack.createUndoAction(0, QString("foo")));
const QScopedPointer<QAction> redoAction(stack.createRedoAction(0, QString("bar")));
QSignalSpy indexChangedSpy(&stack, SIGNAL(indexChanged(int)));
QSignalSpy cleanChangedSpy(&stack, SIGNAL(cleanChanged(bool)));
QSignalSpy canUndoChangedSpy(&stack, SIGNAL(canUndoChanged(bool)));
@ -2972,8 +2963,8 @@ void tst_QUndoStack::commandTextFormat()
qApp->installTranslator(&translator);
QUndoStack stack;
QAction *undo_action = stack.createUndoAction(0);
QAction *redo_action = stack.createRedoAction(0);
const QScopedPointer<QAction> undo_action(stack.createUndoAction(0));
const QScopedPointer<QAction> redo_action(stack.createRedoAction(0));
QCOMPARE(undo_action->text(), QString("Undo-default-text"));
QCOMPARE(redo_action->text(), QString("Redo-default-text"));
@ -3000,8 +2991,8 @@ void tst_QUndoStack::commandTextFormat()
void tst_QUndoStack::separateUndoText()
{
QUndoStack stack;
QAction *undo_action = stack.createUndoAction(0);
QAction *redo_action = stack.createRedoAction(0);
const QScopedPointer<QAction> undo_action(stack.createUndoAction(0));
const QScopedPointer<QAction> redo_action(stack.createRedoAction(0));
QUndoCommand *command1 = new IdleCommand();
QUndoCommand *command2 = new IdleCommand();

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));