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

Conflicts:
	config.tests/win/msvc_version.cpp
	configure.pri
	mkspecs/macx-ios-clang/features/default_post.prf
	mkspecs/macx-ios-clang/features/resolve_config.prf
	mkspecs/features/uikit/default_post.prf
	mkspecs/features/uikit/resolve_config.prf
	src/corelib/io/qsettings_mac.cpp
	src/corelib/json/qjsondocument.cpp
	src/plugins/platforms/cocoa/qcocoawindow.h
	src/plugins/platforms/cocoa/qcocoawindow.mm
	src/plugins/platforms/cocoa/qnswindowdelegate.h
	src/plugins/platforms/cocoa/qnswindowdelegate.mm
	src/plugins/platforms/ios/ios.pro
	src/plugins/platforms/ios/kernel.pro
	src/plugins/platforms/ios/qiosintegration.h
	src/plugins/platforms/minimalegl/qminimaleglintegration.cpp
	tests/auto/gui/painting/qpainter/tst_qpainter.cpp
	tools/configure/environment.cpp

Change-Id: I654845e54e40f5951fb78aab349ca667e9f27843
This commit is contained in:
Liang Qi 2016-10-31 20:09:14 +01:00
commit a732576a66
150 changed files with 14094 additions and 11839 deletions

View File

@ -1,6 +1 @@
mingw { # This file exists only to detach the tests from the surroundings.
TMPPATH = $$(INCLUDE)
QMAKE_INCDIR_POST += $$split(TMPPATH, $$QMAKE_DIRLIST_SEP)
TMPPATH = $$(LIB)
QMAKE_LIBDIR_POST += $$split(TMPPATH, $$QMAKE_DIRLIST_SEP)
}

View File

@ -0,0 +1 @@
_MSC_FULL_VER

View File

@ -247,11 +247,12 @@ defineTest(qtConfTest_checkCompiler) {
$${1}.compilerId = "icc" $${1}.compilerId = "icc"
$${1}.compilerVersion = $$replace(version, "icpc version ([0-9.]+).*", "\\1") $${1}.compilerVersion = $$replace(version, "icpc version ([0-9.]+).*", "\\1")
} else: msvc { } else: msvc {
qtRunLoggedCommand("$$QMAKE_CXX /? 2>&1", version)|return(false) command = $$QMAKE_CXX /EP /nologo $$source $$system_quote($$QMAKE_CONFIG_TESTS_DIR/win/msvc_version.cpp)
qtRunLoggedCommand("$$command", version)|return(false)
version = "$$version" version = "$$version"
$${1}.compilerDescription = "MSVC" $${1}.compilerDescription = "MSVC"
$${1}.compilerId = "cl" $${1}.compilerId = "cl"
$${1}.compilerVersion = $$replace(version, "^.*Compiler Version ([0-9.]+) for.*$", "\\1") $${1}.compilerVersion = $$replace(version, "^.*([0-9]{2})([0-9]{2})([0-9]{5}).*$", "\\1.\\2.\\3")
} else { } else {
return(false) return(false)
} }

View File

@ -1,4 +1,4 @@
pre { pre, .LegaleseLeft {
background-color: #f0f0f0; background-color: #f0f0f0;
font-family: Courier, monospace; font-family: Courier, monospace;
font-weight: 600; font-weight: 600;

View File

@ -18,8 +18,12 @@ img {
height: auto; height: auto;
} }
.content { .content .border img {
box-shadow:3px 3px 8px 3px rgba(200,200,200,0.5)
}
.content .border .player {
box-shadow:3px 3px 8px 3px rgba(200,200,200,0.5)
} }
.content .indexboxcont li { .content .indexboxcont li {
@ -424,7 +428,7 @@ table styles
/* table with border alternative colours*/ /* table with border alternative colours*/
table, pre { table, pre, .LegaleseLeft {
-moz-border-radius: 7px 7px 7px 7px; -moz-border-radius: 7px 7px 7px 7px;
-webkit-border-radius: 7px 7px 7px 7px; -webkit-border-radius: 7px 7px 7px 7px;
border-radius: 7px 7px 7px 7px; border-radius: 7px 7px 7px 7px;
@ -481,6 +485,10 @@ table, pre {
margin: 0px margin: 0px
} }
.LegaleseLeft {
font-family: monospace;
white-space: pre-wrap;
}
/* table bodless & white*/ /* table bodless & white*/
.borderless { .borderless {
@ -543,7 +551,7 @@ ol.a > li{
text-align: left text-align: left
} }
.cpp { .cpp, .LegaleseLeft {
display: block; display: block;
margin: 10px; margin: 10px;
overflow: auto; overflow: auto;

View File

@ -1280,6 +1280,12 @@ li a.active {
margin-top:0.75em; margin-top:0.75em;
max-width:100% max-width:100%
} }
.context .border img {
box-shadow:3px 3px 8px 3px rgba(200,200,200,0.5)
}
.context .border .player {
box-shadow:3px 3px 8px 3px rgba(200,200,200,0.5)
}
.context table { .context table {
vertical-align:initial vertical-align:initial
} }
@ -1364,7 +1370,7 @@ div.qt_commercial {
border-top:5px solid #5caa15; border-top:5px solid #5caa15;
margin-bottom:50px margin-bottom:50px
} }
pre { pre, .LegaleseLeft {
background-color:#404244; background-color:#404244;
color:#fff; color:#fff;
display:block; display:block;
@ -1375,6 +1381,10 @@ pre {
padding:25px; padding:25px;
margin-top:0.75em margin-top:0.75em
} }
.mainContent .LegaleseLeft p {
color:#fff;
white-space: pre-wrap
}
.copy_text { .copy_text {
background-color:#46a2da; background-color:#46a2da;
color:#fff; color:#fff;

View File

@ -261,7 +261,7 @@
\snippet widgets/calculator/calculator.cpp 20 \snippet widgets/calculator/calculator.cpp 20
Like in \c additiveOperatorClicked(), we start by handing any Like in \c additiveOperatorClicked(), we start by handling any
pending multiplicative and additive operators. Then we display \c pending multiplicative and additive operators. Then we display \c
sumSoFar and reset the variable to zero. Resetting the variable sumSoFar and reset the variable to zero. Resetting the variable
to zero is necessary to avoid counting the value twice. to zero is necessary to avoid counting the value twice.

View File

@ -55,7 +55,7 @@ while (<STDIN>) {
my $comment = " /* $1 */"; my $comment = " /* $1 */";
while (my $line = <HDR>) { while (my $line = <HDR>) {
# Match a struct or class declaration, but not a forward declaration # Match a struct or class declaration, but not a forward declaration
$line =~ /^(?:struct|class) (?:Q_.*_EXPORT)? (\w+)(?!;)/ or next; $line =~ /^(?:struct|class|namespace) (?:Q_.*_EXPORT)? (\w+)(?!;)/ or next;
print $comment if $comment; print $comment if $comment;
printf " *%d%s*;\n", length $1, $1; printf " *%d%s*;\n", length $1, $1;
$comment = 0; $comment = 0;

View File

@ -1,12 +1,9 @@
defineTest(addExclusiveBuilds) { defineTest(addExclusiveBuildsProper) {
lessThan(ARGC, 2): \ !$$1:!fix_output_dirs: \
error("addExclusiveBuilds() requires at least two arguments")
!$$join(ARGS, _and_):!fix_output_dirs: \
return(true) return(true)
for(build, ARGS) { for(build, 2) {
isEmpty($${build}.name) { isEmpty($${build}.name) {
$${build}.name = $$title($$build) $${build}.name = $$title($$build)
export($${build}.name) export($${build}.name)
@ -20,7 +17,7 @@ defineTest(addExclusiveBuilds) {
export($${build}.dir_affix) export($${build}.dir_affix)
} }
$${build}.exclusive = $$ARGS $${build}.exclusive = $$2
export($${build}.exclusive) export($${build}.exclusive)
QMAKE_EXCLUSIVE_BUILDS += $$build QMAKE_EXCLUSIVE_BUILDS += $$build
@ -33,6 +30,13 @@ defineTest(addExclusiveBuilds) {
return(true) return(true)
} }
defineTest(addExclusiveBuilds) {
lessThan(ARGC, 2): \
error("addExclusiveBuilds() requires at least two arguments")
addExclusiveBuildsProper($$join(ARGS, _and_), $$ARGS)
}
# Default directories to process # Default directories to process
QMAKE_DIR_REPLACE = OBJECTS_DIR MOC_DIR RCC_DIR PRECOMPILED_DIR QGLTF_DIR DESTDIR QMAKE_DIR_REPLACE = OBJECTS_DIR MOC_DIR RCC_DIR PRECOMPILED_DIR QGLTF_DIR DESTDIR
QMAKE_DIR_REPLACE_SANE += QGLTF_DIR QMAKE_DIR_REPLACE_SANE += QGLTF_DIR

View File

@ -1,6 +1,7 @@
# Objective-C/C++ sources go in SOURCES, like all other sources # Objective-C/C++ sources go in SOURCES, like all other sources
SOURCES += $$OBJECTIVE_SOURCES SOURCES += $$OBJECTIVE_SOURCES
unset(OBJECTIVE_SOURCES)
# Strip C/C++ flags from QMAKE_OBJECTIVE_CFLAGS just in case # Strip C/C++ flags from QMAKE_OBJECTIVE_CFLAGS just in case
QMAKE_OBJECTIVE_CFLAGS -= $$QMAKE_CFLAGS $$QMAKE_CXXFLAGS QMAKE_OBJECTIVE_CFLAGS -= $$QMAKE_CFLAGS $$QMAKE_CXXFLAGS
@ -8,3 +9,4 @@ QMAKE_OBJECTIVE_CFLAGS -= $$QMAKE_CFLAGS $$QMAKE_CXXFLAGS
# Add Objective-C/C++ flags to C/C++ flags, the compiler can handle it # Add Objective-C/C++ flags to C/C++ flags, the compiler can handle it
QMAKE_CFLAGS += $$QMAKE_OBJECTIVE_CFLAGS QMAKE_CFLAGS += $$QMAKE_OBJECTIVE_CFLAGS
QMAKE_CXXFLAGS += $$QMAKE_OBJECTIVE_CFLAGS QMAKE_CXXFLAGS += $$QMAKE_OBJECTIVE_CFLAGS
unset(QMAKE_OBJECTIVE_CFLAGS)

View File

@ -79,7 +79,7 @@ moc_source.CONFIG = no_link moc_verify
moc_source.dependency_type = TYPE_C moc_source.dependency_type = TYPE_C
moc_source.commands = ${QMAKE_FUNC_mocCmdBase} ${QMAKE_FILE_IN} -o ${QMAKE_FILE_OUT} moc_source.commands = ${QMAKE_FUNC_mocCmdBase} ${QMAKE_FILE_IN} -o ${QMAKE_FILE_OUT}
moc_source.output = $$MOC_DIR/$${QMAKE_CPP_MOD_MOC}${QMAKE_FILE_BASE}$${QMAKE_EXT_CPP_MOC} moc_source.output = $$MOC_DIR/$${QMAKE_CPP_MOD_MOC}${QMAKE_FILE_BASE}$${QMAKE_EXT_CPP_MOC}
moc_source.input = SOURCES OBJECTIVE_SOURCES moc_source.input = SOURCES
moc_source.name = MOC ${QMAKE_FILE_IN} moc_source.name = MOC ${QMAKE_FILE_IN}
moc_source.depends += $$WIN_INCLUDETEMP $$moc_predefs.output moc_source.depends += $$WIN_INCLUDETEMP $$moc_predefs.output
silent:moc_source.commands = @echo moc ${QMAKE_FILE_IN} && $$moc_source.commands silent:moc_source.commands = @echo moc ${QMAKE_FILE_IN} && $$moc_source.commands

View File

@ -292,7 +292,8 @@ contains(TEMPLATE, .*app) {
autoplugs = autoplugs =
for (qtmod, qt_module_deps) { for (qtmod, qt_module_deps) {
for (ptype, QT.$${qtmod}.plugin_types) { for (ptype, QT.$${qtmod}.plugin_types) {
isEmpty(QTPLUGIN.$$ptype) { nptype = $$replace(ptype, [-/], _)
isEmpty(QTPLUGIN.$$nptype) {
for (plug, QT_PLUGINS) { for (plug, QT_PLUGINS) {
equals(QT_PLUGIN.$${plug}.TYPE, $$ptype) { equals(QT_PLUGIN.$${plug}.TYPE, $$ptype) {
for (dep, QT_PLUGIN.$${plug}.EXTENDS) { for (dep, QT_PLUGIN.$${plug}.EXTENDS) {
@ -305,7 +306,7 @@ contains(TEMPLATE, .*app) {
} }
} }
} else { } else {
plug = $$eval(QTPLUGIN.$$ptype) plug = $$eval(QTPLUGIN.$$nptype)
!equals(plug, -): \ !equals(plug, -): \
autoplugs += $$plug autoplugs += $$plug
} }

View File

@ -101,7 +101,7 @@ defineReplace(qtExportLibsForModule) {
else: \ else: \
module_config = module_config =
!isEmpty(MODULE_PLUGIN_TYPES): \ !isEmpty(MODULE_PLUGIN_TYPES): \
module_plugtypes = "QT.$${MODULE_ID}.plugin_types = $$replace(MODULE_PLUGIN_TYPES, /.*$, )" module_plugtypes = "QT.$${MODULE_ID}.plugin_types = $$replace(MODULE_PLUGIN_TYPES, /[^.]+\\.[^.]+$, )"
else: \ else: \
module_plugtypes = module_plugtypes =
!isEmpty(MODULE_MASTER_HEADER): \ !isEmpty(MODULE_MASTER_HEADER): \

View File

@ -90,3 +90,11 @@ macx-xcode {
QMAKE_PCH_ARCHS = $$VALID_ARCHS QMAKE_PCH_ARCHS = $$VALID_ARCHS
} }
!xcodebuild:equals(TEMPLATE, app):!isEmpty(QMAKE_INFO_PLIST) {
# Only link in photo library support if Info.plist contains
# NSPhotoLibraryUsageDescription. Otherwise it will be rejected from AppStore.
plist_path = $$absolute_path($$QMAKE_INFO_PLIST, $$_PRO_FILE_PWD_)
system("/usr/libexec/PlistBuddy -c 'Print NSPhotoLibraryUsageDescription' $$system_quote($$plist_path) &>/dev/null"): \
QTPLUGIN += qiosnsphotolibrarysupport
}

View File

@ -11,7 +11,7 @@ load(resolve_config)
!macx-xcode:xcodebuild { !macx-xcode:xcodebuild {
# Switch the order to make sure that the first Makefile target is the right one # 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}.*): \ !qtConfig(simulator_and_device):contains(QMAKE_MAC_SDK, ^$${simulator.sdk}.*): \
addExclusiveBuilds(simulator, device) addExclusiveBuildsProper(simulator_and_device, simulator device)
else: \ else: \
addExclusiveBuilds(device, simulator) addExclusiveBuildsProper(simulator_and_device, device simulator)
} }

View File

@ -1813,6 +1813,12 @@
which qmake will replace with the actual executable name. Other variables which qmake will replace with the actual executable name. Other variables
include @ICON@, @TYPEINFO@, @LIBRARY@, and @SHORT_VERSION@. include @ICON@, @TYPEINFO@, @LIBRARY@, and @SHORT_VERSION@.
If building for iOS, and the \c{.plist} file contains the key
\c NSPhotoLibraryUsageDescription, qmake will include an additional plugin
to the build that adds photo access support (to, e.g.,
\l{QFileDialog::setDirectory()}{QFile/QFileDialog}). See Info.plist
documentation from Apple for more information regarding this key.
\note Most of the time, the default \c{Info.plist} is good enough. \note Most of the time, the default \c{Info.plist} is good enough.
\section1 QMAKE_LFLAGS \section1 QMAKE_LFLAGS

View File

@ -46,6 +46,7 @@
#include <fcntl.h> #include <fcntl.h>
#include <sys/types.h> #include <sys/types.h>
#include <sys/stat.h> #include <sys/stat.h>
#include <limits.h>
#if defined(_MSC_VER) && _MSC_VER >= 1400 #if defined(_MSC_VER) && _MSC_VER >= 1400
#include <share.h> #include <share.h>
#endif #endif
@ -986,9 +987,11 @@ bool QMakeSourceFileInfo::findMocs(SourceFile *file)
continue; continue;
int matchlen = 0, extralines = 0; int matchlen = 0, extralines = 0;
size_t needle_len = strlen(interesting[interest]);
Q_ASSERT(needle_len <= INT_MAX);
if (matchWhileUnsplitting(buffer, buffer_len, y, if (matchWhileUnsplitting(buffer, buffer_len, y,
interesting[interest], interesting[interest],
strlen(interesting[interest]), static_cast<int>(needle_len),
&matchlen, &extralines) &matchlen, &extralines)
&& y + matchlen < buffer_len && y + matchlen < buffer_len
&& !isCWordChar(buffer[y + matchlen])) { && !isCWordChar(buffer[y + matchlen])) {

View File

@ -374,14 +374,21 @@ void NmakeMakefileGenerator::init()
project->values("QMAKE_DISTCLEAN").append(tgt + ".lib"); project->values("QMAKE_DISTCLEAN").append(tgt + ".lib");
} }
if (project->isActiveConfig("debug_info")) { if (project->isActiveConfig("debug_info")) {
// Add the compiler's PDB file. QString pdbfile;
QString pdbfile = var("OBJECTS_DIR") + project->first("TARGET") + ".vc.pdb"; QString distPdbFile = tgt + ".pdb";
if (project->isActiveConfig("staticlib")) {
// For static libraries, the compiler's pdb file and the dist pdb file are the same.
pdbfile = distPdbFile;
} else {
// Use $${TARGET}.vc.pdb in the OBJECTS_DIR for the compiler and
// $${TARGET}.pdb (the default) for the linker.
pdbfile = var("OBJECTS_DIR") + project->first("TARGET") + ".vc.pdb";
}
QString escapedPdbFile = escapeFilePath(pdbfile); QString escapedPdbFile = escapeFilePath(pdbfile);
project->values("QMAKE_CFLAGS").append("/Fd" + escapedPdbFile); project->values("QMAKE_CFLAGS").append("/Fd" + escapedPdbFile);
project->values("QMAKE_CXXFLAGS").append("/Fd" + escapedPdbFile); project->values("QMAKE_CXXFLAGS").append("/Fd" + escapedPdbFile);
project->values("QMAKE_CLEAN").append(pdbfile); project->values("QMAKE_CLEAN").append(pdbfile);
// Add the linker's PDB file to the distclean target. project->values("QMAKE_DISTCLEAN").append(distPdbFile);
project->values("QMAKE_DISTCLEAN").append(tgt + ".pdb");
} }
if (project->isActiveConfig("debug")) { if (project->isActiveConfig("debug")) {
project->values("QMAKE_CLEAN").append(tgt + ".ilk"); project->values("QMAKE_CLEAN").append(tgt + ".ilk");

View File

@ -156,12 +156,14 @@ static inline void positionCluster(HB_ShaperItem *item, int gfrom, int glast)
// ### wrong in rtl context! // ### wrong in rtl context!
case HB_Combining_BelowLeft: case HB_Combining_BelowLeft:
p.y += offset; p.y += offset;
// fall through
case HB_Combining_BelowLeftAttached: case HB_Combining_BelowLeftAttached:
p.x += attachmentRect.x - markMetrics.x; p.x += attachmentRect.x - markMetrics.x;
p.y += (attachmentRect.y + attachmentRect.height) - markMetrics.y; p.y += (attachmentRect.y + attachmentRect.height) - markMetrics.y;
break; break;
case HB_Combining_Below: case HB_Combining_Below:
p.y += offset; p.y += offset;
// fall through
case HB_Combining_BelowAttached: case HB_Combining_BelowAttached:
p.x += attachmentRect.x - markMetrics.x; p.x += attachmentRect.x - markMetrics.x;
p.y += (attachmentRect.y + attachmentRect.height) - markMetrics.y; p.y += (attachmentRect.y + attachmentRect.height) - markMetrics.y;
@ -170,28 +172,33 @@ static inline void positionCluster(HB_ShaperItem *item, int gfrom, int glast)
break; break;
case HB_Combining_BelowRight: case HB_Combining_BelowRight:
p.y += offset; p.y += offset;
// fall through
case HB_Combining_BelowRightAttached: case HB_Combining_BelowRightAttached:
p.x += attachmentRect.x + attachmentRect.width - markMetrics.width - markMetrics.x; p.x += attachmentRect.x + attachmentRect.width - markMetrics.width - markMetrics.x;
p.y += attachmentRect.y + attachmentRect.height - markMetrics.y; p.y += attachmentRect.y + attachmentRect.height - markMetrics.y;
break; break;
case HB_Combining_Left: case HB_Combining_Left:
p.x -= offset; p.x -= offset;
// fall through
case HB_Combining_LeftAttached: case HB_Combining_LeftAttached:
break; break;
case HB_Combining_Right: case HB_Combining_Right:
p.x += offset; p.x += offset;
// fall through
case HB_Combining_RightAttached: case HB_Combining_RightAttached:
break; break;
case HB_Combining_DoubleAbove: case HB_Combining_DoubleAbove:
// ### wrong in RTL context! // ### wrong in RTL context!
case HB_Combining_AboveLeft: case HB_Combining_AboveLeft:
p.y -= offset; p.y -= offset;
// fall through
case HB_Combining_AboveLeftAttached: case HB_Combining_AboveLeftAttached:
p.x += attachmentRect.x - markMetrics.x; p.x += attachmentRect.x - markMetrics.x;
p.y += attachmentRect.y - markMetrics.y - markMetrics.height; p.y += attachmentRect.y - markMetrics.y - markMetrics.height;
break; break;
case HB_Combining_Above: case HB_Combining_Above:
p.y -= offset; p.y -= offset;
// fall through
case HB_Combining_AboveAttached: case HB_Combining_AboveAttached:
p.x += attachmentRect.x - markMetrics.x; p.x += attachmentRect.x - markMetrics.x;
p.y += attachmentRect.y - markMetrics.y - markMetrics.height; p.y += attachmentRect.y - markMetrics.y - markMetrics.height;
@ -200,6 +207,7 @@ static inline void positionCluster(HB_ShaperItem *item, int gfrom, int glast)
break; break;
case HB_Combining_AboveRight: case HB_Combining_AboveRight:
p.y -= offset; p.y -= offset;
// fall through
case HB_Combining_AboveRightAttached: case HB_Combining_AboveRightAttached:
p.x += attachmentRect.x + attachmentRect.width - markMetrics.x - markMetrics.width; p.x += attachmentRect.x + attachmentRect.width - markMetrics.x - markMetrics.width;
p.y += attachmentRect.y - markMetrics.y - markMetrics.height; p.y += attachmentRect.y - markMetrics.y - markMetrics.height;

View File

@ -66,7 +66,7 @@ public class QtActivityLoader extends QtLoader {
@Override @Override
public void onClick(DialogInterface dialogInterface, int i) { public void onClick(DialogInterface dialogInterface, int i) {
try { try {
Uri uri = Uri.parse("market://search?q=pname:org.kde.necessitas.ministro"); Uri uri = Uri.parse("market://details?id=org.kde.necessitas.ministro");
Intent intent = new Intent(Intent.ACTION_VIEW, uri); Intent intent = new Intent(Intent.ACTION_VIEW, uri);
m_activity.startActivityForResult(intent, MINISTRO_INSTALL_REQUEST_CODE); m_activity.startActivityForResult(intent, MINISTRO_INSTALL_REQUEST_CODE);
} catch (Exception e) { } catch (Exception e) {

View File

@ -73,7 +73,7 @@ public abstract class QtLoader {
public final static int MINISTRO_INSTALL_REQUEST_CODE = 0xf3ee; // request code used to know when Ministro instalation is finished public final static int MINISTRO_INSTALL_REQUEST_CODE = 0xf3ee; // request code used to know when Ministro instalation is finished
public static final int MINISTRO_API_LEVEL = 5; // Ministro api level (check IMinistro.aidl file) public static final int MINISTRO_API_LEVEL = 5; // Ministro api level (check IMinistro.aidl file)
public static final int NECESSITAS_API_LEVEL = 2; // Necessitas api level used by platform plugin public static final int NECESSITAS_API_LEVEL = 2; // Necessitas api level used by platform plugin
public static final int QT_VERSION = 0x050100; // This app requires at least Qt version 5.1.0 public static final int QT_VERSION = 0x050700; // This app requires at least Qt version 5.7.0
public static final String ERROR_CODE_KEY = "error.code"; public static final String ERROR_CODE_KEY = "error.code";
public static final String ERROR_MESSAGE_KEY = "error.message"; public static final String ERROR_MESSAGE_KEY = "error.message";

View File

@ -113,9 +113,9 @@ QSet<QString> dictionary = QtConcurrent::blockingFilteredReduced(strings, allLow
//! [7] //! [7]
// keep only images with an alpha channel // keep only images with an alpha channel
QList<QImage> images = ...; QList<QImage> images = ...;
QFuture<void> alphaImages = QtConcurrent::filter(strings, &QImage::hasAlphaChannel); QFuture<void> alphaImages = QtConcurrent::filter(images, &QImage::hasAlphaChannel);
// keep only gray scale images // retrieve gray scale images
QList<QImage> images = ...; QList<QImage> images = ...;
QFuture<QImage> grayscaleImages = QtConcurrent::filtered(images, &QImage::isGrayscale); QFuture<QImage> grayscaleImages = QtConcurrent::filtered(images, &QImage::isGrayscale);

View File

@ -158,11 +158,8 @@
\endtable \endtable
Containers can be nested. For example, it is perfectly possible Containers can be nested. For example, it is perfectly possible
to use a QMap<QString, QList<int> >, where the key type is to use a QMap<QString, QList<int>>, where the key type is
QString and the value type QList<int>. The only pitfall is that QString and the value type QList<int>.
you must insert a space between the closing angle brackets (>);
otherwise the C++ compiler will misinterpret the two >'s as a
right-shift operator (>>) and report a syntax error.
The containers are defined in individual header files with the The containers are defined in individual header files with the
same name as the container (e.g., \c <QLinkedList>). For same name as the container (e.g., \c <QLinkedList>). For

View File

@ -80,7 +80,7 @@
\section1 Event Types \section1 Event Types
Most events types have special classes, notably QResizeEvent, Most event types have special classes, notably QResizeEvent,
QPaintEvent, QMouseEvent, QKeyEvent, and QCloseEvent. Each class QPaintEvent, QMouseEvent, QKeyEvent, and QCloseEvent. Each class
subclasses QEvent and adds event-specific functions. For example, subclasses QEvent and adds event-specific functions. For example,
QResizeEvent adds \l{QResizeEvent::}{size()} and QResizeEvent adds \l{QResizeEvent::}{size()} and

View File

@ -4251,8 +4251,10 @@ bool QInternal::activateCallbacks(Callback cb, void **parameters)
Compares the floating point value \a p1 and \a p2 and Compares the floating point value \a p1 and \a p2 and
returns \c true if they are considered equal, otherwise \c false. returns \c true if they are considered equal, otherwise \c false.
Note that comparing values where either \a p1 or \a p2 is 0.0 will not work. Note that comparing values where either \a p1 or \a p2 is 0.0 will not work,
The solution to this is to compare against values greater than or equal to 1.0. nor does comparing values where one of the values is NaN or infinity.
If one of the values is always 0.0, use qFuzzyIsNull instead. If one of the
values is likely to be 0.0, one solution is to add 1.0 to both values.
\snippet code/src_corelib_global_qglobal.cpp 46 \snippet code/src_corelib_global_qglobal.cpp 46

View File

@ -60,7 +60,7 @@ QT_BEGIN_NAMESPACE
* There will only be one copy of the section in the output library or application. * There will only be one copy of the section in the output library or application.
*/ */
#if defined(QT_BUILD_CORE_LIB) || defined(QT_BOOTSTRAPPED) || defined(QT_NO_VERSION_TAGGING) #if defined(QT_BUILD_CORE_LIB) || defined(QT_BOOTSTRAPPED) || defined(QT_NO_VERSION_TAGGING) || defined(QT_STATIC)
// don't make tags in QtCore, bootstrapped systems or if the user asked not to // don't make tags in QtCore, bootstrapped systems or if the user asked not to
#elif defined(Q_CC_GNU) && !defined(Q_OS_ANDROID) #elif defined(Q_CC_GNU) && !defined(Q_OS_ANDROID)
# if defined(Q_PROCESSOR_X86) && (defined(Q_OS_LINUX) || defined(Q_OS_FREEBSD_KERNEL)) # if defined(Q_PROCESSOR_X86) && (defined(Q_OS_LINUX) || defined(Q_OS_FREEBSD_KERNEL))

View File

@ -293,8 +293,7 @@ QDateTime &QFileInfoPrivate::getFileTime(QAbstractFileEngine::FileTime request)
\note To speed up performance, QFileInfo caches information about \note To speed up performance, QFileInfo caches information about
the file. the file.
To speed up performance, QFileInfo caches information about the Because files can be changed by other users or programs, or
file. Because files can be changed by other users or programs, or
even by other parts of the same program, there is a function that even by other parts of the same program, there is a function that
refreshes the file information: refresh(). If you want to switch refreshes the file information: refresh(). If you want to switch
off a QFileInfo's caching and force it to access the file system off a QFileInfo's caching and force it to access the file system

View File

@ -283,7 +283,7 @@ QFileSystemEntry QFileSystemEngine::canonicalName(const QFileSystemEntry &entry,
if (ret) { if (ret) {
data.knownFlagsMask |= QFileSystemMetaData::ExistsAttribute; data.knownFlagsMask |= QFileSystemMetaData::ExistsAttribute;
data.entryFlags |= QFileSystemMetaData::ExistsAttribute; data.entryFlags |= QFileSystemMetaData::ExistsAttribute;
QString canonicalPath = QDir::cleanPath(QString::fromLocal8Bit(ret)); QString canonicalPath = QDir::cleanPath(QFile::decodeName(ret));
free(ret); free(ret);
return QFileSystemEntry(canonicalPath); return QFileSystemEntry(canonicalPath);
} else if (errno == ENOENT) { // file doesn't exist } else if (errno == ENOENT) { // file doesn't exist

View File

@ -343,7 +343,7 @@ QStringList QFseventsFileSystemWatcherEngine::addPaths(const QStringList &paths,
QStringList p = paths; QStringList p = paths;
QMutableListIterator<QString> it(p); QMutableListIterator<QString> it(p);
while (it.hasNext()) { while (it.hasNext()) {
QString origPath = it.next(); QString origPath = it.next().normalized(QString::NormalizationForm_C);
QString realPath = origPath; QString realPath = origPath;
if (realPath.endsWith(QDir::separator())) if (realPath.endsWith(QDir::separator()))
realPath = realPath.mid(0, realPath.size() - 1); realPath = realPath.mid(0, realPath.size() - 1);

View File

@ -382,11 +382,11 @@ qint64 QFSFileEnginePrivate::nativeWrite(const char *data, qint64 len)
// Writing on Windows fails with ERROR_NO_SYSTEM_RESOURCES when // Writing on Windows fails with ERROR_NO_SYSTEM_RESOURCES when
// the chunks are too large, so we limit the block size to 32MB. // the chunks are too large, so we limit the block size to 32MB.
const DWORD blockSize = DWORD(qMin(bytesToWrite, qint64(32 * 1024 * 1024)));
qint64 totalWritten = 0; qint64 totalWritten = 0;
do { do {
const DWORD currentBlockSize = DWORD(qMin(bytesToWrite, qint64(32 * 1024 * 1024)));
DWORD bytesWritten; DWORD bytesWritten;
if (!WriteFile(fileHandle, data + totalWritten, blockSize, &bytesWritten, NULL)) { if (!WriteFile(fileHandle, data + totalWritten, currentBlockSize, &bytesWritten, NULL)) {
if (totalWritten == 0) { if (totalWritten == 0) {
// Note: Only return error if the first WriteFile failed. // Note: Only return error if the first WriteFile failed.
q->setError(QFile::WriteError, qt_error_string()); q->setError(QFile::WriteError, qt_error_string());

View File

@ -274,7 +274,6 @@ static QVariant qtValue(CFPropertyListRef cfvalue)
const QString str = QString::fromUtf8(byteArray.constData(), byteArray.size()); const QString str = QString::fromUtf8(byteArray.constData(), byteArray.size());
return QSettingsPrivate::stringToVariant(str); return QSettingsPrivate::stringToVariant(str);
} else if (typeId == CFDictionaryGetTypeID()) { } else if (typeId == CFDictionaryGetTypeID()) {
CFDictionaryRef cfdict = static_cast<CFDictionaryRef>(cfvalue); CFDictionaryRef cfdict = static_cast<CFDictionaryRef>(cfvalue);
CFTypeID arrayTypeId = CFArrayGetTypeID(); CFTypeID arrayTypeId = CFArrayGetTypeID();

View File

@ -155,7 +155,7 @@
dealing with URLs and strings: dealing with URLs and strings:
\list \list
\li When creating an QString to contain a URL from a QByteArray or a \li When creating a QString to contain a URL from a QByteArray or a
char*, always use QString::fromUtf8(). char*, always use QString::fromUtf8().
\endlist \endlist
*/ */

File diff suppressed because it is too large Load Diff

View File

@ -9,8 +9,8 @@ Those arrays in qurltlds_p.h are derived from the Public
Suffix List ([2]), which was originally provided by Suffix List ([2]), which was originally provided by
Jo Hermans <jo.hermans@gmail.com>. Jo Hermans <jo.hermans@gmail.com>.
The file qurltlds_p.h was last generated Wednesday, The file qurltlds_p.h was last generated Thursday,
February 11th 14:36 2015. October 20th 8:40 2016.
---- ----
[1] list: http://mxr.mozilla.org/mozilla-central/source/netwerk/dns/effective_tld_names.dat?raw=1 [1] list: http://mxr.mozilla.org/mozilla-central/source/netwerk/dns/effective_tld_names.dat?raw=1

View File

@ -260,8 +260,7 @@ QJsonDocument QJsonDocument::fromBinaryData(const QByteArray &data, DataValidati
Creates a QJsonDocument from the QVariant \a variant. Creates a QJsonDocument from the QVariant \a variant.
If the \a variant contains any other type than a QVariantMap, If the \a variant contains any other type than a QVariantMap,
QVariantHash, QVariantList or QStringList, the returned document QVariantHash, QVariantList or QStringList, the returned document is invalid.
document is invalid.
\sa toVariant() \sa toVariant()
*/ */

View File

@ -1004,7 +1004,7 @@ bool QCoreApplication::notifyInternal2(QObject *receiver, QEvent *event)
approaches are listed below: approaches are listed below:
\list 1 \list 1
\li Reimplementing \l {QWidget::}{paintEvent()}, \l {QWidget::}{mousePressEvent()} and so \li Reimplementing \l {QWidget::}{paintEvent()}, \l {QWidget::}{mousePressEvent()} and so
on. This is the commonest, easiest, and least powerful way. on. This is the most common, easiest, and least powerful way.
\li Reimplementing this function. This is very powerful, providing \li Reimplementing this function. This is very powerful, providing
complete control; but only one subclass can be active at a time. complete control; but only one subclass can be active at a time.

View File

@ -712,6 +712,10 @@ QMimeXMLProvider::QMimeXMLProvider(QMimeDatabasePrivate *db)
initResources(); initResources();
} }
QMimeXMLProvider::~QMimeXMLProvider()
{
}
bool QMimeXMLProvider::isValid() bool QMimeXMLProvider::isValid()
{ {
return true; return true;

View File

@ -138,6 +138,7 @@ class QMimeXMLProvider : public QMimeProviderBase
{ {
public: public:
QMimeXMLProvider(QMimeDatabasePrivate *db); QMimeXMLProvider(QMimeDatabasePrivate *db);
~QMimeXMLProvider();
virtual bool isValid() Q_DECL_OVERRIDE; virtual bool isValid() Q_DECL_OVERRIDE;
virtual QMimeType mimeTypeForName(const QString &name) Q_DECL_OVERRIDE; virtual QMimeType mimeTypeForName(const QString &name) Q_DECL_OVERRIDE;

View File

@ -89,8 +89,8 @@ public:
void unlock() void unlock()
{ {
if (locked) { if (locked) {
if (mtx1) mtx1->unlock();
if (mtx2) mtx2->unlock(); if (mtx2) mtx2->unlock();
if (mtx1) mtx1->unlock();
locked = false; locked = false;
} }
} }
@ -100,7 +100,7 @@ public:
// mtx1 is already locked, mtx2 not... do we need to unlock and relock? // mtx1 is already locked, mtx2 not... do we need to unlock and relock?
if (mtx1 == mtx2) if (mtx1 == mtx2)
return false; return false;
if (mtx1 < mtx2) { if (std::less<QMutex *>()(mtx1, mtx2)) {
mtx2->lock(); mtx2->lock();
return true; return true;
} }

View File

@ -1646,9 +1646,11 @@ QString QTime::toString(Qt::DateFormat format) const
\row \li z \li the milliseconds without leading zeroes (0 to 999) \row \li z \li the milliseconds without leading zeroes (0 to 999)
\row \li zzz \li the milliseconds with leading zeroes (000 to 999) \row \li zzz \li the milliseconds with leading zeroes (000 to 999)
\row \li AP or A \row \li AP or A
\li use AM/PM display. \e A/AP will be replaced by either "AM" or "PM". \li use AM/PM display. \e A/AP will be replaced by either
QLocale::amText() or QLocale::pmText().
\row \li ap or a \row \li ap or a
\li use am/pm display. \e a/ap will be replaced by either "am" or "pm". \li use am/pm display. \e a/ap will be replaced by a lower-case version of
QLocale::amText() or QLocale::pmText().
\row \li t \li the timezone (for example "CEST") \row \li t \li the timezone (for example "CEST")
\endtable \endtable
@ -1657,7 +1659,8 @@ QString QTime::toString(Qt::DateFormat format) const
expression. Two consecutive single quotes ("''") are replaced by a singlequote expression. Two consecutive single quotes ("''") are replaced by a singlequote
in the output. Formats without separators (e.g. "HHmm") are currently not supported. in the output. Formats without separators (e.g. "HHmm") are currently not supported.
Example format strings (assuming that the QTime is 14:13:09.042) Example format strings (assuming that the QTime is 14:13:09.042 and the system
locale is \c{en_US})
\table \table
\header \li Format \li Result \header \li Format \li Result

View File

@ -548,7 +548,7 @@ QT_BEGIN_NAMESPACE
\inmodule QtCore \inmodule QtCore
\reentrant \reentrant
\brief The QRegularExpressionMatch class provides the results of a matching \brief The QRegularExpressionMatch class provides the results of matching
a QRegularExpression against a string. a QRegularExpression against a string.
\since 5.0 \since 5.0

View File

@ -494,48 +494,46 @@ static int ucstrncmp(const QChar *a, const QChar *b, int l)
if (!l) if (!l)
return 0; return 0;
union {
const QChar *w;
const quint32 *d;
quintptr value;
} sa, sb;
sa.w = a;
sb.w = b;
// check alignment // check alignment
if ((sa.value & 2) == (sb.value & 2)) { if ((reinterpret_cast<quintptr>(a) & 2) == (reinterpret_cast<quintptr>(b) & 2)) {
// both addresses have the same alignment // both addresses have the same alignment
if (sa.value & 2) { if (reinterpret_cast<quintptr>(a) & 2) {
// both addresses are not aligned to 4-bytes boundaries // both addresses are not aligned to 4-bytes boundaries
// compare the first character // compare the first character
if (*sa.w != *sb.w) if (*a != *b)
return sa.w->unicode() - sb.w->unicode(); return a->unicode() - b->unicode();
--l; --l;
++sa.w; ++a;
++sb.w; ++b;
// now both addresses are 4-bytes aligned // now both addresses are 4-bytes aligned
} }
// both addresses are 4-bytes aligned // both addresses are 4-bytes aligned
// do a fast 32-bit comparison // do a fast 32-bit comparison
const quint32 *e = sa.d + (l >> 1); const quint32 *da = reinterpret_cast<const quint32 *>(a);
for ( ; sa.d != e; ++sa.d, ++sb.d) { const quint32 *db = reinterpret_cast<const quint32 *>(b);
if (*sa.d != *sb.d) { const quint32 *e = da + (l >> 1);
if (*sa.w != *sb.w) for ( ; da != e; ++da, ++db) {
return sa.w->unicode() - sb.w->unicode(); if (*da != *db) {
return sa.w[1].unicode() - sb.w[1].unicode(); a = reinterpret_cast<const QChar *>(da);
b = reinterpret_cast<const QChar *>(db);
if (*a != *b)
return a->unicode() - b->unicode();
return a[1].unicode() - b[1].unicode();
} }
} }
// do we have a tail? // do we have a tail?
return (l & 1) ? sa.w->unicode() - sb.w->unicode() : 0; a = reinterpret_cast<const QChar *>(da);
b = reinterpret_cast<const QChar *>(db);
return (l & 1) ? a->unicode() - b->unicode() : 0;
} else { } else {
// one of the addresses isn't 4-byte aligned but the other is // one of the addresses isn't 4-byte aligned but the other is
const QChar *e = sa.w + l; const QChar *e = a + l;
for ( ; sa.w != e; ++sa.w, ++sb.w) { for ( ; a != e; ++a, ++b) {
if (*sa.w != *sb.w) if (*a != *b)
return sa.w->unicode() - sb.w->unicode(); return a->unicode() - b->unicode();
} }
} }
return 0; return 0;

View File

@ -761,18 +761,25 @@ QDBusMessage QDBusAbstractInterface::call(QDBus::CallMode mode, const QString &m
switch (count) { switch (count) {
case 8: case 8:
argList.prepend(arg8); argList.prepend(arg8);
// fall through
case 7: case 7:
argList.prepend(arg7); argList.prepend(arg7);
// fall through
case 6: case 6:
argList.prepend(arg6); argList.prepend(arg6);
// fall through
case 5: case 5:
argList.prepend(arg5); argList.prepend(arg5);
// fall through
case 4: case 4:
argList.prepend(arg4); argList.prepend(arg4);
// fall through
case 3: case 3:
argList.prepend(arg3); argList.prepend(arg3);
// fall through
case 2: case 2:
argList.prepend(arg2); argList.prepend(arg2);
// fall through
case 1: case 1:
argList.prepend(arg1); argList.prepend(arg1);
} }
@ -819,18 +826,25 @@ QDBusPendingCall QDBusAbstractInterface::asyncCall(const QString &method, const
switch (count) { switch (count) {
case 8: case 8:
argList.prepend(arg8); argList.prepend(arg8);
// fall through
case 7: case 7:
argList.prepend(arg7); argList.prepend(arg7);
// fall through
case 6: case 6:
argList.prepend(arg6); argList.prepend(arg6);
// fall through
case 5: case 5:
argList.prepend(arg5); argList.prepend(arg5);
// fall through
case 4: case 4:
argList.prepend(arg4); argList.prepend(arg4);
// fall through
case 3: case 3:
argList.prepend(arg3); argList.prepend(arg3);
// fall through
case 2: case 2:
argList.prepend(arg2); argList.prepend(arg2);
// fall through
case 1: case 1:
argList.prepend(arg1); argList.prepend(arg1);
} }

View File

@ -110,7 +110,7 @@ QDBusServer::~QDBusServer()
QDBusConnectionManager::instance()->removeConnection(name); QDBusConnectionManager::instance()->removeConnection(name);
d->serverConnectionNames.clear(); d->serverConnectionNames.clear();
} }
d->serverObject = nullptr; d->serverObject = Q_NULLPTR;
d->ref.store(0); d->ref.store(0);
d->deleteLater(); d->deleteLater();
} }

View File

@ -9,6 +9,7 @@ QMAKE_DOCS = $$PWD/doc/qtgui.qdocconf
MODULE_PLUGIN_TYPES = \ MODULE_PLUGIN_TYPES = \
platforms \ platforms \
platforms/darwin \
xcbglintegrations \ xcbglintegrations \
platformthemes \ platformthemes \
platforminputcontexts \ platforminputcontexts \

View File

@ -95,7 +95,6 @@ public:
QIcon::State state) = 0; QIcon::State state) = 0;
QString filename; QString filename;
QIconDirInfo dir; QIconDirInfo dir;
static int count;
}; };
struct ScalableEntry : public QIconLoaderEngineEntry struct ScalableEntry : public QIconLoaderEngineEntry
@ -124,18 +123,18 @@ public:
QIconLoaderEngine(const QString& iconName = QString()); QIconLoaderEngine(const QString& iconName = QString());
~QIconLoaderEngine(); ~QIconLoaderEngine();
void paint(QPainter *painter, const QRect &rect, QIcon::Mode mode, QIcon::State state); void paint(QPainter *painter, const QRect &rect, QIcon::Mode mode, QIcon::State state) Q_DECL_OVERRIDE;
QPixmap pixmap(const QSize &size, QIcon::Mode mode, QIcon::State state); QPixmap pixmap(const QSize &size, QIcon::Mode mode, QIcon::State state) Q_DECL_OVERRIDE;
QSize actualSize(const QSize &size, QIcon::Mode mode, QIcon::State state); QSize actualSize(const QSize &size, QIcon::Mode mode, QIcon::State state) Q_DECL_OVERRIDE;
QIconEngine *clone() const; QIconEngine *clone() const Q_DECL_OVERRIDE;
bool read(QDataStream &in); bool read(QDataStream &in) Q_DECL_OVERRIDE;
bool write(QDataStream &out) const; bool write(QDataStream &out) const Q_DECL_OVERRIDE;
private: private:
QString key() const; QString key() const Q_DECL_OVERRIDE;
bool hasIcon() const; bool hasIcon() const;
void ensureLoaded(); void ensureLoaded();
void virtual_hook(int id, void *data); void virtual_hook(int id, void *data) Q_DECL_OVERRIDE;
QIconLoaderEngineEntry *entryForSize(const QSize &size); QIconLoaderEngineEntry *entryForSize(const QSize &size);
QIconLoaderEngine(const QIconLoaderEngine &other); QIconLoaderEngine(const QIconLoaderEngine &other);
QThemeIconInfo m_info; QThemeIconInfo m_info;

View File

@ -5062,7 +5062,7 @@ static Q_CONSTEXPR QPixelFormat pixelformats[] = {
/*ALPHA USAGE*/ QPixelFormat::IgnoresAlpha, /*ALPHA USAGE*/ QPixelFormat::IgnoresAlpha,
/*ALPHA POSITION*/ QPixelFormat::AtBeginning, /*ALPHA POSITION*/ QPixelFormat::AtBeginning,
/*PREMULTIPLIED*/ QPixelFormat::NotPremultiplied, /*PREMULTIPLIED*/ QPixelFormat::NotPremultiplied,
/*INTERPRETATION*/ QPixelFormat::UnsignedInteger, /*INTERPRETATION*/ QPixelFormat::UnsignedByte,
/*BYTE ORDER*/ QPixelFormat::CurrentSystemEndian), /*BYTE ORDER*/ QPixelFormat::CurrentSystemEndian),
//QImage::Format_RGB444: //QImage::Format_RGB444:
QPixelFormat(QPixelFormat::RGB, QPixelFormat(QPixelFormat::RGB,

View File

@ -930,12 +930,12 @@ static bool convert_indexed8_to_RGB16_inplace(QImageData *data, Qt::ImageConvers
const int dest_pad = (dst_bytes_per_line >> 1) - width; const int dest_pad = (dst_bytes_per_line >> 1) - width;
quint16 colorTableRGB16[256]; quint16 colorTableRGB16[256];
if (data->colortable.isEmpty()) { const int tableSize = data->colortable.size();
if (tableSize == 0) {
for (int i = 0; i < 256; ++i) for (int i = 0; i < 256; ++i)
colorTableRGB16[i] = qConvertRgb32To16(qRgb(i, i, i)); colorTableRGB16[i] = qConvertRgb32To16(qRgb(i, i, i));
} else { } else {
// 1) convert the existing colors to RGB16 // 1) convert the existing colors to RGB16
const int tableSize = data->colortable.size();
for (int i = 0; i < tableSize; ++i) for (int i = 0; i < tableSize; ++i)
colorTableRGB16[i] = qConvertRgb32To16(data->colortable.at(i)); colorTableRGB16[i] = qConvertRgb32To16(data->colortable.at(i));
data->colortable = QVector<QRgb>(); data->colortable = QVector<QRgb>();

View File

@ -425,8 +425,9 @@ void QClipboard::setPixmap(const QPixmap &pixmap, Mode mode)
/*! /*!
\fn QMimeData *QClipboard::mimeData(Mode mode) const \fn QMimeData *QClipboard::mimeData(Mode mode) const
Returns a reference to a QMimeData representation of the current Returns a pointer to a QMimeData representation of the current
clipboard data. clipboard data (can be NULL if the given \a mode is not
supported by the platform).
The \a mode argument is used to control which part of the system The \a mode argument is used to control which part of the system
clipboard is used. If \a mode is QClipboard::Clipboard, the clipboard is used. If \a mode is QClipboard::Clipboard, the

View File

@ -350,6 +350,16 @@ void QWindowGeometrySpecification::applyTo(QWindow *window) const
static QWindowGeometrySpecification windowGeometrySpecification = Q_WINDOW_GEOMETRY_SPECIFICATION_INITIALIZER; static QWindowGeometrySpecification windowGeometrySpecification = Q_WINDOW_GEOMETRY_SPECIFICATION_INITIALIZER;
/*!
\macro qGuiApp
\relates QGuiApplication
A global pointer referring to the unique application object.
Only valid for use when that object is a QGuiApplication.
\sa QCoreApplication::instance(), qApp
*/
/*! /*!
\class QGuiApplication \class QGuiApplication
\brief The QGuiApplication class manages the GUI application's control \brief The QGuiApplication class manages the GUI application's control

View File

@ -342,6 +342,10 @@ void QPlatformScreen::resizeMaximizedWindows()
for (int i = 0; i < windows.size(); ++i) { for (int i = 0; i < windows.size(); ++i) {
QWindow *w = windows.at(i); QWindow *w = windows.at(i);
// Skip non-platform windows, e.g., offscreen windows.
if (!w->handle())
continue;
if (platformScreenForWindow(w) != this) if (platformScreenForWindow(w) != this)
continue; continue;

View File

@ -41,6 +41,8 @@
#include <QtCore/qatomic.h> #include <QtCore/qatomic.h>
#include <QtCore/QDebug> #include <QtCore/QDebug>
#include <QOpenGLContext>
#include <QtGui/qguiapplication.h>
#ifdef major #ifdef major
#undef major #undef major
@ -761,6 +763,16 @@ Q_GLOBAL_STATIC(QSurfaceFormat, qt_default_surface_format)
*/ */
void QSurfaceFormat::setDefaultFormat(const QSurfaceFormat &format) void QSurfaceFormat::setDefaultFormat(const QSurfaceFormat &format)
{ {
#ifndef QT_NO_OPENGL
if (qApp) {
QOpenGLContext *globalContext = QOpenGLContext::globalShareContext();
if (globalContext && globalContext->isValid()) {
qWarning("Warning: Setting a new default format with a different version or profile "
"after the global shared context is created may cause issues with context "
"sharing.");
}
}
#endif
*qt_default_surface_format() = format; *qt_default_surface_format() = format;
} }

View File

@ -1492,6 +1492,7 @@ bool QOpenGLFramebufferObject::bindDefault()
if (ctx) { if (ctx) {
ctx->functions()->glBindFramebuffer(GL_FRAMEBUFFER, ctx->defaultFramebufferObject()); ctx->functions()->glBindFramebuffer(GL_FRAMEBUFFER, ctx->defaultFramebufferObject());
QOpenGLContextPrivate::get(ctx)->qgl_current_fbo_invalid = true; QOpenGLContextPrivate::get(ctx)->qgl_current_fbo_invalid = true;
QOpenGLContextPrivate::get(ctx)->qgl_current_fbo = Q_NULLPTR;
} }
#ifdef QT_DEBUG #ifdef QT_DEBUG
else else

View File

@ -335,6 +335,8 @@ struct QSpanData
QGradientData gradient; QGradientData gradient;
QTextureData texture; QTextureData texture;
}; };
QExplicitlySharedDataPointer<const QSharedData> cachedGradient;
void init(QRasterBuffer *rb, const QRasterPaintEngine *pe); void init(QRasterBuffer *rb, const QRasterPaintEngine *pe);
void setup(const QBrush &brush, int alpha, QPainter::CompositionMode compositionMode); void setup(const QBrush &brush, int alpha, QPainter::CompositionMode compositionMode);

View File

@ -2283,6 +2283,8 @@ void QRasterPaintEngine::drawImage(const QRectF &r, const QImage &img, const QRe
= QRectF(sr.x() + clippedTargetRect.x() - r.x(), sr.y() + clippedTargetRect.y() - r.y(), = QRectF(sr.x() + clippedTargetRect.x() - r.x(), sr.y() + clippedTargetRect.y() - r.y(),
clippedTargetRect.width(), clippedTargetRect.height()).toRect(); clippedTargetRect.width(), clippedTargetRect.height()).toRect();
clippedSourceRect = clippedSourceRect.intersected(img.rect());
uint dbpl = d->rasterBuffer->bytesPerLine(); uint dbpl = d->rasterBuffer->bytesPerLine();
uint sbpl = img.bytesPerLine(); uint sbpl = img.bytesPerLine();
@ -4147,7 +4149,8 @@ void QRasterBuffer::flushToARGBImage(QImage *target) const
class QGradientCache class QGradientCache
{ {
struct CacheInfo public:
struct CacheInfo : public QSharedData
{ {
inline CacheInfo(QGradientStops s, int op, QGradient::InterpolationMode mode) : inline CacheInfo(QGradientStops s, int op, QGradient::InterpolationMode mode) :
stops(qMove(s)), opacity(op), interpolationMode(mode) {} stops(qMove(s)), opacity(op), interpolationMode(mode) {}
@ -4158,12 +4161,9 @@ class QGradientCache
QGradient::InterpolationMode interpolationMode; QGradient::InterpolationMode interpolationMode;
}; };
typedef QMultiHash<quint64, CacheInfo> QGradientColorTableHash; typedef QMultiHash<quint64, QExplicitlySharedDataPointer<const CacheInfo> > QGradientColorTableHash;
public: inline QExplicitlySharedDataPointer<const CacheInfo> getBuffer(const QGradient &gradient, int opacity) {
typedef QPair<const QRgb *, const QRgba64 *> ColorBufferPair;
inline ColorBufferPair getBuffer(const QGradient &gradient, int opacity) {
quint64 hash_val = 0; quint64 hash_val = 0;
const QGradientStops stops = gradient.stops(); const QGradientStops stops = gradient.stops();
@ -4177,10 +4177,9 @@ public:
return addCacheElement(hash_val, gradient, opacity); return addCacheElement(hash_val, gradient, opacity);
else { else {
do { do {
const CacheInfo &cache_info = it.value(); const QExplicitlySharedDataPointer<const CacheInfo> &cache_info = it.value();
if (cache_info.stops == stops && cache_info.opacity == opacity && cache_info.interpolationMode == gradient.interpolationMode()) if (cache_info->stops == stops && cache_info->opacity == opacity && cache_info->interpolationMode == gradient.interpolationMode())
return qMakePair(reinterpret_cast<const QRgb *>(cache_info.buffer32), return cache_info;
reinterpret_cast<const QRgba64 *>(cache_info.buffer64));
++it; ++it;
} while (it != cache.constEnd() && it.key() == hash_val); } while (it != cache.constEnd() && it.key() == hash_val);
// an exact match for these stops and opacity was not found, create new cache // an exact match for these stops and opacity was not found, create new cache
@ -4194,18 +4193,16 @@ protected:
inline void generateGradientColorTable(const QGradient& g, inline void generateGradientColorTable(const QGradient& g,
QRgba64 *colorTable, QRgba64 *colorTable,
int size, int opacity) const; int size, int opacity) const;
ColorBufferPair addCacheElement(quint64 hash_val, const QGradient &gradient, int opacity) { QExplicitlySharedDataPointer<const CacheInfo> addCacheElement(quint64 hash_val, const QGradient &gradient, int opacity) {
if (cache.size() == maxCacheSize()) { if (cache.size() == maxCacheSize()) {
// may remove more than 1, but OK // may remove more than 1, but OK
cache.erase(cache.begin() + (qrand() % maxCacheSize())); cache.erase(cache.begin() + (qrand() % maxCacheSize()));
} }
CacheInfo cache_entry(gradient.stops(), opacity, gradient.interpolationMode()); QExplicitlySharedDataPointer<CacheInfo> cache_entry(new CacheInfo (gradient.stops(), opacity, gradient.interpolationMode()));
generateGradientColorTable(gradient, cache_entry.buffer64, paletteSize(), opacity); generateGradientColorTable(gradient, cache_entry->buffer64, paletteSize(), opacity);
for (int i = 0; i < GRADIENT_STOPTABLE_SIZE; ++i) for (int i = 0; i < GRADIENT_STOPTABLE_SIZE; ++i)
cache_entry.buffer32[i] = cache_entry.buffer64[i].toArgb32(); cache_entry->buffer32[i] = cache_entry->buffer64[i].toArgb32();
CacheInfo &cache_value = cache.insert(hash_val, cache_entry).value(); return cache.insert(hash_val, cache_entry).value();
return qMakePair(reinterpret_cast<const QRgb *>(cache_value.buffer32),
reinterpret_cast<const QRgba64 *>(cache_value.buffer64));
} }
QGradientColorTableHash cache; QGradientColorTableHash cache;
@ -4424,6 +4421,7 @@ Q_GUI_EXPORT extern QImage qt_imageForBrush(int brushStyle, bool invert);
void QSpanData::setup(const QBrush &brush, int alpha, QPainter::CompositionMode compositionMode) void QSpanData::setup(const QBrush &brush, int alpha, QPainter::CompositionMode compositionMode)
{ {
Qt::BrushStyle brushStyle = qbrush_style(brush); Qt::BrushStyle brushStyle = qbrush_style(brush);
cachedGradient.reset();
switch (brushStyle) { switch (brushStyle) {
case Qt::SolidPattern: { case Qt::SolidPattern: {
type = Solid; type = Solid;
@ -4440,9 +4438,10 @@ void QSpanData::setup(const QBrush &brush, int alpha, QPainter::CompositionMode
const QLinearGradient *g = static_cast<const QLinearGradient *>(brush.gradient()); const QLinearGradient *g = static_cast<const QLinearGradient *>(brush.gradient());
gradient.alphaColor = !brush.isOpaque() || alpha != 256; gradient.alphaColor = !brush.isOpaque() || alpha != 256;
QGradientCache::ColorBufferPair colorBuffers = qt_gradient_cache()->getBuffer(*g, alpha); QExplicitlySharedDataPointer<const QGradientCache::CacheInfo> cacheInfo = qt_gradient_cache()->getBuffer(*g, alpha);
gradient.colorTable64 = colorBuffers.second; cachedGradient = cacheInfo;
gradient.colorTable32 = colorBuffers.first; gradient.colorTable32 = cacheInfo->buffer32;
gradient.colorTable64 = cacheInfo->buffer64;
gradient.spread = g->spread(); gradient.spread = g->spread();
@ -4461,9 +4460,10 @@ void QSpanData::setup(const QBrush &brush, int alpha, QPainter::CompositionMode
const QRadialGradient *g = static_cast<const QRadialGradient *>(brush.gradient()); const QRadialGradient *g = static_cast<const QRadialGradient *>(brush.gradient());
gradient.alphaColor = !brush.isOpaque() || alpha != 256; gradient.alphaColor = !brush.isOpaque() || alpha != 256;
QGradientCache::ColorBufferPair colorBuffers = qt_gradient_cache()->getBuffer(*g, alpha); QExplicitlySharedDataPointer<const QGradientCache::CacheInfo> cacheInfo = qt_gradient_cache()->getBuffer(*g, alpha);
gradient.colorTable64 = colorBuffers.second; cachedGradient = cacheInfo;
gradient.colorTable32 = colorBuffers.first; gradient.colorTable32 = cacheInfo->buffer32;
gradient.colorTable64 = cacheInfo->buffer64;
gradient.spread = g->spread(); gradient.spread = g->spread();
@ -4486,9 +4486,10 @@ void QSpanData::setup(const QBrush &brush, int alpha, QPainter::CompositionMode
const QConicalGradient *g = static_cast<const QConicalGradient *>(brush.gradient()); const QConicalGradient *g = static_cast<const QConicalGradient *>(brush.gradient());
gradient.alphaColor = !brush.isOpaque() || alpha != 256; gradient.alphaColor = !brush.isOpaque() || alpha != 256;
QGradientCache::ColorBufferPair colorBuffers = qt_gradient_cache()->getBuffer(*g, alpha); QExplicitlySharedDataPointer<const QGradientCache::CacheInfo> cacheInfo = qt_gradient_cache()->getBuffer(*g, alpha);
gradient.colorTable64 = colorBuffers.second; cachedGradient = cacheInfo;
gradient.colorTable32 = colorBuffers.first; gradient.colorTable32 = cacheInfo->buffer32;
gradient.colorTable64 = cacheInfo->buffer64;
gradient.spread = QGradient::RepeatSpread; gradient.spread = QGradient::RepeatSpread;

View File

@ -1924,7 +1924,7 @@ int QPdfEnginePrivate::writeCompressed(const char *src, int len)
} }
int QPdfEnginePrivate::writeImage(const QByteArray &data, int width, int height, int depth, int QPdfEnginePrivate::writeImage(const QByteArray &data, int width, int height, int depth,
int maskObject, int softMaskObject, bool dct) int maskObject, int softMaskObject, bool dct, bool isMono)
{ {
int image = addXrefEntry(-1); int image = addXrefEntry(-1);
xprintf("<<\n" xprintf("<<\n"
@ -1934,8 +1934,13 @@ int QPdfEnginePrivate::writeImage(const QByteArray &data, int width, int height,
"/Height %d\n", width, height); "/Height %d\n", width, height);
if (depth == 1) { if (depth == 1) {
xprintf("/ImageMask true\n" if (!isMono) {
"/Decode [1 0]\n"); xprintf("/ImageMask true\n"
"/Decode [1 0]\n");
} else {
xprintf("/BitsPerComponent 1\n"
"/ColorSpace /DeviceGray\n");
}
} else { } else {
xprintf("/BitsPerComponent 8\n" xprintf("/BitsPerComponent 8\n"
"/ColorSpace %s\n", (depth == 32) ? "/DeviceRGB" : "/DeviceGray"); "/ColorSpace %s\n", (depth == 32) ? "/DeviceRGB" : "/DeviceGray");
@ -2453,7 +2458,7 @@ int QPdfEnginePrivate::addImage(const QImage &img, bool *bitmap, qint64 serial_n
memcpy(rawdata, image.constScanLine(y), bytesPerLine); memcpy(rawdata, image.constScanLine(y), bytesPerLine);
rawdata += bytesPerLine; rawdata += bytesPerLine;
} }
object = writeImage(data, w, h, d, 0, 0); object = writeImage(data, w, h, d, 0, 0, false, is_monochrome(img.colorTable()));
} else { } else {
QByteArray softMaskData; QByteArray softMaskData;
bool dct = false; bool dct = false;

View File

@ -295,7 +295,7 @@ private:
int streampos; int streampos;
int writeImage(const QByteArray &data, int width, int height, int depth, int writeImage(const QByteArray &data, int width, int height, int depth,
int maskObject, int softMaskObject, bool dct = false); int maskObject, int softMaskObject, bool dct = false, bool isMono = false);
void writePage(); void writePage();
int addXrefEntry(int object, bool printostr = true); int addXrefEntry(int object, bool printostr = true);

View File

@ -746,8 +746,9 @@ static ColorData parseColorValue(QCss::Value v)
QVector<QCss::Value> colorDigits; QVector<QCss::Value> colorDigits;
if (!p.parseExpr(&colorDigits)) if (!p.parseExpr(&colorDigits))
return ColorData(); return ColorData();
const int tokenCount = colorDigits.count();
for (int i = 0; i < qMin(colorDigits.count(), 7); i += 2) { for (int i = 0; i < qMin(tokenCount, 7); i += 2) {
if (colorDigits.at(i).type == Value::Percentage) { if (colorDigits.at(i).type == Value::Percentage) {
colorDigits[i].variant = colorDigits.at(i).variant.toReal() * (255. / 100.); colorDigits[i].variant = colorDigits.at(i).variant.toReal() * (255. / 100.);
colorDigits[i].type = Value::Number; colorDigits[i].type = Value::Number;
@ -756,11 +757,15 @@ static ColorData parseColorValue(QCss::Value v)
} }
} }
if (tokenCount < 5)
return ColorData();
int v1 = colorDigits.at(0).variant.toInt(); int v1 = colorDigits.at(0).variant.toInt();
int v2 = colorDigits.at(2).variant.toInt(); int v2 = colorDigits.at(2).variant.toInt();
int v3 = colorDigits.at(4).variant.toInt(); int v3 = colorDigits.at(4).variant.toInt();
int alpha = 255; int alpha = 255;
if (colorDigits.count() >= 7) { if (tokenCount >= 7) {
int alphaValue = colorDigits.at(6).variant.toInt(); int alphaValue = colorDigits.at(6).variant.toInt();
if (rgba && alphaValue <= 1) if (rgba && alphaValue <= 1)
alpha = colorDigits.at(6).variant.toReal() * 255.; alpha = colorDigits.at(6).variant.toReal() * 255.;

View File

@ -804,7 +804,8 @@ QStringList QPlatformFontDatabase::fallbacksForFamily(const QString &family, QFo
Q_UNUSED(family); Q_UNUSED(family);
Q_UNUSED(styleHint); Q_UNUSED(styleHint);
QStringList retList; QStringList preferredFallbacks;
QStringList otherFallbacks;
size_t writingSystem = std::find(scriptForWritingSystem, size_t writingSystem = std::find(scriptForWritingSystem,
scriptForWritingSystem + QFontDatabase::WritingSystemsCount, scriptForWritingSystem + QFontDatabase::WritingSystemsCount,
@ -825,18 +826,18 @@ QStringList QPlatformFontDatabase::fallbacksForFamily(const QString &family, QFo
QtFontFoundry *foundry = f->foundries[j]; QtFontFoundry *foundry = f->foundries[j];
for (int k = 0; k < foundry->count; ++k) { for (int k = 0; k < foundry->count; ++k) {
if (style == foundry->styles[k]->key.style) { QString name = foundry->name.isEmpty()
if (foundry->name.isEmpty()) ? f->name
retList.append(f->name); : f->name + QLatin1String(" [") + foundry->name + QLatin1Char(']');
else if (style == foundry->styles[k]->key.style)
retList.append(f->name + QLatin1String(" [") + foundry->name + QLatin1Char(']')); preferredFallbacks.append(name);
break; else
} otherFallbacks.append(name);
} }
} }
} }
return retList; return preferredFallbacks + otherFallbacks;
} }
static void initializeDb(); static void initializeDb();
@ -1659,9 +1660,6 @@ bool QFontDatabase::isFixedPitch(const QString &family,
bool QFontDatabase::isBitmapScalable(const QString &family, bool QFontDatabase::isBitmapScalable(const QString &family,
const QString &style) const const QString &style) const
{ {
if (QGuiApplicationPrivate::platformIntegration()->fontDatabase()->fontsAlwaysScalable())
return true;
bool bitmapScalable = false; bool bitmapScalable = false;
QString familyName, foundryName; QString familyName, foundryName;
parseFontName(family, foundryName, familyName); parseFontName(family, foundryName, familyName);
@ -1702,9 +1700,6 @@ bool QFontDatabase::isBitmapScalable(const QString &family,
*/ */
bool QFontDatabase::isSmoothlyScalable(const QString &family, const QString &style) const bool QFontDatabase::isSmoothlyScalable(const QString &family, const QString &style) const
{ {
if (QGuiApplicationPrivate::platformIntegration()->fontDatabase()->fontsAlwaysScalable())
return true;
bool smoothScalable = false; bool smoothScalable = false;
QString familyName, foundryName; QString familyName, foundryName;
parseFontName(family, foundryName, familyName); parseFontName(family, foundryName, familyName);

View File

@ -1910,7 +1910,7 @@ void QFontEngineFT::unlockAlphaMapForGlyph()
static inline bool is2dRotation(const QTransform &t) static inline bool is2dRotation(const QTransform &t)
{ {
return qFuzzyCompare(t.m11(), t.m22()) && qFuzzyCompare(t.m12(), -t.m21()) return qFuzzyCompare(t.m11(), t.m22()) && qFuzzyCompare(t.m12(), -t.m21())
&& qFuzzyCompare(t.m11()*t.m22() - t.m12()*t.m21(), 1.0); && qFuzzyCompare(t.m11()*t.m22() - t.m12()*t.m21(), qreal(1.0));
} }
QFontEngineFT::Glyph *QFontEngineFT::loadGlyphFor(glyph_t g, QFontEngineFT::Glyph *QFontEngineFT::loadGlyphFor(glyph_t g,

View File

@ -244,7 +244,8 @@ QNetworkReplyHttpImpl::QNetworkReplyHttpImpl(QNetworkAccessManager* const manage
QNetworkReplyHttpImpl::~QNetworkReplyHttpImpl() QNetworkReplyHttpImpl::~QNetworkReplyHttpImpl()
{ {
// Most work is done in private destructor // This will do nothing if the request was already finished or aborted
emit abortHttpRequest();
} }
void QNetworkReplyHttpImpl::close() void QNetworkReplyHttpImpl::close()
@ -442,9 +443,6 @@ QNetworkReplyHttpImplPrivate::QNetworkReplyHttpImplPrivate()
QNetworkReplyHttpImplPrivate::~QNetworkReplyHttpImplPrivate() QNetworkReplyHttpImplPrivate::~QNetworkReplyHttpImplPrivate()
{ {
Q_Q(QNetworkReplyHttpImpl);
// This will do nothing if the request was already finished or aborted
emit q->abortHttpRequest();
} }
/* /*

View File

@ -48,6 +48,11 @@
#include "qnetworkconfigmanager_p.h" #include "qnetworkconfigmanager_p.h"
// for QNetworkSession::interface
#ifdef interface
# undef interface
#endif
#ifndef QT_NO_BEARERMANAGEMENT #ifndef QT_NO_BEARERMANAGEMENT
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE

View File

@ -850,7 +850,7 @@ bool QAbstractSocketPrivate::writeToSocket()
const char *ptr = writeBuffer.readPointer(); const char *ptr = writeBuffer.readPointer();
// Attempt to write it all in one chunk. // Attempt to write it all in one chunk.
qint64 written = socketEngine->write(ptr, nextSize); qint64 written = nextSize ? socketEngine->write(ptr, nextSize) : Q_INT64_C(0);
if (written < 0) { if (written < 0) {
#if defined (QABSTRACTSOCKET_DEBUG) #if defined (QABSTRACTSOCKET_DEBUG)
qDebug() << "QAbstractSocketPrivate::writeToSocket() write error, aborting." qDebug() << "QAbstractSocketPrivate::writeToSocket() write error, aborting."
@ -2504,7 +2504,7 @@ qint64 QAbstractSocket::writeData(const char *data, qint64 size)
if (!d->isBuffered && d->socketType == TcpSocket if (!d->isBuffered && d->socketType == TcpSocket
&& d->socketEngine && d->writeBuffer.isEmpty()) { && d->socketEngine && d->writeBuffer.isEmpty()) {
// This code is for the new Unbuffered QTcpSocket use case // This code is for the new Unbuffered QTcpSocket use case
qint64 written = d->socketEngine->write(data, size); qint64 written = size ? d->socketEngine->write(data, size) : Q_INT64_C(0);
if (written < 0) { if (written < 0) {
d->setError(d->socketEngine->error(), d->socketEngine->errorString()); d->setError(d->socketEngine->error(), d->socketEngine->errorString());
} else if (written < size) { } else if (written < size) {

View File

@ -873,6 +873,10 @@ qint64 QNativeSocketEngine::writeDatagram(const char *data, qint64 size, const Q
/*! /*!
Writes a block of \a size bytes from \a data to the socket. Writes a block of \a size bytes from \a data to the socket.
Returns the number of bytes written, or -1 if an error occurred. Returns the number of bytes written, or -1 if an error occurred.
Passing zero as the \a size parameter on a connected UDP socket
will send an empty datagram. For other socket types results are
unspecified.
*/ */
qint64 QNativeSocketEngine::write(const char *data, qint64 size) qint64 QNativeSocketEngine::write(const char *data, qint64 size)
{ {

View File

@ -561,10 +561,12 @@ void QNativeSocketEngine::close()
ComPtr<IAsyncAction> action; ComPtr<IAsyncAction> action;
hr = socket3->CancelIOAsync(&action); hr = socket3->CancelIOAsync(&action);
Q_ASSERT_SUCCEEDED(hr); Q_ASSERT_SUCCEEDED(hr);
hr = QWinRTFunctions::await(action); hr = QWinRTFunctions::await(action, QWinRTFunctions::YieldThread, 5000);
// If there is no pending IO (no read established before) the function will fail with // If there is no pending IO (no read established before) the function will fail with
// "function was called at an unexpected time" which is fine. // "function was called at an unexpected time" which is fine.
if (hr != E_ILLEGAL_METHOD_CALL) // Timeout is fine as well. The result will be the socket being hard reset instead of
// being closed gracefully
if (hr != E_ILLEGAL_METHOD_CALL && hr != ERROR_TIMEOUT)
Q_ASSERT_SUCCEEDED(hr); Q_ASSERT_SUCCEEDED(hr);
return S_OK; return S_OK;
}); });

View File

@ -1293,14 +1293,19 @@ QGLFormat::OpenGLVersionFlags Q_AUTOTEST_EXPORT qOpenGLVersionFlagsFromString(co
switch (versionString[2].toLatin1()) { switch (versionString[2].toLatin1()) {
case '5': case '5':
versionFlags |= QGLFormat::OpenGL_Version_1_5; versionFlags |= QGLFormat::OpenGL_Version_1_5;
// fall through
case '4': case '4':
versionFlags |= QGLFormat::OpenGL_Version_1_4; versionFlags |= QGLFormat::OpenGL_Version_1_4;
// fall through
case '3': case '3':
versionFlags |= QGLFormat::OpenGL_Version_1_3; versionFlags |= QGLFormat::OpenGL_Version_1_3;
// fall through
case '2': case '2':
versionFlags |= QGLFormat::OpenGL_Version_1_2; versionFlags |= QGLFormat::OpenGL_Version_1_2;
// fall through
case '1': case '1':
versionFlags |= QGLFormat::OpenGL_Version_1_1; versionFlags |= QGLFormat::OpenGL_Version_1_1;
// fall through
default: default:
break; break;
} }
@ -1325,10 +1330,13 @@ QGLFormat::OpenGLVersionFlags Q_AUTOTEST_EXPORT qOpenGLVersionFlagsFromString(co
switch (versionString[2].toLatin1()) { switch (versionString[2].toLatin1()) {
case '3': case '3':
versionFlags |= QGLFormat::OpenGL_Version_3_3; versionFlags |= QGLFormat::OpenGL_Version_3_3;
// fall through
case '2': case '2':
versionFlags |= QGLFormat::OpenGL_Version_3_2; versionFlags |= QGLFormat::OpenGL_Version_3_2;
// fall through
case '1': case '1':
versionFlags |= QGLFormat::OpenGL_Version_3_1; versionFlags |= QGLFormat::OpenGL_Version_3_1;
// fall through
case '0': case '0':
break; break;
default: default:
@ -1353,10 +1361,13 @@ QGLFormat::OpenGLVersionFlags Q_AUTOTEST_EXPORT qOpenGLVersionFlagsFromString(co
switch (versionString[2].toLatin1()) { switch (versionString[2].toLatin1()) {
case '3': case '3':
versionFlags |= QGLFormat::OpenGL_Version_4_3; versionFlags |= QGLFormat::OpenGL_Version_4_3;
// fall through
case '2': case '2':
versionFlags |= QGLFormat::OpenGL_Version_4_2; versionFlags |= QGLFormat::OpenGL_Version_4_2;
// fall through
case '1': case '1':
versionFlags |= QGLFormat::OpenGL_Version_4_1; versionFlags |= QGLFormat::OpenGL_Version_4_1;
// fall through
case '0': case '0':
break; break;
default: default:

View File

@ -414,8 +414,7 @@ QVariant QMacPasteboardMimeUnicodeText::convertToMime(const QString &mimetype, Q
if (flavor == QLatin1String("public.utf8-plain-text")) { if (flavor == QLatin1String("public.utf8-plain-text")) {
ret = QString::fromUtf8(firstData); ret = QString::fromUtf8(firstData);
} else if (flavor == QLatin1String("public.utf16-plain-text")) { } else if (flavor == QLatin1String("public.utf16-plain-text")) {
ret = QString(reinterpret_cast<const QChar *>(firstData.constData()), ret = QTextCodec::codecForName("UTF-16")->toUnicode(firstData);
firstData.size() / sizeof(QChar));
} else { } else {
qWarning("QMime::convertToMime: unhandled mimetype: %s", qPrintable(mimetype)); qWarning("QMime::convertToMime: unhandled mimetype: %s", qPrintable(mimetype));
} }
@ -429,7 +428,7 @@ QList<QByteArray> QMacPasteboardMimeUnicodeText::convertFromMime(const QString &
if (flavor == QLatin1String("public.utf8-plain-text")) if (flavor == QLatin1String("public.utf8-plain-text"))
ret.append(string.toUtf8()); ret.append(string.toUtf8());
else if (flavor == QLatin1String("public.utf16-plain-text")) else if (flavor == QLatin1String("public.utf16-plain-text"))
ret.append(QByteArray((char*)string.utf16(), string.length()*2)); ret.append(QTextCodec::codecForName("UTF-16")->fromUnicode(string));
return ret; return ret;
} }

View File

@ -386,5 +386,10 @@ bool qglx_reduceFormat(QSurfaceFormat *format)
return true; return true;
} }
if (format->stereo()) {
format->setStereo(false);
return true;
}
return false; return false;
} }

View File

@ -635,6 +635,11 @@ static void updateWindow(JNIEnv */*env*/, jobject /*thiz*/)
if (QGuiApplication::instance() != nullptr) { if (QGuiApplication::instance() != nullptr) {
const auto tlw = QGuiApplication::topLevelWindows(); const auto tlw = QGuiApplication::topLevelWindows();
for (QWindow *w : tlw) { for (QWindow *w : tlw) {
// Skip non-platform windows, e.g., offscreen windows.
if (!w->handle())
continue;
QRect availableGeometry = w->screen()->availableGeometry(); QRect availableGeometry = w->screen()->availableGeometry();
if (w->geometry().width() > 0 && w->geometry().height() > 0 && availableGeometry.width() > 0 && availableGeometry.height() > 0) if (w->geometry().width() > 0 && w->geometry().height() > 0 && availableGeometry.width() > 0 && availableGeometry.height() > 0)
QWindowSystemInterface::handleExposeEvent(w, QRegion(QRect(QPoint(), w->geometry().size()))); QWindowSystemInterface::handleExposeEvent(w, QRegion(QRect(QPoint(), w->geometry().size())));

View File

@ -461,9 +461,9 @@ QVariant QAndroidPlatformTheme::themeHint(ThemeHint hint) const
case StyleNames: case StyleNames:
if (qEnvironmentVariableIntValue("QT_USE_ANDROID_NATIVE_STYLE") if (qEnvironmentVariableIntValue("QT_USE_ANDROID_NATIVE_STYLE")
&& m_androidStyleData) { && m_androidStyleData) {
return QStringList("android"); return QStringList(QLatin1String("android"));
} }
return QStringList("fusion"); return QStringList(QLatin1String("fusion"));
case MouseDoubleClickDistance: case MouseDoubleClickDistance:
{ {

View File

@ -122,7 +122,7 @@ QT_NAMESPACE_ALIAS_OBJC_CLASS(QNSColorPanelDelegate);
- (void)dealloc - (void)dealloc
{ {
[self restoreOriginalContentView]; [mStolenContentView release];
[mColorPanel setDelegate:nil]; [mColorPanel setDelegate:nil];
[[NSNotificationCenter defaultCenter] removeObserver:self]; [[NSNotificationCenter defaultCenter] removeObserver:self];

View File

@ -150,7 +150,7 @@ QT_NAMESPACE_ALIAS_OBJC_CLASS(QNSFontPanelDelegate);
- (void)dealloc - (void)dealloc
{ {
[self restoreOriginalContentView]; [mStolenContentView release];
[mFontPanel setDelegate:nil]; [mFontPanel setDelegate:nil];
[[NSFontManager sharedFontManager] setDelegate:nil]; [[NSFontManager sharedFontManager] setDelegate:nil];
[[NSNotificationCenter defaultCenter] removeObserver:self]; [[NSNotificationCenter defaultCenter] removeObserver:self];

View File

@ -76,6 +76,7 @@ private:
static QCocoaWindow *findWindowForMenubar(); static QCocoaWindow *findWindowForMenubar();
static QCocoaMenuBar *findGlobalMenubar(); static QCocoaMenuBar *findGlobalMenubar();
bool needsImmediateUpdate();
bool shouldDisable(QCocoaWindow *active) const; bool shouldDisable(QCocoaWindow *active) const;
NSMenuItem *nativeItemForMenu(QCocoaMenu *menu) const; NSMenuItem *nativeItemForMenu(QCocoaMenu *menu) const;

View File

@ -90,6 +90,32 @@ QCocoaMenuBar::~QCocoaMenuBar()
} }
} }
bool QCocoaMenuBar::needsImmediateUpdate()
{
if (m_window && m_window->window()->isActive()) {
return true;
} else if (!m_window) {
// Only update if the focus/active window has no
// menubar, which means it'll be using this menubar.
// This is to avoid a modification in a parentless
// menubar to affect a window-assigned menubar.
QWindow *fw = QGuiApplication::focusWindow();
if (!fw) {
// Same if there's no focus window, BTW.
return true;
} else {
QCocoaWindow *cw = static_cast<QCocoaWindow *>(fw->handle());
if (cw && !cw->menubar())
return true;
}
}
// Either the menubar is attached to a non-active window,
// or the application's focus window has its own menubar
// (which is different from this one)
return false;
}
void QCocoaMenuBar::insertMenu(QPlatformMenu *platformMenu, QPlatformMenu *before) void QCocoaMenuBar::insertMenu(QPlatformMenu *platformMenu, QPlatformMenu *before)
{ {
QCocoaMenu *menu = static_cast<QCocoaMenu *>(platformMenu); QCocoaMenu *menu = static_cast<QCocoaMenu *>(platformMenu);
@ -130,7 +156,7 @@ void QCocoaMenuBar::insertMenu(QPlatformMenu *platformMenu, QPlatformMenu *befor
syncMenu(menu); syncMenu(menu);
if (m_window && m_window->window()->isActive()) if (needsImmediateUpdate())
updateMenuBarImmediately(); updateMenuBarImmediately();
} }

View File

@ -322,6 +322,8 @@ public: // for QNSView
}; };
QHash<quintptr, BorderRange> m_contentBorderAreas; // identifer -> uppper/lower QHash<quintptr, BorderRange> m_contentBorderAreas; // identifer -> uppper/lower
QHash<quintptr, bool> m_enabledContentBorderAreas; // identifer -> enabled state (true/false) QHash<quintptr, bool> m_enabledContentBorderAreas; // identifer -> enabled state (true/false)
bool m_hasWindowFilePath;
}; };
QT_END_NAMESPACE QT_END_NAMESPACE

View File

@ -380,6 +380,7 @@ QCocoaWindow::QCocoaWindow(QWindow *tlw)
, m_topContentBorderThickness(0) , m_topContentBorderThickness(0)
, m_bottomContentBorderThickness(0) , m_bottomContentBorderThickness(0)
, m_normalGeometry(QRect(0,0,-1,-1)) , m_normalGeometry(QRect(0,0,-1,-1))
, m_hasWindowFilePath(false)
{ {
qCDebug(lcQpaCocoaWindow) << "QCocoaWindow::QCocoaWindow" << window(); qCDebug(lcQpaCocoaWindow) << "QCocoaWindow::QCocoaWindow" << window();
@ -935,6 +936,7 @@ void QCocoaWindow::setWindowFilePath(const QString &filePath)
QFileInfo fi(filePath); QFileInfo fi(filePath);
[m_nsWindow setRepresentedFilename:fi.exists() ? filePath.toNSString() : @""]; [m_nsWindow setRepresentedFilename:fi.exists() ? filePath.toNSString() : @""];
m_hasWindowFilePath = fi.exists();
} }
void QCocoaWindow::setWindowIcon(const QIcon &icon) void QCocoaWindow::setWindowIcon(const QIcon &icon)

View File

@ -874,11 +874,6 @@ static bool _q_dontOverrideCtrlLMB = false;
if (!(m_acceptedMouseDowns & button) == button) if (!(m_acceptedMouseDowns & button) == button)
return false; return false;
if (!(m_buttons & (m_sendUpAsRightButton ? Qt::RightButton : Qt::LeftButton))) {
qCWarning(lcQpaCocoaWindow) << "QNSView mouseDragged: Internal mouse button tracking"
<< "invalid (missing Qt::LeftButton)";
}
[self handleMouseEvent:theEvent]; [self handleMouseEvent:theEvent];
return true; return true;
} }

View File

@ -59,6 +59,8 @@
- (BOOL)windowShouldZoom:(NSWindow *)window toFrame:(NSRect)newFrame; - (BOOL)windowShouldZoom:(NSWindow *)window toFrame:(NSRect)newFrame;
- (void)windowWillClose:(NSNotification *)notification; - (void)windowWillClose:(NSNotification *)notification;
- (BOOL)window:(NSWindow *)window shouldPopUpDocumentPathMenu:(NSMenu *)menu;
- (BOOL)window:(NSWindow *)window shouldDragDocumentWithEvent:(NSEvent *)event from:(NSPoint)dragImageLocation withPasteboard:(NSPasteboard *)pasteboard;
@end @end
QT_NAMESPACE_ALIAS_OBJC_CLASS(QNSWindowDelegate); QT_NAMESPACE_ALIAS_OBJC_CLASS(QNSWindowDelegate);

View File

@ -123,4 +123,19 @@
m_cocoaWindow->windowWillClose(); m_cocoaWindow->windowWillClose();
} }
- (BOOL)window:(NSWindow *)window shouldPopUpDocumentPathMenu:(NSMenu *)menu
{
Q_UNUSED(window);
Q_UNUSED(menu);
return m_cocoaWindow && m_cocoaWindow->m_hasWindowFilePath;
}
- (BOOL)window:(NSWindow *)window shouldDragDocumentWithEvent:(NSEvent *)event from:(NSPoint)dragImageLocation withPasteboard:(NSPasteboard *)pasteboard
{
Q_UNUSED(window);
Q_UNUSED(event);
Q_UNUSED(dragImageLocation);
Q_UNUSED(pasteboard);
return m_cocoaWindow && m_cocoaWindow->m_hasWindowFilePath;
}
@end @end

View File

@ -66,7 +66,8 @@ private:
Q_GLOBAL_STATIC(DeviceIntegration, deviceIntegration) Q_GLOBAL_STATIC(DeviceIntegration, deviceIntegration)
DeviceIntegration::DeviceIntegration() : m_integration(0) DeviceIntegration::DeviceIntegration()
: m_integration(nullptr)
{ {
QStringList pluginKeys = QEglFSDeviceIntegrationFactory::keys(); QStringList pluginKeys = QEglFSDeviceIntegrationFactory::keys();
if (!pluginKeys.isEmpty()) { if (!pluginKeys.isEmpty()) {

View File

@ -79,7 +79,7 @@ void QEglFSKmsEglDevice::close()
EGLNativeDisplayType QEglFSKmsEglDevice::nativeDisplay() const EGLNativeDisplayType QEglFSKmsEglDevice::nativeDisplay() const
{ {
return static_cast<QEglFSKmsEglDeviceIntegration *>(m_integration)->eglDevice(); return reinterpret_cast<EGLNativeDisplayType>(static_cast<QEglFSKmsEglDeviceIntegration *>(m_integration)->eglDevice());
} }
QEglFSKmsScreen *QEglFSKmsEglDevice::createScreen(QEglFSKmsIntegration *integration, QEglFSKmsDevice *device, QEglFSKmsScreen *QEglFSKmsEglDevice::createScreen(QEglFSKmsIntegration *integration, QEglFSKmsDevice *device,

View File

@ -1,74 +1,2 @@
TARGET = qios TEMPLATE = subdirs
SUBDIRS = kernel.pro optional
QT += \
core-private gui-private \
clipboard_support-private fontdatabase_support-private graphics_support-private
LIBS += -framework Foundation -framework UIKit -framework QuartzCore -framework AudioToolbox
OBJECTIVE_SOURCES = \
plugin.mm \
qiosintegration.mm \
qioseventdispatcher.mm \
qioswindow.mm \
qiosscreen.mm \
qiosbackingstore.mm \
qiosapplicationdelegate.mm \
qiosapplicationstate.mm \
qiosviewcontroller.mm \
qioscontext.mm \
qiosinputcontext.mm \
qiostheme.mm \
qiosglobal.mm \
qiosservices.mm \
quiview.mm \
quiaccessibilityelement.mm \
qiosplatformaccessibility.mm \
qiostextresponder.mm
HEADERS = \
qiosintegration.h \
qioseventdispatcher.h \
qioswindow.h \
qiosscreen.h \
qiosbackingstore.h \
qiosapplicationdelegate.h \
qiosapplicationstate.h \
qiosviewcontroller.h \
qioscontext.h \
qiosinputcontext.h \
qiostheme.h \
qiosglobal.h \
qiosservices.h \
quiview.h \
quiaccessibilityelement.h \
qiosplatformaccessibility.h \
qiostextresponder.h \
qiosfileenginefactory.h
!tvos {
LIBS += -framework AssetsLibrary
OBJECTIVE_SOURCES += \
qiosclipboard.mm \
qiosmenu.mm \
qiosfileengineassetslibrary.mm \
qiosfiledialog.mm \
qiosmessagedialog.mm \
qiostextinputoverlay.mm
HEADERS += \
qiosclipboard.h \
qiosmenu.h \
qiosfileengineassetslibrary.h \
qiosfiledialog.h \
qiosmessagedialog.h \
qiostextinputoverlay.h
}
OTHER_FILES = \
quiview_textinput.mm \
quiview_accessibility.mm
PLUGIN_TYPE = platforms
PLUGIN_CLASS_NAME = QIOSIntegrationPlugin
!equals(TARGET, $$QT_DEFAULT_QPA_PLUGIN): PLUGIN_EXTENDS = -
load(qt_plugin)

View File

@ -0,0 +1,72 @@
TARGET = qios
QT += \
core-private gui-private \
clipboard_support-private fontdatabase_support-private graphics_support-private
LIBS += -framework Foundation -framework UIKit -framework QuartzCore -framework AudioToolbox
OBJECTIVE_SOURCES = \
plugin.mm \
qiosintegration.mm \
qioseventdispatcher.mm \
qioswindow.mm \
qiosscreen.mm \
qiosbackingstore.mm \
qiosapplicationdelegate.mm \
qiosapplicationstate.mm \
qiosviewcontroller.mm \
qioscontext.mm \
qiosinputcontext.mm \
qiostheme.mm \
qiosglobal.mm \
qiosservices.mm \
quiview.mm \
quiaccessibilityelement.mm \
qiosplatformaccessibility.mm \
qiostextresponder.mm
HEADERS = \
qiosintegration.h \
qioseventdispatcher.h \
qioswindow.h \
qiosscreen.h \
qiosbackingstore.h \
qiosapplicationdelegate.h \
qiosapplicationstate.h \
qiosviewcontroller.h \
qioscontext.h \
qiosinputcontext.h \
qiostheme.h \
qiosglobal.h \
qiosservices.h \
quiview.h \
quiaccessibilityelement.h \
qiosplatformaccessibility.h \
qiostextresponder.h \
qiosfileenginefactory.h
!tvos {
LIBS += -framework AssetsLibrary
OBJECTIVE_SOURCES += \
qiosclipboard.mm \
qiosmenu.mm \
qiosfiledialog.mm \
qiosmessagedialog.mm \
qiostextinputoverlay.mm
HEADERS += \
qiosclipboard.h \
qiosmenu.h \
qiosfiledialog.h \
qiosmessagedialog.h \
qiostextinputoverlay.h
}
OTHER_FILES = \
quiview_textinput.mm \
quiview_accessibility.mm
PLUGIN_TYPE = platforms
PLUGIN_CLASS_NAME = QIOSIntegrationPlugin
!equals(TARGET, $$QT_DEFAULT_QPA_PLUGIN): PLUGIN_EXTENDS = -
load(qt_plugin)

View File

@ -0,0 +1,22 @@
TARGET = qiosnsphotolibrarysupport
QT += core gui gui-private
LIBS += -framework UIKit -framework AssetsLibrary
HEADERS = \
qiosfileengineassetslibrary.h \
qiosfileenginefactory.h \
qiosimagepickercontroller.h
OBJECTIVE_SOURCES = \
plugin.mm \
qiosfileengineassetslibrary.mm \
qiosimagepickercontroller.mm \
OTHER_FILES = \
plugin.json
PLUGIN_CLASS_NAME = QIosOptionalPlugin_NSPhotoLibrary
PLUGIN_EXTENDS = -
PLUGIN_TYPE = platforms/darwin
load(qt_plugin)

View File

@ -0,0 +1,3 @@
{
"Keys": [ "NSPhotoLibrarySupport" ]
}

View File

@ -0,0 +1,64 @@
/****************************************************************************
**
** Copyright (C) 2016 The Qt Company Ltd.
** Contact: http://www.qt.io/licensing/
**
** This file is part of the plugins of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL21$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
** and conditions see http://www.qt.io/terms-conditions. For further
** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 or version 3 as published by the Free
** Software Foundation and appearing in the file LICENSE.LGPLv21 and
** LICENSE.LGPLv3 included in the packaging of this file. Please review the
** following information to ensure the GNU Lesser General Public License
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** As a special exception, The Qt Company gives you certain additional
** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
**
****************************************************************************/
#include "../../qiosoptionalplugininterface.h"
#include "../../qiosfiledialog.h"
#include "qiosimagepickercontroller.h"
#include "qiosfileenginefactory.h"
QT_BEGIN_NAMESPACE
class QIosOptionalPlugin_NSPhotoLibrary : public QObject, QIosOptionalPluginInterface
{
Q_OBJECT
Q_PLUGIN_METADATA(IID QIosOptionalPluginInterface_iid FILE "plugin.json")
Q_INTERFACES(QIosOptionalPluginInterface)
public:
explicit QIosOptionalPlugin_NSPhotoLibrary(QObject* = 0) {};
~QIosOptionalPlugin_NSPhotoLibrary() {}
UIViewController* createImagePickerController(QIOSFileDialog *fileDialog) const override
{
return [[[QIOSImagePickerController alloc] initWithQIOSFileDialog:fileDialog] autorelease];
}
private:
QIOSFileEngineFactory m_fileEngineFactory;
};
QT_END_NAMESPACE
#include "plugin.moc"

View File

@ -43,6 +43,9 @@
#include <QtCore/private/qabstractfileengine_p.h> #include <QtCore/private/qabstractfileengine_p.h>
Q_FORWARD_DECLARE_OBJC_CLASS(ALAsset); Q_FORWARD_DECLARE_OBJC_CLASS(ALAsset);
QT_BEGIN_NAMESPACE
class QIOSAssetData; class QIOSAssetData;
class QIOSFileEngineAssetsLibrary : public QAbstractFileEngine class QIOSFileEngineAssetsLibrary : public QAbstractFileEngine
@ -51,20 +54,20 @@ public:
QIOSFileEngineAssetsLibrary(const QString &fileName); QIOSFileEngineAssetsLibrary(const QString &fileName);
~QIOSFileEngineAssetsLibrary(); ~QIOSFileEngineAssetsLibrary();
bool open(QIODevice::OpenMode openMode) Q_DECL_OVERRIDE; bool open(QIODevice::OpenMode openMode) override;
bool close() Q_DECL_OVERRIDE; bool close() override;
FileFlags fileFlags(FileFlags type) const Q_DECL_OVERRIDE; FileFlags fileFlags(FileFlags type) const override;
qint64 size() const Q_DECL_OVERRIDE; qint64 size() const override;
qint64 read(char *data, qint64 maxlen) Q_DECL_OVERRIDE; qint64 read(char *data, qint64 maxlen) override;
qint64 pos() const Q_DECL_OVERRIDE; qint64 pos() const override;
bool seek(qint64 pos) Q_DECL_OVERRIDE; bool seek(qint64 pos) override;
QString fileName(FileName file) const Q_DECL_OVERRIDE; QString fileName(FileName file) const override;
void setFileName(const QString &file) Q_DECL_OVERRIDE; void setFileName(const QString &file) override;
QStringList entryList(QDir::Filters filters, const QStringList &filterNames) const Q_DECL_OVERRIDE; QStringList entryList(QDir::Filters filters, const QStringList &filterNames) const override;
#ifndef QT_NO_FILESYSTEMITERATOR #ifndef QT_NO_FILESYSTEMITERATOR
Iterator *beginEntryList(QDir::Filters filters, const QStringList &filterNames) Q_DECL_OVERRIDE; Iterator *beginEntryList(QDir::Filters filters, const QStringList &filterNames) override;
Iterator *endEntryList() Q_DECL_OVERRIDE; Iterator *endEntryList() override;
#endif #endif
void setError(QFile::FileError error, const QString &str) { QAbstractFileEngine::setError(error, str); } void setError(QFile::FileError error, const QString &str) { QAbstractFileEngine::setError(error, str); }
@ -78,5 +81,7 @@ private:
ALAsset *loadAsset() const; ALAsset *loadAsset() const;
}; };
QT_END_NAMESPACE
#endif // QIOSFILEENGINEASSETSLIBRARY_H #endif // QIOSFILEENGINEASSETSLIBRARY_H

View File

@ -48,6 +48,8 @@
#include <QtCore/qset.h> #include <QtCore/qset.h>
#include <QtCore/qthreadstorage.h> #include <QtCore/qthreadstorage.h>
QT_BEGIN_NAMESPACE
static QThreadStorage<QString> g_iteratorCurrentUrl; static QThreadStorage<QString> g_iteratorCurrentUrl;
static QThreadStorage<QPointer<QIOSAssetData> > g_assetDataCache; static QThreadStorage<QPointer<QIOSAssetData> > g_assetDataCache;
@ -472,4 +474,6 @@ QAbstractFileEngine::Iterator *QIOSFileEngineAssetsLibrary::endEntryList()
return 0; return 0;
} }
QT_END_NAMESPACE
#endif #endif

View File

@ -44,6 +44,8 @@
#include <QtCore/private/qabstractfileengine_p.h> #include <QtCore/private/qabstractfileengine_p.h>
#include "qiosfileengineassetslibrary.h" #include "qiosfileengineassetslibrary.h"
QT_BEGIN_NAMESPACE
class QIOSFileEngineFactory : public QAbstractFileEngineHandler class QIOSFileEngineFactory : public QAbstractFileEngineHandler
{ {
public: public:
@ -62,4 +64,6 @@ public:
} }
}; };
QT_END_NAMESPACE
#endif // QIOSFILEENGINEFACTORY_H #endif // QIOSFILEENGINEFACTORY_H

View File

@ -0,0 +1,42 @@
/****************************************************************************
**
** Copyright (C) 2016 The Qt Company Ltd.
** Contact: http://www.qt.io/licensing/
**
** This file is part of the plugins of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL21$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
** and conditions see http://www.qt.io/terms-conditions. For further
** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 or version 3 as published by the Free
** Software Foundation and appearing in the file LICENSE.LGPLv21 and
** LICENSE.LGPLv3 included in the packaging of this file. Please review the
** following information to ensure the GNU Lesser General Public License
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** As a special exception, The Qt Company gives you certain additional
** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
**
****************************************************************************/
#import <UIKit/UIKit.h>
#include "../../qiosfiledialog.h"
@interface QIOSImagePickerController : UIImagePickerController <UIImagePickerControllerDelegate, UINavigationControllerDelegate> {
QIOSFileDialog *m_fileDialog;
}
- (id)initWithQIOSFileDialog:(QIOSFileDialog *)fileDialog;
@end

View File

@ -0,0 +1,66 @@
/****************************************************************************
**
** Copyright (C) 2016 The Qt Company Ltd.
** Contact: http://www.qt.io/licensing/
**
** This file is part of the plugins of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL21$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
** and conditions see http://www.qt.io/terms-conditions. For further
** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 or version 3 as published by the Free
** Software Foundation and appearing in the file LICENSE.LGPLv21 and
** LICENSE.LGPLv3 included in the packaging of this file. Please review the
** following information to ensure the GNU Lesser General Public License
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** As a special exception, The Qt Company gives you certain additional
** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
**
****************************************************************************/
#import <UIKit/UIKit.h>
#include "qiosimagepickercontroller.h"
@implementation QIOSImagePickerController
- (id)initWithQIOSFileDialog:(QIOSFileDialog *)fileDialog
{
self = [super init];
if (self) {
m_fileDialog = fileDialog;
[self setSourceType:UIImagePickerControllerSourceTypePhotoLibrary];
[self setDelegate:self];
}
return self;
}
- (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info
{
Q_UNUSED(picker);
NSURL *url = [info objectForKey:UIImagePickerControllerReferenceURL];
QUrl fileUrl = QUrl::fromLocalFile(QString::fromNSString([url description]));
m_fileDialog->selectedFilesChanged(QList<QUrl>() << fileUrl);
emit m_fileDialog->accept();
}
- (void)imagePickerControllerDidCancel:(UIImagePickerController *)picker
{
Q_UNUSED(picker)
emit m_fileDialog->reject();
}
@end

View File

@ -0,0 +1,2 @@
TEMPLATE = subdirs
SUBDIRS = nsphotolibrarysupport

View File

@ -72,6 +72,8 @@ private:
QList<QUrl> m_selection; QList<QUrl> m_selection;
QEventLoop m_eventLoop; QEventLoop m_eventLoop;
UIViewController *m_viewController; UIViewController *m_viewController;
bool showImagePickerDialog(QWindow *parent);
}; };
QT_END_NAMESPACE QT_END_NAMESPACE

View File

@ -37,52 +37,18 @@
** **
****************************************************************************/ ****************************************************************************/
#include "qiosfiledialog.h"
#import <UIKit/UIKit.h> #import <UIKit/UIKit.h>
#include <QtCore/qstandardpaths.h> #include <QtCore/qstandardpaths.h>
#include <QtGui/qwindow.h> #include <QtGui/qwindow.h>
#include <QDebug>
@interface QIOSImagePickerController : UIImagePickerController <UIImagePickerControllerDelegate, UINavigationControllerDelegate> { #include "qiosfiledialog.h"
QIOSFileDialog *m_fileDialog; #include "qiosintegration.h"
} #include "qiosoptionalplugininterface.h"
@end
@implementation QIOSImagePickerController
- (id)initWithQIOSFileDialog:(QIOSFileDialog *)fileDialog
{
self = [super init];
if (self) {
m_fileDialog = fileDialog;
[self setSourceType:UIImagePickerControllerSourceTypePhotoLibrary];
[self setDelegate:self];
}
return self;
}
- (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info
{
Q_UNUSED(picker);
NSURL *url = [info objectForKey:UIImagePickerControllerReferenceURL];
QUrl fileUrl = QUrl::fromLocalFile(QString::fromNSString([url description]));
m_fileDialog->selectedFilesChanged(QList<QUrl>() << fileUrl);
emit m_fileDialog->accept();
}
- (void)imagePickerControllerDidCancel:(UIImagePickerController *)picker
{
Q_UNUSED(picker)
emit m_fileDialog->reject();
}
@end
// --------------------------------------------------------------------------
QIOSFileDialog::QIOSFileDialog() QIOSFileDialog::QIOSFileDialog()
: m_viewController(0) : m_viewController(Q_NULLPTR)
{ {
} }
@ -104,17 +70,36 @@ bool QIOSFileDialog::show(Qt::WindowFlags windowFlags, Qt::WindowModality window
bool acceptOpen = options()->acceptMode() == QFileDialogOptions::AcceptOpen; bool acceptOpen = options()->acceptMode() == QFileDialogOptions::AcceptOpen;
QString directory = options()->initialDirectory().toLocalFile(); QString directory = options()->initialDirectory().toLocalFile();
if (acceptOpen && directory.startsWith(QLatin1String("assets-library:"))) { if (acceptOpen && directory.startsWith(QLatin1String("assets-library:")))
m_viewController = [[QIOSImagePickerController alloc] initWithQIOSFileDialog:this]; return showImagePickerDialog(parent);
UIWindow *window = parent ? reinterpret_cast<UIView *>(parent->winId()).window
: [UIApplication sharedApplication].keyWindow;
[window.rootViewController presentViewController:m_viewController animated:YES completion:nil];
return true;
}
return false; return false;
} }
bool QIOSFileDialog::showImagePickerDialog(QWindow *parent)
{
if (!m_viewController) {
QFactoryLoader *plugins = QIOSIntegration::instance()->optionalPlugins();
for (int i = 0; i < plugins->metaData().size(); ++i) {
QIosOptionalPluginInterface *plugin = qobject_cast<QIosOptionalPluginInterface *>(plugins->instance(i));
m_viewController = [plugin->createImagePickerController(this) retain];
if (m_viewController)
break;
}
}
if (!m_viewController) {
qWarning() << "QIOSFileDialog: Could not resolve Qt plugin that gives access to photos on iOS";
return false;
}
UIWindow *window = parent ? reinterpret_cast<UIView *>(parent->winId()).window
: [UIApplication sharedApplication].keyWindow;
[window.rootViewController presentViewController:m_viewController animated:YES completion:nil];
return true;
}
void QIOSFileDialog::hide() void QIOSFileDialog::hide()
{ {
// QFileDialog will remember the last directory set, and open subsequent dialogs in the same // QFileDialog will remember the last directory set, and open subsequent dialogs in the same
@ -126,6 +111,8 @@ void QIOSFileDialog::hide()
emit directoryEntered(QUrl::fromLocalFile(QDir::currentPath())); emit directoryEntered(QUrl::fromLocalFile(QDir::currentPath()));
[m_viewController dismissViewControllerAnimated:YES completion:nil]; [m_viewController dismissViewControllerAnimated:YES completion:nil];
[m_viewController release];
m_viewController = Q_NULLPTR;
m_eventLoop.exit(); m_eventLoop.exit();
} }

View File

@ -44,8 +44,9 @@
#include <qpa/qplatformnativeinterface.h> #include <qpa/qplatformnativeinterface.h>
#include <qpa/qwindowsysteminterface.h> #include <qpa/qwindowsysteminterface.h>
#include <QtCore/private/qfactoryloader_p.h>
#include "qiosapplicationstate.h" #include "qiosapplicationstate.h"
#include "qiosfileenginefactory.h"
#ifndef Q_OS_TVOS #ifndef Q_OS_TVOS
#include "qiostextinputoverlay.h" #include "qiostextinputoverlay.h"
#endif #endif
@ -106,6 +107,8 @@ public:
void setDebugWindowManagement(bool); void setDebugWindowManagement(bool);
bool debugWindowManagement() const; bool debugWindowManagement() const;
QFactoryLoader *optionalPlugins() { return m_optionalPlugins; }
private: private:
QPlatformFontDatabase *m_fontDatabase; QPlatformFontDatabase *m_fontDatabase;
#ifndef Q_OS_TVOS #ifndef Q_OS_TVOS
@ -116,7 +119,7 @@ private:
QIOSApplicationState m_applicationState; QIOSApplicationState m_applicationState;
QIOSServices *m_platformServices; QIOSServices *m_platformServices;
mutable QPlatformAccessibility *m_accessibility; mutable QPlatformAccessibility *m_accessibility;
QIOSFileEngineFactory m_fileEngineFactory; QFactoryLoader *m_optionalPlugins;
#ifndef Q_OS_TVOS #ifndef Q_OS_TVOS
QIOSTextInputOverlay m_textInputOverlay; QIOSTextInputOverlay m_textInputOverlay;
#endif #endif

View File

@ -51,6 +51,7 @@
#include "qiosinputcontext.h" #include "qiosinputcontext.h"
#include "qiostheme.h" #include "qiostheme.h"
#include "qiosservices.h" #include "qiosservices.h"
#include "qiosoptionalplugininterface.h"
#include <QtGui/private/qguiapplication_p.h> #include <QtGui/private/qguiapplication_p.h>
@ -80,6 +81,7 @@ QIOSIntegration::QIOSIntegration()
, m_inputContext(0) , m_inputContext(0)
, m_platformServices(new QIOSServices) , m_platformServices(new QIOSServices)
, m_accessibility(0) , m_accessibility(0)
, m_optionalPlugins(new QFactoryLoader(QIosOptionalPluginInterface_iid, QLatin1String("/platforms/darwin")))
, m_debugWindowManagement(false) , m_debugWindowManagement(false)
{ {
if (Q_UNLIKELY(![UIApplication sharedApplication])) { if (Q_UNLIKELY(![UIApplication sharedApplication])) {
@ -124,6 +126,9 @@ QIOSIntegration::QIOSIntegration()
m_touchDevice->setCapabilities(touchCapabilities); m_touchDevice->setCapabilities(touchCapabilities);
QWindowSystemInterface::registerTouchDevice(m_touchDevice); QWindowSystemInterface::registerTouchDevice(m_touchDevice);
QMacInternalPasteboardMime::initializeMimeTypes(); QMacInternalPasteboardMime::initializeMimeTypes();
for (int i = 0; i < m_optionalPlugins->metaData().size(); ++i)
qobject_cast<QIosOptionalPluginInterface *>(m_optionalPlugins->instance(i))->initPlugin();
} }
QIOSIntegration::~QIOSIntegration() QIOSIntegration::~QIOSIntegration()
@ -148,6 +153,9 @@ QIOSIntegration::~QIOSIntegration()
delete m_accessibility; delete m_accessibility;
m_accessibility = 0; m_accessibility = 0;
delete m_optionalPlugins;
m_optionalPlugins = 0;
} }
bool QIOSIntegration::hasCapability(Capability cap) const bool QIOSIntegration::hasCapability(Capability cap) const

View File

@ -0,0 +1,59 @@
/****************************************************************************
**
** Copyright (C) 2016 The Qt Company Ltd.
** Contact: http://www.qt.io/licensing/
**
** This file is part of the plugins of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL21$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
** and conditions see http://www.qt.io/terms-conditions. For further
** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 or version 3 as published by the Free
** Software Foundation and appearing in the file LICENSE.LGPLv21 and
** LICENSE.LGPLv3 included in the packaging of this file. Please review the
** following information to ensure the GNU Lesser General Public License
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** As a special exception, The Qt Company gives you certain additional
** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
**
****************************************************************************/
#ifndef QIOPLUGININTERFACE_H
#define QIOPLUGININTERFACE_H
#include <QtCore/QtPlugin>
#include "qiosfiledialog.h"
QT_BEGIN_NAMESPACE
Q_FORWARD_DECLARE_OBJC_CLASS(UIViewController);
#define QIosOptionalPluginInterface_iid "org.qt-project.Qt.QPA.ios.optional"
class QIosOptionalPluginInterface
{
public:
virtual ~QIosOptionalPluginInterface() {}
virtual void initPlugin() const {};
virtual UIViewController* createImagePickerController(QIOSFileDialog *) const { return Q_NULLPTR; };
};
Q_DECLARE_INTERFACE(QIosOptionalPluginInterface, QIosOptionalPluginInterface_iid)
QT_END_NAMESPACE
#endif // QIOPLUGININTERFACE_H

View File

@ -214,8 +214,8 @@ QIOSScreen::QIOSScreen(UIScreen *screen)
else else
m_depth = 24; m_depth = 24;
if (deviceIdentifier.contains(QRegularExpression("^iPhone(7,1|8,2)$"))) { if (deviceIdentifier.contains(QRegularExpression("^iPhone(7,1|8,2|9,2|9,4)$"))) {
// iPhone 6 Plus or iPhone 6S Plus // iPhone Plus models
m_physicalDpi = 401; m_physicalDpi = 401;
} else if (deviceIdentifier.contains(QRegularExpression("^iPad(1,1|2,[1-4]|3,[1-6]|4,[1-3]|5,[3-4]|6,[7-8])$"))) { } else if (deviceIdentifier.contains(QRegularExpression("^iPad(1,1|2,[1-4]|3,[1-6]|4,[1-3]|5,[3-4]|6,[7-8])$"))) {
// All iPads except the iPad Mini series // All iPads except the iPad Mini series

View File

@ -994,7 +994,8 @@ QIOSTextInputOverlay::QIOSTextInputOverlay()
QIOSTextInputOverlay::~QIOSTextInputOverlay() QIOSTextInputOverlay::~QIOSTextInputOverlay()
{ {
disconnect(qApp, 0, this, 0); if (qApp)
disconnect(qApp, 0, this, 0);
} }
void QIOSTextInputOverlay::updateFocusObject() void QIOSTextInputOverlay::updateFocusObject()

View File

@ -58,7 +58,8 @@
#include <QtGui/QOpenGLContext> #include <QtGui/QOpenGLContext>
#include <QtGui/QScreen> #include <QtGui/QScreen>
#include <QtEglSupport/private/qt_egl_p.h> // this is where EGL headers are pulled in, make sure it is last
#include "qminimaleglscreen.h"
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE

Some files were not shown because too many files have changed in this diff Show More