From e9dedb683aaf2474ef202baf56bcaf99e26e7aa7 Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Thu, 17 Mar 2016 16:28:48 +0100 Subject: Remove unused QButtonGroupPrivate::notifyChecked() It wasn't even implemented. Change-Id: I7d4b97b176c90beeffc780c31848ec5b234ba509 Reviewed-by: Olivier Goffart (Woboq GmbH) --- src/widgets/widgets/qbuttongroup_p.h | 1 - 1 file changed, 1 deletion(-) diff --git a/src/widgets/widgets/qbuttongroup_p.h b/src/widgets/widgets/qbuttongroup_p.h index 01c0367876..95a72eb4fd 100644 --- a/src/widgets/widgets/qbuttongroup_p.h +++ b/src/widgets/widgets/qbuttongroup_p.h @@ -67,7 +67,6 @@ public: QList buttonList; QPointer checkedButton; void detectCheckedButton(); - void notifyChecked(QAbstractButton *button); bool exclusive; QHash mapping; -- cgit v1.2.3 From e342a2e05f1e73c1a5cc4d029f9316401d07f3d6 Mon Sep 17 00:00:00 2001 From: Gabriel de Dietrich Date: Thu, 11 Feb 2016 10:37:10 -0800 Subject: Add auto-test for crash in QCocoaBackingStore This issue has been solved some time between 5.6 and 5.6.0. We just make sure to protect against further regressions. Change-Id: Ic3fdad901ed5f36792ae04b3d65047da95eea668 Task-number: QTBUG-50561 Reviewed-by: Friedemann Kleint --- .../kernel/qwidget_window/tst_qwidget_window.cpp | 45 ++++++++++++++++++++++ 1 file changed, 45 insertions(+) diff --git a/tests/auto/widgets/kernel/qwidget_window/tst_qwidget_window.cpp b/tests/auto/widgets/kernel/qwidget_window/tst_qwidget_window.cpp index 58e85d6b58..27be063333 100644 --- a/tests/auto/widgets/kernel/qwidget_window/tst_qwidget_window.cpp +++ b/tests/auto/widgets/kernel/qwidget_window/tst_qwidget_window.cpp @@ -46,6 +46,8 @@ #include #include #include +#include +#include #include static inline void setFrameless(QWidget *w) @@ -99,6 +101,8 @@ private slots: void tst_move_count(); void tst_eventfilter_on_toplevel(); + + void QTBUG_50561_QCocoaBackingStore_paintDevice_crash(); }; void tst_QWidget_window::initTestCase() @@ -795,5 +799,46 @@ void tst_QWidget_window::tst_eventfilter_on_toplevel() QTRY_COMPARE(filter.eventCount, 1); } +class ApplicationStateSaver +{ +public: + ApplicationStateSaver() + { + QApplication::setAttribute(Qt::AA_NativeWindows, true); + QApplication::setQuitOnLastWindowClosed(false); + } + + ~ApplicationStateSaver() + { + QApplication::setAttribute(Qt::AA_NativeWindows, false); + QApplication::setQuitOnLastWindowClosed(true); + } +}; + +void tst_QWidget_window::QTBUG_50561_QCocoaBackingStore_paintDevice_crash() +{ + // Keep application state clean if testcase fails + ApplicationStateSaver as; + + QMainWindow w; + w.addToolBar(new QToolBar(&w)); + w.show(); + QTest::qWaitForWindowExposed(&w); + + // Simulate window system close + QCloseEvent *e = new QCloseEvent; + e->accept(); + qApp->postEvent(w.windowHandle(), e); + qApp->processEvents(); + + // Show again + w.show(); + qApp->processEvents(); + + // No crash, all good. + // Wrap up and leave + w.close(); +} + QTEST_MAIN(tst_QWidget_window) #include "tst_qwidget_window.moc" -- cgit v1.2.3 From c81db142971ebde5d439acf9e205085f8714f0d5 Mon Sep 17 00:00:00 2001 From: BogDan Vatra Date: Thu, 17 Mar 2016 09:46:46 +0200 Subject: QNX has no libdl, but all the functions are in libc Change-Id: I3f4b32eb8bbc0a35e817399516daa02de358575d Reviewed-by: Lars Knoll Reviewed-by: Oswald Buddenhagen Reviewed-by: Rafael Roquetto --- config.tests/unix/libdl/libdl.pro | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config.tests/unix/libdl/libdl.pro b/config.tests/unix/libdl/libdl.pro index 00d4c47c6c..8ed5231a8f 100644 --- a/config.tests/unix/libdl/libdl.pro +++ b/config.tests/unix/libdl/libdl.pro @@ -1,3 +1,3 @@ SOURCES = libdl.cpp CONFIG -= qt dylib -LIBS += -ldl +!qnx: LIBS += -ldl -- cgit v1.2.3 From bc913ea452b2b23ab54dfbfc29567b9e9d8760ac Mon Sep 17 00:00:00 2001 From: Andreas Holzammer Date: Mon, 21 Mar 2016 10:15:04 +0100 Subject: wince: Adjust configure defaults Remove outdated configure defaults to support features that get autodetected. Change-Id: Ia802ccd3fe9defa97e2667e81dff6e815a7b45b3 Reviewed-by: Kevin Funk Reviewed-by: Andreas Holzammer --- tools/configure/configureapp.cpp | 9 --------- 1 file changed, 9 deletions(-) diff --git a/tools/configure/configureapp.cpp b/tools/configure/configureapp.cpp index f63892b6cc..ea30ce6b17 100644 --- a/tools/configure/configureapp.cpp +++ b/tools/configure/configureapp.cpp @@ -1709,15 +1709,6 @@ void Configure::applySpecSpecifics() dictionary[ "STYLE_FUSION" ] = "no"; dictionary[ "STYLE_WINDOWSCE" ] = "yes"; dictionary[ "STYLE_WINDOWSMOBILE" ] = "yes"; - dictionary[ "OPENGL" ] = "no"; - dictionary[ "RTTI" ] = "no"; - dictionary[ "SSE2" ] = "no"; - dictionary[ "SSE3" ] = "no"; - dictionary[ "SSSE3" ] = "no"; - dictionary[ "SSE4_1" ] = "no"; - dictionary[ "SSE4_2" ] = "no"; - dictionary[ "AVX" ] = "no"; - dictionary[ "AVX2" ] = "no"; dictionary[ "CE_CRT" ] = "yes"; dictionary[ "LARGE_FILE" ] = "no"; dictionary[ "ANGLE" ] = "no"; -- cgit v1.2.3 From 51e71d411156054d291d88cdd4690f48f7710d43 Mon Sep 17 00:00:00 2001 From: BogDan Vatra Date: Mon, 21 Mar 2016 11:33:19 +0200 Subject: Android: Fix inputItemRectangle when using EnableHighDpiScaling When EnableHighDpiScaling is enabled, qGuiApp->inputMethod()- >inputItemRectangle() returns the position divided by pixel density, therefore all the controls positions must by multiplied by pixel density to translate them into screen coordinates. Task-number: QTBUG-52001 Change-Id: Iea92a912cfbab03a9497fc8cddc24bebd0db2192 Reviewed-by: Eskil Abrahamsen Blomfeldt --- src/plugins/platforms/android/qandroidinputcontext.cpp | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/src/plugins/platforms/android/qandroidinputcontext.cpp b/src/plugins/platforms/android/qandroidinputcontext.cpp index 0eddb26959..f3ece3208e 100644 --- a/src/plugins/platforms/android/qandroidinputcontext.cpp +++ b/src/plugins/platforms/android/qandroidinputcontext.cpp @@ -39,6 +39,7 @@ #include "androidjniinput.h" #include "qandroideventdispatcher.h" #include "androiddeadlockprotector.h" +#include "qandroidplatformintegration.h" #include #include #include @@ -47,6 +48,7 @@ #include #include #include +#include #include @@ -541,10 +543,13 @@ void QAndroidInputContext::showInputPanel() if (window) rect = QRect(window->mapToGlobal(rect.topLeft()), rect.size()); - QtAndroidInput::showSoftwareKeyboard(rect.left(), - rect.top(), - rect.width(), - rect.height(), + double pixelDensity = window ? QHighDpiScaling::factor(window) + : QHighDpiScaling::factor(QtAndroid::androidPlatformIntegration()->screen()); + + QtAndroidInput::showSoftwareKeyboard(rect.left() * pixelDensity, + rect.top() * pixelDensity, + rect.width() * pixelDensity, + rect.height() * pixelDensity, query->value(Qt::ImHints).toUInt(), query->value(Qt::ImEnterKeyType).toUInt() ); -- cgit v1.2.3 From 3d20e2e8d7bd325f17e64450b9c66c0f0a91fac6 Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Fri, 18 Mar 2016 16:27:51 +0100 Subject: fix bad initializer for -optimized-tools Task-number: QTBUG-51967 Change-Id: I5b4a3f0ff6358149bc338c6ac2e0b57638bdff7f Reviewed-by: Joerg Bornemann --- tools/configure/configureapp.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/configure/configureapp.cpp b/tools/configure/configureapp.cpp index ea30ce6b17..418426b027 100644 --- a/tools/configure/configureapp.cpp +++ b/tools/configure/configureapp.cpp @@ -230,7 +230,7 @@ Configure::Configure(int& argc, char** argv) : verbose(0) dictionary[ "BUILD" ] = "debug"; dictionary[ "BUILDALL" ] = "auto"; // Means yes, but not explicitly dictionary[ "FORCEDEBUGINFO" ] = "no"; - dictionary[ "OPTIMIZED_TOOLS" ] = "no"; + dictionary[ "RELEASE_TOOLS" ] = "no"; dictionary[ "BUILDTYPE" ] = "none"; -- cgit v1.2.3 From c228e01e1212a2ecd64d475980be04fc7b825bea Mon Sep 17 00:00:00 2001 From: "M. Moellney" Date: Sun, 20 Mar 2016 17:54:02 +0100 Subject: Docs of qSetMessagePattern missing relation to qCDebug and co. The documentation of qSetMessagePattern was missing links to qInfo() and the category logging siblings: qCDebug, qCInfo, qCWarning, and qCCritical. This patch adds the links and adds a link to QLoggingCatergory class. Task-number: QTBUG-51943 Change-Id: I85c1a205bfcd555cb0516f8cbdd157d8f20185b4 Reviewed-by: Kai Koehne Reviewed-by: Martin Smith --- src/corelib/global/qlogging.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/corelib/global/qlogging.cpp b/src/corelib/global/qlogging.cpp index e341b3ecfd..dcac9a16a4 100644 --- a/src/corelib/global/qlogging.cpp +++ b/src/corelib/global/qlogging.cpp @@ -1736,7 +1736,9 @@ void qErrnoWarning(int code, const char *msg, ...) \brief Changes the output of the default message handler. - Allows to tweak the output of qDebug(), qWarning(), qCritical() and qFatal(). + Allows to tweak the output of qDebug(), qInfo(), qWarning(), qCritical(), + and qFatal(). The category logging output of qCDebug(), qCInfo(), + qCWarning(), and qCCritical() is formatted, too. Following placeholders are supported: @@ -1789,7 +1791,7 @@ void qErrnoWarning(int code, const char *msg, ...) Custom message handlers can use qFormatLogMessage() to take \a pattern into account. - \sa qInstallMessageHandler(), {Debugging Techniques} + \sa qInstallMessageHandler(), {Debugging Techniques}, {QLoggingCategory} */ QtMessageHandler qInstallMessageHandler(QtMessageHandler h) -- cgit v1.2.3 From 56384a854aeaa5d3275c158c80a07082949468da Mon Sep 17 00:00:00 2001 From: Gabriel de Dietrich Date: Fri, 18 Mar 2016 13:22:19 -0700 Subject: QCocoaMenus: Use mix-in pattern to implement menu hierarchy MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit To solve menu item roles from their text, we need to find its depth in the menubar hierarchy. Unfortunately, there's no trivial way to access that hierarchy from the QPA side, so we need to come with an ad-hoc solution. Previously, we were using a dynamic proprety to keep track of the 'parent' object. However, as the life span of the different objects has changed since 09acf326dbc6b7b67f21a36, we need a way to keep track of the parent's existence. This is what we do in this patch by having both QCocoaMenu and QCocoaMenuItem also inherit QCocoaMenuObject. This class' sole role is to store the menu hierarchy's parent object and wrap it in a QPointer. Change-Id: Ia18d95171af76d26f6325eef04c77b40d99c4285 Reviewed-by: Morten Johan Sørvig Reviewed-by: J-P Nurmi Reviewed-by: Timur Pocheptsov --- src/plugins/platforms/cocoa/qcocoamenu.h | 2 +- src/plugins/platforms/cocoa/qcocoamenu.mm | 10 +++++----- src/plugins/platforms/cocoa/qcocoamenubar.mm | 2 +- src/plugins/platforms/cocoa/qcocoamenuitem.h | 22 ++++++++++++++++++---- src/plugins/platforms/cocoa/qcocoamenuitem.mm | 16 +++++++++------- 5 files changed, 34 insertions(+), 18 deletions(-) diff --git a/src/plugins/platforms/cocoa/qcocoamenu.h b/src/plugins/platforms/cocoa/qcocoamenu.h index 5064d89585..c975de166d 100644 --- a/src/plugins/platforms/cocoa/qcocoamenu.h +++ b/src/plugins/platforms/cocoa/qcocoamenu.h @@ -43,7 +43,7 @@ QT_BEGIN_NAMESPACE class QCocoaMenuBar; -class QCocoaMenu : public QPlatformMenu +class QCocoaMenu : public QPlatformMenu, public QCocoaMenuObject { public: QCocoaMenu(); diff --git a/src/plugins/platforms/cocoa/qcocoamenu.mm b/src/plugins/platforms/cocoa/qcocoamenu.mm index 21a3799859..6ed7aa0e06 100644 --- a/src/plugins/platforms/cocoa/qcocoamenu.mm +++ b/src/plugins/platforms/cocoa/qcocoamenu.mm @@ -265,8 +265,8 @@ QCocoaMenu::QCocoaMenu() : QCocoaMenu::~QCocoaMenu() { foreach (QCocoaMenuItem *item, m_menuItems) { - if (COCOA_MENU_ANCESTOR(item) == this) - SET_COCOA_MENU_ANCESTOR(item, 0); + if (item->menuParent() == this) + item->setMenuParent(0); } QMacAutoReleasePool pool; @@ -344,7 +344,7 @@ void QCocoaMenu::insertNative(QCocoaMenuItem *item, QCocoaMenuItem *beforeItem) } else { [m_nativeMenu addItem: item->nsItem()]; } - SET_COCOA_MENU_ANCESTOR(item, this); + item->setMenuParent(this); } void QCocoaMenu::removeMenuItem(QPlatformMenuItem *menuItem) @@ -356,8 +356,8 @@ void QCocoaMenu::removeMenuItem(QPlatformMenuItem *menuItem) return; } - if (COCOA_MENU_ANCESTOR(menuItem) == this) - SET_COCOA_MENU_ANCESTOR(menuItem, 0); + if (cocoaItem->menuParent() == this) + cocoaItem->setMenuParent(0); m_menuItems.removeOne(cocoaItem); if (!cocoaItem->isMerged()) { diff --git a/src/plugins/platforms/cocoa/qcocoamenubar.mm b/src/plugins/platforms/cocoa/qcocoamenubar.mm index ac4d29fc52..ac48a0e310 100644 --- a/src/plugins/platforms/cocoa/qcocoamenubar.mm +++ b/src/plugins/platforms/cocoa/qcocoamenubar.mm @@ -314,7 +314,7 @@ void QCocoaMenuBar::updateMenuBarImmediately() continue; NSMenuItem *item = mb->nativeItemForMenu(menu); menu->setAttachedItem(item); - SET_COCOA_MENU_ANCESTOR(menu, mb); + menu->setMenuParent(mb); // force a sync? mb->syncMenu(menu); menu->syncModalState(disableForModal); diff --git a/src/plugins/platforms/cocoa/qcocoamenuitem.h b/src/plugins/platforms/cocoa/qcocoamenuitem.h index ada4b13df1..5f7215596c 100644 --- a/src/plugins/platforms/cocoa/qcocoamenuitem.h +++ b/src/plugins/platforms/cocoa/qcocoamenuitem.h @@ -49,7 +49,24 @@ QT_BEGIN_NAMESPACE class QCocoaMenu; -class QCocoaMenuItem : public QPlatformMenuItem +class QCocoaMenuObject +{ +public: + void setMenuParent(QObject *o) + { + parent = o; + } + + QObject *menuParent() const + { + return parent; + } + +private: + QPointer parent; +}; + +class QCocoaMenuItem : public QPlatformMenuItem, public QCocoaMenuObject { public: QCocoaMenuItem(); @@ -112,9 +129,6 @@ private: int m_iconSize; }; -#define COCOA_MENU_ANCESTOR(m) ((m)->property("_qCocoaMenuAncestor").value()) -#define SET_COCOA_MENU_ANCESTOR(m, ancestor) (m)->setProperty("_qCocoaMenuAncestor", QVariant::fromValue(ancestor)) - QT_END_NAMESPACE #endif diff --git a/src/plugins/platforms/cocoa/qcocoamenuitem.mm b/src/plugins/platforms/cocoa/qcocoamenuitem.mm index e274448620..0f422843e0 100644 --- a/src/plugins/platforms/cocoa/qcocoamenuitem.mm +++ b/src/plugins/platforms/cocoa/qcocoamenuitem.mm @@ -105,8 +105,8 @@ QCocoaMenuItem::~QCocoaMenuItem() { QMacAutoReleasePool pool; - if (m_menu && COCOA_MENU_ANCESTOR(m_menu) == this) - SET_COCOA_MENU_ANCESTOR(m_menu, 0); + if (m_menu && m_menu->menuParent() == this) + m_menu->setMenuParent(0); if (m_merged) { [m_native setHidden:YES]; } else { @@ -132,14 +132,14 @@ void QCocoaMenuItem::setMenu(QPlatformMenu *menu) return; if (m_menu) { - if (COCOA_MENU_ANCESTOR(m_menu) == this) - SET_COCOA_MENU_ANCESTOR(m_menu, 0); + if (m_menu->menuParent() == this) + m_menu->setMenuParent(0); } QMacAutoReleasePool pool; m_menu = static_cast(menu); if (m_menu) { - SET_COCOA_MENU_ANCESTOR(m_menu, this); + m_menu->setMenuParent(this); } else { // we previously had a menu, but no longer // clear out our item so the nexy sync() call builds a new one @@ -229,12 +229,14 @@ NSMenuItem *QCocoaMenuItem::sync() mergeItem = [loader preferencesMenuItem]; break; case TextHeuristicRole: { - QObject *p = COCOA_MENU_ANCESTOR(this); + QObject *p = menuParent(); int depth = 1; QCocoaMenuBar *menubar = 0; while (depth < 3 && p && !(menubar = qobject_cast(p))) { ++depth; - p = COCOA_MENU_ANCESTOR(p); + QCocoaMenuObject *menuObject = dynamic_cast(p); + Q_ASSERT(menuObject); + p = menuObject->menuParent(); } if (depth == 3 || !menubar) break; // Menu item too deep in the hierarchy, or not connected to any menubar -- cgit v1.2.3 From a125b2c4c744b8f5b9136170db66840eeaf1f278 Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Mon, 13 Jul 2015 00:39:52 +0200 Subject: QVersionNumber: compile with -Wzero-as-null-pointer-constant (backport of qtbase/f43885f8d14e045e5ec47857d62a140d99d16cfa) Change-Id: I9735c04d90353372cf9b32828ed839f80c31a88a Reviewed-by: Olivier Goffart (Woboq GmbH) --- src/corelib/tools/qversionnumber.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/corelib/tools/qversionnumber.h b/src/corelib/tools/qversionnumber.h index ebf1844f38..6a2718ca28 100644 --- a/src/corelib/tools/qversionnumber.h +++ b/src/corelib/tools/qversionnumber.h @@ -273,7 +273,7 @@ public: Q_CORE_EXPORT static Q_DECL_PURE_FUNCTION QVersionNumber commonPrefix(const QVersionNumber &v1, const QVersionNumber &v2) Q_REQUIRED_RESULT; Q_CORE_EXPORT QString toString() const Q_REQUIRED_RESULT; - Q_CORE_EXPORT static Q_DECL_PURE_FUNCTION QVersionNumber fromString(const QString &string, int *suffixIndex = 0) Q_REQUIRED_RESULT; + Q_CORE_EXPORT static Q_DECL_PURE_FUNCTION QVersionNumber fromString(const QString &string, int *suffixIndex = Q_NULLPTR) Q_REQUIRED_RESULT; private: #ifndef QT_NO_DATASTREAM -- cgit v1.2.3 From b657496a0ba326af0688e9935069139c002849cf Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Tue, 16 Feb 2016 12:41:11 +0100 Subject: QLineEdit: Use High DPI pixmap for clear button. Add a 32x32-pixmap to the style and factor out a function from QStyle::standardIcon() to assemble the icon. The 32x32 pixmap may also be used for the 16x16 case with devicePixelRatio=2. Change QLineEditIconButton to use QStyle::standardIcon() instead of QStyle::standardPixmap passing the QWindow to obtain the correct pixmap from the icon. Task-number: QTBUG-49374 Change-Id: I9895230f66911752cc13b7212609141610df0977 Reviewed-by: Giuseppe D'Angelo --- src/widgets/styles/images/cleartext-32.png | Bin 0 -> 410 bytes src/widgets/styles/qcommonstyle.cpp | 40 ++++++++++++++++++++++------- src/widgets/styles/qstyle.qrc | 1 + src/widgets/widgets/qlineedit_p.cpp | 11 +++++--- 4 files changed, 39 insertions(+), 13 deletions(-) create mode 100644 src/widgets/styles/images/cleartext-32.png diff --git a/src/widgets/styles/images/cleartext-32.png b/src/widgets/styles/images/cleartext-32.png new file mode 100644 index 0000000000..ff5a2b5ec1 Binary files /dev/null and b/src/widgets/styles/images/cleartext-32.png differ diff --git a/src/widgets/styles/qcommonstyle.cpp b/src/widgets/styles/qcommonstyle.cpp index 355a3d2c3f..748cef20c1 100644 --- a/src/widgets/styles/qcommonstyle.cpp +++ b/src/widgets/styles/qcommonstyle.cpp @@ -5198,6 +5198,30 @@ static QPixmap cachedPixmapFromXPM(const char * const *xpm) return result; } +static QIcon clearTextIcon(bool rtl) +{ + const QString directionalThemeName = rtl + ? QStringLiteral("edit-clear-locationbar-ltr") : QStringLiteral("edit-clear-locationbar-rtl"); + if (QIcon::hasThemeIcon(directionalThemeName)) + return QIcon::fromTheme(directionalThemeName); + const QString themeName = QStringLiteral("edit-clear"); + if (QIcon::hasThemeIcon(themeName)) + return QIcon::fromTheme(themeName); + + QIcon icon; +#ifndef QT_NO_IMAGEFORMAT_PNG + QPixmap clearText16(QStringLiteral(":/qt-project.org/styles/commonstyle/images/cleartext-16.png")); + Q_ASSERT(!clearText16.size().isEmpty()); + icon.addPixmap(clearText16); + QPixmap clearText32(QStringLiteral(":/qt-project.org/styles/commonstyle/images/cleartext-32.png")); + Q_ASSERT(!clearText32.size().isEmpty()); + icon.addPixmap(clearText32); + clearText32.setDevicePixelRatio(2); // The 32x32 pixmap can also be used for 16x16/devicePixelRatio=2 + icon.addPixmap(clearText32); +#endif // !QT_NO_IMAGEFORMAT_PNG + return icon; +} + /*! \reimp */ QPixmap QCommonStyle::standardPixmap(StandardPixmap sp, const QStyleOption *option, const QWidget *widget) const @@ -5370,12 +5394,8 @@ QPixmap QCommonStyle::standardPixmap(StandardPixmap sp, const QStyleOption *opti } } break; - case SP_LineEditClearButton: { - QString themeName = rtl ? QStringLiteral("edit-clear-locationbar-ltr") : QStringLiteral("edit-clear-locationbar-rtl"); - if (!QIcon::hasThemeIcon(themeName)) - themeName = QStringLiteral("edit-clear"); - pixmap = QIcon::fromTheme(themeName).pixmap(16); - } + case SP_LineEditClearButton: + pixmap = clearTextIcon(rtl).pixmap(16); break; default: break; @@ -5505,8 +5525,6 @@ QPixmap QCommonStyle::standardPixmap(StandardPixmap sp, const QStyleOption *opti return QPixmap(QLatin1String(":/qt-project.org/styles/commonstyle/images/media-volume-16.png")); case SP_MediaVolumeMuted: return QPixmap(QLatin1String(":/qt-project.org/styles/commonstyle/images/media-volume-muted-16.png")); - case SP_LineEditClearButton: - return QPixmap(QStringLiteral(":/qt-project.org/styles/commonstyle/images/cleartext-16.png")); #endif // QT_NO_IMAGEFORMAT_PNG default: break; @@ -5556,6 +5574,8 @@ QIcon QCommonStyle::standardIcon(StandardPixmap standardIcon, const QStyleOption const QWidget *widget) const { QIcon icon; + const bool rtl = (option && option->direction == Qt::RightToLeft) || (!option && QApplication::isRightToLeft()); + #ifdef Q_OS_WIN switch (standardIcon) { case SP_DriveCDIcon: @@ -5597,6 +5617,9 @@ QIcon QCommonStyle::standardIcon(StandardPixmap standardIcon, const QStyleOption icon.addPixmap(pixmap); } break; + case SP_LineEditClearButton: + icon = clearTextIcon(rtl); + break; default: break; } @@ -5605,7 +5628,6 @@ QIcon QCommonStyle::standardIcon(StandardPixmap standardIcon, const QStyleOption #endif - const bool rtl = (option && option->direction == Qt::RightToLeft) || (!option && QApplication::isRightToLeft()); if (QApplication::desktopSettingsAware() && !QIcon::themeName().isEmpty()) { switch (standardIcon) { case SP_DirHomeIcon: diff --git a/src/widgets/styles/qstyle.qrc b/src/widgets/styles/qstyle.qrc index c063ec5036..d8c73dd6fa 100644 --- a/src/widgets/styles/qstyle.qrc +++ b/src/widgets/styles/qstyle.qrc @@ -1,6 +1,7 @@ images/cleartext-16.png + images/cleartext-32.png images/filelink-16.png images/filelink-32.png images/filelink-128.png diff --git a/src/widgets/widgets/qlineedit_p.cpp b/src/widgets/widgets/qlineedit_p.cpp index ff4d0fec47..ff80c45c9a 100644 --- a/src/widgets/widgets/qlineedit_p.cpp +++ b/src/widgets/widgets/qlineedit_p.cpp @@ -317,14 +317,17 @@ QLineEditIconButton::QLineEditIconButton(QWidget *parent) void QLineEditIconButton::paintEvent(QPaintEvent *) { QPainter painter(this); + QWindow *window = Q_NULLPTR; + if (const QWidget *nativeParent = nativeParentWidget()) + window = nativeParent->windowHandle(); // Note isDown should really use the active state but in most styles // this has no proper feedback QIcon::Mode state = QIcon::Disabled; if (isEnabled()) state = isDown() ? QIcon::Selected : QIcon::Normal; - const QPixmap iconPixmap = icon().pixmap(QSize(IconButtonSize, IconButtonSize), - state, QIcon::Off); - QRect pixmapRect = QRect(QPoint(0, 0), iconPixmap.size() / iconPixmap.devicePixelRatio()); + const QSize iconSize(IconButtonSize, IconButtonSize); + const QPixmap iconPixmap = icon().pixmap(window, iconSize, state, QIcon::Off); + QRect pixmapRect = QRect(QPoint(0, 0), iconSize); pixmapRect.moveCenter(rect().center()); painter.setOpacity(m_opacity); painter.drawPixmap(pixmapRect, iconPixmap); @@ -416,7 +419,7 @@ QIcon QLineEditPrivate::clearButtonIcon() const Q_Q(const QLineEdit); QStyleOptionFrame styleOption; q->initStyleOption(&styleOption); - return QIcon(q->style()->standardPixmap(QStyle::SP_LineEditClearButton, &styleOption, q)); + return q->style()->standardIcon(QStyle::SP_LineEditClearButton, &styleOption, q); } void QLineEditPrivate::setClearButtonEnabled(bool enabled) -- cgit v1.2.3 From c599e7db7e180f35f3e068b5a2af9ceba9f1afb1 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Mon, 21 Mar 2016 10:08:02 +0100 Subject: win32-icc: Make it possible to rename the ANGLE libraries. Adapt the mkspec which was forgotten in change b0ec05f27bff6065c97e6e4a0f1606da7472d18c. Task-number: QTBUG-48431 Task-number: QTBUG-51686 Change-Id: Ie95e650de8b7a7027979ec637fb77c7f0357a598 Reviewed-by: Oliver Wolff Reviewed-by: Oswald Buddenhagen --- mkspecs/win32-icc/qmake.conf | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/mkspecs/win32-icc/qmake.conf b/mkspecs/win32-icc/qmake.conf index 3b440d143f..9fa2fb88a1 100644 --- a/mkspecs/win32-icc/qmake.conf +++ b/mkspecs/win32-icc/qmake.conf @@ -4,6 +4,8 @@ # Written for Intel C++ # +include(../common/angle.conf) + MAKEFILE_GENERATOR = MSVC.NET QMAKE_PLATFORM = win32 CONFIG += incremental flat debug_and_release debug_and_release_target @@ -80,6 +82,8 @@ QMAKE_LIBS_CORE = kernel32.lib user32.lib shell32.lib uuid.lib ole32.lib QMAKE_LIBS_GUI = gdi32.lib comdlg32.lib oleaut32.lib imm32.lib winmm.lib ws2_32.lib ole32.lib user32.lib advapi32.lib QMAKE_LIBS_NETWORK = ws2_32.lib QMAKE_LIBS_OPENGL = glu32.lib opengl32.lib gdi32.lib user32.lib delayimp.lib +QMAKE_LIBS_OPENGL_ES2 = $${LIBEGL_NAME}.lib $${LIBGLESV2_NAME}.lib gdi32.lib user32.lib +QMAKE_LIBS_OPENGL_ES2_DEBUG = $${LIBEGL_NAME}d.lib $${LIBGLESV2_NAME}d.lib gdi32.lib user32.lib QMAKE_LIBS_COMPAT = advapi32.lib shell32.lib comdlg32.lib user32.lib gdi32.lib ws2_32.lib QMAKE_LIBS_QT_ENTRY = -lqtmain -- cgit v1.2.3 From be5e9247e9e986a40b3661178a05bedfe10acde8 Mon Sep 17 00:00:00 2001 From: J-P Nurmi Date: Tue, 22 Mar 2016 08:16:21 +0100 Subject: qshapedpixmapdndwindow.cpp: fix build with '-qreal float' Change-Id: I57a0c8cd7cd10f122dfe81e25c14f141b6f81d57 Reviewed-by: Shawn Rutledge Reviewed-by: Friedemann Kleint --- src/gui/kernel/qshapedpixmapdndwindow.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gui/kernel/qshapedpixmapdndwindow.cpp b/src/gui/kernel/qshapedpixmapdndwindow.cpp index 850987ac1d..7764dfc0a3 100644 --- a/src/gui/kernel/qshapedpixmapdndwindow.cpp +++ b/src/gui/kernel/qshapedpixmapdndwindow.cpp @@ -91,7 +91,7 @@ void QShapedPixmapWindow::updateGeometry(const QPoint &pos) { QSize size(1, 1); if (!m_pixmap.isNull()) { - size = qFuzzyCompare(m_pixmap.devicePixelRatio(), 1.0) + size = qFuzzyCompare(m_pixmap.devicePixelRatio(), qreal(1.0)) ? m_pixmap.size() : (QSizeF(m_pixmap.size()) / m_pixmap.devicePixelRatio()).toSize(); } -- cgit v1.2.3 From dfb9b9e1f7ff723bbb082875962ddcf0d69d1db2 Mon Sep 17 00:00:00 2001 From: David Schulz Date: Fri, 18 Mar 2016 12:30:33 +0100 Subject: configure: enable QSharedMemory when targeting windows. Change-Id: Ib20e7bab80c2207c50cc221eba5eae996a805242 Reviewed-by: hjk Reviewed-by: Oswald Buddenhagen --- configure | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configure b/configure index 203155c819..8d7772ac5b 100755 --- a/configure +++ b/configure @@ -4580,7 +4580,7 @@ if ! compileTest unix/ipc_sysv "ipc_sysv" ; then if compileTest unix/ipc_posix "ipc_posix" ; then QCONFIG_FLAGS="$QCONFIG_FLAGS QT_POSIX_IPC" else - if [ "$XPLATFORM_ANDROID" = "no" ] ; then + if [ "$XPLATFORM_ANDROID" = "no" ] && [ "$XPLATFORM_MINGW" = "no" ] ; then QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_SYSTEMSEMAPHORE QT_NO_SHAREDMEMORY" fi fi -- cgit v1.2.3 From f8d790f086c2531f5437023a8188b4b4f07f6c31 Mon Sep 17 00:00:00 2001 From: Andreas Holzammer Date: Tue, 22 Mar 2016 07:28:38 +0100 Subject: qmake: Fix wince dll deployment in Visual Studio This fix repairs the mechanism to deploy Qt dlls as well as C++ runtime to a wince target in Visual Studio. Do this by adding a deploy section in the Visual Studio solution and adding the C++ runtime from the mkspec to the files deployed to the target. Deploy target path is set to what the wizard of Visual Studio defaults to. Before, the c++ runtime was only deployed for executables which were built as part of Qt. Task-number: QTBUG-50924 Change-Id: I478010dc16e35c68578281895aa3ae14b5c96bb4 Reviewed-by: Maurice Kalinowski --- qmake/generators/win32/msvc_vcproj.cpp | 7 +++++++ tools/configure/configureapp.cpp | 8 +++++--- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/qmake/generators/win32/msvc_vcproj.cpp b/qmake/generators/win32/msvc_vcproj.cpp index 52d84e8bce..73c9f397e5 100644 --- a/qmake/generators/win32/msvc_vcproj.cpp +++ b/qmake/generators/win32/msvc_vcproj.cpp @@ -187,8 +187,10 @@ const char _slnProjDepEnd[] = "\n\tEndProjectSection"; const char _slnProjConfBeg[] = "\n\tGlobalSection(ProjectConfigurationPlatforms) = postSolution"; const char _slnProjRelConfTag1[]= ".Release|%1.ActiveCfg = Release|"; const char _slnProjRelConfTag2[]= ".Release|%1.Build.0 = Release|"; +const char _slnProjRelConfTag3[]= ".Release|%1.Deploy.0 = Release|"; const char _slnProjDbgConfTag1[]= ".Debug|%1.ActiveCfg = Debug|"; const char _slnProjDbgConfTag2[]= ".Debug|%1.Build.0 = Debug|"; +const char _slnProjDbgConfTag3[]= ".Debug|%1.Deploy.0 = Debug|"; const char _slnProjConfEnd[] = "\n\tEndGlobalSection"; const char _slnExtSections[] = "\n\tGlobalSection(ExtensibilityGlobals) = postSolution" "\n\tEndGlobalSection" @@ -729,8 +731,12 @@ void VcprojGenerator::writeSubDirs(QTextStream &t) platform = xplatform; t << "\n\t\t" << (*it)->uuid << QString(_slnProjDbgConfTag1).arg(xplatform) << platform; t << "\n\t\t" << (*it)->uuid << QString(_slnProjDbgConfTag2).arg(xplatform) << platform; + if (!project->isEmpty("CE_SDK") && !project->isEmpty("CE_ARCH")) + t << "\n\t\t" << (*it)->uuid << QString(_slnProjDbgConfTag3).arg(xplatform) << platform; t << "\n\t\t" << (*it)->uuid << QString(_slnProjRelConfTag1).arg(xplatform) << platform; t << "\n\t\t" << (*it)->uuid << QString(_slnProjRelConfTag2).arg(xplatform) << platform; + if (!project->isEmpty("CE_SDK") && !project->isEmpty("CE_ARCH")) + t << "\n\t\t" << (*it)->uuid << QString(_slnProjRelConfTag3).arg(xplatform) << platform; } t << _slnProjConfEnd; t << _slnExtSections; @@ -1269,6 +1275,7 @@ void VcprojGenerator::initDeploymentTool() targetPath = QString("%CSIDL_PROGRAM_FILES%\\") + project->first("TARGET"); if (targetPath.endsWith("/") || targetPath.endsWith("\\")) targetPath.chop(1); + conf.deployment.RemoteDirectory = targetPath; } ProStringList dllPaths = project->values("QMAKE_DLL_PATHS"); // Only deploy Qt libs for shared build diff --git a/tools/configure/configureapp.cpp b/tools/configure/configureapp.cpp index 418426b027..b599df45e3 100644 --- a/tools/configure/configureapp.cpp +++ b/tools/configure/configureapp.cpp @@ -3176,9 +3176,6 @@ void Configure::generateCachefile() moduleStream << "QT_CE_RAPI_LIB = " << formatPath(dictionary["QT_CE_RAPI_LIB"]) << endl; } - moduleStream << "#Qt for Windows CE c-runtime deployment" << endl - << "QT_CE_C_RUNTIME = " << formatPath(dictionary["CE_CRT"]) << endl; - if (dictionary["CE_SIGNATURE"] != QLatin1String("no")) moduleStream << "DEFAULT_SIGNATURE=" << dictionary["CE_SIGNATURE"] << endl; @@ -3594,6 +3591,11 @@ void Configure::generateQConfigPri() << "QT_GCC_PATCH_VERSION = " << dictionary["QT_GCC_PATCH_VERSION"] << endl; } + if (dictionary.value("XQMAKESPEC").startsWith("wince")) { + configStream << "#Qt for Windows CE c-runtime deployment" << endl + << "QT_CE_C_RUNTIME = " << formatPath(dictionary["CE_CRT"]) << endl; + } + if (!configStream.flush()) dictionary[ "DONE" ] = "error"; } -- cgit v1.2.3 From 8fd96d78f0597fddda0d04fef5fc8c7acb3b468e Mon Sep 17 00:00:00 2001 From: Andreas Holzammer Date: Mon, 21 Mar 2016 08:42:11 +0100 Subject: qmake/wince: Deploy QPA plugin as well in Visual Studio Change-Id: Ia936290ddb61a85be18d903b64d4b11c709b0732 Reviewed-by: Maurice Kalinowski --- qmake/generators/win32/msvc_vcproj.cpp | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/qmake/generators/win32/msvc_vcproj.cpp b/qmake/generators/win32/msvc_vcproj.cpp index 73c9f397e5..6206b2c8f1 100644 --- a/qmake/generators/win32/msvc_vcproj.cpp +++ b/qmake/generators/win32/msvc_vcproj.cpp @@ -1283,6 +1283,7 @@ void VcprojGenerator::initDeploymentTool() !(conf.WinRT && project->first("MSVC_VER").toQString() == "14.0")) { // FIXME: This code should actually resolve the libraries from all Qt modules. ProStringList arg = project->values("QMAKE_LIBS") + project->values("QMAKE_LIBS_PRIVATE"); + bool qpaPluginDeployed = false; for (ProStringList::ConstIterator it = arg.constBegin(); it != arg.constEnd(); ++it) { QString dllName = (*it).toQString(); dllName.replace(QLatin1Char('\\'), QLatin1Char('/')); @@ -1315,6 +1316,32 @@ void VcprojGenerator::initDeploymentTool() + "|" + QDir::toNativeSeparators(info.absolutePath()) + "|" + targetPath + "|0;"; + if (!qpaPluginDeployed) { + QChar debugInfixChar; + bool foundGuid = false; + if (foundGuid = dllName.contains(QLatin1String("Guid"))) + debugInfixChar = QLatin1Char('d'); + + if (foundGuid || dllName.contains(QLatin1String("Gui"))) { + QFileInfo info2; + foreach (const ProString &dllPath, dllPaths) { + QString absoluteDllFilePath = dllPath.toQString(); + if (!absoluteDllFilePath.endsWith(QLatin1Char('/'))) + absoluteDllFilePath += QLatin1Char('/'); + absoluteDllFilePath += QLatin1String("../plugins/platforms/qwindows") + debugInfixChar + QLatin1String(".dll"); + info2 = QFileInfo(absoluteDllFilePath); + if (info2.exists()) + break; + } + if (info2.exists()) { + conf.deployment.AdditionalFiles += QLatin1String("qwindows") + debugInfixChar + QLatin1String(".dll") + + QLatin1Char('|') + QDir::toNativeSeparators(info2.absolutePath()) + + QLatin1Char('|') + targetPath + QLatin1String("\\platforms") + + QLatin1String("|0;"); + qpaPluginDeployed = true; + } + } + } } } } -- cgit v1.2.3 From 663263c124339db432cd5596b87462343096dd83 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Mon, 21 Mar 2016 14:17:18 +0100 Subject: QWidget::create(): Mark parameter window as ignored. Remove parameter from QWidgetPrivate::createWinId(), add a warning and fixme comments. Update the documentation to point the users to QWindow::fromWinId() and QWidget::createWindowContainer(). Task-number: QTBUG-33079 Task-number: QTBUG-51853 Change-Id: I03ae922b31bb46a411889cc0260ea14a4d933492 Reviewed-by: Marc Mutz --- src/widgets/kernel/qwidget.cpp | 30 ++++++++++++++---------------- src/widgets/kernel/qwidget_p.h | 2 +- 2 files changed, 15 insertions(+), 17 deletions(-) diff --git a/src/widgets/kernel/qwidget.cpp b/src/widgets/kernel/qwidget.cpp index 6fdd5d3d0e..c57ca41815 100644 --- a/src/widgets/kernel/qwidget.cpp +++ b/src/widgets/kernel/qwidget.cpp @@ -1243,11 +1243,14 @@ void QWidgetPrivate::createRecursively() } - +// ### fixme: Qt 6: Remove parameter window from QWidget::create() /*! - Creates a new widget window if \a window is 0, otherwise sets the - widget's window to \a window. + Creates a new widget window. + + The parameter \a window is ignored in Qt 5. Please use + QWindow::fromWinId() to create a QWindow wrapping a foreign + window and pass it to QWidget::createWindowContainer() instead. Initializes the window (sets the geometry etc.) if \a initializeWindow is true. If \a initializeWindow is false, no @@ -1260,11 +1263,15 @@ void QWidgetPrivate::createRecursively() The QWidget constructor calls create(0,true,true) to create a window for this widget. + + \sa createWindowContainer(), QWindow::fromWinId() */ void QWidget::create(WId window, bool initializeWindow, bool destroyOldWindow) { Q_D(QWidget); + if (Q_UNLIKELY(window)) + qWarning("QWidget::create(): Parameter 'window' does not have any effect."); if (testAttribute(Qt::WA_WState_Created) && window == 0 && internalWinId()) return; @@ -1288,7 +1295,7 @@ void QWidget::create(WId window, bool initializeWindow, bool destroyOldWindow) // We're about to create a native child widget that doesn't have a native parent; // enforce a native handle for the parent unless the Qt::WA_DontCreateNativeAncestors // attribute is set. - d->createWinId(window); + d->createWinId(); // Nothing more to do. Q_ASSERT(testAttribute(Qt::WA_WState_Created)); Q_ASSERT(internalWinId()); @@ -2520,13 +2527,12 @@ WId QWidget::winId() const return data->winid; } - -void QWidgetPrivate::createWinId(WId winid) +void QWidgetPrivate::createWinId() { Q_Q(QWidget); #ifdef ALIEN_DEBUG - qDebug() << "QWidgetPrivate::createWinId for" << q << winid; + qDebug() << "QWidgetPrivate::createWinId for" << q; #endif const bool forceNativeWindow = q->testAttribute(Qt::WA_NativeWindow); if (!q->testAttribute(Qt::WA_WState_Created) || (forceNativeWindow && !q->internalWinId())) { @@ -2543,15 +2549,7 @@ void QWidgetPrivate::createWinId(WId winid) QWidget *w = qobject_cast(pd->children.at(i)); if (w && !w->isWindow() && (!w->testAttribute(Qt::WA_WState_Created) || (!w->internalWinId() && w->testAttribute(Qt::WA_NativeWindow)))) { - if (w!=q) { - w->create(); - } else { - w->create(winid); - // if the window has already been created, we - // need to raise it to its proper stacking position - if (winid) - w->raise(); - } + w->create(); } } } else { diff --git a/src/widgets/kernel/qwidget_p.h b/src/widgets/kernel/qwidget_p.h index a5c7aa5815..9d4bdc7f89 100644 --- a/src/widgets/kernel/qwidget_p.h +++ b/src/widgets/kernel/qwidget_p.h @@ -333,7 +333,7 @@ public: void init(QWidget *desktopWidget, Qt::WindowFlags f); void create_sys(WId window, bool initializeWindow, bool destroyOldWindow); void createRecursively(); - void createWinId(WId id = 0); + void createWinId(); void createTLExtra(); void createExtra(); -- cgit v1.2.3 From 005a8bfbf0022f03dafafcf2b5c438ccf0675a49 Mon Sep 17 00:00:00 2001 From: James McDonnell Date: Fri, 18 Mar 2016 12:53:12 -0400 Subject: Remove QPROCESS_USE_SPAWN and all that it surrounds The spawn code was only used to make QProcess work on QNX 6.5.0. Fork works on QNX 6.6.0. The QNX spawn implementation has a flaw that causes a deadlock in certain situations. When a working directory is specified for the process, the QNX spawn implementation stops all threads except the one doing the spawn so that it can temporarily change the process' working directory. This can lead to a deadlock if the thread does anything that conficts with something being done in a stopped thread. QNX 6.5.0 is no longer supported in Qt 5.6.0 so we can just switch QNX to the fork implementation and get rid of the spawn implementation. Made a QNX specific adjustment to the hardExit test. There's a bug in the OS that the test can run into because it does something that normal applications wouldn't. Task-number: QTBUG-47250 Change-Id: Ib32567d2c15ce651815858000035ac5aa6f35224 Reviewed-by: Dan Cape Reviewed-by: Oswald Buddenhagen Reviewed-by: Rafael Roquetto --- src/corelib/io/forkfd_qt.cpp | 6 +- src/corelib/io/qprocess.cpp | 11 -- src/corelib/io/qprocess_p.h | 7 +- src/corelib/io/qprocess_unix.cpp | 185 ------------------------ tests/auto/corelib/io/qprocess/tst_qprocess.cpp | 38 ++--- 5 files changed, 12 insertions(+), 235 deletions(-) diff --git a/src/corelib/io/forkfd_qt.cpp b/src/corelib/io/forkfd_qt.cpp index b226332cc1..2ccc9ba837 100644 --- a/src/corelib/io/forkfd_qt.cpp +++ b/src/corelib/io/forkfd_qt.cpp @@ -35,11 +35,7 @@ #include #include "qprocess_p.h" -#ifdef QPROCESS_USE_SPAWN -# define FORKFD_NO_FORKFD -#else -# define FORKFD_NO_SPAWNFD -#endif +#define FORKFD_NO_SPAWNFD #if defined(QT_NO_DEBUG) && !defined(NDEBUG) # define NDEBUG diff --git a/src/corelib/io/qprocess.cpp b/src/corelib/io/qprocess.cpp index 952116b9db..a86e3cb438 100644 --- a/src/corelib/io/qprocess.cpp +++ b/src/corelib/io/qprocess.cpp @@ -1134,17 +1134,6 @@ bool QProcessPrivate::_q_processDied() if (crashed) { exitStatus = QProcess::CrashExit; setErrorAndEmit(QProcess::Crashed); - } else { -#ifdef QPROCESS_USE_SPAWN - // if we're using posix_spawn, waitForStarted always succeeds. - // POSIX documents that the sub-process launched by posix_spawn will exit with code - // 127 if anything prevents the target program from starting. - // http://pubs.opengroup.org/onlinepubs/009695399/functions/posix_spawn.html - if (exitStatus == QProcess::NormalExit && exitCode == 127) { - setError(QProcess::FailedToStart, - QProcess::tr("Process failed to start (spawned process exited with code 127)")); - } -#endif } bool wasRunning = (processState == QProcess::Running); diff --git a/src/corelib/io/qprocess_p.h b/src/corelib/io/qprocess_p.h index d3f251c399..436869462c 100644 --- a/src/corelib/io/qprocess_p.h +++ b/src/corelib/io/qprocess_p.h @@ -62,9 +62,6 @@ typedef HANDLE Q_PIPE; #else typedef int Q_PIPE; #define INVALID_Q_PIPE -1 -# ifdef Q_OS_QNX -# define QPROCESS_USE_SPAWN -# endif #endif #ifndef QT_NO_PROCESS @@ -347,10 +344,8 @@ public: void start(QIODevice::OpenMode mode); void startProcess(); -#if defined(Q_OS_UNIX) && !defined(QPROCESS_USE_SPAWN) +#if defined(Q_OS_UNIX) void execChild(const char *workingDirectory, char **path, char **argv, char **envp); -#elif defined(QPROCESS_USE_SPAWN) - pid_t spawnChild(pid_t *ppid, const char *workingDirectory, char **argv, char **envp); #endif bool processStarted(QString *errorMessage = Q_NULLPTR); void terminateProcess(); diff --git a/src/corelib/io/qprocess_unix.cpp b/src/corelib/io/qprocess_unix.cpp index 8eb5ac9564..18d203404d 100644 --- a/src/corelib/io/qprocess_unix.cpp +++ b/src/corelib/io/qprocess_unix.cpp @@ -423,14 +423,8 @@ void QProcessPrivate::startProcess() } // Start the process manager, and fork off the child process. -#if defined(QPROCESS_USE_SPAWN) - pid_t childPid; - forkfd = spawnChild(&childPid, workingDirPtr, argv, envp); - Q_ASSUME(forkfd != FFD_CHILD_PROCESS); -#else pid_t childPid; forkfd = ::forkfd(FFD_CLOEXEC, &childPid); -#endif int lastForkErrno = errno; if (forkfd != FFD_CHILD_PROCESS) { // Parent process. @@ -464,12 +458,10 @@ void QProcessPrivate::startProcess() } // Start the child. -#if !defined(QPROCESS_USE_SPAWN) if (forkfd == FFD_CHILD_PROCESS) { execChild(workingDirPtr, path, argv, envp); ::_exit(-1); } -#endif pid = Q_PID(childPid); @@ -508,147 +500,6 @@ void QProcessPrivate::startProcess() } } -#if defined(QPROCESS_USE_SPAWN) -static int doSpawn(pid_t *ppid, const posix_spawn_file_actions_t *file_actions, - char **argv, char **envp, const char *workingDir, bool spawn_detached) -{ - // A multi threaded QNX Process can't fork so we call spawnfd() instead. - posix_spawnattr_t attr; - posix_spawnattr_init(&attr); -# ifdef Q_OS_QNX - posix_spawnattr_setxflags(&attr, POSIX_SPAWN_SETSIGDEF | POSIX_SPAWN_SETPGROUP - | (spawn_detached * POSIX_SPAWN_NOZOMBIE)); -# else - posix_spawnattr_setflags(&attr, POSIX_SPAWN_SETSIGDEF | POSIX_SPAWN_SETPGROUP); -# endif - posix_spawnattr_setpgroup(&attr, 0); - - sigset_t sigdefault; - sigemptyset(&sigdefault); - sigaddset(&sigdefault, SIGPIPE); // reset the signal that we ignored - posix_spawnattr_setsigdefault(&attr, &sigdefault); - - // enter the working directory - const char *oldWorkingDir = 0; - char buff[PATH_MAX + 1]; - - if (workingDir) { -# ifdef Q_OS_QNX - //we need to freeze everyone in order to avoid race conditions with //chdir(). - if (ThreadCtl(_NTO_TCTL_THREADS_HOLD, 0) == -1) - qWarning("ThreadCtl(): cannot hold threads: %s", qPrintable(qt_error_string(errno))); -# endif - - oldWorkingDir = QT_GETCWD(buff, PATH_MAX + 1); - if (QT_CHDIR(workingDir) == -1) - qWarning("ThreadCtl(): failed to chdir to %s", workingDir); - } - - int fd; - if (spawn_detached) { - fd = ::posix_spawn(ppid, argv[0], file_actions, &attr, argv, envp); - if (fd == -1) { - fd = ::posix_spawnp(ppid, argv[0], file_actions, &attr, argv, envp); - } - } else { - // use spawnfd - fd = ::spawnfd(FFD_CLOEXEC | FFD_NONBLOCK, ppid, argv[0], file_actions, &attr, argv, envp); - if (fd == -1) { - fd = ::spawnfd(FFD_CLOEXEC | FFD_NONBLOCK | FFD_SPAWN_SEARCH_PATH, ppid, argv[0], file_actions, - &attr, argv, envp); - } - } - - if (oldWorkingDir) { - if (QT_CHDIR(oldWorkingDir) == -1) - qWarning("ThreadCtl(): failed to chdir to %s", oldWorkingDir); - -# ifdef Q_OS_QNX - if (ThreadCtl(_NTO_TCTL_THREADS_CONT, 0) == -1) - qFatal("ThreadCtl(): cannot resume threads: %s", qPrintable(qt_error_string(errno))); -# endif - } - - posix_spawnattr_destroy(&attr); - return fd; -} - -pid_t QProcessPrivate::spawnChild(pid_t *ppid, const char *workingDir, char **argv, char **envp) -{ - // posix_spawn causes all file descriptors with FD_CLOEXEC to be closed automatically; - // we only need to add the actions for our own pipes - posix_spawn_file_actions_t file_actions; - posix_spawn_file_actions_init(&file_actions); - -# ifdef Q_OS_QNX - static const bool OS_QNX = true; -# else - static const bool OS_QNX = false; -#endif - - int fdmax = -1; - - if (processChannelMode == QProcess::MergedChannels) { - // managed stderr == stdout - posix_spawn_file_actions_adddup2(&file_actions, stdoutChannel.pipe[1], STDERR_FILENO); - - if (OS_QNX) - fdmax = qMax(fdmax, stdoutChannel.pipe[1]); - } else if (processChannelMode != QProcess::ForwardedChannels && processChannelMode != QProcess::ForwardedErrorChannel) { - // managed stderr - posix_spawn_file_actions_adddup2(&file_actions, stderrChannel.pipe[1], STDERR_FILENO); - - if (OS_QNX) - fdmax = qMax(fdmax, stderrChannel.pipe[1]); - else - posix_spawn_file_actions_addclose(&file_actions, stderrChannel.pipe[1]); - - } - - if (processChannelMode != QProcess::ForwardedChannels && processChannelMode != QProcess::ForwardedOutputChannel) { - // managed stdout - posix_spawn_file_actions_adddup2(&file_actions, stdoutChannel.pipe[1], STDOUT_FILENO); - - if (OS_QNX) - fdmax = qMax(fdmax, stdoutChannel.pipe[1]); - else - posix_spawn_file_actions_addclose(&file_actions, stdoutChannel.pipe[1]); - - } - - if (inputChannelMode == QProcess::ManagedInputChannel) { - posix_spawn_file_actions_adddup2(&file_actions, stdinChannel.pipe[0], STDIN_FILENO); - - if (OS_QNX) - fdmax = qMax(fdmax, stdinChannel.pipe[0]); - else - posix_spawn_file_actions_addclose(&file_actions, stdinChannel.pipe[0]); - } - - // Workaround: QNX's spawn implementation will actually dup all FD values - // LESS than fdmax - regardless of the FD_CLOEEXEC flag. So we need to add - // those to the list of files to close, otherwise dup will fail when some - // other thread closes the FD. - for (int i = 3; i <= fdmax; i++) { - if (::fcntl(i, F_GETFD) & FD_CLOEXEC) - posix_spawn_file_actions_addclose(&file_actions, i); - } - - int retval = doSpawn(ppid, &file_actions, argv, envp, workingDir, false); - - if (retval == -1) { - QString error = qt_error_string(errno); - qt_safe_write(childStartedPipe[1], error.data(), error.length() * sizeof(QChar)); - qt_safe_close(childStartedPipe[1]); - childStartedPipe[1] = -1; - } - - posix_spawn_file_actions_destroy(&file_actions); - return retval; -} - -#else - void QProcessPrivate::execChild(const char *workingDir, char **path, char **argv, char **envp) { ::signal(SIGPIPE, SIG_DFL); // reset the signal that we ignored @@ -716,7 +567,6 @@ report_errno: qt_safe_close(childStartedPipe[1]); childStartedPipe[1] = -1; } -#endif bool QProcessPrivate::processStarted(QString *errorMessage) { @@ -1100,40 +950,6 @@ bool QProcessPrivate::waitForDeadChild() return true; } -#if defined(QPROCESS_USE_SPAWN) -bool QProcessPrivate::startDetached(const QString &program, const QStringList &arguments, const QString &workingDirectory, qint64 *pid) -{ - QList enc_args; - enc_args.append(QFile::encodeName(program)); - for (int i = 0; i < arguments.size(); ++i) - enc_args.append(arguments.at(i).toLocal8Bit()); - - const int argc = enc_args.size(); - QScopedArrayPointer raw_argv(new char*[argc + 1]); - for (int i = 0; i < argc; ++i) - raw_argv[i] = const_cast(enc_args.at(i).data()); - raw_argv[argc] = 0; - - char **envp = 0; // inherit environment - - // Encode the working directory if it's non-empty, otherwise just pass 0. - const char *workingDirPtr = 0; - QByteArray encodedWorkingDirectory; - if (!workingDirectory.isEmpty()) { - encodedWorkingDirectory = QFile::encodeName(workingDirectory); - workingDirPtr = encodedWorkingDirectory.constData(); - } - - pid_t childPid; - int retval = doSpawn(&childPid, NULL, raw_argv.data(), envp, workingDirPtr, true); - if (pid && retval != -1) - *pid = childPid; - - return retval != -1; -} - -#else - bool QProcessPrivate::startDetached(const QString &program, const QStringList &arguments, const QString &workingDirectory, qint64 *pid) { QByteArray encodedWorkingDirectory = QFile::encodeName(workingDirectory); @@ -1248,7 +1064,6 @@ bool QProcessPrivate::startDetached(const QString &program, const QStringList &a qt_safe_close(pidPipe[0]); return success; } -#endif QT_END_NAMESPACE diff --git a/tests/auto/corelib/io/qprocess/tst_qprocess.cpp b/tests/auto/corelib/io/qprocess/tst_qprocess.cpp index 46bf1a19e8..7e1d5487ba 100644 --- a/tests/auto/corelib/io/qprocess/tst_qprocess.cpp +++ b/tests/auto/corelib/io/qprocess/tst_qprocess.cpp @@ -45,8 +45,6 @@ #include #include -# include // only so we get QPROCESS_USE_SPAWN - typedef void (QProcess::*QProcessFinishedSignal1)(int); typedef void (QProcess::*QProcessFinishedSignal2)(int, QProcess::ExitStatus); typedef void (QProcess::*QProcessErrorSignal)(QProcess::ProcessError); @@ -325,9 +323,6 @@ void tst_QProcess::startDetached() { QVERIFY(QProcess::startDetached("testProcessNormal/testProcessNormal", QStringList() << "arg1" << "arg2")); -#ifdef QPROCESS_USE_SPAWN - QEXPECT_FAIL("", "QProcess cannot detect failure to start when using posix_spawn()", Continue); -#endif QCOMPARE(QProcess::startDetached("nonexistingexe"), false); } @@ -707,9 +702,6 @@ void tst_QProcess::waitForFinished() QCOMPARE(output.count("\n"), 10*1024); process.start("blurdybloop"); -#if defined(QPROCESS_USE_SPAWN) && !defined(Q_OS_QNX) - QEXPECT_FAIL("", "QProcess cannot detect failure to start when using posix_spawn()", Abort); -#endif QVERIFY(!process.waitForFinished()); QCOMPARE(process.error(), QProcess::FailedToStart); } @@ -922,6 +914,16 @@ void tst_QProcess::hardExit() #endif QVERIFY2(proc.waitForStarted(), qPrintable(proc.errorString())); + +#if defined(Q_OS_QNX) + // QNX may lose the kill if it's delivered while the forked process + // is doing the exec that morphs it into testProcessEcho. It's very + // unlikely that a normal application would do such a thing. Make + // sure the test doesn't accidentally try to do it. + proc.write("A"); + QVERIFY(proc.waitForReadyRead(5000)); +#endif + proc.kill(); QVERIFY(proc.waitForFinished(5000)); @@ -1503,11 +1505,6 @@ void tst_QProcess::nativeArguments() void tst_QProcess::exitCodeTest() { for (int i = 0; i < 255; ++i) { -#ifdef QPROCESS_USE_SPAWN - // POSIX reserves exit code 127 when using posix_spawn - if (i == 127) - continue; -#endif QProcess process; process.start("testExitCodes/testExitCodes " + QString::number(i)); QVERIFY(process.waitForFinished(5000)); @@ -1518,9 +1515,6 @@ void tst_QProcess::exitCodeTest() void tst_QProcess::failToStart() { -#if defined(QPROCESS_USE_SPAWN) && !defined(Q_OS_QNX) - QSKIP("QProcess cannot detect failure to start when using posix_spawn()"); -#endif qRegisterMetaType("QProcess::ProcessError"); qRegisterMetaType("QProcess::ExitStatus"); qRegisterMetaType("QProcess::ProcessState"); @@ -1591,9 +1585,6 @@ void tst_QProcess::failToStart() void tst_QProcess::failToStartWithWait() { -#if defined(QPROCESS_USE_SPAWN) && !defined(Q_OS_QNX) - QSKIP("QProcess cannot detect failure to start when using posix_spawn()"); -#endif qRegisterMetaType("QProcess::ProcessError"); qRegisterMetaType("QProcess::ExitStatus"); @@ -1623,9 +1614,6 @@ void tst_QProcess::failToStartWithWait() void tst_QProcess::failToStartWithEventLoop() { -#if defined(QPROCESS_USE_SPAWN) && !defined(Q_OS_QNX) - QSKIP("QProcess cannot detect failure to start when using posix_spawn()"); -#endif qRegisterMetaType("QProcess::ProcessError"); qRegisterMetaType("QProcess::ExitStatus"); @@ -1912,9 +1900,6 @@ void tst_QProcess::waitForReadyReadForNonexistantProcess() QVERIFY(!process.waitForReadyRead()); // used to crash process.start("doesntexist"); QVERIFY(!process.waitForReadyRead()); -#if defined(QPROCESS_USE_SPAWN) && !defined(Q_OS_QNX) - QEXPECT_FAIL("", "QProcess cannot detect failure to start when using posix_spawn()", Abort); -#endif QCOMPARE(errorSpy.count(), 1); QCOMPARE(errorSpy.at(0).at(0).toInt(), 0); QCOMPARE(errorSpy2.count(), 1); @@ -2282,9 +2267,6 @@ void tst_QProcess::setNonExistentWorkingDirectory() // while on Unix with fork it's relative to the child's (with posix_spawn, it could be either). process.start(QFileInfo("testSetWorkingDirectory/testSetWorkingDirectory").absoluteFilePath()); QVERIFY(!process.waitForFinished()); -#ifdef QPROCESS_USE_SPAWN - QEXPECT_FAIL("", "QProcess cannot detect failure to start when using posix_spawn()", Continue); -#endif QCOMPARE(int(process.error()), int(QProcess::FailedToStart)); } #endif -- cgit v1.2.3 From f319b9b43c313dfa306a62c391e767bc6f14bdee Mon Sep 17 00:00:00 2001 From: Gabriel de Dietrich Date: Tue, 1 Mar 2016 14:07:06 -0800 Subject: QOpenGL: Fix GLhandleARB redefinition on OS X Some Qt users include non-system OpenGL headers, resulting in a possible mismatched redefinition of GLhandleARB. Ideally, we'd like to skip the whole glext.h inlined portion and rely on qopenglext.h. However, some issues remain such as GLDEBUGPROC not being defined on OS X. Change-Id: Ie551cf0be309234b22cd615cc3703980f48298b9 Task-number: QTBUG-46149 Reviewed-by: Jake Petroules --- src/gui/opengl/qopengl.h | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/gui/opengl/qopengl.h b/src/gui/opengl/qopengl.h index 87dc2a830e..a060949c17 100644 --- a/src/gui/opengl/qopengl.h +++ b/src/gui/opengl/qopengl.h @@ -181,7 +181,11 @@ typedef ptrdiff_t GLsizeiptrARB; #ifndef GL_ARB_shader_objects /* GL types for program/shader text and shader object handles */ typedef char GLcharARB; +# ifdef Q_OS_DARWIN +typedef void *GLhandleARB; +# else typedef unsigned int GLhandleARB; +# endif // Q_OS_DARWIN #endif /* GL type for "half" precision (s10e5) float data in host memory */ -- cgit v1.2.3