Merge "Merge remote-tracking branch 'origin/stable' into dev" into refs/staging/dev

This commit is contained in:
Sergio Ahumada 2013-09-10 23:22:23 +02:00 committed by The Qt Project
commit bcbec4bc49
45 changed files with 976 additions and 532 deletions

206
dist/changes-5.1.1 vendored Normal file
View File

@ -0,0 +1,206 @@
Qt 5.1.1 is a bug-fix release. It maintains both forward and backward
compatibility (source and binary) with Qt 5.1.0.
For more details, refer to the online documentation included in this
distribution. The documentation is also available online:
http://qt-project.org/doc/qt-5.1/
The Qt version 5.1 series is binary compatible with the 5.0.x series.
Applications compiled for 5.0 will continue to run with 5.1.
Some of the changes listed in this file include issue tracking numbers
corresponding to tasks in the Qt Bug Tracker:
http://bugreports.qt-project.org/
Each of these identifiers can be entered in the bug tracker to obtain more
information about a particular change.
****************************************************************************
* General *
****************************************************************************
- Add support for Visual Studio 2013
- Remove obsolete 'register' C keyword
- Speed up font database loading with fontconfig
- [QTBUG-32284] Fix incomplete override of QIODevice::open in QProcess and QLocalSocket
****************************************************************************
* Library *
****************************************************************************
QtCore
------
- Add basic conversion functions from QVariant(QJsonValue)
- Fix crash when re-creating QThreadData after initially destroying it
- Fix the host_bins variable in the QtCore pkg-config file
- QUrl stringprep: fix handling of U+0080: it's prohibited
- QUrl stringprep: avoid recalculating the surrogates we already know
- QUrl stringprep: fix handling of prohibited characters
- QUrl stringprep: fix case folding from non-BMP to BMP
- QUrl stringprep: recalculate the current position if the size changes
- [QTBUG-24345] Prevent negative size in QBitArray, QVector and QVarLengthArray ctors
- [QTBUG-25732] Mention QRect's int min/max constraints in detailed description
- [QTBUG-29391] fix infinite loop in QProcessPrivate::drainOutputPipes
- [QTBUG-29391] QWinOverlappedIoNotifier: fix race condition
- [QTBUG-31341] Fix watch of files/folders with special characters
- [QTBUG-31606] Fix dead lock in the Qt event handling
- [QTBUG-31926] Fix the number precision in QJsonDocument.toJson() again
- [QTBUG-32100] Remove default argument from declarations of qHash as friend
- [QTBUG-32314] QDir::mkpath shouldn't fail if parent directory denies access
- [QTBUG-32354] fix endless loop in QProcess/Win drainOutputPipes
- [QTBUG-32500] Ensure that the user codecs are listed in QTextCodec::availableCodecs
QtDBus
------
- [QTBUG-27973] Fix disconnectFrom{Peer,Bus} when the connection failed
- [QTBUG-31932] Don't crash if the relayed signal was emitted from the wrong thread
- [QTBUG-32374] Fix QDBusAbstractInterface::isValid() for peer connections
QtGui
-----
- Restore smooth-scaled drawing of 0.5x-2.0x scaled glyphs in the GL engine
- QIcon: Avoid fetching twice the same pixmap
- Fix FBO restoring in QOpenGLTextureGlyphCache
- [QTBUG-28284] Set projection matrix for systems with OpenGL 3.1
- [QTBUG-31443] QPdfWriter: Fix setting of paper size
- [QTBUG-32193] REG: Fix crash when mixing projected/unprojected text painting
- [QTBUG-32433] Detect popup window correctly in modal window blocked handling
QtNetwork
---------
- Correct algorithm for digest auth when using the CONNECT verb
- Add reconnect attempts in more cases in QHttpNetworkConnectionChannel
- [QTBUG-32404] HTTP internals: do not access reply that was deleted already
- [QTBUG-32534] QHttpMultiPart: fix data corruption in readData method
QtPrintSupport
--------------
- [QTBUG-31790] Initialize UI of widget-based dialog.
QtWidgets
---------
- Display sizegrip on QMdiSubWindows, even on OS X 10.7 and later
- Check if widget inherits from QTextEdit when drawing the frame
- Fix QWidget::isActiveWindow for window containers
- Hide placeholder text when QLineEdit has preedit text
- [QTBUG-19036] Make *ItemBoundingRect modes work with custom shapes.
- [QTBUG-29945] Fix dropshadow and blur graphics effects
- [QTBUG-31044] QDockWidget: Keep position when undocking
- [QTBUG-31569] If a QWidget is ignored for auto-quit, ignore its corresponding QWindow
- [QTBUG-31664] Recognize separator item in QMenu
- [QTBUG-31904] Fix rotation of text in vertical QDockWidget titlebars in QFusionStyle
- [QTBUG-32054] Set correct cell when selecting custom color cell with arrow keys
- [QTBUG-32061] Fix the cursor position of an empty QLineEdit with a placeholder text
- [QTBUG-32177] Search toplevel when setting the active window from focus window
- [QTBUG-32260] Consider virtual screen when determining dock widget visibility
****************************************************************************
* Platform Specific Changes *
****************************************************************************
Qt for Linux
------------
- XCB: Don't use Xlib's XBell() function
- XCB: Append 0-character to atom name string
- Resolve modifier mask conflicts on X11
- Fix system tray icon on X11
- [QTBUG-31418] Fix for when we don't have XSettings
- [QTBUG-32274] Fix handling of non-latin1 shortcuts
Qt for Mac
----------
- Disable window restoration for the Mac font panel
- Simplify qt_mac_cgimage_to_nsimage code
- QMacStyle: fix auto-default button animation
- Make the macx-xcode spec a wrapper around the default spec
- Scope cached Mac SDK tool values by mkspec
- Further followup to Q_OS_MACX changes
- Fix QSpinBox clipping issue on Mac when frame=false
- QMacStyle: enable scroll style changes for non-QScrollBars
- Support Mac key equivalent Cmd+Period
- Re-establish platform menu QObject hierarchy
- [QTBUG-28336] Fixed broken prl files in debug-and-release framework builds of qt
- [QTBUG-31477] Let Cocoa pick the right pixmap for menu item icons
- [QTBUG-31532] Don't update the menubar when popups are shown
- [QTBUG-31619] Cocoa save file dialog behavior fix
- [QTBUG-31819] Fix shared color panel usage
- [QTBUG-31562] Fix for OS X QFileDialog showing bundle as directory
- [QTBUG-32440] Avoid a potential crash in unignoredChildren
- [QTBUG-32831] Don't release the printer after using it to change a property
Qt for Windows
--------------
- Clear window under mouse in destruction of platform window
- Prevent activation of windows with Qt::WindowDoesNotAcceptFocus
- Better errorhandling for the fontengine on WINCE
- Windows: Synthesize expose event for shrinking windows
- Windows font database: Resolve aliases for extra fonts
- Bugfix QDesktopServices on Windows
- ActiveQt: Pass native parent handle property from widget to widget window
- REG: Fix character size when exporting PDF on Windows
- Fix crash caused by ~QWindowsWindow flushing the event queue
- Show native file dialog on Windows XP Professional x64 Edition
- Fix detection of synthesized mouse events for MSVC / 64bit
- Display a message box if platform plugin cannot be found
- Fix auto-enabling of windows style
- Fixes QKeyEvent::count() on Windows
Qt for BlackBerry
-----------------
- Disable xkbcommon when building for QNX from Windows
- [QTBUG-32385] Handle Qt::WindowDoesNotAcceptFocus correctly
Qt for Android
--------------
- Get SSL root certificates from TrustManager
- Adjust to new SDK layout on Windows
- Make PCRE's JIT work on Android devices
Qt for iOS
----------
- iOS: Make sure we're deleting framebuffers in the right context
****************************************************************************
* Tools *
****************************************************************************
- configure
* [QTBUG-5366] Complain about bad arguments to -make/-nomake
* [QTBUG-21778] Catch accidental use of -no-make
* [QTBUG-28763] Don't enable EGL support if OpenGL is disabled
- cmake config files
* Use absolute path in the /usr move workaround if -libdir is specified
* Always use forward slashes in paths passed to cmake
* Make clients use the QT_NO_DEBUG flag when using QtCore in release mode
* [QTBUG-32134] Add path to the headers in frameworks to the include dirs
* [QTBUG-32466] Don't check for the existence of private include directories
- qmake
* [QTBUG-5301] basic manifest tool support in vc(x)proj generator
* [QTBUG-19352] Resolve output of .depend_command relative to $$OUT_PWD
* [QTBUG-29826] Only add the res_file to the generated files if there is no rc_file
* [QTBUG-29988] VPATH resolution: don't crash when $(FOO) expands to nothing
* [QTBUG-30993] Changed project dependencies for solution files
* [QTBUG-31877] Make $$list() more backwards-compatible regarding backslashes
* [QTBUG-31975] MANIFEST:NO is not written to vcproj
* [QTBUG-32326] Escape paths coming from prl files

View File

@ -436,8 +436,7 @@ bool TextEdit::maybeSave()
{
if (!textEdit->document()->isModified())
return true;
if (fileName.startsWith(QLatin1String(":/")))
return true;
QMessageBox::StandardButton ret;
ret = QMessageBox::warning(this, tr("Application"),
tr("The document has been modified.\n"
@ -485,6 +484,8 @@ bool TextEdit::fileSave()
{
if (fileName.isEmpty())
return fileSaveAs();
if (fileName.startsWith(QStringLiteral(":/")))
return fileSaveAs();
QTextDocumentWriter writer(fileName);
bool success = writer.write(textEdit->document());

View File

@ -37,7 +37,6 @@ contains(QMAKE_HOST.os,Windows) {
NDK_ROOT = $$(ANDROID_NDK_ROOT)
!exists($$NDK_ROOT) {
NDK_ROOT = $$DEFAULT_ANDROID_NDK_ROOT
!exists($$NDK_ROOT): error("You need to set the ANDROID_NDK_ROOT environment variable to point to your Android NDK.")
}
NDK_HOST = $$(ANDROID_NDK_HOST)
@ -187,4 +186,6 @@ QMAKE_LIBS_OPENGL =
QMAKE_LIBS_OPENGL_ES1 = -lGLESv1_CM
QMAKE_LIBS_OPENGL_ES2 = -lGLESv2
!exists($$NDK_ROOT): error("You need to set the ANDROID_NDK_ROOT environment variable to point to your Android NDK.")
load(qt_config)

View File

@ -24,6 +24,19 @@ load(cmake_functions)
CMAKE_INSTALL_LIBS_DIR = $$cmakeTargetPath($$[QT_INSTALL_LIBS])
contains(CMAKE_INSTALL_LIBS_DIR, ^(/usr)?/lib(64)?.*): CMAKE_USR_MOVE_WORKAROUND = $$CMAKE_INSTALL_LIBS_DIR
CMAKE_MODULE_NAME = $$cmakeModuleName($${MODULE})
split_incpath {
CMAKE_ADD_SOURCE_INCLUDE_DIRS = true
CMAKE_NO_PRIVATE_INCLUDES = true # Don't add private includes in the build dir which don't exist
CMAKE_SOURCE_INCLUDES = \
$$cmakeTargetPath($$QT_MODULE_INCLUDE_BASE) \
$$cmakeTargetPath($$QT_MODULE_INCLUDE_BASE/Qt$${CMAKE_MODULE_NAME})
CMAKE_SOURCE_PRIVATE_INCLUDES = \
$$cmakeTargetPath($$QT_MODULE_INCLUDE_BASE/Qt$${CMAKE_MODULE_NAME}/$$eval(QT.$${MODULE}.VERSION)) \
$$cmakeTargetPath($$QT_MODULE_INCLUDE_BASE/Qt$${CMAKE_MODULE_NAME}/$$eval(QT.$${MODULE}.VERSION)/Qt$${CMAKE_MODULE_NAME})
}
CMAKE_INCLUDE_DIR = $$cmakeRelativePath($$[QT_INSTALL_HEADERS], $$[QT_INSTALL_PREFIX])
contains(CMAKE_INCLUDE_DIR, "^\\.\\./.*") {
CMAKE_INCLUDE_DIR = $$[QT_INSTALL_HEADERS]/
@ -37,10 +50,10 @@ contains(CMAKE_LIB_DIR,"^\\.\\./.*") {
CMAKE_LIB_DIR = $$[QT_INSTALL_LIBS]/
CMAKE_LIB_DIR_IS_ABSOLUTE = True
} else {
CMAKE_RELATIVE_INSTALL_DIR = $$cmakeRelativePath($$[QT_INSTALL_PREFIX], $$[QT_INSTALL_LIBS])
CMAKE_RELATIVE_INSTALL_LIBS_DIR = $$cmakeRelativePath($$[QT_INSTALL_PREFIX], $$[QT_INSTALL_LIBS])
# We need to go up another two levels because the CMake files are
# installed in $${CMAKE_LIB_DIR}/cmake/Qt5$${CMAKE_MODULE_NAME}
CMAKE_RELATIVE_INSTALL_DIR = "$${CMAKE_RELATIVE_INSTALL_DIR}../../"
CMAKE_RELATIVE_INSTALL_DIR = "$${CMAKE_RELATIVE_INSTALL_LIBS_DIR}../../"
}
CMAKE_BIN_DIR = $$cmakeRelativePath($$[QT_HOST_BINS], $$[QT_INSTALL_PREFIX])
@ -135,8 +148,6 @@ unix:contains(QT_CONFIG, reduce_relocations):CMAKE_ADD_FPIE_FLAGS = "true"
CMAKE_MKSPEC = $$[QMAKE_XSPEC]
CMAKE_MODULE_NAME = $$cmakeModuleName($${MODULE})
CMAKE_MODULE_DEPS = $$cmakeModuleList($$sort_depends(QT.$${MODULE}.depends, QT.))
CMAKE_PARTIAL_MODULE_DEPS = $$replace(CMAKE_MODULE_DEPS, ";", ";Qt5::")
!isEmpty(CMAKE_PARTIAL_MODULE_DEPS):CMAKE_QT5_MODULE_DEPS = "Qt5::$${CMAKE_PARTIAL_MODULE_DEPS}"

View File

@ -13,7 +13,7 @@ get_filename_component(_IMPORT_PREFIX \"${CMAKE_CURRENT_LIST_FILE}\" PATH)
get_filename_component(_realCurr \"${_IMPORT_PREFIX}\" REALPATH)
get_filename_component(_realOrig \"$$CMAKE_INSTALL_LIBS_DIR/cmake/Qt5$${CMAKE_MODULE_NAME}\" REALPATH)
if(_realCurr STREQUAL _realOrig)
get_filename_component(_qt5$${CMAKE_MODULE_NAME}_install_prefix \"$$CMAKE_INSTALL_LIBS_DIR\" PATH)
get_filename_component(_qt5$${CMAKE_MODULE_NAME}_install_prefix \"$$CMAKE_INSTALL_LIBS_DIR/$${CMAKE_RELATIVE_INSTALL_LIBS_DIR}\" ABSOLUTE)
else()
get_filename_component(_qt5$${CMAKE_MODULE_NAME}_install_prefix \"${CMAKE_CURRENT_LIST_DIR}/$${CMAKE_RELATIVE_INSTALL_DIR}\" ABSOLUTE)
endif()
@ -120,6 +120,14 @@ if (NOT TARGET Qt5::$${CMAKE_MODULE_NAME})
!!ENDIF
!!ENDIF
!!ENDIF
!!IF !isEmpty(CMAKE_ADD_SOURCE_INCLUDE_DIRS)
list(APPEND _Qt5$${CMAKE_MODULE_NAME}_OWN_INCLUDE_DIRS
$$CMAKE_SOURCE_INCLUDES
)
set(Qt5$${CMAKE_MODULE_NAME}_PRIVATE_INCLUDE_DIRS
$$CMAKE_SOURCE_PRIVATE_INCLUDES
)
!!ENDIF
!!ELSE
set(_Qt5$${CMAKE_MODULE_NAME}_OWN_INCLUDE_DIRS)
set(Qt5$${CMAKE_MODULE_NAME}_PRIVATE_INCLUDE_DIRS)

View File

@ -205,6 +205,7 @@ defineTest(qtPrepareTool) {
}
}
}
QT_TOOL_ENV += $$eval(QT_TOOL.$${2}.envvars)
!isEmpty(3) {
$$1$$3 = $$system_path($$eval($$1))
qtAddTargetEnv($$1$$3, QT_TOOL.$${2}.depends, system)

View File

@ -27,9 +27,28 @@ CONFIG += console
TOOL_PRI = $$MODULE_QMAKE_OUTDIR/mkspecs/modules/qt_tool_$${MODULE}.pri
vars = binary depends
!isEmpty(QT_TOOL_ENV) {
vars += envvars
module_var_names =
module_var_sets =
for(var, QT_TOOL_ENV) {
vars += env.$${var}.name env.$${var}.value
module_var_names += QT_TOOL.$${MODULE}.env.$${var}
module_var_sets += \
"QT_TOOL.$${MODULE}.env.$${var}.name = $$val_escape($${var}.name)" \
"QT_TOOL.$${MODULE}.env.$${var}.value = $$val_escape($${var}.value)"
}
module_envvars = \
"QT_TOOL.$${MODULE}.envvars = $$module_var_names" \
$$module_var_sets
} else {
module_envvars =
}
TOOL_PRI_CONT = \
"QT_TOOL.$${MODULE}.binary = $$QMAKE_RESOLVED_TARGET" \
"QT_TOOL.$${MODULE}.depends =$$join(MODULE_DEPENDS, " ", " ")"
"QT_TOOL.$${MODULE}.depends =$$join(MODULE_DEPENDS, " ", " ")" \
$$module_envvars
write_file($$TOOL_PRI, TOOL_PRI_CONT)|error("Aborting.")
# Then, inject the new tool into the current cache state
@ -39,7 +58,7 @@ CONFIG += console
unset(added)
}
include($$TOOL_PRI)
for(var, $$list(binary depends)): \
for(var, vars): \
cache(QT_TOOL.$${MODULE}.$$var, transient)
}

View File

@ -4006,8 +4006,10 @@
include the precompiled header file in \c HEADERS, as
qmake will do this if the configuration supports precompiled headers.
All platforms that support precompiled headers have the configuration
option \c precompile_header set. Using this option, you may trigger
The MSVC and g++ specs targeting Windows (and Windows CE) enable
\c precompile_header by default.
Using this option, you may trigger
conditional blocks in your project file to add settings when using
precompiled headers.
For example:

View File

@ -2202,6 +2202,24 @@ MakefileGenerator::writeExtraVariables(QTextStream &t)
}
}
bool
MakefileGenerator::writeDummyMakefile(QTextStream &t)
{
if (project->values("QMAKE_FAILED_REQUIREMENTS").isEmpty())
return false;
t << "QMAKE = " << var("QMAKE_QMAKE") << endl;
const ProStringList &qut = project->values("QMAKE_EXTRA_TARGETS");
for (ProStringList::ConstIterator it = qut.begin(); it != qut.end(); ++it)
t << *it << " ";
t << "first all clean install distclean uninstall qmake_all:\n\t"
<< "@echo \"Some of the required modules ("
<< var("QMAKE_FAILED_REQUIREMENTS") << ") are not available.\"\n\t"
<< "@echo \"Skipped.\"\n\n";
writeMakeQmake(t);
t << "FORCE:\n\n";
return true;
}
bool
MakefileGenerator::writeStubMakefile(QTextStream &t)
{

View File

@ -104,6 +104,7 @@ protected:
void writeExtraTargets(QTextStream &t);
void writeExtraCompilerTargets(QTextStream &t);
void writeExtraCompilerVariables(QTextStream &t);
bool writeDummyMakefile(QTextStream &t);
virtual bool writeStubMakefile(QTextStream &t);
virtual bool writeMakefile(QTextStream &t);

View File

@ -80,19 +80,8 @@ UnixMakefileGenerator::writeMakefile(QTextStream &t)
{
writeHeader(t);
if(!project->values("QMAKE_FAILED_REQUIREMENTS").isEmpty()) {
t << "QMAKE = " << var("QMAKE_QMAKE") << endl;
const ProStringList &qut = project->values("QMAKE_EXTRA_TARGETS");
for (ProStringList::ConstIterator it = qut.begin(); it != qut.end(); ++it)
t << *it << " ";
t << "first all clean install distclean uninstall qmake_all:\n\t"
<< "@echo \"Some of the required modules ("
<< var("QMAKE_FAILED_REQUIREMENTS") << ") are not available.\"\n\t"
<< "@echo \"Skipped.\"\n\n";
writeMakeQmake(t);
t << "FORCE:\n\n";
if (writeDummyMakefile(t))
return true;
}
if (project->values("TEMPLATE").first() == "app" ||
project->values("TEMPLATE").first() == "lib" ||

View File

@ -114,14 +114,8 @@ bool MingwMakefileGenerator::findLibraries()
bool MingwMakefileGenerator::writeMakefile(QTextStream &t)
{
writeHeader(t);
if(!project->values("QMAKE_FAILED_REQUIREMENTS").isEmpty()) {
t << "all clean:\n\t"
<< "@echo \"Some of the required modules ("
<< var("QMAKE_FAILED_REQUIREMENTS") << ") are not available.\"\n\t"
<< "@echo \"Skipped.\"\n\n";
writeMakeQmake(t);
if (writeDummyMakefile(t))
return true;
}
if(project->first("TEMPLATE") == "app" ||
project->first("TEMPLATE") == "lib" ||

View File

@ -58,17 +58,8 @@ bool
NmakeMakefileGenerator::writeMakefile(QTextStream &t)
{
writeHeader(t);
if(!project->values("QMAKE_FAILED_REQUIREMENTS").isEmpty()) {
const ProStringList &qut = project->values("QMAKE_EXTRA_TARGETS");
for (ProStringList::ConstIterator it = qut.begin(); it != qut.end(); ++it)
t << *it << " ";
t << "all first clean:\n\t"
<< "@echo \"Some of the required modules ("
<< var("QMAKE_FAILED_REQUIREMENTS") << ") are not available.\"\n\t"
<< "@echo \"Skipped.\"\n\n";
writeMakeQmake(t);
if (writeDummyMakefile(t))
return true;
}
if(project->first("TEMPLATE") == "app" ||
project->first("TEMPLATE") == "lib" ||

View File

@ -2311,7 +2311,7 @@ bool VCFilter::addExtraCompiler(const VCFilterFile &info)
inputs += Option::fixPathToTargetOS(file, false);
}
}
deps += inputs; // input files themselves too..
deps = inputs + deps; // input files themselves too..
// Replace variables for command w/all input files
// ### join gives path issues with directories containing spaces!
@ -2319,7 +2319,7 @@ bool VCFilter::addExtraCompiler(const VCFilterFile &info)
inputs.join(' '),
out);
} else {
deps += inFile; // input file itself too..
deps.prepend(inFile); // input file itself too..
cmd = Project->replaceExtraCompilerVariables(tmp_cmd,
inFile,
out);
@ -2356,14 +2356,14 @@ bool VCFilter::addExtraCompiler(const VCFilterFile &info)
deps += CustomBuildTool.AdditionalDependencies;
// Make sure that all deps are only once
QHash<QString, bool> uniqDeps;
QStringList uniqDeps;
for (int c = 0; c < deps.count(); ++c) {
QString aDep = deps.at(c).trimmed();
if (!aDep.isEmpty())
uniqDeps[aDep] = false;
uniqDeps << aDep;
}
CustomBuildTool.AdditionalDependencies = uniqDeps.keys();
CustomBuildTool.AdditionalDependencies.sort();
uniqDeps.removeDuplicates();
CustomBuildTool.AdditionalDependencies = uniqDeps;
}
// Ensure that none of the output files are also dependencies. Or else, the custom buildstep

View File

@ -573,9 +573,12 @@ typedef enum { Q_FileIdInfo = 18 } Q_FILE_INFO_BY_HANDLE_CLASS;
# if defined(Q_CC_MINGW) || (defined(Q_CC_MSVC) && _MSC_VER < 1700)
// MinGW-64 defines FILE_ID_128 as of gcc-4.8.1 along with FILE_SUPPORTS_INTEGRITY_STREAMS
# if !(defined(Q_CC_MINGW) && defined(FILE_SUPPORTS_INTEGRITY_STREAMS))
typedef struct _FILE_ID_128 {
BYTE Identifier[16];
} FILE_ID_128, *PFILE_ID_128;
# endif // !(Q_CC_MINGW && FILE_SUPPORTS_INTEGRITY_STREAMS)
typedef struct _FILE_ID_INFO {
ULONGLONG VolumeSerialNumber;
@ -614,7 +617,8 @@ QByteArray fileIdWin8(HANDLE handle)
&infoEx, sizeof(FILE_ID_INFO))) {
result = QByteArray::number(infoEx.VolumeSerialNumber, 16);
result += ':';
result += QByteArray((char *)infoEx.FileId.Identifier, sizeof(infoEx.FileId.Identifier)).toHex();
// Note: MinGW-64's definition of FILE_ID_128 differs from the MSVC one.
result += QByteArray((char *)&infoEx.FileId, sizeof(infoEx.FileId)).toHex();
}
}
return result;

View File

@ -42,6 +42,7 @@
#include "qmetaobject.h"
#include "qmetatype.h"
#include "qobject.h"
#include "qmetaobject_p.h"
#include <qcoreapplication.h>
#include <qcoreevent.h>
@ -2098,8 +2099,12 @@ bool QMetaMethod::invoke(QObject *object,
if (qstrcmp(returnValue.name(), retType) != 0) {
// normalize the return value as well
QByteArray normalized = QMetaObject::normalizedType(returnValue.name());
if (qstrcmp(normalized.constData(), retType) != 0)
return false;
if (qstrcmp(normalized.constData(), retType) != 0) {
// String comparison failed, try compare the metatype.
int t = returnType();
if (t == QMetaType::UnknownType || t != QMetaType::type(normalized))
return false;
}
}
}

View File

@ -646,8 +646,6 @@ static inline char qToLower(char c)
store raw binary data, and when memory conservation is critical
(e.g., with Qt for Embedded Linux).
The maximum array size of a QByteArray is under 2^30.
One way to initialize a QByteArray is simply to pass a \c{const
char *} to its constructor. For example, the following code
creates a byte array of size 5 containing the data "Hello":

View File

@ -642,7 +642,7 @@ typename QVector<T>::iterator QVector<T>::erase(iterator abegin, iterator aend)
iterator moveEnd = d->end();
while (moveBegin != moveEnd) {
if (QTypeInfo<T>::isComplex)
abegin->~T();
static_cast<T *>(abegin)->~T();
new (abegin++) T(*moveBegin++);
}
if (abegin < d->end()) {

View File

@ -591,14 +591,14 @@ bool Q_INTERNAL_WIN_NO_THROW QPngHandlerPrivate::readPngImage(QImage *outImage)
if (doScaledRead) {
read_image_scaled(outImage, png_ptr, info_ptr, amp, scaledSize);
} else {
png_uint_32 width;
png_uint_32 height;
png_int_32 offset_x;
png_int_32 offset_y;
png_uint_32 width = 0;
png_uint_32 height = 0;
png_int_32 offset_x = 0;
png_int_32 offset_y = 0;
int bit_depth;
int color_type;
int unit_type;
int bit_depth = 0;
int color_type = 0;
int unit_type = PNG_OFFSET_PIXEL;
png_get_IHDR(png_ptr, info_ptr, &width, &height, &bit_depth, &color_type, 0, 0, 0);
png_get_oFFs(png_ptr, info_ptr, &offset_x, &offset_y, &unit_type);
uchar *data = outImage->bits();

View File

@ -1,6 +1,7 @@
contains(QT_CONFIG,xlib):contains(QT_CONFIG,xrender) {
contains(QT_CONFIG, xlib) {
contains(QT_CONFIG,opengl):!contains(QT_CONFIG,opengles2) {
LIBS_PRIVATE += $$QMAKE_LIBS_X11 -lXrender
contains(QT_CONFIG, xrender): LIBS_PRIVATE += -lXrender
LIBS_PRIVATE += $$QMAKE_LIBS_X11
HEADERS += $$PWD/qglxconvenience_p.h
SOURCES += $$PWD/qglxconvenience.cpp
}

View File

@ -565,33 +565,37 @@ static void setSurface(JNIEnv *env, jobject /*thiz*/, jobject jSurface)
m_nativeWindow = nativeWindow;
if (m_waitForWindow)
m_waitForWindowSemaphore.release();
if (m_androidPlatformIntegration && !sameNativeWindow) {
m_surfaceMutex.unlock();
m_androidPlatformIntegration->surfaceChanged();
} else if (m_androidPlatformIntegration && sameNativeWindow) {
QPlatformScreen *screen = m_androidPlatformIntegration->screen();
if (m_androidPlatformIntegration) {
QSize size = QtAndroid::nativeWindowSize();
QPlatformScreen *screen = m_androidPlatformIntegration->screen();
QRect geometry(QPoint(0, 0), size);
QWindowSystemInterface::handleScreenAvailableGeometryChange(screen->screen(), geometry);
QWindowSystemInterface::handleScreenGeometryChange(screen->screen(), geometry);
// Resize all top level windows, since they share the same surface
foreach (QWindow *w, QGuiApplication::topLevelWindows()) {
QAndroidOpenGLPlatformWindow *window =
static_cast<QAndroidOpenGLPlatformWindow *>(w->handle());
if (!sameNativeWindow) {
m_surfaceMutex.unlock();
m_androidPlatformIntegration->surfaceChanged();
} else {
// Resize all top level windows, since they share the same surface
foreach (QWindow *w, QGuiApplication::topLevelWindows()) {
QAndroidOpenGLPlatformWindow *window =
static_cast<QAndroidOpenGLPlatformWindow *>(w->handle());
if (window != 0) {
window->lock();
window->scheduleResize(size);
if (window != 0) {
window->lock();
window->scheduleResize(size);
QWindowSystemInterface::handleExposeEvent(window->window(),
QRegion(window->window()->geometry()));
window->unlock();
QWindowSystemInterface::handleExposeEvent(window->window(),
QRegion(window->window()->geometry()));
window->unlock();
}
}
m_surfaceMutex.unlock();
}
m_surfaceMutex.unlock();
} else {
m_surfaceMutex.unlock();
}

View File

@ -84,9 +84,19 @@ void QAndroidOpenGLPlatformWindow::invalidateSurface()
}
}
void QAndroidOpenGLPlatformWindow::updateStaticNativeWindow()
{
QWriteLocker locker(&m_staticSurfaceLock);
m_staticNativeWindow = QtAndroid::nativeWindow(false);
}
void QAndroidOpenGLPlatformWindow::resetSurface()
{
m_referenceCount.ref();
// Only add a reference if we're not already holding one, otherwise we're just updating
// the native window pointer
if (m_window == 0)
m_referenceCount.ref();
if (m_staticSurface == 0) {
QWriteLocker locker(&m_staticSurfaceLock);
QEglFSWindow::resetSurface();
@ -94,12 +104,17 @@ void QAndroidOpenGLPlatformWindow::resetSurface()
m_staticNativeWindow = m_window;
} else {
QReadLocker locker(&m_staticSurfaceLock);
Q_ASSERT(m_staticSurface != m_surface);
m_window = m_staticNativeWindow;
m_surface = m_staticSurface;
}
QWindowSystemInterface::handleExposeEvent(window(), QRegion(geometry())); // Expose event
{
lock();
scheduleResize(QtAndroid::nativeWindowSize());
QWindowSystemInterface::handleExposeEvent(window(), QRegion(geometry())); // Expose event
unlock();
}
QWindowSystemInterface::flushWindowSystemEvents();
}

View File

@ -71,6 +71,8 @@ public:
void destroy();
static void updateStaticNativeWindow();
private:
QSize m_scheduledResize;
QMutex m_lock;

View File

@ -174,6 +174,7 @@ void QAndroidPlatformIntegration::invalidateNativeSurface()
void QAndroidPlatformIntegration::surfaceChanged()
{
QAndroidOpenGLPlatformWindow::updateStaticNativeWindow();
foreach (QWindow *w, QGuiApplication::topLevelWindows()) {
QAndroidOpenGLPlatformWindow *window =
static_cast<QAndroidOpenGLPlatformWindow *>(w->handle());

View File

@ -457,7 +457,9 @@ void QCocoaMenu::showPopup(const QWindow *parentWindow, QPoint pos, const QPlatf
// Else, we need to transform 'pos' to window or screen coordinates.
NSPoint nsPos = NSMakePoint(pos.x() - 1, pos.y());
if (view) {
// Flip y-coordinate first, the convert to content view space.
nsPos.y = view.frame.size.height - nsPos.y;
nsPos = [view convertPoint:nsPos toView:view.window.contentView];
} else if (!QGuiApplication::screens().isEmpty()) {
QScreen *screen = QGuiApplication::screens().at(0);
nsPos.y = screen->availableVirtualSize().height() - nsPos.y;

View File

@ -795,6 +795,7 @@ void QCocoaWindow::recreateWindow(const QPlatformWindow *parentWindow)
QRect rect = window()->geometry();
NSRect frame = NSMakeRect(rect.x(), rect.y(), rect.width(), rect.height());
[m_contentView setFrame:frame];
[m_contentView setHidden: YES];
}
const qreal opacity = qt_window_private(window())->opacity;
@ -913,7 +914,8 @@ void QCocoaWindow::clearNSWindow(NSWindow *window)
[window setContentView:nil];
[window setDelegate:nil];
[window clearPlatformWindow];
[[NSNotificationCenter defaultCenter] removeObserver:m_contentView];
[[NSNotificationCenter defaultCenter] removeObserver:m_contentView
name:nil object:window];
}
// Returns the current global screen geometry for the nswindow associated with this window.
@ -1025,7 +1027,7 @@ qreal QCocoaWindow::devicePixelRatio() const
void QCocoaWindow::exposeWindow()
{
if (!m_isExposed) {
if (!m_isExposed && ![[m_contentView superview] isHidden]) {
m_isExposed = true;
QWindowSystemInterface::handleExposeEvent(window(), QRegion(geometry()));
}

View File

@ -107,12 +107,9 @@ static QTouchDevice *touchDevice = 0;
m_maskImage = 0;
m_maskData = 0;
m_window = 0;
if (m_subscribesForGlobalFrameNotifications) {
m_subscribesForGlobalFrameNotifications = false;
[[NSNotificationCenter defaultCenter] removeObserver:self
name:NSViewGlobalFrameDidChangeNotification
object:self];
}
m_subscribesForGlobalFrameNotifications = false;
[[NSNotificationCenter defaultCenter] removeObserver:self];
delete currentCustomDragTypes;
[super dealloc];
@ -603,6 +600,7 @@ static QTouchDevice *touchDevice = 0;
QWindowSystemInterface::handleCloseEvent(m_platformWindow->m_activePopupWindow);
QWindowSystemInterface::flushWindowSystemEvents();
m_platformWindow->m_activePopupWindow = 0;
return;
}
if ([self hasMarkedText]) {
NSInputManager* inputManager = [NSInputManager currentInputManager];

View File

@ -17,7 +17,7 @@ HEADERS = qoffscreenintegration.h \
OTHER_FILES += offscreen.json
contains(QT_CONFIG, xcb):contains(QT_CONFIG, opengl):!contains(QT_CONFIG, opengles2) {
contains(QT_CONFIG, xlib):contains(QT_CONFIG, opengl):!contains(QT_CONFIG, opengles2) {
SOURCES += qoffscreenintegration_x11.cpp
HEADERS += qoffscreenintegration_x11.h
system(echo "Using X11 offscreen integration with GLX")

View File

@ -1808,8 +1808,8 @@ void QWindowsXpNativeFileDialog::populateOpenFileName(OPENFILENAME *ofn, HWND ow
QString defaultSuffix = m_options->defaultSuffix();
if (defaultSuffix.startsWith(QLatin1Char('.')))
defaultSuffix.remove(0, 1);
if (!defaultSuffix.isEmpty())
ofn->lpstrDefExt = qStringToWCharArray(defaultSuffix);
// QTBUG-33156, also create empty strings to trigger the appending mechanism.
ofn->lpstrDefExt = qStringToWCharArray(defaultSuffix);
}
// Flags.
ofn->Flags = (OFN_NOCHANGEDIR | OFN_HIDEREADONLY | OFN_EXPLORER | OFN_PATHMUSTEXIST);

View File

@ -39,6 +39,12 @@
**
****************************************************************************/
// SHSTOCKICONINFO is only available since Vista
#if _WIN32_WINNT < 0x0600
# undef _WIN32_WINNT
# define _WIN32_WINNT 0x0600
#endif
#include "qwindowstheme.h"
#include "qwindowsdialoghelpers.h"
#include "qwindowscontext.h"

View File

@ -26,12 +26,15 @@
****************************************************************************/
/*!
\page qdoc-minimum-qdocconf.html
\title A minimal qdocconf file with comments
\title A minimal qdocconf file with Comments
\brief Describes a minimal .qdocconf file
Below you will find the full contents of qtgui.qdocconf. The subsequent section will discuss
every statement in the qdocconf file.
Below you will find the full contents of qtgui.qdocconf. The subsequent section
will discuss every statement in the qdocconf file.
Each line from the qdocconf file is first quoted. Below each statement you will
find the meaning.
\code
#include(compat.qdocconf)
@ -83,4 +86,6 @@ The source code of the example files can be found in the current directory.
The image files can be found in the underlying directory "images".
\note Please take care with this minimal qdocconf file. Using it in the wrong directory
could cause qdoc to include a large number of files.
*/

View File

@ -3221,6 +3221,13 @@ void QGraphicsView::mouseDoubleClickEvent(QMouseEvent *event)
qt_sendSpontaneousEvent(d->scene, &mouseEvent);
else
QApplication::sendEvent(d->scene, &mouseEvent);
// Update the original mouse event accepted state.
const bool isAccepted = mouseEvent.isAccepted();
event->setAccepted(isAccepted);
// Update the last mouse event accepted state.
d->lastMouseEvent.setAccepted(isAccepted);
}
/*!

View File

@ -1456,7 +1456,7 @@ void QListView::doItemsLayout()
void QListView::updateGeometries()
{
Q_D(QListView);
if (d->model->rowCount(d->root) <= 0 || d->model->columnCount(d->root) <= 0) {
if (geometry().isEmpty() || d->model->rowCount(d->root) <= 0 || d->model->columnCount(d->root) <= 0) {
horizontalScrollBar()->setRange(0, 0);
verticalScrollBar()->setRange(0, 0);
} else {
@ -1471,15 +1471,15 @@ void QListView::updateGeometries()
// if the scroll bars are turned off, we resize the contents to the viewport
if (d->movement == Static && !d->isWrapping()) {
const QSize maxSize = maximumViewportSize();
d->layoutChildren(); // we need the viewport size to be updated
if (d->flow == TopToBottom) {
if (horizontalScrollBarPolicy() == Qt::ScrollBarAlwaysOff) {
d->setContentsSize(maxSize.width(), contentsSize().height());
d->setContentsSize(viewport()->width(), contentsSize().height());
horizontalScrollBar()->setRange(0, 0); // we see all the contents anyway
}
} else { // LeftToRight
if (verticalScrollBarPolicy() == Qt::ScrollBarAlwaysOff) {
d->setContentsSize(contentsSize().width(), maxSize.height());
d->setContentsSize(contentsSize().width(), viewport()->height());
verticalScrollBar()->setRange(0, 0); // we see all the contents anyway
}
}

View File

@ -158,7 +158,7 @@ static bool correctWidgetContext(Qt::ShortcutContext context, QWidget *w, QWidge
if (context == Qt::WidgetWithChildrenShortcut) {
const QWidget *tw = QApplication::focusWidget();
while (tw && tw != w && (tw->windowType() == Qt::Widget || tw->windowType() == Qt::Popup))
while (tw && tw != w && (tw->windowType() == Qt::Widget || tw->windowType() == Qt::Popup || tw->windowType() == Qt::SubWindow))
tw = tw->parentWidget();
return tw == w;
}

View File

@ -333,8 +333,7 @@ void QLineEdit::setText(const QString& text)
\brief the line edit's placeholder text
Setting this property makes the line edit display a grayed-out
placeholder text as long as the text() is empty and the widget doesn't
have focus.
placeholder text as long as the text() is empty.
By default, this property contains an empty string.

View File

@ -2864,8 +2864,15 @@ void QMenu::mouseMoveEvent(QMouseEvent *e)
d->mouseDown = this;
}
if (d->sloppyRegion.contains(e->pos())) {
d->sloppyAction = action;
QMenuPrivate::sloppyDelayTimer = startTimer(style()->styleHint(QStyle::SH_Menu_SubMenuPopupDelay, 0, this)*6);
// If the timer is already running then don't start a new one unless the action is the same
if (d->sloppyAction != action && QMenuPrivate::sloppyDelayTimer != 0) {
killTimer(QMenuPrivate::sloppyDelayTimer);
QMenuPrivate::sloppyDelayTimer = 0;
}
if (QMenuPrivate::sloppyDelayTimer == 0) {
d->sloppyAction = action;
QMenuPrivate::sloppyDelayTimer = startTimer(style()->styleHint(QStyle::SH_Menu_SubMenuPopupDelay, 0, this) * 6);
}
} else if (action != d->currentAction) {
d->setCurrentAction(action, style()->styleHint(QStyle::SH_Menu_SubMenuPopupDelay, 0, this));
}

View File

@ -1054,6 +1054,7 @@ void QMenuBar::mousePressEvent(QMouseEvent *e)
if(QMenu *menu = d->activeMenu) {
d->activeMenu = 0;
menu->hide();
d->closePopupMode = 1;
}
} else {
d->setCurrentAction(action, true);

View File

@ -328,6 +328,7 @@ public slots:
QObject *sl11();
const char *sl12();
QList<QString> sl13(QList<QString> l1);
qint64 sl14();
void testSender();
void testReference(QString &str);
@ -395,6 +396,9 @@ const char *QtTestObject::sl12()
{ slotResult = "sl12"; return "foo"; }
QList<QString> QtTestObject::sl13(QList<QString> l1)
{ slotResult = "sl13"; return l1; }
qint64 QtTestObject::sl14()
{ slotResult = "sl14"; return Q_INT64_C(123456789)*123456789; }
void QtTestObject::testReference(QString &str)
{ slotResult = "testReference:" + str; str = "gotcha"; }
@ -513,6 +517,13 @@ void tst_QMetaObject::invokeMetaMember()
QCOMPARE(returnValue, argument);
QCOMPARE(obj.slotResult, QString("sl13"));
// return qint64
qint64 return64;
QVERIFY(QMetaObject::invokeMethod(&obj, "sl14",
Q_RETURN_ARG(qint64, return64)));
QCOMPARE(return64, Q_INT64_C(123456789)*123456789);
QCOMPARE(obj.slotResult, QString("sl14"));
//test signals
QVERIFY(QMetaObject::invokeMethod(&obj, "sig0"));
QCOMPARE(obj.slotResult, QString("sl0"));

View File

@ -103,20 +103,9 @@ public:
static bool compareReplyFtp(QByteArray const& actual)
{
QList<QByteArray> expected;
// A few different vsFTPd versions.
// Feel free to add more as needed
expected << QByteArray( "220 (vsFTPd 2.0.5)\r\n221 Goodbye.\r\n" );
expected << QByteArray( "220 (vsFTPd 2.2.2)\r\n221 Goodbye.\r\n" );
Q_FOREACH (QByteArray const& ba, expected) {
if (ba == actual) {
return true;
}
}
return false;
// output would be e.g. "220 (vsFTPd 2.3.5)\r\n221 Goodbye.\r\n"
QRegExp ftpVersion(QStringLiteral("220 \\(vsFTPd \\d+\\.\\d+.\\d+\\)\\r\\n221 Goodbye.\\r\\n"));
return ftpVersion.exactMatch(actual);
}
static bool hasIPv6()

View File

@ -4389,6 +4389,10 @@ void tst_QNetworkReply::ioPostToHttpFromSocket_data()
void tst_QNetworkReply::ioPostToHttpFromSocket()
{
if (QTest::currentDataTag() == QByteArray("128k+1+proxyauth")
|| QTest::currentDataTag() == QByteArray("128k+1+auth+proxyauth"))
QSKIP("Squid cannot handle authentication with POST data >= 64K (QTBUG-33180)");
QFETCH(QByteArray, data);
QFETCH(QUrl, url);
QFETCH(QNetworkProxy, proxy);

View File

@ -1578,7 +1578,7 @@ void tst_QTcpSocket::recursiveReadyRead()
QSignalSpy spy(testSocket, SIGNAL(readyRead()));
testSocket->connectToHost(QtNetworkSettings::serverName(), 25);
testSocket->connectToHost(QtNetworkSettings::serverName(), 143);
enterLoop(30);
QVERIFY2(!timeout(),
"Timed out when connecting to QtNetworkSettings::serverName().");

View File

@ -221,6 +221,9 @@ private slots:
void scrollBarRanges_data();
void scrollBarRanges();
void acceptMousePressEvent();
void acceptMouseDoubleClickEvent();
void forwardMousePress();
void forwardMouseDoubleClick();
void replayMouseMove();
void itemsUnderMouse();
void embeddedViews();
@ -2832,16 +2835,22 @@ class TestView : public QGraphicsView
{
public:
TestView(QGraphicsScene *scene)
: QGraphicsView(scene), accepted(false)
: QGraphicsView(scene), pressAccepted(false), doubleClickAccepted(false)
{ }
bool accepted;
bool pressAccepted;
bool doubleClickAccepted;
protected:
void mousePressEvent(QMouseEvent *event)
{
QGraphicsView::mousePressEvent(event);
accepted = event->isAccepted();
pressAccepted = event->isAccepted();
}
void mouseDoubleClickEvent(QMouseEvent *event)
{
QGraphicsView::mouseDoubleClickEvent(event);
doubleClickAccepted = event->isAccepted();
}
};
@ -2859,14 +2868,109 @@ void tst_QGraphicsView::acceptMousePressEvent()
Qt::LeftButton, 0, 0);
event.setAccepted(false);
QApplication::sendEvent(view.viewport(), &event);
QVERIFY(!view.accepted);
QVERIFY(!view.pressAccepted);
scene.addRect(0, 0, 2000, 2000)->setFlag(QGraphicsItem::ItemIsMovable);
qApp->processEvents(); // ensure scene rect is updated
QApplication::sendEvent(view.viewport(), &event);
QVERIFY(view.accepted);
QVERIFY(view.pressAccepted);
}
void tst_QGraphicsView::acceptMouseDoubleClickEvent()
{
QGraphicsScene scene;
TestView view(&scene);
view.show();
QVERIFY(QTest::qWaitForWindowExposed(&view));
QMouseEvent event(QEvent::MouseButtonDblClick,
view.viewport()->rect().center(),
view.viewport()->mapToGlobal(view.viewport()->rect().center()),
Qt::LeftButton, 0, 0);
event.setAccepted(false);
QApplication::sendEvent(view.viewport(), &event);
QVERIFY(!view.doubleClickAccepted);
scene.addRect(0, 0, 2000, 2000)->setFlag(QGraphicsItem::ItemIsMovable);
qApp->processEvents(); // ensure scene rect is updated
QApplication::sendEvent(view.viewport(), &event);
QVERIFY(view.doubleClickAccepted);
}
class TestWidget : public QWidget
{
public:
TestWidget()
: QWidget(), pressForwarded(false), doubleClickForwarded(false)
{ }
bool pressForwarded;
bool doubleClickForwarded;
protected:
void mousePressEvent(QMouseEvent *event)
{
QWidget::mousePressEvent(event);
pressForwarded = true;
}
void mouseDoubleClickEvent(QMouseEvent *event)
{
QWidget::mouseDoubleClickEvent(event);
doubleClickForwarded = true;
}
};
void tst_QGraphicsView::forwardMousePress()
{
TestWidget widget;
QGraphicsScene scene;
QGraphicsView view(&scene);
QHBoxLayout layout;
widget.setLayout(&layout);
layout.addWidget(&view);
widget.show();
QVERIFY(QTest::qWaitForWindowExposed(&widget));
widget.pressForwarded = false;
QTest::mouseClick(view.viewport(), Qt::LeftButton);
QVERIFY(widget.pressForwarded);
scene.addRect(0, 0, 2000, 2000);
qApp->processEvents(); // ensure scene rect is updated
widget.pressForwarded = false;
QTest::mouseClick(view.viewport(), Qt::LeftButton);
QVERIFY(widget.pressForwarded);
}
void tst_QGraphicsView::forwardMouseDoubleClick()
{
TestWidget widget;
QGraphicsScene scene;
QGraphicsView view(&scene);
QHBoxLayout layout;
widget.setLayout(&layout);
layout.addWidget(&view);
widget.show();
QVERIFY(QTest::qWaitForWindowExposed(&widget));
widget.doubleClickForwarded = false;
QTest::mouseDClick(view.viewport(), Qt::LeftButton);
QVERIFY(widget.doubleClickForwarded);
scene.addRect(0, 0, 2000, 2000);
qApp->processEvents(); // ensure scene rect is updated
widget.doubleClickForwarded = false;
QTest::mouseDClick(view.viewport(), Qt::LeftButton);
QVERIFY(widget.doubleClickForwarded);
}
void tst_QGraphicsView::replayMouseMove()

View File

@ -52,6 +52,7 @@
#include <qitemdelegate.h>
#include <qscrollbar.h>
#include <private/qcolumnview_p.h>
#include <qscreen.h>
#define ANIMATION_DELAY 300
@ -387,6 +388,12 @@ void tst_QColumnView::scrollTo_data()
QTest::newRow("reverse") << true << false;
}
static inline void centerOnScreen(QWidget *w)
{
const QPoint offset = QPoint(w->width() / 2, w->height() / 2);
w->move(QGuiApplication::primaryScreen()->availableGeometry().center() - offset);
}
void tst_QColumnView::scrollTo()
{
QFETCH(bool, reverse);
@ -397,6 +404,7 @@ void tst_QColumnView::scrollTo()
ColumnView view(&topLevel);
view.resize(200, 200);
topLevel.show();
centerOnScreen(&topLevel);
view.scrollTo(QModelIndex(), QAbstractItemView::EnsureVisible);
QCOMPARE(view.HorizontalOffset(), 0);

View File

@ -164,6 +164,12 @@ static inline void setFrameless(QWidget *w)
w->setWindowFlags(flags);
}
static inline void centerOnScreen(QWidget *w)
{
const QPoint offset = QPoint(w->width() / 2, w->height() / 2);
w->move(QGuiApplication::primaryScreen()->availableGeometry().center() - offset);
}
class tst_QWidget : public QObject
{
Q_OBJECT
@ -4004,7 +4010,8 @@ void tst_QWidget::update()
Q_CHECK_PAINTEVENTS
UpdateWidget w;
w.setGeometry(50, 50, 100, 100);
w.resize(100, 100);
centerOnScreen(&w);
w.show();
QVERIFY(QTest::qWaitForWindowExposed(&w));
@ -7647,6 +7654,7 @@ void tst_QWidget::doubleRepaint()
QSKIP("QTBUG-30566 - Unstable auto-test");
#endif
UpdateWidget widget;
centerOnScreen(&widget);
widget.setFocusPolicy(Qt::StrongFocus);
// Filter out activation change and focus events to avoid update() calls in QWidget.
widget.updateOnActivationChangeAndFocusIn = false;
@ -7774,6 +7782,7 @@ void tst_QWidget::setMaskInResizeEvent()
UpdateWidget w;
w.reset();
w.resize(200, 200);
centerOnScreen(&w);
w.setWindowFlags(Qt::FramelessWindowHint | Qt::WindowStaysOnTopHint);
w.raise();
@ -7851,6 +7860,7 @@ void tst_QWidget::immediateRepaintAfterShow()
QSKIP("We don't support immediate repaint right after show on other platforms.");
UpdateWidget widget;
centerOnScreen(&widget);
widget.show();
qApp->processEvents();
// On X11 in particular, we are now waiting for a MapNotify event before
@ -7867,6 +7877,7 @@ void tst_QWidget::immediateRepaintAfterInvalidateBuffer()
QSKIP("We don't support immediate repaint right after show on other platforms.");
QScopedPointer<UpdateWidget> widget(new UpdateWidget);
centerOnScreen(widget.data());
widget->show();
QVERIFY(QTest::qWaitForWindowExposed(widget.data()));
QTest::qWait(200);
@ -8282,6 +8293,7 @@ void tst_QWidget::setClearAndResizeMask()
{
UpdateWidget topLevel;
topLevel.resize(160, 160);
centerOnScreen(&topLevel);
topLevel.show();
qApp->setActiveWindow(&topLevel);
QVERIFY(QTest::qWaitForWindowActive(&topLevel));
@ -8434,6 +8446,7 @@ void tst_QWidget::maskedUpdate()
{
UpdateWidget topLevel;
topLevel.resize(200, 200);
centerOnScreen(&topLevel);
const QRegion topLevelMask(50, 50, 70, 70);
topLevel.setMask(topLevelMask);
@ -8859,6 +8872,7 @@ void tst_QWidget::focusWidget_task254563()
void tst_QWidget::destroyBackingStore()
{
UpdateWidget w;
centerOnScreen(&w);
w.reset();
w.show();

File diff suppressed because it is too large Load Diff