diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/corelib/global/qglobal.cpp | 16 | ||||
-rw-r--r-- | src/corelib/thread/qfutureinterface.cpp | 7 | ||||
-rw-r--r-- | src/corelib/thread/qfutureinterface.h | 13 | ||||
-rw-r--r-- | src/plugins/platforms/cocoa/qcocoaintegration.h | 2 | ||||
-rw-r--r-- | src/plugins/platforms/cocoa/qcocoaintegration.mm | 13 | ||||
-rw-r--r-- | src/plugins/platforms/cocoa/qcocoawindow.h | 1 | ||||
-rw-r--r-- | src/plugins/platforms/cocoa/qcocoawindow.mm | 17 | ||||
-rw-r--r-- | src/plugins/platforms/windows/qwindowsglcontext.cpp | 2 | ||||
-rw-r--r-- | src/tools/androiddeployqt/main.cpp | 25 | ||||
-rw-r--r-- | src/widgets/styles/qfusionstyle.cpp | 2 | ||||
-rw-r--r-- | src/widgets/styles/qstylesheetstyle.cpp | 20 |
11 files changed, 83 insertions, 35 deletions
diff --git a/src/corelib/global/qglobal.cpp b/src/corelib/global/qglobal.cpp index dfd5137703..2b1a40cf4c 100644 --- a/src/corelib/global/qglobal.cpp +++ b/src/corelib/global/qglobal.cpp @@ -1200,11 +1200,14 @@ bool qSharedBuild() noexcept the application is compiled (32 or 64). */ +#if QT_DEPRECATED_SINCE(5, 9) /*! \deprecated \variable QSysInfo::WindowsVersion \brief the version of the Windows operating system on which the application is run. + + Use QOperatingSystemVersion::current() instead. */ /*! @@ -1212,6 +1215,8 @@ bool qSharedBuild() noexcept \fn QSysInfo::WindowsVersion QSysInfo::windowsVersion() \since 4.4 + Use QOperatingSystemVersion::current() instead. + Returns the version of the Windows operating system on which the application is run, or WV_None if the operating system is not Windows. @@ -1222,16 +1227,21 @@ bool qSharedBuild() noexcept \variable QSysInfo::MacintoshVersion \brief the version of the Macintosh operating system on which the application is run. + + Use QOperatingSystemVersion::current() instead. */ /*! \deprecated \fn QSysInfo::MacVersion QSysInfo::macVersion() + Use QOperatingSystemVersion::current() instead. + Returns the version of Darwin (\macos or iOS) on which the application is run, or MV_None if the operating system is not a version of Darwin. */ +#endif /*! \enum QSysInfo::Endian @@ -1242,10 +1252,13 @@ bool qSharedBuild() noexcept the platform's byte order. */ +#if QT_DEPRECATED_SINCE(5, 9) /*! \deprecated \enum QSysInfo::WinVersion + Use the versions defined in QOperatingSystemVersion instead. + This enum provides symbolic names for the various versions of the Windows operating system. On Windows, the QSysInfo::WindowsVersion variable gives the version of the system @@ -1303,6 +1316,8 @@ bool qSharedBuild() noexcept \deprecated \enum QSysInfo::MacVersion + Use the versions defined in QOperatingSystemVersion instead. + This enum provides symbolic names for the various versions of the Darwin operating system, covering both \macos and iOS. The QSysInfo::MacintoshVersion variable gives the version of the @@ -1373,6 +1388,7 @@ bool qSharedBuild() noexcept \sa WinVersion */ +#endif /*! \macro Q_OS_DARWIN diff --git a/src/corelib/thread/qfutureinterface.cpp b/src/corelib/thread/qfutureinterface.cpp index 6430f38a3b..1303be10b1 100644 --- a/src/corelib/thread/qfutureinterface.cpp +++ b/src/corelib/thread/qfutureinterface.cpp @@ -424,12 +424,7 @@ void QFutureInterfaceBase::setProgressValueAndText(int progressValue, } } -QMutex *QFutureInterfaceBase::mutex() const -{ - return &d->m_mutex; -} - -QMutex &QFutureInterfaceBase::mutex(int) const +QMutex &QFutureInterfaceBase::mutex() const { return d->m_mutex; } diff --git a/src/corelib/thread/qfutureinterface.h b/src/corelib/thread/qfutureinterface.h index bcdae24833..43dfd6bac4 100644 --- a/src/corelib/thread/qfutureinterface.h +++ b/src/corelib/thread/qfutureinterface.h @@ -119,8 +119,7 @@ public: void waitForResult(int resultIndex); void waitForResume(); - QMutex *mutex() const; - QMutex &mutex(int) const; + QMutex &mutex() const; QtPrivate::ExceptionStore &exceptionStore(); QtPrivate::ResultStoreBase &resultStoreBase(); const QtPrivate::ResultStoreBase &resultStoreBase() const; @@ -191,7 +190,7 @@ public: template <typename T> inline void QFutureInterface<T>::reportResult(const T *result, int index) { - std::lock_guard<QMutex> locker(mutex(0)); + std::lock_guard<QMutex> locker{mutex()}; if (this->queryState(Canceled) || this->queryState(Finished)) { return; } @@ -217,7 +216,7 @@ inline void QFutureInterface<T>::reportResult(const T &result, int index) template <typename T> inline void QFutureInterface<T>::reportResults(const QVector<T> &_results, int beginIndex, int count) { - std::lock_guard<QMutex> locker(mutex(0)); + std::lock_guard<QMutex> locker{mutex()}; if (this->queryState(Canceled) || this->queryState(Finished)) { return; } @@ -245,14 +244,14 @@ inline void QFutureInterface<T>::reportFinished(const T *result) template <typename T> inline const T &QFutureInterface<T>::resultReference(int index) const { - std::lock_guard<QMutex> locker(mutex(0)); + std::lock_guard<QMutex> locker{mutex()}; return resultStoreBase().resultAt(index).template value<T>(); } template <typename T> inline const T *QFutureInterface<T>::resultPointer(int index) const { - std::lock_guard<QMutex> locker(mutex(0)); + std::lock_guard<QMutex> locker{mutex()}; return resultStoreBase().resultAt(index).template pointer<T>(); } @@ -266,7 +265,7 @@ inline QList<T> QFutureInterface<T>::results() QFutureInterfaceBase::waitForResult(-1); QList<T> res; - std::lock_guard<QMutex> locker(mutex(0)); + std::lock_guard<QMutex> locker{mutex()}; QtPrivate::ResultIteratorBase it = resultStoreBase().begin(); while (it != resultStoreBase().end()) { diff --git a/src/plugins/platforms/cocoa/qcocoaintegration.h b/src/plugins/platforms/cocoa/qcocoaintegration.h index bfc3bfe9de..0e2656e046 100644 --- a/src/plugins/platforms/cocoa/qcocoaintegration.h +++ b/src/plugins/platforms/cocoa/qcocoaintegration.h @@ -124,6 +124,8 @@ public: void beep() const override; + void closePopups(QWindow *forWindow = nullptr); + private Q_SLOTS: void focusWindowChanged(QWindow *); diff --git a/src/plugins/platforms/cocoa/qcocoaintegration.mm b/src/plugins/platforms/cocoa/qcocoaintegration.mm index 9a2f19c2f2..67ad0b3492 100644 --- a/src/plugins/platforms/cocoa/qcocoaintegration.mm +++ b/src/plugins/platforms/cocoa/qcocoaintegration.mm @@ -487,6 +487,19 @@ void QCocoaIntegration::beep() const NSBeep(); } +void QCocoaIntegration::closePopups(QWindow *forWindow) +{ + for (auto it = m_popupWindowStack.begin(); it != m_popupWindowStack.end();) { + auto *popup = *it; + if (!forWindow || popup->window()->transientParent() == forWindow) { + it = m_popupWindowStack.erase(it); + QWindowSystemInterface::handleCloseEvent<QWindowSystemInterface::SynchronousDelivery>(popup->window()); + } else { + ++it; + } + } +} + void QCocoaIntegration::focusWindowChanged(QWindow *focusWindow) { // Don't revert icon just because we lost focus diff --git a/src/plugins/platforms/cocoa/qcocoawindow.h b/src/plugins/platforms/cocoa/qcocoawindow.h index c6ce6e6819..72b5a17475 100644 --- a/src/plugins/platforms/cocoa/qcocoawindow.h +++ b/src/plugins/platforms/cocoa/qcocoawindow.h @@ -151,6 +151,7 @@ public: Q_NOTIFICATION_HANDLER(NSWindowDidEndLiveResizeNotification) void windowDidEndLiveResize(); Q_NOTIFICATION_HANDLER(NSWindowDidBecomeKeyNotification) void windowDidBecomeKey(); Q_NOTIFICATION_HANDLER(NSWindowDidResignKeyNotification) void windowDidResignKey(); + Q_NOTIFICATION_HANDLER(NSWindowWillMiniaturizeNotification) void windowWillMiniaturize(); Q_NOTIFICATION_HANDLER(NSWindowDidMiniaturizeNotification) void windowDidMiniaturize(); Q_NOTIFICATION_HANDLER(NSWindowDidDeminiaturizeNotification) void windowDidDeminiaturize(); Q_NOTIFICATION_HANDLER(NSWindowWillEnterFullScreenNotification) void windowWillEnterFullScreen(); diff --git a/src/plugins/platforms/cocoa/qcocoawindow.mm b/src/plugins/platforms/cocoa/qcocoawindow.mm index db4bc12210..bac064dfc5 100644 --- a/src/plugins/platforms/cocoa/qcocoawindow.mm +++ b/src/plugins/platforms/cocoa/qcocoawindow.mm @@ -71,14 +71,6 @@ enum { defaultWindowHeight = 160 }; -static void qt_closePopups() -{ - while (QCocoaWindow *popup = QCocoaIntegration::instance()->popPopupWindow()) { - QWindowSystemInterface::handleCloseEvent(popup->window()); - QWindowSystemInterface::flushWindowSystemEvents(); - } -} - Q_LOGGING_CATEGORY(lcCocoaNotifications, "qt.qpa.cocoa.notifications"); static void qRegisterNotificationCallbacks() @@ -800,6 +792,11 @@ void QCocoaWindow::windowDidExitFullScreen() } } +void QCocoaWindow::windowWillMiniaturize() +{ + QCocoaIntegration::instance()->closePopups(window()); +} + void QCocoaWindow::windowDidMiniaturize() { if (!isContentView()) @@ -1138,7 +1135,7 @@ void QCocoaWindow::viewDidChangeGlobalFrame() void QCocoaWindow::windowWillMove() { // Close any open popups on window move - qt_closePopups(); + QCocoaIntegration::instance()->closePopups(); } void QCocoaWindow::windowDidMove() @@ -1278,7 +1275,7 @@ void QCocoaWindow::windowWillClose() { // Close any open popups on window closing. if (window() && !windowIsPopupType(window()->type())) - qt_closePopups(); + QCocoaIntegration::instance()->closePopups(); } // ----------------------- NSWindowDelegate callbacks ----------------------- diff --git a/src/plugins/platforms/windows/qwindowsglcontext.cpp b/src/plugins/platforms/windows/qwindowsglcontext.cpp index 64b83e2bc4..3591b2c505 100644 --- a/src/plugins/platforms/windows/qwindowsglcontext.cpp +++ b/src/plugins/platforms/windows/qwindowsglcontext.cpp @@ -329,7 +329,7 @@ static inline bool static void describeFormats(HDC hdc) { const int pfiMax = QOpenGLStaticContext::opengl32.describePixelFormat(hdc, 0, 0, nullptr); - for (int i = 0; i < pfiMax; i++) { + for (int i = 1; i <= pfiMax; i++) { PIXELFORMATDESCRIPTOR pfd; initPixelFormatDescriptor(&pfd); QOpenGLStaticContext::opengl32.describePixelFormat(hdc, i, sizeof(PIXELFORMATDESCRIPTOR), &pfd); diff --git a/src/tools/androiddeployqt/main.cpp b/src/tools/androiddeployqt/main.cpp index 794e3b49ae..705a9904b4 100644 --- a/src/tools/androiddeployqt/main.cpp +++ b/src/tools/androiddeployqt/main.cpp @@ -129,6 +129,7 @@ struct Options , jarSigner(false) , installApk(false) , uninstallApk(false) + , qmlImportScannerBinaryPath() {} enum DeploymentMechanism @@ -232,6 +233,9 @@ struct Options QStringList initClasses; QStringList permissions; QStringList features; + + // Override qml import scanner path + QString qmlImportScannerBinaryPath; }; static const QHash<QByteArray, QByteArray> elfArchitecures = { @@ -527,6 +531,8 @@ Options parseOptions() options.generateAssetsFileList = false; } else if (argument.compare(QLatin1String("--aux-mode"), Qt::CaseInsensitive) == 0) { options.auxMode = true; + } else if (argument.compare(QLatin1String("--qml-importscanner-binary"), Qt::CaseInsensitive) == 0) { + options.qmlImportScannerBinaryPath = arguments.at(++i).trimmed(); } } @@ -610,6 +616,10 @@ void printHelp() " dependencies into the build directory and update the XML templates.\n" " The project will not be built or installed.\n" " --apk <path/where/to/copy/the/apk>: Path where to copy the built apk.\n" + " --qml-importscanner-binary <path/to/qmlimportscanner>: Override the\n" + " default qmlimportscanner binary path. By default the\n" + " qmlimportscanner binary is located using the Qt directory\n" + " specified in the input file.\n" " --help: Displays this information.\n\n", qPrintable(QCoreApplication::arguments().at(0)) ); @@ -931,6 +941,12 @@ bool readInputFile(Options *options) } { + const QJsonValue qmlImportScannerBinaryPath = jsonObject.value(QLatin1String("qml-importscanner-binary")); + if (!qmlImportScannerBinaryPath.isUndefined()) + options->qmlImportScannerBinaryPath = qmlImportScannerBinaryPath.toString(); + } + + { const QJsonValue applicationBinary = jsonObject.value(QLatin1String("application-binary")); if (applicationBinary.isUndefined()) { fprintf(stderr, "No application binary defined in json file.\n"); @@ -1734,10 +1750,15 @@ bool scanImports(Options *options, QSet<QString> *usedDependencies) if (options->verbose) fprintf(stdout, "Scanning for QML imports.\n"); - QString qmlImportScanner = options->qtInstallDirectory + QLatin1String("/bin/qmlimportscanner"); + QString qmlImportScanner; + if (!options->qmlImportScannerBinaryPath.isEmpty()) { + qmlImportScanner = options->qmlImportScannerBinaryPath; + } else { + options->qtInstallDirectory + QLatin1String("/bin/qmlimportscanner"); #if defined(Q_OS_WIN32) - qmlImportScanner += QLatin1String(".exe"); + qmlImportScanner += QLatin1String(".exe"); #endif + } if (!QFile::exists(qmlImportScanner)) { fprintf(stderr, "qmlimportscanner not found: %s\n", qPrintable(qmlImportScanner)); diff --git a/src/widgets/styles/qfusionstyle.cpp b/src/widgets/styles/qfusionstyle.cpp index ba2b6b0ed9..e98f6edb8b 100644 --- a/src/widgets/styles/qfusionstyle.cpp +++ b/src/widgets/styles/qfusionstyle.cpp @@ -3232,7 +3232,7 @@ QSize QFusionStyle::sizeFromContents(ContentsType type, const QStyleOption *opti break; case CT_MenuItem: if (const QStyleOptionMenuItem *menuItem = qstyleoption_cast<const QStyleOptionMenuItem *>(option)) { - int w = newSize.width(); + int w = size.width(); // Don't rely of QCommonStyle's width calculation here int maxpmw = menuItem->maxIconWidth; int tabSpacing = 20; if (menuItem->text.contains(QLatin1Char('\t'))) diff --git a/src/widgets/styles/qstylesheetstyle.cpp b/src/widgets/styles/qstylesheetstyle.cpp index dd225fbec3..48d2e268b8 100644 --- a/src/widgets/styles/qstylesheetstyle.cpp +++ b/src/widgets/styles/qstylesheetstyle.cpp @@ -615,7 +615,7 @@ public: public: int features; QBrush defaultBackground; - QFont font; + QFont font; // Be careful using this font directly. Prefer using font.resolve( ) bool hasFont; QHash<QString, QVariant> styleHints; @@ -3211,7 +3211,7 @@ void QStyleSheetStyle::drawComplexControl(ComplexControl cc, const QStyleOptionC rule.drawRule(p, opt->rect); toolOpt.rect = rule.contentsRect(opt->rect); if (rule.hasFont) - toolOpt.font = rule.font; + toolOpt.font = rule.font.resolve(toolOpt.font); drawControl(CE_ToolButtonLabel, &toolOpt, p, w); } @@ -3514,7 +3514,7 @@ void QStyleSheetStyle::drawControl(ControlElement ce, const QStyleOption *opt, Q const QFont oldFont = p->font(); if (rule.hasFont) - p->setFont(rule.font); + p->setFont(rule.font.resolve(p->font())); if (rule.hasPosition() && rule.position()->textAlignment != 0) { Qt::Alignment textAlignment = rule.position()->textAlignment; @@ -3678,7 +3678,7 @@ void QStyleSheetStyle::drawControl(ControlElement ce, const QStyleOption *opt, Q subRule.configurePalette(&mi.palette, QPalette::HighlightedText, QPalette::Highlight); QFont oldFont = p->font(); if (subRule.hasFont) - p->setFont(subRule.font.resolve(p->font())); + p->setFont(subRule.font.resolve(mi.font)); else p->setFont(mi.font); @@ -4084,7 +4084,7 @@ void QStyleSheetStyle::drawControl(ControlElement ce, const QStyleOption *opt, Q subRule.configurePalette(&boxCopy.palette, QPalette::ButtonText, QPalette::Button); QFont oldFont = p->font(); if (subRule.hasFont) - p->setFont(subRule.font); + p->setFont(subRule.font.resolve(p->font())); boxCopy.rect = subRule.contentsRect(opt->rect); if (subRule.hasImage()) { // the image is already drawn with CE_ToolBoxTabShape, adjust rect here @@ -4171,7 +4171,7 @@ void QStyleSheetStyle::drawControl(ControlElement ce, const QStyleOption *opt, Q subRule.configurePalette(&tabCopy.palette, QPalette::WindowText, QPalette::Base); QFont oldFont = p->font(); if (subRule.hasFont) - p->setFont(subRule.font); + p->setFont(subRule.font.resolve(p->font())); if (subRule.hasBox() || !subRule.hasNativeBorder()) { tabCopy.rect = ce == CE_TabBarTabShape ? subRule.borderRect(r) : subRule.contentsRect(r); @@ -5035,8 +5035,12 @@ QSize QStyleSheetStyle::sizeFromContents(ContentsType ct, const QStyleOption *op bool nullIcon = hdr->icon.isNull(); const int margin = pixelMetric(QStyle::PM_HeaderMargin, hdr, w); int iconSize = nullIcon ? 0 : pixelMetric(QStyle::PM_SmallIconSize, hdr, w); - const QSize txt = subRule.hasFont ? QFontMetrics(subRule.font).size(0, hdr->text) - : hdr->fontMetrics.size(0, hdr->text); + QFontMetrics fm = hdr->fontMetrics; + if (subRule.hasFont) { + QFont styleFont = w ? subRule.font.resolve(w->font()) : subRule.font; + fm = QFontMetrics(styleFont); + } + const QSize txt = fm.size(0, hdr->text); nativeContentsSize.setHeight(margin + qMax(iconSize, txt.height()) + margin); nativeContentsSize.setWidth((nullIcon ? 0 : margin) + iconSize + (hdr->text.isNull() ? 0 : margin) + txt.width() + margin); |