summaryrefslogtreecommitdiffstats
path: root/src/widgets/kernel
Commit message (Collapse)AuthorAgeFilesLines
...
* Widgets/Stylesheets: compile without FEATURE_style_stylesheetChristian Ehrlicher2025-05-013-0/+6
| | | | | | | | | | | Make sure to not compile the stylesheet sources when FEATURE_style_stylesheet is disabled, also don't include the relevant headers in this case. Pick-to: 6.9 Fixes: QTBUG-136341 Change-Id: I4fc2de2fcba004b93140809ef79374401209f14a Reviewed-by: Axel Spoerl <[email protected]>
* Widgets/Stylesheets: Remove double negations for stylehseet featureChristian Ehrlicher2025-05-013-23/+23
| | | | | | | | | | Replace ifndef QT_NO_STYLE_STYLESHEET antipattern by if QT_CONFIG(style_stylesheet). Pick-to: 6.9 Task-number: QTBUG-136341 Change-Id: I8f5d5ff0b7b5cce010df167977214bc92a9443b7 Reviewed-by: Axel Spoerl <[email protected]>
* Widgets: remove some unused includesChristian Ehrlicher2025-05-012-17/+1
| | | | | | | | Remove some unused includes in source files. Pick-to: 6.9 Change-Id: I5c43fd10fa1a179664ad8cbf4988f9bdb96d8af8 Reviewed-by: Axel Spoerl <[email protected]>
* QLaoyut: remove check for QT_CONFIG(menubar)Christian Ehrlicher2025-05-011-22/+6
| | | | | | | | | | Even though the member is named 'menuBar', it's a plain QWidget. Also the setter are not guarded so the functionality should not be guarded too. Pick-to: 6.9 Change-Id: I5fa19ab955d9794aa3d344ba0cfc8a0a3d22b61e Reviewed-by: Axel Spoerl <[email protected]>
* QBoxLayout: Add ownership info to the QBoxLayout methodsAli Kianian2025-04-251-0/+12
| | | | | | Change-Id: I4fd08588b940dee286fce5c0243404e1a1c3367a Reviewed-by: Mats Honkamaa <[email protected]> Reviewed-by: Marco Bubke <[email protected]>
* Remove forward declaration of dead QUnifiedToolbarSurfaceTor Arne Vestbø2025-04-152-3/+0
| | | | | | | The class does not exist anymore. Change-Id: Ifb3d7624b22c86b4b460a595834e956bc458dc44 Reviewed-by: Volker Hilsheimer <[email protected]>
* QGestureManager::deliverEvents() - improve debug outputAxel Spoerl2025-04-101-6/+12
| | | | | | | | | | | | qDebug() why no target has been found for a gesture. Correct wrong function names in debug output. Use __FUNCTION__ macro instead of spelling function name out. Adapt QTest::ignoreMessage() calls in tst_gestures.cpp to also use the correct function name. Task-number: QTBUG-129754 Change-Id: Ifabf512215934ee984bcb8c9d0c2463342d77c07 Reviewed-by: David Faure <[email protected]>
* QTapGestureRecognizer: fix UB (invalid downcast) in recognize()Marc Mutz2025-03-281-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | The old code cast the event to QTouchEvent* ahead of checking that it actually is of a type() that suggests is-a QTouchEvent. I'm not sure this was UB, because we weren't dereferencing the result until after we checked type(). Then again, who am I to argue with compiler writers (= same people that write ubsan)? Says UBSan: qstandardgestures.cpp:402:29: runtime error: downcast of address 0x7fffedb894f0 which does not point to an object of type 'QTouchEvent' 0x7fffedb894f0: note: object is of type 'QEvent' ff 7f 00 00 c0 db 01 cf 99 7f 00 00 15 00 00 00 01 00 00 00 01 00 00 00 99 7f 00 00 b6 c4 14 f5 ^~~~~~~~~~~~~~~~~~~~~~~ vptr for 'QEvent' Fix my delaying the cast until after we know that event is-a QTouchEvent. All other recognize() overload already behaved correctly. As a drive-by, use auto (RHS contains the type) and mark the result const. Amends the start of the public history. Pick-to: 6.9 6.8 6.5 5.15 Change-Id: Ifa9e940232b93b2ecf666c35536519a8385c9800 Reviewed-by: Axel Spoerl <[email protected]>
* Cast NativeResourceForIntegrationFunction via QFunctionPointerTor Arne Vestbø2025-03-271-4/+4
| | | | | | | | | | | | To fix warnings with Xcode 16.3: /Users/torarne/dev/qt/qtbase/src/widgets/widgets/qtabbar.cpp:117:6: warning: cast from 'QPlatformNativeInterface::NativeResourceForIntegrationFunction' (aka 'void *(*)()') to 'SetContentBorderAreaEnabledFunction' (aka 'void (*)(QWindow *, unsigned long long, bool)') converts to incompatible function type [-Wcast-function-type-mismatch] 117 | (reinterpret_cast<SetContentBorderAreaEnabledFunction>(function))(q->window()->windowHandle(), identifier, q->isVisible()); | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Pick-to: 6.9 6.8 Change-Id: Ie7b5ace64c1aad5f970bc1a23e59c5724fcd92b5 Reviewed-by: Marc Mutz <[email protected]>
* QWidgetWindow: fix UB (invalid downcast) in Private::handleDragEnterEvent()Marc Mutz2025-03-262-3/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The handleDragEnterEvent() function is not only called for QEvent::DragEnter, but also, in handleDragMoveEvent(), for QEvent::DragMove, in which case the fully-derived event passed as an argument is a QDragMoveEvent, and not its subclass QDragEnterEvent. Code in Qt seems to assume that it's ok to cast an object down to a more-derived class than the most-derived dynamic type, as long as no extra state is being added between the two, but C++ does not chare that view. Says UBSan: qwidgetwindow.cpp:1000:38: runtime error: downcast of address 0x7ffe7b34c6e0 which does not point to an object of type 'QDragEnterEvent' 0x7ffe7b34c6e0: note: object is of type 'QDragMoveEvent' 00 00 00 00 e0 62 70 42 aa 7f 00 00 3d 00 00 00 00 00 00 00 00 00 00 00 00 c0 58 40 00 00 00 00 ^~~~~~~~~~~~~~~~~~~~~~~ vptr for 'QDragMoveEvent' Furtunately, handleDragEnterEvent() doesn't actually need its argument to be a QDragEnterEvent; QDragMoveEvent suffices, so we can just change the argument type back to QDragMoveEvent and remove the cast in handleDragMoveEvent(). Add a bit of \internal docs to describe the discrepancy between the function's name and argument type. Amends f8944a7f07112c85dc4f66848cabb490514cd28e. Picking all the way, because this is risk-less: Either the code compiles and then it works as before (minus the UB), or it doesn't compile. Pick-to: 6.9 6.8 6.5 5.15 Change-Id: I5be53b023d389902b43e9a896d074edea1c4ff2d Reviewed-by: Axel Spoerl <[email protected]>
* Remove 6.7 preliminary tag for QRhiWidgetLaszlo Agocs2025-03-181-5/+0
| | | | | | Pick-to: 6.9 6.8 Change-Id: Iab453b9c0cf4f158f9ca13294dcd053fb35daf93 Reviewed-by: Volker Hilsheimer <[email protected]>
* Only default top levels to Qt::WA_ContentsMarginsRespectsSafeAreaTor Arne Vestbø2025-03-182-2/+23
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When safe area margins are in play, such as on iOS and Android, or on macOS in 6.8 and above when the NSWindowStyleMaskFullSizeContentView styleMask has been set (manually or via Qt::ExpandedClientAreaHint in 6.9), then widgets with a layout will by default try to avoid the non- safe areas. This worked well as a safe default, ensuring widget applications filled the entire window with its background color, while constraining the layout of children to the safe area. However, for those that explicitly want to put content in the non-safe areas, by setting Qt::WA_ContentsMarginsRespectsSafeArea to false, the story was a bit cumbersome, as we set the attribute to true by default for all widgets. Meaning, any child widget put into the non-safe areas that itself had a layout (such as a push button) would also need the Qt::WA_ContentsMarginsRespectsSafeArea = false override. We now default Qt::WA_ContentsMarginsRespectsSafeArea to true only for top level widgets on creation, and leave it up to the user to manage the attribute for the other use-cases, as they then need to be in full control. [ChangeLog][QtWidgets] The Qt::WA_ContentsMarginsRespectsSafeArea attribute is no longer set by default for non-top-level widgets. Top level widgets still default to Qt::WA_ContentsMarginsRespectsSafeArea=true, so children are laid out in the safe areas, but overriding the attribute for the top level now allows placing widgets in the non-safe areas without also setting the Qt::WA_ContentsMarginsRespectsSafeArea attribute to false for every descendant widget that overlaps the non-safe area. Task-number: QTBUG-133215 Pick-to: 6.9 6.8 Change-Id: I7b1d420d730ee896ec2fb61aadacd94473dc9681 Reviewed-by: Axel Spoerl <[email protected]>
* Revert "Init QWidget::data to nullptr"Marc Mutz2025-03-121-1/+1
| | | | | | | | | | This reverts commit 58b9250aea0b1b41c8cbd1033149371a93a5b2c1. Reason for revert: This change was obsoleted by bcd29a9eab00c77bc402b9d4242f097d19c92044. Change-Id: I161dfeb471d23a6fdcbf547c1c559784581a5211 Reviewed-by: Volker Hilsheimer <[email protected]>
* Add QAccessible::LocationChanged to QWidgetEven Oscar Andersen2025-03-111-0/+6
| | | | | | | | | Issue the event when geometry has changed to match QML. Task-number: QTBUG-115926 Pick-to: 6.9 6.8 Change-Id: I31d87a2b07c1cbdb31063bdbf146f21310103798 Reviewed-by: Volker Hilsheimer <[email protected]>
* QWidget: init `data` in ctor, not Private::init()Marc Mutz2025-03-041-2/+1
| | | | | | | | | | | | | | | This should fix Coverity's hallucination that QWidget::data is used uninitialized, or, after 58b9250aea0b1b41c8cbd1033149371a93a5b2c1, dereferenced while it's still nullptr. Coverity-Id: 475552 Coverity-Id: 475551 Coverity-Id: 475550 Coverity-Id: 475549 Coverity-Id: 396828 Pick-to: 6.9 6.8 6.5 Change-Id: I49705b8bc44082fc68a59c2c98c4e37a6d841b19 Reviewed-by: Volker Hilsheimer <[email protected]>
* QWidget: Don't offset the clip region for windows using effectsChristian Ehrlicher2025-03-041-1/+1
| | | | | | | | | | | | | When a top-level widget has a graphic effect applied, QWidgetPrivate::clipToEffectiveMask() must not use the parent widget for the mask calculation as this prevents the loop below from bailing out in the first loop (w->isWindow()) and might mess up the clip region when there is a widget with a mask in the parent chain. Pick-to: 6.9 6.8 Fixes: QTBUG-131893 Change-Id: I5d5777e730bee309db21ad5eb65387d19321ee6c Reviewed-by: Volker Hilsheimer <[email protected]>
* QWidget: DRY the ctors, use ctor delegationMarc Mutz2025-03-031-7/+1
| | | | | | | | | | | | | | | | | | Don't repeat the body in the two QWidgets ctors, call one from the other instead. This will help fighting Coverity's hallucination that QWidget::data is used uninitialized, or, after 58b9250aea0b1b41c8cbd1033149371a93a5b2c1, dereferenced while it's still nullptr. Coverity-Id: 475552 Coverity-Id: 475551 Coverity-Id: 475550 Coverity-Id: 475549 Coverity-Id: 396828 Pick-to: 6.9 6.8 6.5 Change-Id: I1f9a8b93871143b420b9c8f247e49d57510a2379 Reviewed-by: Volker Hilsheimer <[email protected]>
* Style: pass widget to styleHint() where appropriateChristian Ehrlicher2025-03-021-1/+1
| | | | | | | | | | QStyle::styleHint() take the QWidget as optional third parameter. Add this to calls to styleHint() where appropriate. Task-number: QTBUG-2501 Pick-to: 6.9 6.8 Change-Id: I62aa251f7dd9d78178ea8aefc1e2882d3ac040be Reviewed-by: Volker Hilsheimer <[email protected]>
* Init QWidget::data to nullptrMarc Mutz2025-02-281-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | It's unconditionally set to &d->data in d->init(), but at least Coverity doesn't see it as that. Turn a potential uninit'ed value access into a proper nullptr deref, in case Coverity has a point. Not picking to older branches (at least not yet) in the unlikely case that this unearths something. Coverity-Id: 390797 Coverity-Id: 390790 Coverity-Id: 390785 Coverity-Id: 390783 Coverity-Id: 390775 Coverity-Id: 390774 Coverity-Id: 390771 Coverity-Id: 390765 Coverity-Id: 390762 Coverity-Id: 390751 Coverity-Id: 390737 Coverity-Id: 390734 Coverity-Id: 390727 Coverity-Id: 390724 Coverity-Id: 390707 Coverity-Id: 390706 Coverity-Id: 390700 Coverity-Id: 390693 Coverity-Id: 390692 Coverity-Id: 390690 Coverity-Id: 390684 Coverity-Id: 390680 Coverity-Id: 390677 Coverity-Id: 390675 Coverity-Id: 390669 Coverity-Id: 390662 Coverity-Id: 390660 Coverity-Id: 390659 Coverity-Id: 390657 Change-Id: Ieba218117d4bfdb4cdf5069211e9d12517b26d24 Reviewed-by: Volker Hilsheimer <[email protected]>
* Use QThread::isMainThread() in a few placesThiago Macieira2025-02-261-1/+1
| | | | | | | | | | | | | | | It's thread-safe, whereas trying to load qApp isn't in Qt 6.x (will be in 7.0) and dereferencing it to call QObject::thread() will probably never be. It's also faster, being a single function call instead of two or three. This is not an exhaustive search, it's just a few places I found while searching for QThread::instance(). Pick-to: 6.9 6.8 Change-Id: I3b4e1c75bb3966e2cd2dfffd79bfc8a40f6cf40b Reviewed-by: Ivan Solovev <[email protected]> Reviewed-by: Mårten Nordheim <[email protected]>
* Doc: Improve deprecation description for QApplication::fontMetrics()Andreas Eliasson2025-02-142-4/+8
| | | | | | | | | | | | Add a link to QFontMetrics, which provides more information about the differences between QFontMetrics and QFontMetricsF and why the latter is the preferred choice. Fixes: QTBUG-127528 Pick-to: 6.9 6.8 6.5 6.2 Change-Id: Ib5713a9d39bf312a6eae6b8b1a6d1dc1d47e25be Reviewed-by: Marcus Tillmanns <[email protected]> Reviewed-by: Christian Ehrlicher <[email protected]>
* Fix or remove broken and outdated external links in qtbase documentationDavid Boddie2025-02-081-1/+1
| | | | | | Change-Id: Ia78b3b16b89ab3f80d990b6e338b4a0f294ab1ed Pick-to: 6.8 6.9 Reviewed-by: Topi Reiniö <[email protected]>
* Fix crash cases where window container tries to touch destroyed windowJoni Poikelin2025-01-291-3/+9
| | | | | | | Fixes: QTBUG-133289 Pick-to: 6.9 6.8 6.5 Change-Id: I4b5a6ab12c32133d633e1bf11567119d52c1cb5a Reviewed-by: Tor Arne Vestbø <[email protected]>
* QWindowContainer: Improve docs to mention new change in behaviorDoris Verria2025-01-271-5/+7
| | | | | | | | | Specify that since 6.8 tab focus can transfer in and out of the embedded window if using a Qt Quick based window. Pick-to: 6.8 6.9 Change-Id: I21d04457ee79497431f889e261f1cb6bd9fd39ee Reviewed-by: Tor Arne Vestbø <[email protected]>
* QObjectPrivate: encode the version number in the constructor parametersThiago Macieira2025-01-272-12/+2
| | | | | | | | | | | | | | | | Instead of allowing the code to start and then possibly fail at runtime. This isn't a 100% sure solution because it's a function call. With lazy symbol binding on some OSes, the mistake won't be noticed until the function call is attempted. However, most OSes now resolve *all* calls at load time so they can mark the GOT (or equivalent) pages read-only, meaning the loading of the library will fail. qversiontagging_p.h is a more sure way in OSes / executable formats it works on. Change-Id: If7867a37256b7141001dfffd9bd299bb1bbd7c63 Reviewed-by: Marc Mutz <[email protected]>
* Don't pass along expose events for destroying QWidgetsTor Arne Vestbø2025-01-261-0/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | When closing a popup window on macOS, and the NSView needs display, for example due to the frame geometry having changed, the system will ask our NSView to display one last frame, via NSOrderOutAnimationProxyWindow initWithSnapshotOfWindow. If this happens during the close() that the QWidget destructor does, we no longer have a QWidget subclass to handle the corresponding paint event, so we'll end up flushing an empty frame, using that for the animation transition instead of the last valid frame of the widget. Worse, if the top level is using RHI to flush, the texture list might be stale, as there is currently no plumbing for a widget to tell QWidgetRepaintManager about it deleting a texture that was previously picked up and placed in the QPlatformTextureList. When this happens we end up crashing on dereferencing the stale texture. To mitigate these issues we now skip the expose event if the widget is already in ~QWidget. This potentially means the close animation will use a stale frame, but we can live with that. Pick-to: 6.9 6.8 6.5 Change-Id: Iabe1d97019923ee3a1a86039630095d00c966156 Reviewed-by: Volker Hilsheimer <[email protected]>
* Use old position to set window position after recreationMorteza Jamshidi2025-01-221-0/+2
| | | | | | | | | Like window state and visibility, the window position should also remain the same after the window is recreated. Fixes: QTBUG-128790 Change-Id: Iad8599da7ef83eff6a93f7f071e6b452491a0d87 Reviewed-by: Tor Arne Vestbø <[email protected]>
* Avoid dangling d-pointer deref in QWidgetWindow::handleMouseEventShawn Rutledge2025-01-201-0/+8
| | | | | | | | | | | | | | | | If you drag-and-drop a OpenGLWidget in Designer, the main window gets re-created when the OpenGLWidget is instantiated. So in general (in rare cases), at the end of QWidgetWindow::handleMouseEvent() we might have a different window, and therefore can't reliably call QWindowPrivate::maybeSynthesizeContextMenuEvent() without checking for a valid pointer. Amends 84a5f50c7766c99f62b22bb4388137e0aa8dd13d Pick-to: 6.9 Fixes: QTBUG-132912 Change-Id: I7b220b4daceab988aadabf9427ef6b2d5624e00d Reviewed-by: Friedemann Kleint <[email protected]>
* widget: clear WA_OutsideWSRange when needed in QWidgetPrivate::create()Liang Qi2025-01-161-3/+6
| | | | | | | | | which follows the behavior in QWidgetPrivate::setGeometry_sys(). Pick-to: 6.9 6.8 Fixes: QTBUG-129698 Change-Id: Ia85e9470111eea9e3392cdf38c3da2db232ef065 Reviewed-by: Tor Arne Vestbø <[email protected]>
* Remove unused qdebug.h include from private headersAhmad Samir2025-01-161-1/+0
| | | | | | Pick-to: 6.9 Change-Id: I03c951d03ab2410298878d0689c0d50bdd4eedf2 Reviewed-by: Mårten Nordheim <[email protected]>
* Replace all QPair/qMakePair with std::pair in qtbase/widgetsIsak Fyksen2025-01-091-2/+2
| | | | | | | | | | As a drive-by replace QList::append and operator<< with emplace_back, to avoid repeating value_type. Task-number: QTBUG-115841 Pick-to: 6.9 6.8 Change-Id: I6fb790f959b41b0feb49e3a0f0b6b3631e24a232 Reviewed-by: Marc Mutz <[email protected]>
* QApplication: don't create app_fonts() on destructionThiago Macieira2025-01-081-1/+2
| | | | | | | | | Minor optimization, will probably never be needed. Change-Id: I14568dffcb5d09668753fffd24efd10a3fedb21b Reviewed-by: Marc Mutz <[email protected]> Reviewed-by: Volker Hilsheimer <[email protected]> Reviewed-by: Ahmad Samir <[email protected]>
* QRhiWidget: mark (Private&, parent, flags) ctor explicitMarc Mutz2025-01-031-1/+1
| | | | | | | | | | Found in API-review. Amends 8386dfee05d35057836f93d182ef96674a6fd11e. Pick-to: 6.9 Change-Id: I5ad063b17356f75084655f1af353ba34a5deb4bf Reviewed-by: Volker Hilsheimer <[email protected]>
* Replace qgetenv() calls converted to QString with qEnvironmentVariable()Thiago Macieira2025-01-011-4/+4
| | | | | | | | It's slightly more efficient. Pick-to: 6.9 Change-Id: Id5ac04fc27eee108c8e5fffd786c3d5f793a0a9d Reviewed-by: Ahmad Samir <[email protected]>
* QBoxLayout: don't crash on passing invalid indexChristian Ehrlicher2024-12-181-4/+7
| | | | | | | | | | | Passing an invalid index gives an assertion in debug mode and crashes in release mode due to an out-of-bounds access. Fix it by appending the given widget (same as passing a negative index which is documented). Pick-to: 6.9 6.8 6.5 6.2 Fixes: QTBUG-130275 Change-Id: Id0c245e185acc36e5d07cea1d22619bb0e9eee07 Reviewed-by: Richard Moe Gustavsen <[email protected]>
* Q*Application: move the compressEvent() virtual to the Private classThiago Macieira2024-12-134-1/+12
| | | | | | | | | | | | | | | | | | One of the parameters is the QPostEventList, which is declared in qthread_p.h: class QPostEventList : public QList<QPostEvent> and is thus private API anyway. This also requires the ELFVERSION: token in qthread_p.h to avoid marking every class derived from Q*Application as needing private Qt ABI. We can't remove the virtual in Qt 6, so we keep the fallback implementations to just forward to the Private::compressEvent() call. I've elected to mark the QApplication's override as final. Change-Id: I49a46f42e62bcaf7db69fffd12a664d8720bbe46 Reviewed-by: Ivan Solovev <[email protected]> Reviewed-by: Thiago Macieira <[email protected]>
* QWidget::mapTo()/mapFrom(): Do not crash if parent argument is invalidEirik Aavitsland2024-12-121-5/+8
| | | | | | | | | | | | | | | These functions iterate through the parent hierarchy until the widget given as argument is found. If never found, the code would assert (in debug mode) or just silently crash (in release mode). No need to bring down the entire application just because some widget coordinate calculation is off. Instead, just emit a qWarning and return cleanly. Task-number: QTBUG-132072 Pick-to: 6.9 6.8 Change-Id: I4d13f46037cdcf855f76e040f941a8a7050ab12b Reviewed-by: Richard Moe Gustavsen <[email protected]>
* QWidgetWindow: send QContextMenuEvent even after accepted mouse pressShawn Rutledge2024-12-101-1/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | It would be more consistent if we could rely on the accepted state of the original QMouseEvent to decide whether to follow up with a QContextMenuEvent; but not all Qt widgets call ignore() on unhandled mouse events, both in Qt and in external libraries and applications (including some from KDE). So we should at least wait until Qt 7 to make this a requirement. It seems sensible to move the check into QWindow::event() rather than trying to distinguish the window type in maybeSynthesizeContextMenuEvent(). We merely output a categorized log message to indicate when the legacy behavior is in effect. Amends 84a5f50c7766c99f62b22bb4388137e0aa8dd13d [ChangeLog][QtWidgets] If your QWidget subclass depends on receiving QContextMenuEvent, and also handles mouse events directly, we recommend that you call ignore() on unhandled mouse events (such as right-button events). In Qt 7, we plan to stop sending QContextMenuEvent if the triggering mouse event is accepted. Fixes: QTBUG-132066 Pick-to: 6.9 Change-Id: I454813dab4c387112f161fc28a0ee94570013afa Reviewed-by: Volker Hilsheimer <[email protected]> Reviewed-by: Mitch Curtis <[email protected]>
* Move QContextMenuEvent synthesis from QWidgetWindow to QWindowShawn Rutledge2024-12-071-31/+32
| | | | | | | | | | | | | | | | | | | | | | | | ...and only if the original mouse event is not accepted. To that end, QGraphicsView must setAccepted(false) if the graphics scene did not accept the QGraphicsSceneMouseEvent. So a widget or a Qt Quick item or handler can handle the mouse events directly, to provide a consistent context-menu experience across platforms (for example to handle the press-drag-release gesture), but the fallback pattern follows the platform behavior. QWidgetWindow::handleMouseEvent() picks the receiver in its own way: often a leaf widget. It sets qt_last_mouse_receiver, so QWidgetWindow::handleContextMenuEvent() can deliver a mouse-originating QContextMenuEvent to the same receiver. A keyboard-originating QContextMenuEvent is delivered to the focus widget instead, as before. As a drive-by: fix an awkward word in qCDebug output. Task-number: QTBUG-93486 Change-Id: I4c1499120851a899acf2d7d4adaedaf9f42c3126 Reviewed-by: Mitch Curtis <[email protected]> Reviewed-by: Jan Arve Sæther <[email protected]>
* Add widgetAdded signal for QStackedWidget and QStackedLayoutDheerendra Purohit2024-12-022-0/+13
| | | | | | | | | | | | | | | | Currently, there is no signal provided when a widget is added or inserted into QStackedWidget or QStackedLayout. Emit a signal whenever a widget is added or inserted into QStackedWidget or QStackedLayout. [ChangeLog][QtWidgets][QStackedWidget] The widgetAdded() signal emits whenever a widget is added or inserted into QStackedWidget or QStackedLayout. Fixes: QTBUG-122748 Change-Id: I3bf658346a5881665214a8d8f77975aa10e497c0 Reviewed-by: Volker Hilsheimer <[email protected]>
* fix QApplciation with a QML popupWindowLiu Heng2024-11-301-7/+4
| | | | | | | | | | | | | Since 6.8, QML has popupWindow. When in popupModeMode, it does not necessarily have a popupWidget. Not checking whether popWidget is nullptr will cause the program to crash. Fixes: QTBUG-131664 Pick-to: 6.8 Change-Id: I624b62ef7185f0ab35215c2c34b0d6e9c80539a0 Reviewed-by: Tor Arne Vestbø <[email protected]>
* Add Qt::Orientations based flip and flipped functionsAllan Sandfeld Jensen2024-11-291-1/+1
| | | | | | | | Is easier to read and more bool-trap safe. Old form header deprecated from 6.10 Fixes: QTBUG-129575 Change-Id: Id785b9ce159007ce745c04120b2112c8bb9b0802 Reviewed-by: Volker Hilsheimer <[email protected]>
* Create qdoc macros for C++ class docs 2.1: qHash()Marc Mutz2024-11-271-3/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | Add a family of qdoc macros to document the various qHash() overloads we have. This patch does not change the \relates of the qHash() functions, they remain as inconsistent as they have been. Created QTBUG-129815 to clean things up. Since this author expects the \relates to change in the future, there are different \qhash commands, and all except \qhashbuiltin take the class name as an argument, for use in a centrally-choreographed fix for QTBUG-129815. As drive-by's, fix: - missing documentation about Key having to support qHash() in the associative Qt containers - drop noexcept and default arguments from \fn lines that needed to have their argument names changed - move the QStringView overload from qhash.cpp to qstringview.cpp (as it \relates to the former) Fixes: QTBUG-129574 Pick-to: 6.8 6.5 Change-Id: I8e8c2edc27422cbe5823f56baf3a24d7f7050836 Reviewed-by: Ivan Solovev <[email protected]> Reviewed-by: Jaishree Vyas <[email protected]>
* QCoreApplication: replace threadRequiresCoreApplication()Thiago Macieira2024-11-261-2/+3
| | | | | | | | | | | | | | | | | With a direct access to the threadData's variable. Amends commit 10c529b08de7cd55b4c3e3654464119246498273 ("Add a way for auxiliary threads to handle events without CoreApp", Qt 5.6), which introduced QDaemonThread, for QtDBus use. We don't need to get the QThreadData from TLS, because we are processing events for an object associated with that particular thread. This removes the only use of QThreadData::current(false) in all of Qt. Refactoring in the next commit(s). Change-Id: Ica2bab556bd431519a1bfffd859911ea7daf062f Reviewed-by: Fabian Kosmale <[email protected]> Reviewed-by: Ahmad Samir <[email protected]>
* Introduce Qt::ExpandedClientAreaHintTor Arne Vestbø2024-11-251-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The hint requests that the window's client area is expanded to fill parts of the window that might be (partially) covered by, or conflicting with, other (system) UI elements, such as the window's title bar, resize controls, or a status bar. The safe area margins of the window will reflect any areas that may have conflicting UI elements. If the client area is expanded into the area previously covered by the frame margins, the frame margins are reduced accordingly, as the frame margins represent the non-client-area parts of the window. This new flag replaces, and overlaps in value, with the existing Qt::MaximizeUsingFullscreenGeometryHint, as the latter was added to cover this exact use-case for mobile platforms. Now that we have the use-case on desktop platforms as well we want to use a more generic flag, so the old flag has been deprecated. Semantically, on iOS and Android, without the flags set, the window can be seen as being maximized to take up the entire screen, but with a frameMargin() that reflects the system status bar and resize controls. That's not technically how we implement things right now, but this is an implementation detail that will be changed in a follow-up. On macOS the flag maps to NSWindowStyleMaskFullSizeContentView, and on Windows we have an implementation cooking that uses the DwmExtendFrameIntoClientArea function. Task-number: QTBUG-127634 Change-Id: I9b6863b1550ccc056c16bce235d87b26a7d239b9 Reviewed-by: Assam Boudjelthia <[email protected]> Reviewed-by: Wladimir Leuschner <[email protected]>
* Add public QWindow API for safe area marginsTor Arne Vestbø2024-11-251-7/+4
| | | | | | | | | | | | | The margins are exposed as a simple QMargins, as this is covers the primary use-cases sufficiently at this point. A Q_PROPERTY is not added, as this would conflict with the explicit Qt Quick API that will also be added. Task-number: QTBUG-125374 Change-Id: I504c3000473de0b09272aa5a3e58ebf9a41aa942 Reviewed-by: Volker Hilsheimer <[email protected]> Reviewed-by: Assam Boudjelthia <[email protected]>
* QRhiWidget: Add a protected constructorKaj Grönholm2024-11-193-6/+27
| | | | | | | | | This can be useful for QRhiWidget subclasses with PIMPL. Also add Q_WIDGETS_EXPORT for QRhiWidgetPrivate. Change-Id: Idec480454dca59313f8baaa8d6369cb4a85ea567 Reviewed-by: Volker Hilsheimer <[email protected]> Reviewed-by: Laszlo Agocs <[email protected]>
* Fix ubsan warning of illegal cast and illegal method callAllan Sandfeld Jensen2024-11-132-6/+6
| | | | | | | | | Avoid casting an event to a type it does not have. Instead use a static accessor class. Pick-to: 6.8 Task-number: QTBUG-99563 Change-Id: Ideb11779b1510cd10a27fb8bc40bcc8e4849bf15 Reviewed-by: Marc Mutz <[email protected]>
* QWidget: clamp own rect in pointInsideRectAndMaskJohannes Grunenberg2024-11-111-3/+9
| | | | | | | | | | | | The rect of an empty widget (i.e. 0 width/height) will, after adjusting by -1, be invalid as it will have a width/height of -1. In turn, calling contains(p) on that rect can return true even though the rect is empty. Fixes: QTBUG-131001 Pick-to: 6.8 6.8.1 Change-Id: I604f5942589f1c1079cae90bd0d3b104344d2c55 Reviewed-by: Volker Hilsheimer <[email protected]> Reviewed-by: David Faure <[email protected]>
* QWidget: delete 'extra' in dtorChristian Ehrlicher2024-11-111-0/+1
| | | | | | | | | | | | | | | Call d->deleteExtra() in dtor of QWidget to make sure it's cleaned up before QWidgetPrivate calls it which might access the already deleted QWidget through deleteTLSysExtra() / QWindowContainer::toplevelAboutToBeDestroyed(q). Amends 006cbf658ea1f5986bbe1baafa7c146780320661. Pick-to: 6.8 6.8.1 Task-number: QTBUG-130932 Change-Id: I9109072a457cc01abd5d1b4e844a3ed3309d942b Reviewed-by: Tor Arne Vestbø <[email protected]> Reviewed-by: Volker Hilsheimer <[email protected]>