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

This commit is contained in:
Liang Qi 2015-04-28 09:16:06 +00:00 committed by The Qt Project
commit a6f7dc521b
75 changed files with 867 additions and 404 deletions

View File

@ -47,7 +47,8 @@ my $stripModule = 0;
my $fixedFileCount = 0;
my $fileCount = 0;
my $verbose = 0;
my $qtdir = $ENV{'QTDIR'};
my $qtdir;
my $qtIncludeDir;
my $USAGE=<<EOF;
This script replaces all Qt 4 style includes with Qt 5 includes.
@ -114,44 +115,54 @@ sub fixHeaders
sub findQtHeaders
{
my ($dirName,$baseDir) = @_;
my ($dirName,$includeDir) = @_;
local (*DIR);
opendir(DIR, $baseDir . '/include/' . $dirName) || die ('Unable to open ' .$baseDir . '/include/' . $dirName . ': ' . $!);
my $moduleIncludeDir = $includeDir . '/' . $dirName;
opendir(DIR, $moduleIncludeDir) || die ('Unable to open ' . $moduleIncludeDir . ': ' . $!);
my @headers = readdir(DIR);
closedir(DIR);
foreach my $header (@headers) {
next if (-d ($baseDir . '/include/' . $dirName . '/' . $header) || $header =~ /\.pri$/);
next if (-d ($moduleIncludeDir . '/' . $header) || $header =~ /\.pri$/);
$headerSubst{$header} = $stripModule ? $header : ($dirName . '/' . $header);
}
}
# -------- MAIN
die "This script requires the QTDIR environment variable pointing to Qt 5\n" unless $qtdir;
if ($qtdir) {
$qtIncludeDir = $qtdir . '/include';
} else {
$qtIncludeDir = `qmake -query QT_INSTALL_HEADERS`;
chop($qtIncludeDir);
}
findQtHeaders('QtCore', $qtdir);
findQtHeaders('QtConcurrent', $qtdir);
findQtHeaders('QtWidgets', $qtdir);
findQtHeaders('QtPrintSupport', $qtdir);
die "The location of the Qt 5 include files could not be determined.\n"
."Please ensure qmake can be found in PATH or pass the command line option --qtdir.\n"
unless -d $qtIncludeDir;
if (-d $qtdir . '/include/QtMultimedia') {
findQtHeaders('QtMultimedia', $qtdir);
findQtHeaders('QtMultimediaWidgets', $qtdir);
} elsif (-d $qtdir . '/../qtmultimedia' ) {
findQtHeaders('QtCore', $qtIncludeDir);
findQtHeaders('QtConcurrent', $qtIncludeDir);
findQtHeaders('QtWidgets', $qtIncludeDir);
findQtHeaders('QtPrintSupport', $qtIncludeDir);
if (-d $qtIncludeDir . '/include/QtMultimedia') {
findQtHeaders('QtMultimedia', $qtIncludeDir);
findQtHeaders('QtMultimediaWidgets', $qtIncludeDir);
} elsif (-d $qtIncludeDir . '/../qtmultimedia' ) {
# This is the case if QTDIR points to a source tree instead of an installed Qt
findQtHeaders('QtMultimedia', $qtdir . '/../qtmultimedia');
findQtHeaders('QtMultimediaWidgets', $qtdir . '/../qtmultimedia');
findQtHeaders('QtMultimedia', $qtIncludeDir . '/../qtmultimedia');
findQtHeaders('QtMultimediaWidgets', $qtIncludeDir . '/../qtmultimedia');
}
# Support porting from "Qt 4.99" QtDeclarative to QtQuick (QQuickItem et al)
if (-d $qtdir . '/include/QtQuick') {
findQtHeaders('QtQuick', $qtdir);
} elsif (-d $qtdir . '/../qtdeclarative' ) {
if (-d $qtIncludeDir . '/include/QtQuick') {
findQtHeaders('QtQuick', $qtIncludeDir);
} elsif (-d $qtIncludeDir . '/../qtdeclarative' ) {
# This is the case if QTDIR points to a source tree instead of an installed Qt
findQtHeaders('QtQuick', $qtdir . '/../qtdeclarative');
findQtHeaders('QtQuick', $qtIncludeDir . '/../qtdeclarative');
}
# special case

9
configure vendored
View File

@ -357,12 +357,12 @@ compilerSupportsFlag()
int main() { return 0; }
EOF
if [ "$OPT_VERBOSE" = "yes" ]; then
"$@" -o conftest-out.o conftest.cpp
"$@" -o conftest-out conftest.cpp
else
"$@" -o conftest-out.o conftest.cpp >/dev/null 2>&1
"$@" -o conftest-out conftest.cpp >/dev/null 2>&1
fi
ret=$?
rm -f conftest.cpp conftest-out.o
rm -f conftest.cpp conftest-out
return $ret
}
@ -376,6 +376,9 @@ linkerSupportsFlag()
safe_flag=`shellEscape "$flag"`
lflags=$lflags,$safe_flag
done
if [ $CFG_USE_GOLD_LINKER = yes ]; then
lflags="-fuse-ld=gold $lflags"
fi
compilerSupportsFlag $compiler $lflags
}

View File

@ -24,6 +24,8 @@ load(cmake_functions)
CMAKE_INSTALL_LIBS_DIR = $$cmakeTargetPath($$[QT_INSTALL_LIBS])
contains(CMAKE_INSTALL_LIBS_DIR, ^(/usr)?/lib(64)?.*): CMAKE_USR_MOVE_WORKAROUND = $$CMAKE_INSTALL_LIBS_DIR
CMAKE_OUT_DIR = $$MODULE_BASE_OUTDIR/lib/cmake
CMAKE_MODULE_NAME = $$cmakeModuleName($${MODULE})
split_incpath {
@ -36,7 +38,7 @@ split_incpath {
$$QT_MODULE_INCLUDE_BASE/Qt$${CMAKE_MODULE_NAME}/$$eval(QT.$${MODULE}.VERSION)/Qt$${CMAKE_MODULE_NAME})
cmake_extra_source_includes.input = $$PWD/data/cmake/ExtraSourceIncludes.cmake.in
cmake_extra_source_includes.output = $$DESTDIR/cmake/Qt5$${CMAKE_MODULE_NAME}/ExtraSourceIncludes.cmake
cmake_extra_source_includes.output = $$CMAKE_OUT_DIR/Qt5$${CMAKE_MODULE_NAME}/ExtraSourceIncludes.cmake
!build_pass:QMAKE_SUBSTITUTES += \
cmake_extra_source_includes
@ -159,7 +161,7 @@ contains(CONFIG, plugin) {
}
}
cmake_target_file.input = $$PWD/data/cmake/Qt5PluginTarget.cmake.in
cmake_target_file.output = $$DESTDIR/../../$${CMAKE_LIB_DIR}cmake/Qt5$${CMAKE_MODULE_NAME}/Qt5$${CMAKE_MODULE_NAME}_$${PLUGIN_CLASS_NAME}.cmake
cmake_target_file.output = $$CMAKE_OUT_DIR/Qt5$${CMAKE_MODULE_NAME}/Qt5$${CMAKE_MODULE_NAME}_$${PLUGIN_CLASS_NAME}.cmake
!build_pass:QMAKE_SUBSTITUTES += \
cmake_target_file
@ -273,12 +275,12 @@ mac {
INSTALLS += cmake_qt5_module_files
cmake_config_file.input = $$PWD/data/cmake/Qt5BasicConfig.cmake.in
cmake_config_file.output = $$DESTDIR/cmake/Qt5$${CMAKE_MODULE_NAME}/Qt5$${CMAKE_MODULE_NAME}Config.cmake
cmake_config_file.output = $$CMAKE_OUT_DIR/Qt5$${CMAKE_MODULE_NAME}/Qt5$${CMAKE_MODULE_NAME}Config.cmake
CMAKE_PACKAGE_VERSION = $$eval(QT.$${MODULE}.VERSION)
cmake_config_version_file.input = $$PWD/data/cmake/Qt5ConfigVersion.cmake.in
cmake_config_version_file.output = $$DESTDIR/cmake/Qt5$${CMAKE_MODULE_NAME}/Qt5$${CMAKE_MODULE_NAME}ConfigVersion.cmake
cmake_config_version_file.output = $$CMAKE_OUT_DIR/Qt5$${CMAKE_MODULE_NAME}/Qt5$${CMAKE_MODULE_NAME}ConfigVersion.cmake
!build_pass:QMAKE_SUBSTITUTES += \
cmake_config_file \
@ -292,7 +294,7 @@ cmake_extras_file.input = $$_PRO_FILE_PWD_/Qt5$${CMAKE_MODULE_NAME}ConfigExtras.
exists($$cmake_extras_file.input) {
CMAKE_MODULE_EXTRAS = "true"
cmake_extras_file.output = $$DESTDIR/cmake/Qt5$${CMAKE_MODULE_NAME}/Qt5$${CMAKE_MODULE_NAME}ConfigExtras.cmake
cmake_extras_file.output = $$CMAKE_OUT_DIR/Qt5$${CMAKE_MODULE_NAME}/Qt5$${CMAKE_MODULE_NAME}ConfigExtras.cmake
!build_pass:QMAKE_SUBSTITUTES += cmake_extras_file
@ -304,7 +306,7 @@ cmake_macros_file.input = $$_PRO_FILE_PWD_/Qt5$${CMAKE_MODULE_NAME}Macros.cmake
exists($$cmake_macros_file.input) {
CMAKE_MODULE_MACROS = "true"
cmake_macros_file.output = $$DESTDIR/cmake/Qt5$${CMAKE_MODULE_NAME}/Qt5$${CMAKE_MODULE_NAME}Macros.cmake
cmake_macros_file.output = $$CMAKE_OUT_DIR/Qt5$${CMAKE_MODULE_NAME}/Qt5$${CMAKE_MODULE_NAME}Macros.cmake
cmake_macros_file.CONFIG = verbatim
!build_pass:QMAKE_SUBSTITUTES += cmake_macros_file

View File

@ -33,10 +33,12 @@ get_filename_component(_qt5$${CMAKE_MODULE_NAME}_install_prefix \"${CMAKE_CURREN
set(_qt5$${CMAKE_MODULE_NAME}_install_prefix \"$$[QT_INSTALL_PREFIX]\")
!!ENDIF
!!IF !equals(TEMPLATE, aux)
# For backwards compatibility only. Use Qt5$${CMAKE_MODULE_NAME}_VERSION instead.
set(Qt5$${CMAKE_MODULE_NAME}_VERSION_STRING "$$eval(QT.$${MODULE}.MAJOR_VERSION).$$eval(QT.$${MODULE}.MINOR_VERSION).$$eval(QT.$${MODULE}.PATCH_VERSION)")
set(Qt5$${CMAKE_MODULE_NAME}_LIBRARIES Qt5::$${CMAKE_MODULE_NAME})
!!ENDIF // TEMPLATE != aux
macro(_qt5_$${CMAKE_MODULE_NAME}_check_file_exists file)
if(NOT EXISTS \"${file}\" )
@ -230,9 +232,11 @@ if (NOT TARGET Qt5::$${CMAKE_MODULE_NAME})
add_library(Qt5::$${CMAKE_MODULE_NAME} SHARED IMPORTED)
!!ENDIF
!!ENDIF
!!IF !equals(TEMPLATE, aux)
!!IF !isEmpty(CMAKE_BUILD_IS_FRAMEWORK)
set_property(TARGET Qt5::$${CMAKE_MODULE_NAME} PROPERTY FRAMEWORK 1)
!!ENDIF
!!ENDIF // TEMPLATE != aux
set_property(TARGET Qt5::$${CMAKE_MODULE_NAME} PROPERTY
INTERFACE_INCLUDE_DIRECTORIES ${_Qt5$${CMAKE_MODULE_NAME}_OWN_INCLUDE_DIRS})

View File

@ -58,17 +58,22 @@ else: \
MODULE_DEFINE = QT_$${ucmodule}_LIB
MODULE_DEFINES = $$MODULE_DEFINE $$MODULE_DEFINES
load(qt_module_pris)
load(qt_build_paths)
#other
TEMPLATE = lib
DESTDIR = $$eval(QT.$${MODULE_ID}.libs)
win32:!wince*:!prefix_build: DLLDESTDIR = $$eval(QT.$${MODULE_ID}.bins)
qt_no_install_library {
TEMPLATE = aux
CONFIG += force_qt # Needed for the headers_clean tests.
} else {
TEMPLATE = lib
}
DESTDIR = $$MODULE_BASE_OUTDIR/lib
win32:!wince*:!prefix_build: DLLDESTDIR = $$MODULE_BASE_OUTDIR/bin
CONFIG += qmake_cache target_qt
QMAKE_DOCS_TARGETDIR = qt$${MODULE}
load(qt_module_pris)
load(qt_common)
!no_module_headers: load(qt_module_headers)

View File

@ -24,6 +24,10 @@ load(qt_build_paths)
-outdir $$system_quote($$MODULE_BASE_OUTDIR) $$MODULE_SYNCQT_DIR
!silent: message($$QMAKE_SYNCQT)
system($$QMAKE_SYNCQT)|error("Failed to run: $$QMAKE_SYNCQT")
include-distclean.commands = $$QMAKE_DEL_TREE $$shell_quote($$shell_path($$MODULE_BASE_OUTDIR/include/$$MODULE_INCNAME))
QMAKE_EXTRA_TARGETS += include-distclean
DISTCLEAN_DEPS += include-distclean
}
minimal_syncqt: return()
@ -41,11 +45,13 @@ for (injection, SYNCQT.INJECTIONS) {
MAIN_FWD = $$INC_PATH/include/$$MODULE_INCNAME/$$fwd_hdr
MAIN_FWD_CONT = '$${LITERAL_HASH}include "$$member(injects, 0)"'
write_file($$MAIN_FWD, MAIN_FWD_CONT)|error("Aborting.")
!git_build: QMAKE_DISTCLEAN += $$MAIN_FWD
injects = $$member(injects, 2, -1)
for (inject, injects) {
CLASS_FWD = $$INC_PATH/include/$$MODULE_INCNAME/$$inject
CLASS_FWD_CONT = '$${LITERAL_HASH}include "$$fwd_hdr"'
write_file($$CLASS_FWD, CLASS_FWD_CONT)|error("Aborting.")
!git_build: QMAKE_DISTCLEAN += $$CLASS_FWD
}
}
@ -65,6 +71,7 @@ MODULE_MASTER_DEPS_HEADER = $$MODULE_BASE_OUTDIR/include/$$MODULE_INCNAME/$${MOD
}
MODULE_MASTER_DEPS_HEADER_CONT += "$${LITERAL_HASH}endif"
write_file($$MODULE_MASTER_DEPS_HEADER, MODULE_MASTER_DEPS_HEADER_CONT)|error("Aborting.")
!git_build: QMAKE_DISTCLEAN += $$MODULE_MASTER_DEPS_HEADER
}
SYNCQT.HEADER_FILES += $$MODULE_MASTER_DEPS_HEADER

View File

@ -71,3 +71,21 @@ exists($$_PRO_FILE_PWD_/tests/tests.pro) {
QT_BUILD_PARTS -= libs tools examples tests
!isEmpty(QT_BUILD_PARTS): warning("Unknown build part(s): $$QT_BUILD_PARTS")
QMAKE_DISTCLEAN += \
.qmake.cache \
config.log \
mkspecs/modules/*.pri \
mkspecs/modules-inst/*.pri
tests = $$files($$_PRO_FILE_PWD_/config.tests/*.pro, true)
testdirs =
for (t, tests): \
testdirs += $$relative_path($$dirname(t), $$_PRO_FILE_PWD_)
testdirs = $$unique(testdirs)
for (td, testdirs) {
t = $$basename(td)-distclean
$${t}.commands = -cd $$shell_path($$td) && $(MAKE) distclean
QMAKE_EXTRA_TARGETS += $$t
DISTCLEAN_DEPS += $$t
}

View File

@ -123,9 +123,11 @@ clean::
distclean:: clean
$(RM_RF) .deps
$(RM_F) $(BUILD_PATH)/bin/qmake$(EXEEXT)
$(RM_F) Makefile
depend:
makedepend -D__MAKEDEPEND__ $(CPPFLAGS) $(DEPEND_SRC)
$(RM_F) Makefile.bak
ioutils.o: $(QMKLIBSRC)/ioutils.cpp

View File

@ -140,7 +140,9 @@ clean::
-del qmake.tds
distclean:: clean
-del qmake
-del qmake.exe
-del $(BUILD_PATH)\bin\qmake.exe
-del Makefile
.c.obj:
$(CXX) $(CFLAGS) $<

View File

@ -573,10 +573,12 @@ MakefileGenerator::init()
contentBytes = contents.toUtf8();
}
QFile out(outn);
QFileInfo outfi(out);
if (out.exists() && out.open(QFile::ReadOnly)) {
QByteArray old = out.readAll();
if (contentBytes == old) {
v["QMAKE_INTERNAL_INCLUDED_FILES"].append(in.fileName());
v["QMAKE_DISTCLEAN"].append(outfi.absoluteFilePath());
continue;
}
out.close();
@ -586,9 +588,10 @@ MakefileGenerator::init()
continue;
}
}
mkdir(QFileInfo(out).absolutePath());
mkdir(outfi.absolutePath());
if(out.open(QFile::WriteOnly)) {
v["QMAKE_INTERNAL_INCLUDED_FILES"].append(in.fileName());
v["QMAKE_DISTCLEAN"].append(outfi.absoluteFilePath());
out.write(contentBytes);
} else {
warn_msg(WarnLogic, "Cannot open substitute for output '%s'",
@ -1121,6 +1124,7 @@ MakefileGenerator::writePrlFile()
if(ft.open(QIODevice::WriteOnly)) {
project->values("ALL_DEPS").append(prl);
project->values("QMAKE_INTERNAL_PRL_FILE").append(prl);
project->values("QMAKE_DISTCLEAN").append(prl);
QTextStream t(&ft);
writePrlFile(t);
}
@ -1850,8 +1854,12 @@ MakefileGenerator::writeExtraCompilerTargets(QTextStream &t)
t << endl;
if (config.indexOf("no_clean") == -1) {
const ProStringList &raw_clean = project->values(ProKey(*it + ".clean"));
QString tmp_clean = escapeFilePaths(raw_clean).join(' ');
QStringList raw_clean = project->values(ProKey(*it + ".clean")).toQStringList();
if (raw_clean.isEmpty())
raw_clean << tmp_out;
QString tmp_clean;
foreach (const QString &rc, raw_clean)
tmp_clean += ' ' + escapeFilePath(Option::fixPathToTargetOS(rc));
QString tmp_clean_cmds = project->values(ProKey(*it + ".clean_commands")).join(' ');
if(!tmp_inputs.isEmpty())
clean_targets += QString("compiler_" + (*it) + "_clean ");
@ -1863,14 +1871,11 @@ MakefileGenerator::writeExtraCompilerTargets(QTextStream &t)
t << "\n\t" << tmp_clean_cmds;
wrote_clean_cmds = true;
}
if(tmp_clean.isEmpty())
tmp_clean = escapeFilePath(tmp_out);
if(tmp_clean.indexOf("${QMAKE_") == -1) {
t << "\n\t-$(DEL_FILE) " << tmp_clean;
t << "\n\t-$(DEL_FILE)" << tmp_clean;
wrote_clean = true;
}
if(!wrote_clean_cmds || !wrote_clean) {
QStringList q_raw_clean = raw_clean.toQStringList();
QStringList cleans;
const QString del_statement("-$(DEL_FILE)");
if(!wrote_clean) {
@ -1878,7 +1883,7 @@ MakefileGenerator::writeExtraCompilerTargets(QTextStream &t)
for (ProStringList::ConstIterator input = tmp_inputs.begin(); input != tmp_inputs.end(); ++input) {
QString tinp = (*input).toQString();
QString out = replaceExtraCompilerVariables(tmp_out, tinp, QString(), NoShell);
foreach (const QString &rc, q_raw_clean) {
foreach (const QString &rc, raw_clean) {
dels << ' ' + escapeFilePath(Option::fixPathToTargetOS(
replaceExtraCompilerVariables(rc, tinp, out, NoShell), false));
}
@ -2569,11 +2574,11 @@ MakefileGenerator::writeSubTargets(QTextStream &t, QList<MakefileGenerator::SubT
t << " " << targetRule;
}
if(suffix == "all" || suffix == "make_first")
t << depVar("ALL_DEPS");
t << ' ' << depVar("ALL_DEPS");
if(suffix == "clean")
t << depVar("CLEAN_DEPS");
t << ' ' << depVar("CLEAN_DEPS");
else if (suffix == "distclean")
t << depVar("DISTCLEAN_DEPS");
t << ' ' << depVar("DISTCLEAN_DEPS");
t << " FORCE\n";
if(suffix == "clean") {
t << fixFileVarGlue("QMAKE_CLEAN", "\t-$(DEL_FILE) ", "\n\t-$(DEL_FILE) ", "\n");
@ -3159,7 +3164,9 @@ MakefileGenerator::writePkgConfigFile()
QFile ft(fname);
if(!ft.open(QIODevice::WriteOnly))
return;
project->values("ALL_DEPS").append(fileFixify(fname));
QString ffname(fileFixify(fname));
project->values("ALL_DEPS").append(ffname);
project->values("QMAKE_DISTCLEAN").append(ffname);
QTextStream t(&ft);
QString prefix = pkgConfigPrefix();

View File

@ -1041,9 +1041,9 @@ UnixMakefileGenerator::writeMakeParts(QTextStream &t)
t << "\t-$(DEL_FILE) -r " << bundlePath << endl;
} else if(project->isActiveConfig("compile_libtool")) {
t << "\t-$(LIBTOOL) --mode=clean $(DEL_FILE) $(TARGET)\n";
} else if (project->isActiveConfig("staticlib")) {
} else if (project->isActiveConfig("staticlib") || project->isActiveConfig("plugin")) {
t << "\t-$(DEL_FILE) " << escapeFilePath(destdir) << "$(TARGET) \n";
} else if (project->values("QMAKE_APP_FLAG").isEmpty() && !project->isActiveConfig("plugin")) {
} else if (project->values("QMAKE_APP_FLAG").isEmpty()) {
destdir = escapeFilePath(destdir);
t << "\t-$(DEL_FILE) " << destdir << "$(TARGET) \n";
if (!project->isActiveConfig("unversioned_libname")) {
@ -1160,10 +1160,9 @@ void UnixMakefileGenerator::init2()
if(project->isEmpty("QMAKE_FRAMEWORK_VERSION"))
project->values("QMAKE_FRAMEWORK_VERSION").append(project->first("VER_MAJ"));
if (project->first("TEMPLATE") == "aux")
return;
if (!project->values("QMAKE_APP_FLAG").isEmpty()) {
if (project->first("TEMPLATE") == "aux") {
// nothing
} else if (!project->values("QMAKE_APP_FLAG").isEmpty()) {
if(!project->isEmpty("QMAKE_BUNDLE")) {
ProString bundle_loc = project->first("QMAKE_BUNDLE_LOCATION");
if(!bundle_loc.isEmpty() && !bundle_loc.startsWith("/"))
@ -1335,7 +1334,7 @@ void UnixMakefileGenerator::init2()
project->values("QMAKE_LINK_SHLIB_CMD").append(
"$(LINK) $(LFLAGS) " + project->first("QMAKE_LINK_O_FLAG") + "$(TARGET) $(OBJECTS) $(LIBS) $(OBJCOMP)");
}
if (!project->values("QMAKE_APP_FLAG").isEmpty()) {
if (!project->values("QMAKE_APP_FLAG").isEmpty() || project->first("TEMPLATE") == "aux") {
project->values("QMAKE_CFLAGS") += project->values("QMAKE_CFLAGS_APP");
project->values("QMAKE_CXXFLAGS") += project->values("QMAKE_CXXFLAGS_APP");
project->values("QMAKE_LFLAGS") += project->values("QMAKE_LFLAGS_APP");
@ -1412,7 +1411,9 @@ UnixMakefileGenerator::writeLibtoolFile()
QFile ft(fname);
if(!ft.open(QIODevice::WriteOnly))
return;
project->values("ALL_DEPS").append(fileFixify(fname));
QString ffname(fileFixify(fname));
project->values("ALL_DEPS").append(ffname);
project->values("QMAKE_DISTCLEAN").append(ffname);
QTextStream t(&ft);
t << "# " << lname << " - a libtool library file\n";

View File

@ -421,6 +421,24 @@ bool VcprojGenerator::isStandardSuffix(const QString &suffix) const
return false;
}
ProString VcprojGenerator::firstInputFileName(const ProString &extraCompilerName) const
{
foreach (const ProString &var, project->values(ProKey(extraCompilerName + ".input"))) {
const ProStringList &files = project->values(var.toKey());
if (!files.isEmpty())
return files.first();
}
return ProString();
}
QString VcprojGenerator::firstExpandedOutputFileName(const ProString &extraCompilerName)
{
const ProString firstOutput = project->first(ProKey(extraCompilerName + ".output"));
return replaceExtraCompilerVariables(firstOutput.toQString(),
firstInputFileName(extraCompilerName).toQString(),
QString(), NoShell);
}
ProStringList VcprojGenerator::collectDependencies(QMakeProject *proj, QHash<QString, QString> &projLookup,
QHash<QString, QString> &projGuids,
QHash<VcsolutionDepend *, QStringList> &extraSubdirs,
@ -1642,10 +1660,9 @@ void VcprojGenerator::initExtraCompilerOutputs()
extraCompile.Filter = "";
extraCompile.Guid = QString(_GUIDExtraCompilerFiles) + "-" + (*it);
// If the extra compiler has a variable_out set the output file
// is added to an other file list, and does not need its own..
bool addOnInput = hasBuiltinCompiler(project->first(ProKey(*it + ".output")).toQString());
bool addOnInput = hasBuiltinCompiler(firstExpandedOutputFileName(*it));
const ProString &tmp_other_out = project->first(ProKey(*it + ".variable_out"));
if (!tmp_other_out.isEmpty() && !addOnInput)
continue;

View File

@ -76,10 +76,8 @@ protected:
virtual VCProjectWriter *createProjectWriter();
virtual bool doDepends() const { return false; } //never necesary
virtual void processSources() { filterIncludedFiles("SOURCES"); filterIncludedFiles("GENERATED_SOURCES"); }
using MakefileGenerator::ReplaceFor;
using Win32MakefileGenerator::replaceExtraCompilerVariables;
virtual QString replaceExtraCompilerVariables(const QString &, const QStringList &, const QStringList &, ReplaceFor);
inline QString replaceExtraCompilerVariables(const QString &val, const QString &in, const QString &out, ReplaceFor forShell)
{ return MakefileGenerator::replaceExtraCompilerVariables(val, in, out, forShell); }
virtual bool supportsMetaBuild() { return true; }
virtual bool supportsMergedBuilds() { return true; }
virtual bool mergeBuildProject(MakefileGenerator *other);
@ -135,6 +133,8 @@ private:
QUuid increaseUUID(const QUuid &id);
QString retrievePlatformToolSet() const;
bool isStandardSuffix(const QString &suffix) const;
ProString firstInputFileName(const ProString &extraCompilerName) const;
QString firstExpandedOutputFileName(const ProString &extraCompilerName);
friend class VCFilter;
};

View File

@ -8,62 +8,30 @@ SUBDIRS += qmake/qmake-docs.pro
cross_compile: CONFIG += nostrip
confclean.depends += clean
confclean.commands =
unix {
confclean.commands += (cd config.tests/unix/stl && $(MAKE) distclean); \
(cd config.tests/unix/ptrsize && $(MAKE) distclean); \
(cd config.tests/x11/notype && $(MAKE) distclean); \
(cd config.tests/unix/getaddrinfo && $(MAKE) distclean); \
(cd config.tests/unix/cups && $(MAKE) distclean); \
(cd config.tests/unix/psql && $(MAKE) distclean); \
(cd config.tests/unix/mysql && $(MAKE) distclean); \
(cd config.tests/unix/mysql_r && $(MAKE) distclean); \
(cd config.tests/unix/nis && $(MAKE) distclean); \
(cd config.tests/unix/iodbc && $(MAKE) distclean); \
(cd config.tests/unix/odbc && $(MAKE) distclean); \
(cd config.tests/unix/oci && $(MAKE) distclean); \
(cd config.tests/unix/tds && $(MAKE) distclean); \
(cd config.tests/unix/db2 && $(MAKE) distclean); \
(cd config.tests/unix/ibase && $(MAKE) distclean); \
(cd config.tests/unix/ipv6ifname && $(MAKE) distclean); \
(cd config.tests/unix/zlib && $(MAKE) distclean); \
(cd config.tests/unix/sqlite2 && $(MAKE) distclean); \
(cd config.tests/unix/libjpeg && $(MAKE) distclean); \
(cd config.tests/unix/libpng && $(MAKE) distclean); \
(cd config.tests/unix/slog2 && $(MAKE) distclean); \
(cd config.tests/unix/lgmon && $(MAKE) distclean); \
(cd config.tests/x11/xcursor && $(MAKE) distclean); \
(cd config.tests/x11/xrender && $(MAKE) distclean); \
(cd config.tests/x11/xrandr && $(MAKE) distclean); \
(cd config.tests/x11/xkb && $(MAKE) distclean); \
(cd config.tests/x11/xinput && $(MAKE) distclean); \
(cd config.tests/x11/fontconfig && $(MAKE) distclean); \
(cd config.tests/x11/xinerama && $(MAKE) distclean); \
(cd config.tests/x11/xshape && $(MAKE) distclean); \
(cd config.tests/x11/opengl && $(MAKE) distclean); \
$(DEL_FILE) config.tests/.qmake.cache; \
$(DEL_FILE) src/corelib/global/qconfig.h; \
$(DEL_FILE) src/corelib/global/qconfig.cpp; \
$(DEL_FILE) mkspecs/qconfig.pri; \
$(DEL_FILE) mkspecs/qdevice.pri; \
$(DEL_FILE) mkspecs/qmodule.pri; \
$(DEL_FILE) .qmake.cache; \
(cd qmake && $(MAKE) distclean);
}
win32 {
confclean.commands += -$(DEL_FILE) src\\corelib\\global\\qconfig.h $$escape_expand(\\n\\t) \
-$(DEL_FILE) src\\corelib\\global\\qconfig.cpp $$escape_expand(\\n\\t) \
-$(DEL_FILE) mkspecs\\qconfig.pri $$escape_expand(\\n\\t) \
-$(DEL_FILE) mkspecs\\qdevice.pri $$escape_expand(\\n\\t) \
-$(DEL_FILE) mkspecs\\qmodule.pri $$escape_expand(\\n\\t) \
-$(DEL_FILE) .qmake.cache $$escape_expand(\\n\\t) \
(cd qmake && $(MAKE) distclean)
}
confclean.depends += distclean
confclean.commands = echo The confclean target is obsolete. Please use distclean instead.
QMAKE_EXTRA_TARGETS += confclean
qmakeclean.commands += (cd qmake && $(MAKE) clean)
QMAKE_EXTRA_TARGETS += qmakeclean
CLEAN_DEPS += qmakeclean
qmake-clean.commands += (cd qmake && $(MAKE) clean)
QMAKE_EXTRA_TARGETS += qmake-clean
CLEAN_DEPS += qmake-clean
# We don't distclean qmake, as it may be needed for rebuilding Makefiles as a
# recursive distclean proceeds, including beyond qtbase.
DISTCLEAN_DEPS += qmake-clean
# Files created by configure.
# config.status (and configure.cache, which is the same for Windows)
# are omitted for convenience of rebuilds.
QMAKE_DISTCLEAN += \
config.summary \
config.tests/.qmake.cache \
mkspecs/qconfig.pri \
mkspecs/qdevice.pri \
mkspecs/qmodule.pri \
src/corelib/global/qconfig.h \
src/corelib/global/qconfig.cpp \
bin/qt.conf
CONFIG -= qt
@ -186,6 +154,14 @@ FWD_QTCONFIG = \
'$${LITERAL_HASH}include "qconfig.h"'
write_file($$OUT_PWD/include/QtCore/QtConfig, FWD_QTCONFIG)|error("Aborting.")
# Files created by us
QMAKE_DISTCLEAN += \
src/corelib/global/qfeatures.h \
include/QtCore/qfeatures.h \
mkspecs/qfeatures.pri \
include/QtCore/qconfig.h \
include/QtCore/QtConfig
#mkspecs
mkspecs.path = $$[QT_HOST_DATA]/mkspecs
mkspecs.files = \

View File

@ -106,7 +106,7 @@
# if defined(WINCE) || defined(_WIN32_WCE)
# define Q_OS_WINCE
# elif defined(WINAPI_FAMILY)
# if WINAPI_FAMILY==WINAPI_FAMILY_PHONE_APP
# if defined(WINAPI_FAMILY_PHONE_APP) && WINAPI_FAMILY==WINAPI_FAMILY_PHONE_APP
# define Q_OS_WINPHONE
# define Q_OS_WINRT
# elif WINAPI_FAMILY==WINAPI_FAMILY_APP

View File

@ -239,7 +239,7 @@ bool QDirSortItemComparator::operator()(const QDirSortItem &n1, const QDirSortIt
break;
}
case QDir::Size:
r = int(qBound<qint64>(-1, f2->item.size() - f1->item.size(), 1));
r = f2->item.size() - f1->item.size();
break;
case QDir::Type:
{

View File

@ -48,6 +48,12 @@ static inline QByteArray localHostName()
return qgetenv("COMPUTERNAME");
}
static inline bool fileExists(const wchar_t *fileName)
{
WIN32_FILE_ATTRIBUTE_DATA data;
return GetFileAttributesEx(fileName, GetFileExInfoStandard, &data);
}
QLockFile::LockError QLockFilePrivate::tryLock_sys()
{
const QFileSystemEntry fileEntry(fileName);
@ -79,8 +85,13 @@ QLockFile::LockError QLockFilePrivate::tryLock_sys()
case ERROR_SHARING_VIOLATION:
case ERROR_ALREADY_EXISTS:
case ERROR_FILE_EXISTS:
case ERROR_ACCESS_DENIED: // readonly file, or file still in use by another process. Assume the latter, since we don't create it readonly.
return QLockFile::LockFailedError;
case ERROR_ACCESS_DENIED:
// readonly file, or file still in use by another process.
// Assume the latter if the file exists, since we don't create it readonly.
return fileExists((const wchar_t*)fileEntry.nativeFilePath().utf16())
? QLockFile::LockFailedError
: QLockFile::PermissionError;
default:
qWarning() << "Got unexpected locking error" << lastError;
return QLockFile::UnknownError;

View File

@ -198,7 +198,7 @@ static inline bool isDescendant(const QAbstractState *state1, const QAbstractSta
static bool containsDecendantOf(const QSet<QAbstractState *> &states, const QAbstractState *node)
{
Q_FOREACH (QAbstractState *s, states)
foreach (QAbstractState *s, states)
if (isDescendant(s, node))
return true;
@ -490,11 +490,11 @@ void QStateMachinePrivate::removeConflictingTransitions(QList<QAbstractTransitio
filteredTransitions.reserve(enabledTransitions.size());
std::sort(enabledTransitions.begin(), enabledTransitions.end(), transitionStateEntryLessThan);
Q_FOREACH (QAbstractTransition *t1, enabledTransitions) {
foreach (QAbstractTransition *t1, enabledTransitions) {
bool t1Preempted = false;
QVarLengthArray<QAbstractTransition *> transitionsToRemove;
QSet<QAbstractState*> exitSetT1 = computeExitSet_Unordered(QList<QAbstractTransition*>() << t1);
Q_FOREACH (QAbstractTransition *t2, filteredTransitions) {
foreach (QAbstractTransition *t2, filteredTransitions) {
QSet<QAbstractState*> exitSetT2 = computeExitSet_Unordered(QList<QAbstractTransition*>() << t2);
if (!exitSetT1.intersect(exitSetT2).isEmpty()) {
if (isDescendant(t1->sourceState(), t2->sourceState())) {
@ -506,7 +506,7 @@ void QStateMachinePrivate::removeConflictingTransitions(QList<QAbstractTransitio
}
}
if (!t1Preempted) {
Q_FOREACH (QAbstractTransition *t3, transitionsToRemove)
foreach (QAbstractTransition *t3, transitionsToRemove)
filteredTransitions.removeAll(t3);
filteredTransitions.append(t1);
}
@ -615,7 +615,7 @@ QSet<QAbstractState*> QStateMachinePrivate::computeExitSet_Unordered(const QList
Q_ASSERT(domain != 0);
}
Q_FOREACH (QAbstractState* s, configuration) {
foreach (QAbstractState* s, configuration) {
if (isDescendant(s, domain))
statesToExit.insert(s);
}
@ -685,14 +685,14 @@ QList<QAbstractState*> QStateMachinePrivate::computeEntrySet(const QList<QAbstra
{
QSet<QAbstractState*> statesToEnter;
if (pendingErrorStates.isEmpty()) {
Q_FOREACH (QAbstractTransition *t, enabledTransitions) {
Q_FOREACH (QAbstractState *s, t->targetStates()) {
foreach (QAbstractTransition *t, enabledTransitions) {
foreach (QAbstractState *s, t->targetStates()) {
addDescendantStatesToEnter(s, statesToEnter, statesForDefaultEntry);
}
QList<QAbstractState *> effectiveTargetStates = getEffectiveTargetStates(t).toList();
QAbstractState *ancestor = getTransitionDomain(t, effectiveTargetStates);
Q_FOREACH (QAbstractState *s, effectiveTargetStates) {
foreach (QAbstractState *s, effectiveTargetStates) {
addAncestorStatesToEnter(s, ancestor, statesToEnter, statesForDefaultEntry);
}
}
@ -738,7 +738,7 @@ QAbstractState *QStateMachinePrivate::getTransitionDomain(QAbstractTransition *t
if (QState *tSource = t->sourceState()) {
if (isCompound(tSource)) {
bool allDescendants = true;
Q_FOREACH (QAbstractState *s, effectiveTargetStates) {
foreach (QAbstractState *s, effectiveTargetStates) {
if (!isDescendant(s, tSource)) {
allDescendants = false;
break;
@ -970,9 +970,9 @@ void QStateMachinePrivate::addDescendantStatesToEnter(QAbstractState *state,
if (QHistoryState *h = toHistoryState(state)) {
QList<QAbstractState*> historyConfiguration = QHistoryStatePrivate::get(h)->configuration;
if (!historyConfiguration.isEmpty()) {
Q_FOREACH (QAbstractState *s, historyConfiguration)
foreach (QAbstractState *s, historyConfiguration)
addDescendantStatesToEnter(s, statesToEnter, statesForDefaultEntry);
Q_FOREACH (QAbstractState *s, historyConfiguration)
foreach (QAbstractState *s, historyConfiguration)
addAncestorStatesToEnter(s, state->parentState(), statesToEnter, statesForDefaultEntry);
#ifdef QSTATEMACHINE_DEBUG
@ -988,9 +988,9 @@ void QStateMachinePrivate::addDescendantStatesToEnter(QAbstractState *state,
if (defaultHistoryContent.isEmpty()) {
setError(QStateMachine::NoDefaultStateInHistoryStateError, h);
} else {
Q_FOREACH (QAbstractState *s, defaultHistoryContent)
foreach (QAbstractState *s, defaultHistoryContent)
addDescendantStatesToEnter(s, statesToEnter, statesForDefaultEntry);
Q_FOREACH (QAbstractState *s, defaultHistoryContent)
foreach (QAbstractState *s, defaultHistoryContent)
addAncestorStatesToEnter(s, state->parentState(), statesToEnter, statesForDefaultEntry);
#ifdef QSTATEMACHINE_DEBUG
qDebug() << q_func() << ": initial history targets for" << state << ':' << defaultHistoryContent;
@ -1021,7 +1021,7 @@ void QStateMachinePrivate::addDescendantStatesToEnter(QAbstractState *state,
}
} else if (isParallel(state)) {
QState *grp = toStandardState(state);
Q_FOREACH (QAbstractState *child, QStatePrivate::get(grp)->childStates()) {
foreach (QAbstractState *child, QStatePrivate::get(grp)->childStates()) {
if (!containsDecendantOf(statesToEnter, child))
addDescendantStatesToEnter(child, statesToEnter, statesForDefaultEntry);
}
@ -1044,12 +1044,12 @@ void QStateMachinePrivate::addAncestorStatesToEnter(QAbstractState *s, QAbstract
QSet<QAbstractState*> &statesToEnter,
QSet<QAbstractState*> &statesForDefaultEntry)
{
Q_FOREACH (QState *anc, getProperAncestors(s, ancestor)) {
foreach (QState *anc, getProperAncestors(s, ancestor)) {
if (!anc->parentState())
continue;
statesToEnter.insert(anc);
if (isParallel(anc)) {
Q_FOREACH (QAbstractState *child, QStatePrivate::get(anc)->childStates()) {
foreach (QAbstractState *child, QStatePrivate::get(anc)->childStates()) {
if (!containsDecendantOf(statesToEnter, child))
addDescendantStatesToEnter(child, statesToEnter, statesForDefaultEntry);
}

View File

@ -528,12 +528,8 @@ QDebug operator<<(QDebug dbg, const QPointF &p)
/*!
\fn bool QPointF::isNull() const
Returns \c true if both the x and y coordinates are set to +0.0;
otherwise returns \c false.
\note Since this function treats +0.0 and -0.0 differently, points
with zero-valued coordinates where either or both values have a
negative sign are not defined to be null points.
Returns \c true if both the x and y coordinates are set to 0.0 (ignoring
the sign); otherwise returns \c false.
*/

View File

@ -517,12 +517,8 @@ QDebug operator<<(QDebug dbg, const QSize &s)
/*!
\fn bool QSizeF::isNull() const
Returns \c true if both the width and height are +0.0; otherwise returns
false.
\note Since this function treats +0.0 and -0.0 differently, sizes with
zero width and height where either or both values have a negative
sign are not defined to be null sizes.
Returns \c true if both the width and height are 0.0 (ignoring the sign);
otherwise returns \c false.
\sa isValid(), isEmpty()
*/

View File

@ -608,16 +608,23 @@ Q_OUTOFLINE_TEMPLATE T QVector<T>::value(int i, const T &defaultValue) const
template <typename T>
void QVector<T>::append(const T &t)
{
const T copy(t);
const bool isTooSmall = uint(d->size + 1) > d->alloc;
if (!isDetached() || isTooSmall) {
const T copy(t);
QArrayData::AllocationOptions opt(isTooSmall ? QArrayData::Grow : QArrayData::Default);
reallocData(d->size, isTooSmall ? d->size + 1 : d->alloc, opt);
if (QTypeInfo<T>::isComplex)
new (d->end()) T(copy);
else
*d->end() = copy;
} else {
if (QTypeInfo<T>::isComplex)
new (d->end()) T(t);
else
*d->end() = t;
}
if (QTypeInfo<T>::isComplex)
new (d->end()) T(copy);
else
*d->end() = copy;
++d->size;
}

View File

@ -2924,14 +2924,22 @@ template<class T> inline void do_mirror_data(QImageData *dst, QImageData *src,
if (dst == src) {
// When mirroring in-place, stop in the middle for one of the directions, since we
// are swapping the bytes instead of merely copying.
const int srcXEnd = dstX0 ? w / 2 : w;
const int srcYEnd = !dstX0 && dstY0 ? h / 2 : h;
const int srcXEnd = (dstX0 && !dstY0) ? w / 2 : w;
const int srcYEnd = dstY0 ? h / 2 : h;
for (int srcY = 0, dstY = dstY0; srcY < srcYEnd; ++srcY, dstY += dstYIncr) {
T *srcPtr = (T *) (src->data + srcY * src->bytes_per_line);
T *dstPtr = (T *) (dst->data + dstY * dst->bytes_per_line);
for (int srcX = 0, dstX = dstX0; srcX < srcXEnd; ++srcX, dstX += dstXIncr)
std::swap(srcPtr[srcX], dstPtr[dstX]);
}
// If mirroring both ways, the middle line needs to be mirrored horizontally only.
if (dstX0 && dstY0 && (h & 1)) {
int srcY = h / 2;
int srcXEnd2 = w / 2;
T *srcPtr = (T *) (src->data + srcY * src->bytes_per_line);
for (int srcX = 0, dstX = dstX0; srcX < srcXEnd2; ++srcX, dstX += dstXIncr)
std::swap(srcPtr[srcX], srcPtr[dstX]);
}
} else {
for (int srcY = 0, dstY = dstY0; srcY < h; ++srcY, dstY += dstYIncr) {
T *srcPtr = (T *) (src->data + srcY * src->bytes_per_line);

View File

@ -117,7 +117,7 @@ static const uint *QT_FASTCALL convertRGB32ToARGB32PM(uint *buffer, const uint *
return buffer;
}
#if defined(QT_COMPILER_SUPPORTS_SSE4_1) && !defined(__SSE4_1__)
#ifdef QT_COMPILER_SUPPORTS_SSE4_1
extern const uint *QT_FASTCALL convertRGB32FromARGB32PM_sse4(uint *buffer, const uint *src, int count, const QPixelLayout *, const QRgb *);
#endif
@ -144,7 +144,7 @@ void convert_generic(QImageData *dest, const QImageData *src, Qt::ImageConversio
if (src->format == QImage::Format_RGB32)
convertToARGB32PM = convertRGB32ToARGB32PM;
if (dest->format == QImage::Format_RGB32) {
#if defined(QT_COMPILER_SUPPORTS_SSE4_1) && !defined(__SSE4_1__)
#ifdef QT_COMPILER_SUPPORTS_SSE4_1
if (qCpuHasFeature(SSE4_1))
convertFromARGB32PM = convertRGB32FromARGB32PM_sse4;
else
@ -193,7 +193,7 @@ bool convert_generic_inplace(QImageData *data, QImage::Format dst_format, Qt::Im
if (data->format == QImage::Format_RGB32)
convertToARGB32PM = convertRGB32ToARGB32PM;
if (dst_format == QImage::Format_RGB32) {
#if defined(QT_COMPILER_SUPPORTS_SSE4_1) && !defined(__SSE4_1__)
#ifdef QT_COMPILER_SUPPORTS_SSE4_1
if (qCpuHasFeature(SSE4_1))
convertFromARGB32PM = convertRGB32FromARGB32PM_sse4;
else

View File

@ -33,6 +33,7 @@
#include <qimage.h>
#include <private/qdrawhelper_p.h>
#include <private/qdrawingprimitive_sse2_p.h>
#include <private/qimage_p.h>
#include <private/qsimd_p.h>
@ -44,7 +45,7 @@ const uint *QT_FASTCALL convertRGB32FromARGB32PM_sse4(uint *buffer, const uint *
const QPixelLayout *, const QRgb *)
{
for (int i = 0; i < count; ++i)
buffer[i] = 0xff000000 | qUnpremultiply(src[i]);
buffer[i] = 0xff000000 | qUnpremultiply_sse4(src[i]);
return buffer;
}

View File

@ -47,7 +47,6 @@ class QGenericMatrix
public:
QGenericMatrix();
explicit QGenericMatrix(Qt::Initialization) {}
QGenericMatrix(const QGenericMatrix<N, M, T>& other);
explicit QGenericMatrix(const T *values);
const T& operator()(int row, int column) const;
@ -93,8 +92,6 @@ private:
#endif
T m[N][M]; // Column-major order to match OpenGL.
explicit QGenericMatrix(int) {} // Construct without initializing identity matrix.
#if !defined(Q_NO_TEMPLATE_FRIENDS)
template <int NN, int MM, typename TT>
friend class QGenericMatrix;
@ -107,14 +104,6 @@ Q_INLINE_TEMPLATE QGenericMatrix<N, M, T>::QGenericMatrix()
setToIdentity();
}
template <int N, int M, typename T>
Q_INLINE_TEMPLATE QGenericMatrix<N, M, T>::QGenericMatrix(const QGenericMatrix<N, M, T>& other)
{
for (int col = 0; col < N; ++col)
for (int row = 0; row < M; ++row)
m[col][row] = other.m[col][row];
}
template <int N, int M, typename T>
Q_OUTOFLINE_TEMPLATE QGenericMatrix<N, M, T>::QGenericMatrix(const T *values)
{
@ -178,7 +167,7 @@ Q_OUTOFLINE_TEMPLATE void QGenericMatrix<N, M, T>::fill(T value)
template <int N, int M, typename T>
Q_OUTOFLINE_TEMPLATE QGenericMatrix<M, N, T> QGenericMatrix<N, M, T>::transposed() const
{
QGenericMatrix<M, N, T> result(1);
QGenericMatrix<M, N, T> result(Qt::Uninitialized);
for (int row = 0; row < M; ++row)
for (int col = 0; col < N; ++col)
result.m[row][col] = m[col][row];
@ -246,7 +235,7 @@ Q_OUTOFLINE_TEMPLATE QGenericMatrix<N, M, T>& QGenericMatrix<N, M, T>::operator/
template <int N, int M, typename T>
Q_OUTOFLINE_TEMPLATE QGenericMatrix<N, M, T> operator+(const QGenericMatrix<N, M, T>& m1, const QGenericMatrix<N, M, T>& m2)
{
QGenericMatrix<N, M, T> result(1);
QGenericMatrix<N, M, T> result(Qt::Uninitialized);
for (int row = 0; row < M; ++row)
for (int col = 0; col < N; ++col)
result.m[col][row] = m1.m[col][row] + m2.m[col][row];
@ -256,7 +245,7 @@ Q_OUTOFLINE_TEMPLATE QGenericMatrix<N, M, T> operator+(const QGenericMatrix<N, M
template <int N, int M, typename T>
Q_OUTOFLINE_TEMPLATE QGenericMatrix<N, M, T> operator-(const QGenericMatrix<N, M, T>& m1, const QGenericMatrix<N, M, T>& m2)
{
QGenericMatrix<N, M, T> result(1);
QGenericMatrix<N, M, T> result(Qt::Uninitialized);
for (int row = 0; row < M; ++row)
for (int col = 0; col < N; ++col)
result.m[col][row] = m1.m[col][row] - m2.m[col][row];
@ -266,7 +255,7 @@ Q_OUTOFLINE_TEMPLATE QGenericMatrix<N, M, T> operator-(const QGenericMatrix<N, M
template <int N, int M1, int M2, typename T>
Q_OUTOFLINE_TEMPLATE QGenericMatrix<M1, M2, T> operator*(const QGenericMatrix<N, M2, T>& m1, const QGenericMatrix<M1, N, T>& m2)
{
QGenericMatrix<M1, M2, T> result(1);
QGenericMatrix<M1, M2, T> result(Qt::Uninitialized);
for (int row = 0; row < M2; ++row) {
for (int col = 0; col < M1; ++col) {
T sum(0.0f);
@ -281,7 +270,7 @@ Q_OUTOFLINE_TEMPLATE QGenericMatrix<M1, M2, T> operator*(const QGenericMatrix<N,
template <int N, int M, typename T>
Q_OUTOFLINE_TEMPLATE QGenericMatrix<N, M, T> operator-(const QGenericMatrix<N, M, T>& matrix)
{
QGenericMatrix<N, M, T> result(1);
QGenericMatrix<N, M, T> result(Qt::Uninitialized);
for (int row = 0; row < M; ++row)
for (int col = 0; col < N; ++col)
result.m[col][row] = -matrix.m[col][row];
@ -291,7 +280,7 @@ Q_OUTOFLINE_TEMPLATE QGenericMatrix<N, M, T> operator-(const QGenericMatrix<N, M
template <int N, int M, typename T>
Q_OUTOFLINE_TEMPLATE QGenericMatrix<N, M, T> operator*(T factor, const QGenericMatrix<N, M, T>& matrix)
{
QGenericMatrix<N, M, T> result(1);
QGenericMatrix<N, M, T> result(Qt::Uninitialized);
for (int row = 0; row < M; ++row)
for (int col = 0; col < N; ++col)
result.m[col][row] = matrix.m[col][row] * factor;
@ -301,7 +290,7 @@ Q_OUTOFLINE_TEMPLATE QGenericMatrix<N, M, T> operator*(T factor, const QGenericM
template <int N, int M, typename T>
Q_OUTOFLINE_TEMPLATE QGenericMatrix<N, M, T> operator*(const QGenericMatrix<N, M, T>& matrix, T factor)
{
QGenericMatrix<N, M, T> result(1);
QGenericMatrix<N, M, T> result(Qt::Uninitialized);
for (int row = 0; row < M; ++row)
for (int col = 0; col < N; ++col)
result.m[col][row] = matrix.m[col][row] * factor;
@ -311,7 +300,7 @@ Q_OUTOFLINE_TEMPLATE QGenericMatrix<N, M, T> operator*(const QGenericMatrix<N, M
template <int N, int M, typename T>
Q_OUTOFLINE_TEMPLATE QGenericMatrix<N, M, T> operator/(const QGenericMatrix<N, M, T>& matrix, T divisor)
{
QGenericMatrix<N, M, T> result(1);
QGenericMatrix<N, M, T> result(Qt::Uninitialized);
for (int row = 0; row < M; ++row)
for (int col = 0; col < N; ++col)
result.m[col][row] = matrix.m[col][row] / divisor;

View File

@ -266,7 +266,7 @@ inline bool operator==(const QQuaternion &q1, const QQuaternion &q2)
inline bool operator!=(const QQuaternion &q1, const QQuaternion &q2)
{
return q1.xp != q2.xp || q1.yp != q2.yp || q1.zp != q2.zp || q1.wp != q2.wp;
return !operator==(q1, q2);
}
inline const QQuaternion operator+(const QQuaternion &q1, const QQuaternion &q2)

View File

@ -6352,22 +6352,24 @@ void qInitDrawhelperAsm()
}
#endif // SSSE3
#if defined(QT_COMPILER_SUPPORTS_SSE4_1) && !defined(__SSE4_1__)
#if QT_COMPILER_SUPPORTS_SSE4_1
if (qCpuHasFeature(SSE4_1)) {
#if !defined(__SSE4_1__)
extern const uint *QT_FASTCALL convertARGB32ToARGB32PM_sse4(uint *buffer, const uint *src, int count, const QPixelLayout *, const QRgb *);
extern const uint *QT_FASTCALL convertRGBA8888ToARGB32PM_sse4(uint *buffer, const uint *src, int count, const QPixelLayout *, const QRgb *);
qPixelLayouts[QImage::Format_ARGB32].convertToARGB32PM = convertARGB32ToARGB32PM_sse4;
qPixelLayouts[QImage::Format_RGBA8888].convertToARGB32PM = convertRGBA8888ToARGB32PM_sse4;
#endif
extern const uint *QT_FASTCALL convertARGB32FromARGB32PM_sse4(uint *buffer, const uint *src, int count, const QPixelLayout *, const QRgb *);
extern const uint *QT_FASTCALL convertRGBA8888FromARGB32PM_sse4(uint *buffer, const uint *src, int count, const QPixelLayout *, const QRgb *);
extern const uint *QT_FASTCALL convertRGBXFromARGB32PM_sse4(uint *buffer, const uint *src, int count, const QPixelLayout *, const QRgb *);
qPixelLayouts[QImage::Format_ARGB32].convertToARGB32PM = convertARGB32ToARGB32PM_sse4;
qPixelLayouts[QImage::Format_RGBA8888].convertToARGB32PM = convertRGBA8888ToARGB32PM_sse4;
qPixelLayouts[QImage::Format_ARGB32].convertFromARGB32PM = convertARGB32FromARGB32PM_sse4;
qPixelLayouts[QImage::Format_RGBA8888].convertFromARGB32PM = convertRGBA8888FromARGB32PM_sse4;
qPixelLayouts[QImage::Format_RGBX8888].convertFromARGB32PM = convertRGBXFromARGB32PM_sse4;
}
#endif
#if defined(QT_COMPILER_SUPPORTS_AVX2) && !defined(__AVX2__)
#if QT_COMPILER_SUPPORTS_AVX2 && !defined(__AVX2__)
if (qCpuHasFeature(AVX2)) {
extern const uint *QT_FASTCALL convertARGB32ToARGB32PM_avx2(uint *buffer, const uint *src, int count, const QPixelLayout *, const QRgb *);
extern const uint *QT_FASTCALL convertRGBA8888ToARGB32PM_avx2(uint *buffer, const uint *src, int count, const QPixelLayout *, const QRgb *);

View File

@ -32,6 +32,7 @@
****************************************************************************/
#include <private/qdrawhelper_p.h>
#include <private/qdrawingprimitive_sse2_p.h>
#if defined(QT_COMPILER_SUPPORTS_SSE4_1)
@ -53,7 +54,7 @@ const uint *QT_FASTCALL convertARGB32FromARGB32PM_sse4(uint *buffer, const uint
const QPixelLayout *, const QRgb *)
{
for (int i = 0; i < count; ++i)
buffer[i] = qUnpremultiply(src[i]);
buffer[i] = qUnpremultiply_sse4(src[i]);
return buffer;
}
@ -61,7 +62,7 @@ const uint *QT_FASTCALL convertRGBA8888FromARGB32PM_sse4(uint *buffer, const uin
const QPixelLayout *, const QRgb *)
{
for (int i = 0; i < count; ++i)
buffer[i] = ARGB2RGBA(qUnpremultiply(src[i]));
buffer[i] = ARGB2RGBA(qUnpremultiply_sse4(src[i]));
return buffer;
}
@ -69,7 +70,7 @@ const uint *QT_FASTCALL convertRGBXFromARGB32PM_sse4(uint *buffer, const uint *s
const QPixelLayout *, const QRgb *)
{
for (int i = 0; i < count; ++i)
buffer[i] = ARGB2RGBA(0xff000000 | qUnpremultiply(src[i]));
buffer[i] = ARGB2RGBA(0xff000000 | qUnpremultiply_sse4(src[i]));
return buffer;
}

View File

@ -236,4 +236,27 @@ QT_END_NAMESPACE
#endif // __SSE2__
QT_BEGIN_NAMESPACE
#if QT_COMPILER_SUPPORTS_HERE(SSE4_1)
QT_FUNCTION_TARGET(SSE4_1)
inline QRgb qUnpremultiply_sse4(QRgb p)
{
const uint alpha = qAlpha(p);
if (alpha == 255 || alpha == 0)
return p;
const uint invAlpha = qt_inv_premul_factor[alpha];
const __m128i via = _mm_set1_epi32(invAlpha);
const __m128i vr = _mm_set1_epi32(0x8000);
__m128i vl = _mm_cvtepu8_epi32(_mm_cvtsi32_si128(p));
vl = _mm_mullo_epi32(vl, via);
vl = _mm_add_epi32(vl, vr);
vl = _mm_srai_epi32(vl, 16);
vl = _mm_insert_epi32(vl, alpha, 3);
vl = _mm_packus_epi32(vl, vl);
vl = _mm_packus_epi16(vl, vl);
return _mm_cvtsi128_si32(vl);
}
#endif
QT_END_NAMESPACE
#endif // QDRAWINGPRIMITIVE_SSE2_P_H

View File

@ -36,11 +36,6 @@
#include <QtCore/qglobal.h>
#include <QtCore/qprocessordetection.h>
#if defined(__SSE4_1__)
#include <smmintrin.h>
#elif defined(__SSE2__)
#include <emmintrin.h>
#endif
QT_BEGIN_NAMESPACE
@ -92,45 +87,19 @@ inline Q_DECL_RELAXED_CONSTEXPR QRgb qPremultiply(QRgb x)
Q_GUI_EXPORT extern const uint qt_inv_premul_factor[];
#if defined(__SSE2__)
inline QRgb qUnpremultiply(QRgb p)
{
const uint alpha = qAlpha(p);
if (alpha == 255 || alpha == 0)
return p;
const uint invAlpha = qt_inv_premul_factor[alpha];
const __m128i via = _mm_set1_epi32(invAlpha);
const __m128i vr = _mm_set1_epi32(0x8000);
#ifdef __SSE4_1__
__m128i vl = _mm_cvtepu8_epi32(_mm_cvtsi32_si128(p));
vl = _mm_mullo_epi32(vl, via);
#else
__m128i vl = _mm_unpacklo_epi8(_mm_cvtsi32_si128(p), _mm_setzero_si128());
vl = _mm_unpacklo_epi16(vl, vl);
__m128i vll = _mm_mullo_epi16(vl, via);
__m128i vlh = _mm_mulhi_epu16(vl, via);
vl = _mm_add_epi32(vll, _mm_slli_epi32(vlh, 16));
#endif
vl = _mm_add_epi32(vl, vr);
vl = _mm_srli_epi32(vl, 16);
vl = _mm_packs_epi32(vl, _mm_setzero_si128());
vl = _mm_insert_epi16(vl, alpha, 3);
vl = _mm_packus_epi16(vl, _mm_setzero_si128());
return _mm_cvtsi128_si32(vl);
}
#else
inline QRgb qUnpremultiply(QRgb p)
{
const uint alpha = qAlpha(p);
// Alpha 255 and 0 are the two most common values, which makes them beneficial to short-cut.
if (alpha == 255 || alpha == 0)
if (alpha == 255)
return p;
if (alpha == 0)
return 0;
// (p*(0x00ff00ff/alpha)) >> 16 == (p*255)/alpha for all p and alpha <= 256.
const uint invAlpha = qt_inv_premul_factor[alpha];
// We add 0x8000 to get even rounding. The rounding also ensures that qPremultiply(qUnpremultiply(p)) == p for all p.
return qRgba((qRed(p)*invAlpha + 0x8000)>>16, (qGreen(p)*invAlpha + 0x8000)>>16, (qBlue(p)*invAlpha + 0x8000)>>16, alpha);
}
#endif
QT_END_NAMESPACE

View File

@ -6941,7 +6941,7 @@ bool QOpenGLExtension_OES_EGL_image::initializeOpenGLFunctions()
Q_D(QOpenGLExtension_OES_EGL_image);
d->EGLImageTargetTexture2DOES = (void (QOPENGLF_APIENTRYP)(GLenum target, GLeglImageOES image))context->getProcAddress("glEGLImageTargetTexture2DOES");
d->EGLImageTargetRenderbufferStorageOES = (void (QOPENGLF_APIENTRYP)(GLenum target, GLeglImageOES image))context->getProcAddress("glEGLImageTargetRenderbufferStorageOESs");
d->EGLImageTargetRenderbufferStorageOES = (void (QOPENGLF_APIENTRYP)(GLenum target, GLeglImageOES image))context->getProcAddress("glEGLImageTargetRenderbufferStorageOES");
return QAbstractOpenGLExtension::initializeOpenGLFunctions();
}

View File

@ -73,19 +73,10 @@ void QAndroidPlatformForeignWindow::raise()
void QAndroidPlatformForeignWindow::setGeometry(const QRect &rect)
{
QWindow *parent = window()->parent();
QRect newGeometry = rect;
if (parent != 0)
newGeometry.moveTo(parent->mapToGlobal(rect.topLeft()));
if (newGeometry == geometry())
return;
QAndroidPlatformWindow::setGeometry(newGeometry);
QAndroidPlatformWindow::setGeometry(rect);
if (m_surfaceId != -1)
QtAndroid::setSurfaceGeometry(m_surfaceId, newGeometry);
QtAndroid::setSurfaceGeometry(m_surfaceId, rect);
}
void QAndroidPlatformForeignWindow::setVisible(bool visible)
@ -118,18 +109,7 @@ void QAndroidPlatformForeignWindow::applicationStateChanged(Qt::ApplicationState
void QAndroidPlatformForeignWindow::setParent(const QPlatformWindow *window)
{
QRect newGeometry = geometry();
if (window != 0)
newGeometry.moveTo(window->mapToGlobal(geometry().topLeft()));
if (newGeometry != geometry())
QAndroidPlatformWindow::setGeometry(newGeometry);
if (m_surfaceId == -1)
return;
QtAndroid::setSurfaceGeometry(m_surfaceId, newGeometry);
Q_UNUSED(window);
}
QT_END_NAMESPACE

View File

@ -133,7 +133,7 @@ static const QByteArray q_macLocalEventType = QByteArrayLiteral("mac_generic_NSE
return true;
if ([event type] == NSApplicationDefined) {
switch ([event subtype]) {
switch (static_cast<short>([event subtype])) {
case QtCocoaEventSubTypePostMessage:
[NSApp QT_MANGLE_NAMESPACE(qt_sendPostedMessage):event];
return true;

View File

@ -99,9 +99,8 @@ void QCocoaInputContext::reset()
return;
QCocoaAutoReleasePool pool;
NSInputManager *currentIManager = [NSInputManager currentInputManager];
if (currentIManager) {
[currentIManager markedTextAbandoned:view];
if (NSTextInputContext *ctxt = [NSTextInputContext currentInputContext]) {
[ctxt discardMarkedText];
[view unmarkText];
}
}

View File

@ -704,8 +704,10 @@ QT_WARNING_POP
}
// Popups implicitly grap mouse events; forward to the active popup if there is one
if (QCocoaWindow *popup = QCocoaIntegration::instance()->activePopupWindow())
targetView = popup->contentView();
if (QCocoaWindow *popup = QCocoaIntegration::instance()->activePopupWindow()) {
if (QNSView *popupView = popup->qtView())
targetView = popupView;
}
[targetView convertFromScreen:[self screenMousePoint:theEvent] toWindowPoint:&qtWindowPoint andScreenPoint:&qtScreenPoint];
ulong timestamp = [theEvent timestamp] * 1000;
@ -757,12 +759,13 @@ QT_WARNING_POP
NSPoint windowPoint = [theEvent locationInWindow];
int windowScreenY = [window frame].origin.y + [window frame].size.height;
int viewScreenY = [window convertBaseToScreen:[self convertPoint:[self frame].origin toView:nil]].y;
NSPoint windowCoord = [self convertPoint:[self frame].origin toView:nil];
int viewScreenY = [window convertRectToScreen:NSMakeRect(windowCoord.x, windowCoord.y, 0, 0)].origin.y;
int titleBarHeight = windowScreenY - viewScreenY;
NSPoint nsViewPoint = [self convertPoint: windowPoint fromView: nil];
QPoint qtWindowPoint = QPoint(nsViewPoint.x, titleBarHeight + nsViewPoint.y);
NSPoint screenPoint = [window convertBaseToScreen:windowPoint];
NSPoint screenPoint = [window convertRectToScreen:NSMakeRect(windowPoint.x, windowPoint.y, 0, 0)].origin;
QPoint qtScreenPoint = QPoint(screenPoint.x, qt_mac_flipYCoordinate(screenPoint.y));
ulong timestamp = [theEvent timestamp] * 1000;
@ -808,10 +811,7 @@ QT_WARNING_POP
}
if ([self hasMarkedText]) {
NSInputManager* inputManager = [NSInputManager currentInputManager];
if ([inputManager wantsToHandleMouseEvents]) {
[inputManager handleMouseEvent:theEvent];
}
[[NSTextInputContext currentInputContext] handleEvent:theEvent];
} else {
if ([QNSView convertKeyModifiers:[theEvent modifierFlags]] & Qt::MetaModifier) {
m_buttons |= Qt::RightButton;
@ -1983,7 +1983,7 @@ static QPoint mapWindowCoordinates(QWindow *source, QWindow *target, QPoint poin
QPoint qtWindowPoint(windowPoint.x, windowPoint.y);
NSWindow *window = [self window];
NSPoint screenPoint = [window convertBaseToScreen :point];
NSPoint screenPoint = [window convertRectToScreen:NSMakeRect(point.x, point.y, 0, 0)].origin;
QPoint qtScreenPoint = QPoint(screenPoint.x, qt_mac_flipYCoordinate(screenPoint.y));
QWindowSystemInterface::handleMouseEvent(target, mapWindowCoordinates(m_window, target, qtWindowPoint), qtScreenPoint, m_buttons);

View File

@ -1631,6 +1631,8 @@ QStringList QWindowsFontDatabase::extraTryFontsForFamily(const QString &family)
++tf;
}
}
result.append(QStringLiteral("Segoe UI Emoji"));
result.append(QStringLiteral("Segoe UI Symbol"));
return result;
}

View File

@ -483,7 +483,7 @@ bool QGLXContext::makeCurrent(QPlatformSurface *surface)
success = glXMakeContextCurrent(m_display, glxDrawable, glxDrawable, m_context);
}
if (success) {
if (success && surfaceClass == QSurface::Window) {
int interval = surface->format().swapInterval();
QXcbScreen *screen = screenForPlatformSurface(surface);
if (interval >= 0 && m_swapInterval != interval && screen) {

View File

@ -306,7 +306,6 @@ void QXcbConnection::initializeScreens()
m_virtualDesktops.append(virtualDesktop);
QList<QPlatformScreen *> siblings;
int outputCount = 0;
int connectedOutputCount = 0;
if (has_randr_extension) {
xcb_generic_error_t *error = NULL;
// RRGetScreenResourcesCurrent is fast but it may return nothing if the
@ -375,7 +374,6 @@ void QXcbConnection::initializeScreens()
QXcbScreen *screen = createScreen(virtualDesktop, outputs[i], output.data());
siblings << screen;
++connectedOutputCount;
hasOutputs = true;
m_screens << screen;

View File

@ -34,6 +34,8 @@
#include "qprintdevice_p.h"
#include "qplatformprintdevice.h"
#include <private/qdebug_p.h>
QT_BEGIN_NAMESPACE
#ifndef QT_NO_PRINTER
@ -244,6 +246,59 @@ QList<QMimeType> QPrintDevice::supportedMimeTypes() const
}
#endif // QT_NO_MIMETYPE
# ifndef QT_NO_DEBUG_STREAM
void QPrintDevice::format(QDebug debug) const
{
QDebugStateSaver saver(debug);
debug.noquote();
debug.nospace();
if (isValid()) {
const QString deviceId = id();
const QString deviceName = name();
debug << "id=\"" << deviceId << "\", state=" << state();
if (!deviceName.isEmpty() && deviceName != deviceId)
debug << ", name=\"" << deviceName << '"';
if (!location().isEmpty())
debug << ", location=\"" << location() << '"';
debug << ", makeAndModel=\"" << makeAndModel() << '"';
if (isDefault())
debug << ", default";
if (isRemote())
debug << ", remote";
debug << ", defaultPageSize=" << defaultPageSize();
if (supportsCustomPageSizes())
debug << ", supportsCustomPageSizes";
debug << ", physicalPageSize=(";
QtDebugUtils::formatQSize(debug, minimumPhysicalPageSize());
debug << ")..(";
QtDebugUtils::formatQSize(debug, maximumPhysicalPageSize());
debug << "), defaultResolution=" << defaultResolution()
<< ", defaultDuplexMode=" << defaultDuplexMode()
<< ", defaultColorMode="<< defaultColorMode();
# ifndef QT_NO_MIMETYPE
const QList<QMimeType> mimeTypes = supportedMimeTypes();
if (const int mimeTypeCount = mimeTypes.size()) {
debug << ", supportedMimeTypes=(";
for (int i = 0; i < mimeTypeCount; ++i)
debug << " \"" << mimeTypes.at(i).name() << '"';
debug << ')';
}
# endif // !QT_NO_MIMETYPE
} else {
debug << "null";
}
}
QDebug operator<<(QDebug debug, const QPrintDevice &p)
{
QDebugStateSaver saver(debug);
debug.nospace();
debug << "QPrintDevice(";
p.format(debug);
debug << ')';
return debug;
}
# endif // QT_NO_DEBUG_STREAM
#endif // QT_NO_PRINTER
QT_END_NAMESPACE

View File

@ -57,6 +57,7 @@ QT_BEGIN_NAMESPACE
class QPlatformPrintDevice;
class QMarginsF;
class QMimeType;
class QDebug;
class Q_PRINTSUPPORT_EXPORT QPrintDevice
{
@ -127,6 +128,10 @@ public:
QList<QMimeType> supportedMimeTypes() const;
#endif
# ifndef QT_NO_DEBUG_STREAM
void format(QDebug debug) const;
# endif
private:
friend class QPlatformPrinterSupport;
friend class QPlatformPrintDevice;
@ -136,6 +141,9 @@ private:
Q_DECLARE_SHARED(QPrintDevice)
# ifndef QT_NO_DEBUG_STREAM
Q_PRINTSUPPORT_EXPORT QDebug operator<<(QDebug debug, const QPrintDevice &);
# endif
#endif // QT_NO_PRINTER
QT_END_NAMESPACE

View File

@ -31,6 +31,8 @@
#ifndef QT_NO_PRINTER
#include <QtCore/qdebug.h>
#include <qpa/qplatformprintplugin.h>
#include <qpa/qplatformprintersupport.h>
@ -469,6 +471,21 @@ QPrinterInfo QPrinterInfo::printerInfo(const QString &printerName)
return QPrinterInfo(printerName);
}
# ifndef QT_NO_DEBUG_STREAM
QDebug operator<<(QDebug debug, const QPrinterInfo &p)
{
QDebugStateSaver saver(debug);
debug.nospace();
debug << "QPrinterInfo(";
if (p.isNull())
debug << "null";
else
p.d_ptr->m_printDevice.format(debug);
debug << ')';
return debug;
}
# endif // !QT_NO_DEBUG_STREAM
QT_END_NAMESPACE
#endif // QT_NO_PRINTER

View File

@ -46,6 +46,7 @@ QT_BEGIN_NAMESPACE
#ifndef QT_NO_PRINTER
class QPrinterInfoPrivate;
class QPrinterInfoPrivateDeleter;
class QDebug;
class Q_PRINTSUPPORT_EXPORT QPrinterInfo
{
public:
@ -98,6 +99,9 @@ private:
private:
friend class QPlatformPrinterSupport;
# ifndef QT_NO_DEBUG_STREAM
friend Q_PRINTSUPPORT_EXPORT QDebug operator<<(QDebug debug, const QPrinterInfo &);
# endif
Q_DECLARE_PRIVATE(QPrinterInfo)
QScopedPointer<QPrinterInfoPrivate, QPrinterInfoPrivateDeleter> d_ptr;
};

View File

@ -1237,6 +1237,9 @@ bool QMYSQLDriver::open(const QString& db,
QString unixSocket;
#if MYSQL_VERSION_ID >= 50000
my_bool reconnect=false;
uint connectTimeout = 0;
uint readTimeout = 0;
uint writeTimeout = 0;
#endif
// extract the real options from the string
@ -1252,6 +1255,12 @@ bool QMYSQLDriver::open(const QString& db,
else if (opt == QLatin1String("MYSQL_OPT_RECONNECT")) {
if (val == QLatin1String("TRUE") || val == QLatin1String("1") || val.isEmpty())
reconnect = true;
} else if (opt == QLatin1String("MYSQL_OPT_CONNECT_TIMEOUT")) {
connectTimeout = val.toInt();
} else if (opt == QLatin1String("MYSQL_OPT_READ_TIMEOUT")) {
readTimeout = val.toInt();
} else if (opt == QLatin1String("MYSQL_OPT_WRITE_TIMEOUT")) {
writeTimeout = val.toInt();
}
#endif
else if (val == QLatin1String("TRUE") || val == QLatin1String("1"))
@ -1264,8 +1273,16 @@ bool QMYSQLDriver::open(const QString& db,
}
}
if ((d->mysql = mysql_init((MYSQL*) 0)) &&
mysql_real_connect(d->mysql,
if ((d->mysql = mysql_init((MYSQL*) 0))) {
#if MYSQL_VERSION_ID >= 50000
if (connectTimeout != 0)
mysql_options(d->mysql, MYSQL_OPT_CONNECT_TIMEOUT, &connectTimeout);
if (readTimeout != 0)
mysql_options(d->mysql, MYSQL_OPT_READ_TIMEOUT, &readTimeout);
if (writeTimeout != 0)
mysql_options(d->mysql, MYSQL_OPT_WRITE_TIMEOUT, &writeTimeout);
#endif
if (mysql_real_connect(d->mysql,
host.isNull() ? static_cast<const char *>(0)
: host.toLocal8Bit().constData(),
user.isNull() ? static_cast<const char *>(0)
@ -1277,18 +1294,18 @@ bool QMYSQLDriver::open(const QString& db,
(port > -1) ? port : 0,
unixSocket.isNull() ? static_cast<const char *>(0)
: unixSocket.toLocal8Bit().constData(),
optionFlags))
{
if (!db.isEmpty() && mysql_select_db(d->mysql, db.toLocal8Bit().constData())) {
setLastError(qMakeError(tr("Unable to open database '%1'").arg(db), QSqlError::ConnectionError, d));
mysql_close(d->mysql);
setOpenError(true);
return false;
}
optionFlags)) {
if (!db.isEmpty() && mysql_select_db(d->mysql, db.toLocal8Bit().constData())) {
setLastError(qMakeError(tr("Unable to open database '%1'").arg(db), QSqlError::ConnectionError, d));
mysql_close(d->mysql);
setOpenError(true);
return false;
}
#if MYSQL_VERSION_ID >= 50000
if(reconnect)
mysql_options(d->mysql, MYSQL_OPT_RECONNECT, &reconnect);
if (reconnect)
mysql_options(d->mysql, MYSQL_OPT_RECONNECT, &reconnect);
#endif
}
} else {
setLastError(qMakeError(tr("Unable to connect"),
QSqlError::ConnectionError, d));

View File

@ -1224,6 +1224,9 @@ QSqlRecord QSqlDatabase::record(const QString& tablename) const
\li CLIENT_INTERACTIVE
\li UNIX_SOCKET
\li MYSQL_OPT_RECONNECT
\li MYSQL_OPT_CONNECT_TIMEOUT
\li MYSQL_OPT_READ_TIMEOUT
\li MYSQL_OPT_WRITE_TIMEOUT
\endlist
\li

View File

@ -140,7 +140,8 @@ bool Moc::parseClassHead(ClassDef *def)
}
} while (test(COMMA));
if (knownGadgets.contains(def->superclassList.first().first)) {
if (!def->superclassList.isEmpty()
&& knownGadgets.contains(def->superclassList.first().first)) {
// Q_GADGET subclasses are treated as Q_GADGETs
knownGadgets.insert(def->classname, def->qualified);
knownGadgets.insert(def->qualified, def->qualified);

View File

@ -419,6 +419,59 @@ QString Generator::fileName(const Node* node) const
return name;
}
QString Generator::cleanRef(const QString& ref)
{
QString clean;
if (ref.isEmpty())
return clean;
clean.reserve(ref.size() + 20);
const QChar c = ref[0];
const uint u = c.unicode();
if ((u >= 'a' && u <= 'z') ||
(u >= 'A' && u <= 'Z') ||
(u >= '0' && u <= '9')) {
clean += c;
} else if (u == '~') {
clean += "dtor.";
} else if (u == '_') {
clean += "underscore.";
} else {
clean += QLatin1Char('A');
}
for (int i = 1; i < (int) ref.length(); i++) {
const QChar c = ref[i];
const uint u = c.unicode();
if ((u >= 'a' && u <= 'z') ||
(u >= 'A' && u <= 'Z') ||
(u >= '0' && u <= '9') || u == '-' ||
u == '_' || u == ':' || u == '.') {
clean += c;
} else if (c.isSpace()) {
clean += QLatin1Char('-');
} else if (u == '!') {
clean += "-not";
} else if (u == '&') {
clean += "-and";
} else if (u == '<') {
clean += "-lt";
} else if (u == '=') {
clean += "-eq";
} else if (u == '>') {
clean += "-gt";
} else if (u == '#') {
clean += QLatin1Char('#');
} else {
clean += QLatin1Char('-');
clean += QString::number((int)u, 16);
}
}
return clean;
}
QMap<QString, QString>& Generator::formattingLeftMap()
{
return fmtLeftMaps[format()];
@ -521,10 +574,10 @@ QString Generator::fullDocumentLocation(const Node *node, bool useSubdir)
return fullDocumentLocation(functionNode->associatedProperty());
else if (functionNode->overloadNumber() > 1)
anchorRef = QLatin1Char('#') + functionNode->name()
anchorRef = QLatin1Char('#') + cleanRef(functionNode->name())
+ QLatin1Char('-') + QString::number(functionNode->overloadNumber());
else
anchorRef = QLatin1Char('#') + functionNode->name();
anchorRef = QLatin1Char('#') + cleanRef(functionNode->name());
break;
}
/*

View File

@ -103,6 +103,7 @@ public:
static bool useOutputSubdirs() { return useOutputSubdirs_; }
static void setQmlTypeContext(QmlTypeNode* t) { qmlTypeContext_ = t; }
static QmlTypeNode* qmlTypeContext() { return qmlTypeContext_; }
static QString cleanRef(const QString& ref);
protected:
virtual void beginSubPage(const Aggregate* node, const QString& fileName);

View File

@ -3355,7 +3355,7 @@ void HtmlGenerator::generateSectionInheritedList(const Section& section, const N
out() << section.pluralMember;
}
out() << " inherited from <a href=\"" << fileName((*p).first)
<< '#' << HtmlGenerator::cleanRef(section.name.toLower()) << "\">"
<< '#' << Generator::cleanRef(section.name.toLower()) << "\">"
<< protectEnc((*p).first->plainFullName(relative))
<< "</a></li>\n";
++p;
@ -3610,62 +3610,9 @@ void HtmlGenerator::generateLink(const Atom* atom, CodeMarker* marker)
}
}
QString HtmlGenerator::cleanRef(const QString& ref)
{
QString clean;
if (ref.isEmpty())
return clean;
clean.reserve(ref.size() + 20);
const QChar c = ref[0];
const uint u = c.unicode();
if ((u >= 'a' && u <= 'z') ||
(u >= 'A' && u <= 'Z') ||
(u >= '0' && u <= '9')) {
clean += c;
} else if (u == '~') {
clean += "dtor.";
} else if (u == '_') {
clean += "underscore.";
} else {
clean += QLatin1Char('A');
}
for (int i = 1; i < (int) ref.length(); i++) {
const QChar c = ref[i];
const uint u = c.unicode();
if ((u >= 'a' && u <= 'z') ||
(u >= 'A' && u <= 'Z') ||
(u >= '0' && u <= '9') || u == '-' ||
u == '_' || u == ':' || u == '.') {
clean += c;
} else if (c.isSpace()) {
clean += QLatin1Char('-');
} else if (u == '!') {
clean += "-not";
} else if (u == '&') {
clean += "-and";
} else if (u == '<') {
clean += "-lt";
} else if (u == '=') {
clean += "-eq";
} else if (u == '>') {
clean += "-gt";
} else if (u == '#') {
clean += QLatin1Char('#');
} else {
clean += QLatin1Char('-');
clean += QString::number((int)u, 16);
}
}
return clean;
}
QString HtmlGenerator::registerRef(const QString& ref)
{
QString clean = HtmlGenerator::cleanRef(ref);
QString clean = Generator::cleanRef(ref);
for (;;) {
QString& prevRef = refMap[clean.toLower()];

View File

@ -85,7 +85,6 @@ public:
QString protectEnc(const QString &string);
static QString protect(const QString &string, const QString &encoding = "ISO-8859-1");
static QString cleanRef(const QString& ref);
static QString sinceTitle(int i) { return sinceTitles[i]; }
protected:

View File

@ -388,7 +388,6 @@ void Tree::resolveInheritanceHelper(int pass, ClassNode* cn)
while (b != bases.end()) {
if (!(*b).node_) {
Node* n = qdb_->findClassNode((*b).path_);
#if 0
/*
If the node for the base class was not found,
the reason might be that the subclass is in a
@ -401,9 +400,11 @@ void Tree::resolveInheritanceHelper(int pass, ClassNode* cn)
*/
if (!n) {
Aggregate* parent = cn->parent();
n = findClassNode((*b).path_, parent);
if (parent)
// Exclude the root namespace
if (parent->isNamespace() && !parent->name().isEmpty())
n = findClassNode((*b).path_, parent);
}
#endif
if (n) {
ClassNode* bcn = static_cast<ClassNode*>(n);
(*b).node_ = bcn;

View File

@ -1176,6 +1176,7 @@ void WriteInitialization::writeProperties(const QString &varName,
continue;
QString propertyName = p->attributeName();
QString propertyValue;
bool delayProperty = false;
// special case for the property `geometry': Do not use position
if (isTopLevel && propertyName == QLatin1String("geometry") && p->elementRect()) {
@ -1204,6 +1205,10 @@ void WriteInitialization::writeProperties(const QString &varName,
&& m_uic->customWidgetsInfo()->extends(className, QLatin1String("QAxWidget"))) {
// already done ;)
continue;
} else if (propertyName == QLatin1String("default")
&& m_uic->customWidgetsInfo()->extends(className, QLatin1String("QPushButton"))) {
// QTBUG-44406: Setting of QPushButton::default needs to be delayed until the parent is set
delayProperty = true;
} else if (propertyName == QLatin1String("database")
&& p->elementStringList()) {
// Sql support
@ -1479,7 +1484,7 @@ void WriteInitialization::writeProperties(const QString &varName,
else if (propertyName == QLatin1String("accessibleName") || propertyName == QLatin1String("accessibleDescription"))
defineC = accessibilityDefineC;
QTextStream &o = autoTrOutput(p);
QTextStream &o = delayProperty ? m_delayedOut : autoTrOutput(p);
if (defineC)
openIfndef(o, QLatin1String(defineC));

View File

@ -2312,7 +2312,6 @@ QWidget *QApplicationPrivate::focusNextPrevChild_helper(QWidget *toplevel, bool
*/
void QApplicationPrivate::dispatchEnterLeave(QWidget* enter, QWidget* leave, const QPointF &globalPosF)
{
const QPoint globalPos = globalPosF.toPoint();
#if 0
if (leave) {
QEvent e(QEvent::Leave);
@ -2399,6 +2398,10 @@ void QApplicationPrivate::dispatchEnterLeave(QWidget* enter, QWidget* leave, con
}
}
if (!enterList.isEmpty()) {
// Guard against QGuiApplicationPrivate::lastCursorPosition initialized to qInf(), qInf().
const QPoint globalPos = qIsInf(globalPosF.x())
? QPoint(QWIDGETSIZE_MAX, QWIDGETSIZE_MAX)
: globalPosF.toPoint();
const QPoint windowPos = enterList.front()->window()->mapFromGlobal(globalPos);
for (int i = 0; i < enterList.size(); ++i) {
w = enterList.at(i);

View File

@ -1031,8 +1031,14 @@ void QDockWidgetPrivate::setWindowState(bool floating, bool unplug, const QRect
q->setWindowFlags(flags);
if (!rect.isNull())
q->setGeometry(rect);
if (!rect.isNull()) {
if (floating) {
q->resize(rect.size());
q->move(rect.topLeft());
} else {
q->setGeometry(rect);
}
}
updateButtons();

View File

@ -36,6 +36,9 @@
#include <QTemporaryDir>
#include <QFileSystemWatcher>
#include <QElapsedTimer>
#include <QTextStream>
#include <QDir>
/* All tests need to run in temporary directories not used
* by the application to avoid non-deterministic failures on Windows
@ -387,6 +390,60 @@ void tst_QFileSystemWatcher::addPaths()
QCOMPARE(watcher.addPaths(paths), QStringList());
}
// A signal spy that records the paths and times received for better diagnostics.
class FileSystemWatcherSpy : public QObject {
Q_OBJECT
public:
enum Mode {
SpyOnDirectoryChanged,
SpyOnFileChanged
};
explicit FileSystemWatcherSpy(QFileSystemWatcher *watcher, Mode mode)
{
connect(watcher, mode == SpyOnDirectoryChanged ?
&QFileSystemWatcher::directoryChanged : &QFileSystemWatcher::fileChanged,
this, &FileSystemWatcherSpy::spySlot);
m_elapsedTimer.start();
}
int count() const { return m_entries.size(); }
void clear()
{
m_entries.clear();
m_elapsedTimer.restart();
}
QByteArray receivedFilesMessage() const
{
QString result;
QTextStream str(&result);
str << "At " << m_elapsedTimer.elapsed() << "ms, received "
<< count() << " changes: ";
for (int i =0, e = m_entries.size(); i < e; ++i) {
if (i)
str << ", ";
str << m_entries.at(i).timeStamp << "ms: " << QDir::toNativeSeparators(m_entries.at(i).path);
}
return result.toLocal8Bit();
}
private slots:
void spySlot(const QString &p) { m_entries.append(Entry(m_elapsedTimer.elapsed(), p)); }
private:
struct Entry {
Entry() : timeStamp(0) {}
Entry(qint64 t, const QString &p) : timeStamp(t), path(p) {}
qint64 timeStamp;
QString path;
};
QElapsedTimer m_elapsedTimer;
QList<Entry> m_entries;
};
void tst_QFileSystemWatcher::removePaths()
{
QFileSystemWatcher watcher;
@ -438,9 +495,8 @@ void tst_QFileSystemWatcher::watchFileAndItsDirectory()
QVERIFY(watcher.addPath(testFileName));
QSignalSpy fileChangedSpy(&watcher, &QFileSystemWatcher::fileChanged);
QSignalSpy dirChangedSpy(&watcher, &QFileSystemWatcher::directoryChanged);
FileSystemWatcherSpy dirChangedSpy(&watcher, FileSystemWatcherSpy::SpyOnDirectoryChanged);
QVERIFY(fileChangedSpy.isValid());
QVERIFY(dirChangedSpy.isValid());
QEventLoop eventLoop;
QTimer timer;
connect(&timer, SIGNAL(timeout()), &eventLoop, SLOT(quit()));
@ -460,7 +516,7 @@ void tst_QFileSystemWatcher::watchFileAndItsDirectory()
#endif
QTRY_VERIFY(fileChangedSpy.count() > 0);
QCOMPARE(dirChangedSpy.count(), 0);
QVERIFY2(dirChangedSpy.count() == 0, dirChangedSpy.receivedFilesMessage());
fileChangedSpy.clear();
QFile secondFile(secondFileName);
@ -640,13 +696,14 @@ private:
// emitted with the destination path instead of the starting path
void tst_QFileSystemWatcher::signalsEmittedAfterFileMoved()
{
const int fileCount = 10;
QTemporaryDir temporaryDirectory(m_tempDirPattern);
QVERIFY(temporaryDirectory.isValid());
QDir testDir(temporaryDirectory.path());
QVERIFY(testDir.mkdir("movehere"));
QString movePath = testDir.filePath("movehere");
for (int i = 0; i < 10; i++) {
for (int i = 0; i < fileCount; ++i) {
QFile f(testDir.filePath(QString("test%1.txt").arg(i)));
QVERIFY(f.open(QIODevice::WriteOnly));
f.write(QByteArray("i am ") + QByteArray::number(i));
@ -659,6 +716,7 @@ void tst_QFileSystemWatcher::signalsEmittedAfterFileMoved()
// add files to watcher
QFileInfoList files = testDir.entryInfoList(QDir::Files | QDir::NoSymLinks);
QCOMPARE(files.size(), fileCount);
foreach (const QFileInfo &finfo, files)
QVERIFY(watcher.addPath(finfo.absoluteFilePath()));
@ -667,14 +725,16 @@ void tst_QFileSystemWatcher::signalsEmittedAfterFileMoved()
connect(&watcher, SIGNAL(fileChanged(QString)), &signalReceiver, SLOT(fileChanged(QString)));
// watch signals
QSignalSpy changedSpy(&watcher, &QFileSystemWatcher::fileChanged);
QVERIFY(changedSpy.isValid());
FileSystemWatcherSpy changedSpy(&watcher, FileSystemWatcherSpy::SpyOnFileChanged);
QCOMPARE(changedSpy.count(), 0);
// move files to second directory
foreach (const QFileInfo &finfo, files)
QVERIFY(testDir.rename(finfo.fileName(), QString("movehere/%2").arg(finfo.fileName())));
QTRY_COMPARE(changedSpy.count(), 10);
QCoreApplication::processEvents();
QVERIFY2(changedSpy.count() <= fileCount, changedSpy.receivedFilesMessage());
QTRY_COMPARE(changedSpy.count(), fileCount);
}
#endif // QT_NO_FILESYSTEMWATCHER

View File

@ -36,8 +36,11 @@
#include <QtConcurrentRun>
#include <qlockfile.h>
#include <qtemporarydir.h>
#include <qsysinfo.h>
#if defined(Q_OS_UNIX) && !defined(Q_OS_VXWORKS)
#include <unistd.h>
#elif defined(Q_OS_WIN) && !defined(Q_OS_WINCE) && !defined(Q_OS_WINRT)
# include <qt_windows.h>
#endif
class tst_QLockFile : public QObject
@ -58,6 +61,7 @@ private slots:
void staleLongLockFromBusyProcess();
void staleLockRace();
void noPermissions();
void noPermissionsWindows();
public:
QString m_helperApp;
@ -415,5 +419,66 @@ void tst_QLockFile::noPermissions()
QCOMPARE(int(lockFile.error()), int(QLockFile::PermissionError));
}
enum ProcessProperty {
ElevatedProcess = 0x1,
VirtualStore = 0x2
};
Q_DECLARE_FLAGS(ProcessProperties, ProcessProperty)
Q_DECLARE_OPERATORS_FOR_FLAGS(ProcessProperties)
static inline ProcessProperties processProperties()
{
ProcessProperties result;
#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) && !defined(Q_OS_WINRT)
HANDLE processToken = NULL;
if (OpenProcessToken(GetCurrentProcess(), TOKEN_QUERY, &processToken)) {
DWORD elevation; // struct containing a DWORD, not present in some MinGW headers.
DWORD cbSize = sizeof(elevation);
if (GetTokenInformation(processToken, TokenElevation, &elevation, cbSize, &cbSize)
&& elevation) {
result |= ElevatedProcess;
}
// Check for UAC virtualization (compatibility mode for old software
// allowing it to write to system folders by mirroring them under
// "\Users\...\AppData\Local\VirtualStore\", which is typically the case
// for MinGW).
DWORD virtualStoreEnabled = 0;
cbSize = sizeof(virtualStoreEnabled);
if (GetTokenInformation(processToken, TokenVirtualizationEnabled, &virtualStoreEnabled, cbSize, &cbSize)
&& virtualStoreEnabled) {
result |= VirtualStore;
}
CloseHandle(processToken);
}
#endif
return result;
}
void tst_QLockFile::noPermissionsWindows()
{
// Windows: Do the permissions test in a system directory in which
// files cannot be created.
#if !defined(Q_OS_WIN) || defined(Q_OS_WINCE) || defined(Q_OS_WINRT)
QSKIP("This test is for desktop Windows only");
#endif
#ifdef Q_OS_WIN
if (QSysInfo::windowsVersion() < QSysInfo::WV_WINDOWS7)
QSKIP("This test requires at least Windows 7");
#endif
if (const int p = processProperties()) {
const QByteArray message = "This test cannot be run (properties=0x"
+ QByteArray::number(p, 16) + ')';
QSKIP(message.constData());
}
const QString fileName = QFile::decodeName(qgetenv("ProgramFiles"))
+ QLatin1Char('/') + QCoreApplication::applicationName()
+ QDateTime::currentDateTime().toString(QStringLiteral("yyMMddhhmm"));
QLockFile lockFile(fileName);
QVERIFY(!lockFile.lock());
QCOMPARE(int(lockFile.error()), int(QLockFile::PermissionError));
}
QTEST_MAIN(tst_QLockFile)
#include "tst_qlockfile.moc"

View File

@ -4,3 +4,4 @@ TARGET = tst_qlockfile
SOURCES += tst_qlockfile.cpp
QT = core testlib concurrent
win32:!wince:!winrt:LIBS += -ladvapi32

View File

@ -10,6 +10,7 @@ runtime_resource.depends = $$PWD/testqrc/test.qrc
runtime_resource.commands = $$QMAKE_RCC -root /runtime_resource/ -binary $${runtime_resource.depends} -o $${runtime_resource.target}
QMAKE_EXTRA_TARGETS = runtime_resource
PRE_TARGETDEPS += $${runtime_resource.target}
QMAKE_DISTCLEAN += $${runtime_resource.target}
TESTDATA += \
parentdir.txt \

View File

@ -41,24 +41,14 @@ class tst_QState : public QObject
{
Q_OBJECT
public:
tst_QState();
private slots:
void assignProperty();
void assignPropertyTwice();
void historyInitialState();
void transitions();
void privateSignals();
private:
bool functionCalled;
};
tst_QState::tst_QState() : functionCalled(false)
{
}
class TestClass: public QObject
{
Q_OBJECT

View File

@ -155,6 +155,9 @@ private slots:
void inplaceMirrored_data();
void inplaceMirrored();
void inplaceMirroredOdd_data();
void inplaceMirroredOdd();
void inplaceRgbMirrored();
void inplaceConversion_data();
@ -2471,6 +2474,54 @@ void tst_QImage::inplaceMirrored()
#endif
}
void tst_QImage::inplaceMirroredOdd_data()
{
QTest::addColumn<QImage::Format>("format");
QTest::addColumn<bool>("swap_vertical");
QTest::addColumn<bool>("swap_horizontal");
QTest::newRow("Format_ARGB32, vertical") << QImage::Format_ARGB32 << true << false;
QTest::newRow("Format_RGB888, vertical") << QImage::Format_RGB888 << true << false;
QTest::newRow("Format_RGB16, vertical") << QImage::Format_RGB16 << true << false;
QTest::newRow("Format_ARGB32, horizontal") << QImage::Format_ARGB32 << false << true;
QTest::newRow("Format_RGB888, horizontal") << QImage::Format_RGB888 << false << true;
QTest::newRow("Format_RGB16, horizontal") << QImage::Format_RGB16 << false << true;
QTest::newRow("Format_ARGB32, horizontal+vertical") << QImage::Format_ARGB32 << true << true;
QTest::newRow("Format_RGB888, horizontal+vertical") << QImage::Format_RGB888 << true << true;
QTest::newRow("Format_RGB16, horizontal+vertical") << QImage::Format_RGB16 << true << true;
}
void tst_QImage::inplaceMirroredOdd()
{
#if defined(Q_COMPILER_REF_QUALIFIERS)
QFETCH(QImage::Format, format);
QFETCH(bool, swap_vertical);
QFETCH(bool, swap_horizontal);
QImage image(15, 15, format);
for (int i = 0; i < image.height(); ++i)
for (int j = 0; j < image.width(); ++j)
image.setPixel(j, i, qRgb(j*16, i*16, 0));
const uchar* originalPtr = image.constScanLine(0);
QImage imageMirrored = std::move(image).mirrored(swap_horizontal, swap_vertical);
for (int i = 0; i < imageMirrored.height(); ++i) {
int mirroredI = swap_vertical ? (imageMirrored.height() - i - 1) : i;
for (int j = 0; j < imageMirrored.width(); ++j) {
int mirroredJ = swap_horizontal ? (imageMirrored.width() - j - 1) : j;
QRgb mirroredColor = imageMirrored.pixel(mirroredJ, mirroredI);
QCOMPARE(qRed(mirroredColor) & 0xF8, j * 16);
QCOMPARE(qGreen(mirroredColor) & 0xF8, i * 16);
}
}
QCOMPARE(imageMirrored.constScanLine(0), originalPtr);
#endif
}
void tst_QImage::inplaceRgbMirrored()
{
#if defined(Q_COMPILER_REF_QUALIFIERS)

View File

@ -38,6 +38,7 @@
#include <qcolor.h>
#include <qdebug.h>
#include <private/qdrawingprimitive_sse2_p.h>
#include <qrgba64.h>
class tst_QColor : public QObject
@ -104,6 +105,7 @@ private slots:
void achromaticHslHue();
void premultiply();
void unpremultiply_sse4();
void qrgba64();
void qrgba64Premultiply();
void qrgba64Equivalence();
@ -1449,6 +1451,23 @@ void tst_QColor::premultiply()
}
}
void tst_QColor::unpremultiply_sse4()
{
// Tests that qUnpremultiply_sse4 returns the same as qUnpremultiply.
#if QT_COMPILER_SUPPORTS_HERE(SSE4_1)
if (qCpuHasFeature(SSE4_1)) {
for (uint a = 0; a < 256; a++) {
for (uint c = 0; c <= a; c++) {
QRgb p = qRgba(c, a-c, c, a);
QCOMPARE(qUnpremultiply(p), qUnpremultiply_sse4(p));
}
}
return;
}
#endif
QSKIP("SSE4 not supported on this CPU.");
}
void tst_QColor::qrgba64()
{
QRgba64 rgb64 = QRgba64::fromRgba(0x22, 0x33, 0x44, 0xff);

View File

@ -0,0 +1,3 @@
# QTBUG-23837
[abortHostLookupInDifferentThread]
opensuse-13.1 64bit

View File

@ -14,5 +14,3 @@ wince*: {
# needed for getaddrinfo with official MinGW
mingw:DEFINES += _WIN32_WINNT=0x0501
linux-*:CONFIG+=insignificant_test # QTBUG-23837 - test is unstable

View File

@ -83,6 +83,10 @@ QT_USE_NAMESPACE
template <bool b> struct QTBUG_31218 {};
struct QTBUG_31218_Derived : QTBUG_31218<-1<0> {};
#if defined(Q_MOC_RUN)
class QTBUG_45790 : Bug() { };
#endif
struct MyStruct {};
struct MyStruct2 {};

View File

@ -97,7 +97,6 @@ public:
browseTorrents = new QPushButton(groupBox);
browseTorrents->setObjectName(QStringLiteral("browseTorrents"));
browseTorrents->setDefault(true);
gridLayout->addWidget(browseTorrents, 0, 3, 1, 1);
@ -205,6 +204,9 @@ public:
QObject::connect(okButton, SIGNAL(clicked()), AddTorrentFile, SLOT(accept()));
QObject::connect(cancelButton, SIGNAL(clicked()), AddTorrentFile, SLOT(reject()));
browseTorrents->setDefault(true);
QMetaObject::connectSlotsByName(AddTorrentFile);
} // setupUi

View File

@ -688,7 +688,6 @@ public:
buttonOk = new QPushButton(Config);
buttonOk->setObjectName(QStringLiteral("buttonOk"));
buttonOk->setAutoDefault(true);
buttonOk->setDefault(true);
hboxLayout3->addWidget(buttonOk);
@ -706,6 +705,9 @@ public:
QObject::connect(size_width, SIGNAL(valueChanged(int)), size_custom, SLOT(click()));
QObject::connect(size_height, SIGNAL(valueChanged(int)), size_custom, SLOT(click()));
buttonOk->setDefault(true);
QMetaObject::connectSlotsByName(Config);
} // setupUi

View File

@ -164,7 +164,6 @@ public:
vboxLayout1->setObjectName(QStringLiteral("vboxLayout1"));
findNxt = new QPushButton(FindDialog);
findNxt->setObjectName(QStringLiteral("findNxt"));
findNxt->setDefault(true);
findNxt->setFlat(false);
vboxLayout1->addWidget(findNxt);
@ -194,6 +193,9 @@ public:
retranslateUi(FindDialog);
QObject::connect(cancel, SIGNAL(clicked()), FindDialog, SLOT(reject()));
findNxt->setDefault(true);
QMetaObject::connectSlotsByName(FindDialog);
} // setupUi

View File

@ -171,7 +171,6 @@ public:
okButton = new QPushButton(QSqlConnectionDialogUi);
okButton->setObjectName(QStringLiteral("okButton"));
okButton->setDefault(true);
hboxLayout1->addWidget(okButton);
@ -202,6 +201,9 @@ public:
retranslateUi(QSqlConnectionDialogUi);
okButton->setDefault(true);
QMetaObject::connectSlotsByName(QSqlConnectionDialogUi);
} // setupUi

View File

@ -86,7 +86,6 @@ public:
connectButton = new QPushButton(Form);
connectButton->setObjectName(QStringLiteral("connectButton"));
connectButton->setEnabled(true);
connectButton->setDefault(true);
vboxLayout->addWidget(connectButton);
@ -136,7 +135,6 @@ public:
sendButton->setObjectName(QStringLiteral("sendButton"));
sendButton->setEnabled(false);
sendButton->setFocusPolicy(Qt::TabFocus);
sendButton->setDefault(true);
hboxLayout1->addWidget(sendButton);
@ -151,6 +149,10 @@ public:
QObject::connect(hostNameEdit, SIGNAL(returnPressed()), connectButton, SLOT(animateClick()));
QObject::connect(sessionInput, SIGNAL(returnPressed()), sendButton, SLOT(animateClick()));
connectButton->setDefault(true);
sendButton->setDefault(true);
QMetaObject::connectSlotsByName(Form);
} // setupUi

View File

@ -77,7 +77,6 @@ public:
buttonDisplay = new QPushButton(Layout16);
buttonDisplay->setObjectName(QStringLiteral("buttonDisplay"));
buttonDisplay->setAutoDefault(true);
buttonDisplay->setDefault(true);
hboxLayout->addWidget(buttonDisplay);
@ -96,6 +95,9 @@ public:
retranslateUi(TopicChooser);
buttonDisplay->setDefault(true);
QMetaObject::connectSlotsByName(TopicChooser);
} // setupUi

View File

@ -164,7 +164,6 @@ public:
vboxLayout2->setContentsMargins(0, 0, 0, 0);
findNxt = new QPushButton(TranslateDialog);
findNxt->setObjectName(QStringLiteral("findNxt"));
findNxt->setDefault(true);
findNxt->setFlat(false);
vboxLayout2->addWidget(findNxt);
@ -206,6 +205,9 @@ public:
retranslateUi(TranslateDialog);
QObject::connect(cancel, SIGNAL(clicked()), TranslateDialog, SLOT(reject()));
findNxt->setDefault(true);
QMetaObject::connectSlotsByName(TranslateDialog);
} // setupUi

View File

@ -39,6 +39,7 @@
#include <QtCore/QByteArray>
#include <QtCore/QLibraryInfo>
#include <QtCore/QTemporaryDir>
#include <QtCore/QStandardPaths>
class tst_uic : public QObject
{
@ -67,10 +68,12 @@ private:
const QString m_command;
QString m_baseline;
QTemporaryDir m_generated;
QRegExp m_versionRegexp;
};
tst_uic::tst_uic()
: m_command(QLibraryInfo::location(QLibraryInfo::BinariesPath) + QLatin1String("/uic"))
, m_versionRegexp(QLatin1String("Created by: Qt User Interface Compiler version [.\\d]{5,5}"))
{
}
@ -83,6 +86,7 @@ static QByteArray msgProcessStartFailed(const QString &command, const QString &w
void tst_uic::initTestCase()
{
QVERIFY(m_versionRegexp.isValid());
m_baseline = QFINDTESTDATA("baseline");
QVERIFY2(!m_baseline.isEmpty(), "Could not find 'baseline'.");
QProcess process;
@ -171,6 +175,37 @@ void tst_uic::run_data() const
}
}
// Helpers to generate a diff using the standard diff tool if present for failures.
static inline QString diffBinary()
{
QString binary = QLatin1String("diff");
#ifdef Q_OS_WIN
binary += QLatin1String(".exe");
#endif
return QStandardPaths::findExecutable(binary);
}
static QString generateDiff(const QString &originalFile, const QString &generatedFile)
{
static const QString diff = diffBinary();
if (diff.isEmpty())
return QString();
const QStringList args = QStringList() << QLatin1String("-u")
<< QDir::toNativeSeparators(originalFile)
<< QDir::toNativeSeparators(generatedFile);
QProcess diffProcess;
diffProcess.start(diff, args);
return diffProcess.waitForStarted() && diffProcess.waitForFinished()
? QString::fromLocal8Bit(diffProcess.readAllStandardOutput()) : QString();
}
static QByteArray msgCannotReadFile(const QFile &file)
{
const QString result = QLatin1String("Could not read file: ")
+ QDir::toNativeSeparators(file.fileName())
+ QLatin1String(": ") + file.errorString();
return result.toLocal8Bit();
}
void tst_uic::compare()
{
@ -180,23 +215,23 @@ void tst_uic::compare()
QFile orgFile(originalFile);
QFile genFile(generatedFile);
if (!orgFile.open(QIODevice::ReadOnly | QIODevice::Text)) {
QString err(QLatin1String("Could not read file: %1..."));
QFAIL(err.arg(orgFile.fileName()).toUtf8());
QVERIFY2(orgFile.open(QIODevice::ReadOnly | QIODevice::Text), msgCannotReadFile(orgFile));
QVERIFY2(genFile.open(QIODevice::ReadOnly | QIODevice::Text), msgCannotReadFile(genFile));
QString originalFileContents = orgFile.readAll();
originalFileContents.replace(m_versionRegexp, QString());
QString generatedFileContents = genFile.readAll();
generatedFileContents.replace(m_versionRegexp, QString());
if (generatedFileContents != originalFileContents) {
const QString diff = generateDiff(originalFile, generatedFile);
if (!diff.isEmpty())
qWarning().noquote().nospace() << "Difference:\n" << diff;
}
if (!genFile.open(QIODevice::ReadOnly | QIODevice::Text)) {
QString err(QLatin1String("Could not read file: %1..."));
QFAIL(err.arg(genFile.fileName()).toUtf8());
}
originalFile = orgFile.readAll();
originalFile.replace(QRegExp(QLatin1String("Created by: Qt User Interface Compiler version [.\\d]{5,5}")), "");
generatedFile = genFile.readAll();
generatedFile.replace(QRegExp(QLatin1String("Created by: Qt User Interface Compiler version [.\\d]{5,5}")), "");
QCOMPARE(generatedFile, originalFile);
QCOMPARE(generatedFileContents, originalFileContents);
}
void tst_uic::compare_data() const
@ -240,28 +275,31 @@ void tst_uic::runTranslation()
void tst_uic::runCompare()
{
QFile orgFile(m_baseline + QLatin1String("/translation/Dialog_without_Buttons_tr.h"));
const QString dialogFile = QLatin1String("/translation/Dialog_without_Buttons_tr.h");
const QString originalFile = m_baseline + dialogFile;
QFile orgFile(originalFile);
QDir generated(m_generated.path());
QFile genFile(generated.absolutePath() + QLatin1String("/translation/Dialog_without_Buttons_tr.h"));
const QString generatedFile = generated.absolutePath() + dialogFile;
QFile genFile(generatedFile);
if (!orgFile.open(QIODevice::ReadOnly | QIODevice::Text)) {
QString err(QLatin1String("Could not read file: %1..."));
QFAIL(err.arg(orgFile.fileName()).toUtf8());
QVERIFY2(orgFile.open(QIODevice::ReadOnly | QIODevice::Text), msgCannotReadFile(orgFile));
QVERIFY2(genFile.open(QIODevice::ReadOnly | QIODevice::Text), msgCannotReadFile(genFile));
QString originalFileContents = orgFile.readAll();
originalFileContents.replace(m_versionRegexp, QString());
QString generatedFileContents = genFile.readAll();
generatedFileContents.replace(m_versionRegexp, QString());
if (generatedFileContents != originalFileContents) {
const QString diff = generateDiff(originalFile, generatedFile);
if (!diff.isEmpty())
qWarning().noquote().nospace() << "Difference:\n" << diff;
}
if (!genFile.open(QIODevice::ReadOnly | QIODevice::Text)) {
QString err(QLatin1String("Could not read file: %1..."));
QFAIL(err.arg(genFile.fileName()).toUtf8());
}
QString originalFile = orgFile.readAll();
originalFile.replace(QRegExp(QLatin1String("Created by: Qt User Interface Compiler version [.\\d]{5,5}")), "");
QString generatedFile = genFile.readAll();
generatedFile.replace(QRegExp(QLatin1String("Created by: Qt User Interface Compiler version [.\\d]{5,5}")), "");
QCOMPARE(generatedFile, originalFile);
QCOMPARE(generatedFileContents, originalFileContents);
}
QTEST_MAIN(tst_uic)

View File

@ -1,2 +1,2 @@
[sorting]
osx
[ensureUpdateOnTextItem]
osx-10.10

View File

@ -0,0 +1,3 @@
QTBUG-45531
[task260974_menuItemRectangleForComboBoxPopup]
osx-10.10

View File

@ -72,6 +72,7 @@ private slots:
void setTitleBarWidget();
void titleBarDoubleClick();
void restoreStateOfFloating();
void restoreDockWidget();
// task specific tests:
void task165177_deleteFocusWidget();
void task169808_setFloating();
@ -694,20 +695,78 @@ void tst_QDockWidget::titleBarDoubleClick()
QCOMPARE(win.dockWidgetArea(&dock), Qt::TopDockWidgetArea);
}
static QDockWidget *createTestDock(QMainWindow &parent)
{
const QString title = QStringLiteral("dock1");
QDockWidget *dock = new QDockWidget(title, &parent);
dock->setObjectName(title);
dock->setAllowedAreas(Qt::AllDockWidgetAreas);
return dock;
}
void tst_QDockWidget::restoreStateOfFloating()
{
QMainWindow mw;
QDockWidget dock;
dock.setObjectName("dock1");
mw.addDockWidget(Qt::TopDockWidgetArea, &dock);
QVERIFY(!dock.isFloating());
QDockWidget *dock = createTestDock(mw);
mw.addDockWidget(Qt::TopDockWidgetArea, dock);
QVERIFY(!dock->isFloating());
QByteArray ba = mw.saveState();
dock.setFloating(true);
QVERIFY(dock.isFloating());
dock->setFloating(true);
QVERIFY(dock->isFloating());
QVERIFY(mw.restoreState(ba));
QVERIFY(!dock.isFloating());
QVERIFY(!dock->isFloating());
}
void tst_QDockWidget::restoreDockWidget()
{
QByteArray geometry;
QByteArray state;
const QString name = QStringLiteral("main");
const QRect availableGeometry = QApplication::desktop()->availableGeometry();
const QSize size = availableGeometry.size() / 5;
const QPoint mainWindowPos = availableGeometry.bottomRight() - QPoint(size.width(), size.height()) - QPoint(100, 100);
const QPoint dockPos = availableGeometry.center();
{
QMainWindow saveWindow;
saveWindow.setObjectName(name);
saveWindow.setWindowTitle(QTest::currentTestFunction() + QStringLiteral(" save"));
saveWindow.resize(size);
saveWindow.move(mainWindowPos);
saveWindow.restoreState(QByteArray());
QDockWidget *dock = createTestDock(saveWindow);
QVERIFY(!saveWindow.restoreDockWidget(dock)); // Not added, no placeholder
saveWindow.addDockWidget(Qt::TopDockWidgetArea, dock);
dock->setFloating(true);
dock->resize(size);
dock->move(dockPos);
saveWindow.show();
QVERIFY(QTest::qWaitForWindowExposed(&saveWindow));
QVERIFY(dock->isFloating());
state = saveWindow.saveState();
geometry = saveWindow.saveGeometry();
}
QVERIFY(!geometry.isEmpty());
QVERIFY(!state.isEmpty());
{
QMainWindow restoreWindow;
restoreWindow.setObjectName(name);
restoreWindow.setWindowTitle(QTest::currentTestFunction() + QStringLiteral(" restore"));
QVERIFY(restoreWindow.restoreState(state));
QVERIFY(restoreWindow.restoreGeometry(geometry));
// QMainWindow::restoreDockWidget() restores the state when adding the dock
// after restoreState().
QDockWidget *dock = createTestDock(restoreWindow);
QVERIFY(restoreWindow.restoreDockWidget(dock));
restoreWindow.show();
QVERIFY(QTest::qWaitForWindowExposed(&restoreWindow));
QTRY_VERIFY(dock->isFloating());
QTRY_COMPARE(dock->pos(), dockPos);
}
}
void tst_QDockWidget::task165177_deleteFocusWidget()
{

View File

@ -21,7 +21,7 @@ bool QOpenGLExtension_OES_EGL_image::initializeOpenGLFunctions()
Q_D(QOpenGLExtension_OES_EGL_image);
d->EGLImageTargetTexture2DOES = (void (QOPENGLF_APIENTRYP)(GLenum target, GLeglImageOES image))context->getProcAddress("glEGLImageTargetTexture2DOES");
d->EGLImageTargetRenderbufferStorageOES = (void (QOPENGLF_APIENTRYP)(GLenum target, GLeglImageOES image))context->getProcAddress("glEGLImageTargetRenderbufferStorageOESs");
d->EGLImageTargetRenderbufferStorageOES = (void (QOPENGLF_APIENTRYP)(GLenum target, GLeglImageOES image))context->getProcAddress("glEGLImageTargetRenderbufferStorageOES");
return QAbstractOpenGLExtension::initializeOpenGLFunctions();
}