From 03a40d3a46b078f6cf516e5a42ef2e11a5366a20 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Tue, 27 Jan 2015 16:58:53 +0100 Subject: Revert "Windows: Fix call of ToUnicode" This reverts commit dfe853bff90444edf92a993e391df853780c9e8d. When using cyrillic or other keyboard layouts, standard shortcuts like CTRL-C are still supposed to work as if the US keyboard layout were in effect. Task-number: QTBUG-44021 Task-number: QTBUG-35734 Change-Id: If6cd96a1e03e62900b293f8e304e523460e85810 Reviewed-by: Joerg Bornemann --- src/plugins/platforms/windows/qwindowskeymapper.cpp | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) (limited to 'src') diff --git a/src/plugins/platforms/windows/qwindowskeymapper.cpp b/src/plugins/platforms/windows/qwindowskeymapper.cpp index d781cdbe9c..4b1d1112d5 100644 --- a/src/plugins/platforms/windows/qwindowskeymapper.cpp +++ b/src/plugins/platforms/windows/qwindowskeymapper.cpp @@ -537,16 +537,15 @@ static inline int toKeyOrUnicode(int vk, int scancode, unsigned char *kbdBuffer, Q_ASSERT(vk > 0 && vk < 256); int code = 0; QChar unicodeBuffer[5]; - // While key combinations containing alt and ctrl might trigger the third assignment of a key - // (for example "alt+ctrl+q" causes '@' on a German layout), ToUnicode often does not return the - // wanted character if only the ctrl modifier is used. Thus we unset this modifier temporarily - // if it is not used together with alt. - const unsigned char controlState = kbdBuffer[VK_MENU] ? 0 : kbdBuffer[VK_CONTROL]; - if (controlState) - kbdBuffer[VK_CONTROL] = 0; int res = ToUnicode(vk, scancode, kbdBuffer, reinterpret_cast(unicodeBuffer), 5, 0); - if (controlState) + // When Ctrl modifier is used ToUnicode does not return correct values. In order to assign the + // right key the control modifier is removed for just that function if the previous call failed. + if (res == 0 && kbdBuffer[VK_CONTROL]) { + const unsigned char controlState = kbdBuffer[VK_CONTROL]; + kbdBuffer[VK_CONTROL] = 0; + res = ToUnicode(vk, scancode, kbdBuffer, reinterpret_cast(unicodeBuffer), 5, 0); kbdBuffer[VK_CONTROL] = controlState; + } if (res) code = unicodeBuffer[0].toUpper().unicode(); -- cgit v1.2.3 From 4b707d3bde53dd6dd4c01a51c12f096faefbc5b2 Mon Sep 17 00:00:00 2001 From: Andreas Holzammer Date: Fri, 23 Jan 2015 13:50:07 +0100 Subject: WINCE: Fix special case for toplevel It looks like that WindowFromPoint does not return same handle each time, hence he then is in a endless loop. We don't need to look for a child in a loop here for Windows Embedded Compact. Task-number: QTBUG-44073 Change-Id: Ic42d56616b29f293d187111588fde3947c15659c Reviewed-by: Friedemann Kleint --- src/plugins/platforms/windows/qwindowscontext.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'src') diff --git a/src/plugins/platforms/windows/qwindowscontext.cpp b/src/plugins/platforms/windows/qwindowscontext.cpp index ffa7f82d8e..99ba5463bf 100644 --- a/src/plugins/platforms/windows/qwindowscontext.cpp +++ b/src/plugins/platforms/windows/qwindowscontext.cpp @@ -675,6 +675,8 @@ static inline bool findPlatformWindowHelper(const POINT &screenPoint, unsigned c #ifndef Q_OS_WINCE const HWND child = ChildWindowFromPointEx(*hwnd, point, cwexFlags); #else +// Under Windows CE we don't use ChildWindowFromPointEx as it's not available +// and ChildWindowFromPoint does not work properly. Q_UNUSED(cwexFlags) const HWND child = WindowFromPoint(point); #endif @@ -683,7 +685,13 @@ static inline bool findPlatformWindowHelper(const POINT &screenPoint, unsigned c if (QWindowsWindow *window = context->findPlatformWindow(child)) { *result = window; *hwnd = child; +#ifndef Q_OS_WINCE return true; +#else +// WindowFromPoint does not return same handle in two sequential calls, which leads +// to an endless loop, but calling WindowFromPoint once is good enough. + return false; +#endif } #ifndef Q_OS_WINCE // Does not have WS_EX_TRANSPARENT . // QTBUG-40555: despite CWP_SKIPINVISIBLE, it is possible to hit on invisible -- cgit v1.2.3 From 8172fe46472614d4ecf6fce03ae5c5f706820cd7 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Thu, 22 Jan 2015 08:24:34 -0800 Subject: Correct the version of ICC that has the constexpr bug fixed 01fc82e3574614762d2ce061dd45ce4995c79e7f updated the code for ICC 15, but it needs to be 15.0.1 Change-Id: Iba8d819ab9174d9dac07ffff13bbc26b9be46d53 Reviewed-by: Olivier Goffart (Woboq GmbH) --- src/corelib/global/qcompilerdetection.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/corelib/global/qcompilerdetection.h b/src/corelib/global/qcompilerdetection.h index 3f813e163b..7be4ed8bef 100644 --- a/src/corelib/global/qcompilerdetection.h +++ b/src/corelib/global/qcompilerdetection.h @@ -557,7 +557,10 @@ # define Q_COMPILER_UNRESTRICTED_UNIONS # endif # if __INTEL_COMPILER >= 1500 -# define Q_COMPILER_CONSTEXPR +# if __INTEL_COMPILER * 100 + __INTEL_COMPILER_UPDATE >= 150001 +// the bug mentioned above is fixed in 15.0.1 +# define Q_COMPILER_CONSTEXPR +# endif # define Q_COMPILER_ALIGNAS # define Q_COMPILER_ALIGNOF # define Q_COMPILER_INHERITING_CONSTRUCTORS -- cgit v1.2.3 From 012a7ab91212db105fc43db9aa89b92d70052f1b Mon Sep 17 00:00:00 2001 From: Maurice Kalinowski Date: Thu, 29 Jan 2015 13:33:30 +0100 Subject: WinRT: Fix access to style hint instead of theme hint You need to specify explicitly the styleHint enum instead of the theming one, which is where we want to forward to. This caused all clicks to be ignored in case there is a listener to pressAndHold as the hold period is reduced to 0 milliseconds. Task-number: QTBUG-44196 Change-Id: I30d1771b91b5fa358e896e8441ade965543d4613 Reviewed-by: Friedemann Kleint Reviewed-by: Andrew Knight --- src/plugins/platforms/winrt/qwinrttheme.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/plugins/platforms/winrt/qwinrttheme.cpp b/src/plugins/platforms/winrt/qwinrttheme.cpp index f64b47960a..e2857683f8 100644 --- a/src/plugins/platforms/winrt/qwinrttheme.cpp +++ b/src/plugins/platforms/winrt/qwinrttheme.cpp @@ -232,7 +232,7 @@ QVariant QWinRTTheme::styleHint(QPlatformIntegration::StyleHint hint) return false; case QPlatformIntegration::ShowIsMaximized: return false; - case MousePressAndHoldInterval: + case QPlatformIntegration::MousePressAndHoldInterval: return defaultThemeHint(MousePressAndHoldInterval); default: break; -- cgit v1.2.3 From 8e0f56280ab6fd869faf1650edd454883f4d035f Mon Sep 17 00:00:00 2001 From: Allan Sandfeld Jensen Date: Tue, 27 Jan 2015 16:36:10 +0100 Subject: Fix Qt over VNC with broken VisualInfo It appears some VNC servers reports incorrect masks in their visuals. This patch recognizes this unlikely set of masks and interprets it as RGB16 which VNC expects. Task-number: QTBUG-44147 Change-Id: Ia374edcd5f0a5ce0188157ac1d328f888cfa260c Reviewed-by: Shawn Rutledge Reviewed-by: Laszlo Agocs --- src/plugins/platforms/xcb/qxcbwindow.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'src') diff --git a/src/plugins/platforms/xcb/qxcbwindow.cpp b/src/plugins/platforms/xcb/qxcbwindow.cpp index 4fd71f1635..00942787d9 100644 --- a/src/plugins/platforms/xcb/qxcbwindow.cpp +++ b/src/plugins/platforms/xcb/qxcbwindow.cpp @@ -215,6 +215,18 @@ static inline QImage::Format imageFormatForVisual(int depth, quint32 red_mask, q break; } qWarning("Unsupported screen format: depth: %d, red_mask: %x, blue_mask: %x", depth, red_mask, blue_mask); + + switch (depth) { + case 24: + qWarning("Using RGB32 fallback, if this works your X11 server is reporting a bad screen format."); + return QImage::Format_RGB32; + case 16: + qWarning("Using RGB16 fallback, if this works your X11 server is reporting a bad screen format."); + return QImage::Format_RGB16; + default: + break; + } + return QImage::Format_Invalid; } -- cgit v1.2.3 From 5f6bbce4beb32bc6bc1e06f92cde56c48f946558 Mon Sep 17 00:00:00 2001 From: Kai Koehne Date: Mon, 26 Jan 2015 15:21:12 +0100 Subject: Fix memory leak in qSetMessagePattern We were leaking memory in case setPattern was called multiple times Task-number: QTBUG-43893 Change-Id: Icd9c214edea064aeaeb6f92a9c62836238ccd344 Reviewed-by: Marc Mutz --- src/corelib/global/qlogging.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/corelib/global/qlogging.cpp b/src/corelib/global/qlogging.cpp index 50d35a6d84..86ba082398 100644 --- a/src/corelib/global/qlogging.cpp +++ b/src/corelib/global/qlogging.cpp @@ -866,7 +866,7 @@ QMessagePattern::QMessagePattern() QMessagePattern::~QMessagePattern() { - for (int i = 0; literals[i] != 0; ++i) + for (int i = 0; literals[i]; ++i) delete [] literals[i]; delete [] literals; literals = 0; @@ -876,8 +876,12 @@ QMessagePattern::~QMessagePattern() void QMessagePattern::setPattern(const QString &pattern) { + if (literals) { + for (int i = 0; literals[i]; ++i) + delete [] literals[i]; + delete [] literals; + } delete [] tokens; - delete [] literals; // scanner QList lexemes; -- cgit v1.2.3 From 8c3ae221e60ae9b15ed5b942c18a52c2c0f3014f Mon Sep 17 00:00:00 2001 From: Maurice Kalinowski Date: Fri, 16 Jan 2015 11:29:54 +0100 Subject: WinRT: Gracefully exit an application While it is not recommended by Microsoft to manually exit an application, currently applications just hang when exiting main(). Instead when QCoreApplication::exit() is called use the CoreApplication to properly invoke native Exit() and let the application completely shut down. Add a warning to notify developer about this non-standard behavior, as usually the system is supposed to take care of suspending and closing. Certification still passes for Windows RT and Windows Phone. Task-number: QTBUG-43862 Change-Id: Ia34443ea75daaaeca0bee2a0c9fcc568c0659262 Reviewed-by: Friedemann Kleint --- src/corelib/kernel/qcoreapplication.cpp | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'src') diff --git a/src/corelib/kernel/qcoreapplication.cpp b/src/corelib/kernel/qcoreapplication.cpp index ca3d92bad1..6b0ebf8b8b 100644 --- a/src/corelib/kernel/qcoreapplication.cpp +++ b/src/corelib/kernel/qcoreapplication.cpp @@ -81,6 +81,11 @@ #ifdef Q_OS_WIN # ifdef Q_OS_WINRT # include "qeventdispatcher_winrt_p.h" +# include "qfunctions_winrt.h" +# include +# include + using namespace ABI::Windows::ApplicationModel::Core; + using namespace Microsoft::WRL; # else # include "qeventdispatcher_win_p.h" # endif @@ -1221,6 +1226,19 @@ void QCoreApplication::exit(int returnCode) QEventLoop *eventLoop = data->eventLoops.at(i); eventLoop->exit(returnCode); } +#ifdef Q_OS_WINRT + qWarning("QCoreApplication::exit: It is not recommended to explicitly exit an application on Windows Store Apps"); + ComPtr app; + HRESULT hr = RoGetActivationFactory(Wrappers::HString::MakeReference(RuntimeClass_Windows_ApplicationModel_Core_CoreApplication).Get(), + IID_PPV_ARGS(&app)); + RETURN_VOID_IF_FAILED("Could not acquire ICoreApplication object"); + ComPtr appExit; + + hr = app.As(&appExit); + RETURN_VOID_IF_FAILED("Could not acquire ICoreApplicationExit object"); + hr = appExit->Exit(); + RETURN_VOID_IF_FAILED("Could not exit application"); +#endif // Q_OS_WINRT } /***************************************************************************** -- cgit v1.2.3 From 434868e9d3cab37b304d7511cd62616d7cd6e032 Mon Sep 17 00:00:00 2001 From: Eskil Abrahamsen Blomfeldt Date: Wed, 4 Feb 2015 13:54:07 +0100 Subject: REG: Fix misplaced outline drawn text with native rendering MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change c238d34137ffe80d30933733a12aa2893b9631c2 was a refactoring which slightly changed behavior. In the case of fetching the alpha map's bounding box, before we would call loadGlyph() even for the case of outline drawing, as the correct bounding rect is still needed for this case. In loadGlyphFor() however, 0 was always returned for this case, as it was only used for populating the cache. The simple fix for this is to add a bool to loadGlyphFor() which adapts the original behavior when set, similar to the fetchMetricsOnly bool in the loadGlyph() functions. Change-Id: I76296c8aaeddbdae9e4c27ed2b30b7d59ff0843b Task-number: QTBUG-44273 Reviewed-by: Konstantin Ritt Reviewed-by: Pasi Petäjäjärvi Reviewed-by: Simon Hausmann --- src/gui/text/qfontengine_ft.cpp | 7 ++++--- src/gui/text/qfontengine_ft_p.h | 2 +- 2 files changed, 5 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/gui/text/qfontengine_ft.cpp b/src/gui/text/qfontengine_ft.cpp index 792bfadb5e..25156bf1e1 100644 --- a/src/gui/text/qfontengine_ft.cpp +++ b/src/gui/text/qfontengine_ft.cpp @@ -1727,7 +1727,7 @@ glyph_metrics_t QFontEngineFT::boundingBox(glyph_t glyph, const QTransform &matr glyph_metrics_t QFontEngineFT::alphaMapBoundingBox(glyph_t glyph, QFixed subPixelPosition, const QTransform &matrix, QFontEngine::GlyphFormat format) { - Glyph *g = loadGlyphFor(glyph, subPixelPosition, format, matrix); + Glyph *g = loadGlyphFor(glyph, subPixelPosition, format, matrix, true); glyph_metrics_t overall; if (g) { @@ -1870,7 +1870,8 @@ void QFontEngineFT::unlockAlphaMapForGlyph() QFontEngineFT::Glyph *QFontEngineFT::loadGlyphFor(glyph_t g, QFixed subPixelPosition, GlyphFormat format, - const QTransform &t) + const QTransform &t, + bool fetchBoundingBox) { FT_Face face = 0; QGlyphSet *glyphSet = 0; @@ -1883,7 +1884,7 @@ QFontEngineFT::Glyph *QFontEngineFT::loadGlyphFor(glyph_t g, Q_ASSERT(glyphSet != 0); } - if (glyphSet != 0 && glyphSet->outline_drawing) + if (glyphSet != 0 && glyphSet->outline_drawing && !fetchBoundingBox) return 0; Glyph *glyph = glyphSet != 0 ? glyphSet->getGlyph(g, subPixelPosition) : 0; diff --git a/src/gui/text/qfontengine_ft_p.h b/src/gui/text/qfontengine_ft_p.h index 383902c784..b40893c445 100644 --- a/src/gui/text/qfontengine_ft_p.h +++ b/src/gui/text/qfontengine_ft_p.h @@ -266,7 +266,7 @@ private: inline Glyph *loadGlyph(uint glyph, QFixed subPixelPosition, GlyphFormat format = Format_None, bool fetchMetricsOnly = false) const { return loadGlyph(cacheEnabled ? &defaultGlyphSet : 0, glyph, subPixelPosition, format, fetchMetricsOnly); } Glyph *loadGlyph(QGlyphSet *set, uint glyph, QFixed subPixelPosition, GlyphFormat = Format_None, bool fetchMetricsOnly = false) const; - Glyph *loadGlyphFor(glyph_t g, QFixed subPixelPosition, GlyphFormat format, const QTransform &t); + Glyph *loadGlyphFor(glyph_t g, QFixed subPixelPosition, GlyphFormat format, const QTransform &t, bool fetchBoundingBox = false); QGlyphSet *loadTransformedGlyphSet(const QTransform &matrix); -- cgit v1.2.3 From 07c27a13ac2d633fd10058ef55be1f1cd61a120d Mon Sep 17 00:00:00 2001 From: Sergio Ahumada Date: Fri, 6 Feb 2015 13:30:10 +0100 Subject: Replace blog.qt.digia.com with blog.qt.io MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: I7f1c897d8c96780ee330bca18edd9fe893ee7c90 Reviewed-by: Tero Kojo Reviewed-by: Topi Reiniö --- src/testlib/doc/src/qt-webpages.qdoc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/testlib/doc/src/qt-webpages.qdoc b/src/testlib/doc/src/qt-webpages.qdoc index e90790b7c0..03213413c3 100644 --- a/src/testlib/doc/src/qt-webpages.qdoc +++ b/src/testlib/doc/src/qt-webpages.qdoc @@ -25,10 +25,10 @@ ** ****************************************************************************/ /*! - \externalpage http://blog.qt.digia.com + \externalpage http://blog.qt.io \title Qt Labs */ /*! - \externalpage http://blog.qt.digia.com/blog/2008/12/05/qtestlib-now-with-nice-graphs-pointing-upwards/ + \externalpage http://blog.qt.io/blog/2008/12/05/qtestlib-now-with-nice-graphs-pointing-upwards/ \title qtestlib-tools Announcement */ -- cgit v1.2.3 From f2b77e3ff71511944ad8da56cb63c4ca8daf6417 Mon Sep 17 00:00:00 2001 From: Samuel Gaist Date: Sun, 27 Oct 2013 22:11:38 +0100 Subject: Qt 5 to-do in qpainterengineex_p.h This patch apply the recommended cleanup in qpainterengineex_p.h Task-number: QTBUG-25069 Change-Id: Ice2c3298c88ba6a7141642470aeeefa782af7f3a Reviewed-by: Alex Blasche --- src/gui/painting/qpaintengineex_p.h | 9 ------- src/widgets/effects/qpixmapfilter.cpp | 45 ++--------------------------------- 2 files changed, 2 insertions(+), 52 deletions(-) (limited to 'src') diff --git a/src/gui/painting/qpaintengineex_p.h b/src/gui/painting/qpaintengineex_p.h index 82fcd9765a..b831621a0c 100644 --- a/src/gui/painting/qpaintengineex_p.h +++ b/src/gui/painting/qpaintengineex_p.h @@ -65,8 +65,6 @@ struct StrokeHandler; QDebug Q_GUI_EXPORT &operator<<(QDebug &, const QVectorPath &path); #endif -class QPixmapFilter; - class Q_GUI_EXPORT QPaintEngineEx : public QPaintEngine { Q_DECLARE_PRIVATE(QPaintEngineEx) @@ -140,13 +138,6 @@ public: virtual void beginNativePainting() {} virtual void endNativePainting() {} - // Return a pixmap filter of "type" that can render the parameters - // in "prototype". The returned filter is owned by the engine and - // will be destroyed when the engine is destroyed. The "prototype" - // allows the engine to pick different filters based on the parameters - // that will be requested, and not just the "type". - virtual QPixmapFilter *pixmapFilter(int /*type*/, const QPixmapFilter * /*prototype*/) { return 0; } - // These flags are needed in the implementation of paint buffers. enum Flags { diff --git a/src/widgets/effects/qpixmapfilter.cpp b/src/widgets/effects/qpixmapfilter.cpp index 6f618b8914..216b19ca48 100644 --- a/src/widgets/effects/qpixmapfilter.cpp +++ b/src/widgets/effects/qpixmapfilter.cpp @@ -416,17 +416,7 @@ void QPixmapConvolutionFilter::draw(QPainter *painter, const QPointF &p, const Q if (src.isNull()) return; - QPixmapFilter *filter = painter->paintEngine() && painter->paintEngine()->isExtended() ? - static_cast(painter->paintEngine())->pixmapFilter(type(), this) : 0; - QPixmapConvolutionFilter *convolutionFilter = static_cast(filter); - if (convolutionFilter) { - convolutionFilter->setConvolutionKernel(d->convolutionKernel, d->kernelWidth, d->kernelHeight); - convolutionFilter->d_func()->convoluteAlpha = d->convoluteAlpha; - convolutionFilter->draw(painter, p, src, srcRect); - return; - } - - // falling back to raster implementation + // raster implementation QImage *target = 0; if (painter->paintEngine()->paintDevice()->devType() == QInternal::Image) { @@ -924,16 +914,6 @@ void QPixmapBlurFilter::draw(QPainter *painter, const QPointF &p, const QPixmap if (qt_scaleForTransform(painter->transform(), &scale)) scaledRadius /= scale; - QPixmapFilter *filter = painter->paintEngine() && painter->paintEngine()->isExtended() ? - static_cast(painter->paintEngine())->pixmapFilter(type(), this) : 0; - QPixmapBlurFilter *blurFilter = static_cast(filter); - if (blurFilter) { - blurFilter->setRadius(scaledRadius); - blurFilter->setBlurHints(d->hints); - blurFilter->draw(painter, p, src, srcRect); - return; - } - QImage srcImage; QImage destImage; @@ -1094,17 +1074,7 @@ void QPixmapColorizeFilter::draw(QPainter *painter, const QPointF &dest, const Q if (src.isNull()) return; - QPixmapFilter *filter = painter->paintEngine() && painter->paintEngine()->isExtended() ? - static_cast(painter->paintEngine())->pixmapFilter(type(), this) : 0; - QPixmapColorizeFilter *colorizeFilter = static_cast(filter); - if (colorizeFilter) { - colorizeFilter->setColor(d->color); - colorizeFilter->setStrength(d->strength); - colorizeFilter->draw(painter, dest, src, srcRect); - return; - } - - // falling back to raster implementation + // raster implementation if (!d->opaque) { painter->drawPixmap(dest, src, srcRect); @@ -1328,17 +1298,6 @@ void QPixmapDropShadowFilter::draw(QPainter *p, if (px.isNull()) return; - QPixmapFilter *filter = p->paintEngine() && p->paintEngine()->isExtended() ? - static_cast(p->paintEngine())->pixmapFilter(type(), this) : 0; - QPixmapDropShadowFilter *dropShadowFilter = static_cast(filter); - if (dropShadowFilter) { - dropShadowFilter->setColor(d->color); - dropShadowFilter->setBlurRadius(d->radius); - dropShadowFilter->setOffset(d->offset); - dropShadowFilter->draw(p, pos, px, src); - return; - } - QImage tmp(px.size(), QImage::Format_ARGB32_Premultiplied); tmp.fill(0); QPainter tmpPainter(&tmp); -- cgit v1.2.3 From 447ff9a9f32826654f9df9020610c767cb8c9b15 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Wed, 14 Jan 2015 11:02:28 -0800 Subject: Fix compilation with Apple Clang 425 This version was based on Clang mainline between releases 3.1 and 3.2, which means it has part of 3.2 features but not all. One of the missing features is __builtin_bswap16. Cherry-picked from ec9bc843d8a5c18459f3669c6e22acac2077df67 on 5.4 Change-Id: Ic5d393bfd36e48a193fcffff13b95664c7f664de Reviewed-by: Thiago Macieira Reviewed-by: Shawn Rutledge --- src/corelib/global/qendian.h | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/corelib/global/qendian.h b/src/corelib/global/qendian.h index 7c643f7592..0e383c18d2 100644 --- a/src/corelib/global/qendian.h +++ b/src/corelib/global/qendian.h @@ -272,9 +272,15 @@ template <> inline qint8 qFromBigEndian(const uchar *src) */ template T qbswap(T source); +#ifdef __has_builtin +# define QT_HAS_BUILTIN(x) __has_builtin(x) +#else +# define QT_HAS_BUILTIN(x) 0 +#endif + // GCC 4.3 implemented all the intrinsics, but the 16-bit one only got implemented in 4.8; // Clang 2.6 implemented the 32- and 64-bit but waited until 3.2 to implement the 16-bit one -#if (defined(Q_CC_GNU) && Q_CC_GNU >= 403) || (defined(Q_CC_CLANG) && Q_CC_CLANG >= 206) +#if (defined(Q_CC_GNU) && Q_CC_GNU >= 403) || QT_HAS_BUILTIN(__builtin_bswap32) template <> inline quint64 qbswap(quint64 source) { return __builtin_bswap64(source); @@ -306,7 +312,7 @@ template <> inline quint32 qbswap(quint32 source) | ((source & 0xff000000) >> 24); } #endif // GCC & Clang intrinsics -#if (defined(Q_CC_GNU) && Q_CC_GNU >= 408) || (defined(Q_CC_CLANG) && Q_CC_CLANG >= 302) +#if (defined(Q_CC_GNU) && Q_CC_GNU >= 408) || QT_HAS_BUILTIN(__builtin_bswap16) template <> inline quint16 qbswap(quint16 source) { return __builtin_bswap16(source); @@ -320,6 +326,8 @@ template <> inline quint16 qbswap(quint16 source) } #endif // GCC & Clang intrinsics +#undef QT_HAS_BUILTIN + // signed specializations template <> inline qint64 qbswap(qint64 source) { -- cgit v1.2.3 From b4491c358ddc4d87258d92bc7fc99832bc3cd526 Mon Sep 17 00:00:00 2001 From: Laszlo Agocs Date: Thu, 29 Jan 2015 17:06:21 +0100 Subject: Document that setGraphicsEffect is not suitable for GL widgets Task-number: QTBUG-44188 Change-Id: Ie5bea14ffb804124421e97e5f49975ac9ad6d838 Reviewed-by: Shawn Rutledge --- src/widgets/kernel/qwidget.cpp | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src') diff --git a/src/widgets/kernel/qwidget.cpp b/src/widgets/kernel/qwidget.cpp index 27d45ccea6..68715413d1 100644 --- a/src/widgets/kernel/qwidget.cpp +++ b/src/widgets/kernel/qwidget.cpp @@ -5227,6 +5227,9 @@ QGraphicsEffect *QWidget::graphicsEffect() const \note This function will apply the effect on itself and all its children. + \note Graphics effects are not supported for OpenGL-based widgets, such as QGLWidget, + QOpenGLWidget and QQuickWidget. + \since 4.6 \sa graphicsEffect() -- cgit v1.2.3 From e558e71791bb0cdcf77f81fe904c61597c01ae1e Mon Sep 17 00:00:00 2001 From: Andy Shaw Date: Thu, 29 Jan 2015 15:25:53 +0100 Subject: Fix the look of inactive checkboxes in itemviews on OS X 10.10 Task-number: QTBUG-43875 Change-Id: I4734647e2f3f9e3f68a3ae77fb5c825c7d99f8b4 Reviewed-by: Gabriel de Dietrich --- src/widgets/styles/qmacstyle_mac.mm | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/widgets/styles/qmacstyle_mac.mm b/src/widgets/styles/qmacstyle_mac.mm index 38c082baf5..0a9fb19fa4 100644 --- a/src/widgets/styles/qmacstyle_mac.mm +++ b/src/widgets/styles/qmacstyle_mac.mm @@ -1970,6 +1970,7 @@ void QMacStylePrivate::drawColorlessButton(const HIRect &macRect, HIThemeButtonD || bdi->kind == kThemeComboBoxSmall || bdi->kind == kThemeComboBoxMini; const bool button = opt->type == QStyleOption::SO_Button; + const bool viewItem = opt->type == QStyleOption::SO_ViewItem; const bool pressed = bdi->state == kThemeStatePressed; const bool usingYosemiteOrLater = QSysInfo::MacintoshVersion > QSysInfo::MV_10_9; @@ -2010,6 +2011,8 @@ void QMacStylePrivate::drawColorlessButton(const HIRect &macRect, HIThemeButtonD HIRect newRect = CGRectMake(xoff, yoff, macRect.size.width, macRect.size.height); if (button && pressed) bdi->state = kThemeStateActive; + else if (usingYosemiteOrLater && viewItem) + bdi->state = kThemeStateInactive; HIThemeDrawButton(&newRect, bdi, cg, kHIThemeOrientationNormal, 0); } } @@ -2057,7 +2060,7 @@ void QMacStylePrivate::drawColorlessButton(const HIRect &macRect, HIThemeButtonD rect.adjust(0, 0, -5, 0); drawNSViewInRect(cw, bc, rect, p); return; - } else if (usingYosemiteOrLater && editableCombo) { + } else if (usingYosemiteOrLater && (editableCombo || viewItem)) { QImage image = activePixmap.toImage(); for (int y = 0; y < height; ++y) { -- cgit v1.2.3 From e67ebe8ba4f59a4554a47fa26e9c374b1022d36f Mon Sep 17 00:00:00 2001 From: Allan Sandfeld Jensen Date: Thu, 21 Aug 2014 10:45:27 +0200 Subject: Listen to XI2 deviceChanged events to reset last position Some drivers appears to reset their scroll positions when make the primary point. This patch listens for the device changed event and uses the information in it to update the position. Task-number: QTBUG-40829 Change-Id: If354dfde6300ceb2b81be14ea24594ab0658a6aa Reviewed-by: Alex Blasche --- src/plugins/platforms/xcb/qxcbconnection.h | 2 + src/plugins/platforms/xcb/qxcbconnection_xi2.cpp | 76 ++++++++++++++++++++---- 2 files changed, 68 insertions(+), 10 deletions(-) (limited to 'src') diff --git a/src/plugins/platforms/xcb/qxcbconnection.h b/src/plugins/platforms/xcb/qxcbconnection.h index 7286b6b89b..4d0596550c 100644 --- a/src/plugins/platforms/xcb/qxcbconnection.h +++ b/src/plugins/platforms/xcb/qxcbconnection.h @@ -506,6 +506,7 @@ private: XInput2TouchDeviceData *touchDeviceForId(int id); void xi2HandleEvent(xcb_ge_event_t *event); void xi2HandleHierachyEvent(void *event); + void xi2HandleDeviceChangedEvent(void *event); int m_xiOpCode, m_xiEventBase, m_xiErrorBase; #ifndef QT_NO_TABLETEVENT struct TabletData { @@ -539,6 +540,7 @@ private: Qt::Orientations legacyOrientations; QPointF lastScrollPosition; }; + void updateScrollingDevice(ScrollingDevice& scrollingDevice, int num_classes, void *classes); void xi2HandleScrollEvent(void *event, ScrollingDevice &scrollingDevice); QHash m_scrollingDevices; #endif // XCB_USE_XINPUT2 diff --git a/src/plugins/platforms/xcb/qxcbconnection_xi2.cpp b/src/plugins/platforms/xcb/qxcbconnection_xi2.cpp index 90d323ed34..60ae062586 100644 --- a/src/plugins/platforms/xcb/qxcbconnection_xi2.cpp +++ b/src/plugins/platforms/xcb/qxcbconnection_xi2.cpp @@ -346,6 +346,7 @@ void QXcbConnection::xi2Select(xcb_window_t window) // Listen for hotplug events XIEventMask xiEventMask; bitMask = XI_HierarchyChangedMask; + bitMask |= XI_DeviceChangedMask; xiEventMask.deviceid = XIAllDevices; xiEventMask.mask_len = sizeof(bitMask); xiEventMask.mask = xiBitMask; @@ -464,6 +465,11 @@ void QXcbConnection::xi2HandleEvent(xcb_ge_event_t *event) xi2HandleHierachyEvent(xiEvent); return; } + if (xiEvent->evtype == XI_DeviceChanged) { + xi2HandleDeviceChangedEvent(xiEvent); + return; + } + #ifndef QT_NO_TABLETEVENT for (int i = 0; i < m_tabletData.count(); ++i) { if (m_tabletData.at(i).deviceId == xiEvent->deviceid) { @@ -624,6 +630,64 @@ void QXcbConnection::xi2HandleHierachyEvent(void *event) } } +void QXcbConnection::xi2HandleDeviceChangedEvent(void *event) +{ + xXIDeviceChangedEvent *xiEvent = reinterpret_cast(event); + + // ### If a slave device changes (XIDeviceChange), we should probably run setup on it again. + if (xiEvent->reason != XISlaveSwitch) + return; + +#ifdef XCB_USE_XINPUT21 + // This code handles broken scrolling device drivers that reset absolute positions + // when they are made active. Whenever a new slave device is made active the + // primary pointer sends a DeviceChanged event with XISlaveSwitch, and the new + // active slave in sourceid. + + QHash::iterator device = m_scrollingDevices.find(xiEvent->sourceid); + if (device == m_scrollingDevices.end()) + return; + + int nrDevices = 0; + XIDeviceInfo* xiDeviceInfo = XIQueryDevice(static_cast(m_xlib_display), xiEvent->sourceid, &nrDevices); + if (nrDevices <= 0) { + qCDebug(lcQpaXInputDevices, "scrolling device %d no longer present", xiEvent->sourceid); + return; + } + updateScrollingDevice(*device, xiDeviceInfo->num_classes, xiDeviceInfo->classes); + XIFreeDeviceInfo(xiDeviceInfo); +#endif +} + +void QXcbConnection::updateScrollingDevice(ScrollingDevice &scrollingDevice, int num_classes, void *classInfo) +{ +#ifdef XCB_USE_XINPUT21 + XIAnyClassInfo **classes = reinterpret_cast(classInfo); + QPointF lastScrollPosition; + if (lcQpaXInput().isDebugEnabled()) + lastScrollPosition = scrollingDevice.lastScrollPosition; + for (int c = 0; c < num_classes; ++c) { + if (classes[c]->type == XIValuatorClass) { + XIValuatorClassInfo *vci = reinterpret_cast(classes[c]); + const int valuatorAtom = qatom(vci->label); + if (valuatorAtom == QXcbAtom::RelHorizScroll || valuatorAtom == QXcbAtom::RelHorizWheel) + scrollingDevice.lastScrollPosition.setX(vci->value); + else if (valuatorAtom == QXcbAtom::RelVertScroll || valuatorAtom == QXcbAtom::RelVertWheel) + scrollingDevice.lastScrollPosition.setY(vci->value); + } + } + if (lcQpaXInput().isDebugEnabled() && lastScrollPosition != scrollingDevice.lastScrollPosition) + qCDebug(lcQpaXInput, "scrolling device %d moved from (%f, %f) to (%f, %f)", scrollingDevice.deviceId, + lastScrollPosition.x(), lastScrollPosition.y(), + scrollingDevice.lastScrollPosition.x(), + scrollingDevice.lastScrollPosition.y()); +#else + Q_UNUSED(scrollingDevice); + Q_UNUSED(num_classes); + Q_UNUSED(classInfo); +#endif +} + void QXcbConnection::handleEnterEvent(const xcb_enter_notify_event_t *) { #ifdef XCB_USE_XINPUT21 @@ -634,19 +698,11 @@ void QXcbConnection::handleEnterEvent(const xcb_enter_notify_event_t *) int nrDevices = 0; XIDeviceInfo* xiDeviceInfo = XIQueryDevice(static_cast(m_xlib_display), scrollingDevice.deviceId, &nrDevices); if (nrDevices <= 0) { + qCDebug(lcQpaXInputDevices, "scrolling device %d no longer present", scrollingDevice.deviceId); it = m_scrollingDevices.erase(it); continue; } - for (int c = 0; c < xiDeviceInfo->num_classes; ++c) { - if (xiDeviceInfo->classes[c]->type == XIValuatorClass) { - XIValuatorClassInfo *vci = reinterpret_cast(xiDeviceInfo->classes[c]); - const int valuatorAtom = qatom(vci->label); - if (valuatorAtom == QXcbAtom::RelHorizScroll || valuatorAtom == QXcbAtom::RelHorizWheel) - scrollingDevice.lastScrollPosition.setX(vci->value); - else if (valuatorAtom == QXcbAtom::RelVertScroll || valuatorAtom == QXcbAtom::RelVertWheel) - scrollingDevice.lastScrollPosition.setY(vci->value); - } - } + updateScrollingDevice(scrollingDevice, xiDeviceInfo->num_classes, xiDeviceInfo->classes); XIFreeDeviceInfo(xiDeviceInfo); ++it; } -- cgit v1.2.3 From 3ab6653d97a5dd01fd5f5cb4e52d5816274e4cbd Mon Sep 17 00:00:00 2001 From: Jan Arve Saether Date: Fri, 6 Feb 2015 14:47:16 +0100 Subject: Fixed crash when adding items with spans This only occurred if the item added was the only item in the last row/column, since then the the internal grid failed to expand (in this case it would always call expand(0, 0), which would not create the extra row/column). [ChangeLog][QtWidgets][QGridLayout] Fixed crash that sometimes happened when adding items with spans that spanned to the bottom/right edge. Task-number: QTBUG-38052 Change-Id: Iba95f6d9d9356b4d1c84c7b93f4af9b4ea0cf714 Reviewed-by: Paul Olav Tvete --- src/widgets/kernel/qgridlayout.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/widgets/kernel/qgridlayout.cpp b/src/widgets/kernel/qgridlayout.cpp index 10d338c40c..3de0eb7960 100644 --- a/src/widgets/kernel/qgridlayout.cpp +++ b/src/widgets/kernel/qgridlayout.cpp @@ -565,7 +565,7 @@ void QGridLayoutPrivate::add(QGridBox *box, int row1, int row2, int col1, int co add(box, row1, col1); return; } - expand(row2 + 1, col2 + 1); + expand(qMax(row1, row2) + 1, qMax(col1, col2) + 1); box->row = row1; box->col = col1; -- cgit v1.2.3 From 51ba25e0fc89882e5021bed718de91d58f7f3907 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fatih=20A=C5=9F=C4=B1c=C4=B1?= Date: Wed, 24 Dec 2014 17:29:11 +0200 Subject: logging: Check if uClibc has backtrace support execinfo.h is optional in uClibc. We need to check __UCLIBC_HAS_BACKTRACE__ if uClibc is used. Change-Id: Ie28be85b0b70472df1fc4a208581bb66ad34229e Reviewed-by: Kai Koehne Reviewed-by: Thiago Macieira --- src/corelib/global/qlogging.cpp | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/corelib/global/qlogging.cpp b/src/corelib/global/qlogging.cpp index 50d35a6d84..fa897d6d32 100644 --- a/src/corelib/global/qlogging.cpp +++ b/src/corelib/global/qlogging.cpp @@ -77,14 +77,21 @@ #endif #if !defined QT_NO_REGULAREXPRESSION && !defined(QT_BOOTSTRAPPED) -# if (defined(__GLIBC__) && defined(__GLIBCXX__)) || (__has_include() && __has_include()) +# ifdef __UCLIBC__ +# if __UCLIBC_HAS_BACKTRACE__ +# define QLOGGING_HAVE_BACKTRACE +# endif +# elif (defined(__GLIBC__) && defined(__GLIBCXX__)) || (__has_include() && __has_include()) # define QLOGGING_HAVE_BACKTRACE -# include -# include -# include # endif #endif +#ifdef QLOGGING_HAVE_BACKTRACE +# include +# include +# include +#endif + #include QT_BEGIN_NAMESPACE -- cgit v1.2.3 From e024eb55c6eb4582ce22aadec440ada3c9deaab9 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Mon, 9 Feb 2015 12:37:12 -0800 Subject: Remove #define inline from Harfbuzz-NG This code is C++ only. There isn't a single C++ compiler that fails to understand the "inline" keyword, since it's required by C++98. Any compiler older than C++98 is likely to choke on the template usage further down, so this isn't necessary. Moreover, the C++ standard says you cannot define macros. [lib.macro.names] says "Nor shall such a translation unit define macros for names lexically identical to keywords." -- technically, it's a promise that the Standard Library headers won't do it, the wording means that the entire translation unit won't do it, which implies no source can do it. MSVC complains about it: fatal error C1189: #error : The C++ Standard Library forbids macroizing keywords. Enable warning C4005 to find the forbidden macro. Change-Id: Ic2a0a03a0af47386e34bb698454a2040ef3f6a9d Reviewed-by: Simon Hausmann Reviewed-by: Olivier Goffart (Woboq GmbH) --- src/3rdparty/harfbuzz-ng/src/hb-private.hh | 10 ---------- 1 file changed, 10 deletions(-) (limited to 'src') diff --git a/src/3rdparty/harfbuzz-ng/src/hb-private.hh b/src/3rdparty/harfbuzz-ng/src/hb-private.hh index 3f70d74c26..3a4cf611f0 100644 --- a/src/3rdparty/harfbuzz-ng/src/hb-private.hh +++ b/src/3rdparty/harfbuzz-ng/src/hb-private.hh @@ -98,16 +98,6 @@ #define snprintf _snprintf #endif -#ifdef _MSC_VER -#undef inline -#define inline __inline -#endif - -#ifdef __STRICT_ANSI__ -#undef inline -#define inline __inline__ -#endif - #if __GNUC__ >= 3 #define HB_FUNC __PRETTY_FUNCTION__ #elif defined(_MSC_VER) -- cgit v1.2.3 From d6ce94ae6367337ade2c590f182b973e2bcfa98c Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Sun, 1 Feb 2015 14:31:55 -0200 Subject: Force Harfbuzz-NG to use the Qt atomics when built inside Qt For most cases, the GCC/Intel atomics (__sync functions) are fine, but there are some systems for which libgcc is incorrectly built (QNX 6.5.0). Additionally, this will allow Harfbuzz-NG to be supported in exactly the same systems as Qt itself. Task-number: QTBUG-43850 Change-Id: Ib53f57f70d4ad46863c45e74d60b0eb45ba9bd02 Reviewed-by: Lars Knoll Reviewed-by: Marc Mutz --- src/3rdparty/harfbuzz-ng/harfbuzz-ng.pro | 4 ++-- src/3rdparty/harfbuzz-ng/src/hb-atomic-private.hh | 19 +++++++++++++++++++ 2 files changed, 21 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/3rdparty/harfbuzz-ng/harfbuzz-ng.pro b/src/3rdparty/harfbuzz-ng/harfbuzz-ng.pro index 6b51d9679a..a8885d71df 100644 --- a/src/3rdparty/harfbuzz-ng/harfbuzz-ng.pro +++ b/src/3rdparty/harfbuzz-ng/harfbuzz-ng.pro @@ -7,14 +7,14 @@ CONFIG += \ load(qt_helper_lib) -DEFINES += HAVE_OT HB_NO_UNICODE_FUNCS HB_DISABLE_DEPRECATED +DEFINES += HAVE_OT HAVE_QT5_ATOMICS HB_NO_UNICODE_FUNCS HB_DISABLE_DEPRECATED # platform/compiler specific definitions DEFINES += HAVE_ATEXIT -gcc: DEFINES += HAVE_INTEL_ATOMIC_PRIMITIVES unix: DEFINES += HAVE_PTHREAD HAVE_SCHED_H HAVE_SCHED_YIELD INCLUDEPATH += $$PWD/include +INCLUDEPATH += $$OUT_PWD/../../../include SOURCES += \ $$PWD/src/hb-blob.cc \ diff --git a/src/3rdparty/harfbuzz-ng/src/hb-atomic-private.hh b/src/3rdparty/harfbuzz-ng/src/hb-atomic-private.hh index 60cbcf91be..f15ef09799 100644 --- a/src/3rdparty/harfbuzz-ng/src/hb-atomic-private.hh +++ b/src/3rdparty/harfbuzz-ng/src/hb-atomic-private.hh @@ -41,6 +41,25 @@ #if 0 +#elif !defined(HB_NO_MT) && defined(HAVE_QT5_ATOMICS) +#include + +QT_USE_NAMESPACE + +namespace { +// We need to cast hb_atomic_int_t to QAtomicInt and pointers to +// QAtomicPointer instead of using QAtomicOps, otherwise we get a failed +// overload resolution of the template arguments for testAndSetOrdered. +template QAtomicPointer *makeAtomicPointer(T * const &ptr) +{ + return reinterpret_cast *>(const_cast(&ptr)); +} +} + +typedef int hb_atomic_int_t; +#define hb_atomic_int_add(AI, V) reinterpret_cast(AI).fetchAndAddOrdered(V) +#define hb_atomic_ptr_get(P) makeAtomicPointer(*P)->loadAcquire() +#define hb_atomic_ptr_cmpexch(P,O,N) makeAtomicPointer(*P)->testAndSetOrdered((O), (N)) #elif !defined(HB_NO_MT) && (defined(_WIN32) || defined(__CYGWIN__)) -- cgit v1.2.3 From fe1726fd7d33a5e1bda863ca6000bc3b9806b1aa Mon Sep 17 00:00:00 2001 From: Mitch Curtis Date: Thu, 22 Jan 2015 10:38:34 +0100 Subject: Document and further test that QJsonObject::keys() is sorted. Change-Id: I6b145c1240cce85ad3fea6fb90ddbed629487f83 Reviewed-by: Lars Knoll --- src/corelib/json/qjsonobject.cpp | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src') diff --git a/src/corelib/json/qjsonobject.cpp b/src/corelib/json/qjsonobject.cpp index bc74092f59..cd68db8dc6 100644 --- a/src/corelib/json/qjsonobject.cpp +++ b/src/corelib/json/qjsonobject.cpp @@ -223,6 +223,8 @@ QVariantMap QJsonObject::toVariantMap() const /*! Returns a list of all keys in this object. + + The list is sorted lexographically. */ QStringList QJsonObject::keys() const { -- cgit v1.2.3 From 838212b8e692add300774ffb012dc90342a3130e Mon Sep 17 00:00:00 2001 From: Andy Shaw Date: Mon, 1 Dec 2014 14:32:45 +0100 Subject: Respect the orientation setting from the page setup dialog Task-number: QTBUG-27887 Change-Id: I2af7a495c4e693e9519c7e0ffde54b7e6a1d8715 Reviewed-by: Friedemann Kleint Reviewed-by: Joerg Bornemann --- src/printsupport/dialogs/qpagesetupdialog_mac.mm | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src') diff --git a/src/printsupport/dialogs/qpagesetupdialog_mac.mm b/src/printsupport/dialogs/qpagesetupdialog_mac.mm index 7180c01df4..f0f9250434 100644 --- a/src/printsupport/dialogs/qpagesetupdialog_mac.mm +++ b/src/printsupport/dialogs/qpagesetupdialog_mac.mm @@ -84,8 +84,11 @@ QT_USE_NAMESPACE PMPageFormat format = static_cast([printInfo PMPageFormat]); PMRect paperRect; PMGetUnadjustedPaperRect(format, &paperRect); + PMOrientation orientation; + PMGetOrientation(format, &orientation); QSizeF paperSize = QSizeF(paperRect.right - paperRect.left, paperRect.bottom - paperRect.top); printer->printEngine()->setProperty(QPrintEngine::PPK_CustomPaperSize, paperSize); + printer->printEngine()->setProperty(QPrintEngine::PPK_Orientation, orientation == kPMLandscape ? QPrinter::Landscape : QPrinter::Portrait); } dialog->done((returnCode == NSOKButton) ? QDialog::Accepted : QDialog::Rejected); -- cgit v1.2.3 From c66f2433b197fdf6742aa096ee5090a3b5f12247 Mon Sep 17 00:00:00 2001 From: Laszlo Agocs Date: Wed, 11 Feb 2015 13:32:34 +0100 Subject: Provide a native interface object from linuxfb Recent code in font support started to use the platformNativeInterface() return value without checking for null. Most platform plugins, with the notable exception of linuxfb and the minimal ones, provide an object. Start providing a dummy object from linuxfb too. This is more sensible then adding null checks everywhere. This will prevent crashing with linuxfb on startup. Task-number: QTBUG-44414 Change-Id: I48912132e1f8ad52e2a94c3d765dacc7b16f309a Reviewed-by: Andy Nichols --- src/plugins/platforms/linuxfb/qlinuxfbintegration.cpp | 7 +++++++ src/plugins/platforms/linuxfb/qlinuxfbintegration.h | 4 ++++ 2 files changed, 11 insertions(+) (limited to 'src') diff --git a/src/plugins/platforms/linuxfb/qlinuxfbintegration.cpp b/src/plugins/platforms/linuxfb/qlinuxfbintegration.cpp index cb870847f2..777da98f47 100644 --- a/src/plugins/platforms/linuxfb/qlinuxfbintegration.cpp +++ b/src/plugins/platforms/linuxfb/qlinuxfbintegration.cpp @@ -69,6 +69,8 @@ void QLinuxFbIntegration::initialize() m_inputContext = QPlatformInputContextFactory::create(); + m_nativeInterface.reset(new QPlatformNativeInterface); + m_vtHandler.reset(new QFbVtHandler); } @@ -113,4 +115,9 @@ QPlatformServices *QLinuxFbIntegration::services() const return m_services.data(); } +QPlatformNativeInterface *QLinuxFbIntegration::nativeInterface() const +{ + return m_nativeInterface.data(); +} + QT_END_NAMESPACE diff --git a/src/plugins/platforms/linuxfb/qlinuxfbintegration.h b/src/plugins/platforms/linuxfb/qlinuxfbintegration.h index cabd943921..83446105f8 100644 --- a/src/plugins/platforms/linuxfb/qlinuxfbintegration.h +++ b/src/plugins/platforms/linuxfb/qlinuxfbintegration.h @@ -35,6 +35,7 @@ #define QLINUXFBINTEGRATION_H #include +#include QT_BEGIN_NAMESPACE @@ -60,6 +61,8 @@ public: QPlatformServices *services() const Q_DECL_OVERRIDE; QPlatformInputContext *inputContext() const Q_DECL_OVERRIDE { return m_inputContext; } + QPlatformNativeInterface *nativeInterface() const Q_DECL_OVERRIDE; + QList screens() const; private: @@ -68,6 +71,7 @@ private: QScopedPointer m_fontDb; QScopedPointer m_services; QScopedPointer m_vtHandler; + QScopedPointer m_nativeInterface; }; QT_END_NAMESPACE -- cgit v1.2.3 From 32957d8893fa3b739c29be76869a9e8e1e63931b Mon Sep 17 00:00:00 2001 From: Peter Niekamp Date: Thu, 13 Nov 2014 19:37:00 +1100 Subject: Fix regression in opacity handling of pdf path stroke Specifically when rendering svg to a pdf, when painter opacity is set, path strokes were transformed incorrectly due to missed setting of dirtyTransform flag. Task-number: QTBUG-38675 Change-Id: I861353822ccddd394910b8612687a244d195a41e Reviewed-by: Allan Sandfeld Jensen Reviewed-by: Lars Knoll --- src/gui/painting/qpdf.cpp | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/gui/painting/qpdf.cpp b/src/gui/painting/qpdf.cpp index 473231b142..9aca4040a5 100644 --- a/src/gui/painting/qpdf.cpp +++ b/src/gui/painting/qpdf.cpp @@ -1051,7 +1051,7 @@ void QPdfEngine::drawPath (const QPainterPath &p) if (!d->hasPen && !d->hasBrush) return; - if (d->simplePen && d->opacity == 1.0) { + if (d->simplePen) { // draw strokes natively in this case for better output *d->currentPage << QPdf::generatePath(p, QTransform(), d->hasBrush ? QPdf::FillAndStrokePath : QPdf::StrokePath); } else { @@ -1198,7 +1198,7 @@ void QPdfEngine::updateState(const QPaintEngineState &state) d->stroker.setPen(d->pen, state.renderHints()); QBrush penBrush = d->pen.brush(); bool oldSimple = d->simplePen; - d->simplePen = (d->hasPen && (penBrush.style() == Qt::SolidPattern) && penBrush.isOpaque()); + d->simplePen = (d->hasPen && (penBrush.style() == Qt::SolidPattern) && penBrush.isOpaque() && d->opacity == 1.0); if (oldSimple != d->simplePen) flags |= DirtyTransform; } else if (flags & DirtyHints) { @@ -1214,8 +1214,13 @@ void QPdfEngine::updateState(const QPaintEngineState &state) d->brushOrigin = state.brushOrigin(); flags |= DirtyBrush; } - if (flags & DirtyOpacity) + if (flags & DirtyOpacity) { d->opacity = state.opacity(); + if (d->simplePen && d->opacity != 1.0) { + d->simplePen = false; + flags |= DirtyTransform; + } + } bool ce = d->clipEnabled; if (flags & DirtyClipPath) { -- cgit v1.2.3 From 3f25eda0ed669e61cc5e77f8d75771049ffab0c0 Mon Sep 17 00:00:00 2001 From: Joerg Bornemann Date: Thu, 12 Feb 2015 17:07:46 +0100 Subject: QFileDialog: fix overwritten filter Consider the following code: QFileDialog dlg; dlg.setFilter(QDir::Hidden | ...); dlg.setOption(QFileDialog::DontUseNativeDialog) setFilter stores the filter value in QDialogPrivate::options. setOption will overwrite this value with the default value from a newly created QFileSystemModel. The intention was to set the filter in the model to the value in options. Change-Id: I561c5cf1ad4d9d729a56620d86ec549eb3105a07 Task-number: QTBUG-37085 Reviewed-by: Friedemann Kleint --- src/widgets/dialogs/qfiledialog.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/widgets/dialogs/qfiledialog.cpp b/src/widgets/dialogs/qfiledialog.cpp index 6065ad015e..9d5d8d2e24 100644 --- a/src/widgets/dialogs/qfiledialog.cpp +++ b/src/widgets/dialogs/qfiledialog.cpp @@ -2716,7 +2716,7 @@ void QFileDialogPrivate::createWidgets() return; Q_Q(QFileDialog); model = new QFileSystemModel(q); - options->setFilter(model->filter()); + model->setFilter(options->filter()); model->setObjectName(QLatin1String("qt_filesystem_model")); if (QPlatformFileDialogHelper *helper = platformFileDialogHelper()) model->setNameFilterDisables(helper->defaultNameFilterDisables()); -- cgit v1.2.3 From eff7a6473c1fe019c0906887dd723c0bc00dd6f7 Mon Sep 17 00:00:00 2001 From: Sergio Ahumada Date: Fri, 13 Feb 2015 14:56:43 +0100 Subject: qdoc: Replace qt-project.org/doc with doc.qt.io also update some broken links while we are at it ... Change-Id: I9707a01b01be82e229c8f135c9ae093d73fd1204 Reviewed-by: Martin Smith --- src/tools/qdoc/doc/qdoc-manual-contextcmds.qdoc | 4 ++-- src/tools/qdoc/doc/qdoc-manual-markupcmds.qdoc | 24 ++++++++++++------------ src/tools/qdoc/doc/qdoc-manual-qdocconf.qdoc | 4 ++-- src/tools/qdoc/doc/qdoc-manual-topiccmds.qdoc | 24 ++++++++++++------------ src/tools/qdoc/doc/qtgui-qdocconf.qdoc | 4 ++-- 5 files changed, 30 insertions(+), 30 deletions(-) (limited to 'src') diff --git a/src/tools/qdoc/doc/qdoc-manual-contextcmds.qdoc b/src/tools/qdoc/doc/qdoc-manual-contextcmds.qdoc index 9f5ef59e94..f54254e356 100644 --- a/src/tools/qdoc/doc/qdoc-manual-contextcmds.qdoc +++ b/src/tools/qdoc/doc/qdoc-manual-contextcmds.qdoc @@ -428,7 +428,7 @@ \quotation \raw HTML

- Joining + Joining QChar::joining () const

\endraw @@ -787,7 +787,7 @@ \quotation \raw HTML -

QAction +

QAction * QMenu::addAction ( const QIcon & icon, const QString & text )

diff --git a/src/tools/qdoc/doc/qdoc-manual-markupcmds.qdoc b/src/tools/qdoc/doc/qdoc-manual-markupcmds.qdoc index 7825fc3a91..9f719ec3bc 100644 --- a/src/tools/qdoc/doc/qdoc-manual-markupcmds.qdoc +++ b/src/tools/qdoc/doc/qdoc-manual-markupcmds.qdoc @@ -1479,10 +1479,10 @@ \printuntil hello First we create a \l - {http://qt-project.org/doc/qt-5.0/qtwidgets/qapplication.html} {QApplication} + {http://doc.qt.io/qt-5/qapplication.html} {QApplication} object using the \c argc and \c argv parameters, then we create a \l - {http://qt-project.org/doc/qt-5.0/qtwidgets/qpushbutton.html} {QPushButton}. + {http://doc.qt.io/qt-5/qpushbutton.html} {QPushButton}. \endquotation See also \l {printline-command} {\\printline} and \l @@ -1776,7 +1776,7 @@ \code / *! - Read the \l {http://qt-project.org/doc/qt-5.0/} + Read the \l {http://doc.qt.io/qt-5/} {Qt 5.0 Documentation} carefully. * / \endcode @@ -1784,7 +1784,7 @@ QDoc renders this as: \quotation - Read the \l {http://qt-project.org/doc/qt-5.0/} + Read the \l {http://doc.qt.io/qt-5/} {Qt 5.0 Documentation} carefully. \endquotation @@ -2318,7 +2318,7 @@ - + Signals and Slots Signals and slots are used for communication @@ -2327,7 +2327,7 @@ - + Layout Management The Qt layout system provides a simple and powerful way of specifying the layout @@ -2336,7 +2336,7 @@ - + Drag and Drop Drag and drop provides a simple visual mechanism which users can use to transfer @@ -2437,7 +2437,7 @@ - + Signals and Slots Signals and slots are used for communication @@ -2499,7 +2499,7 @@ - + Signals and Slots Signals and slots are used for communication @@ -2508,7 +2508,7 @@ - + Layout Management The Qt layout system provides a simple and powerful way of specifying the layout @@ -2517,7 +2517,7 @@ - + Drag and Drop Drag and drop provides a simple visual mechanism which users can use to transfer @@ -2935,7 +2935,7 @@ \quotation \raw HTML

geometry : - QRect + QRect

\endraw diff --git a/src/tools/qdoc/doc/qdoc-manual-qdocconf.qdoc b/src/tools/qdoc/doc/qdoc-manual-qdocconf.qdoc index cf1f7b2426..6ca394a586 100644 --- a/src/tools/qdoc/doc/qdoc-manual-qdocconf.qdoc +++ b/src/tools/qdoc/doc/qdoc-manual-qdocconf.qdoc @@ -1410,7 +1410,7 @@ \code project = Qt description = Qt Reference Documentation - url = http://qt-project.org/doc/qt-4.8/ + url = http://doc.qt.io/qt-4.8/ ... \endcode @@ -1433,7 +1433,7 @@ \code project = Qt description = Qt Reference Documentation - url = http://qt-project.org/doc/qt-4.8/ + url = http://doc.qt.io/qt-4.8/ ... \endcode diff --git a/src/tools/qdoc/doc/qdoc-manual-topiccmds.qdoc b/src/tools/qdoc/doc/qdoc-manual-topiccmds.qdoc index 1d78eff386..fb3e604396 100644 --- a/src/tools/qdoc/doc/qdoc-manual-topiccmds.qdoc +++ b/src/tools/qdoc/doc/qdoc-manual-topiccmds.qdoc @@ -393,11 +393,11 @@ Files: \list - \li \l{http://qt-project.org/doc/qt-5.0/qtwidgets/widgets-imageviewer-imageviewer-cpp.html} + \li \l{http://doc.qt.io/qt-5/qtwidgets-widgets-imageviewer-imageviewer-cpp.html} {widgets/imageviewer/imageviewer.cpp} - \li \l{http://qt-project.org/doc/qt-5.0/qtwidgets/widgets-imageviewer-imageviewer-h.html} + \li \l{http://doc.qt.io/qt-5/qtwidgets-widgets-imageviewer-imageviewer-h.html} {widgets/imageviewer/imageviewer.h} - \li \l{http://qt-project.org/doc/qt-5.0/qtwidgets/widgets-imageviewer-main-cpp.html} + \li \l{http://doc.qt.io/qt-5/qtwidgets-widgets-imageviewer-main-cpp.html} {widgets/imageviewer/main.cpp} \endlist @@ -414,7 +414,7 @@ \code / *! - \externalpage http://qt-project.org/doc/ + \externalpage http://doc.qt.io/ \title Qt Documentation Site * / \endcode @@ -432,7 +432,7 @@ QDoc renders this as: \quotation - At the \l {http://qt-project.org/doc/}{Qt Documentation Site} + At the \l {http://doc.qt.io/}{Qt Documentation Site} you can find the latest documentation for Qt, Qt Creator, the Qt SDK and much more. \endquotation @@ -443,7 +443,7 @@ \code / *! - At the \l {http://qt-project.org/doc/}{Qt Documentation Site} + At the \l {http://doc.qt.io/}{Qt Documentation Site} you can find the latest documentation for Qt, Qt Creator, the Qt SDK and much more. * / @@ -543,7 +543,7 @@
- QAbstractSocket + QAbstractSocket The base functionality common to all socket types @@ -551,7 +551,7 @@
- QBuffer + QBuffer QIODevice interface for a QByteArray @@ -559,7 +559,7 @@
- QClipboard + QClipboard Access to the window system clipboard @@ -635,7 +635,7 @@

Functions

  • RandomAccessIterator - qBinaryFind + qBinaryFind (RandomAccessIterator begin, RandomAccessIterator end, const T & value)
  • ...
@@ -804,7 +804,7 @@
- QAbstractSocket + QAbstractSocket The base functionality common to all socket types @@ -1539,7 +1539,7 @@ \quotation \raw HTML

- + QPalette QStyleOption::palette diff --git a/src/tools/qdoc/doc/qtgui-qdocconf.qdoc b/src/tools/qdoc/doc/qtgui-qdocconf.qdoc index 2679b42ef2..f8213271c6 100644 --- a/src/tools/qdoc/doc/qtgui-qdocconf.qdoc +++ b/src/tools/qdoc/doc/qtgui-qdocconf.qdoc @@ -43,7 +43,7 @@ every statement in the qdocconf file. project = QtGui description = Qt GUI Reference Documentation - url = http://qt-project.org/doc/qt-$QT_VER/qtgui + url = http://doc.qt.io/qt-$QT_VER/qtgui-index.html version = $QT_VERSION examplesinstallpath = gui @@ -125,7 +125,7 @@ name of the index file doesn't adopt the uppercase letters of the project name. A short description of the project concerned. \code - url = http://qt-project.org/doc/qt-$QT_VER/qtgui + url = http://doc.qt.io/qt-$QT_VER/qtgui-index.html \endcode The \c url variable holds the base url of the project. -- cgit v1.2.3 From 2be0d3088fc5bc52ece6b28157b28d16699ccb9b Mon Sep 17 00:00:00 2001 From: Olivier Goffart Date: Sun, 18 Jan 2015 14:56:21 +0100 Subject: qFormatLogMessage: optimize %{backtrace} backtrace_symbols is very slow because it tries to find the function name from the address. In order to do that it needs to do a linear search over all symbols. (Because the hash table goes the other way to find the address from the symbol name) The code is going to skip a few frames from QtCore. Since we cannot know how many, we take a few more than necessary. This patch changes the additional number of frames from 15 to 7 (Usually, there are about 5 suppressed frames). We call backtrace_symbols several times for only one frame at the time. So we are not looking up addresses we don't need after we printed the right number of frames. Calling many times backtrace_symbols means we do more malloc, but that's negligible compared to the time we save. We anyway do a lot of other allocations because of the regexp operations and such So this patch is then saving about 10 frames lookups which allow to print about 6 qDebug per miliseconds instead of only 2 when using %{backtrace depth=2} Change-Id: Ic6ece2145d53dc570c80fcb0e4455dcef6bc40cb Reviewed-by: Kai Koehne --- src/corelib/global/qlogging.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/corelib/global/qlogging.cpp b/src/corelib/global/qlogging.cpp index 18b672d7ee..5f11334a82 100644 --- a/src/corelib/global/qlogging.cpp +++ b/src/corelib/global/qlogging.cpp @@ -1154,13 +1154,13 @@ QString qFormatLogMessage(QtMsgType type, const QMessageLogContext &context, con message.append(QString::number(qlonglong(QThread::currentThread()->currentThread()), 16)); #ifdef QLOGGING_HAVE_BACKTRACE } else if (token == backtraceTokenC) { - QVarLengthArray buffer(15 + pattern->backtraceDepth); + QVarLengthArray buffer(7 + pattern->backtraceDepth); int n = backtrace(buffer.data(), buffer.size()); if (n > 0) { - QScopedPointer strings(backtrace_symbols(buffer.data(), n)); int numberPrinted = 0; for (int i = 0; i < n && numberPrinted < pattern->backtraceDepth; ++i) { - QString trace = QString::fromLatin1(strings.data()[i]); + QScopedPointer strings(backtrace_symbols(buffer.data() + i, 1)); + QString trace = QString::fromLatin1(strings.data()[0]); // The results of backtrace_symbols looks like this: // /lib/libc.so.6(__libc_start_main+0xf3) [0x4a937413] // The offset and function name are optional. -- cgit v1.2.3 From 0fa7374f1dc433b6b8955cb14dabb22c10f50854 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Fri, 23 Jan 2015 14:20:02 -0800 Subject: Ensure that the binary JSON objects are actually sorted QJsonObject requires that, since it does binary searches for the keys. Change-Id: I8a7a116f51864cecb52fffff13bc24660c1cc1ac Reviewed-by: Lars Knoll --- src/corelib/json/qjson.cpp | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'src') diff --git a/src/corelib/json/qjson.cpp b/src/corelib/json/qjson.cpp index 8fa172eae8..abba1f1b49 100644 --- a/src/corelib/json/qjson.cpp +++ b/src/corelib/json/qjson.cpp @@ -200,6 +200,7 @@ bool Object::isValid() const if (tableOffset + length*sizeof(offset) > size) return false; + QString lastKey; for (uint i = 0; i < length; ++i) { offset entryOffset = table()[i]; if (entryOffset + sizeof(Entry) >= tableOffset) @@ -208,8 +209,12 @@ bool Object::isValid() const int s = e->size(); if (table()[i] + s > tableOffset) return false; + QString key = e->key(); + if (key < lastKey) + return false; if (!e->value.isValid(this)) return false; + lastKey = key; } return true; } -- cgit v1.2.3 From d866f6e8861647c45f438bc5b21905dacee41f8e Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Wed, 24 Dec 2014 17:01:52 -0200 Subject: Save two system calls for setting a socket non-blocking on Linux Linux's socket(2) system call can take SOCK_NONBLOCK and let us avoid the extra two fcntl(2) to change the setting after it's created. Change-Id: Ie0d7a2d51acc21acd850cbee6d0f76e27b1ae859 Reviewed-by: Richard J. Moore --- src/network/socket/qlocalsocket_unix.cpp | 10 +--------- src/network/socket/qnativesocketengine.cpp | 8 -------- src/network/socket/qnativesocketengine_unix.cpp | 4 ++-- src/network/socket/qnativesocketengine_win.cpp | 9 ++++++++- src/network/socket/qnativesocketengine_winrt.cpp | 14 +++++++++++--- 5 files changed, 22 insertions(+), 23 deletions(-) (limited to 'src') diff --git a/src/network/socket/qlocalsocket_unix.cpp b/src/network/socket/qlocalsocket_unix.cpp index 57aab2cc77..1f6d42918e 100644 --- a/src/network/socket/qlocalsocket_unix.cpp +++ b/src/network/socket/qlocalsocket_unix.cpp @@ -235,19 +235,11 @@ void QLocalSocket::connectToServer(OpenMode openMode) } // create the socket - if (-1 == (d->connectingSocket = qt_safe_socket(PF_UNIX, SOCK_STREAM, 0))) { + if (-1 == (d->connectingSocket = qt_safe_socket(PF_UNIX, SOCK_STREAM, 0, O_NONBLOCK))) { d->errorOccurred(UnsupportedSocketOperationError, QLatin1String("QLocalSocket::connectToServer")); return; } - // set non blocking so we can try to connect and it won't wait - int flags = fcntl(d->connectingSocket, F_GETFL, 0); - if (-1 == flags - || -1 == (fcntl(d->connectingSocket, F_SETFL, flags | O_NONBLOCK))) { - d->errorOccurred(UnknownSocketError, - QLatin1String("QLocalSocket::connectToServer")); - return; - } // _q_connectToSocket does the actual connecting d->connectingName = d->serverName; diff --git a/src/network/socket/qnativesocketengine.cpp b/src/network/socket/qnativesocketengine.cpp index e7113c8c5e..63f50632d2 100644 --- a/src/network/socket/qnativesocketengine.cpp +++ b/src/network/socket/qnativesocketengine.cpp @@ -357,14 +357,6 @@ bool QNativeSocketEngine::initialize(QAbstractSocket::SocketType socketType, QAb return false; } - // Make the socket nonblocking. - if (!setOption(NonBlockingSocketOption, 1)) { - d->setError(QAbstractSocket::UnsupportedSocketOperationError, - QNativeSocketEnginePrivate::NonBlockingInitFailedErrorString); - close(); - return false; - } - // Set the broadcasting flag if it's a UDP socket. if (socketType == QAbstractSocket::UdpSocket && !setOption(BroadcastSocketOption, 1)) { diff --git a/src/network/socket/qnativesocketengine_unix.cpp b/src/network/socket/qnativesocketengine_unix.cpp index eed1b70025..a7534a2f3f 100644 --- a/src/network/socket/qnativesocketengine_unix.cpp +++ b/src/network/socket/qnativesocketengine_unix.cpp @@ -138,10 +138,10 @@ bool QNativeSocketEnginePrivate::createNewSocket(QAbstractSocket::SocketType soc int protocol = (socketProtocol == QAbstractSocket::IPv6Protocol || socketProtocol == QAbstractSocket::AnyIPProtocol) ? AF_INET6 : AF_INET; int type = (socketType == QAbstractSocket::UdpSocket) ? SOCK_DGRAM : SOCK_STREAM; - int socket = qt_safe_socket(protocol, type, 0); + int socket = qt_safe_socket(protocol, type, 0, O_NONBLOCK); if (socket < 0 && socketProtocol == QAbstractSocket::AnyIPProtocol && errno == EAFNOSUPPORT) { protocol = AF_INET; - socket = qt_safe_socket(protocol, type, 0); + socket = qt_safe_socket(protocol, type, 0, O_NONBLOCK); socketProtocol = QAbstractSocket::IPv4Protocol; } diff --git a/src/network/socket/qnativesocketengine_win.cpp b/src/network/socket/qnativesocketengine_win.cpp index 184add15c3..7d62fc3955 100644 --- a/src/network/socket/qnativesocketengine_win.cpp +++ b/src/network/socket/qnativesocketengine_win.cpp @@ -383,8 +383,15 @@ bool QNativeSocketEnginePrivate::createNewSocket(QAbstractSocket::SocketType soc #endif socketDescriptor = socket; - return true; + // Make the socket nonblocking. + if (!setOption(QAbstractSocketEngine::NonBlockingSocketOption, 1)) { + setError(QAbstractSocket::UnsupportedSocketOperationError, NonBlockingInitFailedErrorString); + q_func()->close(); + return false; + } + + return true; } /*! \internal diff --git a/src/network/socket/qnativesocketengine_winrt.cpp b/src/network/socket/qnativesocketengine_winrt.cpp index e60840d651..c49eda179a 100644 --- a/src/network/socket/qnativesocketengine_winrt.cpp +++ b/src/network/socket/qnativesocketengine_winrt.cpp @@ -768,7 +768,7 @@ bool QNativeSocketEnginePrivate::createNewSocket(QAbstractSocket::SocketType soc return false; } socketDescriptor = qintptr(socket.Detach()); - return true; + break; } case QAbstractSocket::UdpSocket: { ComPtr socket; @@ -780,13 +780,21 @@ bool QNativeSocketEnginePrivate::createNewSocket(QAbstractSocket::SocketType soc EventRegistrationToken token; socketDescriptor = qintptr(socket.Detach()); udpSocket()->add_MessageReceived(Callback(this, &QNativeSocketEnginePrivate::handleNewDatagram).Get(), &token); - return true; + break; } default: qWarning("Invalid socket type"); return false; } - return false; + + // Make the socket nonblocking. + if (!setOption(QAbstractSocketEngine::NonBlockingSocketOption, 1)) { + setError(QAbstractSocket::UnsupportedSocketOperationError, NonBlockingInitFailedErrorString); + q_func()->close(); + return false; + } + + return true; } QNativeSocketEnginePrivate::QNativeSocketEnginePrivate() -- cgit v1.2.3 From a945124a4212238f4d752ff2f2f3065c5adc1655 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Wed, 17 Dec 2014 18:47:52 -0800 Subject: Make the detection of the number of cores on Unix prettier This is a no-op change. It doesn't improve or worsen the code at all. Change-Id: Ifd5273842370ca9bce0ed74f2f2d54d453797948 Reviewed-by: Thiago Macieira --- src/corelib/thread/qthread_unix.cpp | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/corelib/thread/qthread_unix.cpp b/src/corelib/thread/qthread_unix.cpp index 9a14503584..e4338e10b4 100644 --- a/src/corelib/thread/qthread_unix.cpp +++ b/src/corelib/thread/qthread_unix.cpp @@ -395,14 +395,13 @@ Qt::HANDLE QThread::currentThreadId() Q_DECL_NOTHROW int QThread::idealThreadCount() Q_DECL_NOTHROW { - int cores = -1; + int cores = 1; #if defined(Q_OS_HPUX) // HP-UX struct pst_dynamic psd; if (pstat_getdynamic(&psd, sizeof(psd), 1, 0) == -1) { perror("pstat_getdynamic"); - cores = -1; } else { cores = (int)psd.psd_proc_cnt; } @@ -414,7 +413,6 @@ int QThread::idealThreadCount() Q_DECL_NOTHROW mib[1] = HW_NCPU; if (sysctl(mib, 2, &cores, &len, NULL, 0) != 0) { perror("sysctl"); - cores = -1; } #elif defined(Q_OS_IRIX) // IRIX @@ -449,9 +447,9 @@ int QThread::idealThreadCount() Q_DECL_NOTHROW #else // the rest: Linux, Solaris, AIX, Tru64 cores = (int)sysconf(_SC_NPROCESSORS_ONLN); -#endif if (cores == -1) return 1; +#endif return cores; } -- cgit v1.2.3 From 6342c4a1836f76db43e09a89239d73eda44f414a Mon Sep 17 00:00:00 2001 From: Richard Moe Gustavsen Date: Fri, 13 Feb 2015 12:30:33 +0100 Subject: iOS: only flush non-user input events from layoutSubviews MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change a4e1c15b1 will cause setGeometry to take immediate effect by doing a synchronuous layout and a flush. As a side-effect, the flush will also send posted touch events. So if the current setGeometry call comes from a touchMove, a touchEnd might be delivered before the touchMove returns. A crash in QToolBar drag-n-drop is seen from this. There drag data is deleted on mouse release (during the flush), while a mouse move is already handled on the stack. When the code returns to the move handler, drag-data has been deleted, and we have a crash. Since the root problem is that we flush events on a callback from the app, we can be more careful and precise by only flushing non-user input events from layoutSubviews. Change-Id: I3f5e025d774d21509ef837de9d7e85a1ac6e48cc Reviewed-by: Tor Arne Vestbø --- src/plugins/platforms/ios/quiview.mm | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/plugins/platforms/ios/quiview.mm b/src/plugins/platforms/ios/quiview.mm index c4b92618b1..19b2668a95 100644 --- a/src/plugins/platforms/ios/quiview.mm +++ b/src/plugins/platforms/ios/quiview.mm @@ -146,8 +146,9 @@ QRect previousGeometry = requestedGeometry != actualGeometry ? requestedGeometry : qt_window_private(m_qioswindow->window())->geometry; - QWindowSystemInterface::handleGeometryChange(m_qioswindow->window(), actualGeometry, previousGeometry); - QWindowSystemInterface::flushWindowSystemEvents(); + QWindow *window = m_qioswindow->window(); + QWindowSystemInterface::handleGeometryChange(window, actualGeometry, previousGeometry); + QWindowSystemInterface::flushWindowSystemEvents(window->inherits("QWidgetWindow") ? QEventLoop::ExcludeUserInputEvents : QEventLoop::AllEvents); if (actualGeometry.size() != previousGeometry.size()) { // Trigger expose event on resize -- cgit v1.2.3 From ab3113b679922e5232d56a9532c4330b8986e493 Mon Sep 17 00:00:00 2001 From: Richard Moe Gustavsen Date: Thu, 12 Feb 2015 13:07:24 +0100 Subject: QGuiApplication: revert b8d0fac5a9 (mouse event handling) The current attempt to fix the problem described in b8d0fac5a9 has shown to have unforeseen issues. The assert in the patch has been triggered in user code (see bug report), which, when looking more closely, shows that the assert cannot be guaranteed for all cases. E.g if user code (or Qt drag'n'drop code) starts a new event loop upon receiving the move event, this can deliver new mouse events before the move returns, which will trigger the assert. So it seems like the most correct solution is to *post* the second button event after all (directly trailing the move event), to at least make sure mouse events are being delivered in the correct order. The crash that caused the original change will need to be fixed by other means. Task-number: QTBUG-38597 Change-Id: I47633d1ea310b7c16e937ef0404d9954281452c3 Reviewed-by: Friedemann Kleint Reviewed-by: Laszlo Agocs --- src/gui/kernel/qguiapplication.cpp | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) (limited to 'src') diff --git a/src/gui/kernel/qguiapplication.cpp b/src/gui/kernel/qguiapplication.cpp index 928d0cddc9..42b80846eb 100644 --- a/src/gui/kernel/qguiapplication.cpp +++ b/src/gui/kernel/qguiapplication.cpp @@ -1682,14 +1682,12 @@ void QGuiApplicationPrivate::processMouseEvent(QWindowSystemInterfacePrivate::Mo if (e->globalPos != QGuiApplicationPrivate::lastCursorPosition && (stateChange != Qt::NoButton)) { // A mouse event should not change both position and buttons at the same time. Instead we // should first send a move event followed by a button changed event. Since this is not the case - // with the current event, we fake a move-only event that we recurse and process first. This - // will update the global mouse position and cause the second event to be a button only event. - QWindowSystemInterfacePrivate::MouseEvent moveEvent(e->window.data(), - e->timestamp, e->type, e->localPos, e->globalPos, buttons, e->modifiers, e->source); - moveEvent.synthetic = e->synthetic; - processMouseEvent(&moveEvent); - Q_ASSERT(e->globalPos == QGuiApplicationPrivate::lastCursorPosition); - // continue with processing mouse button change event + // with the current event, we split it in two. + QWindowSystemInterfacePrivate::MouseEvent *mouseButtonEvent = new QWindowSystemInterfacePrivate::MouseEvent( + e->window.data(), e->timestamp, e->type, e->localPos, e->globalPos, e->buttons, e->modifiers); + mouseButtonEvent->synthetic = e->synthetic; + QWindowSystemInterfacePrivate::windowSystemEventQueue.prepend(mouseButtonEvent); + stateChange = Qt::NoButton; } QWindow *window = e->window.data(); -- cgit v1.2.3 From afb52763aa759b3b60be2816212af04d0063595c Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Tue, 10 Feb 2015 08:26:14 -0800 Subject: Doc: clarify what QUrl::topLevelDomain actually does Task-number: QTBUG-44390 Change-Id: I1a800c709d3543699131ffff13c19789a12dac0b Reviewed-by: Martin Smith Reviewed-by: Richard J. Moore --- src/corelib/io/qurl.cpp | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'src') diff --git a/src/corelib/io/qurl.cpp b/src/corelib/io/qurl.cpp index eb97eaf6d6..f459928110 100644 --- a/src/corelib/io/qurl.cpp +++ b/src/corelib/io/qurl.cpp @@ -3083,6 +3083,21 @@ bool QUrl::hasFragment() const URL does not contain a valid TLD, in which case the function returns an empty string. + Note that this function considers a TLD to be any domain that allows users + to register subdomains under, including many home, dynamic DNS websites and + blogging providers. This is useful for determining whether two websites + belong to the same infrastructure and communication should be allowed, such + as browser cookies: two domains should be considered part of the same + website if they share at least one label in addition to the value + returned by this function. + + \list + \li \c{foo.co.uk} and \c{foo.com} do not share a top-level domain + \li \c{foo.co.uk} and \c{bar.co.uk} share the \c{.co.uk} domain, but the next label is different + \li \c{www.foo.co.uk} and \c{ftp.foo.co.uk} share the same top-level domain and one more label, + so they are considered part of the same site + \endlist + If \a options includes EncodeUnicode, the returned string will be in ASCII Compatible Encoding. */ -- cgit v1.2.3 From 6aac5c5cf36fef62431b98d813803dfdc0a6b475 Mon Sep 17 00:00:00 2001 From: Florian Bruhin Date: Fri, 13 Feb 2015 14:55:03 +0100 Subject: Fix links in plural words. In some documents, "{QObject}s" was used which didn't show up as link. This is fixed by using "\l{QObject}s" instead. Change-Id: I90dbd543790842b242a11f3f94a32d4273ebb38d Reviewed-by: Martin Smith --- src/corelib/doc/src/animation.qdoc | 6 +++--- src/corelib/doc/src/filestorage.qdoc | 2 +- src/corelib/tools/qbytearray.cpp | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/corelib/doc/src/animation.qdoc b/src/corelib/doc/src/animation.qdoc index 9385c08995..252583fa8a 100644 --- a/src/corelib/doc/src/animation.qdoc +++ b/src/corelib/doc/src/animation.qdoc @@ -48,7 +48,7 @@ The animation framework aims to provide an easy way for creating animated and smooth GUIs. By animating Qt properties, the framework provides great - freedom for animating widgets and other {QObject}s. The framework can + freedom for animating widgets and other \l{QObject}s. The framework can also be used with the Graphics View framework. Many of the concepts available in the animation framework are also available in \l{Qt Quick}, where it offers a declarative way of defining animations. Much of the @@ -57,7 +57,7 @@ In this overview, we explain the basics of its architecture. We also show examples of the most common techniques that the - framework allows for animating {QObject}s and graphics items. + framework allows for animating \l{QObject}s and graphics items. \tableofcontents @@ -85,7 +85,7 @@ over the property using an easing curve. So when you want to animate a value, you can declare it as a property and make your class a QObject. Note that this gives us great freedom in - animating already existing widgets and other {QObject}s. + animating already existing widgets and other \l{QObject}s. Complex animations can be constructed by building a tree structure of \l{QAbstractAnimation}s. The tree is built by using diff --git a/src/corelib/doc/src/filestorage.qdoc b/src/corelib/doc/src/filestorage.qdoc index a60c5846ff..a59683f732 100644 --- a/src/corelib/doc/src/filestorage.qdoc +++ b/src/corelib/doc/src/filestorage.qdoc @@ -87,7 +87,7 @@ There are three general ways to use QTextStream when reading text files: \list \li Chunk by chunk, by calling \l{QBuffer::readLine()}{readLine()} or \l{QBuffer::readAll()}{readAll()}. - \li Word by word. QTextStream supports streaming into {QString}s, {QByteArray}s + \li Word by word. QTextStream supports streaming into \l{QString}s, \l{QByteArray}s and char* buffers. Words are delimited by space, and leading white space is automatically skipped. \li Character by character, by streaming into QChar or char types. This diff --git a/src/corelib/tools/qbytearray.cpp b/src/corelib/tools/qbytearray.cpp index bd0215902c..5ec8c317e8 100644 --- a/src/corelib/tools/qbytearray.cpp +++ b/src/corelib/tools/qbytearray.cpp @@ -726,7 +726,7 @@ static inline char qToLower(char c) occurrences of a particular value with another, use one of the two-parameter replace() overloads. - {QByteArray}s can be compared using overloaded operators such as + \l{QByteArray}s can be compared using overloaded operators such as operator<(), operator<=(), operator==(), operator>=(), and so on. The comparison is based exclusively on the numeric values of the characters and is very fast, but is not what a human would @@ -771,7 +771,7 @@ static inline char qToLower(char c) lastIndexOf(), operator<(), operator<=(), operator>(), operator>=(), toLower() and toUpper(). - This issue does not apply to {QString}s since they represent + This issue does not apply to \l{QString}s since they represent characters using Unicode. \sa QString, QBitArray -- cgit v1.2.3 From de98302f70071236cea6597f86b7754e0ffc00df Mon Sep 17 00:00:00 2001 From: Samuel Gaist Date: Mon, 16 Feb 2015 00:46:48 +0100 Subject: Update SQL plugin path within Qt's sources MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The current SQL plugins path are still Qt 4 style. This patch adds qtbase to ensure users will be directed to the right place. Change-Id: I11bf933864f0a8955079bf7175eb1e33bb5bc07f Reviewed-by: Sze Howe Koh Reviewed-by: Topi Reiniö --- src/sql/doc/snippets/code/doc_src_sql-driver.qdoc | 48 +++++++++++------------ src/sql/doc/src/sql-driver.qdoc | 4 +- 2 files changed, 26 insertions(+), 26 deletions(-) (limited to 'src') diff --git a/src/sql/doc/snippets/code/doc_src_sql-driver.qdoc b/src/sql/doc/snippets/code/doc_src_sql-driver.qdoc index 052f085bf2..ce214c01bd 100644 --- a/src/sql/doc/snippets/code/doc_src_sql-driver.qdoc +++ b/src/sql/doc/snippets/code/doc_src_sql-driver.qdoc @@ -60,34 +60,34 @@ END //! [3] -cd $QTDIR/src/plugins/sqldrivers/mysql +cd $QTDIR/qtbase/src/plugins/sqldrivers/mysql qmake "INCLUDEPATH+=/usr/local/include" "LIBS+=-L/usr/local/lib -lmysqlclient_r" mysql.pro make //! [3] //! [4] -cd $QTDIR/src/plugins/sqldrivers/mysql +cd $QTDIR/qtbase/src/plugins/sqldrivers/mysql make install //! [4] //! [5] -cd %QTDIR%\src\plugins\sqldrivers\mysql +cd %QTDIR%\qtbase\src\plugins\sqldrivers\mysql qmake "INCLUDEPATH+=C:/MySQL/include" "LIBS+=C:/MYSQL/MySQL Server /lib/opt/libmysql.lib" mysql.pro nmake //! [5] //! [6] -cd $QTDIR/src/plugins/sqldrivers/oci +cd $QTDIR/qtbase/src/plugins/sqldrivers/oci qmake "INCLUDEPATH+=$ORACLE_HOME/rdbms/public $ORACLE_HOME/rdbms/demo" "LIBS+=-L$ORACLE_HOME/lib -lclntsh -lwtc9" oci.pro make //! [6] //! [7] -cd $QTDIR/src/plugins/sqldrivers/oci +cd $QTDIR/qtbase/src/plugins/sqldrivers/oci qmake "INCLUDEPATH+=/usr/include/oracle/10.1.0.3/client/" "LIBS+=-L/usr/lib/oracle/10.1.0.3/client/lib -lclntsh" oci.pro make //! [7] @@ -96,7 +96,7 @@ make //! [8] set INCLUDE=%INCLUDE%;c:\oracle\oci\include set LIB=%LIB%;c:\oracle\oci\lib\msvc -cd %QTDIR%\src\plugins\sqldrivers\oci +cd %QTDIR%\qtbase\src\plugins\sqldrivers\oci qmake oci.pro nmake //! [8] @@ -108,116 +108,116 @@ set PATH=%PATH%;c:\oracle\bin //! [11] -cd $QTDIR/src/plugins/sqldrivers/odbc +cd $QTDIR/qtbase/src/plugins/sqldrivers/odbc qmake "INCLUDEPATH+=/usr/local/unixODBC/include" "LIBS+=-L/usr/local/unixODBC/lib -lodbc" make //! [11] //! [12] -cd %QTDIR%\src\plugins\sqldrivers\odbc +cd %QTDIR%\qtbase\src\plugins\sqldrivers\odbc qmake odbc.pro nmake //! [12] //! [13] -cd $QTDIR/src/plugins/sqldrivers/psql +cd $QTDIR/qtbase/src/plugins/sqldrivers/psql qmake "INCLUDEPATH+=/usr/include/pgsql" "LIBS+=-L/usr/lib -lpq" psql.pro make //! [13] //! [14] -cd $QTDIR/src/plugins/sqldrivers/psql +cd $QTDIR/qtbase/src/plugins/sqldrivers/psql make install //! [14] //! [15] -cd %QTDIR%\src\plugins\sqldrivers\psql +cd %QTDIR%\qtbase\src\plugins\sqldrivers\psql qmake "INCLUDEPATH+=C:/psql/include" "LIBS+=C:/psql/lib/ms/libpq.lib" psql.pro nmake //! [15] //! [16] -cd $QTDIR/src/plugins/sqldrivers/tds +cd $QTDIR/qtbase/src/plugins/sqldrivers/tds qmake "INCLUDEPATH=$SYBASE/include" "LIBS=-L$SYBASE/lib -lsybdb" make //! [16] //! [17] -cd %QTDIR%\src\plugins\sqldrivers\tds +cd %QTDIR%\qtbase\src\plugins\sqldrivers\tds qmake "LIBS+=NTWDBLIB.LIB" tds.pro nmake //! [17] //! [18] -cd $QTDIR/src/plugins/sqldrivers/db2 +cd $QTDIR/qtbase/src/plugins/sqldrivers/db2 qmake "INCLUDEPATH+=$DB2DIR/include" "LIBS+=-L$DB2DIR/lib -ldb2" make //! [18] //! [19] -cd $QTDIR/src/plugins/sqldrivers/db2 +cd $QTDIR/qtbase/src/plugins/sqldrivers/db2 make install //! [19] //! [20] -cd %QTDIR%\src\plugins\sqldrivers\db2 +cd %QTDIR%\qtbase\src\plugins\sqldrivers\db2 qmake "INCLUDEPATH+=/sqllib/include" "LIBS+=/sqllib/lib/db2cli.lib" nmake //! [20] //! [21] -cd $QTDIR/src/plugins/sqldrivers/sqlite +cd $QTDIR/qtbase/src/plugins/sqldrivers/sqlite qmake "INCLUDEPATH+=$SQLITE/include" "LIBS+=-L$SQLITE/lib -lsqlite" make //! [21] //! [22] -cd $QTDIR/src/plugins/sqldrivers/sqlite +cd $QTDIR/qtbase/src/plugins/sqldrivers/sqlite make install //! [22] //! [23] -cd %QTDIR%\src\plugins\sqldrivers\sqlite +cd %QTDIR%\qtbase\src\plugins\sqldrivers\sqlite qmake "INCLUDEPATH+=C:/SQLITE/INCLUDE" "LIBS+=C:/SQLITE/LIB/SQLITE3.LIB" sqlite.pro nmake //! [23] //! [27] -cd $QTDIR/src/plugins/sqldrivers/ibase +cd $QTDIR/qtbase/src/plugins/sqldrivers/ibase qmake "INCLUDEPATH+=/opt/interbase/include" "LIBS+=-L/opt/interbase/lib" ibase.pro make //! [27] //! [28] -cd $QTDIR/src/plugins/sqldrivers/ibase +cd $QTDIR/qtbase/src/plugins/sqldrivers/ibase qmake "INCLUDEPATH+=/opt/interbase/include" "LIBS+=-L/opt/interbase/lib -lfbclient" ibase.pro make //! [28] //! [29] -cd %QTDIR%\src\plugins\sqldrivers\ibase +cd %QTDIR%\qtbase\src\plugins\sqldrivers\ibase qmake "INCLUDEPATH+=C:/interbase/include" ibase.pro nmake //! [29] //! [30] -cd %QTDIR%\src\plugins\sqldrivers\ibase +cd %QTDIR%\qtbase\src\plugins\sqldrivers\ibase qmake "INCLUDEPATH+=C:/interbase/include" "LIBS+=-lfbclient" ibase.pro nmake //! [30] @@ -229,7 +229,7 @@ make //! [32] //! [33] -cd $QTDIR/src/plugins/sqldrivers/oci +cd $QTDIR/qtbase/src/plugins/sqldrivers/oci qmake "INCLUDEPATH+=/usr/include/oracle/10.1.0.3/client" "LIBS+=-L/usr/lib/oracle/10.1.0.3/client/lib -Wl,-rpath,/usr/lib/oracle/10.1.0.3/client/lib -lclntsh -lnnz10" oci.pro make //! [33] diff --git a/src/sql/doc/src/sql-driver.qdoc b/src/sql/doc/src/sql-driver.qdoc index e2ffdaea2c..81cb34577b 100644 --- a/src/sql/doc/src/sql-driver.qdoc +++ b/src/sql/doc/src/sql-driver.qdoc @@ -471,7 +471,7 @@ By default the Microsoft library is used on Windows, if you want to force the use of the Sybase Open Client, you must define \c - Q_USE_SYBASE in \c{%QTDIR%\src\sql\drivers\tds\qsql_tds.cpp}. If you + Q_USE_SYBASE in \c{%QTDIR%\qtbase\src\sql\drivers\tds\qsql_tds.cpp}. If you are not using a Microsoft compiler, replace \c nmake with \c make in the line above. @@ -751,7 +751,7 @@ must use the Q_PLUGIN_METADATA() macro. Read \l{How to Create Qt Plugins} for more information on this. You can also check out how this is done in the SQL plugins that are provided with Qt in - \c{QTDIR/src/plugins/sqldrivers} and \c{QTDIR/src/sql/drivers}. + \c{QTDIR/qtbase/src/plugins/sqldrivers} and \c{QTDIR/qtbase/src/sql/drivers}. The following code can be used as a skeleton for a SQL driver: -- cgit v1.2.3 From 76de1ac0a4cd384f608a14b5d77a8cf3ef1ec868 Mon Sep 17 00:00:00 2001 From: Alexander Volkov Date: Mon, 9 Feb 2015 17:19:14 +0300 Subject: xcb: Update mouse buttons from MotionNotify events We don't receive ButtonRelease event after closing a popup by clicking outside of the client area. Thus the internal state of mouse buttons in the xcb plugin becomes outdated until we receive ButtonRelease event. This commit updates the internal state of mouse buttons from MotionNotify events. So when a user will move a mouse on the client area, the xcb plugin will send a mouse event with updated buttons to Qt Gui and QGuiApplication will detect the following mouse events correctly. Task-number: QTBUG-32609 Task-number: QTBUG-35065 Task-number: QTBUG-43776 Task-number: QTBUG-44166 Task-number: QTBUG-44231 Change-Id: Ica334dfbf04f7ef81db86b25262328fe5da11808 Reviewed-by: Allan Sandfeld Jensen Reviewed-by: Shawn Rutledge Reviewed-by: Gatis Paeglis --- src/plugins/platforms/xcb/qxcbconnection.cpp | 14 ++++++++++---- src/plugins/platforms/xcb/qxcbconnection.h | 1 + 2 files changed, 11 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/plugins/platforms/xcb/qxcbconnection.cpp b/src/plugins/platforms/xcb/qxcbconnection.cpp index 5510c3b1b4..77e4601485 100644 --- a/src/plugins/platforms/xcb/qxcbconnection.cpp +++ b/src/plugins/platforms/xcb/qxcbconnection.cpp @@ -818,6 +818,15 @@ void QXcbConnection::handleButtonRelease(xcb_generic_event_t *ev) qCDebug(lcQpaXInput, "xcb: released mouse button %d, button state %X", event->detail, static_cast(m_buttons)); } +void QXcbConnection::handleMotionNotify(xcb_generic_event_t *ev) +{ + xcb_motion_notify_event_t *event = (xcb_motion_notify_event_t *)ev; + + m_buttons = (m_buttons & ~0x7) | translateMouseButtons(event->state); + if (Q_UNLIKELY(lcQpaXInput().isDebugEnabled())) + qDebug("xcb: moved mouse to %4d, %4d; button state %X", event->event_x, event->event_y, static_cast(m_buttons)); +} + #ifndef QT_NO_XKB namespace { typedef union { @@ -868,11 +877,8 @@ void QXcbConnection::handleXcbEvent(xcb_generic_event_t *event) handleButtonRelease(event); HANDLE_PLATFORM_WINDOW_EVENT(xcb_button_release_event_t, event, handleButtonReleaseEvent); case XCB_MOTION_NOTIFY: - if (Q_UNLIKELY(lcQpaXInput().isDebugEnabled())) { - xcb_motion_notify_event_t *mev = (xcb_motion_notify_event_t *)event; - qDebug("xcb: moved mouse to %4d, %4d; button state %X", mev->event_x, mev->event_y, static_cast(m_buttons)); - } m_keyboard->updateXKBStateFromCore(((xcb_motion_notify_event_t *)event)->state); + handleMotionNotify(event); HANDLE_PLATFORM_WINDOW_EVENT(xcb_motion_notify_event_t, event, handleMotionNotifyEvent); case XCB_CONFIGURE_NOTIFY: HANDLE_PLATFORM_WINDOW_EVENT(xcb_configure_notify_event_t, event, handleConfigureNotifyEvent); diff --git a/src/plugins/platforms/xcb/qxcbconnection.h b/src/plugins/platforms/xcb/qxcbconnection.h index 4d0596550c..9a73006cec 100644 --- a/src/plugins/platforms/xcb/qxcbconnection.h +++ b/src/plugins/platforms/xcb/qxcbconnection.h @@ -496,6 +496,7 @@ private: void updateScreens(); void handleButtonPress(xcb_generic_event_t *event); void handleButtonRelease(xcb_generic_event_t *event); + void handleMotionNotify(xcb_generic_event_t *event); bool m_xi2Enabled; int m_xi2Minor; -- cgit v1.2.3 From cbece1e8c471322b0650dfb2a3f7b2258ff4c1c9 Mon Sep 17 00:00:00 2001 From: Andy Shaw Date: Thu, 12 Feb 2015 09:19:25 +0100 Subject: Ensure the filedialog shows the initial filename Whenever the selection changes it will call panelSelectionDidChange even if the panel is not visible which causes it to overwrite our chosen initial file with "untitled". Therefore we only set the name when the panel is actually visible. Change-Id: I09f7ebabce5c2139a7f74b953391d39dfad65db2 Reviewed-by: Joerg Bornemann --- src/plugins/platforms/cocoa/qcocoafiledialoghelper.mm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/plugins/platforms/cocoa/qcocoafiledialoghelper.mm b/src/plugins/platforms/cocoa/qcocoafiledialoghelper.mm index 084b53af79..bec5602934 100644 --- a/src/plugins/platforms/cocoa/qcocoafiledialoghelper.mm +++ b/src/plugins/platforms/cocoa/qcocoafiledialoghelper.mm @@ -446,7 +446,7 @@ static QString strippedText(QString s) - (void)panelSelectionDidChange:(id)sender { Q_UNUSED(sender); - if (mHelper) { + if (mHelper && [mSavePanel isVisible]) { QString selection = QCFString::toQString([[mSavePanel URL] path]); if (selection != mCurrentSelection) { *mCurrentSelection = selection; -- cgit v1.2.3 From 69196b38c481610ef30bfe8ce8e7ba6826729ab8 Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Mon, 16 Feb 2015 15:31:58 +0100 Subject: fix non-git shadow builds the qt headers live in the source dir in this configuration. instead of hard-coding the path in the project file, use the correct module variable. this requires harfbuzz-ng to be built after corelib. Change-Id: If1b64b59a0939d3b5190331fcf70da566d4eeedd Reviewed-by: Thiago Macieira --- src/3rdparty/harfbuzz-ng/harfbuzz-ng.pro | 2 +- src/src.pro | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/3rdparty/harfbuzz-ng/harfbuzz-ng.pro b/src/3rdparty/harfbuzz-ng/harfbuzz-ng.pro index a8885d71df..300b22ec57 100644 --- a/src/3rdparty/harfbuzz-ng/harfbuzz-ng.pro +++ b/src/3rdparty/harfbuzz-ng/harfbuzz-ng.pro @@ -14,7 +14,7 @@ DEFINES += HAVE_ATEXIT unix: DEFINES += HAVE_PTHREAD HAVE_SCHED_H HAVE_SCHED_YIELD INCLUDEPATH += $$PWD/include -INCLUDEPATH += $$OUT_PWD/../../../include +INCLUDEPATH += $$QT.core.includes SOURCES += \ $$PWD/src/hb-blob.cc \ diff --git a/src/src.pro b/src/src.pro index 81f4fa5256..83f7587f0e 100644 --- a/src/src.pro +++ b/src/src.pro @@ -83,6 +83,7 @@ src_testlib.depends = src_corelib # src_gui & src_widgets are not build-depend src_3rdparty_harfbuzzng.subdir = $$PWD/3rdparty/harfbuzz-ng src_3rdparty_harfbuzzng.target = sub-3rdparty-harfbuzzng +src_3rdparty_harfbuzzng.depends = src_corelib # for the Qt atomics src_angle.subdir = $$PWD/angle src_angle.target = sub-angle -- cgit v1.2.3 From 8d6341a721d07e3cc30032bcc89f7e25cb00b9eb Mon Sep 17 00:00:00 2001 From: Albert Astals Cid Date: Mon, 16 Feb 2015 22:53:02 +0100 Subject: Call [ofono|nm]Registered delayed in constructor otherwise signals will be lost If we call them just in the constructor all the signals they sent out can't be connected and will be lost, particularly this means the QNetworkConfigurationManager doesn't see my ethernet connection and thus thinks i'm not online Change-Id: I1480f76338d6ae4fbed676f9fa40ada18ea431ad Reviewed-by: Alex Blasche --- src/plugins/bearer/networkmanager/qnetworkmanagerengine.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/plugins/bearer/networkmanager/qnetworkmanagerengine.cpp b/src/plugins/bearer/networkmanager/qnetworkmanagerengine.cpp index f52b9d4b4d..0378ac7dac 100644 --- a/src/plugins/bearer/networkmanager/qnetworkmanagerengine.cpp +++ b/src/plugins/bearer/networkmanager/qnetworkmanagerengine.cpp @@ -80,10 +80,10 @@ QNetworkManagerEngine::QNetworkManagerEngine(QObject *parent) this, SLOT(ofonoUnRegistered(QString))); if (QDBusConnection::systemBus().interface()->isServiceRegistered("org.ofono")) - ofonoRegistered(); + QMetaObject::invokeMethod(this, "ofonoRegistered", Qt::QueuedConnection); if (QDBusConnection::systemBus().interface()->isServiceRegistered(NM_DBUS_SERVICE)) - nmRegistered(); + QMetaObject::invokeMethod(this, "nmRegistered", Qt::QueuedConnection); } QNetworkManagerEngine::~QNetworkManagerEngine() -- cgit v1.2.3 From bcfacd4b6f35dfd00f0f04d562f345bbc98cec13 Mon Sep 17 00:00:00 2001 From: Andy Shaw Date: Fri, 24 Oct 2014 19:33:30 +0200 Subject: Make sure the QSplashScreen isn't closed instantly when calling finish() MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Most of the time the widget passed in to finish() will not yet have a window handle so it would just call close() straight away. This way it ensures has a window handle. Task-number: QTBUG-35757 Change-Id: I2e212a2ea496cc4e4bba57a8c2d0d127afc43e48 Reviewed-by: Friedemann Kleint Reviewed-by: Thorbjørn Lund Martsum Reviewed-by: Alex Blasche --- src/widgets/widgets/qsplashscreen.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/widgets/widgets/qsplashscreen.cpp b/src/widgets/widgets/qsplashscreen.cpp index d6b94803d7..30d6baa899 100644 --- a/src/widgets/widgets/qsplashscreen.cpp +++ b/src/widgets/widgets/qsplashscreen.cpp @@ -262,8 +262,11 @@ inline static bool waitForWindowExposed(QWindow *window, int timeout = 1000) void QSplashScreen::finish(QWidget *mainWin) { - if (mainWin && mainWin->windowHandle()) + if (mainWin) { + if (!mainWin->windowHandle()) + mainWin->createWinId(); waitForWindowExposed(mainWin->windowHandle()); + } close(); } -- cgit v1.2.3 From 395f0181ee6d8a9decedea62a096c69a01a48a7c Mon Sep 17 00:00:00 2001 From: Jan Arve Saether Date: Mon, 16 Feb 2015 17:17:23 +0100 Subject: Fix crash in QAccessibleTextWidget::attributes() Task-number: QTBUG-44006 Change-Id: I79d7d84206a3e4abcd49c7c6e5e91b7c9c753dd6 Reviewed-by: Frederik Gladhorn --- src/widgets/accessible/qaccessiblewidgets.cpp | 28 +++++++++++++++++++-------- 1 file changed, 20 insertions(+), 8 deletions(-) (limited to 'src') diff --git a/src/widgets/accessible/qaccessiblewidgets.cpp b/src/widgets/accessible/qaccessiblewidgets.cpp index f459affd07..6e1e3df89a 100644 --- a/src/widgets/accessible/qaccessiblewidgets.cpp +++ b/src/widgets/accessible/qaccessiblewidgets.cpp @@ -727,19 +727,31 @@ QString QAccessibleTextWidget::attributes(int offset, int *startOffset, int *end int blockEnd = blockStart + block.length(); QTextBlock::iterator iter = block.begin(); - while (!iter.fragment().contains(offset)) + int lastFragmentIndex = blockStart; + while (!iter.atEnd()) { + QTextFragment f = iter.fragment(); + if (f.contains(offset)) + break; + lastFragmentIndex = f.position() + f.length(); ++iter; + } - QTextFragment fragment = iter.fragment(); - int pos = fragment.position(); - - // text block and fragment may overlap, use the smallest common range - *startOffset = qMax(pos, blockStart); + QTextCharFormat charFormat; + if (!iter.atEnd()) { + QTextFragment fragment = iter.fragment(); + charFormat = fragment.charFormat(); + int pos = fragment.position(); + // text block and fragment may overlap, use the smallest common range + *startOffset = qMax(pos, blockStart); + *endOffset = qMin(pos + fragment.length(), blockEnd); + } else { + charFormat = block.charFormat(); + *startOffset = lastFragmentIndex; + *endOffset = blockEnd; + } Q_ASSERT(*startOffset <= offset); - *endOffset = qMin(pos + fragment.length(), blockEnd); Q_ASSERT(*endOffset >= offset); - QTextCharFormat charFormat = fragment.charFormat(); QTextBlockFormat blockFormat = cursor.blockFormat(); QMap attrs; -- cgit v1.2.3 From 732c99487682f0be0b201deb1adf697f6d323b00 Mon Sep 17 00:00:00 2001 From: Joerg Bornemann Date: Tue, 17 Feb 2015 11:56:46 +0100 Subject: work around MSVC level 4 warning Change-Id: Ide3541a8a1a16a1f9b6b01f54d5b2f6ab178c3ac Task-number: QTBUG-7233 Reviewed-by: hjk --- src/corelib/global/qglobal.h | 1 + 1 file changed, 1 insertion(+) (limited to 'src') diff --git a/src/corelib/global/qglobal.h b/src/corelib/global/qglobal.h index dade7fc6ec..455582e310 100644 --- a/src/corelib/global/qglobal.h +++ b/src/corelib/global/qglobal.h @@ -865,6 +865,7 @@ Q_CORE_EXPORT void qFreeAligned(void *ptr); /* make use of decltype or GCC's __typeof__ extension */ template class QForeachContainer { + QForeachContainer &operator=(const QForeachContainer &) Q_DECL_EQ_DELETE; public: inline QForeachContainer(const T& t) : c(t), i(c.begin()), e(c.end()), control(1) { } const T c; -- cgit v1.2.3 From 8fccfef424e7d2b7a2019b1f828234145d4011df Mon Sep 17 00:00:00 2001 From: Albert Astals Cid Date: Tue, 17 Feb 2015 09:53:27 +0100 Subject: Make sure there's a scene before using it MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fixes crash hovering links in quassel Task-number: QTBUG-44509 Change-Id: I77d8d9118ad185ed70a46e91445e2960200e562b Reviewed-by: Michael Brüning Reviewed-by: Frederik Gladhorn Reviewed-by: Marc Mutz --- src/widgets/kernel/qwidget.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/widgets/kernel/qwidget.cpp b/src/widgets/kernel/qwidget.cpp index 68715413d1..cb2e9e0bec 100644 --- a/src/widgets/kernel/qwidget.cpp +++ b/src/widgets/kernel/qwidget.cpp @@ -12272,7 +12272,7 @@ QPoint QWidget::mapToGlobal(const QPoint &pos) const { #ifndef QT_NO_GRAPHICSVIEW Q_D(const QWidget); - if (d->extra && d->extra->proxyWidget) { + if (d->extra && d->extra->proxyWidget && d->extra->proxyWidget->scene()) { const QList views = d->extra->proxyWidget->scene()->views(); if (!views.isEmpty()) { const QPointF scenePos = d->extra->proxyWidget->mapToScene(pos); @@ -12307,7 +12307,7 @@ QPoint QWidget::mapFromGlobal(const QPoint &pos) const { #ifndef QT_NO_GRAPHICSVIEW Q_D(const QWidget); - if (d->extra && d->extra->proxyWidget) { + if (d->extra && d->extra->proxyWidget && d->extra->proxyWidget->scene()) { const QList views = d->extra->proxyWidget->scene()->views(); if (!views.isEmpty()) { const QPoint viewPortPos = views.first()->viewport()->mapFromGlobal(pos); -- cgit v1.2.3 From 921dd85c7a90bf7432d50bd9f631d065f5281d34 Mon Sep 17 00:00:00 2001 From: Yoann Lopes Date: Tue, 10 Feb 2015 16:01:22 +0100 Subject: Android: fix timed QWaitCondition::wait() on Android >= 5.0. wait() was always returning immediately, regardless of the timeout value, due to a timespec comparison from different clock types. On Android 5.0, qt_gettime() uses the monotonic clock but the wait condition was using the real time clock. __pthread_cond_timedwait_relative() is not exported anymore in Android 5.0, we therefore fall back to pthread_cond_timedwait(). Since the monotonic clock is now available, qt_gettime returns a time based on it. The wait condition consequently needs to use the monotonic clock. Change-Id: Ie7cf909b81107edd7207c3c039b3ec1f5422303f Reviewed-by: Thiago Macieira Reviewed-by: Eskil Abrahamsen Blomfeldt --- src/corelib/thread/qwaitcondition_unix.cpp | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/corelib/thread/qwaitcondition_unix.cpp b/src/corelib/thread/qwaitcondition_unix.cpp index 3bcf3202a1..e03187196f 100644 --- a/src/corelib/thread/qwaitcondition_unix.cpp +++ b/src/corelib/thread/qwaitcondition_unix.cpp @@ -52,9 +52,12 @@ QT_BEGIN_NAMESPACE #ifdef Q_OS_ANDROID -// Android lacks pthread_condattr_setclock, but it does have a nice function -// for relative waits. Use weakref so we can determine at runtime whether it is -// present. +// pthread_condattr_setclock is available only since Android 5.0. On older versions, there's +// a private function for relative waits (hidden in 5.0). +// Use weakref so we can determine at runtime whether each of them is present. +static int local_condattr_setclock(pthread_condattr_t*, clockid_t) +__attribute__((weakref("pthread_condattr_setclock"))); + static int local_cond_timedwait_relative(pthread_cond_t*, pthread_mutex_t *, const timespec *) __attribute__((weakref("__pthread_cond_timedwait_relative"))); #endif @@ -70,9 +73,14 @@ void qt_initialize_pthread_cond(pthread_cond_t *cond, const char *where) pthread_condattr_t condattr; pthread_condattr_init(&condattr); -#if !defined(Q_OS_MAC) && !defined(Q_OS_ANDROID) && (_POSIX_MONOTONIC_CLOCK-0 >= 0) +#if (_POSIX_MONOTONIC_CLOCK-0 >= 0) +#if defined(Q_OS_ANDROID) + if (local_condattr_setclock && QElapsedTimer::clockType() == QElapsedTimer::MonotonicClock) + local_condattr_setclock(&condattr, CLOCK_MONOTONIC); +#elif !defined(Q_OS_MAC) if (QElapsedTimer::clockType() == QElapsedTimer::MonotonicClock) pthread_condattr_setclock(&condattr, CLOCK_MONOTONIC); +#endif #endif report_error(pthread_cond_init(cond, &condattr), where, "cv init"); pthread_condattr_destroy(&condattr); @@ -108,7 +116,7 @@ public: { timespec ti; #ifdef Q_OS_ANDROID - if (Q_LIKELY(local_cond_timedwait_relative)) { + if (local_cond_timedwait_relative) { ti.tv_sec = time / 1000; ti.tv_nsec = time % 1000 * Q_UINT64_C(1000) * 1000; return local_cond_timedwait_relative(&cond, &mutex, &ti); -- cgit v1.2.3 From 02c5657a7d6d30c6e874e29a0adcc38b58a45b7d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christian=20Str=C3=B8mme?= Date: Fri, 13 Feb 2015 12:18:33 +0100 Subject: Android: Fix local ref handling. We where allowing conversion from jobject to QJNIObject without taking ownership of the jobject. Since we are managing the JNI environment we should not allow conversions without having the option of taking ownership of the local ref. This is now done by making the conversions explicit, i.e., local refs are converted through QJNIObjectPrivate::fromLocalRef() and global refs through the QJNIObjectPrivate's jobject constructor. This change breaks SC, but the API is private and no usage have been found outside QtBase. Change-Id: I3175f171699ec3f8e65144aaebc6246bc6e5bb4d Reviewed-by: Eskil Abrahamsen Blomfeldt --- src/corelib/io/qstandardpaths_android.cpp | 4 ++-- src/corelib/kernel/qjni.cpp | 9 ++++++++- src/corelib/kernel/qjni_p.h | 8 +++++++- .../bearer/android/src/wrappers/androidconnectivitymanager.cpp | 3 +-- 4 files changed, 18 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/corelib/io/qstandardpaths_android.cpp b/src/corelib/io/qstandardpaths_android.cpp index 958b4ea486..50cba3135e 100644 --- a/src/corelib/io/qstandardpaths_android.cpp +++ b/src/corelib/io/qstandardpaths_android.cpp @@ -57,7 +57,7 @@ static QJNIObjectPrivate applicationContext() if (appCtx.isValid()) return appCtx; - QJNIObjectPrivate activity = QtAndroidPrivate::activity(); + QJNIObjectPrivate activity(QtAndroidPrivate::activity()); if (!activity.isValid()) return appCtx; @@ -131,7 +131,7 @@ static QString getExternalFilesDir(const char *directoryField = 0) if (!path.isEmpty()) return path; - QJNIObjectPrivate activity = QtAndroidPrivate::activity(); + QJNIObjectPrivate activity(QtAndroidPrivate::activity()); if (!activity.isValid()) return QString(); diff --git a/src/corelib/kernel/qjni.cpp b/src/corelib/kernel/qjni.cpp index 9d74fd69de..8431ee3b67 100644 --- a/src/corelib/kernel/qjni.cpp +++ b/src/corelib/kernel/qjni.cpp @@ -96,7 +96,7 @@ static jclass loadClassDotEnc(const QString &classDotEnc, JNIEnv *env) if (clazz != 0 || isCached) return clazz; - QJNIObjectPrivate classLoader = QtAndroidPrivate::classLoader(); + QJNIObjectPrivate classLoader(QtAndroidPrivate::classLoader()); if (!classLoader.isValid()) return 0; @@ -2239,6 +2239,13 @@ bool QJNIObjectPrivate::isValid() const return d->m_jobject; } +QJNIObjectPrivate QJNIObjectPrivate::fromLocalRef(jobject lref) +{ + QJNIObjectPrivate o(lref); + QJNIEnvironmentPrivate()->DeleteLocalRef(lref); + return o; +} + bool QJNIObjectPrivate::isSameObject(jobject obj) const { QJNIEnvironmentPrivate env; diff --git a/src/corelib/kernel/qjni_p.h b/src/corelib/kernel/qjni_p.h index 5f573624c6..fb1982dc74 100644 --- a/src/corelib/kernel/qjni_p.h +++ b/src/corelib/kernel/qjni_p.h @@ -84,7 +84,10 @@ public: QJNIObjectPrivate(const char *className, const char *sig, ...); explicit QJNIObjectPrivate(jclass clazz); QJNIObjectPrivate(jclass clazz, const char *sig, ...); - QJNIObjectPrivate(jobject obj); + // In most cases you should never call this function with a local ref. unless you intend + // to manage the local ref. yourself. + // NOTE: see fromLocalRef() for converting a local ref. to QJNIObjectPrivate. + explicit QJNIObjectPrivate(jobject globalRef); template T callMethod(const char *methodName, @@ -183,6 +186,9 @@ public: return *this; } + // This function takes ownership of the jobject and releases the local ref. before returning. + static QJNIObjectPrivate fromLocalRef(jobject lref); + private: friend class QAndroidJniObject; diff --git a/src/plugins/bearer/android/src/wrappers/androidconnectivitymanager.cpp b/src/plugins/bearer/android/src/wrappers/androidconnectivitymanager.cpp index 4beb2e581b..c6a013ebed 100644 --- a/src/plugins/bearer/android/src/wrappers/androidconnectivitymanager.cpp +++ b/src/plugins/bearer/android/src/wrappers/androidconnectivitymanager.cpp @@ -295,8 +295,7 @@ QList AndroidConnectivityManager::getAllNetworkInfo() const if (exceptionCheckAndClear(env)) break; - list << AndroidNetworkInfo(lref); - env->DeleteLocalRef(lref); + list << AndroidNetworkInfo(QJNIObjectPrivate::fromLocalRef(lref)); } return list; -- cgit v1.2.3 From 97f451a600c474a2484c621cc66b0f29fe9c76c4 Mon Sep 17 00:00:00 2001 From: Laszlo Agocs Date: Wed, 18 Feb 2015 15:01:33 +0100 Subject: Correct pixel type for depth textures on ES Byte is definitely wrong. GL_OES_depth_texture states that short or int are the only options, GL_UNSIGNED_BYTE is thus rejected. Let's ask for the highest (32 bits). There's no guarantee that the implementation honors this, but at least we tried. Change-Id: I14dd9d4ab56b0b69cdab341f95f47499786d174e Reviewed-by: Giuseppe D'Angelo --- src/gui/opengl/qopengltexture.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/gui/opengl/qopengltexture.cpp b/src/gui/opengl/qopengltexture.cpp index b96bc6f346..f5218ef4f3 100644 --- a/src/gui/opengl/qopengltexture.cpp +++ b/src/gui/opengl/qopengltexture.cpp @@ -522,6 +522,8 @@ static QOpenGLTexture::PixelType pixelTypeCompatibleWithInternalFormat(QOpenGLTe return QOpenGLTexture::UInt8; case QOpenGLTexture::DepthFormat: + return QOpenGLTexture::UInt32; + case QOpenGLTexture::AlphaFormat: case QOpenGLTexture::RGBFormat: case QOpenGLTexture::RGBAFormat: @@ -1534,7 +1536,7 @@ QOpenGLTexture *QOpenGLTexturePrivate::createTextureView(QOpenGLTexture::Target \value SRGB_Alpha_DXT5 Equivalent to GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT \value SRGB_BP_UNorm Equivalent to GL_COMPRESSED_SRGB_ALPHA_BPTC_UNORM_ARB - \value DepthFormat Equivalent to GL_DEPTH_COMPONENT (OpenGL ES 2 only and when OES_depth_texture is present) + \value DepthFormat Equivalent to GL_DEPTH_COMPONENT (only OpenGL ES 3 or ES 2 with OES_depth_texture) \value AlphaFormat Equivalent to GL_ALPHA (OpenGL ES 2 only) \value RGBFormat Equivalent to GL_RGB (OpenGL ES 2 only) \value RGBAFormat Equivalent to GL_RGBA (OpenGL ES 2 only) -- cgit v1.2.3 From dee1998d4e50d70fe212e46dd0b030337e7884cd Mon Sep 17 00:00:00 2001 From: Andrew Knight Date: Tue, 2 Dec 2014 14:02:52 +0200 Subject: direct2d: Optimize dashed [poly]line drawing Move the optimized dash drawing into stroke() in order to apply the optimization to polygons in addition to lines. In the case of polygons/polylines, a vertex patch is redrawn using the original dash brush in order to respect the joinStyle of the line. As the line correction code flows through both the optimized dashed path and the standard geometry code path, line adjustment is now also performed for normal geometry. Task-number: QTBUG-40604 Done-with: Louai Al-Khanji Done-with: Andrew Knight Change-Id: I668369b4aadb6a1bbbd4d621cb8ce1e3b19fbbc9 Reviewed-by: Louai Al-Khanji --- .../direct2d/qwindowsdirect2dpaintengine.cpp | 248 ++++++++++----------- .../direct2d/qwindowsdirect2dpaintengine.h | 3 - 2 files changed, 119 insertions(+), 132 deletions(-) (limited to 'src') diff --git a/src/plugins/platforms/direct2d/qwindowsdirect2dpaintengine.cpp b/src/plugins/platforms/direct2d/qwindowsdirect2dpaintengine.cpp index a86bb0ee04..bc996420a8 100644 --- a/src/plugins/platforms/direct2d/qwindowsdirect2dpaintengine.cpp +++ b/src/plugins/platforms/direct2d/qwindowsdirect2dpaintengine.cpp @@ -68,8 +68,6 @@ enum { D2DDebugFillRectTag, D2DDebugDrawRectsTag, D2DDebugDrawRectFsTag, - D2DDebugDrawLinesTag, - D2DDebugDrawLineFsTag, D2DDebugDrawEllipseTag, D2DDebugDrawEllipseFTag, D2DDebugDrawImageTag, @@ -102,22 +100,28 @@ static inline ID2D1Factory1 *factory() return QWindowsDirect2DContext::instance()->d2dFactory(); } -static inline D2D1_MATRIX_3X2_F transformFromLine(const QLineF &line, qreal penWidth) +static inline D2D1_MATRIX_3X2_F transformFromLine(const QLineF &line, qreal penWidth, qreal dashOffset) { const qreal halfWidth = penWidth / 2; const qreal angle = -qDegreesToRadians(line.angle()); - QTransform transform = QTransform::fromTranslate(line.p1().x() + qSin(angle) * halfWidth, - line.p1().y() - qCos(angle) * halfWidth); + const qreal sinA = qSin(angle); + const qreal cosA = qCos(angle); + QTransform transform = QTransform::fromTranslate(line.p1().x() + dashOffset * cosA + sinA * halfWidth, + line.p1().y() + dashOffset * sinA - cosA * halfWidth); transform.rotateRadians(angle); return to_d2d_matrix_3x2_f(transform); } +static void adjustLine(QPointF *p1, QPointF *p2); +static bool isLinePositivelySloped(const QPointF &p1, const QPointF &p2); + class Direct2DPathGeometryWriter { public: Direct2DPathGeometryWriter() : m_inFigure(false) , m_roundCoordinates(false) + , m_adjustPositivelySlopedLines(false) { } @@ -152,6 +156,11 @@ public: m_roundCoordinates = enable; } + void setPositiveSlopeAdjustmentEnabled(bool enable) + { + m_adjustPositivelySlopedLines = enable; + } + bool isInFigure() const { return m_inFigure; @@ -164,11 +173,20 @@ public: m_sink->BeginFigure(adjusted(point), D2D1_FIGURE_BEGIN_FILLED); m_inFigure = true; + m_previousPoint = point; } void lineTo(const QPointF &point) { - m_sink->AddLine(adjusted(point)); + QPointF pt = point; + if (m_adjustPositivelySlopedLines && isLinePositivelySloped(m_previousPoint, point)) { + moveTo(m_previousPoint - QPointF(0, 1)); + pt -= QPointF(0, 1); + } + m_sink->AddLine(adjusted(pt)); + if (pt != point) + moveTo(point); + m_previousPoint = point; } void curveTo(const QPointF &p1, const QPointF &p2, const QPointF &p3) @@ -180,6 +198,7 @@ public: }; m_sink->AddBezier(segment); + m_previousPoint = p3; } void close() @@ -212,6 +231,8 @@ private: bool m_inFigure; bool m_roundCoordinates; + bool m_adjustPositivelySlopedLines; + QPointF m_previousPoint; }; struct D2DVectorPathCache { @@ -257,6 +278,7 @@ public: ComPtr brush; ComPtr strokeStyle; ComPtr dashBrush; + int dashLength; inline void reset() { emulate = false; @@ -264,6 +286,7 @@ public: brush.Reset(); strokeStyle.Reset(); dashBrush.Reset(); + dashLength = 0; } } pen; @@ -566,6 +589,7 @@ public: D2D1_BITMAP_BRUSH_PROPERTIES1 bitmapBrushProperties = D2D1::BitmapBrushProperties1( D2D1_EXTEND_MODE_WRAP, D2D1_EXTEND_MODE_CLAMP, D2D1_INTERPOLATION_MODE_LINEAR); hr = dc()->CreateBitmapBrush(bitmap.bitmap(), bitmapBrushProperties, &pen.dashBrush); + pen.dashLength = bitmap.size().width(); } else { hr = factory()->CreateStrokeStyle(props, NULL, 0, &pen.strokeStyle); } @@ -795,6 +819,8 @@ public: writer.setWindingFillEnabled(path.hasWindingFill()); writer.setAliasingEnabled(alias); + writer.setPositiveSlopeAdjustmentEnabled(path.shape() == QVectorPath::LinesHint + || path.shape() == QVectorPath::PolygonHint); const QPainterPath::ElementType *types = path.elements(); const int count = path.elementCount(); @@ -910,6 +936,90 @@ public: DWRITE_MEASURING_MODE_GDI_CLASSIC); } + void stroke(const QVectorPath &path) + { + Q_Q(QWindowsDirect2DPaintEngine); + + // Default path (no optimization) + if (!(path.shape() == QVectorPath::LinesHint || path.shape() == QVectorPath::PolygonHint) + || !pen.dashBrush || q->state()->renderHints.testFlag(QPainter::HighQualityAntialiasing)) { + ComPtr geometry = vectorPathToID2D1PathGeometry(path); + if (!geometry) { + qWarning("%s: Could not convert path to d2d geometry", __FUNCTION__); + return; + } + dc()->DrawGeometry(geometry.Get(), pen.brush.Get(), pen.qpen.widthF(), pen.strokeStyle.Get()); + return; + } + + // Optimized dash line drawing + const bool isPolygon = path.shape() == QVectorPath::PolygonHint && path.elementCount() >= 3; + const bool implicitClose = isPolygon && (path.hints() & QVectorPath::ImplicitClose); + const bool skipJoin = !isPolygon // Non-polygons don't require joins + || (pen.qpen.joinStyle() == Qt::MiterJoin && qFuzzyIsNull(pen.qpen.miterLimit())); + const qreal *points = path.points(); + const int lastElement = path.elementCount() - (implicitClose ? 1 : 2); + qreal dashOffset = 0; + QPointF jointStart; + ID2D1Brush *brush = pen.dashBrush ? pen.dashBrush.Get() : pen.brush.Get(); + for (int i = 0; i <= lastElement; ++i) { + QPointF p1(points[i * 2], points[i * 2 + 1]); + QPointF p2 = implicitClose && i == lastElement ? QPointF(points[0], points[1]) + : QPointF(points[i * 2 + 2], points[i * 2 + 3]); + if (!isPolygon) // Advance the count for lines + ++i; + + // Match raster engine output + if (p1 == p2 && pen.qpen.widthF() <= 1.0) { + q->fillRect(QRectF(p1, QSizeF(pen.qpen.widthF(), pen.qpen.widthF())), pen.qpen.brush()); + continue; + } + + if (!q->antiAliasingEnabled()) + adjustLine(&p1, &p2); + + q->adjustForAliasing(&p1); + q->adjustForAliasing(&p2); + + const QLineF line(p1, p2); + const qreal lineLength = line.length(); + if (pen.dashBrush) { + pen.dashBrush->SetTransform(transformFromLine(line, pen.qpen.widthF(), dashOffset)); + dashOffset = pen.dashLength - fmod(lineLength - dashOffset, pen.dashLength); + } + dc()->DrawLine(to_d2d_point_2f(p1), to_d2d_point_2f(p2), + brush, pen.qpen.widthF(), NULL); + + if (skipJoin) + continue; + + // Patch the join with the original brush + const qreal patchSegment = pen.dashBrush ? qBound(0.0, (pen.dashLength - dashOffset) / lineLength, 1.0) + : pen.qpen.widthF(); + if (i > 0) { + Direct2DPathGeometryWriter writer; + writer.begin(); + writer.moveTo(jointStart); + writer.lineTo(p1); + writer.lineTo(line.pointAt(patchSegment)); + writer.close(); + dc()->DrawGeometry(writer.geometry().Get(), pen.brush.Get(), pen.qpen.widthF(), pen.strokeStyle.Get()); + } + // Record the start position of the next joint + jointStart = line.pointAt(1 - patchSegment); + + if (implicitClose && i == lastElement) { // Close the polygon + Direct2DPathGeometryWriter writer; + writer.begin(); + writer.moveTo(jointStart); + writer.lineTo(p2); + writer.lineTo(QLineF(p2, QPointF(points[2], points[3])).pointAt(patchSegment)); + writer.close(); + dc()->DrawGeometry(writer.geometry().Get(), pen.brush.Get(), pen.qpen.widthF(), pen.strokeStyle.Get()); + } + } + } + ComPtr fontFaceFromFontEngine(QFontEngine *fe) { const QFontDef fontDef = fe->fontDef; @@ -1051,20 +1161,12 @@ void QWindowsDirect2DPaintEngine::setState(QPainterState *s) void QWindowsDirect2DPaintEngine::draw(const QVectorPath &path) { - Q_D(QWindowsDirect2DPaintEngine); - - ComPtr geometry = d->vectorPathToID2D1PathGeometry(path); - if (!geometry) { - qWarning("%s: Could not convert path to d2d geometry", __FUNCTION__); - return; - } - const QBrush &brush = state()->brush; if (qbrush_style(brush) != Qt::NoBrush) { if (emulationRequired(BrushEmulation)) rasterFill(path, brush); else - fill(geometry.Get(), brush); + fill(path, brush); } const QPen &pen = state()->pen; @@ -1072,7 +1174,7 @@ void QWindowsDirect2DPaintEngine::draw(const QVectorPath &path) if (emulationRequired(PenEmulation)) QPaintEngineEx::stroke(path, pen); else - stroke(geometry.Get(), pen); + stroke(path, pen); } } @@ -1102,18 +1204,6 @@ void QWindowsDirect2DPaintEngine::fill(const QVectorPath &path, const QBrush &br d->dc()->FillGeometry(geometry.Get(), d->brush.brush.Get()); } -void QWindowsDirect2DPaintEngine::fill(ID2D1Geometry *geometry, const QBrush &brush) -{ - Q_D(QWindowsDirect2DPaintEngine); - D2D_TAG(D2DDebugFillTag); - - ensureBrush(brush); - if (!d->brush.brush) - return; - - d->dc()->FillGeometry(geometry, d->brush.brush.Get()); -} - void QWindowsDirect2DPaintEngine::stroke(const QVectorPath &path, const QPen &pen) { Q_D(QWindowsDirect2DPaintEngine); @@ -1131,25 +1221,7 @@ void QWindowsDirect2DPaintEngine::stroke(const QVectorPath &path, const QPen &pe if (!d->pen.brush) return; - ComPtr geometry = d->vectorPathToID2D1PathGeometry(path); - if (!geometry) { - qWarning("%s: Could not convert path to d2d geometry", __FUNCTION__); - return; - } - - d->dc()->DrawGeometry(geometry.Get(), d->pen.brush.Get(), d->pen.qpen.widthF(), d->pen.strokeStyle.Get()); -} - -void QWindowsDirect2DPaintEngine::stroke(ID2D1Geometry *geometry, const QPen &pen) -{ - Q_D(QWindowsDirect2DPaintEngine); - D2D_TAG(D2DDebugFillTag); - - ensurePen(pen); - if (!d->pen.brush) - return; - - d->dc()->DrawGeometry(geometry, d->pen.brush.Get(), d->pen.qpen.widthF(), d->pen.strokeStyle.Get()); + d->stroke(path); } void QWindowsDirect2DPaintEngine::clip(const QVectorPath &path, Qt::ClipOperation op) @@ -1297,88 +1369,6 @@ static void adjustLine(QPointF *p1, QPointF *p2) } } -void QWindowsDirect2DPaintEngine::drawLines(const QLine *lines, int lineCount) -{ - Q_D(QWindowsDirect2DPaintEngine); - D2D_TAG(D2DDebugDrawLinesTag); - - ensurePen(); - - if (emulationRequired(PenEmulation)) { - QPaintEngineEx::drawLines(lines, lineCount); - } else if (d->pen.brush) { - for (int i = 0; i < lineCount; i++) { - QPointF p1 = lines[i].p1(); - QPointF p2 = lines[i].p2(); - - // Match raster engine output - if (p1 == p2 && d->pen.qpen.widthF() <= 1.0) { - fillRect(QRectF(p1, QSizeF(d->pen.qpen.widthF(), d->pen.qpen.widthF())), - d->pen.qpen.brush()); - continue; - } - - // Match raster engine output - if (!antiAliasingEnabled()) - adjustLine(&p1, &p2); - - adjustForAliasing(&p1); - adjustForAliasing(&p2); - - D2D1_POINT_2F d2d_p1 = to_d2d_point_2f(p1); - D2D1_POINT_2F d2d_p2 = to_d2d_point_2f(p2); - - if (!d->pen.dashBrush || state()->renderHints.testFlag(QPainter::HighQualityAntialiasing)) { - d->dc()->DrawLine(d2d_p1, d2d_p2, d->pen.brush.Get(), d->pen.qpen.widthF(), d->pen.strokeStyle.Get()); - } else { - d->pen.dashBrush->SetTransform(transformFromLine(lines[i], d->pen.qpen.widthF())); - d->dc()->DrawLine(d2d_p1, d2d_p2, d->pen.dashBrush.Get(), d->pen.qpen.widthF(), NULL); - } - } - } -} - -void QWindowsDirect2DPaintEngine::drawLines(const QLineF *lines, int lineCount) -{ - Q_D(QWindowsDirect2DPaintEngine); - D2D_TAG(D2DDebugDrawLineFsTag); - - ensurePen(); - - if (emulationRequired(PenEmulation)) { - QPaintEngineEx::drawLines(lines, lineCount); - } else if (d->pen.brush) { - for (int i = 0; i < lineCount; i++) { - QPointF p1 = lines[i].p1(); - QPointF p2 = lines[i].p2(); - - // Match raster engine output - if (p1 == p2 && d->pen.qpen.widthF() <= 1.0) { - fillRect(QRectF(p1, QSizeF(d->pen.qpen.widthF(), d->pen.qpen.widthF())), - d->pen.qpen.brush()); - continue; - } - - // Match raster engine output - if (!antiAliasingEnabled()) - adjustLine(&p1, &p2); - - adjustForAliasing(&p1); - adjustForAliasing(&p2); - - D2D1_POINT_2F d2d_p1 = to_d2d_point_2f(p1); - D2D1_POINT_2F d2d_p2 = to_d2d_point_2f(p2); - - if (!d->pen.dashBrush || state()->renderHints.testFlag(QPainter::HighQualityAntialiasing)) { - d->dc()->DrawLine(d2d_p1, d2d_p2, d->pen.brush.Get(), d->pen.qpen.widthF(), d->pen.strokeStyle.Get()); - } else { - d->pen.dashBrush->SetTransform(transformFromLine(lines[i], d->pen.qpen.widthF())); - d->dc()->DrawLine(d2d_p1, d2d_p2, d->pen.dashBrush.Get(), d->pen.qpen.widthF(), NULL); - } - } - } -} - void QWindowsDirect2DPaintEngine::drawEllipse(const QRectF &r) { Q_D(QWindowsDirect2DPaintEngine); diff --git a/src/plugins/platforms/direct2d/qwindowsdirect2dpaintengine.h b/src/plugins/platforms/direct2d/qwindowsdirect2dpaintengine.h index 39cbfdc6cb..c6b570887c 100644 --- a/src/plugins/platforms/direct2d/qwindowsdirect2dpaintengine.h +++ b/src/plugins/platforms/direct2d/qwindowsdirect2dpaintengine.h @@ -92,9 +92,6 @@ public: void drawRects(const QRect *rects, int rectCount) Q_DECL_OVERRIDE; void drawRects(const QRectF *rects, int rectCount) Q_DECL_OVERRIDE; - void drawLines(const QLine *lines, int lineCount) Q_DECL_OVERRIDE; - void drawLines(const QLineF *lines, int lineCount) Q_DECL_OVERRIDE; - void drawEllipse(const QRectF &r) Q_DECL_OVERRIDE; void drawEllipse(const QRect &r) Q_DECL_OVERRIDE; -- cgit v1.2.3 From 6f87e1b526273aba16c44cbfa2b96934b4ee007d Mon Sep 17 00:00:00 2001 From: Dmitry Shachnev Date: Fri, 20 Feb 2015 11:54:12 +0300 Subject: qstorageinfo_unix.cpp: Fix build on Solaris Task-number: QTBUG-44556 Change-Id: I22d791011866175ca88de88c0b1a7c4d9d397d8f Reviewed-by: Ivan Komissarov Reviewed-by: Oswald Buddenhagen Reviewed-by: Thiago Macieira --- src/corelib/io/qstorageinfo_unix.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/corelib/io/qstorageinfo_unix.cpp b/src/corelib/io/qstorageinfo_unix.cpp index 857464f578..2a83e87b0c 100644 --- a/src/corelib/io/qstorageinfo_unix.cpp +++ b/src/corelib/io/qstorageinfo_unix.cpp @@ -62,6 +62,7 @@ # include #elif defined(Q_OS_SOLARIS) # include +# include #else # include #endif @@ -202,17 +203,17 @@ inline bool QStorageIterator::next() inline QString QStorageIterator::rootPath() const { - return QFile::decodeName(mnt->mnt_mountp); + return QFile::decodeName(mnt.mnt_mountp); } inline QByteArray QStorageIterator::fileSystemType() const { - return QByteArray(mnt->mnt_fstype); + return QByteArray(mnt.mnt_fstype); } inline QByteArray QStorageIterator::device() const { - return QByteArray(mnt->mnt_mntopts); + return QByteArray(mnt.mnt_mntopts); } #elif defined(Q_OS_ANDROID) -- cgit v1.2.3 From 9a950655feb709ea515edbbdb66fa5d900dc62ec Mon Sep 17 00:00:00 2001 From: Bjoern Thiel Date: Thu, 29 Jan 2015 13:32:29 +0100 Subject: Fixing Qt5CoreConfigExtras.cmake.in The property INTERFACE_LINK_LIBRARIES has a single value and is configuration independent. Change-Id: I9130b1d0444563335825e3806f693a39f65ca67d Reviewed-by: Stephen Kelly --- src/corelib/Qt5CoreConfigExtras.cmake.in | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/corelib/Qt5CoreConfigExtras.cmake.in b/src/corelib/Qt5CoreConfigExtras.cmake.in index 4387bedc44..7213a844f5 100644 --- a/src/corelib/Qt5CoreConfigExtras.cmake.in +++ b/src/corelib/Qt5CoreConfigExtras.cmake.in @@ -134,12 +134,12 @@ if (NOT TARGET Qt5::WinMain) set(_isNotExcluded $>>) set(_isPolicyNEW $) get_target_property(_configs Qt5::Core IMPORTED_CONFIGURATIONS) + set_property(TARGET Qt5::Core APPEND PROPERTY + INTERFACE_LINK_LIBRARIES + $<$:Qt5::WinMain> + ) + # For backward compatibility with CMake < 2.8.12 foreach(_config ${_configs}) - set_property(TARGET Qt5::Core APPEND PROPERTY - INTERFACE_LINK_LIBRARIES - $<$:Qt5::WinMain> - ) - # For backward compatibility with CMake < 2.8.12 set_property(TARGET Qt5::Core APPEND PROPERTY IMPORTED_LINK_INTERFACE_LIBRARIES_${_config} $<$:Qt5::WinMain> -- cgit v1.2.3 From 6716fe8cfdeb5f8cd63d6dde8252b25d86622404 Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Sat, 21 Feb 2015 09:57:09 +0100 Subject: QVector: fix use of invalid iterators in removeAll() The c2m() function which converts a const_iterator into an iterator is a broken concept for an implicitly shared container such as QVector, because the act of calling begin() as the starting point already detaches and invalidates the c2m argument. This could be fixed in c2m, but the bug wasn't even in c2m, but in removeAll(), which called end() before c2m, so the c2m argument was already invalidated when entering c2m. The solution is to store the positions as indices instead of iterators before calling the first detaching function. Task-number: QTBUG-44592 Change-Id: I66cf4f1277e71148a4d5b5bbfb6a3369ad02db68 Reviewed-by: Olivier Goffart (Woboq GmbH) --- src/corelib/tools/qvector.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/corelib/tools/qvector.h b/src/corelib/tools/qvector.h index 07c66bc393..e263b99c02 100644 --- a/src/corelib/tools/qvector.h +++ b/src/corelib/tools/qvector.h @@ -153,7 +153,9 @@ public: const const_iterator ce = this->cend(), cit = std::find(this->cbegin(), ce, t); if (cit == ce) return 0; - const iterator e = end(), it = std::remove(c2m(cit), e, t); + // next operation detaches, so ce, cit may become invalidated: + const int firstFoundIdx = std::distance(this->cbegin(), cit); + const iterator e = end(), it = std::remove(begin() + firstFoundIdx, e, t); const int result = std::distance(it, e); erase(it, e); return result; -- cgit v1.2.3 From 402f994f12fc524871f2b1d2337ab07ad3d412b8 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Sat, 21 Feb 2015 23:31:02 -0800 Subject: Timezones: Fix handling of offset-from-UTC QTimeZones Those QTimeZones failed to convert to other timezones because the data() virtual function was never overridden and reimplemented. That meant all QUtcTimeZonePrivate objects were *really* UTC, with no offset. Task-number: QTBUG-44600 Change-Id: Ia0aac2f09e9245339951ffff13c5294bb783c674 Reviewed-by: Marc Mutz --- src/corelib/tools/qtimezoneprivate.cpp | 9 +++++++++ src/corelib/tools/qtimezoneprivate_p.h | 2 ++ 2 files changed, 11 insertions(+) (limited to 'src') diff --git a/src/corelib/tools/qtimezoneprivate.cpp b/src/corelib/tools/qtimezoneprivate.cpp index e768905462..4f6067f508 100644 --- a/src/corelib/tools/qtimezoneprivate.cpp +++ b/src/corelib/tools/qtimezoneprivate.cpp @@ -619,6 +619,15 @@ QTimeZonePrivate *QUtcTimeZonePrivate::clone() return new QUtcTimeZonePrivate(*this); } +QTimeZonePrivate::Data QUtcTimeZonePrivate::data(qint64 forMSecsSinceEpoch) const +{ + Data d = invalidData(); + d.abbreviation = m_abbreviation; + d.atMSecsSinceEpoch = forMSecsSinceEpoch; + d.offsetFromUtc = m_offsetFromUtc; + return d; +} + void QUtcTimeZonePrivate::init(const QByteArray &zoneId) { m_id = zoneId; diff --git a/src/corelib/tools/qtimezoneprivate_p.h b/src/corelib/tools/qtimezoneprivate_p.h index 5ba42de560..f1d934abf3 100644 --- a/src/corelib/tools/qtimezoneprivate_p.h +++ b/src/corelib/tools/qtimezoneprivate_p.h @@ -181,6 +181,8 @@ public: QTimeZonePrivate *clone(); + Data data(qint64 forMSecsSinceEpoch) const Q_DECL_OVERRIDE; + QLocale::Country country() const Q_DECL_OVERRIDE; QString comment() const Q_DECL_OVERRIDE; -- cgit v1.2.3 From c97445945501acf13ba6d4f314161bf9689a8a95 Mon Sep 17 00:00:00 2001 From: Marko Kangas Date: Mon, 16 Feb 2015 16:37:05 +0200 Subject: Fix fusion style QPushButton icon on HiDPI mode Change-Id: Ie05012266abe52bc33bb9c2e19c93353cac3307f Task-number: QTBUG-44502 Reviewed-by: Jens Bache-Wiig --- src/widgets/styles/qfusionstyle.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/widgets/styles/qfusionstyle.cpp b/src/widgets/styles/qfusionstyle.cpp index cf2f3ea26b..0cc1211cc0 100644 --- a/src/widgets/styles/qfusionstyle.cpp +++ b/src/widgets/styles/qfusionstyle.cpp @@ -1738,8 +1738,8 @@ void QFusionStyle::drawControl(ControlElement element, const QStyleOption *optio state = QIcon::On; QPixmap pixmap = button->icon.pixmap(button->iconSize, mode, state); - int w = pixmap.width(); - int h = pixmap.height(); + int w = pixmap.width() / pixmap.devicePixelRatio(); + int h = pixmap.height() / pixmap.devicePixelRatio(); if (!button->text.isEmpty()) w += button->fontMetrics.boundingRect(option->rect, tf, button->text).width() + 2; @@ -1747,15 +1747,17 @@ void QFusionStyle::drawControl(ControlElement element, const QStyleOption *optio point = QPoint(ir.x() + ir.width() / 2 - w / 2, ir.y() + ir.height() / 2 - h / 2); + w = pixmap.width() / pixmap.devicePixelRatio(); + if (button->direction == Qt::RightToLeft) - point.rx() += pixmap.width(); + point.rx() += w; painter->drawPixmap(visualPos(button->direction, button->rect, point), pixmap); if (button->direction == Qt::RightToLeft) ir.translate(-point.x() - 2, 0); else - ir.translate(point.x() + pixmap.width(), 0); + ir.translate(point.x() + w, 0); // left-align text if there is if (!button->text.isEmpty()) -- cgit v1.2.3 From fb4d8c21c4924023227a1c01e3315af79e2d5607 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B8rgen=20Lind?= Date: Mon, 23 Feb 2015 10:30:33 +0100 Subject: QWidgetWindow check valid widget geometry before marking the backingstore as dirty. The QWidgetBackingstore has an assert that the region or the rect passed in is not empty, hence its programming error not to check before calling this function. Task-number: QTBUG-43489 Change-Id: Ic67fb6ca7959466e1758ce91827cd4b8acdf73fc Reviewed-by: Friedemann Kleint --- src/widgets/kernel/qwidgetwindow.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/widgets/kernel/qwidgetwindow.cpp b/src/widgets/kernel/qwidgetwindow.cpp index b31f9a51dd..87baaa13de 100644 --- a/src/widgets/kernel/qwidgetwindow.cpp +++ b/src/widgets/kernel/qwidgetwindow.cpp @@ -639,7 +639,7 @@ void QWidgetWindow::handleScreenChange() void QWidgetWindow::repaintWindow() { - if (!m_widget->isVisible() || !m_widget->updatesEnabled()) + if (!m_widget->isVisible() || !m_widget->updatesEnabled() || !m_widget->rect().isValid()) return; QTLWExtra *tlwExtra = m_widget->window()->d_func()->maybeTopData(); -- cgit v1.2.3 From d5f55d9870543050ab6d9078d5dab8de0ab15c24 Mon Sep 17 00:00:00 2001 From: Nico Vertriest Date: Wed, 18 Feb 2015 13:37:51 +0100 Subject: Doc: mod to correct OpenGL link error Task-number: QTBUG-43810 Change-Id: I691cdeced3f857e2dcf9bda5d65207065c454635 Reviewed-by: Martin Smith --- src/opengl/qglcolormap.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/opengl/qglcolormap.cpp b/src/opengl/qglcolormap.cpp index 0f3ae905df..63f363e1ff 100644 --- a/src/opengl/qglcolormap.cpp +++ b/src/opengl/qglcolormap.cpp @@ -37,7 +37,7 @@ a QGLWidget. \obsolete - \inmodule OpenGL + \inmodule QtOpenGL \ingroup painting-3D \ingroup shared -- cgit v1.2.3 From 1afe110b8fe6da51ec23736fa3a105013255f904 Mon Sep 17 00:00:00 2001 From: Nico Vertriest Date: Wed, 21 Jan 2015 15:42:19 +0100 Subject: Doc: corrected link/autolink issues in corelib Task-number: QTBUG-43115 Change-Id: I31da92e3a7c4dd7b75ee283dbfecd77e284978ca Reviewed-by: Martin Smith --- src/corelib/animation/qparallelanimationgroup.cpp | 2 +- src/corelib/doc/qtcore.qdocconf | 2 +- src/corelib/global/qnamespace.qdoc | 7 +++---- src/corelib/io/qfileselector.cpp | 2 +- src/corelib/io/qiodevice.cpp | 2 +- src/corelib/io/qprocess.cpp | 2 +- src/corelib/io/qresource.cpp | 2 +- src/corelib/io/qstandardpaths.cpp | 10 +--------- src/corelib/io/qurl.cpp | 6 +++--- src/corelib/io/qurlquery.cpp | 2 +- src/corelib/json/qjsonarray.cpp | 13 +++++++------ src/corelib/json/qjsonvalue.cpp | 18 ++++++++++++++++-- src/corelib/kernel/qabstracteventdispatcher.cpp | 2 +- src/corelib/kernel/qcoreapplication.cpp | 4 ++-- src/corelib/kernel/qcoreevent.cpp | 10 +++++----- src/corelib/kernel/qmetatype.cpp | 2 ++ src/corelib/kernel/qpointer.cpp | 2 +- src/corelib/kernel/qtimer.cpp | 2 +- src/corelib/kernel/qvariant.cpp | 6 +++--- src/corelib/plugin/qpluginloader.cpp | 2 +- 20 files changed, 53 insertions(+), 45 deletions(-) (limited to 'src') diff --git a/src/corelib/animation/qparallelanimationgroup.cpp b/src/corelib/animation/qparallelanimationgroup.cpp index 06e187ab01..ffc6c2adb2 100644 --- a/src/corelib/animation/qparallelanimationgroup.cpp +++ b/src/corelib/animation/qparallelanimationgroup.cpp @@ -44,7 +44,7 @@ animations in parallel. The animation group finishes when the longest lasting animation has finished. - You can treat QParallelAnimation as any other QAbstractAnimation, + You can treat QParallelAnimationGroup as any other QAbstractAnimation, e.g., pause, resume, or add it to other animation groups. \code diff --git a/src/corelib/doc/qtcore.qdocconf b/src/corelib/doc/qtcore.qdocconf index 5a14ba9088..f3aff83a8b 100644 --- a/src/corelib/doc/qtcore.qdocconf +++ b/src/corelib/doc/qtcore.qdocconf @@ -25,7 +25,7 @@ qhp.QtCore.subprojects.classes.sortPages = true tagfile = ../../../doc/qtcore/qtcore.tags -depends += activeqt qtdbus qtgui qtwidgets qtnetwork qtdoc qtmacextras qtquick qtlinguist qtdesigner qtconcurrent qtxml qmake +depends += activeqt qtdbus qtgui qtwidgets qtnetwork qtdoc qtmacextras qtquick qtlinguist qtdesigner qtconcurrent qtxml qmake qtwinextras # depends += qtqml # Qt namespace collides with QtQml::Qt, see QTBUG-38630 headerdirs += .. diff --git a/src/corelib/global/qnamespace.qdoc b/src/corelib/global/qnamespace.qdoc index 9e9a357272..24de2541b8 100644 --- a/src/corelib/global/qnamespace.qdoc +++ b/src/corelib/global/qnamespace.qdoc @@ -498,7 +498,7 @@ \value TextExpandTabs Makes the U+0009 (ASCII tab) character move to the next tab stop. \value TextShowMnemonic Displays the string "\&P" as \underline{P} - (see QButton for an example). For an ampersand, use "\&\&". + For an ampersand, use "\&\&". \value TextWordWrap Breaks lines at appropriate points, e.g. at word boundaries. \value TextWrapAnywhere Breaks lines anywhere, even within words. @@ -902,8 +902,7 @@ on QWidget::contentsRect(). This is set by the widget's author. \value WA_LayoutUsesWidgetRect Ignore the layout item rect from the style - when laying out this widget with QLayout. This makes a difference in - QMacStyle and QPlastiqueStyle for some widgets. + when laying out this widget with QLayout. \value WA_MacNoClickThrough When a widget that has this attribute set is clicked, and its window is inactive, the click will make the window @@ -1162,7 +1161,7 @@ _NET_WM_WINDOW_TYPE X11 window property. See http://standards.freedesktop.org/wm-spec/ for more details. This attribute has no effect on non-X11 platforms. \b Note: Qt - automatically sets this attribute for QMenus added to a QMenuBar. + automatically sets this attribute for QMenu objects added to a QMenuBar. \value WA_X11NetWmWindowTypePopupMenu Adds _NET_WM_WINDOW_TYPE_POPUP_MENU to the window's _NET_WM_WINDOW_TYPE X11 window property. See diff --git a/src/corelib/io/qfileselector.cpp b/src/corelib/io/qfileselector.cpp index 5d1d5dfe23..008aea27cf 100644 --- a/src/corelib/io/qfileselector.cpp +++ b/src/corelib/io/qfileselector.cpp @@ -229,7 +229,7 @@ static QString qrcScheme() } /*! - This is a convenience version of select operating on QUrls. If the scheme is not file or qrc, + This is a convenience version of select operating on QUrl objects. If the scheme is not file or qrc, \a filePath is returned immediately. Otherwise selection is applied to the path of \a filePath and a QUrl is returned with the selected path and other QUrl parts the same as \a filePath. diff --git a/src/corelib/io/qiodevice.cpp b/src/corelib/io/qiodevice.cpp index 72ec6ff403..f1c42c9bb5 100644 --- a/src/corelib/io/qiodevice.cpp +++ b/src/corelib/io/qiodevice.cpp @@ -708,7 +708,7 @@ bool QIODevice::reset() number of bytes to allocate in a buffer before reading. Subclasses that reimplement this function must call the base - implementation in order to include the size of QIODevices' buffer. Example: + implementation in order to include the size of the buffer of QIODevice. Example: \snippet code/src_corelib_io_qiodevice.cpp 1 diff --git a/src/corelib/io/qprocess.cpp b/src/corelib/io/qprocess.cpp index 939cecfb44..94912ad616 100644 --- a/src/corelib/io/qprocess.cpp +++ b/src/corelib/io/qprocess.cpp @@ -1446,7 +1446,7 @@ void QProcess::setStandardErrorFile(const QString &fileName, OpenMode mode) The following shell command: \snippet code/src_corelib_io_qprocess.cpp 2 - Can be accomplished with QProcesses with the following code: + Can be accomplished with QProcess with the following code: \snippet code/src_corelib_io_qprocess.cpp 3 */ void QProcess::setStandardOutputProcess(QProcess *destination) diff --git a/src/corelib/io/qresource.cpp b/src/corelib/io/qresource.cpp index ed6bfb4e0d..64c20dead2 100644 --- a/src/corelib/io/qresource.cpp +++ b/src/corelib/io/qresource.cpp @@ -197,7 +197,7 @@ Q_GLOBAL_STATIC(QStringList, resourceSearchPaths) path requested in setFileName(). The unregisterResource() function removes a reference to a particular - file. If there are QResources that currently reference resources related + file. If there are QResource objects that currently reference resources related to the unregistered file, they will continue to be valid but the resource file itself will be removed from the resource roots, and thus no further QResource can be created pointing into this resource data. The resource diff --git a/src/corelib/io/qstandardpaths.cpp b/src/corelib/io/qstandardpaths.cpp index b41aee55d2..9d047123a1 100644 --- a/src/corelib/io/qstandardpaths.cpp +++ b/src/corelib/io/qstandardpaths.cpp @@ -77,15 +77,10 @@ QT_BEGIN_NAMESPACE this user, but should still be assumed to be unreachable by applications by other users. - The only exception is QStandardPaths::TempLocation (which is the same as - QDir::tempPath()): the path returned may be application-specific, but files - stored there may be accessed by other applications run by the same user. - Data interchange with other users is out of the scope of QStandardPaths. \value DesktopLocation Returns the user's desktop directory. This is a generic value. - On systems with no concept of a desktop, this is the same as - QStandardPaths::HomeLocation. + On systems with no concept of a desktop. \value DocumentsLocation Returns the directory containing user document files. This is a generic value. The returned path is never empty. \value FontsLocation Returns the directory containing user's fonts. This is a generic value. @@ -118,9 +113,6 @@ QT_BEGIN_NAMESPACE \value GenericCacheLocation Returns a directory location where user-specific non-essential (cached) data, shared across applications, should be written. This is a generic value. Note that the returned path may be empty if the system has no concept of shared cache. - \value GenericDataLocation Returns a directory location where persistent - data shared across applications can be stored. This is a generic value. The returned - path is never empty. \value RuntimeLocation Returns a directory location where runtime communication files should be written, like Unix local sockets. This is a generic value. The returned path may be empty on some systems. diff --git a/src/corelib/io/qurl.cpp b/src/corelib/io/qurl.cpp index f459928110..750437c2b0 100644 --- a/src/corelib/io/qurl.cpp +++ b/src/corelib/io/qurl.cpp @@ -82,7 +82,7 @@ For the convenience of generating encoded URL strings or query strings, there are two static functions called fromPercentEncoding() and toPercentEncoding() which deal with - percent encoding and decoding of QStrings. + percent encoding and decoding of QString objects. Calling isRelative() will tell whether or not the URL is relative. A relative URL can be resolved by passing it as argument @@ -172,7 +172,7 @@ setters setting components of a URL; it is not permitted in the QUrl constructor, in fromEncoded() or in setUrl(). For more information on this mode, see the documentation for - QUrl::FullyDecoded. + \l {QUrl::ComponentFormattingOption}{QUrl::FullyDecoded}. In TolerantMode, the parser has the following behaviour: @@ -4055,7 +4055,7 @@ QString QUrl::errorString() const /*! \since 5.1 - Converts a list of \a urls into a list of QStrings, using toString(\a options). + Converts a list of \a urls into a list of QString objects, using toString(\a options). */ QStringList QUrl::toStringList(const QList &urls, FormattingOptions options) { diff --git a/src/corelib/io/qurlquery.cpp b/src/corelib/io/qurlquery.cpp index 451f2c0ca7..abe05e4c4d 100644 --- a/src/corelib/io/qurlquery.cpp +++ b/src/corelib/io/qurlquery.cpp @@ -414,7 +414,7 @@ bool QUrlQuery::operator ==(const QUrlQuery &other) const } /*! - Returns \c true if this QUrlQUery object contains no key-value pairs, such as + Returns \c true if this QUrlQuery object contains no key-value pairs, such as after being default-constructed or after parsing an empty query string. \sa setQuery(), clear() diff --git a/src/corelib/json/qjsonarray.cpp b/src/corelib/json/qjsonarray.cpp index acbd7dda8f..c3420b21b2 100644 --- a/src/corelib/json/qjsonarray.cpp +++ b/src/corelib/json/qjsonarray.cpp @@ -531,8 +531,8 @@ bool QJsonArray::contains(const QJsonValue &value) const \a i must be a valid index position in the array (i.e., \c{0 <= i < size()}). - The return value is of type QJsonValueRef, a helper class for QJsonArray - and QJsonObject. When you get an object of type QJsonValueRef, you can + The return value is of type \keyword QJsonValueRef, a helper class for QJsonArray + and QJsonObject. When you get an object of type \keyword QJsonValueRef, you can use it as if it were a reference to a QJsonValue. If you assign to it, the assignment will apply to the character in the QJsonArray of QJsonObject from which you got the reference. @@ -731,13 +731,14 @@ bool QJsonArray::operator!=(const QJsonArray &other) const /*! \fn QJsonValueRef QJsonArray::iterator::operator*() const + Returns a modifiable reference to the current item. You can change the value of an item by using operator*() on the left side of an assignment. - The return value is of type QJsonValueRef, a helper class for QJsonArray - and QJsonObject. When you get an object of type QJsonValueRef, you can + The return value is of type \keyword QJsonValueRef, a helper class for QJsonArray + and QJsonObject. When you get an object of type \keyword QJsonValueRef, you can use it as if it were a reference to a QJsonValue. If you assign to it, the assignment will apply to the character in the QJsonArray of QJsonObject from which you got the reference. @@ -756,8 +757,8 @@ bool QJsonArray::operator!=(const QJsonArray &other) const This function is provided to make QJsonArray iterators behave like C++ pointers. - The return value is of type QJsonValueRef, a helper class for QJsonArray - and QJsonObject. When you get an object of type QJsonValueRef, you can + The return value is of type \keyword QJsonValueRef, a helper class for QJsonArray + and QJsonObject. When you get an object of type \keyword QJsonValueRef, you can use it as if it were a reference to a QJsonValue. If you assign to it, the assignment will apply to the character in the QJsonArray of QJsonObject from which you got the reference. diff --git a/src/corelib/json/qjsonvalue.cpp b/src/corelib/json/qjsonvalue.cpp index ac4fcb89c1..6d0b3aa5d8 100644 --- a/src/corelib/json/qjsonvalue.cpp +++ b/src/corelib/json/qjsonvalue.cpp @@ -74,6 +74,20 @@ QT_BEGIN_NAMESPACE conversions. This implies that converting to a type that is not stored in the value will return a default constructed return value. + \section1 QJsonValueRef + + QJsonValueRef is a helper class for QJsonArray and QJsonObject. + When you get an object of type QJsonValueRef, you can + use it as if it were a reference to a QJsonValue. If you assign to it, + the assignment will apply to the element in the QJsonArray or QJsonObject + from which you got the reference. + + The following methods return QJsonValueRef: + \list + \li \l {QJsonArray}::operator[](int i) + \li \l {QJsonObject}::operator[](const QString & key) const + \endlist + \sa {JSON Support in Qt}, {JSON Save Game Example} */ @@ -416,13 +430,13 @@ QJsonValue QJsonValue::fromVariant(const QVariant &variant) The QJsonValue types will be converted as follows: - \value Null {QVariant::}{QVariant()} + \value Null \l {QVariant::}{QVariant()} \value Bool QMetaType::Bool \value Double QMetaType::Double \value String QString \value Array QVariantList \value Object QVariantMap - \value Undefined {QVariant::}{QVariant()} + \value Undefined \l {QVariant::}{QVariant()} \sa fromVariant() */ diff --git a/src/corelib/kernel/qabstracteventdispatcher.cpp b/src/corelib/kernel/qabstracteventdispatcher.cpp index b365714365..bba6592b04 100644 --- a/src/corelib/kernel/qabstracteventdispatcher.cpp +++ b/src/corelib/kernel/qabstracteventdispatcher.cpp @@ -386,7 +386,7 @@ void QAbstractEventDispatcher::closingDown() \note The filter function set here receives native messages, that is, MSG or XEvent structs. - For maximum portability, you should always try to use QEvents + For maximum portability, you should always try to use QEvent objects and QObject::installEventFilter() whenever possible. \sa QObject::installEventFilter() diff --git a/src/corelib/kernel/qcoreapplication.cpp b/src/corelib/kernel/qcoreapplication.cpp index 6b0ebf8b8b..aea82fd48b 100644 --- a/src/corelib/kernel/qcoreapplication.cpp +++ b/src/corelib/kernel/qcoreapplication.cpp @@ -2399,7 +2399,7 @@ Q_GLOBAL_STATIC_WITH_ARGS(QMutex, libraryPathMutex, (QMutex::Recursive)) INSTALL/plugins, where \c INSTALL is the directory where Qt was installed). The directory of the application executable (NOT the working directory) is always added, as well as the colon separated - entries of the QT_PLUGIN_PATH environment variable. + entries of the \c QT_PLUGIN_PATH environment variable. If you want to iterate over the list, you can use the \l foreach pseudo-keyword: @@ -2544,7 +2544,7 @@ void QCoreApplication::removeLibraryPath(const QString &path) \note Native event filters will be disabled when the application the Qt::AA_MacPluginApplication attribute is set. - For maximum portability, you should always try to use QEvents + For maximum portability, you should always try to use QEvent and QObject::installEventFilter() whenever possible. \sa QObject::installEventFilter() diff --git a/src/corelib/kernel/qcoreevent.cpp b/src/corelib/kernel/qcoreevent.cpp index 85b7f51bd6..c0094fb7f2 100644 --- a/src/corelib/kernel/qcoreevent.cpp +++ b/src/corelib/kernel/qcoreevent.cpp @@ -58,7 +58,7 @@ QT_BEGIN_NAMESPACE send events using QCoreApplication::sendEvent() and QCoreApplication::postEvent() (spontaneous() returns \c false). - QObjects receive events by having their QObject::event() function + \l {QObject}{QObjects} receive events by having their QObject::event() function called. The function can be reimplemented in subclasses to customize event handling and add additional event types; QWidget::event() is a notable example. By default, events are @@ -102,13 +102,13 @@ QT_BEGIN_NAMESPACE \value ChildAdded An object gets a child (QChildEvent). \value ChildPolished A widget child gets polished (QChildEvent). \value ChildRemoved An object loses a child (QChildEvent). - \value Clipboard The clipboard contents have changed (QClipboardEvent). + \value Clipboard The clipboard contents have changed. \value Close Widget was closed (QCloseEvent). \value CloseSoftwareInputPanel A widget wants to close the software input panel (SIP). \value ContentsRectChange The margins of the widget's content rect changed. \value ContextMenu Context popup menu (QContextMenuEvent). \value CursorChange The widget's cursor has changed. - \value DeferredDelete The object will be deleted after it has cleaned up (QDeferredDeleteEvent). + \value DeferredDelete The object will be deleted after it has cleaned up (QDeferredDeleteEvent) \value DragEnter The cursor enters a widget during a drag and drop operation (QDragEnterEvent). \value DragLeave The cursor leaves a widget during a drag and drop operation (QDragLeaveEvent). \value DragMove A drag and drop operation is in progress (QDragMoveEvent). @@ -116,7 +116,7 @@ QT_BEGIN_NAMESPACE \value DynamicPropertyChange A dynamic property was added, changed, or removed from the object. \value EnabledChange Widget's enabled state has changed. \value Enter Mouse enters widget's boundaries (QEnterEvent). - \value EnterEditFocus An editor widget gains focus for editing. QT_KEYPAD_NAVIGATION must be defined. + \value EnterEditFocus An editor widget gains focus for editing. \c QT_KEYPAD_NAVIGATION must be defined. \value EnterWhatsThisMode Send to toplevel widgets when the application enters "What's This?" mode. \value Expose Sent to a window when its on-screen contents are invalidated and need to be flushed from the backing store. \value FileOpen File open request (QFileOpenEvent). @@ -177,7 +177,7 @@ QT_BEGIN_NAMESPACE \value MouseTrackingChange The mouse tracking state has changed. \value Move Widget's position changed (QMoveEvent). \value NativeGesture The system has detected a gesture (QNativeGestureEvent). - \value OrientationChange The screens orientation has changes (QScreenOrientationChangeEvent) + \value OrientationChange The screens orientation has changes (QScreenOrientationChangeEvent). \value Paint Screen update necessary (QPaintEvent). \value PaletteChange Palette of the widget changed. \value ParentAboutToChange The widget parent is about to change. diff --git a/src/corelib/kernel/qmetatype.cpp b/src/corelib/kernel/qmetatype.cpp index 311648c33a..74e53b5e86 100644 --- a/src/corelib/kernel/qmetatype.cpp +++ b/src/corelib/kernel/qmetatype.cpp @@ -188,6 +188,8 @@ struct DefinedTypesFilter { \enum QMetaType::Type These are the built-in types supported by QMetaType: + Read doc on QChar + Read doc on \l QChar \value Void \c void \value Bool \c bool diff --git a/src/corelib/kernel/qpointer.cpp b/src/corelib/kernel/qpointer.cpp index 1a7d0930de..c0da2c3cf0 100644 --- a/src/corelib/kernel/qpointer.cpp +++ b/src/corelib/kernel/qpointer.cpp @@ -55,7 +55,7 @@ \li When using QPointer on a QWidget (or a subclass of QWidget), previously the QPointer would be cleared by the QWidget destructor. Now, the QPointer - is cleared by the QObject destructor (since this is when QWeakPointers are + is cleared by the QObject destructor (since this is when QWeakPointer objects are cleared). Any QPointers tracking a widget will \b NOT be cleared before the QWidget destructor destroys the children for the widget being tracked. diff --git a/src/corelib/kernel/qtimer.cpp b/src/corelib/kernel/qtimer.cpp index 0803cf302e..99fe33ebc6 100644 --- a/src/corelib/kernel/qtimer.cpp +++ b/src/corelib/kernel/qtimer.cpp @@ -91,7 +91,7 @@ QT_BEGIN_NAMESPACE its work. This is the traditional way of implementing heavy work in GUI applications, but as multithreading is nowadays becoming available on more and more platforms, we expect that zero-millisecond - QTimers will gradually be replaced by \l{QThread}s. + QTimer objects will gradually be replaced by \l{QThread}s. \section1 Accuracy and Timer Resolution diff --git a/src/corelib/kernel/qvariant.cpp b/src/corelib/kernel/qvariant.cpp index f76201802b..3db19f1ee5 100644 --- a/src/corelib/kernel/qvariant.cpp +++ b/src/corelib/kernel/qvariant.cpp @@ -1274,13 +1274,13 @@ QVariant::QVariant(const char *val) /*! \fn QVariant::QVariant(const QMap &val) - Constructs a new variant with a map of QVariants, \a val. + Constructs a new variant with a map of \l {QVariant}s, \a val. */ /*! \fn QVariant::QVariant(const QHash &val) - Constructs a new variant with a hash of QVariants, \a val. + Constructs a new variant with a hash of \l {QVariant}s, \a val. */ /*! @@ -3333,7 +3333,7 @@ QDebug operator<<(QDebug dbg, const QVariant::Type p) Q_OBJECT macro. If the QVariant contains a sequential container and \c{T} is QVariantList, the - elements of the container will be converted into QVariants and returned as a QVariantList. + elements of the container will be converted into \l {QVariant}s and returned as a QVariantList. \snippet code/src_corelib_kernel_qvariant.cpp 9 diff --git a/src/corelib/plugin/qpluginloader.cpp b/src/corelib/plugin/qpluginloader.cpp index 9441f5bff8..f850394984 100644 --- a/src/corelib/plugin/qpluginloader.cpp +++ b/src/corelib/plugin/qpluginloader.cpp @@ -420,7 +420,7 @@ void Q_CORE_EXPORT qRegisterStaticPluginFunction(QStaticPlugin plugin) /*! Returns a list of static plugin instances (root components) held by the plugin loader. - \sa staticPlugins() + \sa staticPlugin() */ QObjectList QPluginLoader::staticInstances() { -- cgit v1.2.3 From 661f6bfd032dacc62841037732816a583640e187 Mon Sep 17 00:00:00 2001 From: "Richard J. Moore" Date: Sat, 21 Feb 2015 17:43:21 +0000 Subject: Fix a division by zero when processing malformed BMP files. This fixes a division by 0 when processing a maliciously crafted BMP file. No impact beyond DoS. Task-number: QTBUG-44547 Change-Id: Ifcded2c0aa712e90d23e6b3969af0ec3add53973 Reviewed-by: Thiago Macieira Reviewed-by: Oswald Buddenhagen --- src/gui/image/qbmphandler.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'src') diff --git a/src/gui/image/qbmphandler.cpp b/src/gui/image/qbmphandler.cpp index 21c1a2f813..df664994d6 100644 --- a/src/gui/image/qbmphandler.cpp +++ b/src/gui/image/qbmphandler.cpp @@ -314,12 +314,20 @@ static bool read_dib_body(QDataStream &s, const BMP_INFOHDR &bi, int offset, int } } else if (comp == BMP_BITFIELDS && (nbits == 16 || nbits == 32)) { red_shift = calc_shift(red_mask); + if (((red_mask >> red_shift) + 1) == 0) + return false; red_scale = 256 / ((red_mask >> red_shift) + 1); green_shift = calc_shift(green_mask); + if (((green_mask >> green_shift) + 1) == 0) + return false; green_scale = 256 / ((green_mask >> green_shift) + 1); blue_shift = calc_shift(blue_mask); + if (((blue_mask >> blue_shift) + 1) == 0) + return false; blue_scale = 256 / ((blue_mask >> blue_shift) + 1); alpha_shift = calc_shift(alpha_mask); + if (((alpha_mask >> alpha_shift) + 1) == 0) + return false; alpha_scale = 256 / ((alpha_mask >> alpha_shift) + 1); } else if (comp == BMP_RGB && (nbits == 24 || nbits == 32)) { blue_mask = 0x000000ff; -- cgit v1.2.3 From 89536d041b057cd68797a7afa037e7f7a932f3c4 Mon Sep 17 00:00:00 2001 From: Olivier Blin Date: Wed, 18 Feb 2015 19:23:30 +0100 Subject: Fix crash in QPainter::drawGlyphRun() when painter is not active Change-Id: I24f52cf1db300b8a6d0a4cb19fc6c74c41e00dbc Reviewed-by: Allan Sandfeld Jensen --- src/gui/painting/qpainter.cpp | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'src') diff --git a/src/gui/painting/qpainter.cpp b/src/gui/painting/qpainter.cpp index d40a2b9456..de37c5635c 100644 --- a/src/gui/painting/qpainter.cpp +++ b/src/gui/painting/qpainter.cpp @@ -5534,6 +5534,11 @@ void QPainter::drawGlyphRun(const QPointF &position, const QGlyphRun &glyphRun) { Q_D(QPainter); + if (!d->engine) { + qWarning("QPainter::drawGlyphRun: Painter not active"); + return; + } + QRawFont font = glyphRun.rawFont(); if (!font.isValid()) return; -- cgit v1.2.3 From edd555425a08f9e074f0a4d9333862636ccaae8d Mon Sep 17 00:00:00 2001 From: Giuseppe D'Angelo Date: Mon, 23 Feb 2015 21:15:08 +0100 Subject: QtOpenGL: avoid crashing if creating a QGLContext sharing with the global QOpenGLContext If one asks for the global OpenGL context via the right attribute, and then creates a QGLContext sharing with that context, Qt will create anoter, dummy QGLContext owned by the global context. At application shutdown, and specifically after ~QObject of QGuiApplication has run, the QObjectPrivate dpointer gets destroyed. That destroys the owning global QOpenGLContext, and therefore that dummy QGLContext as well. However, QGLContext dtor triggers a code path that accesses qApp as if it were still alive. That's not the case any more -- it has already been destroyed. So, introduce a check and avoid dereferencing NULL. Task-number: QTBUG-44621 Change-Id: Ic160ac99e9269db999e76229b1c7f8c53bd2be61 Reviewed-by: Laszlo Agocs --- src/opengl/qgl.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/opengl/qgl.cpp b/src/opengl/qgl.cpp index 35f08e0092..0bd48b6c17 100644 --- a/src/opengl/qgl.cpp +++ b/src/opengl/qgl.cpp @@ -163,7 +163,7 @@ Q_GLOBAL_STATIC(QGLSignalProxy, theSignalProxy) QGLSignalProxy *QGLSignalProxy::instance() { QGLSignalProxy *proxy = theSignalProxy(); - if (proxy && proxy->thread() != qApp->thread()) { + if (proxy && qApp && proxy->thread() != qApp->thread()) { if (proxy->thread() == QThread::currentThread()) proxy->moveToThread(qApp->thread()); } -- cgit v1.2.3