diff options
author | Frederik Gladhorn <frederik.gladhorn@digia.com> | 2013-06-12 19:17:07 +0200 |
---|---|---|
committer | Frederik Gladhorn <frederik.gladhorn@digia.com> | 2013-06-12 19:17:07 +0200 |
commit | e2776b44a0e0e34e5a1d851916a94f7db5e7bb7b (patch) | |
tree | 7c428c524aa1b8cc42d3a581a8c13378ebd341b5 /src | |
parent | 5c8aa27111fd51c8dff78fd0a276648aea08d4c1 (diff) | |
parent | af2f1e14f61ee8d3a4ade723aed9618d1707f975 (diff) |
Merge remote-tracking branch 'origin/stable' into dev
Conflicts:
src/plugins/platforms/cocoa/qcocoamenubar.mm
Change-Id: I4a699fc8a7f30b2af9de8e496c3d5f027b7495bb
Diffstat (limited to 'src')
52 files changed, 373 insertions, 211 deletions
diff --git a/src/corelib/global/global.pri b/src/corelib/global/global.pri index 6ac32cd35d..4084d4f2ad 100644 --- a/src/corelib/global/global.pri +++ b/src/corelib/global/global.pri @@ -29,6 +29,11 @@ SOURCES += \ # qlibraryinfo.cpp includes qconfig.cpp INCLUDEPATH += $$QT_BUILD_TREE/src/corelib/global +# configure creates these, not syncqt, so we need to manually inject them +targ_headers.files += \ + $$OUT_PWD/global/qconfig.h \ + $$QT_BUILD_TREE/include/QtCore/QtConfig + # Only used on platforms with CONFIG += precompile_header PRECOMPILED_HEADER = global/qt_pch.h diff --git a/src/corelib/io/qfsfileengine_win.cpp b/src/corelib/io/qfsfileengine_win.cpp index fca1a446ce..2b38019674 100644 --- a/src/corelib/io/qfsfileengine_win.cpp +++ b/src/corelib/io/qfsfileengine_win.cpp @@ -255,6 +255,7 @@ qint64 QFSFileEnginePrivate::nativeSize() const if (!filled) { thatQ->setError(QFile::UnspecifiedError, qt_error_string(errno)); + return 0; } return metaData.size(); } diff --git a/src/corelib/io/qsettings.cpp b/src/corelib/io/qsettings.cpp index a0904fea24..5b4d4ec0d8 100644 --- a/src/corelib/io/qsettings.cpp +++ b/src/corelib/io/qsettings.cpp @@ -2527,7 +2527,7 @@ void QConfFileSettingsPrivate::ensureSectionParsed(QConfFile *confFile, character in keys. In addition, if you save a top-level setting (a key with no slashes in it, e.g., "someKey"), it will appear in the INI file's "General" section. To avoid - overwriting other keys, if you save something using the a key + overwriting other keys, if you save something using a key such as "General/someKey", the key will be located in the "%General" section, \e not in the "General" section. diff --git a/src/corelib/io/qurlidna.cpp b/src/corelib/io/qurlidna.cpp index fac1703da8..5fa4b5f7a1 100644 --- a/src/corelib/io/qurlidna.cpp +++ b/src/corelib/io/qurlidna.cpp @@ -1468,11 +1468,12 @@ static void mapToLowerCase(QString *str, int from) int l = 1; while (l < 4 && entry->mapping[l]) ++l; - if (l > 1) { + if (l > 1 || uc > 0xffff) { if (uc <= 0xffff) str->replace(i, 1, reinterpret_cast<const QChar *>(&entry->mapping[0]), l); else - str->replace(i-1, 2, reinterpret_cast<const QChar *>(&entry->mapping[0]), l); + str->replace(--i, 2, reinterpret_cast<const QChar *>(&entry->mapping[0]), l); + i += l - 1; d = 0; } else { if (!d) @@ -1501,18 +1502,20 @@ static bool isMappedToNothing(uint uc) } -static void stripProhibitedOutput(QString *str, int from) +static bool containsProhibitedOuptut(const QString *str, int from) { - ushort *out = (ushort *)str->data() + from; - const ushort *in = out; + const ushort *in = reinterpret_cast<const ushort *>(str->begin() + from); const ushort *end = (ushort *)str->data() + str->size(); - while (in < end) { + for ( ; in < end; ++in) { uint uc = *in; if (QChar(uc).isHighSurrogate() && in < end - 1) { ushort low = *(in + 1); if (QChar(low).isLowSurrogate()) { ++in; uc = QChar::surrogateToUcs4(uc, low); + } else { + // unpaired surrogates are prohibited + return true; } } if (uc <= 0xFFFF) { @@ -1537,7 +1540,7 @@ static void stripProhibitedOutput(QString *str, int from) || (uc >= 0xFDD0 && uc <= 0xFDEF) || uc == 0xFEFF || (uc >= 0xFFF9 && uc <= 0xFFFF))) { - *out++ = *in; + continue; } } else { if (!((uc >= 0x1D173 && uc <= 0x1D17A) @@ -1561,14 +1564,12 @@ static void stripProhibitedOutput(QString *str, int from) || (uc >= 0xFFFFE && uc <= 0xFFFFF) || (uc >= 0x100000 && uc <= 0x10FFFD) || (uc >= 0x10FFFE && uc <= 0x10FFFF))) { - *out++ = QChar::highSurrogate(uc); - *out++ = QChar::lowSurrogate(uc); + continue; } } - ++in; + return true; } - if (in != out) - str->truncate(out - str->utf16()); + return false; } static bool isBidirectionalRorAL(uint uc) @@ -2028,7 +2029,7 @@ Q_AUTOTEST_EXPORT void qt_nameprep(QString *source, int from) for ( ; out < e; ++out) { register ushort uc = out->unicode(); - if (uc > 0x80) { + if (uc >= 0x80) { break; } else if (uc >= 'A' && uc <= 'Z') { *out = QChar(uc | 0x20); @@ -2065,8 +2066,8 @@ Q_AUTOTEST_EXPORT void qt_nameprep(QString *source, int from) if (uc <= 0xFFFF) { *out++ = *in; } else { - *out++ = QChar::highSurrogate(uc); - *out++ = QChar::lowSurrogate(uc); + *out++ = in[-1]; + *out++ = in[0]; } } } @@ -2083,7 +2084,10 @@ Q_AUTOTEST_EXPORT void qt_nameprep(QString *source, int from) firstNonAscii > from ? firstNonAscii - 1 : from); // Strip prohibited output - stripProhibitedOutput(source, firstNonAscii); + if (containsProhibitedOuptut(source, firstNonAscii)) { + source->resize(from); + return; + } // Check for valid bidirectional characters bool containsLCat = false; diff --git a/src/corelib/kernel/qmetatype.cpp b/src/corelib/kernel/qmetatype.cpp index 112ef747a3..16c28966ff 100644 --- a/src/corelib/kernel/qmetatype.cpp +++ b/src/corelib/kernel/qmetatype.cpp @@ -90,6 +90,7 @@ struct DefinedTypesFilter { /*! \macro Q_DECLARE_OPAQUE_POINTER(PointerType) \relates QMetaType + \since 5.0 This macro enables pointers to forward-declared types (\a PointerType) to be registered with QMetaType using either Q_DECLARE_METATYPE() diff --git a/src/corelib/kernel/qmetatype.h b/src/corelib/kernel/qmetatype.h index 5823584b46..6b9fd7d563 100644 --- a/src/corelib/kernel/qmetatype.h +++ b/src/corelib/kernel/qmetatype.h @@ -1822,8 +1822,8 @@ struct QMetaTypeId_ ## SMART_POINTER ## _QObjectStar<T, true> \ return id; \ const char * const cName = T::staticMetaObject.className(); \ QByteArray typeName; \ - typeName.reserve(sizeof(#SMART_POINTER) + 1 + strlen(cName) + 1); \ - typeName.append(#SMART_POINTER, sizeof(#SMART_POINTER) - 1) \ + typeName.reserve(int(sizeof(#SMART_POINTER) + 1 + strlen(cName) + 1)); \ + typeName.append(#SMART_POINTER, int(sizeof(#SMART_POINTER)) - 1) \ .append('<').append(cName).append('>'); \ const int newId = qRegisterNormalizedMetaType< SMART_POINTER<T> >( \ typeName, \ diff --git a/src/corelib/plugin/qfactoryloader.cpp b/src/corelib/plugin/qfactoryloader.cpp index 289fda7afc..61c9b40e83 100644 --- a/src/corelib/plugin/qfactoryloader.cpp +++ b/src/corelib/plugin/qfactoryloader.cpp @@ -121,6 +121,10 @@ void QFactoryLoader::update() d->loadedPaths << pluginDir; QString path = pluginDir + d->suffix; + + if (qt_debug_component()) + qDebug() << "QFactoryLoader::QFactoryLoader() checking directory path" << path << "..."; + if (!QDir(path).exists(QLatin1String("."))) continue; diff --git a/src/corelib/tools/qalgorithms.qdoc b/src/corelib/tools/qalgorithms.qdoc index 7c3aa1a3b2..f3dfddec77 100644 --- a/src/corelib/tools/qalgorithms.qdoc +++ b/src/corelib/tools/qalgorithms.qdoc @@ -33,7 +33,7 @@ \brief The <QtAlgorithms> header includes the generic, template-based algorithms. Qt provides a number of global template functions in \c - <QtAlgorithms> that work on containers and perform well-know + <QtAlgorithms> that work on containers and perform well-known algorithms. You can use these algorithms with any \l {container class} that provides STL-style iterators, including Qt's QList, QLinkedList, QVector, QMap, and QHash classes. diff --git a/src/corelib/tools/qarraydataops.h b/src/corelib/tools/qarraydataops.h index 3cd8c51c07..c8a0825480 100644 --- a/src/corelib/tools/qarraydataops.h +++ b/src/corelib/tools/qarraydataops.h @@ -62,7 +62,7 @@ struct QPodArrayOps Q_ASSERT(newSize <= this->alloc); ::memset(this->end(), 0, (newSize - this->size) * sizeof(T)); - this->size = newSize; + this->size = int(newSize); } void copyAppend(const T *b, const T *e) @@ -84,7 +84,7 @@ struct QPodArrayOps const T *const end = iter + n; for (; iter != end; ++iter) ::memcpy(iter, &t, sizeof(T)); - this->size += n; + this->size += int(n); } void truncate(size_t newSize) @@ -92,7 +92,7 @@ struct QPodArrayOps Q_ASSERT(!this->ref.isShared()); Q_ASSERT(newSize < size_t(this->size)); - this->size = newSize; + this->size = int(newSize); } void destroyAll() // Call from destructors, ONLY! diff --git a/src/corelib/tools/qbitarray.cpp b/src/corelib/tools/qbitarray.cpp index 4949476f25..54c1ff8843 100644 --- a/src/corelib/tools/qbitarray.cpp +++ b/src/corelib/tools/qbitarray.cpp @@ -123,7 +123,8 @@ QT_BEGIN_NAMESPACE */ QBitArray::QBitArray(int size, bool value) { - if (!size) { + Q_ASSERT_X(size >= 0, "QBitArray::QBitArray", "Size must be greater than or equal to 0."); + if (size <= 0) { d.resize(0); return; } diff --git a/src/corelib/tools/qregularexpression.cpp b/src/corelib/tools/qregularexpression.cpp index a50c7da6cc..a2a58f8926 100644 --- a/src/corelib/tools/qregularexpression.cpp +++ b/src/corelib/tools/qregularexpression.cpp @@ -1031,7 +1031,7 @@ void QRegularExpressionPrivate::getPatternInfo() */ class QPcreJitStackPointer { - Q_DISABLE_COPY(QPcreJitStackPointer); + Q_DISABLE_COPY(QPcreJitStackPointer) public: /*! diff --git a/src/corelib/tools/qsimd.cpp b/src/corelib/tools/qsimd.cpp index 97a64eb5bb..c81df7a6f2 100644 --- a/src/corelib/tools/qsimd.cpp +++ b/src/corelib/tools/qsimd.cpp @@ -240,14 +240,14 @@ inline quint64 _xgetbv(__int64) { return 0; } #endif static void xgetbv(uint in, uint &eax, uint &edx) { -#ifdef Q_OS_WIN - quint64 result = _xgetbv(in); - eax = result; - edx = result >> 32; -#elif defined(Q_CC_GNU) +#if defined(Q_CC_GNU) asm (".byte 0x0F, 0x01, 0xD0" // xgetbv instruction : "=a" (eax), "=d" (edx) : "c" (in)); +#elif defined(Q_OS_WIN) + quint64 result = _xgetbv(in); + eax = result; + edx = result >> 32; #endif } diff --git a/src/corelib/tools/qvarlengtharray.h b/src/corelib/tools/qvarlengtharray.h index 3a2028057d..825e05ae1b 100644 --- a/src/corelib/tools/qvarlengtharray.h +++ b/src/corelib/tools/qvarlengtharray.h @@ -197,6 +197,8 @@ private: template <class T, int Prealloc> Q_INLINE_TEMPLATE QVarLengthArray<T, Prealloc>::QVarLengthArray(int asize) : s(asize) { + Q_STATIC_ASSERT_X(Prealloc > 0, "QVarLengthArray Prealloc must be greater than 0."); + Q_ASSERT_X(s >= 0, "QVarLengthArray::QVarLengthArray()", "Size must be greater than or equal to 0."); if (s > Prealloc) { ptr = reinterpret_cast<T *>(malloc(s * sizeof(T))); Q_CHECK_PTR(ptr); diff --git a/src/corelib/tools/qvector.h b/src/corelib/tools/qvector.h index 816e1f15f6..489ee821b9 100644 --- a/src/corelib/tools/qvector.h +++ b/src/corelib/tools/qvector.h @@ -398,7 +398,8 @@ QVector<T> &QVector<T>::operator=(const QVector<T> &v) template <typename T> QVector<T>::QVector(int asize) { - if (Q_LIKELY(asize)) { + Q_ASSERT_X(asize >= 0, "QVector::QVector", "Size must be greater than or equal to 0."); + if (Q_LIKELY(asize > 0)) { d = Data::allocate(asize); d->size = asize; defaultConstruct(d->begin(), d->end()); @@ -410,7 +411,8 @@ QVector<T>::QVector(int asize) template <typename T> QVector<T>::QVector(int asize, const T &t) { - if (asize) { + Q_ASSERT_X(asize >= 0, "QVector::QVector", "Size must be greater than or equal to 0."); + if (asize > 0) { d = Data::allocate(asize); d->size = asize; T* i = d->end(); diff --git a/src/gui/kernel/qguiapplication.cpp b/src/gui/kernel/qguiapplication.cpp index 2a1d7e3bcc..3c3cea2910 100644 --- a/src/gui/kernel/qguiapplication.cpp +++ b/src/gui/kernel/qguiapplication.cpp @@ -782,12 +782,14 @@ static void init_platform(const QString &pluginArgument, const QString &platform QGuiApplicationPrivate::platform_name = new QString(name); } else { QStringList keys = QPlatformIntegrationFactory::keys(platformPluginPath); - QString fatalMessage = - QString::fromLatin1("Failed to load platform plugin \"%1\". Available platforms are: \n").arg(name); - foreach(const QString &key, keys) { - fatalMessage.append(key + QLatin1Char('\n')); - } - qFatal("%s", fatalMessage.toLocal8Bit().constData()); + + QString fatalMessage + = QStringLiteral("Failed to find or load platform plugin \"%1\".\n").arg(name); + if (!keys.isEmpty()) + fatalMessage += QStringLiteral("Available platforms are: %1\n").arg( + keys.join(QStringLiteral(", "))); + fatalMessage += QStringLiteral("GUI applications require a platform plugin. Terminating."); + qFatal(qPrintable(fatalMessage)); return; } @@ -2251,8 +2253,8 @@ void QGuiApplicationPrivate::processExposeEvent(QWindowSystemInterfacePrivate::E if (!p->receivedExpose) { if (p->resizeEventPending) { // as a convenience for plugins, send a resize event before the first expose event if they haven't done so - QSize size = p->geometry.size(); - QResizeEvent e(size, size); + // window->geometry() should have a valid size as soon as a handle exists. + QResizeEvent e(window->geometry().size(), p->geometry.size()); QGuiApplication::sendSpontaneousEvent(window, &e); p->resizeEventPending = false; diff --git a/src/gui/kernel/qopenglcontext_p.h b/src/gui/kernel/qopenglcontext_p.h index 8a36df3e7c..3cbcd1c06d 100644 --- a/src/gui/kernel/qopenglcontext_p.h +++ b/src/gui/kernel/qopenglcontext_p.h @@ -96,7 +96,7 @@ private: friend class QOpenGLContextGroupPrivate; friend class QOpenGLMultiGroupSharedResource; - Q_DISABLE_COPY(QOpenGLSharedResource); + Q_DISABLE_COPY(QOpenGLSharedResource) }; class Q_GUI_EXPORT QOpenGLSharedResourceGuard : public QOpenGLSharedResource diff --git a/src/gui/kernel/qwindowsysteminterface_p.h b/src/gui/kernel/qwindowsysteminterface_p.h index c4968f8ca6..398df0a96f 100644 --- a/src/gui/kernel/qwindowsysteminterface_p.h +++ b/src/gui/kernel/qwindowsysteminterface_p.h @@ -441,7 +441,7 @@ public: } } private: - Q_DISABLE_COPY(WindowSystemEventList); + Q_DISABLE_COPY(WindowSystemEventList) }; static WindowSystemEventList windowSystemEventQueue; diff --git a/src/gui/opengl/qopenglframebufferobject.cpp b/src/gui/opengl/qopenglframebufferobject.cpp index 8d6b05d0b4..90416db72b 100644 --- a/src/gui/opengl/qopenglframebufferobject.cpp +++ b/src/gui/opengl/qopenglframebufferobject.cpp @@ -1064,7 +1064,6 @@ QImage QOpenGLFramebufferObject::toImage() const /*! \fn bool QOpenGLFramebufferObject::bindDefault() - \internal Switches rendering back to the default, windowing system provided framebuffer. diff --git a/src/gui/opengl/qopengltextureglyphcache.cpp b/src/gui/opengl/qopengltextureglyphcache.cpp index 83f407575e..7d49c03f5b 100644 --- a/src/gui/opengl/qopengltextureglyphcache.cpp +++ b/src/gui/opengl/qopengltextureglyphcache.cpp @@ -147,6 +147,9 @@ void QOpenGLTextureGlyphCache::resizeTextureData(int width, int height) return; } + GLint oldFbo; + glGetIntegerv(GL_FRAMEBUFFER_BINDING, &oldFbo); + int oldWidth = m_textureResource->m_width; int oldHeight = m_textureResource->m_height; @@ -265,7 +268,7 @@ void QOpenGLTextureGlyphCache::resizeTextureData(int width, int height) glDeleteTextures(1, &tmp_texture); glDeleteTextures(1, &oldTexture); - funcs.glBindFramebuffer(GL_FRAMEBUFFER, ctx->d_func()->current_fbo); + funcs.glBindFramebuffer(GL_FRAMEBUFFER, (GLuint)oldFbo); if (pex != 0) { glViewport(0, 0, pex->width, pex->height); diff --git a/src/gui/text/qfontengine_ft.cpp b/src/gui/text/qfontengine_ft.cpp index 10225febcb..4545645dc6 100644 --- a/src/gui/text/qfontengine_ft.cpp +++ b/src/gui/text/qfontengine_ft.cpp @@ -1316,6 +1316,12 @@ void QFontEngineFT::doKerning(QGlyphLayout *g, QFontEngine::ShaperFlags flags) c unlockFace(); } } + + if (shouldUseDesignMetrics(flags) && !(fontDef.styleStrategy & QFont::ForceIntegerMetrics)) + flags |= DesignMetrics; + else + flags &= ~DesignMetrics; + QFontEngine::doKerning(g, flags); } @@ -1571,12 +1577,18 @@ bool QFontEngineFT::stringToCMap(const QChar *str, int len, QGlyphLayout *glyphs return true; } +bool QFontEngineFT::shouldUseDesignMetrics(QFontEngine::ShaperFlags flags) const +{ + if (!FT_IS_SCALABLE(freetype->face)) + return false; + + return default_hint_style == HintNone || default_hint_style == HintLight || (flags & DesignMetrics); +} + void QFontEngineFT::recalcAdvances(QGlyphLayout *glyphs, QFontEngine::ShaperFlags flags) const { FT_Face face = 0; - bool design = (default_hint_style == HintNone || - default_hint_style == HintLight || - (flags & DesignMetrics)) && FT_IS_SCALABLE(freetype->face); + bool design = shouldUseDesignMetrics(flags); for (int i = 0; i < glyphs->numGlyphs; i++) { Glyph *g = cacheEnabled ? defaultGlyphSet.getGlyph(glyphs->glyphs[i]) : 0; // Since we are passing Format_None to loadGlyph, use same default format logic as loadGlyph diff --git a/src/gui/text/qfontengine_ft_p.h b/src/gui/text/qfontengine_ft_p.h index 434eb76c33..e09fa6f94f 100644 --- a/src/gui/text/qfontengine_ft_p.h +++ b/src/gui/text/qfontengine_ft_p.h @@ -325,6 +325,7 @@ private: friend class QFontEngineMultiFontConfig; int loadFlags(QGlyphSet *set, GlyphFormat format, int flags, bool &hsubpixel, int &vfactor) const; + bool shouldUseDesignMetrics(ShaperFlags flags) const; GlyphFormat defaultFormat; FT_Matrix matrix; diff --git a/src/platformsupport/input/evdevtouch/qevdevtouch.cpp b/src/platformsupport/input/evdevtouch/qevdevtouch.cpp index 2c93da147e..5e493ac68c 100644 --- a/src/platformsupport/input/evdevtouch/qevdevtouch.cpp +++ b/src/platformsupport/input/evdevtouch/qevdevtouch.cpp @@ -125,6 +125,7 @@ public: bool m_forceToActiveWindow; QTouchDevice *m_device; bool m_typeB; + QTransform m_rotate; }; QEvdevTouchScreenData::QEvdevTouchScreenData(QEvdevTouchScreenHandler *q_ptr, const QStringList &args) @@ -177,10 +178,24 @@ QEvdevTouchScreenHandler::QEvdevTouchScreenHandler(const QString &specification, QStringList args = spec.split(QLatin1Char(':')); + int rotationAngle = 0; for (int i = 0; i < args.count(); ++i) { - if (args.at(i).startsWith(QLatin1String("/dev/"))) { + if (args.at(i).startsWith(QLatin1String("/dev/")) && dev.isEmpty()) { dev = args.at(i); - break; + } else if (args.at(i).startsWith(QLatin1String("rotate"))) { + QString rotateArg = args.at(i).section(QLatin1Char('='), 1, 1); + bool ok; + uint argValue = rotateArg.toUInt(&ok); + if (ok) { + switch (argValue) { + case 90: + case 180: + case 270: + rotationAngle = argValue; + default: + break; + } + } } } @@ -265,6 +280,9 @@ QEvdevTouchScreenHandler::QEvdevTouchScreenHandler(const QString &specification, #endif qDebug("Protocol type %c %s", d->m_typeB ? 'B' : 'A', mtdevStr); + if (rotationAngle) + d->m_rotate = QTransform::fromTranslate(0.5, 0.5).rotate(rotationAngle).translate(-0.5, -0.5); + d->registerDevice(); } @@ -421,6 +439,11 @@ void QEvdevTouchScreenData::processInputEvent(input_event *data) tp.normalPosition = QPointF((contact.x - hw_range_x_min) / qreal(hw_range_x_max - hw_range_x_min), (contact.y - hw_range_y_min) / qreal(hw_range_y_max - hw_range_y_min)); + if (!m_rotate.isIdentity()) + tp.normalPosition = m_rotate.map(tp.normalPosition); + + tp.rawPositions.append(QPointF(contact.x, contact.y)); + m_touchPoints.append(tp); if (contact.state == Qt::TouchPointReleased) @@ -513,9 +536,10 @@ void QEvdevTouchScreenData::reportPoints() QWindowSystemInterface::TouchPoint &tp(m_touchPoints[i]); // Generate a screen position that is always inside the active window - // or the primary screen. - const qreal wx = winRect.left() + tp.normalPosition.x() * winRect.width(); - const qreal wy = winRect.top() + tp.normalPosition.y() * winRect.height(); + // or the primary screen. Even though we report this as a QRectF, internally + // Qt uses QRect/QPoint so we need to bound the size to winRect.size() - QSize(1, 1) + const qreal wx = winRect.left() + tp.normalPosition.x() * (winRect.width() - 1); + const qreal wy = winRect.top() + tp.normalPosition.y() * (winRect.height() - 1); const qreal sizeRatio = (winRect.width() + winRect.height()) / qreal(hw_w + hw_h); if (tp.area.width() == -1) // touch major was not provided tp.area = QRectF(0, 0, 8, 8); diff --git a/src/plugins/bearer/connman/qconnmanservice_linux.cpp b/src/plugins/bearer/connman/qconnmanservice_linux.cpp index 4efecc5464..380cf92a24 100644 --- a/src/plugins/bearer/connman/qconnmanservice_linux.cpp +++ b/src/plugins/bearer/connman/qconnmanservice_linux.cpp @@ -74,7 +74,6 @@ const QDBusArgument &operator>>(const QDBusArgument &argument, ConnmanMap &map) return argument; } -static QDBusConnection dbusConnection = QDBusConnection::systemBus(); QConnmanManagerInterface::QConnmanManagerInterface( QObject *parent) : QDBusAbstractInterface(QLatin1String(CONNMAN_SERVICE), QLatin1String(CONNMAN_MANAGER_PATH), @@ -98,7 +97,7 @@ void QConnmanManagerInterface::connectNotify(const QMetaMethod &signal) QLatin1String(CONNMAN_MANAGER_INTERFACE), QLatin1String("PropertyChanged"), this,SIGNAL(propertyChanged(QString,QDBusVariant)))) { - qWarning() << "PropertyCHanged not connected"; + qWarning() << "PropertyChanged not connected"; } } @@ -118,7 +117,7 @@ void QConnmanManagerInterface::connectNotify(const QMetaMethod &signal) QConnmanDBusHelper *helper; helper = new QConnmanDBusHelper(this); - dbusConnection.connect(QLatin1String(CONNMAN_SERVICE), + QDBusConnection::systemBus().connect(QLatin1String(CONNMAN_SERVICE), QLatin1String(CONNMAN_MANAGER_PATH), QLatin1String(CONNMAN_MANAGER_INTERFACE), QLatin1String("PropertyChanged"), @@ -379,7 +378,7 @@ void QConnmanProfileInterface::connectNotify(const QMetaMethod &signal) { static const QMetaMethod propertyChangedSignal = QMetaMethod::fromSignal(&QConnmanProfileInterface::propertyChanged); if (signal == propertyChangedSignal) { - dbusConnection.connect(QLatin1String(CONNMAN_SERVICE), + QDBusConnection::systemBus().connect(QLatin1String(CONNMAN_SERVICE), this->path(), QLatin1String(CONNMAN_PROFILE_INTERFACE), QLatin1String("PropertyChanged"), @@ -449,7 +448,7 @@ void QConnmanServiceInterface::connectNotify(const QMetaMethod &signal) { static const QMetaMethod propertyChangedSignal = QMetaMethod::fromSignal(&QConnmanServiceInterface::propertyChanged); if (signal == propertyChangedSignal) { - dbusConnection.connect(QLatin1String(CONNMAN_SERVICE), + QDBusConnection::systemBus().connect(QLatin1String(CONNMAN_SERVICE), this->path(), QLatin1String(CONNMAN_SERVICE_INTERFACE), QLatin1String("PropertyChanged"), @@ -460,7 +459,7 @@ void QConnmanServiceInterface::connectNotify(const QMetaMethod &signal) QConnmanDBusHelper *helper; helper = new QConnmanDBusHelper(this); - dbusConnection.connect(QLatin1String(CONNMAN_SERVICE), + QDBusConnection::systemBus().connect(QLatin1String(CONNMAN_SERVICE), this->path(), QLatin1String(CONNMAN_SERVICE_INTERFACE), QLatin1String("PropertyChanged"), @@ -514,9 +513,6 @@ void QConnmanServiceInterface::remove() QDBusReply<QVariantMap> reply = this->call(QLatin1String("Remove")); } -// void moveBefore(QDBusObjectPath &service); -// void moveAfter(QDBusObjectPath &service); - // properties QString QConnmanServiceInterface::getState() { @@ -779,7 +775,7 @@ void QConnmanTechnologyInterface::connectNotify(const QMetaMethod &signal) { static const QMetaMethod propertyChangedSignal = QMetaMethod::fromSignal(&QConnmanTechnologyInterface::propertyChanged); if (signal == propertyChangedSignal) { - dbusConnection.connect(QLatin1String(CONNMAN_SERVICE), + QDBusConnection::systemBus().connect(QLatin1String(CONNMAN_SERVICE), this->path(), QLatin1String(CONNMAN_TECHNOLOGY_INTERFACE), QLatin1String("PropertyChanged"), @@ -790,7 +786,7 @@ void QConnmanTechnologyInterface::connectNotify(const QMetaMethod &signal) QConnmanDBusHelper *helper; helper = new QConnmanDBusHelper(this); - dbusConnection.connect(QLatin1String(CONNMAN_SERVICE), + QDBusConnection::systemBus().connect(QLatin1String(CONNMAN_SERVICE), this->path(), QLatin1String(CONNMAN_TECHNOLOGY_INTERFACE), QLatin1String("PropertyChanged"), @@ -861,23 +857,11 @@ QConnmanAgentInterface::~QConnmanAgentInterface() void QConnmanAgentInterface::connectNotify(const QMetaMethod &signal) { Q_UNUSED(signal); -// static const QMetaMethod propertyChangedSignal = QMetaMethod::fromSignal(&QConnmanAgentInterface::propertyChanged); -// if (signal == propertyChangedSignal) { -// dbusConnection.connect(QLatin1String(CONNMAN_SERVICE), -// this->path(), -// QLatin1String(CONNMAN_NETWORK_INTERFACE), -// QLatin1String("PropertyChanged"), -// this,SIGNAL(propertyChanged(QString,QVariant&))); -// } } void QConnmanAgentInterface::disconnectNotify(const QMetaMethod &signal) { Q_UNUSED(signal); -// static const QMetaMethod propertyChangedSignal = QMetaMethod::fromSignal(&QConnmanAgentInterface::propertyChanged); -// if (signal == propertyChangedSignal) { - -// } } @@ -889,10 +873,6 @@ void QConnmanAgentInterface::reportError(QDBusObjectPath &/*path*/, const QStrin { } -//dict QConnmanAgentInterface::requestInput(QDBusObjectPath &path, dict fields) -//{ -//} - void QConnmanAgentInterface::cancel() { } diff --git a/src/plugins/platforms/cocoa/qcocoaaccessibilityelement.mm b/src/plugins/platforms/cocoa/qcocoaaccessibilityelement.mm index f7c945c50d..55a23fda76 100644 --- a/src/plugins/platforms/cocoa/qcocoaaccessibilityelement.mm +++ b/src/plugins/platforms/cocoa/qcocoaaccessibilityelement.mm @@ -151,8 +151,7 @@ [kids addObject: element]; [element release]; } - // ### maybe we should use NSAccessibilityUnignoredChildren(kids); this needs more profiling - return kids; + return NSAccessibilityUnignoredChildren(kids); } else if ([attribute isEqualToString:NSAccessibilityFocusedAttribute]) { // Just check if the app thinks we're focused. @@ -272,8 +271,7 @@ // No child found, meaning we hit this element. if (!childInterface) { // qDebug() << "Hit test returns: " << id << iface; - return self; - //return NSAccessibilityUnignoredAncestor(self); + return NSAccessibilityUnignoredAncestor(self); } QAccessible::Id childId = QAccessible::uniqueId(childInterface); diff --git a/src/plugins/platforms/cocoa/qcocoadrag.mm b/src/plugins/platforms/cocoa/qcocoadrag.mm index 7dad4271b5..a37552d844 100644 --- a/src/plugins/platforms/cocoa/qcocoadrag.mm +++ b/src/plugins/platforms/cocoa/qcocoadrag.mm @@ -123,7 +123,7 @@ Qt::DropAction QCocoaDrag::drag(QDrag *o) if (pm.isNull()) pm = defaultPixmap(); - NSImage *nsimage = static_cast<NSImage *>(qt_mac_create_nsimage(pm)); + NSImage *nsimage = qt_mac_create_nsimage(pm); QMacPasteboard dragBoard((CFStringRef) NSDragPboard, QMacPasteboardMime::MIME_DND); m_drag->mimeData()->setData(QLatin1String("application/x-qt-mime-type-name"), QByteArray("dummy")); @@ -145,6 +145,8 @@ Qt::DropAction QCocoaDrag::drag(QDrag *o) source:m_lastView slideBack:YES]; + [nsimage release]; + m_drag = 0; return m_executed_drop_action; } diff --git a/src/plugins/platforms/cocoa/qcocoamenu.h b/src/plugins/platforms/cocoa/qcocoamenu.h index 9100b9b15f..7224ee2ff8 100644 --- a/src/plugins/platforms/cocoa/qcocoamenu.h +++ b/src/plugins/platforms/cocoa/qcocoamenu.h @@ -49,6 +49,8 @@ QT_BEGIN_NAMESPACE +class QCocoaMenuBar; + class QCocoaMenu : public QPlatformMenu { public: @@ -87,6 +89,8 @@ public: QList<QCocoaMenuItem *> items() const; QList<QCocoaMenuItem *> merged() const; + void setMenuBar(QCocoaMenuBar *menuBar); + QCocoaMenuBar *menuBar() const; private: QCocoaMenuItem *itemOrNull(int index) const; void insertNative(QCocoaMenuItem *item, QCocoaMenuItem *beforeItem); @@ -97,6 +101,7 @@ private: NSObject *m_delegate; bool m_enabled; quintptr m_tag; + QCocoaMenuBar *m_menuBar; }; QT_END_NAMESPACE diff --git a/src/plugins/platforms/cocoa/qcocoamenu.mm b/src/plugins/platforms/cocoa/qcocoamenu.mm index 08ae6c43bd..f6378d126f 100644 --- a/src/plugins/platforms/cocoa/qcocoamenu.mm +++ b/src/plugins/platforms/cocoa/qcocoamenu.mm @@ -217,7 +217,8 @@ QT_BEGIN_NAMESPACE QCocoaMenu::QCocoaMenu() : m_enabled(true), - m_tag(0) + m_tag(0), + m_menuBar(0) { m_delegate = [[QCocoaMenuDelegate alloc] initWithMenu:this]; m_nativeItem = [[NSMenuItem alloc] initWithTitle:@"" action:nil keyEquivalent:@""]; @@ -536,4 +537,14 @@ void QCocoaMenu::syncModalState(bool modal) } } +void QCocoaMenu::setMenuBar(QCocoaMenuBar *menuBar) +{ + m_menuBar = menuBar; +} + +QCocoaMenuBar *QCocoaMenu::menuBar() const +{ + return m_menuBar; +} + QT_END_NAMESPACE diff --git a/src/plugins/platforms/cocoa/qcocoamenubar.h b/src/plugins/platforms/cocoa/qcocoamenubar.h index 8086676cc5..7a1bda74a4 100644 --- a/src/plugins/platforms/cocoa/qcocoamenubar.h +++ b/src/plugins/platforms/cocoa/qcocoamenubar.h @@ -75,6 +75,8 @@ private: static QCocoaMenuBar *findGlobalMenubar(); bool shouldDisable(QCocoaWindow *active) const; + void insertNativeMenu(QCocoaMenu *menu, QCocoaMenu *beforeMenu); + void removeNativeMenu(QCocoaMenu *menu); QList<QCocoaMenu*> m_menus; NSMenu *m_nativeMenu; diff --git a/src/plugins/platforms/cocoa/qcocoamenubar.mm b/src/plugins/platforms/cocoa/qcocoamenubar.mm index 315f192ff8..52bfdfa385 100644 --- a/src/plugins/platforms/cocoa/qcocoamenubar.mm +++ b/src/plugins/platforms/cocoa/qcocoamenubar.mm @@ -83,9 +83,24 @@ QCocoaMenuBar::~QCocoaMenuBar() } } -void QCocoaMenuBar::insertMenu(QPlatformMenu *platformMenu, QPlatformMenu *before) +void QCocoaMenuBar::insertNativeMenu(QCocoaMenu *menu, QCocoaMenu *beforeMenu) { QCocoaAutoReleasePool pool; + + if (beforeMenu) { + NSUInteger nativeIndex = [m_nativeMenu indexOfItem:beforeMenu->nsMenuItem()]; + [m_nativeMenu insertItem: menu->nsMenuItem() atIndex: nativeIndex]; + } else { + [m_nativeMenu addItem: menu->nsMenuItem()]; + } + + menu->setMenuBar(this); + syncMenu(static_cast<QPlatformMenu *>(menu)); + [m_nativeMenu setSubmenu: menu->nsMenu() forItem: menu->nsMenuItem()]; +} + +void QCocoaMenuBar::insertMenu(QPlatformMenu *platformMenu, QPlatformMenu *before) +{ QCocoaMenu *menu = static_cast<QCocoaMenu *>(platformMenu); QCocoaMenu *beforeMenu = static_cast<QCocoaMenu *>(before); #ifdef QT_COCOA_ENABLE_MENU_DEBUG @@ -96,39 +111,36 @@ void QCocoaMenuBar::insertMenu(QPlatformMenu *platformMenu, QPlatformMenu *befor qWarning() << Q_FUNC_INFO << "This menu already belongs to the menubar, remove it first"; return; } - if (beforeMenu) { - if (!m_menus.contains(beforeMenu)) { - qWarning() << Q_FUNC_INFO << "The before menu does not belong to the menubar"; - return; - } - m_menus.insert(m_menus.indexOf(beforeMenu), menu); - NSUInteger nativeIndex = [m_nativeMenu indexOfItem:beforeMenu->nsMenuItem()]; - [m_nativeMenu insertItem: menu->nsMenuItem() atIndex: nativeIndex]; - } else { - m_menus.append(menu); - [m_nativeMenu addItem: menu->nsMenuItem()]; + + if (beforeMenu && !m_menus.contains(beforeMenu)) { + qWarning() << Q_FUNC_INFO << "The before menu does not belong to the menubar"; + return; } - platformMenu->setParent(this); - syncMenu(platformMenu); - [m_nativeMenu setSubmenu: menu->nsMenu() forItem: menu->nsMenuItem()]; + m_menus.insert(beforeMenu ? m_menus.indexOf(beforeMenu) : m_menus.size(), menu); + if (!menu->menuBar()) + insertNativeMenu(menu, beforeMenu); } -void QCocoaMenuBar::removeMenu(QPlatformMenu *platformMenu) +void QCocoaMenuBar::removeNativeMenu(QCocoaMenu *menu) { QCocoaAutoReleasePool pool; + if (menu->menuBar() == this) + menu->setMenuBar(0); + NSUInteger realIndex = [m_nativeMenu indexOfItem:menu->nsMenuItem()]; + [m_nativeMenu removeItemAtIndex: realIndex]; +} + +void QCocoaMenuBar::removeMenu(QPlatformMenu *platformMenu) +{ QCocoaMenu *menu = static_cast<QCocoaMenu *>(platformMenu); if (!m_menus.contains(menu)) { qWarning() << Q_FUNC_INFO << "Trying to remove a menu that does not belong to the menubar"; return; } m_menus.removeOne(menu); - - if (platformMenu->parent() == this) - platformMenu->setParent(0); - NSUInteger realIndex = [m_nativeMenu indexOfItem:menu->nsMenuItem()]; - [m_nativeMenu removeItemAtIndex: realIndex]; + removeNativeMenu(menu); } void QCocoaMenuBar::syncMenu(QPlatformMenu *menu) @@ -207,6 +219,20 @@ void QCocoaMenuBar::updateMenuBarImmediately() m->syncModalState(disableForModal); } + // reparent shared menu items if necessary. + // We browse the list in reverse order to be sure that the next items are redrawn before the current ones, + // in this way we are sure that "beforeMenu" (see below) is part of the native menu before "m" is redraw + for (int i = mb->m_menus.size() - 1; i >= 0; i--) { + QCocoaMenu *m = mb->m_menus.at(i); + QCocoaMenuBar *menuBar = m->menuBar(); + if (menuBar != mb) { + QCocoaMenu *beforeMenu = i < (mb->m_menus.size() - 1) ? mb->m_menus.at(i + 1) : 0; + if (menuBar) + menuBar->removeNativeMenu(m); + mb->insertNativeMenu(m, beforeMenu); + } + } + QCocoaMenuLoader *loader = getMenuLoader(); [loader ensureAppMenuInMenu:mb->nsMenu()]; diff --git a/src/plugins/platforms/cocoa/qcocoatheme.mm b/src/plugins/platforms/cocoa/qcocoatheme.mm index 31bbd63e36..5a5b2bc51f 100644 --- a/src/plugins/platforms/cocoa/qcocoatheme.mm +++ b/src/plugins/platforms/cocoa/qcocoatheme.mm @@ -283,7 +283,7 @@ QVariant QCocoaTheme::themeHint(ThemeHint hint) const sizes << 16 << 32 << 64 << 128; return QVariant::fromValue(sizes); } - case QPlatformTheme::PasswordMaskDelay: + case QPlatformTheme::PasswordMaskCharacter: return QVariant(QChar(kBulletUnicode)); default: break; diff --git a/src/plugins/platforms/cocoa/qnsviewaccessibility.mm b/src/plugins/platforms/cocoa/qnsviewaccessibility.mm index 6ebb1f6ba8..331a66417d 100644 --- a/src/plugins/platforms/cocoa/qnsviewaccessibility.mm +++ b/src/plugins/platforms/cocoa/qnsviewaccessibility.mm @@ -88,7 +88,7 @@ [element release]; } - return kids; + return NSAccessibilityUnignoredChildren(kids); } else { return [super accessibilityAttributeValue:attribute]; } diff --git a/src/plugins/platforms/eglfs/qeglfshooks_stub.cpp b/src/plugins/platforms/eglfs/qeglfshooks_stub.cpp index 91a97ff977..c334f46c2c 100644 --- a/src/plugins/platforms/eglfs/qeglfshooks_stub.cpp +++ b/src/plugins/platforms/eglfs/qeglfshooks_stub.cpp @@ -99,6 +99,7 @@ QSizeF QEglFSHooks::physicalScreenSize() const struct fb_var_screeninfo vinfo; int w = -1; int h = -1; + QSize screenResolution; if (framebuffer != -1) { if (ioctl(framebuffer, FBIOGET_VSCREENINFO, &vinfo) == -1) { @@ -106,12 +107,15 @@ QSizeF QEglFSHooks::physicalScreenSize() const } else { w = vinfo.width; h = vinfo.height; + screenResolution = QSize(vinfo.xres, vinfo.yres); } + } else { + screenResolution = screenSize(); } const int defaultPhysicalDpi = 100; - size.setWidth(w <= 0 ? vinfo.xres * Q_MM_PER_INCH / defaultPhysicalDpi : qreal(w)); - size.setHeight(h <= 0 ? vinfo.yres * Q_MM_PER_INCH / defaultPhysicalDpi : qreal(h)); + size.setWidth(w <= 0 ? screenResolution.width() * Q_MM_PER_INCH / defaultPhysicalDpi : qreal(w)); + size.setHeight(h <= 0 ? screenResolution.height() * Q_MM_PER_INCH / defaultPhysicalDpi : qreal(h)); if (w <= 0 || h <= 0) { qWarning("EGLFS: Unable to query physical screen size, defaulting to %d dpi.\n" diff --git a/src/plugins/platforms/eglfs/qeglfswindow.cpp b/src/plugins/platforms/eglfs/qeglfswindow.cpp index cd92a07f00..98c54e0ee0 100644 --- a/src/plugins/platforms/eglfs/qeglfswindow.cpp +++ b/src/plugins/platforms/eglfs/qeglfswindow.cpp @@ -68,11 +68,11 @@ QEglFSWindow::~QEglFSWindow() void QEglFSWindow::create() { - setWindowState(Qt::WindowFullScreen); - if (m_window) return; + setWindowState(Qt::WindowFullScreen); + if (window()->type() == Qt::Desktop) { QRect rect(QPoint(), QEglFSHooks::hooks()->screenSize()); QPlatformWindow::setGeometry(rect); diff --git a/src/plugins/platforms/qnx/qqnxwindow.cpp b/src/plugins/platforms/qnx/qqnxwindow.cpp index f7fc5de8d7..cd79ae73fd 100644 --- a/src/plugins/platforms/qnx/qqnxwindow.cpp +++ b/src/plugins/platforms/qnx/qqnxwindow.cpp @@ -77,7 +77,7 @@ QQnxWindow::QQnxWindow(QWindow *window, screen_context_t context) #endif m_screen(0), m_parentWindow(0), - m_visible(true), + m_visible(false), m_windowState(Qt::WindowNoState), m_requestedBufferSize(window->geometry().size()) { @@ -153,7 +153,6 @@ QQnxWindow::QQnxWindow(QWindow *window, screen_context_t context) if (window->parent() && window->parent()->handle()) setParent(window->parent()->handle()); setGeometryHelper(window->geometry()); - setVisible(window->isVisible()); } QQnxWindow::~QQnxWindow() @@ -272,6 +271,9 @@ void QQnxWindow::setVisible(bool visible) { qWindowDebug() << Q_FUNC_INFO << "window =" << window() << "visible =" << visible; + if (m_visible == visible) + return; + m_visible = visible; QQnxWindow *root = this; @@ -282,13 +284,13 @@ void QQnxWindow::setVisible(bool visible) window()->requestActivate(); - if (window()->isTopLevel()) { - QWindowSystemInterface::handleExposeEvent(window(), window()->geometry()); + QWindowSystemInterface::handleExposeEvent(window(), window()->geometry()); - if (!visible) { - // Flush the context, otherwise it won't disappear immediately - screen_flush_context(m_screenContext, 0); - } + if (visible) { + applyWindowState(); + } else { + // Flush the context, otherwise it won't disappear immediately + screen_flush_context(m_screenContext, 0); } } @@ -638,35 +640,10 @@ void QQnxWindow::setWindowState(Qt::WindowState state) if (m_windowState == state) return; - switch (state) { - - // WindowActive is not an accepted parameter according to the docs - case Qt::WindowActive: - return; - - case Qt::WindowMinimized: - minimize(); - - if (m_unmaximizedGeometry.isValid()) - setGeometry(m_unmaximizedGeometry); - else - setGeometry(m_screen->geometry()); - - break; - - case Qt::WindowMaximized: - case Qt::WindowFullScreen: - m_unmaximizedGeometry = geometry(); - setGeometry(state == Qt::WindowMaximized ? m_screen->availableGeometry() : m_screen->geometry()); - break; - - case Qt::WindowNoState: - if (m_unmaximizedGeometry.isValid()) - setGeometry(m_unmaximizedGeometry); - break; - } - m_windowState = state; + + if (m_visible) + applyWindowState(); } void QQnxWindow::gainedFocus() @@ -747,6 +724,37 @@ void QQnxWindow::updateZorder(int &topZorder) childWindow->updateZorder(topZorder); } +void QQnxWindow::applyWindowState() +{ + switch (m_windowState) { + + // WindowActive is not an accepted parameter according to the docs + case Qt::WindowActive: + return; + + case Qt::WindowMinimized: + minimize(); + + if (m_unmaximizedGeometry.isValid()) + setGeometry(m_unmaximizedGeometry); + else + setGeometry(m_screen->geometry()); + + break; + + case Qt::WindowMaximized: + case Qt::WindowFullScreen: + m_unmaximizedGeometry = geometry(); + setGeometry(m_windowState == Qt::WindowMaximized ? m_screen->availableGeometry() : m_screen->geometry()); + break; + + case Qt::WindowNoState: + if (m_unmaximizedGeometry.isValid()) + setGeometry(m_unmaximizedGeometry); + break; + } +} + void QQnxWindow::blitHelper(QQnxBuffer &source, QQnxBuffer &target, const QPoint &sourceOffset, const QPoint &targetOffset, const QRegion ®ion, bool flush) { diff --git a/src/plugins/platforms/qnx/qqnxwindow.h b/src/plugins/platforms/qnx/qqnxwindow.h index 4a327fd54b..63d5dc0979 100644 --- a/src/plugins/platforms/qnx/qqnxwindow.h +++ b/src/plugins/platforms/qnx/qqnxwindow.h @@ -124,6 +124,7 @@ private: void setOffset(const QPoint &setOffset); void updateVisibility(bool parentVisible); void updateZorder(int &topZorder); + void applyWindowState(); void fetchBuffers(); diff --git a/src/plugins/platforms/windows/qplatformfunctions_wince.h b/src/plugins/platforms/windows/qplatformfunctions_wince.h index 3190e39ec5..30fc66563e 100644 --- a/src/plugins/platforms/windows/qplatformfunctions_wince.h +++ b/src/plugins/platforms/windows/qplatformfunctions_wince.h @@ -74,6 +74,7 @@ #ifndef CWP_SKIPINVISIBLE #define CWP_SKIPINVISIBLE 0x0001 +#define CWP_SKIPTRANSPARENT 0x0004 #define findPlatformWindowAt(a, b, c) findPlatformWindowAt(a, b) #endif diff --git a/src/plugins/platforms/windows/qwindowsintegration.cpp b/src/plugins/platforms/windows/qwindowsintegration.cpp index 814892b43a..fc2ba454df 100644 --- a/src/plugins/platforms/windows/qwindowsintegration.cpp +++ b/src/plugins/platforms/windows/qwindowsintegration.cpp @@ -433,6 +433,9 @@ QPlatformWindow *QWindowsIntegration::createPlatformWindow(QWindow *window) cons return 0; if (requested.flags != obtained.flags) window->setFlags(obtained.flags); + // Trigger geometry change signals of QWindow. + if ((obtained.flags & Qt::Desktop) != Qt::Desktop && requested.geometry != obtained.geometry) + QWindowSystemInterface::handleGeometryChange(window, obtained.geometry); return new QWindowsWindow(window, obtained); } diff --git a/src/plugins/platforms/windows/qwindowsmousehandler.cpp b/src/plugins/platforms/windows/qwindowsmousehandler.cpp index 5c096b7eca..c6cfa4dbbc 100644 --- a/src/plugins/platforms/windows/qwindowsmousehandler.cpp +++ b/src/plugins/platforms/windows/qwindowsmousehandler.cpp @@ -232,8 +232,10 @@ bool QWindowsMouseHandler::translateMouseEvent(QWindow *window, HWND hwnd, } const QPoint globalPosition = QWindowsGeometryHint::mapToGlobal(hwnd, winEventPosition); + // In this context, neither an invisible nor a transparent window (transparent regarding mouse + // events, "click-through") can be considered as the window under mouse. QWindow *currentWindowUnderMouse = platformWindow->hasMouseCapture() ? - QWindowsScreen::windowAt(globalPosition) : window; + QWindowsScreen::windowAt(globalPosition, CWP_SKIPINVISIBLE | CWP_SKIPTRANSPARENT) : window; compressMouseMove(&msg); // Qt expects the platform plugin to capture the mouse on diff --git a/src/plugins/platforms/xcb/qxcbxsettings.cpp b/src/plugins/platforms/xcb/qxcbxsettings.cpp index 7ffd3e105f..c106bd00f8 100644 --- a/src/plugins/platforms/xcb/qxcbxsettings.cpp +++ b/src/plugins/platforms/xcb/qxcbxsettings.cpp @@ -214,23 +214,37 @@ QXcbXSettings::QXcbXSettings(QXcbScreen *screen) QByteArray settings_atom_for_screen("_XSETTINGS_S"); settings_atom_for_screen.append(QByteArray::number(screen->screenNumber())); xcb_intern_atom_cookie_t atom_cookie = xcb_intern_atom(screen->xcb_connection(), - false, + true, settings_atom_for_screen.length(), settings_atom_for_screen.constData()); - xcb_intern_atom_reply_t *atom_reply = xcb_intern_atom_reply(screen->xcb_connection(),atom_cookie,NULL); + xcb_generic_error_t *error = 0; + xcb_intern_atom_reply_t *atom_reply = xcb_intern_atom_reply(screen->xcb_connection(),atom_cookie,&error); + if (error) { + qWarning() << Q_FUNC_INFO << "Failed to find XSETTINGS_S atom"; + return; + } xcb_atom_t selection_owner_atom = atom_reply->atom; free(atom_reply); xcb_get_selection_owner_cookie_t selection_cookie = xcb_get_selection_owner(screen->xcb_connection(), selection_owner_atom); + xcb_get_selection_owner_reply_t *selection_result = - xcb_get_selection_owner_reply(screen->xcb_connection(), selection_cookie, NULL); + xcb_get_selection_owner_reply(screen->xcb_connection(), selection_cookie, &error); + if (error) { + qWarning() << Q_FUNC_INFO << "Failed to get selection owner for XSETTINGS_S atom"; + return; + } d_ptr->x_settings_window = selection_result->owner; + if (!d_ptr->x_settings_window) { + return; + } free(selection_result); + const uint32_t event = XCB_CW_EVENT_MASK; const uint32_t event_mask[] = { XCB_EVENT_MASK_STRUCTURE_NOTIFY|XCB_EVENT_MASK_PROPERTY_CHANGE }; - xcb_change_window_attributes(screen->xcb_connection(),d_ptr->x_settings_window,XCB_CW_EVENT_MASK,event_mask); + xcb_change_window_attributes(screen->xcb_connection(),d_ptr->x_settings_window,event,event_mask); d_ptr->populateSettings(d_ptr->getSettings()); } diff --git a/src/tools/qdoc/config.cpp b/src/tools/qdoc/config.cpp index 107af96607..273cb60d7d 100644 --- a/src/tools/qdoc/config.cpp +++ b/src/tools/qdoc/config.cpp @@ -1089,7 +1089,7 @@ QStringList Config::getFilesHere(const QString& uncleanDir, const QSet<QString> &excludedDirs, const QSet<QString> &excludedFiles) { - QString dir = location.isEmpty() ? QDir::cleanPath(uncleanDir) : Location::canonicalRelativePath(uncleanDir); + QString dir = location.isEmpty() ? QDir::cleanPath(uncleanDir) : QDir(uncleanDir).canonicalPath(); QStringList result; if (excludedDirs.contains(dir)) return result; diff --git a/src/tools/qdoc/cppcodeparser.cpp b/src/tools/qdoc/cppcodeparser.cpp index dc086c853d..d0f3ab3667 100644 --- a/src/tools/qdoc/cppcodeparser.cpp +++ b/src/tools/qdoc/cppcodeparser.cpp @@ -207,10 +207,10 @@ void CppCodeParser::parseSourceFile(const Location& location, const QString& fil readToken(); /* - The set of active namespaces is cleared before parsing + The set of open namespaces is cleared before parsing each source file. The word "source" here means cpp file. */ - activeNamespaces_.clear(); + qdb_->clearOpenNamespaces(); matchDocsAndStuff(); in.close(); @@ -323,21 +323,18 @@ Node* CppCodeParser::processTopicCommand(const Doc& doc, doc.startLocation().warning(tr("Invalid syntax in '\\%1'").arg(COMMAND_FN)); } else { - if (!activeNamespaces_.isEmpty()) { - foreach (const QString& usedNamespace_, activeNamespaces_) { - QStringList newPath = usedNamespace_.split("::") + parentPath; - func = qdb_->findFunctionNode(newPath, clone); - if (func) - break; - } - } - // Search the root namespace if no match was found. - if (func == 0) + func = qdb_->findNodeInOpenNamespace(parentPath, clone); + /* + Search the root namespace if no match was found. + */ + if (func == 0) { func = qdb_->findFunctionNode(parentPath, clone); + } if (func == 0) { - if (parentPath.isEmpty() && !lastPath_.isEmpty()) + if (parentPath.isEmpty() && !lastPath_.isEmpty()) { func = qdb_->findFunctionNode(lastPath_, clone); + } if (func == 0) { doc.location().warning(tr("Cannot find '%1' in '\\%2' %3") .arg(clone->name() + "(...)") @@ -426,16 +423,7 @@ Node* CppCodeParser::processTopicCommand(const Doc& doc, C++ namespace, search for it first in all the known C++ namespaces. */ - if (!activeNamespaces_.isEmpty()) { - foreach (const QString& usedNamespace_, activeNamespaces_) { - QStringList newPath = usedNamespace_.split("::") + path; - node = qdb_->findNodeByNameAndType(newPath, type, subtype); - if (node) { - path = newPath; - break; - } - } - } + node = qdb_->findNodeInOpenNamespace(path, type, subtype); /* If the node was not found in a C++ namespace, search @@ -458,7 +446,7 @@ Node* CppCodeParser::processTopicCommand(const Doc& doc, if (path.size() > 1) { path.pop_back(); QString ns = path.join("::"); - activeNamespaces_.insert(ns); + qdb_->insertOpenNamespace(ns); } } return node; @@ -1718,7 +1706,7 @@ bool CppCodeParser::matchUsingDecl() /* So far, so good. We have 'using namespace Foo;'. */ - activeNamespaces_.insert(name); + qdb_->insertOpenNamespace(name); return true; } @@ -2125,13 +2113,7 @@ bool CppCodeParser::matchDocsAndStuff() FunctionNode *func = 0; if (matchFunctionDecl(0, &parentPath, &clone, QString(), extra)) { - foreach (const QString& usedNamespace_, activeNamespaces_) { - QStringList newPath = usedNamespace_.split("::") + parentPath; - func = qdb_->findFunctionNode(newPath, clone); - if (func) { - break; - } - } + func = qdb_->findNodeInOpenNamespace(parentPath, clone); if (func == 0) func = qdb_->findFunctionNode(parentPath, clone); @@ -2256,9 +2238,8 @@ bool CppCodeParser::makeFunctionNode(const QString& signature, Tokenizer* outerTokenizer = tokenizer; int outerTok = tok; - Location loc; QByteArray latin1 = signature.toLatin1(); - Tokenizer stringTokenizer(loc, latin1); + Tokenizer stringTokenizer(location(), latin1); stringTokenizer.setParsingFnOrMacro(true); tokenizer = &stringTokenizer; readToken(); diff --git a/src/tools/qdoc/cppcodeparser.h b/src/tools/qdoc/cppcodeparser.h index eae5d1e97d..957142712b 100644 --- a/src/tools/qdoc/cppcodeparser.h +++ b/src/tools/qdoc/cppcodeparser.h @@ -166,7 +166,6 @@ protected: QStringList lastPath_; QRegExp varComment; QRegExp sep; - QSet<QString> activeNamespaces_; private: QString sequentialIteratorDefinition; diff --git a/src/tools/qdoc/htmlgenerator.cpp b/src/tools/qdoc/htmlgenerator.cpp index 7e1467f300..3d6f04decf 100644 --- a/src/tools/qdoc/htmlgenerator.cpp +++ b/src/tools/qdoc/htmlgenerator.cpp @@ -1755,12 +1755,12 @@ void HtmlGenerator::generateHeader(const QString& title, if (shortVersion.count(QChar('.')) == 2) shortVersion.truncate(shortVersion.lastIndexOf(QChar('.'))); if (!project.isEmpty()) - shortVersion = project + QLatin1Char(' ') + shortVersion + QLatin1String(": "); + shortVersion = QLatin1String(" | ") + project + QLatin1Char(' ') + shortVersion; else - shortVersion = QLatin1String("Qt ") + shortVersion + QLatin1String(": "); + shortVersion = QLatin1String(" | ") + QLatin1String("Qt ") + shortVersion ; // Generating page title - out() << " <title>" << shortVersion << protectEnc(title) << "</title>\n"; + out() << " <title>" << protectEnc(title) << shortVersion << "</title>\n"; // Include style sheet and script links. out() << headerStyles; diff --git a/src/tools/qdoc/puredocparser.cpp b/src/tools/qdoc/puredocparser.cpp index aba17d79b1..d11ef3a3c7 100644 --- a/src/tools/qdoc/puredocparser.cpp +++ b/src/tools/qdoc/puredocparser.cpp @@ -101,10 +101,10 @@ void PureDocParser::parseSourceFile(const Location& location, const QString& fil readToken(); /* - The set of active namespaces is cleared before parsing + The set of open namespaces is cleared before parsing each source file. The word "source" here means cpp file. */ - activeNamespaces_.clear(); + qdb_->clearOpenNamespaces(); processQdocComments(); in.close(); diff --git a/src/tools/qdoc/qdocdatabase.cpp b/src/tools/qdoc/qdocdatabase.cpp index 674917f6dc..7a3df4e4f2 100644 --- a/src/tools/qdoc/qdocdatabase.cpp +++ b/src/tools/qdoc/qdocdatabase.cpp @@ -1126,4 +1126,56 @@ QString QDocDatabase::refForAtom(const Atom* atom) return QString(); } +/*! + If there are open namespaces, search for the function node + having the same function name as the \a clone node in each + open namespace. The \a parentPath is a portion of the path + name provided with the function name at the point of + reference. \a parentPath is usually a class name. Return + the pointer to the function node if one is found in an + open namespace. Otherwise return 0. + + This open namespace concept is of dubious value and might + be removed. + */ +FunctionNode* QDocDatabase::findNodeInOpenNamespace(const QStringList& parentPath, + const FunctionNode* clone) +{ + FunctionNode* fn = 0; + if (!openNamespaces_.isEmpty()) { + foreach (const QString& t, openNamespaces_) { + QStringList path = t.split("::") + parentPath; + fn = findFunctionNode(path, clone); + if (fn) + break; + } + } + return fn; +} + +/*! + Find a node of the specified \a type and \a subtype that is + reached with the specified \a path. If such a node is found + in an open namespace, prefix \a path with the name of the + open namespace and "::" and return a pointer to the node. + Othewrwise return 0. + */ +Node* QDocDatabase::findNodeInOpenNamespace(QStringList& path, + Node::Type type, + Node::SubType subtype) +{ + Node* n = 0; + if (!openNamespaces_.isEmpty()) { + foreach (const QString& t, openNamespaces_) { + QStringList p = t.split("::") + path; + n = findNodeByNameAndType(p, type, subtype); + if (n) { + path = p; + break; + } + } + } + return n; +} + QT_END_NAMESPACE diff --git a/src/tools/qdoc/qdocdatabase.h b/src/tools/qdoc/qdocdatabase.h index d97fb3809a..d88160ee56 100644 --- a/src/tools/qdoc/qdocdatabase.h +++ b/src/tools/qdoc/qdocdatabase.h @@ -196,6 +196,11 @@ class QDocDatabase Generator* g, bool generateInternalNodes = false); + void clearOpenNamespaces() { openNamespaces_.clear(); } + void insertOpenNamespace(const QString& path) { openNamespaces_.insert(path); } + FunctionNode* findNodeInOpenNamespace(const QStringList& parentPath, const FunctionNode* clone); + Node* findNodeInOpenNamespace(QStringList& path, Node::Type type, Node::SubType subtype); + /* debugging functions */ void printModules() const; void printQmlModules() const; @@ -240,6 +245,7 @@ class QDocDatabase TextToNodeMap legaleseTexts_; DocNodeMultiMap docNodesByTitle_; TargetRecMultiMap targetRecMultiMap_; + QSet<QString> openNamespaces_; }; QT_END_NAMESPACE diff --git a/src/tools/qdoc/tree.cpp b/src/tools/qdoc/tree.cpp index 1efab11a92..553c569ae9 100644 --- a/src/tools/qdoc/tree.cpp +++ b/src/tools/qdoc/tree.cpp @@ -367,7 +367,11 @@ const FunctionNode* Tree::findFunctionNode(const QStringList& parentPath, const Node* relative, int findFlags) const { - const Node* parent = findNode(parentPath, relative, findFlags); + const Node* parent = findNamespaceNode(parentPath); + if (parent == 0) + parent = findClassNode(parentPath, 0); + if (parent == 0) + parent = findNode(parentPath, relative, findFlags); if (parent == 0 || !parent->isInnerNode()) return 0; return ((InnerNode*)parent)->findFunctionNode(clone); @@ -658,7 +662,7 @@ Node* Tree::findNodeRecursive(const QStringList& path, Node* start, Node::Type type, Node::SubType subtype, - bool acceptCollision) + bool acceptCollision) const { if (!start || path.isEmpty()) return 0; // no place to start, or nothing to search for. @@ -736,7 +740,7 @@ EnumNode* Tree::findEnumNode(const QStringList& path, Node* start) at the root of the tree. Only a C++ class node named \a path is acceptible. If one is not found, 0 is returned. */ -ClassNode* Tree::findClassNode(const QStringList& path, Node* start) +ClassNode* Tree::findClassNode(const QStringList& path, Node* start) const { if (!start) start = const_cast<NamespaceNode*>(root()); @@ -748,7 +752,7 @@ ClassNode* Tree::findClassNode(const QStringList& path, Node* start) the root of the tree. Only a Namespace node named \a path is acceptible. If one is not found, 0 is returned. */ -NamespaceNode* Tree::findNamespaceNode(const QStringList& path) +NamespaceNode* Tree::findNamespaceNode(const QStringList& path) const { Node* start = const_cast<NamespaceNode*>(root()); return static_cast<NamespaceNode*>(findNodeRecursive(path, 0, start, Node::Namespace, Node::NoSubType)); diff --git a/src/tools/qdoc/tree.h b/src/tools/qdoc/tree.h index 67cd3a9752..e44b8d7d12 100644 --- a/src/tools/qdoc/tree.h +++ b/src/tools/qdoc/tree.h @@ -82,9 +82,9 @@ class Tree ~Tree(); EnumNode* findEnumNode(const QStringList& path, Node* start = 0); - ClassNode* findClassNode(const QStringList& path, Node* start = 0); + ClassNode* findClassNode(const QStringList& path, Node* start = 0) const; QmlClassNode* findQmlTypeNode(const QStringList& path); - NamespaceNode* findNamespaceNode(const QStringList& path); + NamespaceNode* findNamespaceNode(const QStringList& path) const; DocNode* findQmlModuleNode(const QStringList& path, Node* start = 0); Node* findNodeByNameAndType(const QStringList& path, @@ -98,7 +98,7 @@ class Tree Node* start, Node::Type type, Node::SubType subtype, - bool acceptCollision = false); + bool acceptCollision = false) const; const Node* findNode(const QStringList &path, const Node* relative = 0, diff --git a/src/tools/uic/qclass_lib_map.h b/src/tools/uic/qclass_lib_map.h index 6859cd0cd4..cedefb801a 100644 --- a/src/tools/uic/qclass_lib_map.h +++ b/src/tools/uic/qclass_lib_map.h @@ -587,8 +587,8 @@ QT_CLASS_LIB(QFontDialog, QtWidgets, qfontdialog.h) QT_CLASS_LIB(QInputDialog, QtWidgets, qinputdialog.h) QT_CLASS_LIB(QMessageBox, QtWidgets, qmessagebox.h) QT_CLASS_LIB(QPageSetupDialog, QtWidgets, qpagesetupdialog.h) -QT_CLASS_LIB(QPrintDialog, QtWidgets, qprintdialog.h) -QT_CLASS_LIB(QPrintPreviewDialog, QtWidgets, qprintpreviewdialog.h) +QT_CLASS_LIB(QPrintDialog, QtPrintSupport, qprintdialog.h) +QT_CLASS_LIB(QPrintPreviewDialog, QtPrintSupport, qprintpreviewdialog.h) QT_CLASS_LIB(QProgressDialog, QtWidgets, qprogressdialog.h) QT_CLASS_LIB(QWizard, QtWidgets, qwizard.h) QT_CLASS_LIB(QWizardPage, QtWidgets, qwizard.h) @@ -944,7 +944,7 @@ QT_CLASS_LIB(QMenuBar, QtWidgets, qmenubar.h) QT_CLASS_LIB(QMenuItem, QtWidgets, qmenudata.h) QT_CLASS_LIB(QPlainTextEdit, QtWidgets, qplaintextedit.h) QT_CLASS_LIB(QPlainTextDocumentLayout, QtWidgets, qplaintextedit.h) -QT_CLASS_LIB(QPrintPreviewWidget, QtWidgets, qprintpreviewwidget.h) +QT_CLASS_LIB(QPrintPreviewWidget, QtPrintSupport, qprintpreviewwidget.h) QT_CLASS_LIB(QProgressBar, QtWidgets, qprogressbar.h) QT_CLASS_LIB(QPushButton, QtWidgets, qpushbutton.h) QT_CLASS_LIB(QRadioButton, QtWidgets, qradiobutton.h) diff --git a/src/widgets/dialogs/qdialog.cpp b/src/widgets/dialogs/qdialog.cpp index a76c88dc5e..2cda99a269 100644 --- a/src/widgets/dialogs/qdialog.cpp +++ b/src/widgets/dialogs/qdialog.cpp @@ -150,12 +150,11 @@ void QDialogPrivate::deletePlatformHelper() provide a \l{#return}{return value}, and they can have \l{#default}{default buttons}. QDialogs can also have a QSizeGrip in their lower-right corner, using setSizeGripEnabled(). - Note that QDialog (an any other widget that has type Qt::Dialog) uses - the parent widget slightly differently from other classes in Qt. A - dialog is always a top-level widget, but if it has a parent, its - default location is centered on top of the parent's top-level widget - (if it is not top-level itself). It will also share the parent's - taskbar entry. + Note that QDialog (and any other widget that has type \c Qt::Dialog) uses + the parent widget slightly differently from other classes in Qt. A dialog is + always a top-level widget, but if it has a parent, its default location is + centered on top of the parent's top-level widget (if it is not top-level + itself). It will also share the parent's taskbar entry. Use the overload of the QWidget::setParent() function to change the ownership of a QDialog widget. This function allows you to diff --git a/src/widgets/styles/qcommonstyle.cpp b/src/widgets/styles/qcommonstyle.cpp index e601110c3e..61a823569e 100644 --- a/src/widgets/styles/qcommonstyle.cpp +++ b/src/widgets/styles/qcommonstyle.cpp @@ -5004,7 +5004,7 @@ int QCommonStyle::styleHint(StyleHint sh, const QStyleOption *opt, const QWidget case SH_ItemView_ActivateItemOnSingleClick: ret = 0; if (const QPlatformTheme *theme = QGuiApplicationPrivate::platformTheme()) - ret = theme->themeHint(QPlatformTheme::ToolButtonStyle).toBool() ? 1 : 0; + ret = theme->themeHint(QPlatformTheme::ItemViewActivateItemOnSingleClick).toBool() ? 1 : 0; break; case SH_TitleBar_ModifyNotification: ret = true; diff --git a/src/widgets/widgets/qdockwidget.cpp b/src/widgets/widgets/qdockwidget.cpp index a3c331aa2b..ae931deb16 100644 --- a/src/widgets/widgets/qdockwidget.cpp +++ b/src/widgets/widgets/qdockwidget.cpp @@ -1259,6 +1259,9 @@ void QDockWidget::setFloating(bool floating) d->endDrag(true); QRect r = d->undockedGeometry; + // Keep position when undocking for the first time. + if (floating && isVisible() && !r.isValid()) + r = QRect(mapToGlobal(QPoint(0, 0)), size()); d->setWindowState(floating, false, floating ? r : QRect()); |