Merge remote-tracking branch 'origin/5.4' into dev
Conflicts: src/corelib/global/qglobal.h src/platformsupport/platformcompositor/qopenglcompositor.cpp src/platformsupport/platformcompositor/qopenglcompositorbackingstore.cpp tests/auto/gui/kernel/qwindow/tst_qwindow.cpp Change-Id: I5422868500be695584a496dbbbc719d146bc572d
This commit is contained in:
commit
e281537f20
@ -29,7 +29,7 @@
|
||||
\title Qt Homepage
|
||||
*/
|
||||
/*!
|
||||
\externalpage http://bugreports.qt-project.org
|
||||
\externalpage http://bugreports.qt.io
|
||||
\title Qt Bug Tracker
|
||||
*/
|
||||
/*!
|
||||
|
@ -117,7 +117,7 @@ HTML.postheader = \
|
||||
" <li><a href=\"http://qt-project.org/wiki\">Wiki</a></li>\n" \
|
||||
" <li><a href=\"http://doc.qt.io/\" class=\"active\">Documentation</a></li>\n" \
|
||||
" <li><a href=\"http://qt-project.org/forums\">Forum</a></li>\n" \
|
||||
" <li><a href=\"https://bugreports.qt-project.org/\">Bug Reports</a></li>\n" \
|
||||
" <li><a href=\"https://bugreports.qt.io/\">Bug Reports</a></li>\n" \
|
||||
" <li><a href=\"https://codereview.qt-project.org/\">Code Review</a></li>\n" \
|
||||
" </ul>\n" \
|
||||
" <div id=\"main_title_bar\">\n" \
|
||||
|
@ -298,7 +298,7 @@ entered (localStorage), but credit-card data s/b absent
|
||||
<div id="feedcloseX" class="feedclose t_button">X</div>
|
||||
<form id="feedform" action="http://doc.qt.nokia.com/docFeedbck/feedback.php" method="get">
|
||||
<p id="noteHead">Thank you for giving your feedback.</p> <p class="note">Make sure it is related to this specific page. For more general bugs and
|
||||
requests, please use the <a href="http://bugreports.qt-project.org/secure/Dashboard.jspa">Qt Bug Tracker</a>.</p>
|
||||
requests, please use the <a href="http://bugreports.qt.io/secure/Dashboard.jspa">Qt Bug Tracker</a>.</p>
|
||||
<p><textarea id="feedbox" name="feedText" rows="5" cols="40"></textarea></p>
|
||||
<p><input id="feedsubmit" class="feedclose" type="submit" name="feedback" /></p>
|
||||
</form>
|
||||
|
@ -1019,7 +1019,7 @@
|
||||
on the directory they reside. This is turned on by default.
|
||||
\row \li embed_manifest_dll \li Embeds a manifest file in the DLL created
|
||||
as part of a library project.
|
||||
\row \li embed_manifest_exe \li Embeds a manifest file in the DLL created
|
||||
\row \li embed_manifest_exe \li Embeds a manifest file in the EXE created
|
||||
as part of an application project.
|
||||
\endtable
|
||||
|
||||
|
2
src/3rdparty/angle/src/common/utilities.cpp
vendored
2
src/3rdparty/angle/src/common/utilities.cpp
vendored
@ -486,7 +486,7 @@ void writeFile(const char* path, const void* content, size_t size)
|
||||
}
|
||||
#endif // !ANGLE_ENABLE_WINDOWS_STORE
|
||||
|
||||
#if defined(ANGLE_ENABLE_WINDOWS_STORE)
|
||||
#if defined(ANGLE_ENABLE_WINDOWS_STORE) && _MSC_FULL_VER < 180031101
|
||||
|
||||
void Sleep(unsigned long dwMilliseconds)
|
||||
{
|
||||
|
2
src/3rdparty/angle/src/common/utilities.h
vendored
2
src/3rdparty/angle/src/common/utilities.h
vendored
@ -51,7 +51,7 @@ std::string getTempPath();
|
||||
void writeFile(const char* path, const void* data, size_t size);
|
||||
#endif
|
||||
|
||||
#if defined(ANGLE_ENABLE_WINDOWS_STORE)
|
||||
#if defined(ANGLE_ENABLE_WINDOWS_STORE) && _MSC_FULL_VER < 180031101
|
||||
void Sleep(_In_ unsigned long dwMilliseconds);
|
||||
#endif
|
||||
|
||||
|
2
src/3rdparty/angle/src/libGLESv2/Shader.cpp
vendored
2
src/3rdparty/angle/src/libGLESv2/Shader.cpp
vendored
@ -53,7 +53,7 @@ void Shader::setSource(GLsizei count, const char *const *string, const GLint *le
|
||||
{
|
||||
if (length == nullptr || length[i] < 0)
|
||||
{
|
||||
stream.write(string[i], std::strlen(string[i]));
|
||||
stream.write(string[i], strlen(string[i]));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -292,7 +292,7 @@ public class QtActivityDelegate
|
||||
}
|
||||
} else if ((inputHints & ImhHiddenText) != 0) {
|
||||
inputType |= android.text.InputType.TYPE_TEXT_VARIATION_PASSWORD;
|
||||
} else if ((inputHints & ImhSensitiveData) != 0) {
|
||||
} else if ((inputHints & ImhSensitiveData) != 0 || (inputHints & ImhNoPredictiveText) != 0) {
|
||||
inputType |= android.text.InputType.TYPE_TEXT_VARIATION_VISIBLE_PASSWORD;
|
||||
}
|
||||
|
||||
|
@ -1,14 +1,20 @@
|
||||
buildscript {
|
||||
repositories {
|
||||
mavenCentral()
|
||||
jcenter()
|
||||
}
|
||||
|
||||
dependencies {
|
||||
classpath 'com.android.tools.build:gradle:0.12.1'
|
||||
classpath 'com.android.tools.build:gradle:1.0.0'
|
||||
}
|
||||
}
|
||||
|
||||
apply plugin: 'android'
|
||||
allprojects {
|
||||
repositories {
|
||||
jcenter()
|
||||
}
|
||||
}
|
||||
|
||||
apply plugin: 'com.android.application'
|
||||
|
||||
dependencies {
|
||||
compile fileTree(dir: 'libs', include: ['*.jar'])
|
||||
|
30
src/angle/patches/0020-ANGLE-Do-not-use-std-strlen.patch
Normal file
30
src/angle/patches/0020-ANGLE-Do-not-use-std-strlen.patch
Normal file
@ -0,0 +1,30 @@
|
||||
From 071b8936386b0b44475c91511d85479e5c633bc5 Mon Sep 17 00:00:00 2001
|
||||
From: Kai Koehne <kai.koehne@theqtcompany.com>
|
||||
Date: Thu, 11 Dec 2014 13:54:23 +0100
|
||||
Subject: [PATCH] ANGLE: Do not use std::strlen
|
||||
|
||||
This is a cherry-pick from upstream change
|
||||
|
||||
e7cfb3dd2029c1bfe5c175ad994c03cac221ad4d
|
||||
|
||||
Change-Id: Iefe01545319f9ad268c0c6bf8e8b2181e09d8a84
|
||||
---
|
||||
src/3rdparty/angle/src/libGLESv2/Shader.cpp | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/src/3rdparty/angle/src/libGLESv2/Shader.cpp b/src/3rdparty/angle/src/libGLESv2/Shader.cpp
|
||||
index 5bca746..024ef8f 100644
|
||||
--- a/src/3rdparty/angle/src/libGLESv2/Shader.cpp
|
||||
+++ b/src/3rdparty/angle/src/libGLESv2/Shader.cpp
|
||||
@@ -53,7 +53,7 @@ void Shader::setSource(GLsizei count, const char *const *string, const GLint *le
|
||||
{
|
||||
if (length == nullptr || length[i] < 0)
|
||||
{
|
||||
- stream.write(string[i], std::strlen(string[i]));
|
||||
+ stream.write(string[i], strlen(string[i]));
|
||||
}
|
||||
else
|
||||
{
|
||||
--
|
||||
1.9.4.msysgit.0
|
||||
|
@ -0,0 +1,43 @@
|
||||
From a48dfb3f1ecb57a59084c0e87155506586b73188 Mon Sep 17 00:00:00 2001
|
||||
From: Maurice Kalinowski <maurice.kalinowski@theqtcompany.com>
|
||||
Date: Thu, 11 Dec 2014 13:11:55 +0100
|
||||
Subject: [PATCH] [ANGLE] Fix compilation with MSVC2013 Update4
|
||||
|
||||
Update4 provides a native Sleep implementation. Hence the wrapper
|
||||
needs to be disabled.
|
||||
|
||||
Change-Id: I162da45934b02c262ac09b557c66c3363c276e54
|
||||
---
|
||||
src/3rdparty/angle/src/common/utilities.cpp | 2 +-
|
||||
src/3rdparty/angle/src/common/utilities.h | 2 +-
|
||||
2 files changed, 2 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/src/3rdparty/angle/src/common/utilities.cpp b/src/3rdparty/angle/src/common/utilities.cpp
|
||||
index 9d797a6..924573e 100644
|
||||
--- a/src/3rdparty/angle/src/common/utilities.cpp
|
||||
+++ b/src/3rdparty/angle/src/common/utilities.cpp
|
||||
@@ -486,7 +486,7 @@ void writeFile(const char* path, const void* content, size_t size)
|
||||
}
|
||||
#endif // !ANGLE_ENABLE_WINDOWS_STORE
|
||||
|
||||
-#if defined(ANGLE_ENABLE_WINDOWS_STORE)
|
||||
+#if defined(ANGLE_ENABLE_WINDOWS_STORE) && _MSC_FULL_VER < 180031101
|
||||
|
||||
void Sleep(unsigned long dwMilliseconds)
|
||||
{
|
||||
diff --git a/src/3rdparty/angle/src/common/utilities.h b/src/3rdparty/angle/src/common/utilities.h
|
||||
index 2cf6bed..7583d3e 100644
|
||||
--- a/src/3rdparty/angle/src/common/utilities.h
|
||||
+++ b/src/3rdparty/angle/src/common/utilities.h
|
||||
@@ -51,7 +51,7 @@ std::string getTempPath();
|
||||
void writeFile(const char* path, const void* data, size_t size);
|
||||
#endif
|
||||
|
||||
-#if defined(ANGLE_ENABLE_WINDOWS_STORE)
|
||||
+#if defined(ANGLE_ENABLE_WINDOWS_STORE) && _MSC_FULL_VER < 180031101
|
||||
void Sleep(_In_ unsigned long dwMilliseconds);
|
||||
#endif
|
||||
|
||||
--
|
||||
1.9.4.msysgit.2
|
||||
|
@ -97,7 +97,10 @@
|
||||
of the property changes.
|
||||
\c NOTIFY signals for \c MEMBER variables must take zero or one parameter,
|
||||
which must be of the same type as the property. The parameter will take the
|
||||
new value of the property.
|
||||
new value of the property. The \c NOTIFY signal should only be emitted when
|
||||
the property has really been changed, to avoid bindings being unnecessarily
|
||||
re-evaluated in QML, for example. Qt emits automatically that signal when
|
||||
needed for MEMBER properties that do not have an explicit setter.
|
||||
|
||||
\li A \c REVISION number is optional. If included, it defines
|
||||
the property and its notifier signal to be used in a particular
|
||||
|
@ -154,17 +154,17 @@
|
||||
/* Clang also masquerades as GCC */
|
||||
# if defined(__apple_build_version__)
|
||||
# /* http://en.wikipedia.org/wiki/Xcode#Toolchain_Versions */
|
||||
# if __apple_build_version__ >= 600051
|
||||
# if __apple_build_version__ >= 6000051
|
||||
# define Q_CC_CLANG 305
|
||||
# elif __apple_build_version__ >= 503038
|
||||
# elif __apple_build_version__ >= 5030038
|
||||
# define Q_CC_CLANG 304
|
||||
# elif __apple_build_version__ >= 500275
|
||||
# elif __apple_build_version__ >= 5000275
|
||||
# define Q_CC_CLANG 303
|
||||
# elif __apple_build_version__ >= 425024
|
||||
# elif __apple_build_version__ >= 4250024
|
||||
# define Q_CC_CLANG 302
|
||||
# elif __apple_build_version__ >= 318045
|
||||
# elif __apple_build_version__ >= 3180045
|
||||
# define Q_CC_CLANG 301
|
||||
# elif __apple_build_version__ >= 211101
|
||||
# elif __apple_build_version__ >= 2111001
|
||||
# define Q_CC_CLANG 300
|
||||
# else
|
||||
# error "Unknown Apple Clang version"
|
||||
|
@ -1286,8 +1286,8 @@ static void android_default_message_handler(QtMsgType type,
|
||||
case QtFatalMsg: priority = ANDROID_LOG_FATAL; break;
|
||||
};
|
||||
|
||||
__android_log_print(priority, "Qt", "%s:%d (%s): %s\n",
|
||||
context.file, context.line,
|
||||
__android_log_print(priority, qPrintable(QCoreApplication::applicationName()),
|
||||
"%s:%d (%s): %s\n", context.file, context.line,
|
||||
context.function, qPrintable(message));
|
||||
}
|
||||
#endif //Q_OS_ANDROID
|
||||
|
@ -2612,7 +2612,7 @@
|
||||
\value ElideNone Ellipsis should NOT appear in the text.
|
||||
|
||||
Qt::ElideMiddle is normally the most appropriate choice for URLs (e.g.,
|
||||
"\l{http://bugreports.qt-project.org/browse/QTWEBSITE-13}{http://bugreports.qt.../QTWEBSITE-13/}"),
|
||||
"\l{http://bugreports.qt.io/browse/QTWEBSITE-13}{http://bugreports.qt.../QTWEBSITE-13/}"),
|
||||
whereas Qt::ElideRight is appropriate
|
||||
for other strings (e.g.,
|
||||
"\l{http://doc.qt.digia.com/qq/qq09-mac-deployment.html}{Deploying Applications on Ma...}").
|
||||
|
@ -331,11 +331,13 @@ bool QCommandLineParser::addOption(const QCommandLineOption &option)
|
||||
/*!
|
||||
\since 5.4
|
||||
|
||||
Adds the options \a options to look for while parsing.
|
||||
Adds the options to look for while parsing. The options are specified by
|
||||
the parameter \a options.
|
||||
|
||||
Returns \c false if adding any of the options failed; otherwise returns \c false.
|
||||
Returns \c true if adding all of the options was successful; otherwise
|
||||
returns \c false.
|
||||
|
||||
Cf. addOption() for when it may fail.
|
||||
See the documentation for addOption() for when this function may fail.
|
||||
*/
|
||||
bool QCommandLineParser::addOptions(const QList<QCommandLineOption> &options)
|
||||
{
|
||||
|
@ -502,7 +502,7 @@ QVariant QSystemLocale::query(QueryType type, QVariant in = QVariant()) const
|
||||
} else if (typeId == CFStringGetTypeID()) {
|
||||
result = QStringList(QCFString::toQString(languages.as<CFStringRef>()));
|
||||
} else {
|
||||
qWarning("QLocale::uiLanguages(): CFPreferencesCopyValue returned unhandled type \"%s\"; please report to http://bugreports.qt-project.org",
|
||||
qWarning("QLocale::uiLanguages(): CFPreferencesCopyValue returned unhandled type \"%s\"; please report to http://bugreports.qt.io",
|
||||
qPrintable(QCFString::toQString(CFCopyTypeIDDescription(typeId))));
|
||||
}
|
||||
return QVariant(result);
|
||||
|
@ -4511,7 +4511,6 @@ QImage QImage::transformed(const QTransform &matrix, Qt::TransformationMode mode
|
||||
|
||||
dImage.d->dpmx = dotsPerMeterX();
|
||||
dImage.d->dpmy = dotsPerMeterY();
|
||||
dImage.d->devicePixelRatio = devicePixelRatio();
|
||||
|
||||
// initizialize the data
|
||||
if (d->format == QImage::Format_Indexed8) {
|
||||
@ -4526,13 +4525,19 @@ QImage QImage::transformed(const QTransform &matrix, Qt::TransformationMode mode
|
||||
memset(dImage.bits(), 0x00, dImage.byteCount());
|
||||
|
||||
if (target_format >= QImage::Format_RGB32) {
|
||||
// Prevent QPainter from applying devicePixelRatio corrections
|
||||
const QImage sImage = (devicePixelRatio() != 1) ? QImage(constBits(), width(), height(), format()) : *this;
|
||||
|
||||
Q_ASSERT(sImage.devicePixelRatio() == 1);
|
||||
Q_ASSERT(sImage.devicePixelRatio() == dImage.devicePixelRatio());
|
||||
|
||||
QPainter p(&dImage);
|
||||
if (mode == Qt::SmoothTransformation) {
|
||||
p.setRenderHint(QPainter::Antialiasing);
|
||||
p.setRenderHint(QPainter::SmoothPixmapTransform);
|
||||
}
|
||||
p.setTransform(mat);
|
||||
p.drawImage(QPoint(0, 0), *this);
|
||||
p.drawImage(QPoint(0, 0), sImage);
|
||||
} else {
|
||||
bool invertible;
|
||||
mat = mat.inverted(&invertible); // invert matrix
|
||||
@ -4544,6 +4549,8 @@ QImage QImage::transformed(const QTransform &matrix, Qt::TransformationMode mode
|
||||
int dbpl = dImage.bytesPerLine();
|
||||
qt_xForm_helper(mat, 0, type, bpp, dImage.bits(), dbpl, 0, hd, sptr, sbpl, ws, hs);
|
||||
}
|
||||
|
||||
dImage.d->devicePixelRatio = devicePixelRatio();
|
||||
return dImage;
|
||||
}
|
||||
|
||||
|
@ -1114,9 +1114,9 @@ void QOpenGLContext::deleteQGLContext()
|
||||
void *QOpenGLContext::openGLModuleHandle()
|
||||
{
|
||||
#ifdef QT_OPENGL_DYNAMIC
|
||||
QGuiApplication *app = qGuiApp;
|
||||
Q_ASSERT(app);
|
||||
return app->platformNativeInterface()->nativeResourceForIntegration(QByteArrayLiteral("glhandle"));
|
||||
QPlatformNativeInterface *ni = QGuiApplication::platformNativeInterface();
|
||||
Q_ASSERT(ni);
|
||||
return ni->nativeResourceForIntegration(QByteArrayLiteral("glhandle"));
|
||||
#else
|
||||
return 0;
|
||||
#endif
|
||||
|
@ -107,29 +107,6 @@ QOpenGL2PaintEngineExPrivate::~QOpenGL2PaintEngineExPrivate()
|
||||
}
|
||||
}
|
||||
|
||||
void QOpenGL2PaintEngineExPrivate::updateTextureFilter(GLenum wrapMode, bool smoothPixmapTransform, GLuint id)
|
||||
{
|
||||
// funcs.glActiveTexture(GL_TEXTURE0 + QT_BRUSH_TEXTURE_UNIT); //### Is it always this texture unit?
|
||||
if (id != GLuint(-1) && id == lastTextureUsed)
|
||||
return;
|
||||
|
||||
lastTextureUsed = id;
|
||||
|
||||
static const GLenum target = GL_TEXTURE_2D;
|
||||
|
||||
if (smoothPixmapTransform) {
|
||||
funcs.glTexParameteri(target, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
|
||||
funcs.glTexParameteri(target, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
|
||||
} else {
|
||||
funcs.glTexParameteri(target, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
|
||||
funcs.glTexParameteri(target, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
|
||||
}
|
||||
|
||||
funcs.glTexParameteri(target, GL_TEXTURE_WRAP_S, wrapMode);
|
||||
funcs.glTexParameteri(target, GL_TEXTURE_WRAP_T, wrapMode);
|
||||
}
|
||||
|
||||
|
||||
inline QColor qt_premultiplyColor(QColor c, GLfloat opacity)
|
||||
{
|
||||
qreal alpha = c.alphaF() * opacity;
|
||||
@ -176,38 +153,129 @@ void QOpenGL2PaintEngineExPrivate::useSimpleShader()
|
||||
updateMatrix();
|
||||
}
|
||||
|
||||
/*
|
||||
Single entry-point for activating, binding, and setting properties.
|
||||
|
||||
Allows keeping track of (caching) the latest texture unit and bound
|
||||
texture in a central place, so that we can skip re-binding unless
|
||||
needed.
|
||||
|
||||
\note Any code or Qt API that internally activates or binds will
|
||||
not affect the cache used by this function, which means they will
|
||||
lead to inconsisent state. QPainter::beginNativePainting() takes
|
||||
care of resetting the cache, so for user–code this is fine, but
|
||||
internally in the paint engine care must be taken to not call
|
||||
functions that may activate or bind under our feet.
|
||||
*/
|
||||
template<typename T>
|
||||
void QOpenGL2PaintEngineExPrivate::updateTexture(GLenum textureUnit, const T &texture, GLenum wrapMode, GLenum filterMode, TextureUpdateMode updateMode)
|
||||
{
|
||||
static const GLenum target = GL_TEXTURE_2D;
|
||||
|
||||
activateTextureUnit(textureUnit);
|
||||
|
||||
GLuint textureId = bindTexture(texture);
|
||||
|
||||
if (updateMode == UpdateIfNeeded && textureId == lastTextureUsed)
|
||||
return;
|
||||
|
||||
lastTextureUsed = textureId;
|
||||
|
||||
funcs.glTexParameteri(target, GL_TEXTURE_WRAP_S, wrapMode);
|
||||
funcs.glTexParameteri(target, GL_TEXTURE_WRAP_T, wrapMode);
|
||||
|
||||
funcs.glTexParameteri(target, GL_TEXTURE_MAG_FILTER, filterMode);
|
||||
funcs.glTexParameteri(target, GL_TEXTURE_MIN_FILTER, filterMode);
|
||||
}
|
||||
|
||||
void QOpenGL2PaintEngineExPrivate::activateTextureUnit(GLenum textureUnit)
|
||||
{
|
||||
if (textureUnit != lastTextureUnitUsed) {
|
||||
funcs.glActiveTexture(GL_TEXTURE0 + textureUnit);
|
||||
lastTextureUnitUsed = textureUnit;
|
||||
|
||||
// We simplify things by keeping a single cached value of the last
|
||||
// texture that was bound, instead of one per texture unit. This
|
||||
// means that switching texture units could potentially mean we
|
||||
// need a re-bind and corresponding parameter updates.
|
||||
lastTextureUsed = GLuint(-1);
|
||||
}
|
||||
}
|
||||
|
||||
template<>
|
||||
GLuint QOpenGL2PaintEngineExPrivate::bindTexture(const GLuint &textureId)
|
||||
{
|
||||
if (textureId != lastTextureUsed)
|
||||
funcs.glBindTexture(GL_TEXTURE_2D, textureId);
|
||||
|
||||
return textureId;
|
||||
}
|
||||
|
||||
template<>
|
||||
GLuint QOpenGL2PaintEngineExPrivate::bindTexture(const QImage &image)
|
||||
{
|
||||
return QOpenGLTextureCache::cacheForContext(ctx)->bindTexture(ctx, image);
|
||||
}
|
||||
|
||||
template<>
|
||||
GLuint QOpenGL2PaintEngineExPrivate::bindTexture(const QPixmap &pixmap)
|
||||
{
|
||||
return QOpenGLTextureCache::cacheForContext(ctx)->bindTexture(ctx, pixmap);
|
||||
}
|
||||
|
||||
template<>
|
||||
GLuint QOpenGL2PaintEngineExPrivate::bindTexture(const QGradient &gradient)
|
||||
{
|
||||
// We apply global opacity in the fragment shaders, so we always pass 1.0
|
||||
// for opacity to the cache.
|
||||
GLuint textureId = QOpenGL2GradientCache::cacheForContext(ctx)->getBuffer(gradient, 1.0);
|
||||
|
||||
// QOpenGL2GradientCache::getBuffer() may bind and generate a new texture if it
|
||||
// hasn't been cached yet, but will otherwise return an unbound texture id. To
|
||||
// be sure that the texture is bound, we unfortunately have to bind again,
|
||||
// which results in the initial generation of the texture doing two binds.
|
||||
return bindTexture(textureId);
|
||||
}
|
||||
|
||||
struct ImageWithBindOptions
|
||||
{
|
||||
const QImage ℑ
|
||||
QOpenGLTextureCache::BindOptions options;
|
||||
};
|
||||
|
||||
template<>
|
||||
GLuint QOpenGL2PaintEngineExPrivate::bindTexture(const ImageWithBindOptions &imageWithOptions)
|
||||
{
|
||||
return QOpenGLTextureCache::cacheForContext(ctx)->bindTexture(ctx, imageWithOptions.image, imageWithOptions.options);
|
||||
}
|
||||
|
||||
void QOpenGL2PaintEngineExPrivate::updateBrushTexture()
|
||||
{
|
||||
Q_Q(QOpenGL2PaintEngineEx);
|
||||
// qDebug("QOpenGL2PaintEngineExPrivate::updateBrushTexture()");
|
||||
Qt::BrushStyle style = currentBrush.style();
|
||||
|
||||
bool smoothPixmapTransform = q->state()->renderHints & QPainter::SmoothPixmapTransform;
|
||||
GLenum filterMode = smoothPixmapTransform ? GL_LINEAR : GL_NEAREST;
|
||||
|
||||
if ( (style >= Qt::Dense1Pattern) && (style <= Qt::DiagCrossPattern) ) {
|
||||
// Get the image data for the pattern
|
||||
QImage texImage = qt_imageForBrush(style, false);
|
||||
QImage textureImage = qt_imageForBrush(style, false);
|
||||
|
||||
funcs.glActiveTexture(GL_TEXTURE0 + QT_BRUSH_TEXTURE_UNIT);
|
||||
QOpenGLTextureCache::cacheForContext(ctx)->bindTexture(ctx, texImage);
|
||||
updateTextureFilter(GL_REPEAT, q->state()->renderHints & QPainter::SmoothPixmapTransform);
|
||||
updateTexture(QT_BRUSH_TEXTURE_UNIT, textureImage, GL_REPEAT, filterMode, ForceUpdate);
|
||||
}
|
||||
else if (style >= Qt::LinearGradientPattern && style <= Qt::ConicalGradientPattern) {
|
||||
// Gradiant brush: All the gradiants use the same texture
|
||||
|
||||
const QGradient* g = currentBrush.gradient();
|
||||
|
||||
// We apply global opacity in the fragment shaders, so we always pass 1.0
|
||||
// for opacity to the cache.
|
||||
GLuint texId = QOpenGL2GradientCache::cacheForContext(ctx)->getBuffer(*g, 1.0);
|
||||
const QGradient *gradient = currentBrush.gradient();
|
||||
|
||||
GLenum wrapMode = GL_CLAMP_TO_EDGE;
|
||||
if (g->spread() == QGradient::RepeatSpread || g->type() == QGradient::ConicalGradient)
|
||||
if (gradient->spread() == QGradient::RepeatSpread || gradient->type() == QGradient::ConicalGradient)
|
||||
wrapMode = GL_REPEAT;
|
||||
else if (g->spread() == QGradient::ReflectSpread)
|
||||
else if (gradient->spread() == QGradient::ReflectSpread)
|
||||
wrapMode = GL_MIRRORED_REPEAT;
|
||||
|
||||
funcs.glActiveTexture(GL_TEXTURE0 + QT_BRUSH_TEXTURE_UNIT);
|
||||
funcs.glBindTexture(GL_TEXTURE_2D, texId);
|
||||
updateTextureFilter(wrapMode, q->state()->renderHints & QPainter::SmoothPixmapTransform);
|
||||
updateTexture(QT_BRUSH_TEXTURE_UNIT, *gradient, wrapMode, filterMode, ForceUpdate);
|
||||
}
|
||||
else if (style == Qt::TexturePattern) {
|
||||
currentBrushImage = currentBrush.textureImage();
|
||||
@ -224,9 +292,7 @@ void QOpenGL2PaintEngineExPrivate::updateBrushTexture()
|
||||
wrapMode = GL_CLAMP_TO_EDGE;
|
||||
}
|
||||
|
||||
funcs.glActiveTexture(GL_TEXTURE0 + QT_BRUSH_TEXTURE_UNIT);
|
||||
QOpenGLTextureCache::cacheForContext(ctx)->bindTexture(ctx, currentBrushImage);
|
||||
updateTextureFilter(wrapMode, q->state()->renderHints & QPainter::SmoothPixmapTransform);
|
||||
updateTexture(QT_BRUSH_TEXTURE_UNIT, currentBrushImage, wrapMode, filterMode, ForceUpdate);
|
||||
|
||||
textureInvertedY = false;
|
||||
}
|
||||
@ -569,10 +635,16 @@ void QOpenGL2PaintEngineEx::beginNativePainting()
|
||||
}
|
||||
#endif // QT_OPENGL_ES_2
|
||||
|
||||
d->lastTextureUsed = GLuint(-1);
|
||||
d->dirtyStencilRegion = QRect(0, 0, d->width, d->height);
|
||||
d->resetGLState();
|
||||
|
||||
// We don't know what texture units and textures the native painting
|
||||
// will activate and bind, so we can't assume anything when we return
|
||||
// from the native painting.
|
||||
d->lastTextureUnitUsed = QT_UNKNOWN_TEXTURE_UNIT;
|
||||
d->lastTextureUsed = GLuint(-1);
|
||||
|
||||
d->dirtyStencilRegion = QRect(0, 0, d->width, d->height);
|
||||
|
||||
d->shaderManager->setDirty();
|
||||
|
||||
d->needsSync = true;
|
||||
@ -580,8 +652,9 @@ void QOpenGL2PaintEngineEx::beginNativePainting()
|
||||
|
||||
void QOpenGL2PaintEngineExPrivate::resetGLState()
|
||||
{
|
||||
activateTextureUnit(QT_DEFAULT_TEXTURE_UNIT);
|
||||
|
||||
funcs.glDisable(GL_BLEND);
|
||||
funcs.glActiveTexture(GL_TEXTURE0);
|
||||
funcs.glDisable(GL_STENCIL_TEST);
|
||||
funcs.glDisable(GL_DEPTH_TEST);
|
||||
funcs.glDisable(GL_SCISSOR_TEST);
|
||||
@ -624,10 +697,6 @@ void QOpenGL2PaintEngineExPrivate::transferMode(EngineMode newMode)
|
||||
if (newMode == mode)
|
||||
return;
|
||||
|
||||
if (mode != BrushDrawingMode) {
|
||||
lastTextureUsed = GLuint(-1);
|
||||
}
|
||||
|
||||
if (newMode == TextDrawingMode) {
|
||||
shaderManager->setHasComplexGeometry(true);
|
||||
} else {
|
||||
@ -1340,7 +1409,12 @@ void QOpenGL2PaintEngineEx::renderHintsChanged()
|
||||
#endif // QT_OPENGL_ES_2
|
||||
|
||||
Q_D(QOpenGL2PaintEngineEx);
|
||||
|
||||
// This is a somewhat sneaky way of conceptually making the next call to
|
||||
// updateTexture() use FoceUpdate for the TextureUpdateMode. We need this
|
||||
// as new render hints may require updating the filter mode.
|
||||
d->lastTextureUsed = GLuint(-1);
|
||||
|
||||
d->brushTextureDirty = true;
|
||||
// qDebug("QOpenGL2PaintEngineEx::renderHintsChanged() not implemented!");
|
||||
}
|
||||
@ -1382,9 +1456,8 @@ void QOpenGL2PaintEngineEx::drawPixmap(const QRectF& dest, const QPixmap & pixma
|
||||
ensureActive();
|
||||
d->transferMode(ImageDrawingMode);
|
||||
|
||||
d->funcs.glActiveTexture(GL_TEXTURE0 + QT_IMAGE_TEXTURE_UNIT);
|
||||
GLuint id = QOpenGLTextureCache::cacheForContext(ctx)->bindTexture(ctx, pixmap);
|
||||
d->updateTextureFilter(GL_CLAMP_TO_EDGE, state()->renderHints & QPainter::SmoothPixmapTransform, id);
|
||||
GLenum filterMode = state()->renderHints & QPainter::SmoothPixmapTransform ? GL_LINEAR : GL_NEAREST;
|
||||
d->updateTexture(QT_IMAGE_TEXTURE_UNIT, pixmap, GL_CLAMP_TO_EDGE, filterMode);
|
||||
|
||||
bool isBitmap = pixmap.isQBitmap();
|
||||
bool isOpaque = !isBitmap && !pixmap.hasAlpha();
|
||||
@ -1442,9 +1515,9 @@ void QOpenGL2PaintEngineEx::drawImage(const QRectF& dest, const QImage& image, c
|
||||
break;
|
||||
}
|
||||
|
||||
d->funcs.glActiveTexture(GL_TEXTURE0 + QT_IMAGE_TEXTURE_UNIT);
|
||||
GLuint id = QOpenGLTextureCache::cacheForContext(ctx)->bindTexture(ctx, image, bindOption);
|
||||
d->updateTextureFilter(GL_CLAMP_TO_EDGE, state()->renderHints & QPainter::SmoothPixmapTransform, id);
|
||||
ImageWithBindOptions imageWithOptions = { image, bindOption };
|
||||
GLenum filterMode = state()->renderHints & QPainter::SmoothPixmapTransform ? GL_LINEAR : GL_NEAREST;
|
||||
d->updateTexture(QT_IMAGE_TEXTURE_UNIT, imageWithOptions, GL_CLAMP_TO_EDGE, filterMode);
|
||||
|
||||
d->drawTexture(dest, src, image.size(), !image.hasAlphaChannel());
|
||||
}
|
||||
@ -1485,9 +1558,8 @@ bool QOpenGL2PaintEngineEx::drawTexture(const QRectF &dest, GLuint textureId, co
|
||||
ensureActive();
|
||||
d->transferMode(ImageDrawingMode);
|
||||
|
||||
d->funcs.glActiveTexture(GL_TEXTURE0 + QT_IMAGE_TEXTURE_UNIT);
|
||||
d->funcs.glBindTexture(GL_TEXTURE_2D, textureId);
|
||||
d->updateTextureFilter(GL_CLAMP_TO_EDGE, state()->renderHints & QPainter::SmoothPixmapTransform, textureId);
|
||||
GLenum filterMode = state()->renderHints & QPainter::SmoothPixmapTransform ? GL_LINEAR : GL_NEAREST;
|
||||
d->updateTexture(QT_IMAGE_TEXTURE_UNIT, textureId, GL_CLAMP_TO_EDGE, filterMode);
|
||||
|
||||
d->shaderManager->setSrcPixelType(QOpenGLEngineShaderManager::ImageSrc);
|
||||
|
||||
@ -1651,7 +1723,25 @@ void QOpenGL2PaintEngineExPrivate::drawCachedGlyphs(QFontEngine::GlyphFormat gly
|
||||
cache->populate(fe, staticTextItem->numGlyphs,
|
||||
staticTextItem->glyphs, staticTextItem->glyphPositions);
|
||||
}
|
||||
cache->fillInPendingGlyphs();
|
||||
|
||||
if (cache->hasPendingGlyphs()) {
|
||||
// Filling in the glyphs binds and sets parameters, so we need to
|
||||
// ensure that the glyph cache doesn't mess with whatever unit
|
||||
// is currently active. Note that the glyph cache internally
|
||||
// uses the image texture unit for blitting to the cache, while
|
||||
// we switch between image and mask units when drawing.
|
||||
static const GLenum glypchCacheTextureUnit = QT_IMAGE_TEXTURE_UNIT;
|
||||
activateTextureUnit(glypchCacheTextureUnit);
|
||||
|
||||
cache->fillInPendingGlyphs();
|
||||
|
||||
// We assume the cache can be trusted on which texture was bound
|
||||
lastTextureUsed = cache->texture();
|
||||
|
||||
// But since the brush and image texture units are possibly shared
|
||||
// we may have to re-bind brush textures after filling in the cache.
|
||||
brushTextureDirty = (QT_BRUSH_TEXTURE_UNIT == glypchCacheTextureUnit);
|
||||
}
|
||||
}
|
||||
|
||||
if (cache->width() == 0 || cache->height() == 0)
|
||||
@ -1817,9 +1907,7 @@ void QOpenGL2PaintEngineExPrivate::drawCachedGlyphs(QFontEngine::GlyphFormat gly
|
||||
funcs.glEnable(GL_BLEND);
|
||||
funcs.glBlendFunc(GL_ZERO, GL_ONE_MINUS_SRC_COLOR);
|
||||
|
||||
funcs.glActiveTexture(GL_TEXTURE0 + QT_MASK_TEXTURE_UNIT);
|
||||
funcs.glBindTexture(GL_TEXTURE_2D, cache->texture());
|
||||
updateTextureFilter(GL_REPEAT, false);
|
||||
updateTexture(QT_MASK_TEXTURE_UNIT, cache->texture(), GL_REPEAT, GL_NEAREST, ForceUpdate);
|
||||
|
||||
#if defined(QT_OPENGL_DRAWCACHEDGLYPHS_INDEX_ARRAY_VBO)
|
||||
funcs.glDrawElements(GL_TRIANGLE_STRIP, 6 * numGlyphs, GL_UNSIGNED_SHORT, 0);
|
||||
@ -1854,31 +1942,23 @@ void QOpenGL2PaintEngineExPrivate::drawCachedGlyphs(QFontEngine::GlyphFormat gly
|
||||
prepareForCachedGlyphDraw(*cache);
|
||||
}
|
||||
|
||||
QOpenGLTextureGlyphCache::FilterMode filterMode = (s->matrix.type() > QTransform::TxTranslate)?QOpenGLTextureGlyphCache::Linear:QOpenGLTextureGlyphCache::Nearest;
|
||||
if (lastMaskTextureUsed != cache->texture() || cache->filterMode() != filterMode) {
|
||||
GLenum textureUnit = QT_MASK_TEXTURE_UNIT;
|
||||
if (glyphFormat == QFontEngine::Format_ARGB)
|
||||
textureUnit = QT_IMAGE_TEXTURE_UNIT;
|
||||
|
||||
if (glyphFormat == QFontEngine::Format_ARGB)
|
||||
funcs.glActiveTexture(GL_TEXTURE0 + QT_IMAGE_TEXTURE_UNIT);
|
||||
else
|
||||
funcs.glActiveTexture(GL_TEXTURE0 + QT_MASK_TEXTURE_UNIT);
|
||||
QOpenGLTextureGlyphCache::FilterMode filterMode = (s->matrix.type() > QTransform::TxTranslate) ?
|
||||
QOpenGLTextureGlyphCache::Linear : QOpenGLTextureGlyphCache::Nearest;
|
||||
|
||||
if (lastMaskTextureUsed != cache->texture()) {
|
||||
funcs.glBindTexture(GL_TEXTURE_2D, cache->texture());
|
||||
lastMaskTextureUsed = cache->texture();
|
||||
}
|
||||
GLenum glFilterMode = filterMode == QOpenGLTextureGlyphCache::Linear ? GL_LINEAR : GL_NEAREST;
|
||||
|
||||
if (cache->filterMode() != filterMode) {
|
||||
if (filterMode == QOpenGLTextureGlyphCache::Linear) {
|
||||
funcs.glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
|
||||
funcs.glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
|
||||
} else {
|
||||
funcs.glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
|
||||
funcs.glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
|
||||
}
|
||||
cache->setFilterMode(filterMode);
|
||||
}
|
||||
TextureUpdateMode updateMode = UpdateIfNeeded;
|
||||
if (cache->filterMode() != filterMode) {
|
||||
updateMode = ForceUpdate;
|
||||
cache->setFilterMode(filterMode);
|
||||
}
|
||||
|
||||
updateTexture(textureUnit, cache->texture(), GL_REPEAT, glFilterMode, updateMode);
|
||||
|
||||
#if defined(QT_OPENGL_DRAWCACHEDGLYPHS_INDEX_ARRAY_VBO)
|
||||
funcs.glDrawElements(GL_TRIANGLE_STRIP, 6 * numGlyphs, GL_UNSIGNED_SHORT, 0);
|
||||
funcs.glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0);
|
||||
@ -1964,9 +2044,8 @@ void QOpenGL2PaintEngineExPrivate::drawPixmapFragments(const QPainter::PixmapFra
|
||||
|
||||
transferMode(ImageOpacityArrayDrawingMode);
|
||||
|
||||
funcs.glActiveTexture(GL_TEXTURE0 + QT_IMAGE_TEXTURE_UNIT);
|
||||
GLuint id = QOpenGLTextureCache::cacheForContext(ctx)->bindTexture(ctx, pixmap);
|
||||
updateTextureFilter(GL_CLAMP_TO_EDGE, q->state()->renderHints & QPainter::SmoothPixmapTransform, id);
|
||||
GLenum filterMode = q->state()->renderHints & QPainter::SmoothPixmapTransform ? GL_LINEAR : GL_NEAREST;
|
||||
updateTexture(QT_IMAGE_TEXTURE_UNIT, pixmap, GL_CLAMP_TO_EDGE, filterMode);
|
||||
|
||||
bool isBitmap = pixmap.isQBitmap();
|
||||
bool isOpaque = !isBitmap && (!pixmap.hasAlpha() || (hints & QPainter::OpaqueHint)) && allOpaque;
|
||||
@ -2102,7 +2181,6 @@ void QOpenGL2PaintEngineEx::ensureActive()
|
||||
d->transferMode(BrushDrawingMode);
|
||||
d->funcs.glViewport(0, 0, d->width, d->height);
|
||||
d->needsSync = false;
|
||||
d->lastMaskTextureUsed = 0;
|
||||
d->shaderManager->setDirty();
|
||||
d->syncGlState();
|
||||
for (int i = 0; i < 3; ++i)
|
||||
|
@ -69,6 +69,8 @@ enum EngineMode {
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
#define GL_STENCIL_HIGH_BIT GLuint(0x80)
|
||||
#define QT_UNKNOWN_TEXTURE_UNIT GLuint(-1)
|
||||
#define QT_DEFAULT_TEXTURE_UNIT GLuint(0)
|
||||
#define QT_BRUSH_TEXTURE_UNIT GLuint(0)
|
||||
#define QT_IMAGE_TEXTURE_UNIT GLuint(0) //Can be the same as brush texture unit
|
||||
#define QT_MASK_TEXTURE_UNIT GLuint(1)
|
||||
@ -184,7 +186,7 @@ public:
|
||||
snapToPixelGrid(false),
|
||||
nativePaintingActive(false),
|
||||
inverseScale(1),
|
||||
lastMaskTextureUsed(0)
|
||||
lastTextureUnitUsed(QT_UNKNOWN_TEXTURE_UNIT)
|
||||
{ }
|
||||
|
||||
~QOpenGL2PaintEngineExPrivate();
|
||||
@ -193,7 +195,13 @@ public:
|
||||
void updateBrushUniforms();
|
||||
void updateMatrix();
|
||||
void updateCompositionMode();
|
||||
void updateTextureFilter(GLenum wrapMode, bool smoothPixmapTransform, GLuint id = GLuint(-1));
|
||||
|
||||
enum TextureUpdateMode { UpdateIfNeeded, ForceUpdate };
|
||||
template<typename T>
|
||||
void updateTexture(GLenum textureUnit, const T &texture, GLenum wrapMode, GLenum filterMode, TextureUpdateMode updateMode = UpdateIfNeeded);
|
||||
template<typename T>
|
||||
GLuint bindTexture(const T &texture);
|
||||
void activateTextureUnit(GLenum textureUnit);
|
||||
|
||||
void resetGLState();
|
||||
|
||||
@ -295,8 +303,8 @@ public:
|
||||
GLfloat pmvMatrix[3][3];
|
||||
GLfloat inverseScale;
|
||||
|
||||
GLenum lastTextureUnitUsed;
|
||||
GLuint lastTextureUsed;
|
||||
GLuint lastMaskTextureUsed;
|
||||
|
||||
bool needsSync;
|
||||
bool multisamplingAlwaysEnabled;
|
||||
|
@ -82,9 +82,10 @@ public:
|
||||
|
||||
struct QBackingstoreTextureInfo
|
||||
{
|
||||
QWidget *widget; // may be null
|
||||
GLuint textureId;
|
||||
QRect rect;
|
||||
bool stacksOnTop;
|
||||
QPlatformTextureList::Flags flags;
|
||||
};
|
||||
|
||||
Q_DECLARE_TYPEINFO(QBackingstoreTextureInfo, Q_MOVABLE_TYPE);
|
||||
@ -122,10 +123,16 @@ GLuint QPlatformTextureList::textureId(int index) const
|
||||
return d->textures.at(index).textureId;
|
||||
}
|
||||
|
||||
bool QPlatformTextureList::stacksOnTop(int index) const
|
||||
QWidget *QPlatformTextureList::widget(int index)
|
||||
{
|
||||
Q_D(const QPlatformTextureList);
|
||||
return d->textures.at(index).stacksOnTop;
|
||||
return d->textures.at(index).widget;
|
||||
}
|
||||
|
||||
QPlatformTextureList::Flags QPlatformTextureList::flags(int index) const
|
||||
{
|
||||
Q_D(const QPlatformTextureList);
|
||||
return d->textures.at(index).flags;
|
||||
}
|
||||
|
||||
QRect QPlatformTextureList::geometry(int index) const
|
||||
@ -149,13 +156,14 @@ bool QPlatformTextureList::isLocked() const
|
||||
return d->locked;
|
||||
}
|
||||
|
||||
void QPlatformTextureList::appendTexture(GLuint textureId, const QRect &geometry, bool stacksOnTop)
|
||||
void QPlatformTextureList::appendTexture(QWidget *widget, GLuint textureId, const QRect &geometry, Flags flags)
|
||||
{
|
||||
Q_D(QPlatformTextureList);
|
||||
QBackingstoreTextureInfo bi;
|
||||
bi.widget = widget;
|
||||
bi.textureId = textureId;
|
||||
bi.rect = geometry;
|
||||
bi.stacksOnTop = stacksOnTop;
|
||||
bi.flags = flags;
|
||||
d->textures.append(bi);
|
||||
}
|
||||
|
||||
@ -245,7 +253,7 @@ void QPlatformBackingStore::composeAndFlush(QWindow *window, const QRegion ®i
|
||||
|
||||
// Textures for renderToTexture widgets.
|
||||
for (int i = 0; i < textures->count(); ++i) {
|
||||
if (!textures->stacksOnTop(i)) {
|
||||
if (!textures->flags(i).testFlag(QPlatformTextureList::StacksOnTop)) {
|
||||
QRect targetRect = deviceRect(textures->geometry(i), window);
|
||||
QMatrix4x4 target = QOpenGLTextureBlitter::targetTransform(targetRect, windowRect);
|
||||
d_ptr->blitter->blit(textures->textureId(i), target, QOpenGLTextureBlitter::OriginBottomLeft);
|
||||
@ -272,7 +280,7 @@ void QPlatformBackingStore::composeAndFlush(QWindow *window, const QRegion ®i
|
||||
|
||||
// Textures for renderToTexture widgets that have WA_AlwaysStackOnTop set.
|
||||
for (int i = 0; i < textures->count(); ++i) {
|
||||
if (textures->stacksOnTop(i)) {
|
||||
if (textures->flags(i).testFlag(QPlatformTextureList::StacksOnTop)) {
|
||||
QRect targetRect = deviceRect(textures->geometry(i), window);
|
||||
QMatrix4x4 target = QOpenGLTextureBlitter::targetTransform(targetRect, windowRect);
|
||||
d_ptr->blitter->blit(textures->textureId(i), target, QOpenGLTextureBlitter::OriginBottomLeft);
|
||||
|
@ -69,6 +69,11 @@ class Q_GUI_EXPORT QPlatformTextureList : public QObject
|
||||
Q_OBJECT
|
||||
Q_DECLARE_PRIVATE(QPlatformTextureList)
|
||||
public:
|
||||
enum Flag {
|
||||
StacksOnTop = 0x01
|
||||
};
|
||||
Q_DECLARE_FLAGS(Flags, Flag)
|
||||
|
||||
explicit QPlatformTextureList(QObject *parent = 0);
|
||||
~QPlatformTextureList();
|
||||
|
||||
@ -76,16 +81,18 @@ public:
|
||||
bool isEmpty() const { return count() == 0; }
|
||||
GLuint textureId(int index) const;
|
||||
QRect geometry(int index) const;
|
||||
bool stacksOnTop(int index) const;
|
||||
QWidget *widget(int index);
|
||||
Flags flags(int index) const;
|
||||
void lock(bool on);
|
||||
bool isLocked() const;
|
||||
|
||||
void appendTexture(GLuint textureId, const QRect &geometry, bool stacksOnTop = false);
|
||||
void appendTexture(QWidget *widget, GLuint textureId, const QRect &geometry, Flags flags = 0);
|
||||
void clear();
|
||||
|
||||
Q_SIGNALS:
|
||||
void locked(bool);
|
||||
};
|
||||
Q_DECLARE_OPERATORS_FOR_FLAGS(QPlatformTextureList::Flags)
|
||||
#endif
|
||||
|
||||
class Q_GUI_EXPORT QPlatformBackingStore
|
||||
|
@ -222,7 +222,7 @@ bool QTextureGlyphCache::populate(QFontEngine *fontEngine, int numGlyphs, const
|
||||
|
||||
void QTextureGlyphCache::fillInPendingGlyphs()
|
||||
{
|
||||
if (m_pendingGlyphs.isEmpty())
|
||||
if (!hasPendingGlyphs())
|
||||
return;
|
||||
|
||||
int requiredHeight = m_h;
|
||||
|
@ -104,6 +104,7 @@ public:
|
||||
|
||||
bool populate(QFontEngine *fontEngine, int numGlyphs, const glyph_t *glyphs,
|
||||
const QFixedPoint *positions);
|
||||
bool hasPendingGlyphs() const { return !m_pendingGlyphs.isEmpty(); };
|
||||
void fillInPendingGlyphs();
|
||||
|
||||
virtual void createTextureData(int width, int height) = 0;
|
||||
|
@ -247,7 +247,6 @@ void QRawFont::loadFromData(const QByteArray &fontData,
|
||||
d.detach();
|
||||
d->cleanUp();
|
||||
d->hintingPreference = hintingPreference;
|
||||
d->thread = QThread::currentThread();
|
||||
d->loadFromData(fontData, pixelSize, hintingPreference);
|
||||
}
|
||||
|
||||
@ -700,8 +699,7 @@ QRawFont QRawFont::fromFont(const QFont &font, QFontDatabase::WritingSystem writ
|
||||
}
|
||||
|
||||
if (fe != 0) {
|
||||
rawFont.d.data()->fontEngine = fe;
|
||||
rawFont.d.data()->fontEngine->ref.ref();
|
||||
rawFont.d.data()->setFontEngine(fe);
|
||||
rawFont.d.data()->hintingPreference = font.hintingPreference();
|
||||
}
|
||||
return rawFont;
|
||||
@ -712,42 +710,23 @@ QRawFont QRawFont::fromFont(const QFont &font, QFontDatabase::WritingSystem writ
|
||||
*/
|
||||
void QRawFont::setPixelSize(qreal pixelSize)
|
||||
{
|
||||
if (d->fontEngine == 0 || qFuzzyCompare(d->fontEngine->fontDef.pixelSize, pixelSize))
|
||||
if (!d->isValid() || qFuzzyCompare(d->fontEngine->fontDef.pixelSize, pixelSize))
|
||||
return;
|
||||
|
||||
d.detach();
|
||||
QFontEngine *oldFontEngine = d->fontEngine;
|
||||
|
||||
d->fontEngine = d->fontEngine->cloneWithSize(pixelSize);
|
||||
if (d->fontEngine != 0)
|
||||
d->fontEngine->ref.ref();
|
||||
|
||||
if (!oldFontEngine->ref.deref())
|
||||
delete oldFontEngine;
|
||||
d->setFontEngine(d->fontEngine->cloneWithSize(pixelSize));
|
||||
}
|
||||
|
||||
/*!
|
||||
\internal
|
||||
*/
|
||||
void QRawFontPrivate::cleanUp()
|
||||
{
|
||||
if (fontEngine != 0) {
|
||||
if (!fontEngine->ref.deref())
|
||||
delete fontEngine;
|
||||
fontEngine = 0;
|
||||
}
|
||||
hintingPreference = QFont::PreferDefaultHinting;
|
||||
}
|
||||
|
||||
void QRawFontPrivate::loadFromData(const QByteArray &fontData, qreal pixelSize,
|
||||
QFont::HintingPreference hintingPreference)
|
||||
{
|
||||
Q_ASSERT(fontEngine == 0);
|
||||
|
||||
QPlatformFontDatabase *pfdb = QGuiApplicationPrivate::platformIntegration()->fontDatabase();
|
||||
fontEngine = pfdb->fontEngine(fontData, pixelSize, hintingPreference);
|
||||
if (fontEngine != 0)
|
||||
fontEngine->ref.ref();
|
||||
setFontEngine(pfdb->fontEngine(fontData, pixelSize, hintingPreference));
|
||||
}
|
||||
|
||||
/*!
|
||||
@ -757,7 +736,7 @@ void QRawFontPrivate::loadFromData(const QByteArray &fontData, qreal pixelSize,
|
||||
*/
|
||||
QRectF QRawFont::boundingRect(quint32 glyphIndex) const
|
||||
{
|
||||
if (!isValid())
|
||||
if (!d->isValid())
|
||||
return QRectF();
|
||||
|
||||
glyph_metrics_t gm = d->fontEngine->boundingBox(glyphIndex);
|
||||
|
@ -66,10 +66,11 @@ public:
|
||||
{}
|
||||
|
||||
QRawFontPrivate(const QRawFontPrivate &other)
|
||||
: hintingPreference(other.hintingPreference)
|
||||
: fontEngine(other.fontEngine)
|
||||
, hintingPreference(other.hintingPreference)
|
||||
, thread(other.thread)
|
||||
{
|
||||
fontEngine = other.fontEngine;
|
||||
Q_ASSERT(fontEngine == 0 || thread == QThread::currentThread());
|
||||
if (fontEngine != 0)
|
||||
fontEngine->ref.ref();
|
||||
}
|
||||
@ -80,13 +81,38 @@ public:
|
||||
cleanUp();
|
||||
}
|
||||
|
||||
inline void cleanUp()
|
||||
{
|
||||
setFontEngine(0);
|
||||
hintingPreference = QFont::PreferDefaultHinting;
|
||||
}
|
||||
|
||||
inline bool isValid() const
|
||||
{
|
||||
Q_ASSERT(thread == 0 || thread == QThread::currentThread());
|
||||
Q_ASSERT(fontEngine == 0 || thread == QThread::currentThread());
|
||||
return fontEngine != 0;
|
||||
}
|
||||
|
||||
void cleanUp();
|
||||
inline void setFontEngine(QFontEngine *engine)
|
||||
{
|
||||
Q_ASSERT(fontEngine == 0 || thread == QThread::currentThread());
|
||||
if (fontEngine == engine)
|
||||
return;
|
||||
|
||||
if (fontEngine != 0) {
|
||||
if (!fontEngine->ref.deref())
|
||||
delete fontEngine;
|
||||
thread = 0;
|
||||
}
|
||||
|
||||
fontEngine = engine;
|
||||
|
||||
if (fontEngine != 0) {
|
||||
fontEngine->ref.ref();
|
||||
Q_ASSERT(thread = QThread::currentThread()); // set only if assertions enabled
|
||||
}
|
||||
}
|
||||
|
||||
void loadFromData(const QByteArray &fontData,
|
||||
qreal pixelSize,
|
||||
QFont::HintingPreference hintingPreference);
|
||||
@ -95,9 +121,10 @@ public:
|
||||
|
||||
QFontEngine *fontEngine;
|
||||
QFont::HintingPreference hintingPreference;
|
||||
QThread *thread;
|
||||
QAtomicInt ref;
|
||||
|
||||
private:
|
||||
QThread *thread;
|
||||
};
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
@ -1776,6 +1776,11 @@ void QTextLine::layout_helper(int maxGlyphs)
|
||||
|
||||
QFixed x = line.x + line.textWidth + lbh.tmpData.textWidth + lbh.spaceData.textWidth;
|
||||
QFixed tabWidth = eng->calculateTabWidth(item, x);
|
||||
attributes = eng->attributes();
|
||||
if (!attributes)
|
||||
return;
|
||||
lbh.logClusters = eng->layoutData->logClustersPtr;
|
||||
lbh.glyphs = eng->shapedGlyphs(¤t);
|
||||
|
||||
lbh.spaceData.textWidth += tabWidth;
|
||||
lbh.spaceData.length++;
|
||||
@ -2063,9 +2068,8 @@ static QGlyphRun glyphRunWithInfo(QFontEngine *fontEngine,
|
||||
// Make a font for this particular engine
|
||||
QRawFont font;
|
||||
QRawFontPrivate *fontD = QRawFontPrivate::get(font);
|
||||
fontD->fontEngine = fontEngine;
|
||||
fontD->thread = QThread::currentThread();
|
||||
fontD->fontEngine->ref.ref();
|
||||
fontD->setFontEngine(fontEngine);
|
||||
|
||||
QVarLengthArray<glyph_t> glyphsArray;
|
||||
QVarLengthArray<QFixedPoint> positionsArray;
|
||||
|
||||
|
@ -361,7 +361,7 @@ void QHttpNetworkConnectionChannel::allDone()
|
||||
Q_ASSERT(reply);
|
||||
|
||||
if (!reply) {
|
||||
qWarning() << "QHttpNetworkConnectionChannel::allDone() called without reply. Please report at http://bugreports.qt-project.org/";
|
||||
qWarning() << "QHttpNetworkConnectionChannel::allDone() called without reply. Please report at http://bugreports.qt.io/";
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -1006,7 +1006,7 @@ QList<QNetworkCookie> QNetworkCookiePrivate::parseSetCookieHeaderLine(const QByt
|
||||
*/
|
||||
void QNetworkCookie::normalize(const QUrl &url)
|
||||
{
|
||||
// don't do path checking. See http://bugreports.qt-project.org/browse/QTBUG-5815
|
||||
// don't do path checking. See QTBUG-5815
|
||||
if (d->path.isEmpty()) {
|
||||
QString pathAndFileName = url.path();
|
||||
QString defaultPath = pathAndFileName.left(pathAndFileName.lastIndexOf(QLatin1Char('/'))+1);
|
||||
|
@ -33,9 +33,12 @@
|
||||
|
||||
|
||||
#include "qsslkey.h"
|
||||
#include "qssl_p.h"
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
Q_LOGGING_CATEGORY(lcSsl, "qt.network.ssl");
|
||||
|
||||
/*! \namespace QSsl
|
||||
|
||||
\brief The QSsl namespace declares enums common to all SSL classes in Qt Network.
|
||||
|
58
src/network/ssl/qssl_p.h
Normal file
58
src/network/ssl/qssl_p.h
Normal file
@ -0,0 +1,58 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
|
||||
** Contact: http://www.qt-project.org/legal
|
||||
**
|
||||
** This file is part of the QtNetwork module 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 Digia. For licensing terms and
|
||||
** conditions see http://qt.digia.com/licensing. For further information
|
||||
** use the contact form at http://qt.digia.com/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.
|
||||
**
|
||||
** In addition, as a special exception, Digia gives you certain additional
|
||||
** rights. These rights are described in the Digia Qt LGPL Exception
|
||||
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
||||
**
|
||||
** $QT_END_LICENSE$
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
|
||||
#ifndef QSSL_P_H
|
||||
#define QSSL_P_H
|
||||
|
||||
|
||||
//
|
||||
// W A R N I N G
|
||||
// -------------
|
||||
//
|
||||
// This file is not part of the Qt API. It exists for the convenience
|
||||
// of qsslcertificate.cpp. This header file may change from version to version
|
||||
// without notice, or even be removed.
|
||||
//
|
||||
// We mean it.
|
||||
//
|
||||
|
||||
#include <QtCore/QLoggingCategory>
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
Q_DECLARE_LOGGING_CATEGORY(lcSsl)
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
||||
#endif // QSSL_P_H
|
@ -112,6 +112,7 @@
|
||||
#include "qsslsocket_winrt_p.h"
|
||||
#endif
|
||||
|
||||
#include "qssl_p.h"
|
||||
#include "qsslcertificate.h"
|
||||
#include "qsslcertificate_p.h"
|
||||
#include "qsslkey_p.h"
|
||||
@ -524,7 +525,7 @@ QList<QSslCertificate> QSslCertificate::fromPath(const QString &path,
|
||||
QList<QSslCertificate> QSslCertificate::fromDevice(QIODevice *device, QSsl::EncodingFormat format)
|
||||
{
|
||||
if (!device) {
|
||||
qWarning("QSslCertificate::fromDevice: cannot read from a null device");
|
||||
qCWarning(lcSsl, "QSslCertificate::fromDevice: cannot read from a null device");
|
||||
return QList<QSslCertificate>();
|
||||
}
|
||||
return fromData(device->readAll(), format);
|
||||
|
@ -39,6 +39,7 @@
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#include "qssl_p.h"
|
||||
#include "qsslsocket_openssl_symbols_p.h"
|
||||
#include "qsslcertificate_p.h"
|
||||
#include "qsslkey_p.h"
|
||||
@ -303,7 +304,7 @@ static QVariant x509UnknownExtensionToValue(X509_EXTENSION *ext)
|
||||
else
|
||||
return list;
|
||||
} else if (meth->i2s && ext_internal) {
|
||||
//qDebug() << meth->i2s(meth, ext_internal);
|
||||
//qCDebug(lcSsl) << meth->i2s(meth, ext_internal);
|
||||
QVariant result(QString::fromUtf8(meth->i2s(meth, ext_internal)));
|
||||
return result;
|
||||
} else if (meth->i2r && ext_internal) {
|
||||
@ -371,7 +372,7 @@ static QVariant x509ExtensionToValue(X509_EXTENSION *ext)
|
||||
|
||||
result[QString::fromUtf8(QSslCertificatePrivate::asn1ObjectName(ad->method))] = uri;
|
||||
} else {
|
||||
qWarning() << "Strange location type" << name->type;
|
||||
qCWarning(lcSsl) << "Strange location type" << name->type;
|
||||
}
|
||||
}
|
||||
|
||||
@ -516,7 +517,7 @@ void QSslCertificatePrivate::init(const QByteArray &data, QSsl::EncodingFormat f
|
||||
QByteArray QSslCertificatePrivate::QByteArray_from_X509(X509 *x509, QSsl::EncodingFormat format)
|
||||
{
|
||||
if (!x509) {
|
||||
qWarning("QSslSocketBackendPrivate::X509_to_QByteArray: null X509");
|
||||
qCWarning(lcSsl, "QSslSocketBackendPrivate::X509_to_QByteArray: null X509");
|
||||
return QByteArray();
|
||||
}
|
||||
|
||||
@ -551,7 +552,7 @@ QByteArray QSslCertificatePrivate::QByteArray_from_X509(X509 *x509, QSsl::Encodi
|
||||
QString QSslCertificatePrivate::text_from_X509(X509 *x509)
|
||||
{
|
||||
if (!x509) {
|
||||
qWarning("QSslSocketBackendPrivate::text_from_X509: null X509");
|
||||
qCWarning(lcSsl, "QSslSocketBackendPrivate::text_from_X509: null X509");
|
||||
return QString();
|
||||
}
|
||||
|
||||
|
@ -40,7 +40,7 @@
|
||||
****************************************************************************/
|
||||
|
||||
|
||||
|
||||
#include "qssl_p.h"
|
||||
#include "qsslcertificate.h"
|
||||
#include "qsslcertificate_p.h"
|
||||
#include "qsslkey.h"
|
||||
@ -83,8 +83,9 @@ bool QSslCertificate::isSelfSigned() const
|
||||
if (d->null)
|
||||
return false;
|
||||
|
||||
qWarning("QSslCertificate::isSelfSigned: This function does not check, whether the certificate "
|
||||
"is actually signed. It just checks whether issuer and subject are identical");
|
||||
qCWarning(lcSsl,
|
||||
"QSslCertificate::isSelfSigned: This function does not check, whether the certificate "
|
||||
"is actually signed. It just checks whether issuer and subject are identical");
|
||||
return d->subjectMatchesIssuer;
|
||||
}
|
||||
|
||||
|
@ -32,6 +32,7 @@
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#include "qssl_p.h"
|
||||
#include "qsslconfiguration.h"
|
||||
#include "qsslconfiguration_p.h"
|
||||
#include "qsslsocket.h"
|
||||
@ -343,7 +344,8 @@ int QSslConfiguration::peerVerifyDepth() const
|
||||
void QSslConfiguration::setPeerVerifyDepth(int depth)
|
||||
{
|
||||
if (depth < 0) {
|
||||
qWarning("QSslConfiguration::setPeerVerifyDepth: cannot set negative depth of %d", depth);
|
||||
qCWarning(lcSsl,
|
||||
"QSslConfiguration::setPeerVerifyDepth: cannot set negative depth of %d", depth);
|
||||
return;
|
||||
}
|
||||
d->peerVerifyDepth = depth;
|
||||
|
@ -37,6 +37,7 @@
|
||||
#include <QtNetwork/qsslsocket.h>
|
||||
#include <QtCore/qmutex.h>
|
||||
|
||||
#include "private/qssl_p.h"
|
||||
#include "private/qsslcontext_openssl_p.h"
|
||||
#include "private/qsslsocket_p.h"
|
||||
#include "private/qsslsocket_openssl_p.h"
|
||||
@ -390,7 +391,7 @@ static int next_proto_cb(SSL *, unsigned char **out, unsigned char *outlen,
|
||||
ctx->status = QSslConfiguration::NextProtocolNegotiationUnsupported;
|
||||
break;
|
||||
default:
|
||||
qWarning("OpenSSL sent unknown NPN status");
|
||||
qCWarning(lcSsl, "OpenSSL sent unknown NPN status");
|
||||
}
|
||||
|
||||
return SSL_TLSEXT_ERR_OK;
|
||||
@ -417,7 +418,7 @@ SSL* QSslContext::createSsl()
|
||||
if (session) {
|
||||
// Try to resume the last session we cached
|
||||
if (!q_SSL_set_session(ssl, session)) {
|
||||
qWarning("could not set SSL session");
|
||||
qCWarning(lcSsl, "could not set SSL session");
|
||||
q_SSL_SESSION_free(session);
|
||||
session = 0;
|
||||
}
|
||||
@ -429,8 +430,8 @@ SSL* QSslContext::createSsl()
|
||||
m_supportedNPNVersions.clear();
|
||||
for (int a = 0; a < protocols.count(); ++a) {
|
||||
if (protocols.at(a).size() > 255) {
|
||||
qWarning() << "TLS NPN extension" << protocols.at(a)
|
||||
<< "is too long and will be truncated to 255 characters.";
|
||||
qCWarning(lcSsl) << "TLS NPN extension" << protocols.at(a)
|
||||
<< "is too long and will be truncated to 255 characters.";
|
||||
protocols[a] = protocols.at(a).left(255);
|
||||
}
|
||||
m_supportedNPNVersions.append(protocols.at(a).size()).append(protocols.at(a));
|
||||
@ -466,7 +467,7 @@ bool QSslContext::cacheSession(SSL* ssl)
|
||||
m_sessionASN1.resize(sessionSize);
|
||||
unsigned char *data = reinterpret_cast<unsigned char *>(m_sessionASN1.data());
|
||||
if (!q_i2d_SSL_SESSION(session, &data))
|
||||
qWarning("could not store persistent version of SSL session");
|
||||
qCWarning(lcSsl, "could not store persistent version of SSL session");
|
||||
m_sessionTicketLifeTimeHint = session->tlsext_tick_lifetime_hint;
|
||||
}
|
||||
}
|
||||
|
@ -39,6 +39,7 @@
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#include "qssl_p.h"
|
||||
#include "qsslkey.h"
|
||||
#include "qsslkey_p.h"
|
||||
#include "qsslcertificate_p.h"
|
||||
@ -144,7 +145,7 @@ static QByteArray doCrypt(QSslKeyPrivate::Cipher cipher, QByteArray data, const
|
||||
if (padding > 0 && padding <= blockLength)
|
||||
resultLength -= padding;
|
||||
else
|
||||
qWarning("Invalid padding length of %u; decryption likely failed.", padding);
|
||||
qCWarning(lcSsl, "Invalid padding length of %u; decryption likely failed.", padding);
|
||||
}
|
||||
|
||||
return QByteArray(reinterpret_cast<const char *>(resultData), resultLength);
|
||||
|
@ -281,6 +281,7 @@
|
||||
\sa peerVerifyError()
|
||||
*/
|
||||
|
||||
#include "qssl_p.h"
|
||||
#include "qsslsocket.h"
|
||||
#include "qsslcipher.h"
|
||||
#ifndef QT_NO_OPENSSL
|
||||
@ -335,7 +336,7 @@ QSslSocket::QSslSocket(QObject *parent)
|
||||
{
|
||||
Q_D(QSslSocket);
|
||||
#ifdef QSSLSOCKET_DEBUG
|
||||
qDebug() << "QSslSocket::QSslSocket(" << parent << "), this =" << (void *)this;
|
||||
qCDebug(lcSsl) << "QSslSocket::QSslSocket(" << parent << "), this =" << (void *)this;
|
||||
#endif
|
||||
d->q_ptr = this;
|
||||
d->init();
|
||||
@ -348,7 +349,7 @@ QSslSocket::~QSslSocket()
|
||||
{
|
||||
Q_D(QSslSocket);
|
||||
#ifdef QSSLSOCKET_DEBUG
|
||||
qDebug() << "QSslSocket::~QSslSocket(), this =" << (void *)this;
|
||||
qCDebug(lcSsl) << "QSslSocket::~QSslSocket(), this =" << (void *)this;
|
||||
#endif
|
||||
delete d->plainSocket;
|
||||
d->plainSocket = 0;
|
||||
@ -417,7 +418,8 @@ void QSslSocket::connectToHostEncrypted(const QString &hostName, quint16 port, O
|
||||
{
|
||||
Q_D(QSslSocket);
|
||||
if (d->state == ConnectedState || d->state == ConnectingState) {
|
||||
qWarning("QSslSocket::connectToHostEncrypted() called when already connecting/connected");
|
||||
qCWarning(lcSsl,
|
||||
"QSslSocket::connectToHostEncrypted() called when already connecting/connected");
|
||||
return;
|
||||
}
|
||||
|
||||
@ -447,7 +449,8 @@ void QSslSocket::connectToHostEncrypted(const QString &hostName, quint16 port,
|
||||
{
|
||||
Q_D(QSslSocket);
|
||||
if (d->state == ConnectedState || d->state == ConnectingState) {
|
||||
qWarning("QSslSocket::connectToHostEncrypted() called when already connecting/connected");
|
||||
qCWarning(lcSsl,
|
||||
"QSslSocket::connectToHostEncrypted() called when already connecting/connected");
|
||||
return;
|
||||
}
|
||||
|
||||
@ -477,7 +480,7 @@ bool QSslSocket::setSocketDescriptor(qintptr socketDescriptor, SocketState state
|
||||
{
|
||||
Q_D(QSslSocket);
|
||||
#ifdef QSSLSOCKET_DEBUG
|
||||
qDebug() << "QSslSocket::setSocketDescriptor(" << socketDescriptor << ','
|
||||
qCDebug(lcSsl) << "QSslSocket::setSocketDescriptor(" << socketDescriptor << ','
|
||||
<< state << ',' << openMode << ')';
|
||||
#endif
|
||||
if (!d->plainSocket)
|
||||
@ -661,7 +664,7 @@ void QSslSocket::setPeerVerifyDepth(int depth)
|
||||
{
|
||||
Q_D(QSslSocket);
|
||||
if (depth < 0) {
|
||||
qWarning("QSslSocket::setPeerVerifyDepth: cannot set negative depth of %d", depth);
|
||||
qCWarning(lcSsl, "QSslSocket::setPeerVerifyDepth: cannot set negative depth of %d", depth);
|
||||
return;
|
||||
}
|
||||
d->configuration.peerVerifyDepth = depth;
|
||||
@ -772,7 +775,7 @@ bool QSslSocket::canReadLine() const
|
||||
void QSslSocket::close()
|
||||
{
|
||||
#ifdef QSSLSOCKET_DEBUG
|
||||
qDebug() << "QSslSocket::close()";
|
||||
qCDebug(lcSsl) << "QSslSocket::close()";
|
||||
#endif
|
||||
Q_D(QSslSocket);
|
||||
if (encryptedBytesToWrite())
|
||||
@ -816,7 +819,7 @@ bool QSslSocket::flush()
|
||||
{
|
||||
Q_D(QSslSocket);
|
||||
#ifdef QSSLSOCKET_DEBUG
|
||||
qDebug() << "QSslSocket::flush()";
|
||||
qCDebug(lcSsl) << "QSslSocket::flush()";
|
||||
#endif
|
||||
if (d->mode != UnencryptedMode)
|
||||
// encrypt any unencrypted bytes in our buffer
|
||||
@ -850,7 +853,7 @@ void QSslSocket::abort()
|
||||
{
|
||||
Q_D(QSslSocket);
|
||||
#ifdef QSSLSOCKET_DEBUG
|
||||
qDebug() << "QSslSocket::abort()";
|
||||
qCDebug(lcSsl) << "QSslSocket::abort()";
|
||||
#endif
|
||||
if (d->plainSocket)
|
||||
d->plainSocket->abort();
|
||||
@ -1721,7 +1724,7 @@ bool QSslSocket::waitForDisconnected(int msecs)
|
||||
|
||||
// require calling connectToHost() before waitForDisconnected()
|
||||
if (state() == UnconnectedState) {
|
||||
qWarning("QSslSocket::waitForDisconnected() is not allowed in UnconnectedState");
|
||||
qCWarning(lcSsl, "QSslSocket::waitForDisconnected() is not allowed in UnconnectedState");
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -1837,15 +1840,17 @@ void QSslSocket::startClientEncryption()
|
||||
{
|
||||
Q_D(QSslSocket);
|
||||
if (d->mode != UnencryptedMode) {
|
||||
qWarning("QSslSocket::startClientEncryption: cannot start handshake on non-plain connection");
|
||||
qCWarning(lcSsl,
|
||||
"QSslSocket::startClientEncryption: cannot start handshake on non-plain connection");
|
||||
return;
|
||||
}
|
||||
if (state() != ConnectedState) {
|
||||
qWarning("QSslSocket::startClientEncryption: cannot start handshake when not connected");
|
||||
qCWarning(lcSsl,
|
||||
"QSslSocket::startClientEncryption: cannot start handshake when not connected");
|
||||
return;
|
||||
}
|
||||
#ifdef QSSLSOCKET_DEBUG
|
||||
qDebug() << "QSslSocket::startClientEncryption()";
|
||||
qCDebug(lcSsl) << "QSslSocket::startClientEncryption()";
|
||||
#endif
|
||||
d->mode = SslClientMode;
|
||||
emit modeChanged(d->mode);
|
||||
@ -1876,11 +1881,11 @@ void QSslSocket::startServerEncryption()
|
||||
{
|
||||
Q_D(QSslSocket);
|
||||
if (d->mode != UnencryptedMode) {
|
||||
qWarning("QSslSocket::startServerEncryption: cannot start handshake on non-plain connection");
|
||||
qCWarning(lcSsl, "QSslSocket::startServerEncryption: cannot start handshake on non-plain connection");
|
||||
return;
|
||||
}
|
||||
#ifdef QSSLSOCKET_DEBUG
|
||||
qDebug() << "QSslSocket::startServerEncryption()";
|
||||
qCDebug(lcSsl) << "QSslSocket::startServerEncryption()";
|
||||
#endif
|
||||
d->mode = SslServerMode;
|
||||
emit modeChanged(d->mode);
|
||||
@ -1957,12 +1962,12 @@ void QSslSocket::connectToHost(const QString &hostName, quint16 port, OpenMode o
|
||||
d->initialized = false;
|
||||
|
||||
#ifdef QSSLSOCKET_DEBUG
|
||||
qDebug() << "QSslSocket::connectToHost("
|
||||
qCDebug(lcSsl) << "QSslSocket::connectToHost("
|
||||
<< hostName << ',' << port << ',' << openMode << ')';
|
||||
#endif
|
||||
if (!d->plainSocket) {
|
||||
#ifdef QSSLSOCKET_DEBUG
|
||||
qDebug() << "\tcreating internal plain socket";
|
||||
qCDebug(lcSsl) << "\tcreating internal plain socket";
|
||||
#endif
|
||||
d->createPlainSocket(openMode);
|
||||
}
|
||||
@ -1981,7 +1986,7 @@ void QSslSocket::disconnectFromHost()
|
||||
{
|
||||
Q_D(QSslSocket);
|
||||
#ifdef QSSLSOCKET_DEBUG
|
||||
qDebug() << "QSslSocket::disconnectFromHost()";
|
||||
qCDebug(lcSsl) << "QSslSocket::disconnectFromHost()";
|
||||
#endif
|
||||
if (!d->plainSocket)
|
||||
return;
|
||||
@ -2025,7 +2030,7 @@ qint64 QSslSocket::readData(char *data, qint64 maxlen)
|
||||
if (d->mode == UnencryptedMode && !d->autoStartHandshake) {
|
||||
readBytes = d->plainSocket->read(data, maxlen);
|
||||
#ifdef QSSLSOCKET_DEBUG
|
||||
qDebug() << "QSslSocket::readData(" << (void *)data << ',' << maxlen << ") =="
|
||||
qCDebug(lcSsl) << "QSslSocket::readData(" << (void *)data << ',' << maxlen << ") =="
|
||||
<< readBytes;
|
||||
#endif
|
||||
} else {
|
||||
@ -2044,7 +2049,7 @@ qint64 QSslSocket::writeData(const char *data, qint64 len)
|
||||
{
|
||||
Q_D(QSslSocket);
|
||||
#ifdef QSSLSOCKET_DEBUG
|
||||
qDebug() << "QSslSocket::writeData(" << (void *)data << ',' << len << ')';
|
||||
qCDebug(lcSsl) << "QSslSocket::writeData(" << (void *)data << ',' << len << ')';
|
||||
#endif
|
||||
if (d->mode == UnencryptedMode && !d->autoStartHandshake)
|
||||
return d->plainSocket->write(data, len);
|
||||
@ -2386,10 +2391,10 @@ void QSslSocketPrivate::_q_connectedSlot()
|
||||
cachedSocketDescriptor = plainSocket->socketDescriptor();
|
||||
|
||||
#ifdef QSSLSOCKET_DEBUG
|
||||
qDebug() << "QSslSocket::_q_connectedSlot()";
|
||||
qDebug() << "\tstate =" << q->state();
|
||||
qDebug() << "\tpeer =" << q->peerName() << q->peerAddress() << q->peerPort();
|
||||
qDebug() << "\tlocal =" << QHostInfo::fromName(q->localAddress().toString()).hostName()
|
||||
qCDebug(lcSsl) << "QSslSocket::_q_connectedSlot()";
|
||||
qCDebug(lcSsl) << "\tstate =" << q->state();
|
||||
qCDebug(lcSsl) << "\tpeer =" << q->peerName() << q->peerAddress() << q->peerPort();
|
||||
qCDebug(lcSsl) << "\tlocal =" << QHostInfo::fromName(q->localAddress().toString()).hostName()
|
||||
<< q->localAddress() << q->localPort();
|
||||
#endif
|
||||
|
||||
@ -2411,8 +2416,8 @@ void QSslSocketPrivate::_q_hostFoundSlot()
|
||||
{
|
||||
Q_Q(QSslSocket);
|
||||
#ifdef QSSLSOCKET_DEBUG
|
||||
qDebug() << "QSslSocket::_q_hostFoundSlot()";
|
||||
qDebug() << "\tstate =" << q->state();
|
||||
qCDebug(lcSsl) << "QSslSocket::_q_hostFoundSlot()";
|
||||
qCDebug(lcSsl) << "\tstate =" << q->state();
|
||||
#endif
|
||||
emit q->hostFound();
|
||||
}
|
||||
@ -2424,8 +2429,8 @@ void QSslSocketPrivate::_q_disconnectedSlot()
|
||||
{
|
||||
Q_Q(QSslSocket);
|
||||
#ifdef QSSLSOCKET_DEBUG
|
||||
qDebug() << "QSslSocket::_q_disconnectedSlot()";
|
||||
qDebug() << "\tstate =" << q->state();
|
||||
qCDebug(lcSsl) << "QSslSocket::_q_disconnectedSlot()";
|
||||
qCDebug(lcSsl) << "\tstate =" << q->state();
|
||||
#endif
|
||||
disconnected();
|
||||
emit q->disconnected();
|
||||
@ -2438,7 +2443,7 @@ void QSslSocketPrivate::_q_stateChangedSlot(QAbstractSocket::SocketState state)
|
||||
{
|
||||
Q_Q(QSslSocket);
|
||||
#ifdef QSSLSOCKET_DEBUG
|
||||
qDebug() << "QSslSocket::_q_stateChangedSlot(" << state << ')';
|
||||
qCDebug(lcSsl) << "QSslSocket::_q_stateChangedSlot(" << state << ')';
|
||||
#endif
|
||||
q->setSocketState(state);
|
||||
emit q->stateChanged(state);
|
||||
@ -2451,9 +2456,9 @@ void QSslSocketPrivate::_q_errorSlot(QAbstractSocket::SocketError error)
|
||||
{
|
||||
Q_Q(QSslSocket);
|
||||
#ifdef QSSLSOCKET_DEBUG
|
||||
qDebug() << "QSslSocket::_q_errorSlot(" << error << ')';
|
||||
qDebug() << "\tstate =" << q->state();
|
||||
qDebug() << "\terrorString =" << q->errorString();
|
||||
qCDebug(lcSsl) << "QSslSocket::_q_errorSlot(" << error << ')';
|
||||
qCDebug(lcSsl) << "\tstate =" << q->state();
|
||||
qCDebug(lcSsl) << "\terrorString =" << q->errorString();
|
||||
#endif
|
||||
q->setSocketError(plainSocket->error());
|
||||
q->setErrorString(plainSocket->errorString());
|
||||
@ -2467,7 +2472,7 @@ void QSslSocketPrivate::_q_readyReadSlot()
|
||||
{
|
||||
Q_Q(QSslSocket);
|
||||
#ifdef QSSLSOCKET_DEBUG
|
||||
qDebug() << "QSslSocket::_q_readyReadSlot() -" << plainSocket->bytesAvailable() << "bytes available";
|
||||
qCDebug(lcSsl) << "QSslSocket::_q_readyReadSlot() -" << plainSocket->bytesAvailable() << "bytes available";
|
||||
#endif
|
||||
if (mode == QSslSocket::UnencryptedMode) {
|
||||
if (readyReadEmittedPointer)
|
||||
@ -2486,7 +2491,7 @@ void QSslSocketPrivate::_q_bytesWrittenSlot(qint64 written)
|
||||
{
|
||||
Q_Q(QSslSocket);
|
||||
#ifdef QSSLSOCKET_DEBUG
|
||||
qDebug() << "QSslSocket::_q_bytesWrittenSlot(" << written << ')';
|
||||
qCDebug(lcSsl) << "QSslSocket::_q_bytesWrittenSlot(" << written << ')';
|
||||
#endif
|
||||
|
||||
if (mode == QSslSocket::UnencryptedMode)
|
||||
|
@ -50,6 +50,7 @@
|
||||
//#define QSSLSOCKET_DEBUG
|
||||
//#define QT_DECRYPT_SSL_TRAFFIC
|
||||
|
||||
#include "qssl_p.h"
|
||||
#include "qsslsocket_openssl_p.h"
|
||||
#include "qsslsocket_openssl_symbols_p.h"
|
||||
#include "qsslsocket.h"
|
||||
@ -252,24 +253,24 @@ int q_X509Callback(int ok, X509_STORE_CTX *ctx)
|
||||
// Store the error and at which depth the error was detected.
|
||||
_q_sslErrorList()->errors << qMakePair<int, int>(q_X509_STORE_CTX_get_error(ctx), q_X509_STORE_CTX_get_error_depth(ctx));
|
||||
#ifdef QSSLSOCKET_DEBUG
|
||||
qDebug() << "verification error: dumping bad certificate";
|
||||
qDebug() << QSslCertificatePrivate::QSslCertificate_from_X509(q_X509_STORE_CTX_get_current_cert(ctx)).toPem();
|
||||
qDebug() << "dumping chain";
|
||||
qCDebug(lcSsl) << "verification error: dumping bad certificate";
|
||||
qCDebug(lcSsl) << QSslCertificatePrivate::QSslCertificate_from_X509(q_X509_STORE_CTX_get_current_cert(ctx)).toPem();
|
||||
qCDebug(lcSsl) << "dumping chain";
|
||||
foreach (QSslCertificate cert, QSslSocketBackendPrivate::STACKOFX509_to_QSslCertificates(q_X509_STORE_CTX_get_chain(ctx))) {
|
||||
QString certFormat(QStringLiteral("O=%1 CN=%2 L=%3 OU=%4 C=%5 ST=%6"));
|
||||
qDebug() << "Issuer:" << "O=" << cert.issuerInfo(QSslCertificate::Organization)
|
||||
qCDebug(lcSsl) << "Issuer:" << "O=" << cert.issuerInfo(QSslCertificate::Organization)
|
||||
<< "CN=" << cert.issuerInfo(QSslCertificate::CommonName)
|
||||
<< "L=" << cert.issuerInfo(QSslCertificate::LocalityName)
|
||||
<< "OU=" << cert.issuerInfo(QSslCertificate::OrganizationalUnitName)
|
||||
<< "C=" << cert.issuerInfo(QSslCertificate::CountryName)
|
||||
<< "ST=" << cert.issuerInfo(QSslCertificate::StateOrProvinceName);
|
||||
qDebug() << "Subject:" << "O=" << cert.subjectInfo(QSslCertificate::Organization)
|
||||
qCDebug(lcSsl) << "Subject:" << "O=" << cert.subjectInfo(QSslCertificate::Organization)
|
||||
<< "CN=" << cert.subjectInfo(QSslCertificate::CommonName)
|
||||
<< "L=" << cert.subjectInfo(QSslCertificate::LocalityName)
|
||||
<< "OU=" << cert.subjectInfo(QSslCertificate::OrganizationalUnitName)
|
||||
<< "C=" << cert.subjectInfo(QSslCertificate::CountryName)
|
||||
<< "ST=" << cert.subjectInfo(QSslCertificate::StateOrProvinceName);
|
||||
qDebug() << "Valid:" << cert.effectiveDate() << "-" << cert.expiryDate();
|
||||
qCDebug(lcSsl) << "Valid:" << cert.effectiveDate() << "-" << cert.expiryDate();
|
||||
}
|
||||
#endif
|
||||
}
|
||||
@ -363,7 +364,7 @@ bool QSslSocketBackendPrivate::initSslContext()
|
||||
&& !QHostAddress().setAddress(tlsHostName)
|
||||
&& !(configuration.sslOptions & QSsl::SslOptionDisableServerNameIndication)) {
|
||||
if (!q_SSL_ctrl(ssl, SSL_CTRL_SET_TLSEXT_HOSTNAME, TLSEXT_NAMETYPE_host_name, ace.data()))
|
||||
qWarning("could not set SSL_CTRL_SET_TLSEXT_HOSTNAME, Server Name Indication disabled");
|
||||
qCWarning(lcSsl, "could not set SSL_CTRL_SET_TLSEXT_HOSTNAME, Server Name Indication disabled");
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@ -490,16 +491,16 @@ void QSslSocketPrivate::ensureCiphersAndCertsLoaded()
|
||||
if (securityLib.load()) {
|
||||
ptrSecCertificateCopyData = (PtrSecCertificateCopyData) securityLib.resolve("SecCertificateCopyData");
|
||||
if (!ptrSecCertificateCopyData)
|
||||
qWarning("could not resolve symbols in security library"); // should never happen
|
||||
qCWarning(lcSsl, "could not resolve symbols in security library"); // should never happen
|
||||
|
||||
ptrSecTrustSettingsCopyCertificates = (PtrSecTrustSettingsCopyCertificates) securityLib.resolve("SecTrustSettingsCopyCertificates");
|
||||
if (!ptrSecTrustSettingsCopyCertificates) { // method was introduced in Leopard, use legacy method if it's not there
|
||||
ptrSecTrustCopyAnchorCertificates = (PtrSecTrustCopyAnchorCertificates) securityLib.resolve("SecTrustCopyAnchorCertificates");
|
||||
if (!ptrSecTrustCopyAnchorCertificates)
|
||||
qWarning("could not resolve symbols in security library"); // should never happen
|
||||
qCWarning(lcSsl, "could not resolve symbols in security library"); // should never happen
|
||||
}
|
||||
} else {
|
||||
qWarning("could not load security library");
|
||||
qCWarning(lcSsl, "could not load security library");
|
||||
}
|
||||
#elif defined(Q_OS_WIN)
|
||||
HINSTANCE hLib = LoadLibraryW(L"Crypt32");
|
||||
@ -514,9 +515,9 @@ void QSslSocketPrivate::ensureCiphersAndCertsLoaded()
|
||||
ptrCertCloseStore = (PtrCertCloseStore)GetProcAddress(hLib, "CertCloseStore");
|
||||
#endif
|
||||
if (!ptrCertOpenSystemStoreW || !ptrCertFindCertificateInStore || !ptrCertCloseStore)
|
||||
qWarning("could not resolve symbols in crypt32 library"); // should never happen
|
||||
qCWarning(lcSsl, "could not resolve symbols in crypt32 library"); // should never happen
|
||||
} else {
|
||||
qWarning("could not load crypt32 library"); // should never happen
|
||||
qCWarning(lcSsl, "could not load crypt32 library"); // should never happen
|
||||
}
|
||||
#elif defined(Q_OS_QNX)
|
||||
s_loadRootCertsOnDemand = true;
|
||||
@ -685,7 +686,7 @@ QList<QSslCertificate> QSslSocketPrivate::systemCaCertificates()
|
||||
data = ptrSecCertificateCopyData(cfCert);
|
||||
|
||||
if (data == NULL) {
|
||||
qWarning("error retrieving a CA certificate from the system store");
|
||||
qCWarning(lcSsl, "error retrieving a CA certificate from the system store");
|
||||
} else {
|
||||
QByteArray rawCert = QByteArray::fromRawData((const char *)CFDataGetBytePtr(data), CFDataGetLength(data));
|
||||
systemCerts.append(QSslCertificate::fromData(rawCert, QSsl::Der));
|
||||
@ -696,7 +697,7 @@ QList<QSslCertificate> QSslSocketPrivate::systemCaCertificates()
|
||||
}
|
||||
else {
|
||||
// no detailed error handling here
|
||||
qWarning("could not retrieve system CA certificates");
|
||||
qCWarning(lcSsl, "could not retrieve system CA certificates");
|
||||
}
|
||||
}
|
||||
#elif defined(Q_OS_WIN)
|
||||
@ -770,8 +771,8 @@ QList<QSslCertificate> QSslSocketPrivate::systemCaCertificates()
|
||||
}
|
||||
#endif
|
||||
#ifdef QSSLSOCKET_DEBUG
|
||||
qDebug() << "systemCaCertificates retrieval time " << timer.elapsed() << "ms";
|
||||
qDebug() << "imported " << systemCerts.count() << " certificates";
|
||||
qCDebug(lcSsl) << "systemCaCertificates retrieval time " << timer.elapsed() << "ms";
|
||||
qCDebug(lcSsl) << "imported " << systemCerts.count() << " certificates";
|
||||
#endif
|
||||
|
||||
return systemCerts;
|
||||
@ -852,7 +853,7 @@ void QSslSocketBackendPrivate::transmit()
|
||||
}
|
||||
}
|
||||
#ifdef QSSLSOCKET_DEBUG
|
||||
qDebug() << "QSslSocketBackendPrivate::transmit: encrypted" << writtenBytes << "bytes";
|
||||
qCDebug(lcSsl) << "QSslSocketBackendPrivate::transmit: encrypted" << writtenBytes << "bytes";
|
||||
#endif
|
||||
writeBuffer.free(writtenBytes);
|
||||
totalBytesWritten += writtenBytes;
|
||||
@ -885,7 +886,7 @@ void QSslSocketBackendPrivate::transmit()
|
||||
// Write encrypted data from the buffer to the socket.
|
||||
qint64 actualWritten = plainSocket->write(data.constData(), encryptedBytesRead);
|
||||
#ifdef QSSLSOCKET_DEBUG
|
||||
qDebug() << "QSslSocketBackendPrivate::transmit: wrote" << encryptedBytesRead << "encrypted bytes to the socket" << actualWritten << "actual.";
|
||||
qCDebug(lcSsl) << "QSslSocketBackendPrivate::transmit: wrote" << encryptedBytesRead << "encrypted bytes to the socket" << actualWritten << "actual.";
|
||||
#endif
|
||||
if (actualWritten < 0) {
|
||||
//plain socket write fails if it was in the pending close state.
|
||||
@ -906,7 +907,7 @@ void QSslSocketBackendPrivate::transmit()
|
||||
int encryptedBytesRead = plainSocket->peek(data.data(), pendingBytes);
|
||||
|
||||
#ifdef QSSLSOCKET_DEBUG
|
||||
qDebug() << "QSslSocketBackendPrivate::transmit: read" << encryptedBytesRead << "encrypted bytes from the socket";
|
||||
qCDebug(lcSsl) << "QSslSocketBackendPrivate::transmit: read" << encryptedBytesRead << "encrypted bytes from the socket";
|
||||
#endif
|
||||
// Write encrypted data from the buffer into the read BIO.
|
||||
int writtenToBio = q_BIO_write(readBio, data.constData(), encryptedBytesRead);
|
||||
@ -930,17 +931,17 @@ void QSslSocketBackendPrivate::transmit()
|
||||
// connect / accept.
|
||||
if (!connectionEncrypted) {
|
||||
#ifdef QSSLSOCKET_DEBUG
|
||||
qDebug() << "QSslSocketBackendPrivate::transmit: testing encryption";
|
||||
qCDebug(lcSsl) << "QSslSocketBackendPrivate::transmit: testing encryption";
|
||||
#endif
|
||||
if (startHandshake()) {
|
||||
#ifdef QSSLSOCKET_DEBUG
|
||||
qDebug() << "QSslSocketBackendPrivate::transmit: encryption established";
|
||||
qCDebug(lcSsl) << "QSslSocketBackendPrivate::transmit: encryption established";
|
||||
#endif
|
||||
connectionEncrypted = true;
|
||||
transmitting = true;
|
||||
} else if (plainSocket->state() != QAbstractSocket::ConnectedState) {
|
||||
#ifdef QSSLSOCKET_DEBUG
|
||||
qDebug() << "QSslSocketBackendPrivate::transmit: connection lost";
|
||||
qCDebug(lcSsl) << "QSslSocketBackendPrivate::transmit: connection lost";
|
||||
#endif
|
||||
break;
|
||||
} else if (paused) {
|
||||
@ -948,7 +949,7 @@ void QSslSocketBackendPrivate::transmit()
|
||||
return;
|
||||
} else {
|
||||
#ifdef QSSLSOCKET_DEBUG
|
||||
qDebug() << "QSslSocketBackendPrivate::transmit: encryption not done yet";
|
||||
qCDebug(lcSsl) << "QSslSocketBackendPrivate::transmit: encryption not done yet";
|
||||
#endif
|
||||
}
|
||||
}
|
||||
@ -969,7 +970,7 @@ void QSslSocketBackendPrivate::transmit()
|
||||
// Don't use SSL_pending(). It's very unreliable.
|
||||
if ((readBytes = q_SSL_read(ssl, data.data(), data.size())) > 0) {
|
||||
#ifdef QSSLSOCKET_DEBUG
|
||||
qDebug() << "QSslSocketBackendPrivate::transmit: decrypted" << readBytes << "bytes";
|
||||
qCDebug(lcSsl) << "QSslSocketBackendPrivate::transmit: decrypted" << readBytes << "bytes";
|
||||
#endif
|
||||
char *ptr = buffer.reserve(readBytes);
|
||||
::memcpy(ptr, data.data(), readBytes);
|
||||
@ -990,7 +991,7 @@ void QSslSocketBackendPrivate::transmit()
|
||||
case SSL_ERROR_ZERO_RETURN:
|
||||
// The remote host closed the connection.
|
||||
#ifdef QSSLSOCKET_DEBUG
|
||||
qDebug() << "QSslSocketBackendPrivate::transmit: remote disconnect";
|
||||
qCDebug(lcSsl) << "QSslSocketBackendPrivate::transmit: remote disconnect";
|
||||
#endif
|
||||
shutdown = true; // the other side shut down, make sure we do not send shutdown ourselves
|
||||
q->setErrorString(QSslSocket::tr("The TLS/SSL connection has been closed"));
|
||||
@ -1109,7 +1110,7 @@ bool QSslSocketBackendPrivate::startHandshake()
|
||||
q->setErrorString(QSslSocket::tr("Error during SSL handshake: %1").arg(getErrorsFromOpenSsl()));
|
||||
q->setSocketError(QAbstractSocket::SslHandshakeFailedError);
|
||||
#ifdef QSSLSOCKET_DEBUG
|
||||
qDebug() << "QSslSocketBackendPrivate::startHandshake: error!" << q->errorString();
|
||||
qCDebug(lcSsl) << "QSslSocketBackendPrivate::startHandshake: error!" << q->errorString();
|
||||
#endif
|
||||
emit q->error(QAbstractSocket::SslHandshakeFailedError);
|
||||
q->abort();
|
||||
@ -1212,7 +1213,7 @@ bool QSslSocketBackendPrivate::startHandshake()
|
||||
break;
|
||||
default:
|
||||
#ifdef QSSLSOCKET_DEBUG
|
||||
qDebug() << sslErrors.at(i).errorString();
|
||||
qCDebug(lcSsl) << sslErrors.at(i).errorString();
|
||||
#endif
|
||||
break;
|
||||
}
|
||||
@ -1346,7 +1347,7 @@ void QWindowsCaRootFetcher::start()
|
||||
PCCERT_CONTEXT wincert = CertCreateCertificateContext(X509_ASN_ENCODING, (const BYTE *)der.constData(), der.length());
|
||||
if (!wincert) {
|
||||
#ifdef QSSLSOCKET_DEBUG
|
||||
qDebug("QWindowsCaRootFetcher failed to convert certificate to windows form");
|
||||
qCDebug(lcSsl, "QWindowsCaRootFetcher failed to convert certificate to windows form");
|
||||
#endif
|
||||
emit finished(cert, QSslCertificate());
|
||||
deleteLater();
|
||||
@ -1377,32 +1378,32 @@ void QWindowsCaRootFetcher::start()
|
||||
0, //reserved
|
||||
&chain);
|
||||
#ifdef QSSLSOCKET_DEBUG
|
||||
qDebug() << "QWindowsCaRootFetcher" << stopwatch.elapsed() << "ms to get chain";
|
||||
qCDebug(lcSsl) << "QWindowsCaRootFetcher" << stopwatch.elapsed() << "ms to get chain";
|
||||
#endif
|
||||
|
||||
QSslCertificate trustedRoot;
|
||||
if (result) {
|
||||
#ifdef QSSLSOCKET_DEBUG
|
||||
qDebug() << "QWindowsCaRootFetcher - examining windows chains";
|
||||
qCDebug(lcSsl) << "QWindowsCaRootFetcher - examining windows chains";
|
||||
if (chain->TrustStatus.dwErrorStatus == CERT_TRUST_NO_ERROR)
|
||||
qDebug() << " - TRUSTED";
|
||||
qCDebug(lcSsl) << " - TRUSTED";
|
||||
else
|
||||
qDebug() << " - NOT TRUSTED" << chain->TrustStatus.dwErrorStatus;
|
||||
qCDebug(lcSsl) << " - NOT TRUSTED" << chain->TrustStatus.dwErrorStatus;
|
||||
if (chain->TrustStatus.dwInfoStatus & CERT_TRUST_IS_SELF_SIGNED)
|
||||
qDebug() << " - SELF SIGNED";
|
||||
qDebug() << "QSslSocketBackendPrivate::fetchCaRootForCert - dumping simple chains";
|
||||
qCDebug(lcSsl) << " - SELF SIGNED";
|
||||
qCDebug(lcSsl) << "QSslSocketBackendPrivate::fetchCaRootForCert - dumping simple chains";
|
||||
for (unsigned int i = 0; i < chain->cChain; i++) {
|
||||
if (chain->rgpChain[i]->TrustStatus.dwErrorStatus == CERT_TRUST_NO_ERROR)
|
||||
qDebug() << " - TRUSTED SIMPLE CHAIN" << i;
|
||||
qCDebug(lcSsl) << " - TRUSTED SIMPLE CHAIN" << i;
|
||||
else
|
||||
qDebug() << " - UNTRUSTED SIMPLE CHAIN" << i << "reason:" << chain->rgpChain[i]->TrustStatus.dwErrorStatus;
|
||||
qCDebug(lcSsl) << " - UNTRUSTED SIMPLE CHAIN" << i << "reason:" << chain->rgpChain[i]->TrustStatus.dwErrorStatus;
|
||||
for (unsigned int j = 0; j < chain->rgpChain[i]->cElement; j++) {
|
||||
QSslCertificate foundCert(QByteArray((const char *)chain->rgpChain[i]->rgpElement[j]->pCertContext->pbCertEncoded
|
||||
, chain->rgpChain[i]->rgpElement[j]->pCertContext->cbCertEncoded), QSsl::Der);
|
||||
qDebug() << " - " << foundCert;
|
||||
qCDebug(lcSsl) << " - " << foundCert;
|
||||
}
|
||||
}
|
||||
qDebug() << " - and" << chain->cLowerQualityChainContext << "low quality chains"; //expect 0, we haven't asked for them
|
||||
qCDebug(lcSsl) << " - and" << chain->cLowerQualityChainContext << "low quality chains"; //expect 0, we haven't asked for them
|
||||
#endif
|
||||
|
||||
//based on http://msdn.microsoft.com/en-us/library/windows/desktop/aa377182%28v=vs.85%29.aspx
|
||||
@ -1521,12 +1522,12 @@ void QSslSocketBackendPrivate::continueHandshake()
|
||||
QString sslKeyFile = QDir::tempPath() + QLatin1String("/qt-ssl-keys");
|
||||
QFile file(sslKeyFile);
|
||||
if (!file.open(QIODevice::Append))
|
||||
qWarning() << "could not open file" << sslKeyFile << "for appending";
|
||||
qCWarning(lcSsl) << "could not open file" << sslKeyFile << "for appending";
|
||||
if (!file.write(debugLineClientRandom))
|
||||
qWarning() << "could not write to file" << sslKeyFile;
|
||||
qCWarning(lcSsl) << "could not write to file" << sslKeyFile;
|
||||
file.close();
|
||||
} else {
|
||||
qWarning("could not decrypt SSL traffic");
|
||||
qCWarning(lcSsl, "could not decrypt SSL traffic");
|
||||
}
|
||||
#endif
|
||||
|
||||
@ -1585,7 +1586,7 @@ QList<QSslError> QSslSocketBackendPrivate::verify(QList<QSslCertificate> certifi
|
||||
// Setup the store with the default CA certificates
|
||||
X509_STORE *certStore = q_X509_STORE_new();
|
||||
if (!certStore) {
|
||||
qWarning() << "Unable to create certificate store";
|
||||
qCWarning(lcSsl) << "Unable to create certificate store";
|
||||
errors << QSslError(QSslError::UnspecifiedError);
|
||||
return errors;
|
||||
}
|
||||
@ -1722,7 +1723,7 @@ bool QSslSocketBackendPrivate::importPkcs12(QIODevice *device,
|
||||
// Create the PKCS#12 object
|
||||
PKCS12 *p12 = q_d2i_PKCS12_bio(bio, 0);
|
||||
if (!p12) {
|
||||
qWarning("Unable to read PKCS#12 structure, %s", q_ERR_error_string(q_ERR_get_error(), 0));
|
||||
qCWarning(lcSsl, "Unable to read PKCS#12 structure, %s", q_ERR_error_string(q_ERR_get_error(), 0));
|
||||
q_BIO_free(bio);
|
||||
return false;
|
||||
}
|
||||
@ -1733,7 +1734,7 @@ bool QSslSocketBackendPrivate::importPkcs12(QIODevice *device,
|
||||
STACK_OF(X509) *ca = 0;
|
||||
|
||||
if (!q_PKCS12_parse(p12, passPhrase.constData(), &pkey, &x509, &ca)) {
|
||||
qWarning("Unable to parse PKCS#12 structure, %s", q_ERR_error_string(q_ERR_get_error(), 0));
|
||||
qCWarning(lcSsl, "Unable to parse PKCS#12 structure, %s", q_ERR_error_string(q_ERR_get_error(), 0));
|
||||
q_PKCS12_free(p12);
|
||||
q_BIO_free(bio);
|
||||
return false;
|
||||
@ -1741,7 +1742,7 @@ bool QSslSocketBackendPrivate::importPkcs12(QIODevice *device,
|
||||
|
||||
// Convert to Qt types
|
||||
if (!key->d->fromEVP_PKEY(pkey)) {
|
||||
qWarning("Unable to convert private key");
|
||||
qCWarning(lcSsl, "Unable to convert private key");
|
||||
q_sk_pop_free(reinterpret_cast<STACK *>(ca), reinterpret_cast<void(*)(void*)>(q_sk_free));
|
||||
q_X509_free(x509);
|
||||
q_EVP_PKEY_free(pkey);
|
||||
|
@ -47,6 +47,7 @@
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#include "qssl_p.h"
|
||||
#include "qsslsocket_openssl_symbols_p.h"
|
||||
|
||||
#ifdef Q_OS_WIN
|
||||
@ -115,12 +116,12 @@ QT_BEGIN_NAMESPACE
|
||||
namespace {
|
||||
void qsslSocketUnresolvedSymbolWarning(const char *functionName)
|
||||
{
|
||||
qWarning("QSslSocket: cannot call unresolved function %s", functionName);
|
||||
qCWarning(lcSsl, "QSslSocket: cannot call unresolved function %s", functionName);
|
||||
}
|
||||
|
||||
void qsslSocketCannotResolveSymbolWarning(const char *functionName)
|
||||
{
|
||||
qWarning("QSslSocket: cannot resolve %s", functionName);
|
||||
qCWarning(lcSsl, "QSslSocket: cannot resolve %s", functionName);
|
||||
}
|
||||
}
|
||||
|
||||
@ -393,11 +394,11 @@ DEFINEFUNC(void, PKCS12_free, PKCS12 *pkcs12, pkcs12, return, DUMMYARG)
|
||||
#ifdef QT_NO_LIBRARY
|
||||
bool q_resolveOpenSslSymbols()
|
||||
{
|
||||
qWarning("QSslSocket: unable to resolve symbols. "
|
||||
"QT_NO_LIBRARY is defined which means runtime resolving of "
|
||||
"libraries won't work.");
|
||||
qWarning("Either compile Qt statically or with support for runtime resolving "
|
||||
"of libraries.");
|
||||
qCWarning(lcSsl, "QSslSocket: unable to resolve symbols. "
|
||||
"QT_NO_LIBRARY is defined which means runtime resolving of "
|
||||
"libraries won't work.");
|
||||
qCWarning(lcSsl, "Either compile Qt statically or with support for runtime resolving "
|
||||
"of libraries.");
|
||||
return false;
|
||||
}
|
||||
#else
|
||||
@ -1003,7 +1004,7 @@ QDateTime q_getTimeFromASN1(const ASN1_TIME *aTime)
|
||||
return result;
|
||||
|
||||
} else {
|
||||
qWarning("unsupported date format detected");
|
||||
qCWarning(lcSsl, "unsupported date format detected");
|
||||
return QDateTime();
|
||||
}
|
||||
|
||||
|
@ -39,6 +39,7 @@
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#include "qssl_p.h"
|
||||
#include "qsslsocket_winrt_p.h"
|
||||
#include "qsslsocket.h"
|
||||
#include "qsslcertificate_p.h"
|
||||
@ -455,8 +456,9 @@ HRESULT QSslSocketBackendPrivate::onSslUpgrade(IAsyncAction *action, AsyncStatus
|
||||
Q_Q(QSslSocket);
|
||||
|
||||
if (wasDeleted) {
|
||||
qWarning("SSL upgrade callback received after the delegate was deleted. "
|
||||
"This may be indicative of an internal bug in the WinRT SSL implementation.");
|
||||
qCWarning(lcSsl,
|
||||
"SSL upgrade callback received after the delegate was deleted. "
|
||||
"This may be indicative of an internal bug in the WinRT SSL implementation.");
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
@ -477,8 +479,9 @@ HRESULT QSslSocketBackendPrivate::onSslUpgrade(IAsyncAction *action, AsyncStatus
|
||||
|
||||
IStreamSocket *socket = reinterpret_cast<IStreamSocket *>(plainSocket->socketDescriptor());
|
||||
if (qintptr(socket) == -1) {
|
||||
qWarning("The underlying TCP socket used by the SSL socket is invalid. "
|
||||
"This may be indicative of an internal bug in the WinRT SSL implementation.");
|
||||
qCWarning(lcSsl,
|
||||
"The underlying TCP socket used by the SSL socket is invalid. "
|
||||
"This may be indicative of an internal bug in the WinRT SSL implementation.");
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
|
@ -2,6 +2,7 @@
|
||||
contains(QT_CONFIG, ssl) | contains(QT_CONFIG, openssl) | contains(QT_CONFIG, openssl-linked) {
|
||||
HEADERS += ssl/qasn1element_p.h \
|
||||
ssl/qssl.h \
|
||||
ssl/qssl_p.h \
|
||||
ssl/qsslcertificate.h \
|
||||
ssl/qsslcertificate_p.h \
|
||||
ssl/qsslconfiguration.h \
|
||||
|
@ -70,7 +70,7 @@ VisualID QXlibEglIntegration::getCompatibleVisualId(Display *display, EGLDisplay
|
||||
chosenVisualInfo = XGetVisualInfo(display, VisualIDMask, &visualInfoTemplate, &matchingCount);
|
||||
if (chosenVisualInfo) {
|
||||
// Skip size checks if implementation supports non-matching visual
|
||||
// and config (http://bugreports.qt-project.org/browse/QTBUG-9444).
|
||||
// and config (QTBUG-9444).
|
||||
if (q_hasEglExtension(eglDisplay,"EGL_NV_post_convert_rounding")) {
|
||||
XFree(chosenVisualInfo);
|
||||
return visualId;
|
||||
|
@ -177,7 +177,7 @@ void QOpenGLCompositor::render(QOpenGLCompositorWindow *window)
|
||||
const bool translucent = window->sourceWindow()->requestedFormat().alphaBufferSize() > 0;
|
||||
blend.set(translucent);
|
||||
m_blitter.blit(textureId, target, QOpenGLTextureBlitter::OriginTopLeft);
|
||||
} else if (!textures->stacksOnTop(i)) {
|
||||
} else if (!textures->flags(i).testFlag(QPlatformTextureList::StacksOnTop)) {
|
||||
// Texture from an FBO belonging to a QOpenGLWidget
|
||||
blend.set(false);
|
||||
m_blitter.blit(textureId, target, QOpenGLTextureBlitter::OriginBottomLeft);
|
||||
@ -185,7 +185,7 @@ void QOpenGLCompositor::render(QOpenGLCompositorWindow *window)
|
||||
}
|
||||
|
||||
for (int i = 0; i < textures->count(); ++i) {
|
||||
if (textures->stacksOnTop(i)) {
|
||||
if (textures->flags(i).testFlag(QPlatformTextureList::StacksOnTop)) {
|
||||
QMatrix4x4 target = QOpenGLTextureBlitter::targetTransform(textures->geometry(i), targetWindowRect);
|
||||
blend.set(true);
|
||||
m_blitter.blit(textures->textureId(i), target, QOpenGLTextureBlitter::OriginBottomLeft);
|
||||
|
@ -149,7 +149,7 @@ void QOpenGLCompositorBackingStore::flush(QWindow *window, const QRegion ®ion
|
||||
dstCtx->makeCurrent(dstWin);
|
||||
updateTexture();
|
||||
m_textures->clear();
|
||||
m_textures->appendTexture(m_bsTexture, window->geometry());
|
||||
m_textures->appendTexture(Q_NULLPTR, m_bsTexture, window->geometry());
|
||||
|
||||
compositor->update();
|
||||
}
|
||||
@ -175,10 +175,10 @@ void QOpenGLCompositorBackingStore::composeAndFlush(QWindow *window, const QRegi
|
||||
|
||||
m_textures->clear();
|
||||
for (int i = 0; i < textures->count(); ++i)
|
||||
m_textures->appendTexture(textures->textureId(i), textures->geometry(i), textures->stacksOnTop(i));
|
||||
m_textures->appendTexture(textures->widget(i), textures->textureId(i), textures->geometry(i), textures->flags(i));
|
||||
|
||||
updateTexture();
|
||||
m_textures->appendTexture(m_bsTexture, window->geometry());
|
||||
m_textures->appendTexture(Q_NULLPTR, m_bsTexture, window->geometry());
|
||||
|
||||
textures->lock(true);
|
||||
m_lockedWidgetTextures = textures;
|
||||
|
@ -146,7 +146,7 @@ QDBusInterface *QNetworkManagerInterface::connectionInterface() const
|
||||
QList <QDBusObjectPath> QNetworkManagerInterface::getDevices()
|
||||
{
|
||||
if (devicesPathList.isEmpty()) {
|
||||
qWarning() << "using blocking call!";
|
||||
//qWarning() << "using blocking call!";
|
||||
QDBusReply<QList<QDBusObjectPath> > reply = d->connectionInterface->call(QLatin1String("GetDevices"));
|
||||
devicesPathList = reply.value();
|
||||
}
|
||||
@ -779,7 +779,7 @@ QDBusInterface *QNetworkManagerInterfaceDeviceWireless::connectionInterface() co
|
||||
QList <QDBusObjectPath> QNetworkManagerInterfaceDeviceWireless::getAccessPoints()
|
||||
{
|
||||
if (accessPointsList.isEmpty()) {
|
||||
qWarning() << "Using blocking call!";
|
||||
//qWarning() << "Using blocking call!";
|
||||
QDBusReply<QList<QDBusObjectPath> > reply
|
||||
= d->connectionInterface->call(QLatin1String("GetAccessPoints"));
|
||||
accessPointsList = reply.value();
|
||||
@ -997,7 +997,7 @@ bool QNetworkManagerSettings::setConnections()
|
||||
QList <QDBusObjectPath> QNetworkManagerSettings::listConnections()
|
||||
{
|
||||
if (connectionsList.isEmpty()) {
|
||||
qWarning() << "Using blocking call!";
|
||||
//qWarning() << "Using blocking call!";
|
||||
QDBusReply<QList<QDBusObjectPath> > reply
|
||||
= d->connectionInterface->call(QLatin1String("ListConnections"));
|
||||
connectionsList = reply.value();
|
||||
@ -1103,7 +1103,7 @@ QDBusInterface *QNetworkManagerSettingsConnection::connectionInterface() const
|
||||
QNmSettingsMap QNetworkManagerSettingsConnection::getSettings()
|
||||
{
|
||||
if (d->settingsMap.isEmpty()) {
|
||||
qWarning() << "Using blocking call!";
|
||||
//qWarning() << "Using blocking call!";
|
||||
QDBusReply<QNmSettingsMap> reply = d->connectionInterface->call(QLatin1String("GetSettings"));
|
||||
d->settingsMap = reply.value();
|
||||
}
|
||||
|
@ -79,8 +79,11 @@ void *QAndroidPlatformNativeInterface::nativeResourceForIntegration(const QByteA
|
||||
if (resource == "QtActivity")
|
||||
return QtAndroid::activity();
|
||||
if (resource == "AndroidStyleData") {
|
||||
if (m_androidStyle)
|
||||
if (m_androidStyle) {
|
||||
if (m_androidStyle->m_styleData.isEmpty())
|
||||
m_androidStyle->m_styleData = AndroidStyle::loadStyleData();
|
||||
return &m_androidStyle->m_styleData;
|
||||
}
|
||||
else
|
||||
return Q_NULLPTR;
|
||||
}
|
||||
|
@ -176,7 +176,7 @@ static void setPaletteColor(const QVariantMap &object,
|
||||
}
|
||||
}
|
||||
|
||||
static std::shared_ptr<AndroidStyle> loadAndroidStyle(QPalette *defaultPalette)
|
||||
QJsonObject AndroidStyle::loadStyleData()
|
||||
{
|
||||
QString stylePath(QLatin1String(qgetenv("MINISTRO_ANDROID_STYLE_PATH")));
|
||||
const QLatin1Char slashChar('/');
|
||||
@ -198,21 +198,29 @@ static std::shared_ptr<AndroidStyle> loadAndroidStyle(QPalette *defaultPalette)
|
||||
|
||||
QFile f(stylePath + QLatin1String("style.json"));
|
||||
if (!f.open(QIODevice::ReadOnly))
|
||||
return std::shared_ptr<AndroidStyle>();
|
||||
return QJsonObject();
|
||||
|
||||
QJsonParseError error;
|
||||
QJsonDocument document = QJsonDocument::fromJson(f.readAll(), &error);
|
||||
if (document.isNull()) {
|
||||
qCritical() << error.errorString();
|
||||
return std::shared_ptr<AndroidStyle>();
|
||||
return QJsonObject();
|
||||
}
|
||||
|
||||
if (!document.isObject()) {
|
||||
qCritical() << "Style.json does not contain a valid style.";
|
||||
return std::shared_ptr<AndroidStyle>();
|
||||
return QJsonObject();
|
||||
}
|
||||
return document.object();
|
||||
}
|
||||
|
||||
static std::shared_ptr<AndroidStyle> loadAndroidStyle(QPalette *defaultPalette)
|
||||
{
|
||||
std::shared_ptr<AndroidStyle> style(new AndroidStyle);
|
||||
style->m_styleData = document.object();
|
||||
style->m_styleData = AndroidStyle::loadStyleData();
|
||||
if (style->m_styleData.isEmpty())
|
||||
return std::shared_ptr<AndroidStyle>();
|
||||
|
||||
for (QJsonObject::const_iterator objectIterator = style->m_styleData.constBegin();
|
||||
objectIterator != style->m_styleData.constEnd();
|
||||
++objectIterator) {
|
||||
|
@ -46,12 +46,12 @@ QT_BEGIN_NAMESPACE
|
||||
|
||||
struct AndroidStyle
|
||||
{
|
||||
static QJsonObject loadStyleData();
|
||||
QJsonObject m_styleData;
|
||||
QPalette m_standardPalette;
|
||||
QHash<int, QPalette> m_palettes;
|
||||
QHash<int, QFont> m_fonts;
|
||||
QHash<QByteArray, QFont> m_QWidgetsFonts;
|
||||
QHash<QByteArray, QFont> m_QWidgetsPalettes;
|
||||
};
|
||||
|
||||
class QAndroidPlatformNativeInterface;
|
||||
|
@ -96,7 +96,6 @@ public:
|
||||
|
||||
void setFocusObject(QObject *object) Q_DECL_OVERRIDE;
|
||||
void focusWindowChanged(QWindow *focusWindow);
|
||||
void cursorRectangleChanged();
|
||||
|
||||
void scrollToCursor();
|
||||
void scroll(int y);
|
||||
|
@ -68,6 +68,7 @@ static QUIView *focusView()
|
||||
@private
|
||||
QIOSInputContext *m_context;
|
||||
}
|
||||
@property BOOL hasDeferredScrollToCursor;
|
||||
@end
|
||||
|
||||
@implementation QIOSKeyboardListener
|
||||
@ -80,6 +81,8 @@ static QUIView *focusView()
|
||||
|
||||
m_context = context;
|
||||
|
||||
self.hasDeferredScrollToCursor = NO;
|
||||
|
||||
// UIGestureRecognizer
|
||||
self.enabled = NO;
|
||||
self.cancelsTouchesInView = NO;
|
||||
@ -159,6 +162,18 @@ static QUIView *focusView()
|
||||
|
||||
// -------------------------------------------------------------------------
|
||||
|
||||
- (BOOL)canPreventGestureRecognizer:(UIGestureRecognizer *)other
|
||||
{
|
||||
Q_UNUSED(other);
|
||||
return NO;
|
||||
}
|
||||
|
||||
- (BOOL)canBePreventedByGestureRecognizer:(UIGestureRecognizer *)other
|
||||
{
|
||||
Q_UNUSED(other);
|
||||
return NO;
|
||||
}
|
||||
|
||||
- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event
|
||||
{
|
||||
[super touchesBegan:touches withEvent:event];
|
||||
@ -231,9 +246,14 @@ static QUIView *focusView()
|
||||
qImDebug() << "keyboard was hidden, disabling hide-keyboard gesture";
|
||||
self.enabled = NO;
|
||||
} else {
|
||||
qImDebug() << "gesture completed without triggering, scrolling view to cursor";
|
||||
m_context->scrollToCursor();
|
||||
qImDebug() << "gesture completed without triggering";
|
||||
if (self.hasDeferredScrollToCursor) {
|
||||
qImDebug() << "applying deferred scroll to cursor";
|
||||
m_context->scrollToCursor();
|
||||
}
|
||||
}
|
||||
|
||||
self.hasDeferredScrollToCursor = NO;
|
||||
}
|
||||
|
||||
@end
|
||||
@ -281,8 +301,6 @@ QIOSInputContext::QIOSInputContext()
|
||||
if (isQtApplication()) {
|
||||
QIOSScreen *iosScreen = static_cast<QIOSScreen*>(QGuiApplication::primaryScreen()->handle());
|
||||
[iosScreen->uiWindow() addGestureRecognizer:m_keyboardHideGesture];
|
||||
|
||||
connect(qGuiApp->inputMethod(), &QInputMethod::cursorRectangleChanged, this, &QIOSInputContext::cursorRectangleChanged);
|
||||
}
|
||||
|
||||
connect(qGuiApp, &QGuiApplication::focusWindowChanged, this, &QIOSInputContext::focusWindowChanged);
|
||||
@ -400,23 +418,6 @@ QRectF QIOSInputContext::keyboardRect() const
|
||||
|
||||
// -------------------------------------------------------------------------
|
||||
|
||||
void QIOSInputContext::cursorRectangleChanged()
|
||||
{
|
||||
if (!isInputPanelVisible() || !qApp->focusObject())
|
||||
return;
|
||||
|
||||
// Check if the cursor has changed position inside the input item. Since
|
||||
// qApp->inputMethod()->cursorRectangle() will also change when the input item
|
||||
// itself moves, we need to ask the focus object for ImCursorRectangle:
|
||||
static QPoint prevCursor;
|
||||
QInputMethodQueryEvent queryEvent(Qt::ImCursorRectangle);
|
||||
QCoreApplication::sendEvent(qApp->focusObject(), &queryEvent);
|
||||
QPoint cursor = queryEvent.value(Qt::ImCursorRectangle).toRect().topLeft();
|
||||
if (cursor != prevCursor)
|
||||
scrollToCursor();
|
||||
prevCursor = cursor;
|
||||
}
|
||||
|
||||
UIView *QIOSInputContext::scrollableRootView()
|
||||
{
|
||||
if (!m_keyboardHideGesture.view)
|
||||
@ -437,7 +438,8 @@ void QIOSInputContext::scrollToCursor()
|
||||
if (m_keyboardHideGesture.state == UIGestureRecognizerStatePossible && m_keyboardHideGesture.numberOfTouches == 1) {
|
||||
// Don't scroll to the cursor if the user is touching the screen and possibly
|
||||
// trying to trigger the hide-keyboard gesture.
|
||||
qImDebug() << "preventing scrolling to cursor as we're still waiting for a possible gesture";
|
||||
qImDebug() << "deferring scrolling to cursor as we're still waiting for a possible gesture";
|
||||
m_keyboardHideGesture.hasDeferredScrollToCursor = YES;
|
||||
return;
|
||||
}
|
||||
|
||||
@ -524,7 +526,8 @@ void QIOSInputContext::setFocusObject(QObject *focusObject)
|
||||
|
||||
qImDebug() << "new focus object =" << focusObject;
|
||||
|
||||
if (m_keyboardHideGesture.state == UIGestureRecognizerStateChanged) {
|
||||
if (QPlatformInputContext::inputMethodAccepted()
|
||||
&& m_keyboardHideGesture.state == UIGestureRecognizerStateChanged) {
|
||||
// A new focus object may be set as part of delivering touch events to
|
||||
// application during the hide-keyboard gesture, but we don't want that
|
||||
// to result in a new object getting focus and bringing the keyboard up
|
||||
@ -598,6 +601,9 @@ void QIOSInputContext::update(Qt::InputMethodQueries updatedProperties)
|
||||
} else {
|
||||
[m_textResponder notifyInputDelegate:changedProperties];
|
||||
}
|
||||
|
||||
if (changedProperties & Qt::ImCursorRectangle)
|
||||
scrollToCursor();
|
||||
}
|
||||
|
||||
bool QIOSInputContext::inputMethodAccepted() const
|
||||
|
@ -263,10 +263,14 @@
|
||||
// will set the new first-responder to our next-responder, and in the latter
|
||||
// case we'll have an active responder candidate.
|
||||
if ([UIResponder currentFirstResponder] == [self nextResponder]) {
|
||||
// We have resigned the keyboard, and transferred back to the parent view, so unset focus object
|
||||
// We have resigned the keyboard, and transferred first responder back to the parent view
|
||||
Q_ASSERT(!FirstResponderCandidate::currentCandidate());
|
||||
qImDebug() << "keyboard was closed, clearing focus object";
|
||||
m_inputContext->clearCurrentFocusObject();
|
||||
if ([self imValue:Qt::ImEnabled].toBool()) {
|
||||
// The current focus object expects text input, but there
|
||||
// is no keyboard to get input from. So we clear focus.
|
||||
qImDebug() << "no keyboard available, clearing focus object";
|
||||
m_inputContext->clearCurrentFocusObject();
|
||||
}
|
||||
} else {
|
||||
// We've lost responder status because another Qt window was made active,
|
||||
// another QIOSTextResponder was made first-responder, another UIView was
|
||||
|
@ -1017,7 +1017,7 @@ QFontEngine::Properties QWindowsFontEngine::properties() const
|
||||
void QWindowsFontEngine::getUnscaledGlyph(glyph_t glyph, QPainterPath *path, glyph_metrics_t *metrics)
|
||||
{
|
||||
LOGFONT lf = m_logfont;
|
||||
lf.lfHeight = unitsPerEm;
|
||||
lf.lfHeight = -unitsPerEm;
|
||||
int flags = synthesized();
|
||||
if(flags & SynthesizedItalic)
|
||||
lf.lfItalic = false;
|
||||
|
@ -833,7 +833,10 @@ bool QWindowsKeyMapper::translateMultimediaKeyEventInternal(QWindow *window, con
|
||||
|
||||
const int qtKey = CmdTbl[cmd];
|
||||
sendExtendedPressRelease(receiver, qtKey, Qt::KeyboardModifier(state), 0, 0, 0);
|
||||
return true;
|
||||
// QTBUG-43343: Make sure to return false if Qt does not handle the key, otherwise,
|
||||
// the keys are not passed to the active media player.
|
||||
const QKeySequence sequence(Qt::Modifier(state) + qtKey);
|
||||
return QGuiApplicationPrivate::instance()->shortcutMap.hasShortcutForKeySequence(sequence);
|
||||
#else
|
||||
Q_UNREACHABLE();
|
||||
return false;
|
||||
|
@ -559,10 +559,11 @@ QWindowsWindowData
|
||||
Q_ASSERT(result.hwnd);
|
||||
const LONG_PTR style = GetWindowLongPtr(result.hwnd, GWL_STYLE);
|
||||
const LONG_PTR exStyle = GetWindowLongPtr(result.hwnd, GWL_EXSTYLE);
|
||||
result.geometry = frameGeometry(result.hwnd, !GetParent(result.hwnd));
|
||||
result.frame = QWindowsGeometryHint::frame(style, exStyle);
|
||||
result.embedded = false;
|
||||
qCDebug(lcQpaWindows) << "Foreign window: " << w << result.hwnd << result.geometry << result.frame;
|
||||
result.frame = QWindowsGeometryHint::frame(style, exStyle);
|
||||
result.geometry = frameGeometry(result.hwnd, !GetParent(result.hwnd))
|
||||
.marginsRemoved(result.frame);
|
||||
qCDebug(lcQpaWindows) << "Foreign window: " << w << result.hwnd << result.geometry;
|
||||
return result;
|
||||
}
|
||||
|
||||
@ -889,7 +890,8 @@ QWindowsWindow::QWindowsWindow(QWindow *aWindow, const QWindowsWindowData &data)
|
||||
updateDropSite();
|
||||
|
||||
#ifndef Q_OS_WINCE
|
||||
if (QWindowsContext::instance()->systemInfo() & QWindowsContext::SI_SupportsTouch) {
|
||||
if ((QWindowsContext::instance()->systemInfo() & QWindowsContext::SI_SupportsTouch)
|
||||
&& aWindow->type() != Qt::ForeignWindow) {
|
||||
if (QWindowsContext::user32dll.registerTouchWindow(m_data.hwnd, 0)) {
|
||||
setFlag(TouchRegistered);
|
||||
} else {
|
||||
|
@ -742,7 +742,8 @@ void QXcbClipboard::handleXFixesSelectionRequest(xcb_xfixes_selection_notify_eve
|
||||
m_xClipboard[mode]->reset();
|
||||
}
|
||||
emitChanged(mode);
|
||||
}
|
||||
} else if (event->subtype == XCB_XFIXES_SELECTION_EVENT_SELECTION_CLIENT_CLOSE)
|
||||
emitChanged(mode);
|
||||
}
|
||||
|
||||
|
||||
|
@ -165,7 +165,7 @@ QXcbIntegration::QXcbIntegration(const QStringList ¶meters, int &argc, char
|
||||
"\t Use the -dograb option to enforce grabbing.");
|
||||
}
|
||||
#endif
|
||||
m_canGrab = (!underDebugger && noGrabArg) || (underDebugger && doGrabArg);
|
||||
m_canGrab = (!underDebugger && !noGrabArg) || (underDebugger && doGrabArg);
|
||||
|
||||
static bool canNotGrabEnv = qEnvironmentVariableIsSet("QT_XCB_NO_GRAB_SERVER");
|
||||
if (canNotGrabEnv)
|
||||
|
@ -627,6 +627,7 @@ public:
|
||||
QColorPicker(QWidget* parent);
|
||||
~QColorPicker();
|
||||
|
||||
void setCrossVisible(bool visible);
|
||||
public slots:
|
||||
void setCol(int h, int s);
|
||||
|
||||
@ -650,6 +651,7 @@ private:
|
||||
void setCol(const QPoint &pt);
|
||||
|
||||
QPixmap pix;
|
||||
bool crossVisible;
|
||||
};
|
||||
|
||||
static int pWidth = 220;
|
||||
@ -805,6 +807,7 @@ void QColorPicker::setCol(const QPoint &pt)
|
||||
|
||||
QColorPicker::QColorPicker(QWidget* parent)
|
||||
: QFrame(parent)
|
||||
, crossVisible(true)
|
||||
{
|
||||
hue = 0; sat = 0;
|
||||
setCol(150, 255);
|
||||
@ -817,6 +820,14 @@ QColorPicker::~QColorPicker()
|
||||
{
|
||||
}
|
||||
|
||||
void QColorPicker::setCrossVisible(bool visible)
|
||||
{
|
||||
if (crossVisible != visible) {
|
||||
crossVisible = visible;
|
||||
update();
|
||||
}
|
||||
}
|
||||
|
||||
QSize QColorPicker::sizeHint() const
|
||||
{
|
||||
return QSize(pWidth + 2*frameWidth(), pHeight + 2*frameWidth());
|
||||
@ -858,12 +869,13 @@ void QColorPicker::paintEvent(QPaintEvent* )
|
||||
QRect r = contentsRect();
|
||||
|
||||
p.drawPixmap(r.topLeft(), pix);
|
||||
QPoint pt = colPt() + r.topLeft();
|
||||
p.setPen(Qt::black);
|
||||
|
||||
p.fillRect(pt.x()-9, pt.y(), 20, 2, Qt::black);
|
||||
p.fillRect(pt.x(), pt.y()-9, 2, 20, Qt::black);
|
||||
|
||||
if (crossVisible) {
|
||||
QPoint pt = colPt() + r.topLeft();
|
||||
p.setPen(Qt::black);
|
||||
p.fillRect(pt.x()-9, pt.y(), 20, 2, Qt::black);
|
||||
p.fillRect(pt.x(), pt.y()-9, 2, 20, Qt::black);
|
||||
}
|
||||
}
|
||||
|
||||
void QColorPicker::resizeEvent(QResizeEvent *ev)
|
||||
@ -1477,8 +1489,8 @@ bool QColorDialogPrivate::selectColor(const QColor &col)
|
||||
const QRgb *match = std::find(standardColors, standardColorsEnd, color);
|
||||
if (match != standardColorsEnd) {
|
||||
const int index = int(match - standardColors);
|
||||
const int row = index / standardColorRows;
|
||||
const int column = index % standardColorRows;
|
||||
const int column = index / standardColorRows;
|
||||
const int row = index % standardColorRows;
|
||||
_q_newStandard(row, column);
|
||||
standard->setCurrent(row, column);
|
||||
standard->setSelected(row, column);
|
||||
@ -1493,8 +1505,8 @@ bool QColorDialogPrivate::selectColor(const QColor &col)
|
||||
const QRgb *match = std::find(customColors, customColorsEnd, color);
|
||||
if (match != customColorsEnd) {
|
||||
const int index = int(match - customColors);
|
||||
const int row = index / customColorRows;
|
||||
const int column = index % customColorRows;
|
||||
const int column = index / customColorRows;
|
||||
const int row = index % customColorRows;
|
||||
_q_newCustom(row, column);
|
||||
custom->setCurrent(row, column);
|
||||
custom->setSelected(row, column);
|
||||
@ -1578,6 +1590,7 @@ void QColorDialogPrivate::_q_pickScreenColor()
|
||||
void QColorDialogPrivate::releaseColorPicking()
|
||||
{
|
||||
Q_Q(QColorDialog);
|
||||
cp->setCrossVisible(true);
|
||||
q->removeEventFilter(colorPickingEventFilter);
|
||||
q->releaseMouse();
|
||||
q->releaseKeyboard();
|
||||
@ -2174,6 +2187,9 @@ void QColorDialog::changeEvent(QEvent *e)
|
||||
|
||||
bool QColorDialogPrivate::handleColorPickingMouseMove(QMouseEvent *e)
|
||||
{
|
||||
// If the cross is visible the grabbed color will be black most of the times
|
||||
cp->setCrossVisible(!cp->geometry().contains(e->pos()));
|
||||
|
||||
const QPoint globalPos = e->globalPos();
|
||||
const QColor color = grabScreenColor(globalPos);
|
||||
// QTBUG-39792, do not change standard, custom color selectors while moving as
|
||||
|
@ -61,7 +61,7 @@ public:
|
||||
//! [1]
|
||||
class CustomItem : public QGraphicsItem
|
||||
{
|
||||
...
|
||||
public:
|
||||
enum { Type = UserType + 1 };
|
||||
|
||||
int type() const
|
||||
@ -245,21 +245,6 @@ scene->destroyItemGroup(group);
|
||||
//! [17]
|
||||
|
||||
|
||||
//! [QGraphicsItem type]
|
||||
class CustomItem : public QGraphicsItem
|
||||
{
|
||||
...
|
||||
enum { Type = UserType + 1 };
|
||||
|
||||
int type() const
|
||||
{
|
||||
// Enable the use of qgraphicsitem_cast with this item.
|
||||
return Type;
|
||||
}
|
||||
...
|
||||
};
|
||||
//! [QGraphicsItem type]
|
||||
|
||||
//! [18]
|
||||
class QGraphicsPathItem : public QAbstractGraphicsShapeItem
|
||||
{
|
||||
|
@ -6592,7 +6592,7 @@ void QGraphicsItem::setData(int key, const QVariant &value)
|
||||
|
||||
For example:
|
||||
|
||||
\snippet code/src_gui_graphicsview_qgraphicsitem.cpp QGraphicsItem type
|
||||
\snippet code/src_gui_graphicsview_qgraphicsitem.cpp 1
|
||||
|
||||
\sa UserType
|
||||
*/
|
||||
|
@ -270,6 +270,7 @@ void QGraphicsProxyWidgetPrivate::sendWidgetMouseEvent(QGraphicsSceneMouseEvent
|
||||
QMouseEvent mouseEvent(type, pos, receiver->mapTo(receiver->topLevelWidget(), pos.toPoint()),
|
||||
receiver->mapToGlobal(pos.toPoint()),
|
||||
event->button(), event->buttons(), event->modifiers());
|
||||
QGuiApplicationPrivate::setMouseEventSource(&mouseEvent, event->source());
|
||||
|
||||
QWidget *embeddedMouseGrabberPtr = (QWidget *)embeddedMouseGrabber;
|
||||
QApplicationPrivate::sendMouseEvent(receiver, &mouseEvent, alienWidget, widget,
|
||||
|
@ -53,6 +53,7 @@
|
||||
#include <qstyleditemdelegate.h>
|
||||
#include <private/qabstractitemview_p.h>
|
||||
#include <private/qabstractitemmodel_p.h>
|
||||
#include <private/qguiapplication_p.h>
|
||||
#ifndef QT_NO_ACCESSIBILITY
|
||||
#include <qaccessible.h>
|
||||
#endif
|
||||
@ -1885,6 +1886,7 @@ void QAbstractItemView::mouseDoubleClickEvent(QMouseEvent *event)
|
||||
QMouseEvent me(QEvent::MouseButtonPress,
|
||||
event->localPos(), event->windowPos(), event->screenPos(),
|
||||
event->button(), event->buttons(), event->modifiers());
|
||||
QGuiApplicationPrivate::setMouseEventSource(&me, event->source());
|
||||
mousePressEvent(&me);
|
||||
return;
|
||||
}
|
||||
|
@ -619,6 +619,8 @@ public:
|
||||
|
||||
QOpenGLContext *shareContext() const;
|
||||
|
||||
virtual QObject *focusObject() { return 0; }
|
||||
|
||||
#ifndef QT_NO_OPENGL
|
||||
virtual GLuint textureId() const { return 0; }
|
||||
virtual QImage grabFramebuffer() { return QImage(); }
|
||||
|
@ -957,9 +957,12 @@ void QWidgetBackingStore::sync(QWidget *exposedWidget, const QRegion &exposedReg
|
||||
static void findTextureWidgetsRecursively(QWidget *tlw, QWidget *widget, QPlatformTextureList *widgetTextures)
|
||||
{
|
||||
QWidgetPrivate *wd = QWidgetPrivate::get(widget);
|
||||
if (wd->renderToTexture)
|
||||
widgetTextures->appendTexture(wd->textureId(), QRect(widget->mapTo(tlw, QPoint()), widget->size()),
|
||||
widget->testAttribute(Qt::WA_AlwaysStackOnTop));
|
||||
if (wd->renderToTexture) {
|
||||
QPlatformTextureList::Flags flags = 0;
|
||||
if (widget->testAttribute(Qt::WA_AlwaysStackOnTop))
|
||||
flags |= QPlatformTextureList::StacksOnTop;
|
||||
widgetTextures->appendTexture(widget, wd->textureId(), QRect(widget->mapTo(tlw, QPoint()), widget->size()), flags);
|
||||
}
|
||||
|
||||
for (int i = 0; i < wd->children.size(); ++i) {
|
||||
QWidget *w = qobject_cast<QWidget *>(wd->children.at(i));
|
||||
@ -1150,28 +1153,20 @@ void QWidgetBackingStore::doSync()
|
||||
}
|
||||
|
||||
#ifndef QT_NO_OPENGL
|
||||
// There is something other dirty than the renderToTexture widgets.
|
||||
// Now it is time to include the renderToTexture ones among the others.
|
||||
if (widgetTextures && widgetTextures->count()) {
|
||||
for (int i = 0; i < widgetTextures->count(); ++i) {
|
||||
const QRect rect = widgetTextures->geometry(i); // mapped to the tlw already
|
||||
dirty += rect;
|
||||
toClean += rect;
|
||||
QWidget *w = widgetTextures->widget(i);
|
||||
if (dirtyRenderToTextureWidgets.contains(w)) {
|
||||
const QRect rect = widgetTextures->geometry(i); // mapped to the tlw already
|
||||
dirty += rect;
|
||||
toClean += rect;
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
// The dirtyRenderToTextureWidgets list is useless here, so just reset. As
|
||||
// unintuitive as it is, we need to send paint events to renderToTexture
|
||||
// widgets always when something (any widget) needs to be updated, even if
|
||||
// the renderToTexture widget itself is clean, i.e. there was no update()
|
||||
// call for it. This is because changing any widget will cause a flush and
|
||||
// so a potentially blocking buffer swap for the window, and skipping paints
|
||||
// for the renderToTexture widgets would make it impossible to have smoothly
|
||||
// animated content in them.
|
||||
for (int i = 0; i < dirtyRenderToTextureWidgets.count(); ++i)
|
||||
resetWidget(dirtyRenderToTextureWidgets.at(i));
|
||||
dirtyRenderToTextureWidgets.clear();
|
||||
#endif
|
||||
|
||||
#ifndef QT_NO_GRAPHICSVIEW
|
||||
if (tlw->d_func()->extra->proxyWidget) {
|
||||
|
@ -147,6 +147,12 @@ QObject *QWidgetWindow::focusObject() const
|
||||
if (!widget)
|
||||
widget = m_widget;
|
||||
|
||||
if (widget) {
|
||||
QObject *focusObj = QWidgetPrivate::get(widget)->focusObject();
|
||||
if (focusObj)
|
||||
return focusObj;
|
||||
}
|
||||
|
||||
return widget;
|
||||
}
|
||||
|
||||
|
@ -879,6 +879,10 @@ static QSize qt_aqua_get_known_size(QStyle::ContentsType ct, const QWidget *widg
|
||||
gbi.size = sz == QAquaSizeSmall ? kHIThemeGrowBoxSizeSmall : kHIThemeGrowBoxSizeNormal;
|
||||
if (HIThemeGetGrowBoxBounds(&p, &gbi, &r) == noErr) {
|
||||
int width = 0;
|
||||
#ifndef QT_NO_MDIAREA
|
||||
if (widg && qobject_cast<QMdiSubWindow *>(widg->parentWidget()))
|
||||
width = r.size.width;
|
||||
#endif
|
||||
ret = QSize(width, r.size.height);
|
||||
}
|
||||
}
|
||||
|
@ -40,6 +40,7 @@
|
||||
#include "qgraphicssceneevent.h"
|
||||
#include "qgraphicsview.h"
|
||||
#include "qscroller.h"
|
||||
#include "private/qapplication_p.h"
|
||||
#include "private/qevent_p.h"
|
||||
#include "private/qflickgesture_p.h"
|
||||
#include "qdebug.h"
|
||||
@ -65,7 +66,9 @@ static QMouseEvent *copyMouseEvent(QEvent *e)
|
||||
case QEvent::MouseButtonRelease:
|
||||
case QEvent::MouseMove: {
|
||||
QMouseEvent *me = static_cast<QMouseEvent *>(e);
|
||||
return new QMouseEvent(me->type(), QPoint(0, 0), me->windowPos(), me->screenPos(), me->button(), me->buttons(), me->modifiers());
|
||||
QMouseEvent *cme = new QMouseEvent(me->type(), QPoint(0, 0), me->windowPos(), me->screenPos(), me->button(), me->buttons(), me->modifiers());
|
||||
QGuiApplicationPrivate::setMouseEventSource(cme, me->source());
|
||||
return cme;
|
||||
}
|
||||
#ifndef QT_NO_GRAPHICSVIEW
|
||||
case QEvent::GraphicsSceneMousePress:
|
||||
@ -75,7 +78,9 @@ static QMouseEvent *copyMouseEvent(QEvent *e)
|
||||
#if 1
|
||||
QEvent::Type met = me->type() == QEvent::GraphicsSceneMousePress ? QEvent::MouseButtonPress :
|
||||
(me->type() == QEvent::GraphicsSceneMouseRelease ? QEvent::MouseButtonRelease : QEvent::MouseMove);
|
||||
return new QMouseEvent(met, QPoint(0, 0), QPoint(0, 0), me->screenPos(), me->button(), me->buttons(), me->modifiers());
|
||||
QMouseEvent *cme = new QMouseEvent(met, QPoint(0, 0), QPoint(0, 0), me->screenPos(), me->button(), me->buttons(), me->modifiers());
|
||||
QGuiApplicationPrivate::setMouseEventSource(cme, me->source());
|
||||
return cme;
|
||||
#else
|
||||
QGraphicsSceneMouseEvent *copy = new QGraphicsSceneMouseEvent(me->type());
|
||||
copy->setPos(me->pos());
|
||||
@ -113,6 +118,7 @@ private:
|
||||
, sendingEvent(false)
|
||||
, mouseButton(Qt::NoButton)
|
||||
, mouseTarget(0)
|
||||
, mouseEventSource(Qt::MouseEventNotSynthesized)
|
||||
{ }
|
||||
|
||||
static PressDelayHandler *inst;
|
||||
@ -148,6 +154,7 @@ public:
|
||||
pressDelayTimer = startTimer(delay);
|
||||
mouseTarget = QApplication::widgetAt(pressDelayEvent->globalPos());
|
||||
mouseButton = pressDelayEvent->button();
|
||||
mouseEventSource = pressDelayEvent->source();
|
||||
qFGDebug() << "QFG: consuming/delaying mouse press";
|
||||
} else {
|
||||
qFGDebug() << "QFG: NOT consuming/delaying mouse press";
|
||||
@ -234,6 +241,7 @@ public:
|
||||
QMouseEvent re(QEvent::MouseButtonRelease, QPoint(), farFarAway, farFarAway,
|
||||
mouseButton, QApplication::mouseButtons() & ~mouseButton,
|
||||
QApplication::keyboardModifiers());
|
||||
QGuiApplicationPrivate::setMouseEventSource(&re, mouseEventSource);
|
||||
sendMouseEvent(&re, RegrabMouseAfterwards);
|
||||
// don't clear the mouseTarget just yet, since we need to explicitly ungrab the mouse on release!
|
||||
}
|
||||
@ -284,6 +292,7 @@ protected:
|
||||
QMouseEvent copy(me->type(), mouseTarget->mapFromGlobal(me->globalPos()),
|
||||
mouseTarget->topLevelWidget()->mapFromGlobal(me->globalPos()), me->screenPos(),
|
||||
me->button(), me->buttons(), me->modifiers());
|
||||
QGuiApplicationPrivate::setMouseEventSource(©, me->source());
|
||||
qt_sendSpontaneousEvent(mouseTarget, ©);
|
||||
}
|
||||
|
||||
@ -309,6 +318,7 @@ private:
|
||||
bool sendingEvent;
|
||||
Qt::MouseButton mouseButton;
|
||||
QPointer<QWidget> mouseTarget;
|
||||
Qt::MouseEventSource mouseEventSource;
|
||||
};
|
||||
|
||||
|
||||
|
@ -1111,6 +1111,7 @@ bool QMenuPrivate::mouseEventTaken(QMouseEvent *e)
|
||||
if(e->type() != QEvent::MouseButtonRelease || mouseDown == caused) {
|
||||
QMouseEvent new_e(e->type(), cpos, caused->mapTo(caused->topLevelWidget(), cpos), e->screenPos(),
|
||||
e->button(), e->buttons(), e->modifiers());
|
||||
QGuiApplicationPrivate::setMouseEventSource(&new_e, e->source());
|
||||
QApplication::sendEvent(caused, &new_e);
|
||||
return true;
|
||||
}
|
||||
|
@ -791,7 +791,7 @@ void tst_QImageReader::animatedGif()
|
||||
}
|
||||
}
|
||||
|
||||
// http://bugreports.qt-project.org/browse/QTBUG-6696
|
||||
// QTBUG-6696
|
||||
// Check the count of images in various call orders...
|
||||
void tst_QImageReader::gifImageCount()
|
||||
{
|
||||
|
@ -155,6 +155,7 @@ public:
|
||||
void reset()
|
||||
{
|
||||
m_received.clear();
|
||||
m_framePositionsOnMove.clear();
|
||||
}
|
||||
|
||||
bool event(QEvent *event)
|
||||
@ -170,6 +171,9 @@ public:
|
||||
m_surfaceventType = static_cast<QPlatformSurfaceEvent *>(event)->surfaceEventType();
|
||||
break;
|
||||
|
||||
case QEvent::Move:
|
||||
m_framePositionsOnMove << framePosition();
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
@ -197,6 +201,7 @@ public:
|
||||
return m_surfaceventType;
|
||||
}
|
||||
|
||||
QVector<QPoint> m_framePositionsOnMove;
|
||||
private:
|
||||
QHash<QEvent::Type, int> m_received;
|
||||
QVector<QEvent::Type> m_order;
|
||||
@ -321,9 +326,17 @@ void tst_QWindow::positioning()
|
||||
QPoint framePos = QPlatformScreen::platformScreenForWindow(&window)->availableGeometry().center();
|
||||
|
||||
window.reset();
|
||||
const QPoint oldFramePos = window.framePosition();
|
||||
window.setFramePosition(framePos);
|
||||
|
||||
QTRY_VERIFY(window.received(QEvent::Move));
|
||||
if (window.framePosition() != framePos) {
|
||||
qDebug() << "About to fail auto-test. Here is some additional information:";
|
||||
qDebug() << "window.framePosition() == " << window.framePosition();
|
||||
qDebug() << "old frame position == " << oldFramePos;
|
||||
qDebug() << "We received " << window.received(QEvent::Move) << " move events";
|
||||
qDebug() << "frame positions after each move event:" << window.m_framePositionsOnMove;
|
||||
}
|
||||
QTRY_COMPARE(framePos, window.framePosition());
|
||||
QTRY_COMPARE(originalMargins, window.frameMargins());
|
||||
QCOMPARE(window.position(), window.framePosition() + QPoint(originalMargins.left(), originalMargins.top()));
|
||||
|
@ -116,6 +116,7 @@ private slots:
|
||||
void boundingRectForSetLineWidth();
|
||||
void glyphLessItems();
|
||||
void justifyTrailingSpaces();
|
||||
void layoutWithCustomTabStops();
|
||||
|
||||
// QTextLine stuff
|
||||
void setNumColumnsWrapAtWordBoundaryOrAnywhere();
|
||||
@ -2050,5 +2051,38 @@ void tst_QTextLayout::nbsp()
|
||||
layout.endLayout();
|
||||
}
|
||||
|
||||
void tst_QTextLayout::layoutWithCustomTabStops()
|
||||
{
|
||||
QScopedPointer<QTextLayout> textLayout(new QTextLayout);
|
||||
QList<QTextOption::Tab> tabStops;
|
||||
|
||||
const int tabWidth = 18;
|
||||
const int maxTabPos = 2500;
|
||||
for (int tabPos = tabWidth; tabPos < maxTabPos; tabPos += tabWidth)
|
||||
tabStops << QTextOption::Tab(tabPos, QTextOption::LeftTab);
|
||||
|
||||
QTextOption textOption;
|
||||
textOption.setTabs(tabStops);
|
||||
textLayout->setTextOption(textOption);
|
||||
|
||||
textLayout->setText(QStringLiteral("\ta aa aa aa aa aa aa"));
|
||||
|
||||
textLayout->beginLayout();
|
||||
textLayout->createLine();
|
||||
textLayout->endLayout();
|
||||
|
||||
qreal shortWidth = textLayout->maximumWidth();
|
||||
|
||||
textLayout->setText(QStringLiteral("\ta aa aa aa aa aa aa aa aa aa aa aa aa a"));
|
||||
|
||||
textLayout->beginLayout();
|
||||
textLayout->createLine();
|
||||
textLayout->endLayout();
|
||||
|
||||
qreal longWidth = textLayout->maximumWidth();
|
||||
|
||||
QVERIFY(longWidth > shortWidth);
|
||||
}
|
||||
|
||||
QTEST_MAIN(tst_QTextLayout)
|
||||
#include "tst_qtextlayout.moc"
|
||||
|
@ -2,6 +2,8 @@
|
||||
osx
|
||||
[ioGetFromBuiltinHttp:https+limited]
|
||||
osx
|
||||
[ioGetFromHttpBrokenServer:no-newline]
|
||||
osx
|
||||
[synchronousRequest:https]
|
||||
osx
|
||||
[SslHandshakeFailedError]
|
||||
|
@ -7290,7 +7290,7 @@ void tst_QNetworkReply::synchronousRequest()
|
||||
// workaround for HTTPS requests: add self-signed server cert to list of CA certs,
|
||||
// since we cannot react to the sslErrors() signal
|
||||
// to fix this properly we would need to have an ignoreSslErrors() method in the
|
||||
// QNetworkRequest, see http://bugreports.qt-project.org/browse/QTBUG-14774
|
||||
// QNetworkRequest, see QTBUG-14774
|
||||
if (url.scheme() == "https") {
|
||||
QSslConfiguration sslConf;
|
||||
QList<QSslCertificate> certs = QSslCertificate::fromPath(testDataDir + "/certs/qt-test-server-cacert.pem");
|
||||
|
@ -47,7 +47,7 @@ private slots:
|
||||
void tst_QNetworkConfigurationManager::staticsInitialization()
|
||||
{
|
||||
// This code should not crash. The test was introduced as
|
||||
// a fix for https://bugreports.qt-project.org/browse/QTBUG-36897
|
||||
// a fix for QTBUG-36897
|
||||
for (int i = 0; i < 2; i++)
|
||||
{
|
||||
int argc = 1;
|
||||
|
@ -195,7 +195,7 @@ void tst_QGLBuffer::testBuffer(QGLBuffer::Type type)
|
||||
void tst_QGLBuffer::bufferSharing()
|
||||
{
|
||||
#if defined(Q_OS_WIN)
|
||||
// Needs investigation on Windows: https://bugreports.qt-project.org/browse/QTBUG-29692
|
||||
// Needs investigation on Windows: QTBUG-29692
|
||||
QSKIP("Unreproducible timeout on Windows (MSVC/MinGW) CI bots");
|
||||
#endif
|
||||
|
||||
|
@ -139,4 +139,24 @@ save
|
||||
setClipPath clip
|
||||
setPen black
|
||||
repeat_block text_drawing
|
||||
restore
|
||||
|
||||
translate 150 0
|
||||
save
|
||||
setPen black
|
||||
setFont "sansserif" 10 normal
|
||||
drawText 0 20 "testing glyph cache textures"
|
||||
|
||||
# Important that this gradient doesn't match any earlier
|
||||
# gradients, so that it's not cached from before.
|
||||
gradient_clearStops
|
||||
gradient_appendStop 0 blue
|
||||
gradient_appendStop 0.5 #00ff00
|
||||
gradient_appendStop 1 red
|
||||
gradient_setLinear 0 0 100 0
|
||||
setPen nopen
|
||||
drawRect 0 30 100 20
|
||||
|
||||
setPen black
|
||||
drawText 0 70 "testing glyph cache textures"
|
||||
restore
|
@ -735,7 +735,7 @@ void tst_QPrinter::customPaperNameSettingBySize()
|
||||
// Fail with the original values
|
||||
if (!paperNameFound) {
|
||||
qDebug() << "supportedPageSizes() = " << sizes;
|
||||
QEXPECT_FAIL("", "Paper Name mismatch: please report this failure at bugreports.qt-project.org", Continue);
|
||||
QEXPECT_FAIL("", "Paper Name mismatch: please report this failure at bugreports.qt.io", Continue);
|
||||
QCOMPARE(sizes.at(i).name(), printer.paperName());
|
||||
}
|
||||
}
|
||||
|
@ -356,7 +356,7 @@ void tst_QScroller::scrollerProperties()
|
||||
void tst_QScroller::scrollTo()
|
||||
{
|
||||
#ifdef Q_OS_MAC
|
||||
QSKIP("Flakey test - https://bugreports.qt-project.org/browse/QTBUG-29950");
|
||||
QSKIP("Flakey test - QTBUG-29950");
|
||||
#endif
|
||||
{
|
||||
tst_QScrollerWidget *sw = new tst_QScrollerWidget();
|
||||
@ -385,7 +385,7 @@ void tst_QScroller::scrollTo()
|
||||
void tst_QScroller::scroll()
|
||||
{
|
||||
#ifdef Q_OS_MAC
|
||||
QSKIP("Flakey test - https://bugreports.qt-project.org/browse/QTBUG-30133");
|
||||
QSKIP("Flakey test - QTBUG-30133");
|
||||
#endif
|
||||
#ifndef QT_NO_GESTURES
|
||||
// -- good case. normal scroll
|
||||
@ -430,7 +430,7 @@ void tst_QScroller::scroll()
|
||||
void tst_QScroller::overshoot()
|
||||
{
|
||||
#ifdef Q_OS_MAC
|
||||
QSKIP("Flakey test - https://bugreports.qt-project.org/browse/QTBUG-29950");
|
||||
QSKIP("Flakey test - QTBUG-29950");
|
||||
#endif
|
||||
#ifndef QT_NO_GESTURES
|
||||
tst_QScrollerWidget *sw = new tst_QScrollerWidget();
|
||||
|
@ -34,6 +34,11 @@
|
||||
#include <QtWidgets/QOpenGLWidget>
|
||||
#include <QtGui/QOpenGLFunctions>
|
||||
#include <QtGui/QPainter>
|
||||
#include <QtWidgets/QGraphicsView>
|
||||
#include <QtWidgets/QGraphicsScene>
|
||||
#include <QtWidgets/QGraphicsRectItem>
|
||||
#include <QtWidgets/QVBoxLayout>
|
||||
#include <QtWidgets/QPushButton>
|
||||
#include <QtTest/QtTest>
|
||||
#include <QSignalSpy>
|
||||
|
||||
@ -49,6 +54,7 @@ private slots:
|
||||
void painter();
|
||||
void reparentToAlreadyCreated();
|
||||
void reparentToNotYetCreated();
|
||||
void asViewport();
|
||||
};
|
||||
|
||||
void tst_QOpenGLWidget::create()
|
||||
@ -253,6 +259,52 @@ void tst_QOpenGLWidget::reparentToNotYetCreated()
|
||||
QVERIFY(image.pixel(20, 10) == qRgb(0, 0, 255));
|
||||
}
|
||||
|
||||
class CountingGraphicsView : public QGraphicsView
|
||||
{
|
||||
public:
|
||||
CountingGraphicsView(): m_count(0) { }
|
||||
int paintCount() const { return m_count; }
|
||||
void resetPaintCount() { m_count = 0; }
|
||||
|
||||
protected:
|
||||
void drawForeground(QPainter *, const QRectF &) Q_DECL_OVERRIDE;
|
||||
int m_count;
|
||||
};
|
||||
|
||||
void CountingGraphicsView::drawForeground(QPainter *, const QRectF &)
|
||||
{
|
||||
++m_count;
|
||||
}
|
||||
|
||||
void tst_QOpenGLWidget::asViewport()
|
||||
{
|
||||
// Have a QGraphicsView with a QOpenGLWidget as its viewport.
|
||||
QGraphicsScene scene;
|
||||
scene.addItem(new QGraphicsRectItem(10, 10, 100, 100));
|
||||
CountingGraphicsView *view = new CountingGraphicsView;
|
||||
view->setScene(&scene);
|
||||
view->setViewport(new QOpenGLWidget);
|
||||
QWidget widget;
|
||||
QVBoxLayout *layout = new QVBoxLayout;
|
||||
layout->addWidget(view);
|
||||
QPushButton *btn = new QPushButton("Test");
|
||||
layout->addWidget(btn);
|
||||
widget.setLayout(layout);
|
||||
widget.show();
|
||||
QTest::qWaitForWindowExposed(&widget);
|
||||
|
||||
QVERIFY(view->paintCount() > 0);
|
||||
view->resetPaintCount();
|
||||
|
||||
// And now trigger a repaint on the push button. We must not
|
||||
// receive paint events for the graphics view. If we do, that's a
|
||||
// side effect of QOpenGLWidget's special behavior and handling in
|
||||
// the widget stack.
|
||||
btn->update();
|
||||
qApp->processEvents();
|
||||
QVERIFY(view->paintCount() == 0);
|
||||
}
|
||||
|
||||
QTEST_MAIN(tst_QOpenGLWidget)
|
||||
|
||||
#include "tst_qopenglwidget.moc"
|
||||
|
@ -151,7 +151,7 @@ void tst_QScrollBar::task_209492()
|
||||
#define WHEEL_DELTA 120 // copied from tst_QAbstractSlider / tst_QComboBox
|
||||
void tst_QScrollBar::QTBUG_27308()
|
||||
{
|
||||
// https://bugreports.qt-project.org/browse/QTBUG-27308
|
||||
// QTBUG-27308
|
||||
// Check that a disabled scrollbar doesn't react on wheel events anymore
|
||||
|
||||
QScrollBar testWidget(Qt::Horizontal);
|
||||
|
@ -59,7 +59,7 @@ void EventFilter::init(EventCategories eventCategories)
|
||||
<< QEvent::MouseButtonDblClick << QEvent::NonClientAreaMouseButtonPress
|
||||
<< QEvent::NonClientAreaMouseButtonRelease
|
||||
<< QEvent::NonClientAreaMouseButtonDblClick
|
||||
<< QEvent::Enter << QEvent::Leave;
|
||||
<< QEvent::Wheel << QEvent::Enter << QEvent::Leave;
|
||||
}
|
||||
if (eventCategories & MouseMoveEvents)
|
||||
m_eventTypes << QEvent::MouseMove << QEvent::NonClientAreaMouseMove;
|
||||
|
@ -1701,6 +1701,7 @@ void Configure::applySpecSpecifics()
|
||||
dictionary[ "QT_GETIFADDRS" ] = "no";
|
||||
dictionary[ "QT_XKBCOMMON" ] = "no";
|
||||
dictionary["ANDROID_STYLE_ASSETS"] = "yes";
|
||||
dictionary[ "STYLE_ANDROID" ] = "yes";
|
||||
}
|
||||
}
|
||||
|
||||
@ -2713,6 +2714,9 @@ void Configure::generateOutputVars()
|
||||
if (dictionary[ "STYLE_WINDOWSMOBILE" ] == "yes")
|
||||
qmakeStyles += "windowsmobile";
|
||||
|
||||
if (dictionary[ "STYLE_ANDROID" ] == "yes")
|
||||
qmakeStyles += "android";
|
||||
|
||||
// Databases ----------------------------------------------------
|
||||
if (dictionary[ "SQL_MYSQL" ] == "yes")
|
||||
qmakeSql += "mysql";
|
||||
|
Loading…
Reference in New Issue
Block a user