From 05ddae12d18a348afd942fd85a8d8773698da3a1 Mon Sep 17 00:00:00 2001 From: Eskil Abrahamsen Blomfeldt Date: Thu, 15 Aug 2013 10:45:51 +0200 Subject: Android: Fix orientation change on Android 4.3 In Android 4.3, we will get a new native window pointer for the same surface (the old surface has not been destroyed), whereas before we would get the same pointer, thus hitting the "sameNativeWindow" branch. This revealed some bugs in the surfaceChanged code path when the old surface had not been destroyed. This path is now taken both when there's no old surface (the app has been suspended in the mean time) and when the orientation changes. To handle the second case, we need to make sure: 1. We update the static pointer 2. We update the pointers in the platform windows 3. We don't add a second reference to the static data for windows 4. We schedule an update of the window size Task-number: QTBUG-32878 Change-Id: I47257615f9ba820315fc98d7a804e52223f430bf Reviewed-by: Christian Stromme Reviewed-by: Frederik Gladhorn --- .../platforms/android/src/androidjnimain.cpp | 40 ++++++++++++---------- .../src/opengl/qandroidopenglplatformwindow.cpp | 21 ++++++++++-- .../src/opengl/qandroidopenglplatformwindow.h | 2 ++ .../android/src/qandroidplatformintegration.cpp | 1 + 4 files changed, 43 insertions(+), 21 deletions(-) (limited to 'src') diff --git a/src/plugins/platforms/android/src/androidjnimain.cpp b/src/plugins/platforms/android/src/androidjnimain.cpp index 162a8aa977..74183b3107 100644 --- a/src/plugins/platforms/android/src/androidjnimain.cpp +++ b/src/plugins/platforms/android/src/androidjnimain.cpp @@ -555,33 +555,37 @@ static void setSurface(JNIEnv *env, jobject /*thiz*/, jobject jSurface) m_nativeWindow = nativeWindow; if (m_waitForWindow) m_waitForWindowSemaphore.release(); - if (m_androidPlatformIntegration && !sameNativeWindow) { - m_surfaceMutex.unlock(); - m_androidPlatformIntegration->surfaceChanged(); - } else if (m_androidPlatformIntegration && sameNativeWindow) { - QPlatformScreen *screen = m_androidPlatformIntegration->screen(); + + if (m_androidPlatformIntegration) { QSize size = QtAndroid::nativeWindowSize(); + QPlatformScreen *screen = m_androidPlatformIntegration->screen(); QRect geometry(QPoint(0, 0), size); QWindowSystemInterface::handleScreenAvailableGeometryChange(screen->screen(), geometry); QWindowSystemInterface::handleScreenGeometryChange(screen->screen(), geometry); - // Resize all top level windows, since they share the same surface - foreach (QWindow *w, QGuiApplication::topLevelWindows()) { - QAndroidOpenGLPlatformWindow *window = - static_cast(w->handle()); - - if (window != 0) { - window->lock(); - window->scheduleResize(size); - - QWindowSystemInterface::handleExposeEvent(window->window(), - QRegion(window->window()->geometry())); - window->unlock(); + if (!sameNativeWindow) { + m_surfaceMutex.unlock(); + m_androidPlatformIntegration->surfaceChanged(); + } else { + // Resize all top level windows, since they share the same surface + foreach (QWindow *w, QGuiApplication::topLevelWindows()) { + QAndroidOpenGLPlatformWindow *window = + static_cast(w->handle()); + + if (window != 0) { + window->lock(); + window->scheduleResize(size); + + QWindowSystemInterface::handleExposeEvent(window->window(), + QRegion(window->window()->geometry())); + window->unlock(); + } } + + m_surfaceMutex.unlock(); } - m_surfaceMutex.unlock(); } else { m_surfaceMutex.unlock(); } diff --git a/src/plugins/platforms/android/src/opengl/qandroidopenglplatformwindow.cpp b/src/plugins/platforms/android/src/opengl/qandroidopenglplatformwindow.cpp index 5362906e0e..b1a2231ff5 100644 --- a/src/plugins/platforms/android/src/opengl/qandroidopenglplatformwindow.cpp +++ b/src/plugins/platforms/android/src/opengl/qandroidopenglplatformwindow.cpp @@ -85,9 +85,19 @@ void QAndroidOpenGLPlatformWindow::invalidateSurface() } } +void QAndroidOpenGLPlatformWindow::updateStaticNativeWindow() +{ + QWriteLocker locker(&m_staticSurfaceLock); + m_staticNativeWindow = QtAndroid::nativeWindow(false); +} + void QAndroidOpenGLPlatformWindow::resetSurface() { - m_referenceCount.ref(); + // Only add a reference if we're not already holding one, otherwise we're just updating + // the native window pointer + if (m_window == 0) + m_referenceCount.ref(); + if (m_staticSurface == 0) { QWriteLocker locker(&m_staticSurfaceLock); QEglFSWindow::resetSurface(); @@ -95,12 +105,17 @@ void QAndroidOpenGLPlatformWindow::resetSurface() m_staticNativeWindow = m_window; } else { QReadLocker locker(&m_staticSurfaceLock); - Q_ASSERT(m_staticSurface != m_surface); m_window = m_staticNativeWindow; m_surface = m_staticSurface; } - QWindowSystemInterface::handleExposeEvent(window(), QRegion(geometry())); // Expose event + { + lock(); + scheduleResize(QtAndroid::nativeWindowSize()); + QWindowSystemInterface::handleExposeEvent(window(), QRegion(geometry())); // Expose event + unlock(); + } + QWindowSystemInterface::flushWindowSystemEvents(); } diff --git a/src/plugins/platforms/android/src/opengl/qandroidopenglplatformwindow.h b/src/plugins/platforms/android/src/opengl/qandroidopenglplatformwindow.h index 36a110e1a8..9a25957ccd 100644 --- a/src/plugins/platforms/android/src/opengl/qandroidopenglplatformwindow.h +++ b/src/plugins/platforms/android/src/opengl/qandroidopenglplatformwindow.h @@ -71,6 +71,8 @@ public: void destroy(); + static void updateStaticNativeWindow(); + private: QSize m_scheduledResize; QMutex m_lock; diff --git a/src/plugins/platforms/android/src/qandroidplatformintegration.cpp b/src/plugins/platforms/android/src/qandroidplatformintegration.cpp index 91ad2b368f..636a2b3853 100644 --- a/src/plugins/platforms/android/src/qandroidplatformintegration.cpp +++ b/src/plugins/platforms/android/src/qandroidplatformintegration.cpp @@ -162,6 +162,7 @@ void QAndroidPlatformIntegration::invalidateNativeSurface() void QAndroidPlatformIntegration::surfaceChanged() { + QAndroidOpenGLPlatformWindow::updateStaticNativeWindow(); foreach (QWindow *w, QGuiApplication::topLevelWindows()) { QAndroidOpenGLPlatformWindow *window = static_cast(w->handle()); -- cgit v1.2.3 From c15a8cc283d5d7b26677b9c71cabb1f5f47494f1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tor=20Arne=20Vestb=C3=B8?= Date: Wed, 21 Aug 2013 15:05:19 +0200 Subject: Don't use qt_mac_get_fixed_pitch() to resolve fixed pitch fonts on OSX The call was resulting in inifinite recursion on OSX 10.9 when Qt was built against the 10.7 SDK, as qt_mac_get_fixed_pitch uses QFontMetrics to resolve the pitch, and we would end up in the font resolver again when asking for the metrics. The CoreText font-database already takes care of resolving whether or not a font family is fixed-pitch, so the code is likely a leftover from the ATSUI-days, and can be removed. Task-number: QTBUG-31803 Change-Id: I37c90fa637927eb4adc16c0fd556c4c46c456034 Reviewed-by: Gabriel de Dietrich (cherry picked from commit bd9a023a41209a216eec28bd25a20372a5172b6a) Reviewed-by: Jani Heikkinen Reviewed-by: Iikka Eklund --- src/gui/text/qfontdatabase.cpp | 24 ------------------------ 1 file changed, 24 deletions(-) (limited to 'src') diff --git a/src/gui/text/qfontdatabase.cpp b/src/gui/text/qfontdatabase.cpp index 62379cd592..54b4629ca0 100644 --- a/src/gui/text/qfontdatabase.cpp +++ b/src/gui/text/qfontdatabase.cpp @@ -314,9 +314,6 @@ struct QtFontFamily QtFontFamily(const QString &n) : fixedPitch(false), -#if !defined(QWS) && defined(Q_OS_MAC) - fixedPitchComputed(false), -#endif name(n), count(0), foundries(0) , bogusWritingSystems(false) , askedForFallback(false) @@ -330,9 +327,6 @@ struct QtFontFamily } bool fixedPitch : 1; -#if !defined(QWS) && defined(Q_OS_MAC) - bool fixedPitchComputed : 1; -#endif QString name; QStringList aliases; @@ -348,18 +342,6 @@ struct QtFontFamily QtFontFoundry *foundry(const QString &f, bool = false); }; -#if !defined(QWS) && defined(Q_OS_MAC) -inline static void qt_mac_get_fixed_pitch(QtFontFamily *f) -{ - if(f && !f->fixedPitchComputed) { - QFontMetrics fm(f->name); - f->fixedPitch = fm.width(QLatin1Char('i')) == fm.width(QLatin1Char('m')); - f->fixedPitchComputed = true; - } -} -#endif - - QtFontFoundry *QtFontFamily::foundry(const QString &f, bool create) { if (f.isNull() && count == 1) @@ -823,9 +805,6 @@ unsigned int bestFoundry(int script, unsigned int score, int styleStrategy, EncodingMismatch = 0x0002 }; if (pitch != '*') { -#if !defined(QWS) && defined(Q_OS_MAC) - qt_mac_get_fixed_pitch(const_cast(family)); -#endif if ((pitch == 'm' && !family->fixedPitch) || (pitch == 'p' && family->fixedPitch)) this_score += PitchMismatch; @@ -1263,9 +1242,6 @@ bool QFontDatabase::isFixedPitch(const QString &family, QT_PREPEND_NAMESPACE(load)(familyName); QtFontFamily *f = d->family(familyName); -#if !defined(QWS) && defined(Q_OS_MAC) - qt_mac_get_fixed_pitch(f); -#endif return (f && f->fixedPitch); } -- cgit v1.2.3 From 78d7192338e2cbba0c9b53c429d35b9437b7e1cd Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Tue, 27 Aug 2013 11:58:34 +0200 Subject: Close menu on 2nd click on QMenuBar. Task-number: QTBUG-32807 Change-Id: I0c3c25c6acf92bc30c1bcfc09003209b572ec777 Reviewed-by: Joerg Bornemann --- src/widgets/widgets/qmenubar.cpp | 1 + 1 file changed, 1 insertion(+) (limited to 'src') diff --git a/src/widgets/widgets/qmenubar.cpp b/src/widgets/widgets/qmenubar.cpp index f22c48b26f..a7cad28df3 100644 --- a/src/widgets/widgets/qmenubar.cpp +++ b/src/widgets/widgets/qmenubar.cpp @@ -1054,6 +1054,7 @@ void QMenuBar::mousePressEvent(QMouseEvent *e) if(QMenu *menu = d->activeMenu) { d->activeMenu = 0; menu->hide(); + d->closePopupMode = 1; } } else { d->setCurrentAction(action, true); -- cgit v1.2.3 From 198d2f6d3e1f622e1f168ff7e6aea7d1f05b80ed Mon Sep 17 00:00:00 2001 From: Giuseppe D'Angelo Date: Mon, 26 Aug 2013 17:54:32 +0200 Subject: Activate Qt::WidgetWithChildrenShortcut shortcuts in MDI subwindows If a MDI subwindow is focused and an ancestor has a QShortCut set with the Qt::WidgetWithChildrenShortcut flag, it should trigger, as MDI subwindows are not top-level widgets. Task-number: QTBUG-32788 Change-Id: I7ec76d493b827ae6678209a56015ab6b432c1ed9 Reviewed-by: Friedemann Kleint --- src/widgets/kernel/qshortcut.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/widgets/kernel/qshortcut.cpp b/src/widgets/kernel/qshortcut.cpp index 471b054a99..678e6f25d1 100644 --- a/src/widgets/kernel/qshortcut.cpp +++ b/src/widgets/kernel/qshortcut.cpp @@ -158,7 +158,7 @@ static bool correctWidgetContext(Qt::ShortcutContext context, QWidget *w, QWidge if (context == Qt::WidgetWithChildrenShortcut) { const QWidget *tw = QApplication::focusWidget(); - while (tw && tw != w && (tw->windowType() == Qt::Widget || tw->windowType() == Qt::Popup)) + while (tw && tw != w && (tw->windowType() == Qt::Widget || tw->windowType() == Qt::Popup || tw->windowType() == Qt::SubWindow)) tw = tw->parentWidget(); return tw == w; } -- cgit v1.2.3 From 62645266590cfff620c4629ba85d8b9903c1f313 Mon Sep 17 00:00:00 2001 From: Nico Vertriest Date: Thu, 29 Aug 2013 13:12:41 +0200 Subject: Doc: minor language and layout edits Task-number: QTBUG-31801 Change-Id: I99043ba5d1a417e093ae2e4bc7d2967ec9d095fc Reviewed-by: Jerome Pasion --- src/tools/qdoc/doc/qdoc-minimum-qdocconf.qdoc | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/tools/qdoc/doc/qdoc-minimum-qdocconf.qdoc b/src/tools/qdoc/doc/qdoc-minimum-qdocconf.qdoc index 4289f357e9..20e0b86b6c 100644 --- a/src/tools/qdoc/doc/qdoc-minimum-qdocconf.qdoc +++ b/src/tools/qdoc/doc/qdoc-minimum-qdocconf.qdoc @@ -26,12 +26,15 @@ ****************************************************************************/ /*! \page qdoc-minimum-qdocconf.html -\title A minimal qdocconf file with comments +\title A minimal qdocconf file with Comments \brief Describes a minimal .qdocconf file -Below you will find the full contents of qtgui.qdocconf. The subsequent section will discuss -every statement in the qdocconf file. +Below you will find the full contents of qtgui.qdocconf. The subsequent section +will discuss every statement in the qdocconf file. + +Each line from the qdocconf file is first quoted. Below each statement you will +find the meaning. \code #include(compat.qdocconf) @@ -83,4 +86,6 @@ The source code of the example files can be found in the current directory. The image files can be found in the underlying directory "images". +\note Please take care with this minimal qdocconf file. Using it in the wrong directory +could cause qdoc to include a large number of files. */ -- cgit v1.2.3 From 4ffa60e03a6ef1a7b8c8458377697b25c07eda8b Mon Sep 17 00:00:00 2001 From: Giuseppe D'Angelo Date: Thu, 29 Aug 2013 12:40:47 +0200 Subject: Update QLineEdit::placeholderText property documentation eeb31ad10a1c1b26233f383de6d1b2b217cde08f changed the behavior and allowed the placeholder text to stay visible even if the lineedit has focus. Task-number: QTBUG-33237 Change-Id: I733331be1d3225eb28390b21eb9a7e4971bfdc31 Reviewed-by: Olivier Goffart --- src/widgets/widgets/qlineedit.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'src') diff --git a/src/widgets/widgets/qlineedit.cpp b/src/widgets/widgets/qlineedit.cpp index 70083d7267..816e7be8fd 100644 --- a/src/widgets/widgets/qlineedit.cpp +++ b/src/widgets/widgets/qlineedit.cpp @@ -333,8 +333,7 @@ void QLineEdit::setText(const QString& text) \brief the line edit's placeholder text Setting this property makes the line edit display a grayed-out - placeholder text as long as the text() is empty and the widget doesn't - have focus. + placeholder text as long as the text() is empty. By default, this property contains an empty string. -- cgit v1.2.3 From e59a5f9fdcec5df2f54e88d75a75fcb4a2fe577b Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Mon, 26 Aug 2013 11:52:47 +0200 Subject: Windows: Fix compilation with MinGW-64, gcc 4.8.1 A definition for FILE_ID_128 was added. Change-Id: Ifdfe5da1b15a90afdf5cf09d92838a04b1cf5c19 Reviewed-by: Kai Koehne --- src/corelib/io/qfilesystemengine_win.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/corelib/io/qfilesystemengine_win.cpp b/src/corelib/io/qfilesystemengine_win.cpp index e8904b0ab7..57231b57a9 100644 --- a/src/corelib/io/qfilesystemengine_win.cpp +++ b/src/corelib/io/qfilesystemengine_win.cpp @@ -573,9 +573,12 @@ typedef enum { Q_FileIdInfo = 18 } Q_FILE_INFO_BY_HANDLE_CLASS; # if defined(Q_CC_MINGW) || (defined(Q_CC_MSVC) && _MSC_VER < 1700) +// MinGW-64 defines FILE_ID_128 as of gcc-4.8.1 along with FILE_SUPPORTS_INTEGRITY_STREAMS +# if !(defined(Q_CC_MINGW) && defined(FILE_SUPPORTS_INTEGRITY_STREAMS)) typedef struct _FILE_ID_128 { BYTE Identifier[16]; } FILE_ID_128, *PFILE_ID_128; +# endif // !(Q_CC_MINGW && FILE_SUPPORTS_INTEGRITY_STREAMS) typedef struct _FILE_ID_INFO { ULONGLONG VolumeSerialNumber; @@ -614,7 +617,8 @@ QByteArray fileIdWin8(HANDLE handle) &infoEx, sizeof(FILE_ID_INFO))) { result = QByteArray::number(infoEx.VolumeSerialNumber, 16); result += ':'; - result += QByteArray((char *)infoEx.FileId.Identifier, sizeof(infoEx.FileId.Identifier)).toHex(); + // Note: MinGW-64's definition of FILE_ID_128 differs from the MSVC one. + result += QByteArray((char *)&infoEx.FileId, sizeof(infoEx.FileId)).toHex(); } } return result; -- cgit v1.2.3 From b49327145eb984c2051585d89f0826c58d35c116 Mon Sep 17 00:00:00 2001 From: Olivier Goffart Date: Thu, 29 Aug 2013 12:53:18 +0200 Subject: QMetaMethod::invoke: compare the QMetaType id of the return types MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Since Qt5, the QMetaObject do not contains the string name of the builtin types, but only the QMetaType id. QMetaMethod::typeName convert back from the id to the string. But if the type is aliased, the string of the main type is returned. This was the case for example for qint64 which is transformed to "qlonglong". This causes a regression in QMetaType::invoke when trying to invoke a method which return an aliased type, since the string comparison would fail. Fix the problem by also comparing the metatype id. Changelog: QMetaMethod::invoke: Fix return of aliased meta type Task-number: QTBUG-33222 Change-Id: Iec7b99dcbf7b23eb818de74f413e4451ce510ac4 Reviewed-by: Jędrzej Nowacki --- src/corelib/kernel/qmetaobject.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/corelib/kernel/qmetaobject.cpp b/src/corelib/kernel/qmetaobject.cpp index 4dc766ecc5..8d6cf5beb5 100644 --- a/src/corelib/kernel/qmetaobject.cpp +++ b/src/corelib/kernel/qmetaobject.cpp @@ -42,6 +42,7 @@ #include "qmetaobject.h" #include "qmetatype.h" #include "qobject.h" +#include "qmetaobject_p.h" #include #include @@ -2098,8 +2099,12 @@ bool QMetaMethod::invoke(QObject *object, if (qstrcmp(returnValue.name(), retType) != 0) { // normalize the return value as well QByteArray normalized = QMetaObject::normalizedType(returnValue.name()); - if (qstrcmp(normalized.constData(), retType) != 0) - return false; + if (qstrcmp(normalized.constData(), retType) != 0) { + // String comparison failed, try compare the metatype. + int t = returnType(); + if (t == QMetaType::UnknownType || t != QMetaType::type(normalized)) + return false; + } } } -- cgit v1.2.3 From 0ab3e290c4808f73d46903a5274929e3833d8d3c Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Wed, 28 Aug 2013 12:20:17 +0200 Subject: Initialize variables to fix valgrind warning in pnghandler. Conditional jump or move depends on uninitialised value(s) ==7986== at 0x5B838E8: QPngHandlerPrivate::readPngImage(QImage*) (qpnghandler.cpp:617) Change-Id: Ie739ca1665ce600426e2816a6229145d814125cb Reviewed-by: aavit --- src/gui/image/qpnghandler.cpp | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'src') diff --git a/src/gui/image/qpnghandler.cpp b/src/gui/image/qpnghandler.cpp index e43ac666c7..7838b7df8e 100644 --- a/src/gui/image/qpnghandler.cpp +++ b/src/gui/image/qpnghandler.cpp @@ -591,14 +591,14 @@ bool Q_INTERNAL_WIN_NO_THROW QPngHandlerPrivate::readPngImage(QImage *outImage) if (doScaledRead) { read_image_scaled(outImage, png_ptr, info_ptr, amp, scaledSize); } else { - png_uint_32 width; - png_uint_32 height; - png_int_32 offset_x; - png_int_32 offset_y; - - int bit_depth; - int color_type; - int unit_type; + png_uint_32 width = 0; + png_uint_32 height = 0; + png_int_32 offset_x = 0; + png_int_32 offset_y = 0; + + int bit_depth = 0; + int color_type = 0; + int unit_type = PNG_OFFSET_PIXEL; png_get_IHDR(png_ptr, info_ptr, &width, &height, &bit_depth, &color_type, 0, 0, 0); png_get_oFFs(png_ptr, info_ptr, &offset_x, &offset_y, &unit_type); uchar *data = outImage->bits(); -- cgit v1.2.3 From 99362fb7f25a88829c2d824ebfe6da61d4d7b35f Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Fri, 30 Aug 2013 12:08:47 +0200 Subject: Windows XP file dialog: Fix appending the selected filter suffix. The mechanism is triggered by always setting lpstrDefExt, Task-number: QTBUG-33156 Change-Id: Ib3a49410a1ad78fb433a4e0803a0751ec8c2a51e Reviewed-by: Joerg Bornemann --- src/plugins/platforms/windows/qwindowsdialoghelpers.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/plugins/platforms/windows/qwindowsdialoghelpers.cpp b/src/plugins/platforms/windows/qwindowsdialoghelpers.cpp index 27a7044868..9a7d03c0c2 100644 --- a/src/plugins/platforms/windows/qwindowsdialoghelpers.cpp +++ b/src/plugins/platforms/windows/qwindowsdialoghelpers.cpp @@ -1818,8 +1818,8 @@ void QWindowsXpNativeFileDialog::populateOpenFileName(OPENFILENAME *ofn, HWND ow QString defaultSuffix = m_options->defaultSuffix(); if (defaultSuffix.startsWith(QLatin1Char('.'))) defaultSuffix.remove(0, 1); - if (!defaultSuffix.isEmpty()) - ofn->lpstrDefExt = qStringToWCharArray(defaultSuffix); + // QTBUG-33156, also create empty strings to trigger the appending mechanism. + ofn->lpstrDefExt = qStringToWCharArray(defaultSuffix); } // Flags. ofn->Flags = (OFN_NOCHANGEDIR | OFN_HIDEREADONLY | OFN_EXPLORER | OFN_PATHMUSTEXIST); -- cgit v1.2.3 From 16f3c84e30ba82481d0d8ffdc6a239452a45c8bf Mon Sep 17 00:00:00 2001 From: Leonard Lee Date: Thu, 22 Aug 2013 16:37:17 +0200 Subject: Remove the size limit of QByteArray information. The information is explaining implementation details rather than on how to use it effectively. The size limit of QByteArray may vary depending on available memory. Task-number: QTBUG-33037 Change-Id: I361316422ade3624a0c2864d93f87caeb654f4d7 Reviewed-by: Thiago Macieira --- src/corelib/tools/qbytearray.cpp | 2 -- 1 file changed, 2 deletions(-) (limited to 'src') diff --git a/src/corelib/tools/qbytearray.cpp b/src/corelib/tools/qbytearray.cpp index e993855e7e..6ce17e5e13 100644 --- a/src/corelib/tools/qbytearray.cpp +++ b/src/corelib/tools/qbytearray.cpp @@ -645,8 +645,6 @@ static inline char qToLower(char c) store raw binary data, and when memory conservation is critical (e.g., with Qt for Embedded Linux). - The maximum array size of a QByteArray is under 2^30. - One way to initialize a QByteArray is simply to pass a \c{const char *} to its constructor. For example, the following code creates a byte array of size 5 containing the data "Hello": -- cgit v1.2.3 From 0ed30cbf09db591b46370888fa2f687310bf5cff Mon Sep 17 00:00:00 2001 From: Kai Koehne Date: Mon, 2 Sep 2013 10:20:37 +0200 Subject: Fix compilation with latest Mingw-w64 headers Fix compilation with e.g. mingw-builds 4.8.1-rev4 package. The Mingw-W64 headers define SHSTOCKICONINFO only for vista and newer. Task-number: QTBUG-33225 Change-Id: I30a62c642ae017c7eafb99b1efb06578fd61a12e Reviewed-by: Friedemann Kleint --- src/plugins/platforms/windows/qwindowstheme.cpp | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'src') diff --git a/src/plugins/platforms/windows/qwindowstheme.cpp b/src/plugins/platforms/windows/qwindowstheme.cpp index 0fcd20f7bb..9f6e6b18e7 100644 --- a/src/plugins/platforms/windows/qwindowstheme.cpp +++ b/src/plugins/platforms/windows/qwindowstheme.cpp @@ -39,6 +39,12 @@ ** ****************************************************************************/ +// SHSTOCKICONINFO is only available since Vista +#if _WIN32_WINNT < 0x0600 +# undef _WIN32_WINNT +# define _WIN32_WINNT 0x0600 +#endif + #include "qwindowstheme.h" #include "qwindowsdialoghelpers.h" #include "qwindowscontext.h" -- cgit v1.2.3 From cdbf8dd276a2b6f3544a4e67e1216a1b8ca9f29e Mon Sep 17 00:00:00 2001 From: Andy Shaw Date: Mon, 26 Aug 2013 12:05:54 +0200 Subject: Ensure the timer is killed when appropriate before starting a new one When the mouse moves while the sloppy menu timer is still running then it would end up just creating a new one and the old one would continue to run. If the action that it is relevant for is different then it should restart the timer, otherwise it should just ignore the mouse move and let the other timer continue. Change-Id: Id03014fa05596bd6ede887fa917e21ca5a7690d8 Reviewed-by: Friedemann Kleint --- src/widgets/widgets/qmenu.cpp | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/widgets/widgets/qmenu.cpp b/src/widgets/widgets/qmenu.cpp index 4df89a5ede..c305748c7d 100644 --- a/src/widgets/widgets/qmenu.cpp +++ b/src/widgets/widgets/qmenu.cpp @@ -2864,8 +2864,15 @@ void QMenu::mouseMoveEvent(QMouseEvent *e) d->mouseDown = this; } if (d->sloppyRegion.contains(e->pos())) { - d->sloppyAction = action; - QMenuPrivate::sloppyDelayTimer = startTimer(style()->styleHint(QStyle::SH_Menu_SubMenuPopupDelay, 0, this)*6); + // If the timer is already running then don't start a new one unless the action is the same + if (d->sloppyAction != action && QMenuPrivate::sloppyDelayTimer != 0) { + killTimer(QMenuPrivate::sloppyDelayTimer); + QMenuPrivate::sloppyDelayTimer = 0; + } + if (QMenuPrivate::sloppyDelayTimer == 0) { + d->sloppyAction = action; + QMenuPrivate::sloppyDelayTimer = startTimer(style()->styleHint(QStyle::SH_Menu_SubMenuPopupDelay, 0, this) * 6); + } } else if (action != d->currentAction) { d->setCurrentAction(action, style()->styleHint(QStyle::SH_Menu_SubMenuPopupDelay, 0, this)); } -- cgit v1.2.3 From 5236f74942f0df8a74b696f133cbbac763e6950e Mon Sep 17 00:00:00 2001 From: J-P Nurmi Date: Tue, 3 Sep 2013 13:44:34 +0200 Subject: Fix regression in QListView The fix was originally applied to Qt 4.8 (4c64464), but missed Qt 5 which had already been branched at that point of time. Task-number: QTBUG-33089 Task-number: QTBUG-21433 Change-Id: Ia3cd35d29dbdc70ba55b6f0840c4082e232c24ae Reviewed-by: Jens Bache-Wiig --- src/widgets/itemviews/qlistview.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/widgets/itemviews/qlistview.cpp b/src/widgets/itemviews/qlistview.cpp index 8ccb0557cb..3690b15650 100644 --- a/src/widgets/itemviews/qlistview.cpp +++ b/src/widgets/itemviews/qlistview.cpp @@ -1456,7 +1456,7 @@ void QListView::doItemsLayout() void QListView::updateGeometries() { Q_D(QListView); - if (d->model->rowCount(d->root) <= 0 || d->model->columnCount(d->root) <= 0) { + if (geometry().isEmpty() || d->model->rowCount(d->root) <= 0 || d->model->columnCount(d->root) <= 0) { horizontalScrollBar()->setRange(0, 0); verticalScrollBar()->setRange(0, 0); } else { @@ -1471,15 +1471,15 @@ void QListView::updateGeometries() // if the scroll bars are turned off, we resize the contents to the viewport if (d->movement == Static && !d->isWrapping()) { - const QSize maxSize = maximumViewportSize(); + d->layoutChildren(); // we need the viewport size to be updated if (d->flow == TopToBottom) { if (horizontalScrollBarPolicy() == Qt::ScrollBarAlwaysOff) { - d->setContentsSize(maxSize.width(), contentsSize().height()); + d->setContentsSize(viewport()->width(), contentsSize().height()); horizontalScrollBar()->setRange(0, 0); // we see all the contents anyway } } else { // LeftToRight if (verticalScrollBarPolicy() == Qt::ScrollBarAlwaysOff) { - d->setContentsSize(contentsSize().width(), maxSize.height()); + d->setContentsSize(contentsSize().width(), viewport()->height()); verticalScrollBar()->setRange(0, 0); // we see all the contents anyway } } -- cgit v1.2.3 From 86f8bee96b658d1712733477e26e70a1fd723102 Mon Sep 17 00:00:00 2001 From: Shawn Rutledge Date: Tue, 3 Sep 2013 16:25:53 +0200 Subject: OSX: clicking outside a popup: don't propagate the event elsewhere If you click outside a popup window, it only closes the popup; any other widget that was under the cursor at that time should not get the event. The bug was about the popup list on a combobox, but this patch assumes that this rule is universal; can't think of any exceptions at this time. (E.g. a tooltip is not a popup) Clicking on the application menubar still does not close the popup though. Task-number: QTBUG-33241 Change-Id: I2444b7cfd40cf75ff7b70e3fecfeceb2fd4623bf Reviewed-by: Gabriel de Dietrich --- src/plugins/platforms/cocoa/qnsview.mm | 1 + 1 file changed, 1 insertion(+) (limited to 'src') diff --git a/src/plugins/platforms/cocoa/qnsview.mm b/src/plugins/platforms/cocoa/qnsview.mm index 4505f8b8cf..c6dce8b6f6 100644 --- a/src/plugins/platforms/cocoa/qnsview.mm +++ b/src/plugins/platforms/cocoa/qnsview.mm @@ -600,6 +600,7 @@ static QTouchDevice *touchDevice = 0; QWindowSystemInterface::handleCloseEvent(m_platformWindow->m_activePopupWindow); QWindowSystemInterface::flushWindowSystemEvents(); m_platformWindow->m_activePopupWindow = 0; + return; } if ([self hasMarkedText]) { NSInputManager* inputManager = [NSInputManager currentInputManager]; -- cgit v1.2.3 From a2bdda8e3ba324a51620d9e758e444d02c4fd061 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Morten=20Johan=20S=C3=B8rvig?= Date: Fri, 30 Aug 2013 14:20:21 +0200 Subject: Fix event delivery for apps with native widgets. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Native widgets, which have a NSView but not a NSWindow, must be created in the hidden state to prevent Cocoa from selecting them for event delivery. Change-Id: I741e52729047ad4e03959f2244abe5b14b5df46b Reviewed-by: Gabriel de Dietrich Reviewed-by: Morten Johan Sørvig --- src/plugins/platforms/cocoa/qcocoawindow.mm | 1 + 1 file changed, 1 insertion(+) (limited to 'src') diff --git a/src/plugins/platforms/cocoa/qcocoawindow.mm b/src/plugins/platforms/cocoa/qcocoawindow.mm index 86f12e0e5f..a3797682a3 100644 --- a/src/plugins/platforms/cocoa/qcocoawindow.mm +++ b/src/plugins/platforms/cocoa/qcocoawindow.mm @@ -792,6 +792,7 @@ void QCocoaWindow::recreateWindow(const QPlatformWindow *parentWindow) QRect rect = window()->geometry(); NSRect frame = NSMakeRect(rect.x(), rect.y(), rect.width(), rect.height()); [m_contentView setFrame:frame]; + [m_contentView setHidden: YES]; } const qreal opacity = qt_window_private(window())->opacity; -- cgit v1.2.3 From 8fd71914b43350a21c0c05051c1a6e24e9d8cb85 Mon Sep 17 00:00:00 2001 From: Gabriel de Dietrich Date: Tue, 20 Aug 2013 16:55:17 +0200 Subject: Cocoa: Unregister view from window's notifications only MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Otherwise the view will miss its own frame change notifications. And we must unregister from all the notifications during dealloc. This would also reveal a bug where we would expose an NSView before its super view is visible, leading to those "invalid drawable" warnings when using QQuickViews. Therefore, we add this extra check in QCocoaWindow::exposeWindow(). Task-number: QTBUG-32826 Change-Id: I69018cb6f199b242768d114b2aa34c7f2d243196 Reviewed-by: Morten Johan Sørvig --- src/plugins/platforms/cocoa/qcocoawindow.mm | 5 +++-- src/plugins/platforms/cocoa/qnsview.mm | 9 +++------ 2 files changed, 6 insertions(+), 8 deletions(-) (limited to 'src') diff --git a/src/plugins/platforms/cocoa/qcocoawindow.mm b/src/plugins/platforms/cocoa/qcocoawindow.mm index a3797682a3..c239aedb05 100644 --- a/src/plugins/platforms/cocoa/qcocoawindow.mm +++ b/src/plugins/platforms/cocoa/qcocoawindow.mm @@ -911,7 +911,8 @@ void QCocoaWindow::clearNSWindow(NSWindow *window) [window setContentView:nil]; [window setDelegate:nil]; [window clearPlatformWindow]; - [[NSNotificationCenter defaultCenter] removeObserver:m_contentView]; + [[NSNotificationCenter defaultCenter] removeObserver:m_contentView + name:nil object:window]; } // Returns the current global screen geometry for the nswindow associated with this window. @@ -1023,7 +1024,7 @@ qreal QCocoaWindow::devicePixelRatio() const void QCocoaWindow::exposeWindow() { - if (!m_isExposed) { + if (!m_isExposed && ![[m_contentView superview] isHidden]) { m_isExposed = true; QWindowSystemInterface::handleExposeEvent(window(), QRegion(geometry())); } diff --git a/src/plugins/platforms/cocoa/qnsview.mm b/src/plugins/platforms/cocoa/qnsview.mm index c6dce8b6f6..c2ffe96f8c 100644 --- a/src/plugins/platforms/cocoa/qnsview.mm +++ b/src/plugins/platforms/cocoa/qnsview.mm @@ -107,12 +107,9 @@ static QTouchDevice *touchDevice = 0; m_maskImage = 0; m_maskData = 0; m_window = 0; - if (m_subscribesForGlobalFrameNotifications) { - m_subscribesForGlobalFrameNotifications = false; - [[NSNotificationCenter defaultCenter] removeObserver:self - name:NSViewGlobalFrameDidChangeNotification - object:self]; -} + m_subscribesForGlobalFrameNotifications = false; + [[NSNotificationCenter defaultCenter] removeObserver:self]; + delete currentCustomDragTypes; [super dealloc]; -- cgit v1.2.3 From 9554088557571d5c6b96c710424e591ab8db4e0d Mon Sep 17 00:00:00 2001 From: Gabriel de Dietrich Date: Tue, 3 Sep 2013 14:23:33 +0200 Subject: Cocoa: Fix NSMenu popup coordinates MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Those should be in window coordinates (or rather, its content view) not view coordinates. Task-number: QTBUG-32826 Change-Id: I52dddeccf17b359163ad477ce4299b934633b4fa Reviewed-by: Morten Johan Sørvig --- src/plugins/platforms/cocoa/qcocoamenu.mm | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src') diff --git a/src/plugins/platforms/cocoa/qcocoamenu.mm b/src/plugins/platforms/cocoa/qcocoamenu.mm index f9e033d21b..2e53000596 100644 --- a/src/plugins/platforms/cocoa/qcocoamenu.mm +++ b/src/plugins/platforms/cocoa/qcocoamenu.mm @@ -455,7 +455,9 @@ void QCocoaMenu::showPopup(const QWindow *parentWindow, QPoint pos, const QPlatf // Else, we need to transform 'pos' to window or screen coordinates. NSPoint nsPos = NSMakePoint(pos.x() - 1, pos.y()); if (view) { + // Flip y-coordinate first, the convert to content view space. nsPos.y = view.frame.size.height - nsPos.y; + nsPos = [view convertPoint:nsPos toView:view.window.contentView]; } else if (!QGuiApplication::screens().isEmpty()) { QScreen *screen = QGuiApplication::screens().at(0); nsPos.y = screen->availableVirtualSize().height() - nsPos.y; -- cgit v1.2.3 From 5ca5f4d344f6eb644a9b56f8b1ad166582bb8483 Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Thu, 29 Aug 2013 20:43:50 +0200 Subject: build glxconvenience also without Xrender it contains #ifdefs for that, no need to disable it completely. Change-Id: I4a7d03e09fefded966e2c3fec58a470b4f1d3300 Reviewed-by: Giuseppe D'Angelo --- src/platformsupport/glxconvenience/glxconvenience.pri | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/platformsupport/glxconvenience/glxconvenience.pri b/src/platformsupport/glxconvenience/glxconvenience.pri index d325f5adf9..cc5b198f6c 100644 --- a/src/platformsupport/glxconvenience/glxconvenience.pri +++ b/src/platformsupport/glxconvenience/glxconvenience.pri @@ -1,6 +1,7 @@ -contains(QT_CONFIG,xlib):contains(QT_CONFIG,xrender) { +contains(QT_CONFIG, xlib) { contains(QT_CONFIG,opengl):!contains(QT_CONFIG,opengles2) { - LIBS_PRIVATE += $$QMAKE_LIBS_X11 -lXrender + contains(QT_CONFIG, xrender): LIBS_PRIVATE += -lXrender + LIBS_PRIVATE += $$QMAKE_LIBS_X11 HEADERS += $$PWD/qglxconvenience_p.h SOURCES += $$PWD/qglxconvenience.cpp } -- cgit v1.2.3 From ac327aa3af8d934abb1d605541d9b6f8d1cfdc27 Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Thu, 29 Aug 2013 20:45:26 +0200 Subject: the condition for building the x11 offscreen plugin is ... having xlib Task-number: QTBUG-33240 Change-Id: Idc96239b0bcbe98d1519c239600aebcda42e8818 Reviewed-by: Giuseppe D'Angelo --- src/plugins/platforms/offscreen/offscreen.pro | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/plugins/platforms/offscreen/offscreen.pro b/src/plugins/platforms/offscreen/offscreen.pro index 270e3ce228..9f10eaad94 100644 --- a/src/plugins/platforms/offscreen/offscreen.pro +++ b/src/plugins/platforms/offscreen/offscreen.pro @@ -16,7 +16,7 @@ HEADERS = qoffscreenintegration.h \ OTHER_FILES += offscreen.json -contains(QT_CONFIG, xcb):contains(QT_CONFIG, opengl):!contains(QT_CONFIG, opengles2) { +contains(QT_CONFIG, xlib):contains(QT_CONFIG, opengl):!contains(QT_CONFIG, opengles2) { SOURCES += qoffscreenintegration_x11.cpp HEADERS += qoffscreenintegration_x11.h system(echo "Using X11 offscreen integration with GLX") -- cgit v1.2.3 From ba43b70132b661d1b8d99af5258fca3567fe776c Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Thu, 5 Sep 2013 16:59:46 -0700 Subject: Compile in strict-iterator mode under MSVC MSVC doesn't like operator->() returning a pointer to non-aggregate. So we must make sure that the expanded code does not try to call it by doing: abegin->~T(); Instead, we make an implicit call to operator T*() with that static_cast. If abegin is a non-strict iterator, it's already a T*, so the static_cast is a no-op. qvector.h(645) : error C2839: invalid return type 'int *' for overloaded 'operator ->' Change-Id: I06f983bab7677cb60ef3913cdce349e26896bfb6 Reviewed-by: Olivier Goffart --- src/corelib/tools/qvector.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/corelib/tools/qvector.h b/src/corelib/tools/qvector.h index 489ee821b9..4ff2b9f8e0 100644 --- a/src/corelib/tools/qvector.h +++ b/src/corelib/tools/qvector.h @@ -634,7 +634,7 @@ typename QVector::iterator QVector::erase(iterator abegin, iterator aend) iterator moveEnd = d->end(); while (moveBegin != moveEnd) { if (QTypeInfo::isComplex) - abegin->~T(); + static_cast(abegin)->~T(); new (abegin++) T(*moveBegin++); } if (abegin < d->end()) { -- cgit v1.2.3 From 730bc064a070e886e10950ccfd59780e8976f5fd Mon Sep 17 00:00:00 2001 From: Marcel Krems Date: Sat, 31 Aug 2013 16:42:43 +0200 Subject: Forward QGraphicsView::mouseDoubleClickEvent Do the same as in mousePressEvent. Otherwise it is not possible to handle the event in one of the graphics views parents. Task-number: QTBUG-8061 Change-Id: I67c7635361a9ed595c513c28ea016e6253fa2101 Reviewed-by: Andreas Aardal Hanssen --- src/widgets/graphicsview/qgraphicsview.cpp | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'src') diff --git a/src/widgets/graphicsview/qgraphicsview.cpp b/src/widgets/graphicsview/qgraphicsview.cpp index 846858ab31..a39c084798 100644 --- a/src/widgets/graphicsview/qgraphicsview.cpp +++ b/src/widgets/graphicsview/qgraphicsview.cpp @@ -3221,6 +3221,13 @@ void QGraphicsView::mouseDoubleClickEvent(QMouseEvent *event) qt_sendSpontaneousEvent(d->scene, &mouseEvent); else QApplication::sendEvent(d->scene, &mouseEvent); + + // Update the original mouse event accepted state. + const bool isAccepted = mouseEvent.isAccepted(); + event->setAccepted(isAccepted); + + // Update the last mouse event accepted state. + d->lastMouseEvent.setAccepted(isAccepted); } /*! -- cgit v1.2.3