Merge remote-tracking branch 'origin/5.5' into HEAD
Conflicts: src/plugins/platforms/windows/qwindowsopengltester.cpp Change-Id: Ia7abeba9395ccf84e2fa81b91a5725a86dedb9fe
This commit is contained in:
commit
b2603b7665
9
configure
vendored
9
configure
vendored
@ -682,6 +682,9 @@ CFG_XCB=auto
|
||||
CFG_XCB_XLIB=auto
|
||||
CFG_XCB_GLX=no
|
||||
CFG_EGLFS=auto
|
||||
CFG_EGLFS_BRCM=no
|
||||
CFG_EGLFS_MALI=no
|
||||
CFG_EGLFS_VIV=no
|
||||
CFG_DIRECTFB=auto
|
||||
CFG_LINUXFB=auto
|
||||
CFG_KMS=auto
|
||||
@ -2697,7 +2700,7 @@ MacOS/iOS options:
|
||||
link tools against those frameworks.
|
||||
-no-framework ...... Do not build Qt as a series of frameworks.
|
||||
|
||||
-secure-transport .. Use SecureTransport instead of OpenSSL (requires -no-openssl)
|
||||
-securetransport ... Use SecureTransport instead of OpenSSL (requires -no-openssl)
|
||||
|
||||
-sdk <sdk> ......... Build Qt using Apple provided SDK <sdk>. The argument should be
|
||||
one of the available SDKs as listed by 'xcodebuild -showsdks'.
|
||||
@ -2842,7 +2845,7 @@ if [ -z "$PLATFORM" ]; then
|
||||
Linux:*)
|
||||
PLATFORM=linux-g++
|
||||
PLATFORM_NOTES="
|
||||
- Also available for Linux: linux-kcc linux-icc linux-cxx
|
||||
- Also available for Linux: linux-clang linux-kcc linux-icc linux-cxx
|
||||
"
|
||||
;;
|
||||
SunOS:5*)
|
||||
@ -4236,7 +4239,7 @@ compileTestWithPkgConfig()
|
||||
libdir_mod=`echo $libdir_raw | sed -e 's,^-L,,g' -e 's, -L, ,g'`
|
||||
has_used_pkg_config="yes"
|
||||
fi
|
||||
if compileTest $configtest $configtest_name $libdir_raw $incdir_raw $libs $cflags "$@"; then
|
||||
if compileTest $configtest "$configtest_name" $libdir_raw $incdir_raw $libs $cflags "$@"; then
|
||||
if [ "$has_used_pkg_config" = "yes" ] && [ -n "$qmake_postfix" ]; then
|
||||
QMakeVar set QMAKE_INCDIR_$qmake_postfix "`shellArgumentListToQMakeList $incdir_mod`"
|
||||
QMakeVar set QMAKE_LIBDIR_$qmake_postfix "`shellArgumentListToQMakeList $libdir_mod`"
|
||||
|
@ -60,16 +60,16 @@ if errorlevel 1 goto exit
|
||||
echo #### Generated by configure.bat - DO NOT EDIT! ####> Makefile
|
||||
echo/>> Makefile
|
||||
for /f "tokens=3 usebackq" %%V in (`findstr QT_VERSION_STR %QTSRC%src\corelib\global\qglobal.h`) do @echo QTVERSION = %%~V>> Makefile
|
||||
if not "%cl.exe%" == "" (
|
||||
echo CXX = cl>>Makefile
|
||||
echo EXTRA_CXXFLAGS =>>Makefile
|
||||
if not "%icl.exe%" == "" (
|
||||
echo CXX = icl>>Makefile
|
||||
echo EXTRA_CXXFLAGS = /Zc:forScope>>Makefile
|
||||
rem This must have a trailing space.
|
||||
echo QTSRC = %QTSRC% >> Makefile
|
||||
set tmpl=win32
|
||||
set make=nmake
|
||||
) else if not "%icl.exe%" == "" (
|
||||
echo CXX = icl>>Makefile
|
||||
echo EXTRA_CXXFLAGS = /Zc:forScope>>Makefile
|
||||
) else if not "%cl.exe%" == "" (
|
||||
echo CXX = cl>>Makefile
|
||||
echo EXTRA_CXXFLAGS =>>Makefile
|
||||
rem This must have a trailing space.
|
||||
echo QTSRC = %QTSRC% >> Makefile
|
||||
set tmpl=win32
|
||||
|
@ -11,61 +11,61 @@ HTML.footer += \
|
||||
" <div class=\"footer-main\">\n" \
|
||||
" <div class=\"container clearfix\">\n" \
|
||||
" <nav class=\"footer-nav clearfix\">\n" \
|
||||
" <div class=\"menu-footer-menu-container\"><ul id=\"menu-footer-menu\" class=\"menu\"><li id=\"menu-item-1350\" class=\"menu-item menu-item-type-post_type menu-item-object-page menu-item-has-children menu-item-1350\"><a href=\"http://qt.io/about-us/\">About us</a>\n" \
|
||||
" <div class=\"menu-footer-menu-container\"><ul id=\"menu-footer-menu\" class=\"menu\"><li id=\"menu-item-1403\" class=\"menu-item menu-item-type-post_type menu-item-object-page menu-item-has-children menu-item-1403\"><a href=\"http://qt.io/download/\">Download</a>\n" \
|
||||
"<ul class=\"sub-menu\">\n" \
|
||||
" <li id=\"menu-item-1353\" class=\"menu-item menu-item-type-post_type menu-item-object-page menu-item-1353\"><a href=\"http://qt.io/events/\">Training & Events</a></li>\n" \
|
||||
" <li id=\"menu-item-1596\" class=\"menu-item menu-item-type-post_type menu-item-object-page menu-item-1596\"><a href=\"http://qt.io/news/\">News</a></li>\n" \
|
||||
" <li id=\"menu-item-1354\" class=\"menu-item menu-item-type-post_type menu-item-object-page menu-item-1354\"><a href=\"http://qt.io/resource-center/\">Resource Center</a></li>\n" \
|
||||
" <li id=\"menu-item-1352\" class=\"menu-item menu-item-type-post_type menu-item-object-page menu-item-1352\"><a href=\"http://qt.io/partners/\">Partners</a></li>\n" \
|
||||
" <li id=\"menu-item-1349\" class=\"menu-item menu-item-type-post_type menu-item-object-page menu-item-1349\"><a href=\"http://qt.io/careers/\">Careers</a></li>\n" \
|
||||
" <li id=\"menu-item-11676\" class=\"menu-item menu-item-type-post_type menu-item-object-page menu-item-11676\"><a href=\"http://qt.io/locations/\">Locations</a></li>\n" \
|
||||
" <li id=\"menu-item-11677\" class=\"menu-item menu-item-type-custom menu-item-object-custom menu-item-11677\"><a href=\"http://qt.io/download/\">Start for Free</a></li>\n" \
|
||||
" <li id=\"menu-item-15840\" class=\"menu-item menu-item-type-post_type menu-item-object-page menu-item-15840\"><a href=\"http://qt.io/download-eval-for-applications-step-2/\">Qt for Application Development</a></li>\n" \
|
||||
" <li id=\"menu-item-15841\" class=\"menu-item menu-item-type-post_type menu-item-object-page menu-item-15841\"><a href=\"http://qt.io/request-eval-for-devices-step-2/\">Qt for Device Creation</a></li>\n" \
|
||||
" <li id=\"menu-item-15838\" class=\"menu-item menu-item-type-post_type menu-item-object-page menu-item-15838\"><a href=\"http://qt.io/download-open-source/\">Qt Open Source</a></li>\n" \
|
||||
" <li id=\"menu-item-1415\" class=\"menu-item menu-item-type-post_type menu-item-object-page menu-item-1415\"><a href=\"http://qt.io/terms-conditions/\">Terms & Conditions</a></li>\n" \
|
||||
" <li id=\"menu-item-14184\" class=\"menu-item menu-item-type-post_type menu-item-object-page menu-item-14184\"><a href=\"http://qt.io/FAQ/\">Licensing FAQ</a></li>\n" \
|
||||
"</ul>\n" \
|
||||
"</li>\n" \
|
||||
"<li id=\"menu-item-1355\" class=\"menu-item menu-item-type-post_type menu-item-object-page menu-item-has-children menu-item-1355\"><a href=\"http://qt.io/product/\">Product</a>\n" \
|
||||
"<ul class=\"sub-menu\">\n" \
|
||||
" <li id=\"menu-item-1358\" class=\"menu-item menu-item-type-post_type menu-item-object-page menu-item-1358\"><a href=\"http://qt.io/qt-framework/\">Qt Framework</a></li>\n" \
|
||||
" <li id=\"menu-item-1356\" class=\"menu-item menu-item-type-post_type menu-item-object-page menu-item-1356\"><a href=\"http://qt.io/qt-features/\">Qt Features</a></li>\n" \
|
||||
" <li id=\"menu-item-1359\" class=\"menu-item menu-item-type-post_type menu-item-object-page menu-item-1359\"><a href=\"http://qt.io/qt-quick/\">Qt Quick</a></li>\n" \
|
||||
" <li id=\"menu-item-12576\" class=\"menu-item menu-item-type-post_type menu-item-object-page menu-item-12576\"><a href=\"http://qt.io/product/\">Qt in Use</a></li>\n" \
|
||||
" <li id=\"menu-item-15848\" class=\"menu-item menu-item-type-post_type menu-item-object-page menu-item-15848\"><a href=\"http://qt.io/application-development/\">Qt for Application Development</a></li>\n" \
|
||||
" <li id=\"menu-item-1357\" class=\"menu-item menu-item-type-post_type menu-item-object-page menu-item-1357\"><a href=\"http://qt.io/qt-for-device-creation/\">Qt for Device Creation</a></li>\n" \
|
||||
" <li id=\"menu-item-10159\" class=\"menu-item menu-item-type-post_type menu-item-object-page menu-item-10159\"><a href=\"http://qt.io/mobile-app-development/\">Qt for Mobile Apps</a></li>\n" \
|
||||
" <li id=\"menu-item-12576\" class=\"menu-item menu-item-type-post_type menu-item-object-page menu-item-12576\"><a href=\"http://qt.io/qt-in-use/\">Qt in Use</a></li>\n" \
|
||||
" <li id=\"menu-item-1356\" class=\"menu-item menu-item-type-post_type menu-item-object-page menu-item-1356\"><a href=\"http://qt.io/qt-features/\">Commercial Features</a></li>\n" \
|
||||
" <li id=\"menu-item-15850\" class=\"menu-item menu-item-type-post_type menu-item-object-page menu-item-15850\"><a href=\"http://qt.io/ide/\">Qt Creator IDE</a></li>\n" \
|
||||
" <li id=\"menu-item-1359\" class=\"menu-item menu-item-type-post_type menu-item-object-page menu-item-1359\"><a href=\"http://qt.io/qt-quick/\">Qt Quick</a></li>\n" \
|
||||
"</ul>\n" \
|
||||
"</li>\n" \
|
||||
"<li id=\"menu-item-1347\" class=\"menu-item menu-item-type-post_type menu-item-object-page current-menu-ancestor current-menu-parent current_page_parent current_page_ancestor menu-item-has-children menu-item-1347\"><a href=\"http://qt.io/services/\">Services</a>\n" \
|
||||
"<ul class=\"sub-menu\">\n" \
|
||||
" <li id=\"menu-item-4028\" class=\"menu-item menu-item-type-post_type menu-item-object-page menu-item-4028\"><a href=\"http://qt.io/services-technology-evaluation/\">Technology Evaluation</a></li>\n" \
|
||||
" <li id=\"menu-item-4027\" class=\"menu-item menu-item-type-post_type menu-item-object-page menu-item-4027\"><a href=\"http://qt.io/services-proof-of-concept/\">Proof of Concept</a></li>\n" \
|
||||
" <li id=\"menu-item-4026\" class=\"menu-item menu-item-type-post_type menu-item-object-page menu-item-4026\"><a href=\"http://qt.io/services-design-implementation/\">Design & Implementation</a></li>\n" \
|
||||
" <li id=\"menu-item-4025\" class=\"menu-item menu-item-type-post_type menu-item-object-page menu-item-4025\"><a href=\"http://qt.io/services-productization/\">Productization</a></li>\n" \
|
||||
" <li id=\"menu-item-15863\" class=\"menu-item menu-item-type-post_type menu-item-object-page menu-item-15863\"><a href=\"http://qt.io/qt-training/\">Qt Training</a></li>\n" \
|
||||
" <li id=\"menu-item-4779\" class=\"menu-item menu-item-type-custom menu-item-object-custom menu-item-4779\"><a href=\"https://qt.io/partners/\">Partner Network</a></li>\n" \
|
||||
"</ul>\n" \
|
||||
"</li>\n" \
|
||||
"<li id=\"menu-item-33\" class=\"menu-item menu-item-type-post_type menu-item-object-page menu-item-has-children menu-item-33\"><a href=\"http://qt.io/developers/\">Developers</a>\n" \
|
||||
"<ul class=\"sub-menu\">\n" \
|
||||
" <li id=\"menu-item-1365\" class=\"menu-item menu-item-type-custom menu-item-object-custom menu-item-1365\"><a href=\"http://doc.qt.io/\">Documentation</a></li>\n" \
|
||||
" <li id=\"menu-item-1364\" class=\"menu-item menu-item-type-custom menu-item-object-custom menu-item-1364\"><a href=\"http://doc.qt.io/qt-5/qtexamplesandtutorials.html\">Examples & Tutorials</a></li>\n" \
|
||||
" <li id=\"menu-item-1363\" class=\"menu-item menu-item-type-custom menu-item-object-custom menu-item-1363\"><a href=\"http://doc.qt.io/qt-5/topics-app-development.html\">Tools</a></li>\n" \
|
||||
" <li id=\"menu-item-1363\" class=\"menu-item menu-item-type-custom menu-item-object-custom menu-item-1363\"><a href=\"http://doc.qt.io/qt-5/topics-app-development.html\">Development Tools</a></li>\n" \
|
||||
" <li id=\"menu-item-1361\" class=\"menu-item menu-item-type-custom menu-item-object-custom menu-item-1361\"><a href=\"http://wiki.qt.io/\">Wiki</a></li>\n" \
|
||||
" <li id=\"menu-item-1360\" class=\"menu-item menu-item-type-custom menu-item-object-custom menu-item-1360\"><a href=\"http://forum.qt.io/\">Forums</a></li>\n" \
|
||||
" <li id=\"menu-item-1362\" class=\"menu-item menu-item-type-custom menu-item-object-custom menu-item-1362\"><a href=\"http://wiki.qt.io/Qt_Contribution_Guidelines\">Contribute to Qt</a></li>\n" \
|
||||
" <li id=\"menu-item-15922\" class=\"menu-item menu-item-type-custom menu-item-object-custom menu-item-15922\"><a href=\"http://wiki.qt.io/contribute\">Contribute to Qt</a></li>\n" \
|
||||
"</ul>\n" \
|
||||
"</li>\n" \
|
||||
"<li id=\"menu-item-1347\" class=\"menu-item menu-item-type-post_type menu-item-object-page current-menu-ancestor current-menu-parent current_page_parent current_page_ancestor menu-item-has-children menu-item-1347\"><a href=\"http://qt.io/services/\">Services</a>\n" \
|
||||
"<li id=\"menu-item-1350\" class=\"menu-item menu-item-type-post_type menu-item-object-page menu-item-has-children menu-item-1350\"><a href=\"http://qt.io/about-us/\">About us</a>\n" \
|
||||
"<ul class=\"sub-menu\">\n" \
|
||||
" <li id=\"menu-item-32\" class=\"menu-item menu-item-type-post_type menu-item-object-page page_item page-item-14 menu-item-32\"><a href=\"http://qt.io/support/\">Support</a></li>\n" \
|
||||
" <li id=\"menu-item-4028\" class=\"menu-item menu-item-type-post_type menu-item-object-page menu-item-4028\"><a href=\"http://qt.io/services-technology-evaluation/\">Technology Evaluation</a></li>\n" \
|
||||
" <li id=\"menu-item-4027\" class=\"menu-item menu-item-type-post_type menu-item-object-page menu-item-4027\"><a href=\"http://qt.io/services-proof-of-concept/\">Proof of Concept</a></li>\n" \
|
||||
" <li id=\"menu-item-4026\" class=\"menu-item menu-item-type-post_type menu-item-object-page menu-item-4026\"><a href=\"http://qt.io/services-design-implementation/\">Design & Implementation</a></li>\n" \
|
||||
" <li id=\"menu-item-4025\" class=\"menu-item menu-item-type-post_type menu-item-object-page menu-item-4025\"><a href=\"http://qt.io/services-productization/\">Productization</a></li>\n" \
|
||||
" <li id=\"menu-item-5124\" class=\"menu-item menu-item-type-custom menu-item-object-custom menu-item-5124\"><a href=\"https://qtcloudservices.com/\">Qt Cloud Services</a></li>\n" \
|
||||
"</ul>\n" \
|
||||
"</li>\n" \
|
||||
"<li id=\"menu-item-1403\" class=\"menu-item menu-item-type-post_type menu-item-object-page menu-item-has-children menu-item-1403\"><a href=\"http://qt.io/download/\">Download</a>\n" \
|
||||
"<ul class=\"sub-menu\">\n" \
|
||||
" <li id=\"menu-item-11677\" class=\"menu-item menu-item-type-custom menu-item-object-custom menu-item-11677\"><a href=\"http://qt.io/download/\">Free 30-Day Trial</a></li>\n" \
|
||||
" <li id=\"menu-item-1982\" class=\"menu-item menu-item-type-post_type menu-item-object-page menu-item-1982\"><a href=\"http://qt.io/buy-enterprise-step-2/\">Enterprise</a></li>\n" \
|
||||
" <li id=\"menu-item-1985\" class=\"menu-item menu-item-type-post_type menu-item-object-page menu-item-1985\"><a href=\"http://qt.io/buy-professional-step-2/\">Professional</a></li>\n" \
|
||||
" <li id=\"menu-item-3346\" class=\"menu-item menu-item-type-post_type menu-item-object-page menu-item-3346\"><a href=\"http://qt.io/buy-indiemobile-step-2/\">Indie Mobile</a></li>\n" \
|
||||
" <li id=\"menu-item-3343\" class=\"menu-item menu-item-type-post_type menu-item-object-page menu-item-3343\"><a href=\"http://qt.io/download-open-source/\">Community</a></li>\n" \
|
||||
" <li id=\"menu-item-1415\" class=\"menu-item menu-item-type-post_type menu-item-object-page menu-item-1415\"><a href=\"http://qt.io/terms-conditions/\">Legal | Terms & Conditions</a></li>\n" \
|
||||
" <li id=\"menu-item-1353\" class=\"menu-item menu-item-type-post_type menu-item-object-page menu-item-1353\"><a href=\"http://qt.io/events/\">Training & Events</a></li>\n" \
|
||||
" <li id=\"menu-item-1354\" class=\"menu-item menu-item-type-post_type menu-item-object-page menu-item-1354\"><a href=\"http://qt.io/resource-center/\">Resource Center</a></li>\n" \
|
||||
" <li id=\"menu-item-12285\" class=\"menu-item menu-item-type-post_type menu-item-object-page menu-item-12285\"><a href=\"http://qt.io/news/\">News</a></li>\n" \
|
||||
" <li id=\"menu-item-1349\" class=\"menu-item menu-item-type-post_type menu-item-object-page menu-item-1349\"><a href=\"http://qt.io/careers/\">Careers</a></li>\n" \
|
||||
" <li id=\"menu-item-11676\" class=\"menu-item menu-item-type-post_type menu-item-object-page menu-item-11676\"><a href=\"http://qt.io/locations/\">Locations</a></li>\n" \
|
||||
" <li id=\"menu-item-15911\" class=\"menu-item menu-item-type-post_type menu-item-object-page menu-item-15911\"><a href=\"http://qt.io/contact-us\">Contact Us</a></li>\n" \
|
||||
"</ul>\n" \
|
||||
"</li>\n" \
|
||||
"</ul></div></nav>\n" \
|
||||
"<a href=\"http://qt.io/about-us/\" target=\"_blank\" class=\"theqtcompany\"></a>\n" \
|
||||
" <div class=\"footer-social clearfix\">\n" \
|
||||
" <div class=\"facebook\">\n" \
|
||||
" <iframe scrolling=\"no\" frameborder=\"0\" allowTransparency=\"true\" src=\"//www.facebook.com/plugins/like.php?href=https%3A%2F%2Fwww.facebook.com%2Fqt&width&layout=button_count&action=like&show_faces=true&share=false&height=21\" style=\"border:none;overflow:hidden;height:21px;\"></iframe>\n" \
|
||||
" <iframe scrolling=\"no\" frameborder=\"0\" allowTransparency=\"true\" src=\"http://www.facebook.com/plugins/like.php?href=https%3A%2F%2Fwww.facebook.com%2Fqt&width&layout=button_count&action=like&show_faces=true&share=false&height=21\" style=\"border:none;overflow:hidden;height:21px;\"></iframe>\n" \
|
||||
" </div>\n" \
|
||||
" <div class=\"twitter\">\n" \
|
||||
" <iframe id=\"twitter-widget-0\" scrolling=\"no\" frameborder=\"0\" allowtransparency=\"true\" src=\"http://platform.twitter.com/widgets/follow_button.33b190ea0cba008796487b65df7f6d8e.en.html#_=1414403615717&id=twitter-widget-0&lang=en&screen_name=qtproject&show_count=true&show_screen_name=false&size=m\" class=\"twitter-follow-button twitter-follow-button\" title=\"Twitter Follow Button\" data-twttr-rendered=\"true\" style=\"width: 160px; height: 20px;\"></iframe>\n" \
|
||||
|
@ -770,7 +770,7 @@ body.qt-account #navbar .navbar-oneQt h2 {
|
||||
#footerbar .theqtcompany {
|
||||
background:url("theqtcompany.png") no-repeat;
|
||||
background-size:100%;
|
||||
width:150px;
|
||||
width:215px;
|
||||
height:68px;
|
||||
display:inline;
|
||||
float:right;
|
||||
|
Binary file not shown.
Before Width: | Height: | Size: 12 KiB After Width: | Height: | Size: 31 KiB |
@ -124,10 +124,16 @@
|
||||
|
||||
\snippet widgets/imageviewer/imageviewer.cpp 2
|
||||
|
||||
In the \c loadFile() function, we check if the file's
|
||||
format is an image format by constructing a QImage which tries to
|
||||
load the image from the file. If the constructor returns a null
|
||||
image, we use a QMessageBox to alert the user.
|
||||
In the \c loadFile() function, we instantiate a QImageReader
|
||||
and enable automatic transformations by calling
|
||||
QImageReader::setAutoTransform(). For files in JPEG format,
|
||||
this ensures that portrait mode images of digital cameras are shown
|
||||
correctly by applying the appropriate orientation read from the
|
||||
EXIF meta data stored in the image file.
|
||||
|
||||
We then load the image using QImageReader::read(). If this returns
|
||||
a null image, indicating that the file is not an image file,
|
||||
we use a QMessageBox to alert the user.
|
||||
|
||||
The QMessageBox class provides a modal dialog with a short
|
||||
message, an icon, and some buttons. As with QFileDialog the
|
||||
|
@ -202,6 +202,7 @@ QImage ImageWidget::loadImage(const QString &fileName)
|
||||
{
|
||||
qDebug() << position << files << fileName;
|
||||
QImageReader reader(fileName);
|
||||
reader.setAutoTransform(true);
|
||||
qCDebug(lcExample) << "loading" << QDir::toNativeSeparators(fileName) << position << '/' << files.size();
|
||||
if (!reader.canRead()) {
|
||||
qCWarning(lcExample) << QDir::toNativeSeparators(fileName) << ": can't load image";
|
||||
|
@ -69,7 +69,9 @@ ImageViewer::ImageViewer()
|
||||
|
||||
bool ImageViewer::loadFile(const QString &fileName)
|
||||
{
|
||||
QImage image(fileName);
|
||||
QImageReader reader(fileName);
|
||||
reader.setAutoTransform(true);
|
||||
const QImage image = reader.read();
|
||||
if (image.isNull()) {
|
||||
QMessageBox::information(this, QGuiApplication::applicationDisplayName(),
|
||||
tr("Cannot load %1.").arg(QDir::toNativeSeparators(fileName)));
|
||||
|
@ -48,10 +48,10 @@ warnings_are_errors:warning_clean {
|
||||
# compiler.
|
||||
clang {
|
||||
# Apple clang 4.0-4.2,5.0-5.1
|
||||
# Regular clang 3.3 & 3.4
|
||||
# Regular clang 3.3-3.6
|
||||
apple_ver = $${QT_APPLE_CLANG_MAJOR_VERSION}.$${QT_APPLE_CLANG_MINOR_VERSION}
|
||||
reg_ver = $${QT_CLANG_MAJOR_VERSION}.$${QT_CLANG_MINOR_VERSION}
|
||||
contains(apple_ver, "4\\.[012]|5\\.[01]")|contains(reg_ver, "3\\.[34]") {
|
||||
contains(apple_ver, "4\\.[012]|5\\.[01]")|contains(reg_ver, "3\\.[3-6]") {
|
||||
QMAKE_CXXFLAGS_WARN_ON += -Werror -Wno-error=\\$${LITERAL_HASH}warnings -Wno-error=deprecated-declarations $$WERROR
|
||||
}
|
||||
} else:intel_icc:linux {
|
||||
@ -67,9 +67,9 @@ warnings_are_errors:warning_clean {
|
||||
QMAKE_CXXFLAGS_WARN_ON += -Werror -ww177,1224,1478,1881 $$WERROR
|
||||
}
|
||||
} else:gcc:!clang:!intel_icc {
|
||||
# GCC 4.6-4.9
|
||||
# GCC 4.6-4.9, 5.x
|
||||
ver = $${QT_GCC_MAJOR_VERSION}.$${QT_GCC_MINOR_VERSION}
|
||||
contains(ver, "4\\.[6789]") {
|
||||
contains(ver, "(4\\.[6789]|5\\..)") {
|
||||
QMAKE_CXXFLAGS_WARN_ON += -Werror -Wno-error=cpp -Wno-error=deprecated-declarations $$WERROR
|
||||
|
||||
# GCC prints this bogus warning, after it has inlined a lot of code
|
||||
|
@ -55,7 +55,7 @@ win32 {
|
||||
equals(TEMPLATE, lib) {
|
||||
static {
|
||||
QMAKE_RESOLVED_TARGET = $${QMAKE_RESOLVED_TARGET}$${LIBPREFIX}$${TARGET}.a
|
||||
} else:plugin {
|
||||
} else: plugin|unversioned_libname {
|
||||
QMAKE_RESOLVED_TARGET = $${QMAKE_RESOLVED_TARGET}$${LIBPREFIX}$${TARGET}.so
|
||||
} else {
|
||||
TEMP_VERSION = $$VERSION
|
||||
|
47
mkspecs/wince80colibri-armv7-msvc2012/qmake.conf
Normal file
47
mkspecs/wince80colibri-armv7-msvc2012/qmake.conf
Normal file
@ -0,0 +1,47 @@
|
||||
# qmake configuration for Windows Embedded Compact 2013 with VS2012 on ARM targets
|
||||
#
|
||||
# This is just a template for creating WEC2013 mkspecs for ARM targets
|
||||
# Replace the SDK name with actual SDK name.
|
||||
|
||||
include(../common/wince/qmake.conf)
|
||||
|
||||
CE_SDK = Toradex_CE8_SDK # replace with actual SDK name
|
||||
CE_ARCH = ARMV7
|
||||
QT_CONFIG -= accessibility
|
||||
|
||||
DEFINES += QT_NO_CLIPBOARD QT_NO_ACCESSIBILITY QT_NO_NATIVE_GESTURES QT_NOSTANDARDSHELL_UI_MODEL _CRT_SECURE_NO_DEPRECATE _WIN32_WCE=0x800 $$CE_ARCH _AMRV7_ armv7 _ARM_ UNDER_CE WINCE ARM
|
||||
|
||||
#QMAKE_CXXFLAGS += /P
|
||||
QMAKE_CFLAGS_RELEASE += -O2 -MT
|
||||
QMAKE_CFLAGS_RELEASE_WITH_DEBUGINFO += -O2 -MT -Zi
|
||||
QMAKE_CFLAGS_DEBUG += -Zi -MTd
|
||||
QMAKE_CFLAGS_RELEASE -= -MD
|
||||
QMAKE_CFLAGS_RELEASE_WITH_DEBUGINFO -= -MD
|
||||
QMAKE_CFLAGS_DEBUG -= -MDd
|
||||
QMAKE_CXXFLAGS_RELEASE -= -MD
|
||||
QMAKE_CXXFLAGS_RELEASE += -MT
|
||||
QMAKE_CXXFLAGS_RELEASE_WITH_DEBUGINFO += -MT
|
||||
QMAKE_CXXFLAGS_RELEASE_WITH_DEBUGINFO -= -MD
|
||||
QMAKE_CXXFLAGS_DEBUG -= -MDd
|
||||
QMAKE_CXXFLAGS_DEBUG += -MTd
|
||||
QMAKE_INCDIR_OPENGL_ES2 += $$(NV_WINCE_T2_PLAT)/include
|
||||
QMAKE_LFLAGS_CONSOLE = /SUBSYSTEM:WINDOWSCE,8.00 /MACHINE:ARM /ENTRY:mainCRTStartup
|
||||
QMAKE_LFLAGS_WINDOWS = /SUBSYSTEM:WINDOWSCE,8.00 /MACHINE:ARM
|
||||
QMAKE_LFLAGS_DLL = /SUBSYSTEM:WINDOWSCE,8.00 /MACHINE:ARM /DLL /SAFESEH:NO
|
||||
QMAKE_LIBFLAGS_RELEASE = /LTCG
|
||||
QMAKE_LIBS = coredll.lib
|
||||
QMAKE_LIBS_CORE = ole32.lib oleaut32.lib uuid.lib commctrl.lib coredll.lib winsock.lib
|
||||
QMAKE_LIBS_GUI = ole32.lib $$QMAKE_LIBS_CORE
|
||||
QMAKE_LIBS_NETWORK = ws2.lib $$QMAKE_LIBS_GUI
|
||||
QMAKE_LIBS_OPENGL =
|
||||
QMAKE_LIBS_COMPAT =
|
||||
QMAKE_LIBS_OPENVG =
|
||||
QMAKE_LIBS_OPENGL_ES2 = libEGL.lib libGLESv2.lib
|
||||
QMAKE_LIBDIR_OPENGL_ES2 = $$(NV_WINCE_T2_PLAT)/lib/Test
|
||||
QMAKE_INCDIR_EGL = $$(NV_WINCE_T2_PLAT)/include
|
||||
QMAKE_LIBDIR_EGL = $$(NV_WINCE_T2_PLAT)/lib/Test
|
||||
|
||||
QMAKE_RC = rc
|
||||
|
||||
QMAKE_COMPILER_DEFINES -= _MSC_VER=1400
|
||||
QMAKE_COMPILER_DEFINES += _MSC_VER=1700
|
35
mkspecs/wince80colibri-armv7-msvc2012/qplatformdefs.h
Normal file
35
mkspecs/wince80colibri-armv7-msvc2012/qplatformdefs.h
Normal file
@ -0,0 +1,35 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2015 The Qt Company Ltd.
|
||||
** Contact: http://www.qt.io/licensing/
|
||||
**
|
||||
** This file is part of the qmake spec 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 "../common/wince/qplatformdefs.h"
|
||||
|
97
src/3rdparty/forkfd/forkfd.c
vendored
97
src/3rdparty/forkfd/forkfd.c
vendored
@ -1,6 +1,6 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2014 Intel Corporation
|
||||
** Copyright (C) 2015 Intel Corporation
|
||||
** Copyright (C) 2015 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com
|
||||
**
|
||||
** Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
@ -31,6 +31,8 @@
|
||||
#include "forkfd.h"
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/time.h>
|
||||
#include <sys/resource.h>
|
||||
#include <sys/wait.h>
|
||||
#include <assert.h>
|
||||
#include <errno.h>
|
||||
@ -38,6 +40,7 @@
|
||||
#include <signal.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <time.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#ifdef __linux__
|
||||
@ -79,6 +82,12 @@
|
||||
ret = call; \
|
||||
} while (ret == -1 && errno == EINTR)
|
||||
|
||||
struct pipe_payload
|
||||
{
|
||||
struct forkfd_info info;
|
||||
struct rusage rusage;
|
||||
};
|
||||
|
||||
typedef struct process_info
|
||||
{
|
||||
ffd_atomic_int pid;
|
||||
@ -179,33 +188,43 @@ static int isChildReady(pid_t pid, siginfo_t *info)
|
||||
}
|
||||
#endif
|
||||
|
||||
static int tryReaping(pid_t pid, siginfo_t *info)
|
||||
static int tryReaping(pid_t pid, struct pipe_payload *payload)
|
||||
{
|
||||
/* reap the child */
|
||||
#ifdef HAVE_WAITID
|
||||
if (waitid_works) {
|
||||
// we have waitid(2), which fills in siginfo_t for us
|
||||
info->si_pid = 0;
|
||||
return waitid(P_PID, pid, info, WEXITED | WNOHANG) == 0 && info->si_pid == pid;
|
||||
siginfo_t info;
|
||||
info.si_pid = 0;
|
||||
int ret = waitid(P_PID, pid, &info, WEXITED | WNOHANG) == 0 && info.si_pid == pid;
|
||||
if (!ret)
|
||||
return ret;
|
||||
|
||||
payload->info.code = info.si_code;
|
||||
payload->info.status = info.si_status;
|
||||
# ifdef __linux__
|
||||
payload->rusage.ru_utime.tv_sec = info.si_utime / CLOCKS_PER_SEC;
|
||||
payload->rusage.ru_utime.tv_usec = info.si_utime % CLOCKS_PER_SEC;
|
||||
payload->rusage.ru_stime.tv_sec = info.si_stime / CLOCKS_PER_SEC;
|
||||
payload->rusage.ru_stime.tv_usec = info.si_stime % CLOCKS_PER_SEC;
|
||||
# endif
|
||||
return 1;
|
||||
}
|
||||
#endif
|
||||
|
||||
int status;
|
||||
if (waitpid(pid, &status, WNOHANG) <= 0)
|
||||
return 0; // child did not change state
|
||||
|
||||
info->si_signo = SIGCHLD;
|
||||
info->si_pid = pid;
|
||||
if (WIFEXITED(status)) {
|
||||
info->si_code = CLD_EXITED;
|
||||
info->si_status = WEXITSTATUS(status);
|
||||
payload->info.code = CLD_EXITED;
|
||||
payload->info.status = WEXITSTATUS(status);
|
||||
} else if (WIFSIGNALED(status)) {
|
||||
info->si_code = CLD_KILLED;
|
||||
payload->info.code = CLD_KILLED;
|
||||
# ifdef WCOREDUMP
|
||||
if (WCOREDUMP(status))
|
||||
info->si_code = CLD_DUMPED;
|
||||
payload->info.code = CLD_DUMPED;
|
||||
# endif
|
||||
info->si_status = WTERMSIG(status);
|
||||
payload->info.status = WTERMSIG(status);
|
||||
}
|
||||
|
||||
return 1;
|
||||
@ -220,10 +239,11 @@ static void freeInfo(Header *header, ProcessInfo *entry)
|
||||
assert(header->busyCount >= 0);
|
||||
}
|
||||
|
||||
static void notifyAndFreeInfo(Header *header, ProcessInfo *entry, siginfo_t *info)
|
||||
static void notifyAndFreeInfo(Header *header, ProcessInfo *entry,
|
||||
const struct pipe_payload *payload)
|
||||
{
|
||||
ssize_t ret;
|
||||
EINTR_LOOP(ret, write(entry->deathPipe, info, sizeof(*info)));
|
||||
EINTR_LOOP(ret, write(entry->deathPipe, payload, sizeof(*payload)));
|
||||
EINTR_LOOP(ret, close(entry->deathPipe));
|
||||
|
||||
freeInfo(header, entry);
|
||||
@ -243,9 +263,11 @@ static void sigchld_handler(int signum)
|
||||
/* is this one of our children? */
|
||||
BigArray *array;
|
||||
siginfo_t info;
|
||||
struct pipe_payload payload;
|
||||
int i;
|
||||
|
||||
memset(&info, 0, sizeof info);
|
||||
memset(&payload, 0, sizeof payload);
|
||||
|
||||
#ifdef HAVE_WAITID
|
||||
if (!waitid_works)
|
||||
@ -275,8 +297,8 @@ search_next_child:
|
||||
FFD_ATOMIC_ACQUIRE, FFD_ATOMIC_RELAXED)) {
|
||||
/* this is our child, send notification and free up this entry */
|
||||
/* ### FIXME: what if tryReaping returns false? */
|
||||
if (tryReaping(pid, &info))
|
||||
notifyAndFreeInfo(&children.header, &children.entries[i], &info);
|
||||
if (tryReaping(pid, &payload))
|
||||
notifyAndFreeInfo(&children.header, &children.entries[i], &payload);
|
||||
goto search_next_child;
|
||||
}
|
||||
}
|
||||
@ -290,8 +312,8 @@ search_next_child:
|
||||
FFD_ATOMIC_ACQUIRE, FFD_ATOMIC_RELAXED)) {
|
||||
/* this is our child, send notification and free up this entry */
|
||||
/* ### FIXME: what if tryReaping returns false? */
|
||||
if (tryReaping(pid, &info))
|
||||
notifyAndFreeInfo(&array->header, &array->entries[i], &info);
|
||||
if (tryReaping(pid, &payload))
|
||||
notifyAndFreeInfo(&array->header, &array->entries[i], &payload);
|
||||
goto search_next_child;
|
||||
}
|
||||
}
|
||||
@ -321,9 +343,9 @@ search_arrays:
|
||||
continue;
|
||||
}
|
||||
#endif
|
||||
if (tryReaping(pid, &info)) {
|
||||
if (tryReaping(pid, &payload)) {
|
||||
/* this is our child, send notification and free up this entry */
|
||||
notifyAndFreeInfo(&children.header, &children.entries[i], &info);
|
||||
notifyAndFreeInfo(&children.header, &children.entries[i], &payload);
|
||||
}
|
||||
}
|
||||
|
||||
@ -344,9 +366,9 @@ search_arrays:
|
||||
continue;
|
||||
}
|
||||
#endif
|
||||
if (tryReaping(pid, &info)) {
|
||||
if (tryReaping(pid, &payload)) {
|
||||
/* this is our child, send notification and free up this entry */
|
||||
notifyAndFreeInfo(&array->header, &array->entries[i], &info);
|
||||
notifyAndFreeInfo(&array->header, &array->entries[i], &payload);
|
||||
}
|
||||
}
|
||||
|
||||
@ -626,7 +648,7 @@ int spawnfd(int flags, pid_t *ppid, const char *path, const posix_spawn_file_act
|
||||
{
|
||||
Header *header;
|
||||
ProcessInfo *info;
|
||||
siginfo_t si;
|
||||
struct pipe_payload payload;
|
||||
pid_t pid;
|
||||
int death_pipe[2];
|
||||
int ret = -1;
|
||||
@ -664,8 +686,8 @@ int spawnfd(int flags, pid_t *ppid, const char *path, const posix_spawn_file_act
|
||||
ffd_atomic_store(&info->pid, pid, FFD_ATOMIC_RELEASE);
|
||||
|
||||
/* check if the child has already exited */
|
||||
if (tryReaping(pid, &si))
|
||||
notifyAndFreeInfo(header, info, &si);
|
||||
if (tryReaping(pid, &payload))
|
||||
notifyAndFreeInfo(header, info, &payload);
|
||||
|
||||
ret = death_pipe[0];
|
||||
return ret;
|
||||
@ -682,3 +704,28 @@ out:
|
||||
return -1;
|
||||
}
|
||||
#endif // _POSIX_SPAWN && !FORKFD_NO_SPAWNFD
|
||||
|
||||
|
||||
int forkfd_wait(int ffd, forkfd_info *info, struct rusage *rusage)
|
||||
{
|
||||
struct pipe_payload payload;
|
||||
int ret;
|
||||
|
||||
ret = read(ffd, &payload, sizeof(payload));
|
||||
if (ret == -1)
|
||||
return ret; /* pass errno, probably EINTR, EBADF or EWOULDBLOCK */
|
||||
|
||||
assert(ret == sizeof(payload));
|
||||
if (info)
|
||||
*info = payload.info;
|
||||
if (rusage)
|
||||
*rusage = payload.rusage;
|
||||
|
||||
return 0; /* success */
|
||||
}
|
||||
|
||||
|
||||
int forkfd_close(int ffd)
|
||||
{
|
||||
return close(ffd);
|
||||
}
|
||||
|
10
src/3rdparty/forkfd/forkfd.h
vendored
10
src/3rdparty/forkfd/forkfd.h
vendored
@ -1,6 +1,6 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2014 Intel Corporation
|
||||
** Copyright (C) 2015 Intel Corporation
|
||||
**
|
||||
** Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
** of this software and associated documentation files (the "Software"), to deal
|
||||
@ -26,6 +26,7 @@
|
||||
#define FORKFD_H
|
||||
|
||||
#include <fcntl.h>
|
||||
#include <stdint.h>
|
||||
#include <unistd.h> // to get the POSIX flags
|
||||
|
||||
#ifdef _POSIX_SPAWN
|
||||
@ -41,7 +42,14 @@ extern "C" {
|
||||
|
||||
#define FFD_CHILD_PROCESS (-2)
|
||||
|
||||
struct forkfd_info {
|
||||
int32_t code;
|
||||
int32_t status;
|
||||
};
|
||||
|
||||
int forkfd(int flags, pid_t *ppid);
|
||||
int forkfd_wait(int ffd, forkfd_info *info, struct rusage *rusage);
|
||||
int forkfd_close(int ffd);
|
||||
|
||||
#ifdef _POSIX_SPAWN
|
||||
/* only for spawnfd: */
|
||||
|
@ -90,7 +90,10 @@ private:
|
||||
|
||||
template <typename T> struct QAtomicOps : QBasicAtomicOps<sizeof(T)>
|
||||
{
|
||||
typedef T Type;
|
||||
// this is GCC or GCC-like, so we can use extensions:
|
||||
// force the alignment to be the size of the type, as on some ABIs the alignment
|
||||
// of 64-bit types is 32-bit. We need proper alignment for LDREX / STREX.
|
||||
typedef __attribute__((__aligned__(sizeof(T)))) T Type;
|
||||
};
|
||||
|
||||
#ifndef Q_CC_RVCT
|
||||
|
@ -601,6 +601,13 @@
|
||||
container. It only affects the copy, which is probably not what you
|
||||
want.
|
||||
|
||||
An alternative to Qt's \c foreach loop is the range-based \c for that is
|
||||
part of C++ 11 and newer. However, keep in mind that the range-based
|
||||
\c for might force a Qt container to \l{Implicit Sharing}{detach}, whereas
|
||||
\c foreach would not. But using \c foreach always copies the container,
|
||||
which is usually not cheap for STL containers. If in doubt, prefer
|
||||
\c foreach for Qt containers, and range based \c for for STL ones.
|
||||
|
||||
In addition to \c foreach, Qt also provides a \c forever
|
||||
pseudo-keyword for infinite loops:
|
||||
|
||||
|
@ -41,7 +41,7 @@ LIBS_PRIVATE += $$QMAKE_LIBS_EXECINFO
|
||||
if(linux*|hurd*):!cross_compile:!static:!*-armcc* {
|
||||
QMAKE_LFLAGS += -Wl,-e,qt_core_boilerplate
|
||||
prog=$$quote(if (/program interpreter: (.*)]/) { print $1; })
|
||||
DEFINES += ELF_INTERPRETER=\\\"$$system(readelf -l /bin/ls | perl -n -e \'$$prog\')\\\"
|
||||
DEFINES += ELF_INTERPRETER=\\\"$$system(LC_ALL=C readelf -l /bin/ls | perl -n -e \'$$prog\')\\\"
|
||||
}
|
||||
|
||||
slog2 {
|
||||
|
@ -97,7 +97,7 @@
|
||||
/* Intel C++ disguising as Visual C++: the `using' keyword avoids warnings */
|
||||
# if defined(__INTEL_COMPILER)
|
||||
# define Q_DECL_VARIABLE_DEPRECATED
|
||||
# define Q_CC_INTEL
|
||||
# define Q_CC_INTEL __INTEL_COMPILER
|
||||
# endif
|
||||
|
||||
/* only defined for MSVC since that's the only compiler that actually optimizes for this */
|
||||
@ -564,6 +564,16 @@
|
||||
# endif
|
||||
# define Q_COMPILER_UDL
|
||||
# endif
|
||||
# ifdef _MSC_VER
|
||||
# if _MSC_VER == 1700
|
||||
// <initializer_list> is missing with MSVC 2012 (it's present in 2010, 2013 and up)
|
||||
# undef Q_COMPILER_INITIALIZER_LISTS
|
||||
# endif
|
||||
# if _MSC_VER < 1900
|
||||
// ICC disables unicode string support when compatibility mode with MSVC 2013 or lower is active
|
||||
# undef Q_COMPILER_UNICODE_STRINGS
|
||||
# endif
|
||||
# endif
|
||||
# endif
|
||||
#endif
|
||||
|
||||
@ -890,7 +900,8 @@
|
||||
# define Q_COMPILER_RANGE_FOR
|
||||
# define Q_COMPILER_REF_QUALIFIERS
|
||||
# define Q_COMPILER_THREAD_LOCAL
|
||||
# define Q_COMPILER_THREADSAFE_STATICS
|
||||
// Broken, see QTBUG-47224 and https://connect.microsoft.com/VisualStudio/feedback/details/1549785
|
||||
//# define Q_COMPILER_THREADSAFE_STATICS
|
||||
# define Q_COMPILER_UDL
|
||||
# define Q_COMPILER_UNICODE_STRINGS
|
||||
// Uniform initialization is not working yet -- build errors with QUuid
|
||||
|
@ -2262,7 +2262,8 @@ static bool readEtcRedHatRelease(QUnixOSVersion &v)
|
||||
int releaseIndex = line.indexOf(keyword);
|
||||
v.productType = QString::fromLatin1(line.mid(0, releaseIndex)).remove(QLatin1Char(' '));
|
||||
int spaceIndex = line.indexOf(' ', releaseIndex + strlen(keyword));
|
||||
v.productVersion = QString::fromLatin1(line.mid(releaseIndex + strlen(keyword), spaceIndex > -1 ? spaceIndex - releaseIndex - strlen(keyword) : -1));
|
||||
v.productVersion = QString::fromLatin1(line.mid(releaseIndex + strlen(keyword),
|
||||
spaceIndex > -1 ? spaceIndex - releaseIndex - int(strlen(keyword)) : -1));
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -650,11 +650,9 @@ void qt_core_boilerplate()
|
||||
"Copyright (C) 2015 The Qt Company Ltd.\n"
|
||||
"Contact: http://www.qt.io/licensing/\n"
|
||||
"\n"
|
||||
"Build date: %s\n"
|
||||
"Installation prefix: %s\n"
|
||||
"Library path: %s\n"
|
||||
"Include path: %s\n",
|
||||
qt_configure_installation + 12,
|
||||
qt_configure_prefix_path_str + 12,
|
||||
qt_configure_strs + qt_configure_str_offsets[QT_PREPEND_NAMESPACE(QLibraryInfo)::LibrariesPath - 1],
|
||||
qt_configure_strs + qt_configure_str_offsets[QT_PREPEND_NAMESPACE(QLibraryInfo)::HeadersPath - 1]);
|
||||
|
@ -87,6 +87,10 @@
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#if defined(QT_USE_SLOG2)
|
||||
extern char *__progname;
|
||||
#endif
|
||||
|
||||
#if defined(Q_OS_LINUX) && (defined(__GLIBC__) || __has_include(<sys/syscall.h>))
|
||||
# include <sys/syscall.h>
|
||||
static long qt_gettid()
|
||||
@ -1173,8 +1177,6 @@ void QMessagePattern::setPattern(const QString &pattern)
|
||||
#define QT_LOG_CODE 9000
|
||||
#endif
|
||||
|
||||
extern char *__progname;
|
||||
|
||||
static void slog2_default_handler(QtMsgType msgType, const char *message)
|
||||
{
|
||||
if (slog2_set_default_buffer((slog2_buffer_t)-1) == 0) {
|
||||
@ -1357,8 +1359,9 @@ QString qFormatLogMessage(QtMsgType type, const QMessageLogContext &context, con
|
||||
} else if (pattern->timeFormat == QLatin1String("boot")) {
|
||||
// just print the milliseconds since the elapsed timer reference
|
||||
// like the Linux kernel does
|
||||
pattern->timer.elapsed();
|
||||
uint ms = pattern->timer.msecsSinceReference();
|
||||
QElapsedTimer now;
|
||||
now.start();
|
||||
uint ms = now.msecsSinceReference();
|
||||
message.append(QString::asprintf("%6d.%03d", uint(ms / 1000), uint(ms % 1000)));
|
||||
} else if (pattern->timeFormat.isEmpty()) {
|
||||
message.append(QDateTime::currentDateTime().toString(Qt::ISODate));
|
||||
|
@ -147,6 +147,7 @@ win32 {
|
||||
SOURCES += io/qsettings_mac.cpp
|
||||
OBJECTIVE_SOURCES += io/qurl_mac.mm
|
||||
}
|
||||
freebsd: LIBS_PRIVATE += -lutil # qlockfile_unix.cpp requires this
|
||||
mac {
|
||||
osx {
|
||||
OBJECTIVE_SOURCES += io/qfilesystemwatcher_fsevents.mm
|
||||
|
@ -1503,11 +1503,19 @@ bool QDir::removeRecursively()
|
||||
while (di.hasNext()) {
|
||||
di.next();
|
||||
const QFileInfo& fi = di.fileInfo();
|
||||
const QString &filePath = di.filePath();
|
||||
bool ok;
|
||||
if (fi.isDir() && !fi.isSymLink())
|
||||
ok = QDir(di.filePath()).removeRecursively(); // recursive
|
||||
else
|
||||
ok = QFile::remove(di.filePath());
|
||||
if (fi.isDir() && !fi.isSymLink()) {
|
||||
ok = QDir(filePath).removeRecursively(); // recursive
|
||||
} else {
|
||||
ok = QFile::remove(filePath);
|
||||
if (!ok) { // Read-only files prevent directory deletion on Windows, retry with Write permission.
|
||||
const QFile::Permissions permissions = QFile::permissions(filePath);
|
||||
if (!(permissions & QFile::WriteUser))
|
||||
ok = QFile::setPermissions(filePath, permissions | QFile::WriteUser)
|
||||
&& QFile::remove(filePath);
|
||||
}
|
||||
}
|
||||
if (!ok)
|
||||
success = false;
|
||||
}
|
||||
|
@ -210,20 +210,23 @@ void QLoggingSettingsParser::setContent(QTextStream &stream)
|
||||
|
||||
if (_section == QLatin1String("Rules")) {
|
||||
int equalPos = line.indexOf(QLatin1Char('='));
|
||||
if ((equalPos != -1)
|
||||
&& (line.lastIndexOf(QLatin1Char('=')) == equalPos)) {
|
||||
const QStringRef pattern = line.leftRef(equalPos);
|
||||
const QStringRef valueStr = line.midRef(equalPos + 1);
|
||||
int value = -1;
|
||||
if (valueStr == QLatin1String("true"))
|
||||
value = 1;
|
||||
else if (valueStr == QLatin1String("false"))
|
||||
value = 0;
|
||||
QLoggingRule rule(pattern, (value == 1));
|
||||
if (rule.flags != 0 && (value != -1))
|
||||
_rules.append(rule);
|
||||
else
|
||||
if (equalPos != -1) {
|
||||
if (line.lastIndexOf(QLatin1Char('=')) == equalPos) {
|
||||
const QStringRef pattern = line.leftRef(equalPos);
|
||||
const QStringRef valueStr = line.midRef(equalPos + 1);
|
||||
int value = -1;
|
||||
if (valueStr == QLatin1String("true"))
|
||||
value = 1;
|
||||
else if (valueStr == QLatin1String("false"))
|
||||
value = 0;
|
||||
QLoggingRule rule(pattern, (value == 1));
|
||||
if (rule.flags != 0 && (value != -1))
|
||||
_rules.append(rule);
|
||||
else
|
||||
warnMsg("Ignoring malformed logging rule: '%s'", line.toUtf8().constData());
|
||||
} else {
|
||||
warnMsg("Ignoring malformed logging rule: '%s'", line.toUtf8().constData());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1075,20 +1075,17 @@ bool QProcessPrivate::waitForDeadChild()
|
||||
return true; // child has already exited
|
||||
|
||||
// read the process information from our fd
|
||||
siginfo_t info;
|
||||
qint64 ret = qt_safe_read(forkfd, &info, sizeof info);
|
||||
Q_ASSERT(ret == sizeof info);
|
||||
Q_UNUSED(ret);
|
||||
forkfd_info info;
|
||||
int ret;
|
||||
EINTR_LOOP(ret, forkfd_wait(forkfd, &info, Q_NULLPTR));
|
||||
|
||||
Q_ASSERT(info.si_pid == pid_t(pid));
|
||||
|
||||
exitCode = info.si_status;
|
||||
crashed = info.si_code != CLD_EXITED;
|
||||
exitCode = info.status;
|
||||
crashed = info.code != CLD_EXITED;
|
||||
|
||||
delete deathNotifier;
|
||||
deathNotifier = 0;
|
||||
|
||||
qt_safe_close(forkfd);
|
||||
EINTR_LOOP(ret, forkfd_close(forkfd));
|
||||
forkfd = -1; // Child is dead, don't try to kill it anymore
|
||||
|
||||
#if defined QPROCESS_DEBUG
|
||||
|
@ -215,7 +215,8 @@ bool QSaveFile::open(OpenMode mode)
|
||||
d->finalFileName = existingFile.filePath();
|
||||
}
|
||||
|
||||
d->fileEngine = new QTemporaryFileEngine(d->finalFileName, 0666);
|
||||
d->fileEngine = new QTemporaryFileEngine;
|
||||
static_cast<QTemporaryFileEngine *>(d->fileEngine)->initialize(d->finalFileName, 0666);
|
||||
// Same as in QFile: QIODevice provides the buffering, so there's no need to request it from the file engine.
|
||||
if (!d->fileEngine->open(mode | QIODevice::Unbuffered)) {
|
||||
QFileDevice::FileError err = d->fileEngine->error();
|
||||
|
@ -409,14 +409,24 @@ QTemporaryFilePrivate::~QTemporaryFilePrivate()
|
||||
QAbstractFileEngine *QTemporaryFilePrivate::engine() const
|
||||
{
|
||||
if (!fileEngine) {
|
||||
if (fileName.isEmpty())
|
||||
fileEngine = new QTemporaryFileEngine(templateName, 0600);
|
||||
else
|
||||
fileEngine = new QTemporaryFileEngine(fileName, 0600, false);
|
||||
fileEngine = new QTemporaryFileEngine;
|
||||
resetFileEngine();
|
||||
}
|
||||
return fileEngine;
|
||||
}
|
||||
|
||||
void QTemporaryFilePrivate::resetFileEngine() const
|
||||
{
|
||||
if (!fileEngine)
|
||||
return;
|
||||
|
||||
QTemporaryFileEngine *tef = static_cast<QTemporaryFileEngine *>(fileEngine);
|
||||
if (fileName.isEmpty())
|
||||
tef->initialize(templateName, 0600);
|
||||
else
|
||||
tef->initialize(fileName, 0600, false);
|
||||
}
|
||||
|
||||
QString QTemporaryFilePrivate::defaultTemplateName()
|
||||
{
|
||||
QString baseName;
|
||||
@ -769,6 +779,13 @@ bool QTemporaryFile::open(OpenMode flags)
|
||||
}
|
||||
}
|
||||
|
||||
// reset the engine state so it creates a new, unique file name from the template;
|
||||
// equivalent to:
|
||||
// delete d->fileEngine;
|
||||
// d->fileEngine = 0;
|
||||
// d->engine();
|
||||
d->resetFileEngine();
|
||||
|
||||
if (QFile::open(flags)) {
|
||||
d->fileName = d->fileEngine->fileName(QAbstractFileEngine::DefaultName);
|
||||
return true;
|
||||
|
@ -64,6 +64,7 @@ protected:
|
||||
~QTemporaryFilePrivate();
|
||||
|
||||
QAbstractFileEngine *engine() const;
|
||||
void resetFileEngine() const;
|
||||
|
||||
bool autoRemove;
|
||||
QString templateName;
|
||||
@ -77,22 +78,17 @@ class QTemporaryFileEngine : public QFSFileEngine
|
||||
{
|
||||
Q_DECLARE_PRIVATE(QFSFileEngine)
|
||||
public:
|
||||
|
||||
QTemporaryFileEngine(const QString &file,
|
||||
quint32 fileMode,
|
||||
bool fileIsTemplate = true) :
|
||||
QFSFileEngine(),
|
||||
fileMode(fileMode),
|
||||
filePathIsTemplate(fileIsTemplate),
|
||||
filePathWasTemplate(fileIsTemplate)
|
||||
void initialize(const QString &file, quint32 mode, bool nameIsTemplate = true)
|
||||
{
|
||||
Q_D(QFSFileEngine);
|
||||
Q_ASSERT(!isReallyOpen());
|
||||
fileMode = mode;
|
||||
filePathIsTemplate = filePathWasTemplate = nameIsTemplate;
|
||||
d->fileEntry = QFileSystemEntry(file);
|
||||
|
||||
if (!filePathIsTemplate)
|
||||
QFSFileEngine::setFileName(file);
|
||||
}
|
||||
|
||||
~QTemporaryFileEngine();
|
||||
|
||||
bool isReallyOpen() const;
|
||||
|
@ -392,7 +392,7 @@ static bool quitLockRefEnabled = true;
|
||||
// GUI apps or when using MinGW due to its globbing.
|
||||
static inline bool isArgvModified(int argc, char **argv)
|
||||
{
|
||||
if (__argc != argc)
|
||||
if (__argc != argc || !__argv /* wmain() */)
|
||||
return true;
|
||||
if (__argv == argv)
|
||||
return false;
|
||||
|
@ -560,6 +560,17 @@ static HWND qt_create_internal_window(const QEventDispatcherWin32 *eventDispatch
|
||||
return wnd;
|
||||
}
|
||||
|
||||
static void calculateNextTimeout(WinTimerInfo *t, quint64 currentTime)
|
||||
{
|
||||
uint interval = t->interval;
|
||||
if ((interval >= 20000u && t->timerType != Qt::PreciseTimer) || t->timerType == Qt::VeryCoarseTimer) {
|
||||
// round the interval, VeryCoarseTimers only have full second accuracy
|
||||
interval = ((interval + 500)) / 1000 * 1000;
|
||||
}
|
||||
t->interval = interval;
|
||||
t->timeout = currentTime + interval;
|
||||
}
|
||||
|
||||
void QEventDispatcherWin32Private::registerTimer(WinTimerInfo *t)
|
||||
{
|
||||
Q_ASSERT(internalHwnd);
|
||||
@ -567,6 +578,7 @@ void QEventDispatcherWin32Private::registerTimer(WinTimerInfo *t)
|
||||
Q_Q(QEventDispatcherWin32);
|
||||
|
||||
int ok = 0;
|
||||
calculateNextTimeout(t, qt_msectime());
|
||||
uint interval = t->interval;
|
||||
if (interval == 0u) {
|
||||
// optimization for single-shot-zero-timer
|
||||
@ -575,17 +587,13 @@ void QEventDispatcherWin32Private::registerTimer(WinTimerInfo *t)
|
||||
} else if ((interval < 20u || t->timerType == Qt::PreciseTimer) && qtimeSetEvent) {
|
||||
ok = t->fastTimerId = qtimeSetEvent(interval, 1, qt_fast_timer_proc, (DWORD_PTR)t,
|
||||
TIME_CALLBACK_FUNCTION | TIME_PERIODIC | TIME_KILL_SYNCHRONOUS);
|
||||
} else if (interval >= 20000u || t->timerType == Qt::VeryCoarseTimer) {
|
||||
// round the interval, VeryCoarseTimers only have full second accuracy
|
||||
interval = ((interval + 500)) / 1000 * 1000;
|
||||
}
|
||||
|
||||
if (ok == 0) {
|
||||
// user normal timers for (Very)CoarseTimers, or if no more multimedia timers available
|
||||
ok = SetTimer(internalHwnd, t->timerId, interval, 0);
|
||||
}
|
||||
|
||||
t->timeout = qt_msectime() + interval;
|
||||
|
||||
if (ok == 0)
|
||||
qErrnoWarning("QEventDispatcherWin32::registerTimer: Failed to create a timer");
|
||||
}
|
||||
@ -610,6 +618,9 @@ void QEventDispatcherWin32Private::sendTimerEvent(int timerId)
|
||||
// send event, but don't allow it to recurse
|
||||
t->inTimerEvent = true;
|
||||
|
||||
// recalculate next emission
|
||||
calculateNextTimeout(t, qt_msectime());
|
||||
|
||||
QTimerEvent e(t->timerId);
|
||||
QCoreApplication::sendEvent(t->obj, &e);
|
||||
|
||||
|
@ -58,7 +58,7 @@ class QEventDispatcherWin32Private;
|
||||
|
||||
// forward declaration
|
||||
LRESULT QT_WIN_CALLBACK qt_internal_proc(HWND hwnd, UINT message, WPARAM wp, LPARAM lp);
|
||||
int qt_msectime();
|
||||
quint64 qt_msectime();
|
||||
|
||||
class Q_CORE_EXPORT QEventDispatcherWin32 : public QAbstractEventDispatcher
|
||||
{
|
||||
|
@ -52,7 +52,7 @@
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
int qt_msectime();
|
||||
quint64 qt_msectime();
|
||||
|
||||
class QEventDispatcherWinRTPrivate;
|
||||
|
||||
|
@ -1879,13 +1879,14 @@ const char *QMetaMethod::typeName() const
|
||||
way in the function declaration:
|
||||
|
||||
\code
|
||||
// In the class MainWindow declaration
|
||||
#ifndef Q_MOC_RUN
|
||||
// define the tag text
|
||||
# define THISISTESTTAG
|
||||
// define the tag text as empty, so the compiler doesn't see it
|
||||
# define MY_CUSTOM_TAG
|
||||
#endif
|
||||
...
|
||||
private slots:
|
||||
THISISTESTTAG void testFunc();
|
||||
MY_CUSTOM_TAG void testFunc();
|
||||
\endcode
|
||||
|
||||
and the information can be accessed by using:
|
||||
@ -1895,12 +1896,14 @@ const char *QMetaMethod::typeName() const
|
||||
win.show();
|
||||
|
||||
int functionIndex = win.metaObject()->indexOfSlot("testFunc()");
|
||||
QMetaMethod mm = metaObject()->method(functionIndex);
|
||||
qDebug() << mm.tag(); // prints THISISTESTTAG
|
||||
QMetaMethod mm = win.metaObject()->method(functionIndex);
|
||||
qDebug() << mm.tag(); // prints MY_CUSTOM_TAG
|
||||
\endcode
|
||||
|
||||
For the moment, \c moc will extract and record all tags, but it will not
|
||||
handle any of them specially.
|
||||
handle any of them specially. You can use the tags to annotate your methods
|
||||
differently, and treat them according to the specific needs of your
|
||||
application.
|
||||
|
||||
\note Since Qt 5.0, \c moc expands preprocessor macros, so it is necessary
|
||||
to surround the definition with \c #ifndef \c Q_MOC_RUN, as shown in the
|
||||
@ -1960,8 +1963,9 @@ int QMetaMethod::revision() const
|
||||
Returns the access specification of this method (private,
|
||||
protected, or public).
|
||||
|
||||
Signals are always protected, meaning that you can only emit them
|
||||
from the class or from a subclass.
|
||||
\note Signals are always public, but you should regard that as an
|
||||
implementation detail. It is almost always a bad idea to emit a signal from
|
||||
outside its class.
|
||||
|
||||
\sa methodType()
|
||||
*/
|
||||
|
@ -909,14 +909,7 @@ QObject::~QObject()
|
||||
}
|
||||
|
||||
if (!d->isWidget && d->isSignalConnected(0)) {
|
||||
QT_TRY {
|
||||
emit destroyed(this);
|
||||
} QT_CATCH(...) {
|
||||
// all the signal/slots connections are still in place - if we don't
|
||||
// quit now, we will crash pretty soon.
|
||||
qWarning("Detected an unexpected exception in ~QObject while emitting destroyed().");
|
||||
QT_RETHROW;
|
||||
}
|
||||
emit destroyed(this);
|
||||
}
|
||||
|
||||
if (d->declarativeData) {
|
||||
|
@ -117,7 +117,7 @@ static quint64 getTickCount()
|
||||
#endif // Q_OS_WINRT
|
||||
}
|
||||
|
||||
int qt_msectime()
|
||||
quint64 qt_msectime()
|
||||
{
|
||||
return ticksToNanoseconds(getTickCount()) / 1000000;
|
||||
}
|
||||
|
@ -273,9 +273,9 @@ static inline __m128i mergeQuestionMarks(__m128i chunk)
|
||||
// that they are doing the right thing. Inverting the arguments in the
|
||||
// instruction does cause a bunch of test failures.
|
||||
|
||||
const int mode = _SIDD_UWORD_OPS | _SIDD_CMP_RANGES | _SIDD_UNIT_MASK;
|
||||
const __m128i rangeMatch = _mm_cvtsi32_si128(0xffff0100);
|
||||
const __m128i offLimitMask = _mm_cmpestrm(rangeMatch, 2, chunk, 8, mode);
|
||||
const __m128i offLimitMask = _mm_cmpestrm(rangeMatch, 2, chunk, 8,
|
||||
_SIDD_UWORD_OPS | _SIDD_CMP_RANGES | _SIDD_UNIT_MASK);
|
||||
|
||||
// replace the non-Latin 1 characters in the chunk with question marks
|
||||
chunk = _mm_blendv_epi8(chunk, questionMark, offLimitMask);
|
||||
|
@ -43,7 +43,7 @@ QOpenGLShader shader(QOpenGLShader::Vertex);
|
||||
shader.compileSourceCode(code);
|
||||
|
||||
QOpenGLShaderProgram program(context);
|
||||
program.addShader(shader);
|
||||
program.addShader(&shader);
|
||||
program.link();
|
||||
|
||||
program.bind();
|
||||
|
@ -1103,7 +1103,7 @@ static bool mask_alpha_converter_rgbx_inplace(QImageData *data, Qt::ImageConvers
|
||||
}
|
||||
rgb_data += pad;
|
||||
}
|
||||
data->format = DestFormat;
|
||||
data->format = QImage::Format_RGBX8888;
|
||||
return true;
|
||||
#endif
|
||||
}
|
||||
|
@ -710,6 +710,7 @@ public:
|
||||
enum State {
|
||||
Ready,
|
||||
ReadHeader,
|
||||
ReadingEnd,
|
||||
Error
|
||||
};
|
||||
|
||||
@ -958,7 +959,7 @@ bool QJpegHandlerPrivate::read(QImage *image)
|
||||
for (int i = 0; i < readTexts.size()-1; i+=2)
|
||||
image->setText(readTexts.at(i), readTexts.at(i+1));
|
||||
|
||||
state = Ready;
|
||||
state = ReadingEnd;
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -1006,7 +1007,7 @@ bool QJpegHandler::canRead() const
|
||||
if(d->state == QJpegHandlerPrivate::Ready && !canRead(device()))
|
||||
return false;
|
||||
|
||||
if (d->state != QJpegHandlerPrivate::Error) {
|
||||
if (d->state != QJpegHandlerPrivate::Error && d->state != QJpegHandlerPrivate::ReadingEnd) {
|
||||
setFormat("jpeg");
|
||||
return true;
|
||||
}
|
||||
|
@ -1889,7 +1889,7 @@ void QGuiApplicationPrivate::processKeyEvent(QWindowSystemInterfacePrivate::KeyE
|
||||
#if !defined(Q_OS_OSX)
|
||||
// On OS X the shortcut override is checked earlier, see: QWindowSystemInterface::handleKeyEvent()
|
||||
const bool checkShortcut = e->keyType == QEvent::KeyPress && window != 0;
|
||||
if (checkShortcut && QWindowSystemInterface::tryHandleShortcutEvent(window, e->timestamp, e->key, e->modifiers, e->unicode))
|
||||
if (checkShortcut && QWindowSystemInterface::tryHandleShortcutEvent(window, e->timestamp, e->key, e->modifiers, e->unicode, e->repeat, e->repeatCount))
|
||||
return;
|
||||
#endif // Q_OS_OSX
|
||||
|
||||
|
@ -1112,6 +1112,7 @@ void QOpenGLTexturePrivate::setData(int mipLevel, int layer, QOpenGLTexture::Cub
|
||||
mipLevelSize(mipLevel, dimensions[0]),
|
||||
1,
|
||||
sourceFormat, sourceType, data, options);
|
||||
break;
|
||||
|
||||
case QOpenGLTexture::Target2D:
|
||||
Q_UNUSED(layer);
|
||||
@ -1210,6 +1211,7 @@ void QOpenGLTexturePrivate::setCompressedData(int mipLevel, int layer, QOpenGLTe
|
||||
mipLevelSize(mipLevel, dimensions[0]),
|
||||
1,
|
||||
format, dataSize, data, options);
|
||||
break;
|
||||
|
||||
case QOpenGLTexture::Target2D:
|
||||
Q_UNUSED(layer);
|
||||
|
@ -101,6 +101,8 @@ QOpenGLTextureHelper::QOpenGLTextureHelper(QOpenGLContext *context)
|
||||
// Use our own DSA emulation
|
||||
TextureParameteri = &QOpenGLTextureHelper::qt_TextureParameteri;
|
||||
TextureParameteriv = &QOpenGLTextureHelper::qt_TextureParameteriv;
|
||||
TextureParameterf = &QOpenGLTextureHelper::qt_TextureParameterf;
|
||||
TextureParameterfv = &QOpenGLTextureHelper::qt_TextureParameterfv;
|
||||
GenerateTextureMipmap = &QOpenGLTextureHelper::qt_GenerateTextureMipmap;
|
||||
TextureStorage3D = &QOpenGLTextureHelper::qt_TextureStorage3D;
|
||||
TextureStorage2D = &QOpenGLTextureHelper::qt_TextureStorage2D;
|
||||
|
@ -1256,7 +1256,7 @@ int QTextEngine::shapeTextWithHarfbuzzNG(const QScriptItem &si, const ushort *st
|
||||
// scaling the advances for this particular version
|
||||
if (actualFontEngine->fontDef.stretch != 100
|
||||
&& QSysInfo::MacintoshVersion != QSysInfo::MV_10_6) {
|
||||
QFixed stretch = QFixed(actualFontEngine->fontDef.stretch) / QFixed(100);
|
||||
QFixed stretch = QFixed(int(actualFontEngine->fontDef.stretch)) / QFixed(100);
|
||||
for (uint i = 0; i < num_glyphs; ++i)
|
||||
g.advances[i] *= stretch;
|
||||
}
|
||||
|
@ -472,11 +472,11 @@ QNetworkAccessManager::QNetworkAccessManager(QObject *parent)
|
||||
// the QNetworkSession's signals
|
||||
connect(&d->networkConfigurationManager, SIGNAL(onlineStateChanged(bool)),
|
||||
SLOT(_q_onlineStateChanged(bool)));
|
||||
// we would need all active configurations to check for
|
||||
// d->networkConfigurationManager.isOnline(), which is asynchronous
|
||||
// and potentially expensive. We can just check the configuration here
|
||||
d->online = (d->networkConfiguration.state() & QNetworkConfiguration::Active);
|
||||
}
|
||||
// we would need all active configurations to check for
|
||||
// d->networkConfigurationManager.isOnline(), which is asynchronous
|
||||
// and potentially expensive. We can just check the configuration here
|
||||
d->online = (d->networkConfiguration.state() & QNetworkConfiguration::Active);
|
||||
#endif
|
||||
}
|
||||
|
||||
@ -946,6 +946,7 @@ QNetworkConfiguration QNetworkAccessManager::activeConfiguration() const
|
||||
void QNetworkAccessManager::setNetworkAccessible(QNetworkAccessManager::NetworkAccessibility accessible)
|
||||
{
|
||||
Q_D(QNetworkAccessManager);
|
||||
d->defaultAccessControl = false;
|
||||
|
||||
if (d->networkAccessible != accessible) {
|
||||
NetworkAccessibility previous = networkAccessible();
|
||||
@ -964,7 +965,6 @@ void QNetworkAccessManager::setNetworkAccessible(QNetworkAccessManager::NetworkA
|
||||
QNetworkAccessManager::NetworkAccessibility QNetworkAccessManager::networkAccessible() const
|
||||
{
|
||||
Q_D(const QNetworkAccessManager);
|
||||
|
||||
if (d->networkSessionRequired) {
|
||||
QSharedPointer<QNetworkSession> networkSession(d->getNetworkSession());
|
||||
if (networkSession) {
|
||||
@ -975,7 +975,13 @@ QNetworkAccessManager::NetworkAccessibility QNetworkAccessManager::networkAccess
|
||||
return NotAccessible;
|
||||
} else {
|
||||
// Network accessibility is either disabled or unknown.
|
||||
return (d->networkAccessible == NotAccessible) ? NotAccessible : UnknownAccessibility;
|
||||
if (d->defaultAccessControl) {
|
||||
if (d->online)
|
||||
return d->networkAccessible;
|
||||
else
|
||||
return NotAccessible;
|
||||
}
|
||||
return (d->networkAccessible);
|
||||
}
|
||||
} else {
|
||||
if (d->online)
|
||||
@ -1568,7 +1574,7 @@ void QNetworkAccessManagerPrivate::createSession(const QNetworkConfiguration &co
|
||||
if (!networkSessionStrongRef) {
|
||||
online = false;
|
||||
|
||||
if (networkAccessible == QNetworkAccessManager::NotAccessible)
|
||||
if (networkAccessible == QNetworkAccessManager::NotAccessible || !online)
|
||||
emit q->networkAccessibleChanged(QNetworkAccessManager::NotAccessible);
|
||||
else
|
||||
emit q->networkAccessibleChanged(QNetworkAccessManager::UnknownAccessibility);
|
||||
@ -1616,11 +1622,14 @@ void QNetworkAccessManagerPrivate::_q_networkSessionStateChanged(QNetworkSession
|
||||
if (online) {
|
||||
if (state != QNetworkSession::Connected && state != QNetworkSession::Roaming) {
|
||||
online = false;
|
||||
emit q->networkAccessibleChanged(QNetworkAccessManager::NotAccessible);
|
||||
networkAccessible = QNetworkAccessManager::NotAccessible;
|
||||
emit q->networkAccessibleChanged(networkAccessible);
|
||||
}
|
||||
} else {
|
||||
if (state == QNetworkSession::Connected || state == QNetworkSession::Roaming) {
|
||||
online = true;
|
||||
if (defaultAccessControl)
|
||||
networkAccessible = QNetworkAccessManager::Accessible;
|
||||
emit q->networkAccessibleChanged(networkAccessible);
|
||||
}
|
||||
}
|
||||
|
@ -84,6 +84,7 @@ public:
|
||||
initializeSession(true),
|
||||
#endif
|
||||
cookieJarCreated(false),
|
||||
defaultAccessControl(true),
|
||||
authenticationManager(QSharedPointer<QNetworkAccessAuthenticationManager>::create())
|
||||
{ }
|
||||
~QNetworkAccessManagerPrivate();
|
||||
@ -164,6 +165,7 @@ public:
|
||||
#endif
|
||||
|
||||
bool cookieJarCreated;
|
||||
bool defaultAccessControl;
|
||||
|
||||
// The cache with authorization data:
|
||||
QSharedPointer<QNetworkAccessAuthenticationManager> authenticationManager;
|
||||
|
@ -71,10 +71,8 @@ public:
|
||||
private:
|
||||
int id;
|
||||
|
||||
friend Q_DECL_CONSTEXPR bool operator==(QSslEllipticCurve lhs, QSslEllipticCurve rhs) Q_DECL_NOTHROW
|
||||
{ return lhs.id == rhs.id; }
|
||||
friend Q_DECL_CONSTEXPR uint qHash(QSslEllipticCurve curve, uint seed) Q_DECL_NOTHROW
|
||||
{ return qHash(curve.id, seed); }
|
||||
friend Q_DECL_CONSTEXPR bool operator==(QSslEllipticCurve lhs, QSslEllipticCurve rhs) Q_DECL_NOTHROW;
|
||||
friend Q_DECL_CONSTEXPR uint qHash(QSslEllipticCurve curve, uint seed) Q_DECL_NOTHROW;
|
||||
|
||||
friend class QSslSocketPrivate;
|
||||
friend class QSslSocketBackendPrivate;
|
||||
@ -82,6 +80,12 @@ private:
|
||||
|
||||
Q_DECLARE_TYPEINFO(QSslEllipticCurve, Q_PRIMITIVE_TYPE);
|
||||
|
||||
Q_DECL_CONSTEXPR inline uint qHash(QSslEllipticCurve curve, uint seed) Q_DECL_NOTHROW
|
||||
{ return qHash(curve.id, seed); }
|
||||
|
||||
Q_DECL_CONSTEXPR inline bool operator==(QSslEllipticCurve lhs, QSslEllipticCurve rhs) Q_DECL_NOTHROW
|
||||
{ return lhs.id == rhs.id; }
|
||||
|
||||
Q_DECL_CONSTEXPR inline bool operator!=(QSslEllipticCurve lhs, QSslEllipticCurve rhs) Q_DECL_NOTHROW
|
||||
{ return !operator==(lhs, rhs); }
|
||||
|
||||
|
@ -33,6 +33,7 @@
|
||||
|
||||
#include "qsslsocket.h"
|
||||
|
||||
#include "qssl_p.h"
|
||||
#include "qsslsocket_mac_p.h"
|
||||
#include "qasn1element_p.h"
|
||||
#include "qsslcertificate_p.h"
|
||||
@ -93,7 +94,7 @@ static OSStatus _q_SSLRead(QTcpSocket *plainSocket, char *data, size_t *dataLeng
|
||||
|
||||
const qint64 bytes = plainSocket->read(data, *dataLength);
|
||||
#ifdef QSSLSOCKET_DEBUG
|
||||
qDebug() << Q_FUNC_INFO << plainSocket << "read" << bytes;
|
||||
qCDebug(lcSsl) << plainSocket << "read" << bytes;
|
||||
#endif
|
||||
if (bytes < 0) {
|
||||
*dataLength = 0;
|
||||
@ -114,7 +115,7 @@ static OSStatus _q_SSLWrite(QTcpSocket *plainSocket, const char *data, size_t *d
|
||||
|
||||
const qint64 bytes = plainSocket->write(data, *dataLength);
|
||||
#ifdef QSSLSOCKET_DEBUG
|
||||
qDebug() << Q_FUNC_INFO << plainSocket << "write" << bytes;
|
||||
qCDebug(lcSsl) << plainSocket << "write" << bytes;
|
||||
#endif
|
||||
if (bytes < 0) {
|
||||
*dataLength = 0;
|
||||
@ -166,7 +167,7 @@ void QSslSocketPrivate::ensureInitialized()
|
||||
if (!s_loadRootCertsOnDemand)
|
||||
setDefaultCaCertificates(systemCaCertificates());
|
||||
} else {
|
||||
qWarning() << Q_FUNC_INFO << "SSLCreateContext failed";
|
||||
qCWarning(lcSsl) << "SSLCreateContext failed";
|
||||
s_loadedCiphersAndCerts = false;
|
||||
}
|
||||
|
||||
@ -225,7 +226,7 @@ QList<QSslCertificate> QSslSocketPrivate::systemCaCertificates()
|
||||
}
|
||||
} else {
|
||||
// no detailed error handling here
|
||||
qWarning("could not retrieve system CA certificates");
|
||||
qCWarning(lcSsl) << "SecTrustSettingsCopyCertificates failed:" << status;
|
||||
}
|
||||
#endif
|
||||
return systemCerts;
|
||||
@ -244,7 +245,7 @@ QSslSocketBackendPrivate::~QSslSocketBackendPrivate()
|
||||
void QSslSocketBackendPrivate::continueHandshake()
|
||||
{
|
||||
#ifdef QSSLSOCKET_DEBUG
|
||||
qDebug() << Q_FUNC_INFO << plainSocket << "connection encrypted";
|
||||
qCDebug(lcSsl) << plainSocket << "connection encrypted";
|
||||
#endif
|
||||
Q_Q(QSslSocket);
|
||||
connectionEncrypted = true;
|
||||
@ -291,8 +292,7 @@ QSsl::SslProtocol QSslSocketBackendPrivate::sessionProtocol() const
|
||||
SSLProtocol protocol = kSSLProtocolUnknown;
|
||||
const OSStatus err = SSLGetNegotiatedProtocolVersion(context, &protocol);
|
||||
if (err != noErr) {
|
||||
qWarning() << Q_FUNC_INFO << "SSLGetNegotiatedProtocolVersion failed:"
|
||||
<< int(err);
|
||||
qCWarning(lcSsl) << "SSLGetNegotiatedProtocolVersion failed:" << err;
|
||||
return QSsl::UnknownProtocol;
|
||||
}
|
||||
|
||||
@ -356,9 +356,12 @@ void QSslSocketBackendPrivate::transmit()
|
||||
const size_t nextDataBlockSize = writeBuffer.nextDataBlockSize();
|
||||
size_t writtenBytes = 0;
|
||||
const OSStatus err = SSLWrite(context, writeBuffer.readPointer(), nextDataBlockSize, &writtenBytes);
|
||||
#ifdef QSSLSOCKET_DEBUG
|
||||
qCDebug(lcSsl) << plainSocket << "SSLWrite returned" << err;
|
||||
#endif
|
||||
if (err != noErr && err != errSSLWouldBlock) {
|
||||
qWarning() << Q_FUNC_INFO << "SSL write failed with error:" << int(err);
|
||||
setError("SSL write failed", QAbstractSocket::SslInternalError);
|
||||
setError(QStringLiteral("SSLWrite failed: %1").arg(err),
|
||||
QAbstractSocket::SslInternalError);
|
||||
break;
|
||||
}
|
||||
|
||||
@ -387,9 +390,17 @@ void QSslSocketBackendPrivate::transmit()
|
||||
size_t readBytes = 0;
|
||||
data.resize(4096);
|
||||
const OSStatus err = SSLRead(context, data.data(), data.size(), &readBytes);
|
||||
if (err != noErr && err != errSSLWouldBlock) {
|
||||
qWarning() << Q_FUNC_INFO << "SSLRead failed with:" << int(err);
|
||||
setError("SSL read failed", QAbstractSocket::SslInternalError);
|
||||
#ifdef QSSLSOCKET_DEBUG
|
||||
qCDebug(lcSsl) << plainSocket << "SSLRead returned" << err;
|
||||
#endif
|
||||
if (err == errSSLClosedGraceful) {
|
||||
shutdown = true; // the other side shut down, make sure we do not send shutdown ourselves
|
||||
setError(QSslSocket::tr("The TLS/SSL connection has been closed"),
|
||||
QAbstractSocket::RemoteHostClosedError);
|
||||
break;
|
||||
} else if (err != noErr && err != errSSLWouldBlock) {
|
||||
setError(QStringLiteral("SSLRead failed: %1").arg(err),
|
||||
QAbstractSocket::SslInternalError);
|
||||
break;
|
||||
}
|
||||
|
||||
@ -596,7 +607,7 @@ QSslCipher QSslSocketBackendPrivate::QSslCipher_from_SSLCipherSuite(SSLCipherSui
|
||||
} else if (ciph.d->name.startsWith("ECDH-") || ciph.d->name.startsWith("ECDHE-")) {
|
||||
ciph.d->keyExchangeMethod = QLatin1String("ECDH");
|
||||
} else {
|
||||
qWarning() << Q_FUNC_INFO << "Unknown Kx" << ciph.d->name;
|
||||
qCWarning(lcSsl) << "Unknown Kx" << ciph.d->name;
|
||||
}
|
||||
|
||||
if (bits.size() == 2 || bits.size() == 3) {
|
||||
@ -606,7 +617,7 @@ QSslCipher QSslSocketBackendPrivate::QSslCipher_from_SSLCipherSuite(SSLCipherSui
|
||||
} else if (ciph.d->name.contains("-RSA-")) {
|
||||
ciph.d->authenticationMethod = QLatin1String("RSA");
|
||||
} else {
|
||||
qWarning() << Q_FUNC_INFO << "Unknown Au" << ciph.d->name;
|
||||
qCWarning(lcSsl) << "Unknown Au" << ciph.d->name;
|
||||
}
|
||||
|
||||
if (ciph.d->name.contains("RC4-")) {
|
||||
@ -628,7 +639,7 @@ QSslCipher QSslSocketBackendPrivate::QSslCipher_from_SSLCipherSuite(SSLCipherSui
|
||||
} else if (ciph.d->name.contains("NULL-")) {
|
||||
ciph.d->encryptionMethod = QLatin1String("NULL");
|
||||
} else {
|
||||
qWarning() << Q_FUNC_INFO << "Unknown Enc" << ciph.d->name;
|
||||
qCWarning(lcSsl) << "Unknown Enc" << ciph.d->name;
|
||||
}
|
||||
}
|
||||
return ciph;
|
||||
@ -647,7 +658,6 @@ bool QSslSocketBackendPrivate::initSslContext()
|
||||
|
||||
context = SSLCreateContext(Q_NULLPTR, side, kSSLStreamType);
|
||||
if (!context) {
|
||||
qWarning() << Q_FUNC_INFO << "SSLCreateContext failed";
|
||||
setError("SSLCreateContext failed", QAbstractSocket::SslInternalError);
|
||||
return false;
|
||||
}
|
||||
@ -655,9 +665,9 @@ bool QSslSocketBackendPrivate::initSslContext()
|
||||
const OSStatus err = SSLSetIOFuncs(context, reinterpret_cast<SSLReadFunc>(&_q_SSLRead),
|
||||
reinterpret_cast<SSLWriteFunc>(&_q_SSLWrite));
|
||||
if (err != noErr) {
|
||||
qWarning() << Q_FUNC_INFO << "SSLSetIOFuncs failed with error " << int(err);
|
||||
destroySslContext();
|
||||
setError("SSLSetIOFuncs failed", QAbstractSocket::SslInternalError);
|
||||
setError(QStringLiteral("SSLSetIOFuncs failed: %1").arg(err),
|
||||
QAbstractSocket::SslInternalError);
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -675,7 +685,6 @@ bool QSslSocketBackendPrivate::initSslContext()
|
||||
}
|
||||
|
||||
if (!setSessionProtocol()) {
|
||||
qWarning() << Q_FUNC_INFO << "failed to set protocol version";
|
||||
destroySslContext();
|
||||
setError("Failed to set protocol version", QAbstractSocket::SslInternalError);
|
||||
return false;
|
||||
@ -688,7 +697,6 @@ bool QSslSocketBackendPrivate::initSslContext()
|
||||
// But for OS X versions below 10.8 we have to do it explicitly:
|
||||
const OSStatus err = SSLSetEnableCertVerify(context, false);
|
||||
if (err != noErr) {
|
||||
qWarning() << Q_FUNC_INFO << "SSLSetEnableCertVerify failed:" << int(err);
|
||||
destroySslContext();
|
||||
setError(QStringLiteral("SSLSetEnableCertVerify failed: %1").arg(err),
|
||||
QSslSocket::SslInternalError);
|
||||
@ -711,7 +719,6 @@ bool QSslSocketBackendPrivate::initSslContext()
|
||||
err = SSLSetSessionOption(context, kSSLSessionOptionBreakOnCertRequested, true);
|
||||
|
||||
if (err != noErr) {
|
||||
qWarning() << Q_FUNC_INFO << "SSLSetSessionOption failed:" << int(err);
|
||||
destroySslContext();
|
||||
setError(QStringLiteral("SSLSetSessionOption failed: %1").arg(err),
|
||||
QSslSocket::SslInternalError);
|
||||
@ -729,7 +736,6 @@ bool QSslSocketBackendPrivate::initSslContext()
|
||||
}
|
||||
|
||||
if (err != noErr) {
|
||||
qWarning() << Q_FUNC_INFO << "failed to set SSL context option in server mode";
|
||||
destroySslContext();
|
||||
setError(QStringLiteral("failed to set SSL context option in server mode: %1").arg(err),
|
||||
QAbstractSocket::SslInternalError);
|
||||
@ -781,7 +787,7 @@ bool QSslSocketBackendPrivate::setSessionCertificate(QString &errorDescription,
|
||||
OSStatus err = SecPKCS12Import(pkcs12, options, &items);
|
||||
if (err != noErr) {
|
||||
#ifdef QSSLSOCKET_DEBUG
|
||||
qWarning() << Q_FUNC_INFO << plainSocket
|
||||
qCWarning(lcSsl) << plainSocket
|
||||
<< QStringLiteral("SecPKCS12Import failed: %1").arg(err);
|
||||
#endif
|
||||
errorCode = QAbstractSocket::SslInvalidUserDataError;
|
||||
@ -791,7 +797,7 @@ bool QSslSocketBackendPrivate::setSessionCertificate(QString &errorDescription,
|
||||
|
||||
if (!CFArrayGetCount(items)) {
|
||||
#ifdef QSSLSOCKET_DEBUG
|
||||
qWarning() << Q_FUNC_INFO << plainSocket << "SecPKCS12Import returned no items";
|
||||
qCWarning(lcSsl) << plainSocket << "SecPKCS12Import returned no items";
|
||||
#endif
|
||||
errorCode = QAbstractSocket::SslInvalidUserDataError;
|
||||
errorDescription = QStringLiteral("SecPKCS12Import returned no items");
|
||||
@ -802,7 +808,7 @@ bool QSslSocketBackendPrivate::setSessionCertificate(QString &errorDescription,
|
||||
SecIdentityRef identity = (SecIdentityRef)CFDictionaryGetValue(import, kSecImportItemIdentity);
|
||||
if (!identity) {
|
||||
#ifdef QSSLSOCKET_DEBUG
|
||||
qWarning() << Q_FUNC_INFO << plainSocket << "SecPKCS12Import returned no identity";
|
||||
qCWarning(lcSsl) << plainSocket << "SecPKCS12Import returned no identity";
|
||||
#endif
|
||||
errorCode = QAbstractSocket::SslInvalidUserDataError;
|
||||
errorDescription = QStringLiteral("SecPKCS12Import returned no identity");
|
||||
@ -827,7 +833,7 @@ bool QSslSocketBackendPrivate::setSessionCertificate(QString &errorDescription,
|
||||
err = SSLSetCertificate(context, certs);
|
||||
if (err != noErr) {
|
||||
#ifdef QSSLSOCKET_DEBUG
|
||||
qWarning() << Q_FUNC_INFO << plainSocket
|
||||
qCWarning(lcSsl) << plainSocket
|
||||
<< QStringLiteral("Cannot set certificate and key: %1").arg(err);
|
||||
#endif
|
||||
errorCode = QAbstractSocket::SslInvalidUserDataError;
|
||||
@ -851,41 +857,41 @@ bool QSslSocketBackendPrivate::setSessionProtocol()
|
||||
// return errSSLIllegalParam;
|
||||
// where MINIMUM_STREAM_VERSION is SSL_Version_3_0, MAXIMUM_STREAM_VERSION is TLS_Version_1_2.
|
||||
if (configuration.protocol == QSsl::SslV2) {
|
||||
qDebug() << Q_FUNC_INFO << "protocol QSsl::SslV2 is disabled";
|
||||
qCDebug(lcSsl) << "protocol QSsl::SslV2 is disabled";
|
||||
return false;
|
||||
}
|
||||
|
||||
if (configuration.protocol == QSsl::SslV3) {
|
||||
#ifdef QSSLSOCKET_DEBUG
|
||||
qDebug() << Q_FUNC_INFO << plainSocket << "requesting : SSLv3";
|
||||
qCDebug(lcSsl) << plainSocket << "requesting : SSLv3";
|
||||
#endif
|
||||
err = SSLSetProtocolVersionMin(context, kSSLProtocol3);
|
||||
if (err == noErr)
|
||||
err = SSLSetProtocolVersionMax(context, kSSLProtocol3);
|
||||
} else if (configuration.protocol == QSsl::TlsV1_0) {
|
||||
#ifdef QSSLSOCKET_DEBUG
|
||||
qDebug() << Q_FUNC_INFO << plainSocket << "requesting : TLSv1.0";
|
||||
qCDebug(lcSsl) << plainSocket << "requesting : TLSv1.0";
|
||||
#endif
|
||||
err = SSLSetProtocolVersionMin(context, kTLSProtocol1);
|
||||
if (err == noErr)
|
||||
err = SSLSetProtocolVersionMax(context, kTLSProtocol1);
|
||||
} else if (configuration.protocol == QSsl::TlsV1_1) {
|
||||
#ifdef QSSLSOCKET_DEBUG
|
||||
qDebug() << Q_FUNC_INFO << plainSocket << "requesting : TLSv1.1";
|
||||
qCDebug(lcSsl) << plainSocket << "requesting : TLSv1.1";
|
||||
#endif
|
||||
err = SSLSetProtocolVersionMin(context, kTLSProtocol11);
|
||||
if (err == noErr)
|
||||
err = SSLSetProtocolVersionMax(context, kTLSProtocol11);
|
||||
} else if (configuration.protocol == QSsl::TlsV1_2) {
|
||||
#ifdef QSSLSOCKET_DEBUG
|
||||
qDebug() << Q_FUNC_INFO << plainSocket << "requesting : TLSv1.2";
|
||||
qCDebug(lcSsl) << plainSocket << "requesting : TLSv1.2";
|
||||
#endif
|
||||
err = SSLSetProtocolVersionMin(context, kTLSProtocol12);
|
||||
if (err == noErr)
|
||||
err = SSLSetProtocolVersionMax(context, kTLSProtocol12);
|
||||
} else if (configuration.protocol == QSsl::AnyProtocol) {
|
||||
#ifdef QSSLSOCKET_DEBUG
|
||||
qDebug() << Q_FUNC_INFO << plainSocket << "requesting : any";
|
||||
qCDebug(lcSsl) << plainSocket << "requesting : any";
|
||||
#endif
|
||||
// kSSLProtocol3, since kSSLProtocol2 is disabled:
|
||||
err = SSLSetProtocolVersionMin(context, kSSLProtocol3);
|
||||
@ -893,41 +899,43 @@ bool QSslSocketBackendPrivate::setSessionProtocol()
|
||||
err = SSLSetProtocolVersionMax(context, kTLSProtocol12);
|
||||
} else if (configuration.protocol == QSsl::TlsV1SslV3) {
|
||||
#ifdef QSSLSOCKET_DEBUG
|
||||
qDebug() << Q_FUNC_INFO << plainSocket << "requesting : SSLv3 - TLSv1.2";
|
||||
qCDebug(lcSsl) << plainSocket << "requesting : SSLv3 - TLSv1.2";
|
||||
#endif
|
||||
err = SSLSetProtocolVersionMin(context, kSSLProtocol3);
|
||||
if (err == noErr)
|
||||
err = SSLSetProtocolVersionMax(context, kTLSProtocol12);
|
||||
} else if (configuration.protocol == QSsl::SecureProtocols) {
|
||||
#ifdef QSSLSOCKET_DEBUG
|
||||
qDebug() << Q_FUNC_INFO << plainSocket << "requesting : TLSv1 - TLSv1.2";
|
||||
qCDebug(lcSsl) << plainSocket << "requesting : TLSv1 - TLSv1.2";
|
||||
#endif
|
||||
err = SSLSetProtocolVersionMin(context, kTLSProtocol1);
|
||||
if (err == noErr)
|
||||
err = SSLSetProtocolVersionMax(context, kTLSProtocol12);
|
||||
} else if (configuration.protocol == QSsl::TlsV1_0OrLater) {
|
||||
#ifdef QSSLSOCKET_DEBUG
|
||||
qDebug() << Q_FUNC_INFO << plainSocket << "requesting : TLSv1 - TLSv1.2";
|
||||
qCDebug(lcSsl) << plainSocket << "requesting : TLSv1 - TLSv1.2";
|
||||
#endif
|
||||
err = SSLSetProtocolVersionMin(context, kTLSProtocol1);
|
||||
if (err == noErr)
|
||||
err = SSLSetProtocolVersionMax(context, kTLSProtocol12);
|
||||
} else if (configuration.protocol == QSsl::TlsV1_1OrLater) {
|
||||
#ifdef QSSLSOCKET_DEBUG
|
||||
qDebug() << Q_FUNC_INFO << plainSocket << "requesting : TLSv1.1 - TLSv1.2";
|
||||
qCDebug(lcSsl) << plainSocket << "requesting : TLSv1.1 - TLSv1.2";
|
||||
#endif
|
||||
err = SSLSetProtocolVersionMin(context, kTLSProtocol11);
|
||||
if (err == noErr)
|
||||
err = SSLSetProtocolVersionMax(context, kTLSProtocol12);
|
||||
} else if (configuration.protocol == QSsl::TlsV1_2OrLater) {
|
||||
#ifdef QSSLSOCKET_DEBUG
|
||||
qDebug() << Q_FUNC_INFO << plainSocket << "requesting : TLSv1.2";
|
||||
qCDebug(lcSsl) << plainSocket << "requesting : TLSv1.2";
|
||||
#endif
|
||||
err = SSLSetProtocolVersionMin(context, kTLSProtocol12);
|
||||
if (err == noErr)
|
||||
err = SSLSetProtocolVersionMax(context, kTLSProtocol12);
|
||||
} else {
|
||||
qDebug() << Q_FUNC_INFO << "no protocol version found in the configuration";
|
||||
#ifdef QSSLSOCKET_DEBUG
|
||||
qCDebug(lcSsl) << plainSocket << "no protocol version found in the configuration";
|
||||
#endif
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -997,7 +1005,8 @@ bool QSslSocketBackendPrivate::verifyPeerTrust()
|
||||
if (err != noErr) {
|
||||
// We can not ignore this, it's not even about trust verification
|
||||
// probably ...
|
||||
setError("SecTrustEvaluate failed", QAbstractSocket::SslHandshakeFailedError);
|
||||
setError(QStringLiteral("SecTrustEvaluate failed: %1").arg(err),
|
||||
QAbstractSocket::SslHandshakeFailedError);
|
||||
plainSocket->disconnectFromHost();
|
||||
return false;
|
||||
}
|
||||
@ -1132,7 +1141,7 @@ bool QSslSocketBackendPrivate::startHandshake()
|
||||
|
||||
OSStatus err = SSLHandshake(context);
|
||||
#ifdef QSSLSOCKET_DEBUG
|
||||
qDebug() << Q_FUNC_INFO << plainSocket << "SSLHandhake returned" << err;
|
||||
qCDebug(lcSsl) << plainSocket << "SSLHandhake returned" << err;
|
||||
#endif
|
||||
|
||||
if (err == errSSLWouldBlock) {
|
||||
@ -1153,7 +1162,6 @@ bool QSslSocketBackendPrivate::startHandshake()
|
||||
// setSessionCertificate does not fail if we have no certificate.
|
||||
// Failure means a real error (invalid certificate, no private key, etc).
|
||||
if (!setSessionCertificate(errorDescription, errorCode)) {
|
||||
qWarning() << Q_FUNC_INFO << "Failed to provide a client certificate";
|
||||
setError(errorDescription, errorCode);
|
||||
return false;
|
||||
} else {
|
||||
@ -1169,7 +1177,7 @@ bool QSslSocketBackendPrivate::startHandshake()
|
||||
return startHandshake();
|
||||
}
|
||||
|
||||
setError(QStringLiteral("Error during SSL handshake: %1").arg(err),
|
||||
setError(QStringLiteral("SSLHandshake failed: %1").arg(err),
|
||||
QAbstractSocket::SslHandshakeFailedError);
|
||||
plainSocket->disconnectFromHost();
|
||||
return false;
|
||||
@ -1177,7 +1185,7 @@ bool QSslSocketBackendPrivate::startHandshake()
|
||||
|
||||
// Connection aborted during handshake phase.
|
||||
if (q->state() != QAbstractSocket::ConnectedState) {
|
||||
qDebug() << Q_FUNC_INFO << "connection aborted";
|
||||
qCDebug(lcSsl) << "connection aborted";
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -379,17 +379,20 @@ QEvdevKeyboardHandler::KeycodeAction QEvdevKeyboardHandler::processKeycode(quint
|
||||
}
|
||||
|
||||
if (!skip) {
|
||||
qCDebug(qLcEvdevKeyMap, "Processing: uni=%04x, qt=%08x, qtmod=%08x", unicode, qtcode & ~modmask, (qtcode & modmask));
|
||||
//If NumLockOff and keypad key pressed remap event sent
|
||||
if (!m_locks[1] &&
|
||||
(qtcode & Qt::KeypadModifier) &&
|
||||
// Up until now qtcode contained both the key and modifiers. Split it.
|
||||
Qt::KeyboardModifiers qtmods = Qt::KeyboardModifiers(qtcode & modmask);
|
||||
qtcode &= ~modmask;
|
||||
|
||||
qCDebug(qLcEvdevKeyMap, "Processing: uni=%04x, qt=%08x, qtmod=%08x", unicode, qtcode, int(qtmods));
|
||||
|
||||
// If NumLockOff and keypad key pressed remap event sent
|
||||
if (!m_locks[1] && (qtmods & Qt::KeypadModifier) &&
|
||||
keycode >= 71 &&
|
||||
keycode <= 83 &&
|
||||
keycode != 74 &&
|
||||
keycode != 78) {
|
||||
|
||||
unicode = 0xffff;
|
||||
int oldMask = (qtcode & modmask);
|
||||
switch (keycode) {
|
||||
case 71: //7 --> Home
|
||||
qtcode = Qt::Key_Home;
|
||||
@ -425,11 +428,14 @@ QEvdevKeyboardHandler::KeycodeAction QEvdevKeyboardHandler::processKeycode(quint
|
||||
qtcode = Qt::Key_Delete;
|
||||
break;
|
||||
}
|
||||
qtcode ^= oldMask;
|
||||
}
|
||||
|
||||
// send the result to the server
|
||||
processKeyEvent(keycode, unicode, qtcode & ~modmask, Qt::KeyboardModifiers(qtcode & modmask), pressed, autorepeat);
|
||||
// Map SHIFT + Tab to SHIFT + Backtab, QShortcutMap knows about this translation
|
||||
if (qtcode == Qt::Key_Tab && (qtmods & Qt::ShiftModifier) == Qt::ShiftModifier)
|
||||
qtcode = Qt::Key_Backtab;
|
||||
|
||||
// Generate the QPA event.
|
||||
processKeyEvent(keycode, unicode, qtcode, qtmods, pressed, autorepeat);
|
||||
}
|
||||
}
|
||||
return result;
|
||||
|
@ -79,12 +79,12 @@ QT_USE_NAMESPACE
|
||||
|
||||
- (void)QT_MANGLE_NAMESPACE(qt_setDockMenu):(NSMenu *)newMenu
|
||||
{
|
||||
[[QCocoaApplicationDelegate sharedDelegate] setDockMenu:newMenu];
|
||||
[[QT_MANGLE_NAMESPACE(QCocoaApplicationDelegate) sharedDelegate] setDockMenu:newMenu];
|
||||
}
|
||||
|
||||
- (QT_MANGLE_NAMESPACE(QCocoaMenuLoader) *)QT_MANGLE_NAMESPACE(qt_qcocoamenuLoader)
|
||||
{
|
||||
return [[QCocoaApplicationDelegate sharedDelegate] menuLoader];
|
||||
return [[QT_MANGLE_NAMESPACE(QCocoaApplicationDelegate) sharedDelegate] menuLoader];
|
||||
}
|
||||
|
||||
- (int)QT_MANGLE_NAMESPACE(qt_validModesForFontPanel):(NSFontPanel *)fontPanel
|
||||
@ -147,9 +147,9 @@ static const QByteArray q_macLocalEventType = QByteArrayLiteral("mac_generic_NSE
|
||||
|
||||
@end
|
||||
|
||||
@implementation QNSApplication
|
||||
@implementation QT_MANGLE_NAMESPACE(QNSApplication)
|
||||
|
||||
- (void)qt_sendEvent_original:(NSEvent *)event
|
||||
- (void)QT_MANGLE_NAMESPACE(qt_sendEvent_original):(NSEvent *)event
|
||||
{
|
||||
Q_UNUSED(event);
|
||||
// This method will only be used as a signature
|
||||
@ -157,14 +157,14 @@ static const QByteArray q_macLocalEventType = QByteArrayLiteral("mac_generic_NSE
|
||||
// containing the original [NSApplication sendEvent:] implementation
|
||||
}
|
||||
|
||||
- (void)qt_sendEvent_replacement:(NSEvent *)event
|
||||
- (void)QT_MANGLE_NAMESPACE(qt_sendEvent_replacement):(NSEvent *)event
|
||||
{
|
||||
// This method (or its implementation to be precise) will
|
||||
// be called instead of sendEvent if redirection occurs.
|
||||
// 'self' will then be an instance of NSApplication
|
||||
// (and not QNSApplication)
|
||||
if (![NSApp QT_MANGLE_NAMESPACE(qt_filterEvent):event])
|
||||
[self qt_sendEvent_original:event];
|
||||
[self QT_MANGLE_NAMESPACE(qt_sendEvent_original):event];
|
||||
}
|
||||
|
||||
- (void)sendEvent:(NSEvent *)event
|
||||
@ -187,7 +187,7 @@ void qt_redirectNSApplicationSendEvent()
|
||||
// can be unloaded.
|
||||
return;
|
||||
|
||||
if ([NSApp isMemberOfClass:[QNSApplication class]]) {
|
||||
if ([NSApp isMemberOfClass:[QT_MANGLE_NAMESPACE(QNSApplication) class]]) {
|
||||
// No need to change implementation since Qt
|
||||
// already controls a subclass of NSApplication
|
||||
return;
|
||||
@ -200,9 +200,9 @@ void qt_redirectNSApplicationSendEvent()
|
||||
qt_cocoa_change_implementation(
|
||||
[NSApplication class],
|
||||
@selector(sendEvent:),
|
||||
[QNSApplication class],
|
||||
@selector(qt_sendEvent_replacement:),
|
||||
@selector(qt_sendEvent_original:));
|
||||
[QT_MANGLE_NAMESPACE(QNSApplication) class],
|
||||
@selector(QT_MANGLE_NAMESPACE(qt_sendEvent_replacement):),
|
||||
@selector(QT_MANGLE_NAMESPACE(qt_sendEvent_original):));
|
||||
}
|
||||
|
||||
void qt_resetNSApplicationSendEvent()
|
||||
|
@ -1436,7 +1436,7 @@ static QTabletEvent::TabletDevice wacomTabletDevice(NSEvent *theEvent)
|
||||
if (eventType == QEvent::KeyPress) {
|
||||
|
||||
if (m_composingText.isEmpty())
|
||||
m_sendKeyEvent = !QWindowSystemInterface::tryHandleShortcutEvent(focusWindow, timestamp, keyCode, modifiers, text);
|
||||
m_sendKeyEvent = !QWindowSystemInterface::tryHandleShortcutEvent(focusWindow, timestamp, keyCode, modifiers, text, [nsevent isARepeat], 1);
|
||||
|
||||
QObject *fo = QGuiApplication::focusObject();
|
||||
if (m_sendKeyEvent && fo) {
|
||||
|
@ -1169,23 +1169,19 @@ QT_WARNING_POP
|
||||
CustomFontFileLoader fontFileLoader;
|
||||
fontFileLoader.addKey(this, fontData);
|
||||
|
||||
IDWriteFactory *factory = 0;
|
||||
HRESULT hres = DWriteCreateFactory(DWRITE_FACTORY_TYPE_SHARED,
|
||||
__uuidof(IDWriteFactory),
|
||||
reinterpret_cast<IUnknown **>(&factory));
|
||||
if (FAILED(hres)) {
|
||||
qErrnoWarning(hres, "%s: DWriteCreateFactory failed", __FUNCTION__);
|
||||
QSharedPointer<QWindowsFontEngineData> fontEngineData = sharedFontData();
|
||||
if (!initDirectWrite(fontEngineData.data()))
|
||||
return 0;
|
||||
}
|
||||
|
||||
IDWriteFontFile *fontFile = 0;
|
||||
void *key = this;
|
||||
|
||||
hres = factory->CreateCustomFontFileReference(&key, sizeof(void *),
|
||||
fontFileLoader.loader(), &fontFile);
|
||||
HRESULT hres = fontEngineData->directWriteFactory->CreateCustomFontFileReference(&key,
|
||||
sizeof(void *),
|
||||
fontFileLoader.loader(),
|
||||
&fontFile);
|
||||
if (FAILED(hres)) {
|
||||
qErrnoWarning(hres, "%s: CreateCustomFontFileReference failed", __FUNCTION__);
|
||||
factory->Release();
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -1196,30 +1192,31 @@ QT_WARNING_POP
|
||||
fontFile->Analyze(&isSupportedFontType, &fontFileType, &fontFaceType, &numberOfFaces);
|
||||
if (!isSupportedFontType) {
|
||||
fontFile->Release();
|
||||
factory->Release();
|
||||
return 0;
|
||||
}
|
||||
|
||||
IDWriteFontFace *directWriteFontFace = 0;
|
||||
hres = factory->CreateFontFace(fontFaceType, 1, &fontFile, 0, DWRITE_FONT_SIMULATIONS_NONE,
|
||||
&directWriteFontFace);
|
||||
hres = fontEngineData->directWriteFactory->CreateFontFace(fontFaceType,
|
||||
1,
|
||||
&fontFile,
|
||||
0,
|
||||
DWRITE_FONT_SIMULATIONS_NONE,
|
||||
&directWriteFontFace);
|
||||
if (FAILED(hres)) {
|
||||
qErrnoWarning(hres, "%s: CreateFontFace failed", __FUNCTION__);
|
||||
fontFile->Release();
|
||||
factory->Release();
|
||||
return 0;
|
||||
}
|
||||
|
||||
fontFile->Release();
|
||||
|
||||
fontEngine = new QWindowsFontEngineDirectWrite(directWriteFontFace, pixelSize,
|
||||
sharedFontData());
|
||||
fontEngineData);
|
||||
|
||||
// Get font family from font data
|
||||
fontEngine->fontDef.family = font.familyName();
|
||||
|
||||
directWriteFontFace->Release();
|
||||
factory->Release();
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -995,6 +995,7 @@ QVector<FORMATETC> QWindowsMimeImage::formatsForMime(const QString &mimeType, co
|
||||
if (!image.isNull() && image.hasAlphaChannel())
|
||||
formatetcs += setCf(CF_DIBV5);
|
||||
formatetcs += setCf(CF_DIB);
|
||||
formatetcs += setCf(CF_PNG); // QTBUG-86848, Paste into GIMP queries for PNG.
|
||||
}
|
||||
return formatetcs;
|
||||
}
|
||||
@ -1025,13 +1026,15 @@ bool QWindowsMimeImage::canConvertFromMime(const FORMATETC &formatetc, const QMi
|
||||
return false;
|
||||
// QTBUG-11463, deny CF_DIB support for images with alpha to prevent loss of
|
||||
// transparency in conversion.
|
||||
return cf == CF_DIBV5 || (cf == CF_DIB && !image.hasAlphaChannel());
|
||||
return cf == CF_DIBV5
|
||||
|| (cf == CF_DIB && !image.hasAlphaChannel())
|
||||
|| cf == int(CF_PNG);
|
||||
}
|
||||
|
||||
bool QWindowsMimeImage::convertFromMime(const FORMATETC &formatetc, const QMimeData *mimeData, STGMEDIUM * pmedium) const
|
||||
{
|
||||
int cf = getCf(formatetc);
|
||||
if ((cf == CF_DIB || cf == CF_DIBV5) && mimeData->hasImage()) {
|
||||
if ((cf == CF_DIB || cf == CF_DIBV5 || cf == int(CF_PNG)) && mimeData->hasImage()) {
|
||||
QImage img = qvariant_cast<QImage>(mimeData->imageData());
|
||||
if (img.isNull())
|
||||
return false;
|
||||
@ -1042,6 +1045,12 @@ bool QWindowsMimeImage::convertFromMime(const FORMATETC &formatetc, const QMimeD
|
||||
const QByteArray ba = writeDib(img);
|
||||
if (!ba.isEmpty())
|
||||
return setData(ba, pmedium);
|
||||
} else if (cf == int(CF_PNG)) {
|
||||
QBuffer buffer(&ba);
|
||||
const bool written = buffer.open(QIODevice::WriteOnly) && img.save(&buffer, "PNG");
|
||||
buffer.close();
|
||||
if (written)
|
||||
return setData(ba, pmedium);
|
||||
} else {
|
||||
QDataStream s(&ba, QIODevice::WriteOnly);
|
||||
s.setByteOrder(QDataStream::LittleEndian);// Intel byte order ####
|
||||
|
@ -224,7 +224,7 @@ QWindowsOpenGLTester::Renderers QWindowsOpenGLTester::detectSupportedRenderers(c
|
||||
#elif defined(Q_OS_WINCE)
|
||||
return QWindowsOpenGLTester::Gles;
|
||||
#else
|
||||
QOpenGLConfig::Gpu qgpu = QOpenGLConfig::Gpu::fromDevice(gpu.deviceId, gpu.vendorId, gpu.driverVersion, gpu.description);
|
||||
QOpenGLConfig::Gpu qgpu = QOpenGLConfig::Gpu::fromDevice(gpu.vendorId, gpu.deviceId, gpu.driverVersion, gpu.description);
|
||||
SupportedRenderersCache *srCache = supportedRenderersCache();
|
||||
SupportedRenderersCache::const_iterator it = srCache->find(qgpu);
|
||||
if (it != srCache->cend())
|
||||
|
@ -454,6 +454,7 @@ QXcbConnection::QXcbConnection(QXcbNativeInterface *nativeInterface, bool canGra
|
||||
, has_xkb(false)
|
||||
, m_buttons(0)
|
||||
, m_focusWindow(0)
|
||||
, m_clientLeader(0)
|
||||
, m_systemTrayTracker(0)
|
||||
, m_glIntegration(Q_NULLPTR)
|
||||
, m_xiGrab(false)
|
||||
@ -1336,6 +1337,58 @@ xcb_window_t QXcbConnection::rootWindow()
|
||||
return s ? s->root() : 0;
|
||||
}
|
||||
|
||||
xcb_window_t QXcbConnection::clientLeader()
|
||||
{
|
||||
if (m_clientLeader == 0) {
|
||||
m_clientLeader = xcb_generate_id(xcb_connection());
|
||||
QXcbScreen *screen = primaryScreen();
|
||||
Q_XCB_CALL(xcb_create_window(xcb_connection(),
|
||||
XCB_COPY_FROM_PARENT,
|
||||
m_clientLeader,
|
||||
screen->root(),
|
||||
0, 0, 1, 1,
|
||||
0,
|
||||
XCB_WINDOW_CLASS_INPUT_OUTPUT,
|
||||
screen->screen()->root_visual,
|
||||
0, 0));
|
||||
#ifndef QT_NO_DEBUG
|
||||
QByteArray ba("Qt client leader window");
|
||||
Q_XCB_CALL(xcb_change_property(xcb_connection(),
|
||||
XCB_PROP_MODE_REPLACE,
|
||||
m_clientLeader,
|
||||
atom(QXcbAtom::_NET_WM_NAME),
|
||||
atom(QXcbAtom::UTF8_STRING),
|
||||
8,
|
||||
ba.length(),
|
||||
ba.constData()));
|
||||
#endif
|
||||
Q_XCB_CALL(xcb_change_property(xcb_connection(),
|
||||
XCB_PROP_MODE_REPLACE,
|
||||
m_clientLeader,
|
||||
atom(QXcbAtom::WM_CLIENT_LEADER),
|
||||
XCB_ATOM_WINDOW,
|
||||
32,
|
||||
1,
|
||||
&m_clientLeader));
|
||||
|
||||
#if !defined(QT_NO_SESSIONMANAGER) && defined(XCB_USE_SM)
|
||||
// If we are session managed, inform the window manager about it
|
||||
QByteArray session = qGuiApp->sessionId().toLatin1();
|
||||
if (!session.isEmpty()) {
|
||||
Q_XCB_CALL(xcb_change_property(xcb_connection(),
|
||||
XCB_PROP_MODE_REPLACE,
|
||||
m_clientLeader,
|
||||
atom(QXcbAtom::SM_CLIENT_ID),
|
||||
XCB_ATOM_STRING,
|
||||
8,
|
||||
session.length(),
|
||||
session.constData()));
|
||||
}
|
||||
#endif
|
||||
}
|
||||
return m_clientLeader;
|
||||
}
|
||||
|
||||
#ifdef XCB_USE_XLIB
|
||||
void *QXcbConnection::xlib_display() const
|
||||
{
|
||||
@ -1578,6 +1631,7 @@ static const char * xcb_atomnames = {
|
||||
"_KDE_NET_WM_WINDOW_TYPE_OVERRIDE\0"
|
||||
|
||||
"_KDE_NET_WM_FRAME_STRUT\0"
|
||||
"_NET_FRAME_EXTENTS\0"
|
||||
|
||||
"_NET_STARTUP_INFO\0"
|
||||
"_NET_STARTUP_INFO_BEGIN\0"
|
||||
|
@ -194,6 +194,7 @@ namespace QXcbAtom {
|
||||
_KDE_NET_WM_WINDOW_TYPE_OVERRIDE,
|
||||
|
||||
_KDE_NET_WM_FRAME_STRUT,
|
||||
_NET_FRAME_EXTENTS,
|
||||
|
||||
_NET_STARTUP_INFO,
|
||||
_NET_STARTUP_INFO_BEGIN,
|
||||
@ -402,6 +403,7 @@ public:
|
||||
|
||||
QXcbWMSupport *wmSupport() const { return m_wmSupport.data(); }
|
||||
xcb_window_t rootWindow();
|
||||
xcb_window_t clientLeader();
|
||||
|
||||
bool hasDefaultVisualId() const { return m_defaultVisualId != UINT_MAX; }
|
||||
xcb_visualid_t defaultVisualId() const { return m_defaultVisualId; }
|
||||
@ -641,6 +643,7 @@ private:
|
||||
|
||||
QXcbWindow *m_focusWindow;
|
||||
|
||||
xcb_window_t m_clientLeader;
|
||||
QByteArray m_startupId;
|
||||
QXcbSystemTrayTracker *m_systemTrayTracker;
|
||||
QXcbGlIntegration *m_glIntegration;
|
||||
|
@ -170,38 +170,6 @@ QXcbScreen::QXcbScreen(QXcbConnection *connection, QXcbVirtualDesktop *virtualDe
|
||||
else
|
||||
m_syncRequestSupported = true;
|
||||
|
||||
m_clientLeader = xcb_generate_id(xcb_connection());
|
||||
Q_XCB_CALL2(xcb_create_window(xcb_connection(),
|
||||
XCB_COPY_FROM_PARENT,
|
||||
m_clientLeader,
|
||||
screen()->root,
|
||||
0, 0, 1, 1,
|
||||
0,
|
||||
XCB_WINDOW_CLASS_INPUT_OUTPUT,
|
||||
screen()->root_visual,
|
||||
0, 0), connection);
|
||||
#ifndef QT_NO_DEBUG
|
||||
QByteArray ba("Qt client leader window for screen ");
|
||||
ba += m_outputName.toUtf8();
|
||||
Q_XCB_CALL2(xcb_change_property(xcb_connection(),
|
||||
XCB_PROP_MODE_REPLACE,
|
||||
m_clientLeader,
|
||||
atom(QXcbAtom::_NET_WM_NAME),
|
||||
atom(QXcbAtom::UTF8_STRING),
|
||||
8,
|
||||
ba.length(),
|
||||
ba.constData()), connection);
|
||||
#endif
|
||||
|
||||
Q_XCB_CALL2(xcb_change_property(xcb_connection(),
|
||||
XCB_PROP_MODE_REPLACE,
|
||||
m_clientLeader,
|
||||
atom(QXcbAtom::WM_CLIENT_LEADER),
|
||||
XCB_ATOM_WINDOW,
|
||||
32,
|
||||
1,
|
||||
&m_clientLeader), connection);
|
||||
|
||||
xcb_depth_iterator_t depth_iterator =
|
||||
xcb_screen_allowed_depths_iterator(screen());
|
||||
|
||||
|
@ -116,8 +116,6 @@ public:
|
||||
xcb_randr_crtc_t crtc() const { return m_crtc; }
|
||||
xcb_randr_mode_t mode() const { return m_mode; }
|
||||
|
||||
xcb_window_t clientLeader() const { return m_clientLeader; }
|
||||
|
||||
void windowShown(QXcbWindow *window);
|
||||
QString windowManagerName() const { return m_windowManagerName; }
|
||||
bool syncRequestSupported() const { return m_syncRequestSupported; }
|
||||
@ -173,7 +171,6 @@ private:
|
||||
Qt::ScreenOrientation m_orientation;
|
||||
QString m_windowManagerName;
|
||||
bool m_syncRequestSupported;
|
||||
xcb_window_t m_clientLeader;
|
||||
QMap<xcb_visualid_t, xcb_visualtype_t> m_visuals;
|
||||
QMap<xcb_visualid_t, quint8> m_visualDepths;
|
||||
QXcbCursor *m_cursor;
|
||||
|
@ -623,7 +623,7 @@ void QXcbWindow::create()
|
||||
|
||||
xcb_set_wm_hints(xcb_connection(), m_window, &hints);
|
||||
|
||||
xcb_window_t leader = platformScreen->clientLeader();
|
||||
xcb_window_t leader = connection()->clientLeader();
|
||||
Q_XCB_CALL(xcb_change_property(xcb_connection(), XCB_PROP_MODE_REPLACE, m_window,
|
||||
atom(QXcbAtom::WM_CLIENT_LEADER), XCB_ATOM_WINDOW, 32,
|
||||
1, &leader));
|
||||
@ -746,6 +746,22 @@ void QXcbWindow::setGeometry(const QRect &rect)
|
||||
QMargins QXcbWindow::frameMargins() const
|
||||
{
|
||||
if (m_dirtyFrameMargins) {
|
||||
if (connection()->wmSupport()->isSupportedByWM(atom(QXcbAtom::_NET_FRAME_EXTENTS))) {
|
||||
xcb_get_property_cookie_t cookie = xcb_get_property(xcb_connection(), false, m_window,
|
||||
atom(QXcbAtom::_NET_FRAME_EXTENTS), XCB_ATOM_CARDINAL, 0, 4);
|
||||
QScopedPointer<xcb_get_property_reply_t, QScopedPointerPodDeleter> reply(
|
||||
xcb_get_property_reply(xcb_connection(), cookie, NULL));
|
||||
if (reply && reply->type == XCB_ATOM_CARDINAL && reply->format == 32 && reply->value_len == 4) {
|
||||
quint32 *data = (quint32 *)xcb_get_property_value(reply.data());
|
||||
// _NET_FRAME_EXTENTS format is left, right, top, bottom
|
||||
m_frameMargins = QMargins(data[0], data[2], data[1], data[3]);
|
||||
m_dirtyFrameMargins = false;
|
||||
return m_frameMargins;
|
||||
}
|
||||
}
|
||||
|
||||
// _NET_FRAME_EXTENTS property is not available, so
|
||||
// walk up the window tree to get the frame parent
|
||||
xcb_window_t window = m_window;
|
||||
xcb_window_t parent = m_window;
|
||||
|
||||
@ -859,7 +875,7 @@ void QXcbWindow::show()
|
||||
// Default to client leader if there is no transient parent, else modal dialogs can
|
||||
// be hidden by their parents.
|
||||
if (!transientXcbParent)
|
||||
transientXcbParent = xcbScreen()->clientLeader();
|
||||
transientXcbParent = connection()->clientLeader();
|
||||
if (transientXcbParent) { // ICCCM 4.1.2.6
|
||||
Q_XCB_CALL(xcb_change_property(xcb_connection(), XCB_PROP_MODE_REPLACE, m_window,
|
||||
XCB_ATOM_WM_TRANSIENT_FOR, XCB_ATOM_WINDOW, 32,
|
||||
@ -2446,6 +2462,8 @@ void QXcbWindow::handlePropertyNotifyEvent(const xcb_property_notify_event_t *ev
|
||||
m_windowState = newState;
|
||||
}
|
||||
return;
|
||||
} else if (event->atom == atom(QXcbAtom::_NET_FRAME_EXTENTS)) {
|
||||
m_dirtyFrameMargins = true;
|
||||
} else if (event->atom == atom(QXcbAtom::_NET_WORKAREA) && xcbScreen() && event->window == xcbScreen()->root()) {
|
||||
xcbScreen()->updateGeometry(event->time);
|
||||
}
|
||||
|
@ -693,7 +693,8 @@ QStringList RCCResourceLibrary::dataFiles() const
|
||||
RCCFileInfo *child = it.value();
|
||||
if (child->m_flags & RCCFileInfo::Directory)
|
||||
pending.push(child);
|
||||
ret.append(child->m_fileInfo.filePath());
|
||||
else
|
||||
ret.append(child->m_fileInfo.filePath());
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
|
@ -493,9 +493,6 @@
|
||||
but Graphics View currently doesn't support the Qt::Sheet and
|
||||
Qt::Drawer flags that are common on OS X.
|
||||
|
||||
The capabilities of QGraphicsWidget are expected to grow depending
|
||||
on community feedback.
|
||||
|
||||
\section3 QGraphicsLayout
|
||||
|
||||
QGraphicsLayout is part of a second-generation layout framework
|
||||
|
@ -428,7 +428,7 @@
|
||||
\note If both this flag and ItemClipsChildrenToShape are set, the clip
|
||||
will be enforced. This is equivalent to just setting
|
||||
ItemClipsChildrenToShape.
|
||||
.
|
||||
|
||||
This flag was introduced in Qt 5.4.
|
||||
*/
|
||||
|
||||
|
@ -289,8 +289,15 @@ QWidgetPrivate::QWidgetPrivate(int version)
|
||||
return;
|
||||
}
|
||||
|
||||
#ifdef QT_BUILD_INTERNAL
|
||||
// Don't check the version parameter in internal builds.
|
||||
// This allows incompatible versions to be loaded, possibly for testing.
|
||||
Q_UNUSED(version);
|
||||
#else
|
||||
if (version != QObjectPrivateVersion)
|
||||
qFatal("Cannot mix incompatible Qt libraries");
|
||||
qFatal("Cannot mix incompatible Qt library (version 0x%x) with this library (version 0x%x)",
|
||||
version, QObjectPrivateVersion);
|
||||
#endif
|
||||
|
||||
isWidget = true;
|
||||
memset(high_attributes, 0, sizeof(high_attributes));
|
||||
|
@ -396,7 +396,7 @@ void QWindowsVistaStyle::drawPrimitive(PrimitiveElement element, const QStyleOpt
|
||||
|
||||
case PE_IndicatorBranch:
|
||||
{
|
||||
XPThemeData theme(0, painter, QWindowsXPStylePrivate::TreeViewTheme);
|
||||
XPThemeData theme(widget, painter, QWindowsXPStylePrivate::TreeViewTheme);
|
||||
static int decoration_size = 0;
|
||||
if (d->initTreeViewTheming() && theme.isValid() && !decoration_size) {
|
||||
XPThemeData themeSize = theme;
|
||||
@ -657,6 +657,8 @@ void QWindowsVistaStyle::drawPrimitive(PrimitiveElement element, const QStyleOpt
|
||||
newStyle = !qobject_cast<const QTableView*>(view);
|
||||
selectionBehavior = view->selectionBehavior();
|
||||
selectionMode = view->selectionMode();
|
||||
} else if (!widget) {
|
||||
newStyle = !QStyleHelper::hasAncestor(option->styleObject, QAccessible::MenuItem) ;
|
||||
}
|
||||
|
||||
if (newStyle && (vopt = qstyleoption_cast<const QStyleOptionViewItem *>(option))) {
|
||||
@ -710,7 +712,7 @@ void QWindowsVistaStyle::drawPrimitive(PrimitiveElement element, const QStyleOpt
|
||||
state = LISS_HOT;
|
||||
|
||||
QPainter pixmapPainter(&pixmap);
|
||||
XPThemeData theme(0, &pixmapPainter,
|
||||
XPThemeData theme(widget, &pixmapPainter,
|
||||
QWindowsXPStylePrivate::TreeViewTheme,
|
||||
LVP_LISTITEM, state, QRect(0, 0, sectionSize.width(), sectionSize.height()));
|
||||
if (d->initTreeViewTheming() && theme.isValid()) {
|
||||
|
@ -1224,7 +1224,7 @@ void QWindowsXPStyle::polish(QWidget *widget)
|
||||
if (!d->hasInitColors) {
|
||||
// Get text color for group box labels
|
||||
COLORREF cref;
|
||||
XPThemeData theme(0, 0, QWindowsXPStylePrivate::ButtonTheme, 0, 0);
|
||||
XPThemeData theme(widget, 0, QWindowsXPStylePrivate::ButtonTheme, 0, 0);
|
||||
QWindowsXPStylePrivate::pGetThemeColor(theme.handle(), BP_GROUPBOX, GBS_NORMAL, TMT_TEXTCOLOR, &cref);
|
||||
d->groupBoxTextColor = qRgb(GetRValue(cref), GetGValue(cref), GetBValue(cref));
|
||||
QWindowsXPStylePrivate::pGetThemeColor(theme.handle(), BP_GROUPBOX, GBS_DISABLED, TMT_TEXTCOLOR, &cref);
|
||||
@ -1540,7 +1540,7 @@ case PE_Frame:
|
||||
return;
|
||||
themeNumber = QWindowsXPStylePrivate::ListViewTheme;
|
||||
partId = LVP_LISTGROUP;
|
||||
XPThemeData theme(0, 0, themeNumber, partId, 0);
|
||||
XPThemeData theme(widget, 0, themeNumber, partId, 0);
|
||||
|
||||
if (!(flags & State_Enabled))
|
||||
stateId = ETS_DISABLED;
|
||||
|
@ -2093,8 +2093,10 @@ void QComboBoxPrivate::setCurrentIndex(const QModelIndex &mi)
|
||||
const QString newText = itemText(normalized);
|
||||
if (lineEdit->text() != newText) {
|
||||
lineEdit->setText(newText);
|
||||
#ifndef QT_NO_COMPLETER
|
||||
if (lineEdit->completer())
|
||||
lineEdit->completer()->setCompletionPrefix(newText);
|
||||
#endif
|
||||
}
|
||||
updateLineEditGeometry();
|
||||
}
|
||||
|
@ -202,9 +202,8 @@ int QDialPrivate::valueFromPoint(const QPoint &p) const
|
||||
to draw every one, QDial will skip notches to try and draw a uniform
|
||||
set (e.g. by drawing every second or third notch).
|
||||
|
||||
Like the slider, the dial makes the QAbstractSlider functions
|
||||
setValue(), addLine(), subtractLine(), addPage() and
|
||||
subtractPage() available as slots.
|
||||
Like the slider, the dial makes the QAbstractSlider function setValue()
|
||||
available as a slot.
|
||||
|
||||
The dial's keyboard interface is fairly simple: The
|
||||
\uicontrol{left}/\uicontrol{up} and \uicontrol{right}/\uicontrol{down} arrow keys adjust
|
||||
|
@ -57,7 +57,7 @@ private Q_SLOTS:
|
||||
void api();
|
||||
void constVolatile();
|
||||
void exception();
|
||||
void threadedException();
|
||||
void catchExceptionAndRetry();
|
||||
void threadStressTest();
|
||||
void afterDestruction();
|
||||
};
|
||||
@ -163,7 +163,7 @@ void tst_QGlobalStatic::exception()
|
||||
|
||||
QBasicAtomicInt exceptionControlVar = Q_BASIC_ATOMIC_INITIALIZER(1);
|
||||
Q_GLOBAL_STATIC_WITH_ARGS(ThrowingType, exceptionGS, (exceptionControlVar))
|
||||
void tst_QGlobalStatic::threadedException()
|
||||
void tst_QGlobalStatic::catchExceptionAndRetry()
|
||||
{
|
||||
if (exceptionControlVar.load() != 1)
|
||||
QSKIP("This test cannot be run more than once");
|
||||
|
@ -470,21 +470,22 @@ void tst_QDir::removeRecursivelyFailure()
|
||||
#ifdef Q_OS_UNIX
|
||||
QFile dirAsFile(path); // yay, I have to use QFile to change a dir's permissions...
|
||||
QVERIFY(dirAsFile.setPermissions(QFile::Permissions(0))); // no permissions
|
||||
#else
|
||||
QVERIFY(file.setPermissions(QFile::ReadOwner));
|
||||
#endif
|
||||
|
||||
QVERIFY(!QDir().rmdir(path));
|
||||
QDir dir(path);
|
||||
QVERIFY(!dir.removeRecursively()); // didn't work
|
||||
QVERIFY(dir.exists()); // still exists
|
||||
|
||||
#ifdef Q_OS_UNIX
|
||||
QVERIFY(dirAsFile.setPermissions(QFile::Permissions(QFile::ReadOwner | QFile::WriteOwner | QFile::ExeOwner)));
|
||||
#else
|
||||
QVERIFY(file.setPermissions(QFile::ReadOwner | QFile::WriteOwner));
|
||||
#endif
|
||||
QVERIFY(dir.removeRecursively());
|
||||
QVERIFY(!dir.exists());
|
||||
#else // Q_OS_UNIX
|
||||
QVERIFY(file.setPermissions(QFile::ReadOwner));
|
||||
QVERIFY(!QDir().rmdir(path));
|
||||
QDir dir(path);
|
||||
QVERIFY(dir.removeRecursively());
|
||||
QVERIFY(!dir.exists());
|
||||
#endif // !Q_OS_UNIX
|
||||
}
|
||||
|
||||
void tst_QDir::removeRecursivelySymlink()
|
||||
|
@ -215,6 +215,8 @@ void tst_QTemporaryDir::autoRemove()
|
||||
QFile file(dirName + "/dir1/file");
|
||||
QVERIFY(file.open(QIODevice::WriteOnly));
|
||||
QCOMPARE(file.write("Hello"), 5LL);
|
||||
file.close();
|
||||
QVERIFY(file.setPermissions(QFile::ReadUser));
|
||||
}
|
||||
#ifdef Q_OS_WIN
|
||||
QTRY_VERIFY(!QDir(dirName).exists());
|
||||
|
@ -353,6 +353,7 @@ void tst_QTemporaryFile::removeAndReOpen()
|
||||
QVERIFY(!QFile::exists(fileName));
|
||||
|
||||
QVERIFY(file.open());
|
||||
QCOMPARE(QFileInfo(file.fileName()).path(), QFileInfo(fileName).path());
|
||||
fileName = file.fileName();
|
||||
QVERIFY(QFile::exists(fileName));
|
||||
}
|
||||
|
@ -54,6 +54,8 @@ private slots:
|
||||
void singleShotTimeout();
|
||||
void timeout();
|
||||
void remainingTime();
|
||||
void remainingTimeDuringActivation_data();
|
||||
void remainingTimeDuringActivation();
|
||||
void livelock_data();
|
||||
void livelock();
|
||||
void timerInfiniteRecursion_data();
|
||||
@ -79,14 +81,16 @@ class TimerHelper : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
TimerHelper() : QObject(), count(0)
|
||||
TimerHelper() : QObject(), count(0), remainingTime(-1)
|
||||
{
|
||||
}
|
||||
|
||||
int count;
|
||||
int remainingTime;
|
||||
|
||||
public slots:
|
||||
void timeout();
|
||||
void fetchRemainingTime();
|
||||
};
|
||||
|
||||
void TimerHelper::timeout()
|
||||
@ -94,6 +98,12 @@ void TimerHelper::timeout()
|
||||
++count;
|
||||
}
|
||||
|
||||
void TimerHelper::fetchRemainingTime()
|
||||
{
|
||||
QTimer *timer = static_cast<QTimer *>(sender());
|
||||
remainingTime = timer->remainingTime();
|
||||
}
|
||||
|
||||
void tst_QTimer::zeroTimer()
|
||||
{
|
||||
TimerHelper helper;
|
||||
@ -158,6 +168,53 @@ void tst_QTimer::remainingTime()
|
||||
|
||||
int remainingTime = timer.remainingTime();
|
||||
QVERIFY2(qAbs(remainingTime - 150) < 50, qPrintable(QString::number(remainingTime)));
|
||||
|
||||
// wait for the timer to actually fire now
|
||||
connect(&timer, SIGNAL(timeout()), &QTestEventLoop::instance(), SLOT(exitLoop()));
|
||||
QTestEventLoop::instance().enterLoop(5);
|
||||
QVERIFY(!QTestEventLoop::instance().timeout());
|
||||
QCOMPARE(helper.count, 1);
|
||||
|
||||
// the timer is still active, so it should have a non-zero remaining time
|
||||
remainingTime = timer.remainingTime();
|
||||
QVERIFY2(remainingTime > 150, qPrintable(QString::number(remainingTime)));
|
||||
}
|
||||
|
||||
void tst_QTimer::remainingTimeDuringActivation_data()
|
||||
{
|
||||
QTest::addColumn<bool>("singleShot");
|
||||
QTest::newRow("repeating") << true;
|
||||
QTest::newRow("single-shot") << true;
|
||||
}
|
||||
|
||||
void tst_QTimer::remainingTimeDuringActivation()
|
||||
{
|
||||
QFETCH(bool, singleShot);
|
||||
|
||||
TimerHelper helper;
|
||||
QTimer timer;
|
||||
|
||||
const int timeout = 20; // 20 ms is short enough and should not round down to 0 in any timer mode
|
||||
|
||||
connect(&timer, SIGNAL(timeout()), &helper, SLOT(fetchRemainingTime()));
|
||||
connect(&timer, SIGNAL(timeout()), &QTestEventLoop::instance(), SLOT(exitLoop()));
|
||||
timer.start(timeout);
|
||||
timer.setSingleShot(singleShot);
|
||||
|
||||
QTestEventLoop::instance().enterLoop(5);
|
||||
QVERIFY(!QTestEventLoop::instance().timeout());
|
||||
if (singleShot)
|
||||
QCOMPARE(helper.remainingTime, -1); // timer not running
|
||||
else
|
||||
QCOMPARE(helper.remainingTime, timeout);
|
||||
|
||||
if (!singleShot) {
|
||||
// do it again - see QTBUG-46940
|
||||
helper.remainingTime = -1;
|
||||
QTestEventLoop::instance().enterLoop(5);
|
||||
QVERIFY(!QTestEventLoop::instance().timeout());
|
||||
QCOMPARE(helper.remainingTime, timeout);
|
||||
}
|
||||
}
|
||||
|
||||
void tst_QTimer::livelock_data()
|
||||
|
@ -56,6 +56,7 @@ private slots:
|
||||
void indexOf();
|
||||
void lastIndexOf();
|
||||
void contains();
|
||||
void clear();
|
||||
void initializeListInt();
|
||||
void initializeListMovable();
|
||||
void initializeListComplex();
|
||||
@ -812,6 +813,21 @@ void tst_QVarLengthArray::contains()
|
||||
QVERIFY(myvec.contains(QLatin1String("I don't exist")));
|
||||
}
|
||||
|
||||
void tst_QVarLengthArray::clear()
|
||||
{
|
||||
QVarLengthArray<QString, 5> myvec;
|
||||
|
||||
for (int i = 0; i < 10; ++i)
|
||||
myvec << "aaa";
|
||||
|
||||
QCOMPARE(myvec.size(), 10);
|
||||
QVERIFY(myvec.capacity() >= myvec.size());
|
||||
const int oldCapacity = myvec.capacity();
|
||||
myvec.clear();
|
||||
QCOMPARE(myvec.size(), 0);
|
||||
QCOMPARE(myvec.capacity(), oldCapacity);
|
||||
}
|
||||
|
||||
void tst_QVarLengthArray::initializeListInt()
|
||||
{
|
||||
initializeList<int>();
|
||||
|
@ -170,7 +170,10 @@ public:
|
||||
}
|
||||
|
||||
QRectF boundingRect() const Q_DECL_OVERRIDE { return QRectF(0, 0, 10, 10); }
|
||||
void paint(QPainter *, const QStyleOptionGraphicsItem *, QWidget *) Q_DECL_OVERRIDE { }
|
||||
void paint(QPainter *painter, const QStyleOptionGraphicsItem *, QWidget *) Q_DECL_OVERRIDE
|
||||
{
|
||||
painter->fillRect(QRectF(QPointF(0, 0), boundingRect().size()), Qt::yellow);
|
||||
}
|
||||
|
||||
bool sceneEvent(QEvent *event) Q_DECL_OVERRIDE
|
||||
{
|
||||
@ -1446,6 +1449,7 @@ void tst_QTouchEvent::touchBeginWithGraphicsWidget()
|
||||
{
|
||||
QGraphicsScene scene;
|
||||
QGraphicsView view(&scene);
|
||||
view.setWindowTitle(QTest::currentTestFunction());
|
||||
QScopedPointer<tst_QTouchEventGraphicsItem> root(new tst_QTouchEventGraphicsItem);
|
||||
root->setAcceptTouchEvents(true);
|
||||
scene.addItem(root.data());
|
||||
@ -1454,10 +1458,13 @@ void tst_QTouchEvent::touchBeginWithGraphicsWidget()
|
||||
glassWidget->setMinimumSize(100, 100);
|
||||
scene.addItem(glassWidget.data());
|
||||
|
||||
view.resize(200, 200);
|
||||
view.setAlignment(Qt::AlignLeft | Qt::AlignTop);
|
||||
const QRect availableGeometry = QGuiApplication::primaryScreen()->availableGeometry();
|
||||
view.resize(availableGeometry.size() - QSize(100, 100));
|
||||
view.move(availableGeometry.topLeft() + QPoint(50, 50));
|
||||
view.fitInView(scene.sceneRect());
|
||||
view.show();
|
||||
QVERIFY(QTest::qWaitForWindowExposed(&view));
|
||||
view.fitInView(scene.sceneRect());
|
||||
|
||||
QTest::touchEvent(&view, touchScreenDevice)
|
||||
.press(0, view.mapFromScene(root->mapToScene(3,3)), view.viewport());
|
||||
|
@ -306,6 +306,7 @@ void tst_QListView::init()
|
||||
|
||||
void tst_QListView::cleanup()
|
||||
{
|
||||
QVERIFY(QApplication::topLevelWidgets().isEmpty());
|
||||
}
|
||||
|
||||
|
||||
@ -791,14 +792,31 @@ void tst_QListView::hideFirstRow()
|
||||
QTest::qWait(10);
|
||||
}
|
||||
|
||||
static int modelIndexCount(const QAbstractItemView *view)
|
||||
{
|
||||
QBitArray ba;
|
||||
for (int y = 0, height = view->height(); y < height; ++y) {
|
||||
const QModelIndex idx = view->indexAt( QPoint(1, y) );
|
||||
if (!idx.isValid())
|
||||
break;
|
||||
if (idx.row() >= ba.size())
|
||||
ba.resize(idx.row() + 1);
|
||||
ba.setBit(idx.row(), true);
|
||||
}
|
||||
return ba.size();
|
||||
}
|
||||
|
||||
void tst_QListView::batchedMode()
|
||||
{
|
||||
const int rowCount = 3;
|
||||
|
||||
QStringList items;
|
||||
for (int i=0; i <3; ++i)
|
||||
items << "item";
|
||||
for (int i = 0; i < rowCount; ++i)
|
||||
items << QLatin1String("item ") + QString::number(i);
|
||||
QStringListModel model(items);
|
||||
|
||||
QListView view;
|
||||
view.setWindowTitle(QTest::currentTestFunction());
|
||||
view.setModel(&model);
|
||||
view.setUniformItemSizes(true);
|
||||
view.setViewMode(QListView::ListMode);
|
||||
@ -807,22 +825,8 @@ void tst_QListView::batchedMode()
|
||||
view.resize(200,400);
|
||||
view.show();
|
||||
QVERIFY(QTest::qWaitForWindowExposed(&view));
|
||||
QTest::qWait(100);
|
||||
|
||||
#if defined(Q_OS_WINCE)
|
||||
QTest::qWait(2000);
|
||||
#endif
|
||||
QBitArray ba;
|
||||
for (int y = 0; y < view.height(); ++y) {
|
||||
QModelIndex idx = view.indexAt( QPoint(1, y) );
|
||||
if (!idx.isValid())
|
||||
break;
|
||||
if (idx.row() >= ba.size())
|
||||
ba.resize(idx.row() + 1);
|
||||
ba.setBit(idx.row(), true);
|
||||
}
|
||||
QCOMPARE(ba.size(), 3);
|
||||
|
||||
QTRY_COMPARE(modelIndexCount(&view), rowCount);
|
||||
|
||||
// Test the dynamic listview too.
|
||||
view.setViewMode(QListView::IconMode);
|
||||
@ -830,22 +834,7 @@ void tst_QListView::batchedMode()
|
||||
view.setFlow(QListView::TopToBottom);
|
||||
view.setBatchSize(2);
|
||||
|
||||
#if !defined(Q_OS_WINCE)
|
||||
QTest::qWait(100);
|
||||
#else
|
||||
QTest::qWait(2000);
|
||||
#endif
|
||||
|
||||
ba.clear();
|
||||
for (int y = 0; y < view.height(); ++y) {
|
||||
QModelIndex idx = view.indexAt( QPoint(1, y) );
|
||||
if (!idx.isValid())
|
||||
break;
|
||||
if (idx.row() >= ba.size())
|
||||
ba.resize(idx.row() + 1);
|
||||
ba.setBit(idx.row(), true);
|
||||
}
|
||||
QCOMPARE(ba.size(), 3);
|
||||
QTRY_COMPARE(modelIndexCount(&view), rowCount);
|
||||
}
|
||||
|
||||
void tst_QListView::setCurrentIndex()
|
||||
|
@ -69,6 +69,7 @@ private slots:
|
||||
void task200823_tooltip();
|
||||
void task229128TriggeredSignalWithoutActiongroup();
|
||||
void task229128TriggeredSignalWhenInActiongroup();
|
||||
void repeat();
|
||||
|
||||
private:
|
||||
int m_lastEventType;
|
||||
@ -380,5 +381,42 @@ void tst_QAction::task229128TriggeredSignalWhenInActiongroup()
|
||||
QCOMPARE(actionSpy.count(), 1);
|
||||
}
|
||||
|
||||
void tst_QAction::repeat()
|
||||
{
|
||||
QWidget *wid = m_tstWidget;
|
||||
QAction act(wid);
|
||||
wid->addAction(&act);
|
||||
act.setShortcut(QKeySequence(Qt::Key_F));
|
||||
QSignalSpy spy(&act, SIGNAL(triggered()));
|
||||
|
||||
act.setAutoRepeat(true);
|
||||
QTest::keyPress(wid, Qt::Key_F);
|
||||
QTest::keyRelease(wid, Qt::Key_F);
|
||||
QCOMPARE(spy.count(), 1);
|
||||
|
||||
spy.clear();
|
||||
QTest::keyPress(wid, Qt::Key_F);
|
||||
// repeat event
|
||||
QTest::simulateEvent(wid, true, Qt::Key_F, Qt::NoModifier, QString("f"), true);
|
||||
QTest::simulateEvent(wid, true, Qt::Key_F, Qt::NoModifier, QString("f"), true);
|
||||
QTest::keyRelease(wid, Qt::Key_F);
|
||||
QCOMPARE(spy.count(), 3);
|
||||
|
||||
spy.clear();
|
||||
act.setAutoRepeat(false);
|
||||
QTest::keyPress(wid, Qt::Key_F);
|
||||
QTest::simulateEvent(wid, true, Qt::Key_F, Qt::NoModifier, QString("f"), true);
|
||||
QTest::simulateEvent(wid, true, Qt::Key_F, Qt::NoModifier, QString("f"), true);
|
||||
QTest::keyRelease(wid, Qt::Key_F);
|
||||
QCOMPARE(spy.count(), 1);
|
||||
|
||||
spy.clear();
|
||||
act.setAutoRepeat(true);
|
||||
QTest::keyPress(wid, Qt::Key_F);
|
||||
QTest::simulateEvent(wid, true, Qt::Key_F, Qt::NoModifier, QString("f"), true);
|
||||
QTest::keyRelease(wid, Qt::Key_F);
|
||||
QCOMPARE(spy.count(), 2);
|
||||
}
|
||||
|
||||
QTEST_MAIN(tst_QAction)
|
||||
#include "tst_qaction.moc"
|
||||
|
@ -2088,11 +2088,12 @@ void tst_QApplication::touchEventPropagation()
|
||||
window.resize(200, 200);
|
||||
window.setObjectName("2. window");
|
||||
TouchEventPropagationTestWidget widget(&window);
|
||||
widget.resize(200, 200);
|
||||
widget.setObjectName("2. widget");
|
||||
window.show();
|
||||
QVERIFY(QTest::qWaitForWindowExposed(&window));
|
||||
pressedTouchPoints[0].setScreenPos(window.mapToGlobal(QPoint(0, 0)));
|
||||
releasedTouchPoints[0].setScreenPos(window.mapToGlobal(QPoint(0, 0)));
|
||||
pressedTouchPoints[0].setScreenPos(window.mapToGlobal(QPoint(50, 50)));
|
||||
releasedTouchPoints[0].setScreenPos(window.mapToGlobal(QPoint(50, 50)));
|
||||
|
||||
QWindowSystemInterface::handleTouchEvent(window.windowHandle(),
|
||||
0,
|
||||
@ -2102,9 +2103,8 @@ void tst_QApplication::touchEventPropagation()
|
||||
0,
|
||||
device,
|
||||
touchPointList(releasedTouchPoints));
|
||||
QCoreApplication::processEvents();
|
||||
QTRY_VERIFY(widget.seenMouseEvent);
|
||||
QVERIFY(!widget.seenTouchEvent);
|
||||
QVERIFY(widget.seenMouseEvent);
|
||||
QVERIFY(!window.seenTouchEvent);
|
||||
QVERIFY(window.seenMouseEvent);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user