summaryrefslogtreecommitdiffstats
path: root/src/widgets/graphicsview
Commit message (Collapse)AuthorAgeFilesLines
* Remove redundant qtimer.h includesAhmad Samir7 days2-2/+0
| | | | | | | | | | | | | | If QTimer isn't used in the file where it's included, remove the include. Fix files that depended on transitive includes. QMacPanGestureRecognizer: drive by change: classes inheriting from QObject should have Q_OBJECT macro in the definition. Change-Id: Ia8d71f4195a1ca643c9fcb14db41877413348d98 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* QGraphicsProxyWidget: use focus abstraction instead of focus_next/prevAxel Spoerl2024-03-181-5/+5
| | | | | | | | | | | Focus abstraction in QWidgetPrivate makes direct access to QWidget::focus_next and focus_prev an antipattern. Remove usage. Task-number: QTBUG-121478 Change-Id: I741e6875e686a9cfb4e6a113e7575c911a38e80c Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* QDoc: Drop default arguments from some \fn documentation stringsPaul Wicking2024-03-131-1/+1
| | | | | | | | | | | | | | | | | | | In the \fn commands for a limited number of methods in the documentation for Testlib and Widgets, `= 0` is passed as default argument instead of `= Qt::KeyboardModifiers()`. Until QDoc with Clang 17, inclusive, QDoc generated the correct signature. However, with Clang 18, QDoc outputs `= 0` in the documentation. While strictly speaking still correct, this change impacts the documentation negatively in terms of readability. Dropping the default argument from the \fn command ensures that QDoc generates the right signature with both Clang 17 and Clang 18. Task-number: QTBUG-123130 Pick-to: 6.7 Change-Id: I94ccec2f2c9a02241095fb5b18feb74aa55f97e1 Reviewed-by: Andreas Eliasson <andreas.eliasson@qt.io> Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
* Fix -Wimplicit-fallthrough for clangTim Blechmann2024-03-011-0/+1
| | | | | | | | | | | | | | | | | | | Clang's `-Wimplicit-fallthrough` warnings are a little stricter than gcc's interpretation: switch (i) { case 0: foo(); case 4: break; } While gcc accepts the implicit fallthrough, if the following statement is a trivial `break`, clang will warn about it. Pick-to: 6.7 Change-Id: I38e0817f1bc034fbb552aeac21de1516edcbcbb0 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Increase precision for QGraphicsView::AnchorUnderMouseThorbjørn Lindeijer2024-01-221-7/+6
| | | | | | | | | | | | | | | | | | * Use a more precise view center for views with odd width/height * Use the QPointF version of mapToScene to avoid rounding * Round instead of truncate when setting scroll bar values These changes increase the precision of AnchorUnderMouse, which is important when for example wheel scrolling is used to change the scale of the view. Without these changes, the view shifts slightly with each change in the transform. [ChangeLog][QtWidgets][QGraphicsView] Increase precision for QGraphicsView::AnchorUnderMouse and QGraphicsView::centerOn Pick-to: 6.6 6.7 Task-number: QTBUG-96879 Change-Id: I8199196c671e4aa96732f382e8057468f676b8d7 Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
* Widgets: pass widget to QStyle::pixelMetric()Christian Ehrlicher2024-01-162-3/+3
| | | | | | | | | | | | Make sure to pass the widget to QStyle::pixelMetric() as some styles might use this (e.g. the new windows styles) to determine the correct pixel metric. Pick-to: 6.7 6.6 6.5 6.2 Task-number: QTBUG-1857 Change-Id: I5c32f5af8b284749732b610e56b4e3d8c8ed1946 Reviewed-by: Axel Spoerl <axel.spoerl@qt.io> Reviewed-by: David Faure <david.faure@kdab.com>
* Doc: fix typo in QGraphicsView::rubberBandRect() method documentationDavid Faure2024-01-081-1/+1
| | | | | | | | outise -> outside Pick-to: 6.7 Change-Id: I143430b3c6661cf5259a09ffa64b74a220e2b979 Reviewed-by: Paul Wicking <paul.wicking@qt.io>
* Doc: Fix \fn template arguments for Qt WidgetsTopi Reinio2023-11-181-1/+1
| | | | | | | | | Upcoming changes to QDoc require accurate definition for template arguments in \fn commands. Task-number: QTBUG-118080 Change-Id: I3a193ca69a911ee2f62e7663aaf4c032a35ee5dd Reviewed-by: Luca Di Sera <luca.disera@qt.io>
* Fix warning for 32bit buildsVolker Hilsheimer2023-11-011-1/+1
| | | | | | | | | | | | When building for 32bit platforms (e.g. Android armv7a), then printing qsizetype value using printf's %lld format generates a warning because qsizetype is just an int. This breaks the build, and can't be fixed by using another placeholder without producing a warning on 64bit builds. So fix it by casting the qsizetype always to 64bit signed int. Change-Id: Ie7c0fa8b3a0fe6366ce6fd5b2947f42a3e67c381 Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io> Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
* QGraphicsAnchorLayout: remove a redundant member containerAhmad Samir2023-10-181-2/+3
| | | | | | | | The m_children container isn't used at all, so remove it. Spotted by Volker Hilsheimer. Change-Id: I79db1f77c0e4caf8ebab1573a82e07396a6a806b Reviewed-by: Christian Ehrlicher <ch.ehrlicher@gmx.de>
* QGraphicsAnchorLayout: make a member container constAhmad Samir2023-10-172-3/+3
| | | | | | | | | | The m_edges container isn't changed after it's initialized in the constructor; so make it const. This amends commit 641bccce2a80b2a7268c3b8409bdc957b9a510b5. Change-Id: I387eb2562475bc4910700d48f67303b0a5f80ccd Reviewed-by: Christian Ehrlicher <ch.ehrlicher@gmx.de>
* Include what you need: <QPointer>Marc Mutz2023-10-123-0/+6
| | | | | | | | | | | | | | | | | | | | | | | All these TUs relied on transitive includes of qpointer.h, maybe to a large extent via qevent.h, though, given that qevent.h is more or less the only public QtBase header that includes qpointer.h, something else seems to be at play here. Said qevent.h actually needs QPointer in-name-only, so a forward declaration would suffice. Prepare for qevent.h dropping the include. The algorithm I used was: If the TU mentions 'passiveGrabbers', the name of the QEvent function that returns QPointers, and the TU doesn't have qpointer.h included explicitly, include it. That may produce False Positives, but better safe than sorry. Otherwise, in src/, add an include to all source and header files which mention QPointer. Exception: if foo.h of a foo.cpp already includes it, don't include again. Task-number: QTBUG-117670 Change-Id: I3321cccdb41ce0ba6d8a709cea92427aba398254 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* QGraphicsAnchorLayout: compile with QT_NO_FOREACHAhmad Samir2023-10-081-19/+9
| | | | | | | | | | | | | | | The m_edges container isn't changed after it's initialized in the constructor (in a later commit I'll make this container const, so as to keep this commit backport-able), and it isn't changed by the loop. Port all loops over m_edges to ranged-for. Remove "#undef QT_NO_FOREACH" from the source file, as that was the only usage of foreach in it. And remove that source file from NO_PCH_SOURCES. Pick-to: 6.6 6.5 Task-number: QTBUG-115803 Change-Id: I9cfc0c95865cbc7415dbecc82388c64c65ded4be Reviewed-by: Christian Ehrlicher <ch.ehrlicher@gmx.de>
* Tidy up qgraphicsview: use nullptr moreAnton Kudryavtsev2023-09-081-1/+1
| | | | | | Change-Id: Ie4d2b64175cba12e884260455814774bce8c8787 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io> Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* QGraphicsScene: use const methods moreAnton Kudryavtsev2023-09-081-1/+1
| | | | | | | Avoid unnecessary detach. Change-Id: I206a7df677119ec309c6c176de881469db057165 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Mark QtWidgets as free of Q_FOREACH, except where it isn'tMarc Mutz2023-08-091-0/+2
| | | | | | | | | | | | | | | | | | The density of Q_FOREACH uses is high here, too high for this author to tackle in a short amount of time. But they're concentrated in just a few TUs, so pick a different strategy: Mark the whole library with QT_NO_FOREACH, to prevent new uses from creeping in, and whitelist the affected TUs by #undef'ing QT_NO_FOREACH locally, at the top of each file. For TUs that are part of a larger executable, this requires these files to be compiled separately, so add them to NO_PCH_SOURCES (which implies NO_UNITY_BUILD_SOURCES, too). Created QTBUG-115803 to keep track of this. Task-number: QTBUG-115803 Change-Id: Ib5d6192632d98bdcc6625a9a14e05d13bb7f759b Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
* Doc: Remove duplicate wordsAndreas Eliasson2023-02-282-2/+2
| | | | | | Change-Id: Ia7a38a1035bd34d00f20351a0adc3927e473b2e7 Pick-to: 6.5 6.4 6.2 Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
* QGraphicsView: remove even more vestiges of QtDeclarative1Giuseppe D'Angelo2023-01-183-12/+6
| | | | | | | | The field is never set and thus never used meaningfully. Change-Id: Ia45afa6339d38316d76766a736ba8cb1ce9f58fa Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* QGraphicsItem: remove QtDeclarative 1 vestigesGiuseppe D'Angelo2023-01-183-127/+0
| | | | | | | This code is completely unused at this point. Change-Id: Id0ecd0125e59b08904ae722ad4319c5ff15620a6 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Add resetTransform to see also of setTransform in QGraphicsViewLeon Zhang2023-01-061-1/+1
| | | | | | Pick-to: 6.5 6.4 Change-Id: I4a38d44f2109f8b92069651c23717da02f5b3091 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* QGraphicsProxyWidget: Don't unnecessarily check focusWidget twiceLu YaNing2022-12-211-1/+1
| | | | | | | Amends commit bf5011815d917e07ae7cf45e5768f1775f70e90d Change-Id: I18a8d26b08b4035d7a76fc51873696590292b181 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Support stereoscopic rendering with QGraphicsViewKristoffer Skau2022-12-012-113/+142
| | | | | | | | | | | | | | | | This patch adds a manual test and the required work in graphicsview and qwidget private apis to support stereoscopic rendeing. Basically it works by doing the drawing in QGraphicsView::paintEvent twice, once for each buffer. This way the scene items are rendered to both buffers. There's also an update to resolvement in QOpenGLWidgetPrivate so that multisampling works correctly. [ChangeLog][Widgets][QGraphicsView] Added support for stereoscopic rendering. Task-number: QTBUG-64587 Change-Id: I20650682daa805b64fe7f0d2ba086917d3f12229 Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
* QGraphicsView: fix jumping graphic items when dragging out of viewTaras Kachmaryk2022-11-261-22/+29
| | | | | | | | | | | | | | | | | | | | | The algorithms for calculating the scene's position within the view did not compensate for scrollbars showing. The scrollbars should be ignored when positioning hte scene within the view, as alignment only cares about the positioning of the scene when the view is larger than the scene anyway. Add a test case that verifies that items don't jump up or down when dragging horizontally, and not left or right when dragging vertically. Mark variables in the modified function as const where applicable to make it easier to follow the code. Done-with: Volker Hilsheimer <volker.hilsheimer@qt.io> Fixes: QTBUG-46757 Change-Id: If205637dfe124e0034f68201b23f174d6863084d Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Port from container::count() and length() to size() - V5Marc Mutz2022-11-031-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is a semantic patch using ClangTidyTransformator as in qtbase/df9d882d41b741fef7c5beeddb0abe9d904443d8, but extended to handle typedefs and accesses through pointers, too: const std::string o = "object"; auto hasTypeIgnoringPointer = [](auto type) { return anyOf(hasType(type), hasType(pointsTo(type))); }; auto derivedFromAnyOfClasses = [&](ArrayRef<StringRef> classes) { auto exprOfDeclaredType = [&](auto decl) { return expr(hasTypeIgnoringPointer(hasUnqualifiedDesugaredType(recordType(hasDeclaration(decl))))).bind(o); }; return exprOfDeclaredType(cxxRecordDecl(isSameOrDerivedFrom(hasAnyName(classes)))); }; auto renameMethod = [&] (ArrayRef<StringRef> classes, StringRef from, StringRef to) { return makeRule(cxxMemberCallExpr(on(derivedFromAnyOfClasses(classes)), callee(cxxMethodDecl(hasName(from), parameterCountIs(0)))), changeTo(cat(access(o, cat(to)), "()")), cat("use '", to, "' instead of '", from, "'")); }; renameMethod(<classes>, "count", "size"); renameMethod(<classes>, "length", "size"); except that the on() matcher has been replaced by one that doesn't ignoreParens(). a.k.a qt-port-to-std-compatible-api V5 with config Scope: 'Container'. Added two NOLINTNEXTLINEs in tst_qbitarray and tst_qcontiguouscache, to avoid porting calls that explicitly test count(). Change-Id: Icfb8808c2ff4a30187e9935a51cad26987451c22 Reviewed-by: Ivan Solovev <ivan.solovev@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
* Replace usages of Q_CLANG_QDOC with Q_QDOCLuca Di Sera2022-10-213-3/+3
| | | | | | | | | | | | | | | | | | | | | | | To allow the user to customize the C++ code that QDoc sees, so as to be able to work-around some limitations on QDoc itself, QDoc defines two symbols: Q_QDOC and Q_CLANG_QDOC, both of which are "true" during an entire execution of QDoc. At a certain point in time, QDoc allowed the user the choice between a custom C++ parser and a Clang based one. The Q_QDOC symbol would always be defined while the Q_CLANG_QDOC symbol would be defined only when the Clang based parser was chosen. In more recent times, QDoc always uses a Clang based parser, such that both Q_CLANG_QDOC and Q_QDOC are always defined, making them equivalent. To avoid using different symbols, and the possible confusion and fragmentation that derives from it, all usages of Q_CLANG_QDOC are now replaced by the equivalent usages of Q_QDOC. Change-Id: I5810abb9ad1016a4c5bbea99acd03381b8514b3f Reviewed-by: Kai Koehne <kai.koehne@qt.io>
* Layouts docs: pass parent widget in the ctorAhmad Samir2022-10-212-6/+13
| | | | | | | | | This is a follow up from commit 1e904ab342c1aaa; changing more documentation to pass a widget * in the ctor of a layout, rather than creating a parent-less layout then calling setLayout(). Change-Id: I4fc59c6cfa46ccd279a153acd67335a6daf22ff9 Reviewed-by: Jan Arve Sæther <jan-arve.saether@qt.io>
* Port from qAsConst() to std::as_const()Marc Mutz2022-10-117-54/+54
| | | | | | | | | | | | | | | | We've been requiring C++17 since Qt 6.0, and our qAsConst use finally starts to bother us (QTBUG-99313), so time to port away from it now. Since qAsConst has exactly the same semantics as std::as_const (down to rvalue treatment, constexpr'ness and noexcept'ness), there's really nothing more to it than a global search-and-replace, with manual unstaging of the actual definition and documentation in dist/, src/corelib/doc/ and src/corelib/global/. Task-number: QTBUG-99313 Change-Id: I4c7114444a325ad4e62d0fcbfd347d2bbfb21541 Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
* Port from container.count()/length() to size()Marc Mutz2022-10-047-44/+44
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is semantic patch using ClangTidyTransformator: auto QtContainerClass = expr(hasType(namedDecl(hasAnyName(<classes>)))).bind(o) makeRule(cxxMemberCallExpr(on(QtContainerClass), callee(cxxMethodDecl(hasAnyName({"count", "length"), parameterCountIs(0))))), changeTo(cat(access(o, cat("size"), "()"))), cat("use 'size()' instead of 'count()/length()'")) a.k.a qt-port-to-std-compatible-api with config Scope: 'Container'. <classes> are: // sequential: "QByteArray", "QList", "QQueue", "QStack", "QString", "QVarLengthArray", "QVector", // associative: "QHash", "QMultiHash", "QMap", "QMultiMap", "QSet", // Qt has no QMultiSet Change-Id: Ibe8837be96e8d30d1846881ecd65180c1bc459af Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* QtWidgets: Use the default constructor of QString and appendMate Barany2022-09-271-1/+3
| | | | | | | | | | | | | Addressing a comment from the review of QTBUG-98434: instead of the QL1S constructor use the default constructor and append "Path: "_L1. With the QL1S constructor capacity == size == rhs.capacity and the very next append is guaranteed to reallocate. In the other case the capacity will grow according to the growth strategy. Task-number: QTBUG-103100 Change-Id: Ifcc1c22a59739c6384b363471dbb27d6a978e306 Reviewed-by: Marc Mutz <marc.mutz@qt.io>
* QGraphicsScene::render: fix int/qsizetype mismatchThiago Macieira2022-08-081-3/+3
| | | | | | | | | | | Also suppresses the warning that we may be trying to allocate -1 items in call to new[]. Task-number: QTBUG-105388 Task-number: QTBUG-105471 Pick-to: 6.2 6.3 6.4 Change-Id: Ie4bb662dcb274440ab8bfffd17096d3606354647 Reviewed-by: Marc Mutz <marc.mutz@qt.io>
* QWidget: use WA_InputMethodEnabled when ImEnabled is not implementedRichard Moe Gustavsen2022-07-081-1/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | In Qt 6.3, a check for WA_InputMethodEnabled was removed in QWidget, to support IM queries also for read-only widgets (7c6e4af48). This caused a regression on iOS, which made the input panel open for widgets that didn't support IM at all. A patch was merged that solved the regression (3b12305575), but it didn't take the widget attribute into account. Since not doing so has the potential to cause regressions, this patch will modify the affected code once more, so that we instead fall back to test WA_InputMethodEnabled when ImEnabled is not implemented. This will match closely to the way ImEnabled was implemented in Qt 6.2. Since we, with this change, now require that either ImEnabled or WA_InputMethodEnabled is set, our own input widgets will fail to support IM text selection when they're read-only, since they actually don't implement ImEnabled. This patch will therefore also make sure that we do so. Task-number: QTBUG-104527 Pick-to: 6.4 6.3 Change-Id: I70ad910aec38d0a74f4dd7d3115d3c45c16d2b3b Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* qgraphicsitem_cast: replace 0 with nullptrMarc Mutz2022-07-021-2/+2
| | | | | | | | | While headerscheck doesn't detect this (generic code), this might trigger warnings in user code. Pick-to: 6.4 6.3 6.2 5.15 Change-Id: I6183323d0a1c73b021699d4c4afa2d1fcf71aad2 Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
* QGraphicsScene: respect that items can override selection changesVolker Hilsheimer2022-06-201-3/+8
| | | | | | | | | | | | | | | | | | | | | | | | | QGraphicsItems may override itemChange to prevent certain attribute changes. Overriding ItemSelectedChange this way is explicitly documented to be allowed. However QGraphicsScene::clearSelection did not test whether items were in fact deselected after the call to setSelection, and always cleared the stored set of selected items. Fix this by checking the actual selected state of the item as we iterate over them, and store those items that are still selected in a set that becomes the new selectedItems set (which will be empty if no item overrides, which is the default). Add a test that also checks that clearing the selection emits the selectionChanged signal correctly (and does not if all selected items block being deselected). Fixes: QTBUG-85474 Pick-to: 6.4 6.3 6.2 Change-Id: I665afc132876e02e6e1061b7be37f4f6e4be418f Reviewed-by: Axel Spoerl <axel.spoerl@qt.io> Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
* Fix improper moc includes inside the Qt namespaceThiago Macieira2022-06-191-2/+2
| | | | | | Pick-to: 6.3 6.4 Change-Id: Id0fb9ab0089845ee8843fffd16fa1b1413fd0d41 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Fix typos in docs and commentsKai Köhne2022-06-153-4/+4
| | | | | | | | | Found by codespell Pick-to: 6.4 Change-Id: Ie3e301a23830c773a2e9aff487c702a223d246eb Reviewed-by: Nicholas Bennett <nicholas.bennett@qt.io> Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* Doc: Remove \target TransformationsKai Köhne2022-06-141-1/+0
| | | | | | | | | The section is already called Transformations. Making it a target just causes issues in other contexts. Pick-to: 6.4 Change-Id: I8dc65bd3254238e51a649f926cd066dfcbe9500d Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
* Use SPDX license identifiersLucie Gérard2022-05-1653-2014/+106
| | | | | | | | | | | | | Replace the current license disclaimer in files by a SPDX-License-Identifier. Files that have to be modified by hand are modified. License files are organized under LICENSES directory. Task-number: QTBUG-67283 Change-Id: Id880c92784c40f3bbde861c0d93f58151c18b9f1 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Lars Knoll <lars.knoll@qt.io> Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
* QWidgetTextControl: port to new-style connects (faster)David Faure2022-05-102-13/+10
| | | | | | | | | | | | | | | This speeds up creating a QGraphicsTextItem by 14% in an optimized build Before: 0.070 msecs per iteration After: 0.060 msecs per iteration Those connects were showing up when profiling, because of the string parsing that is necessary when using SIGNAL/SLOT macros. The stacktrace was connect() => decodeMethodSignature() => argumentTypesFromString() => QArgumentType constructor => qMetaTypeInternal(const char*). Pick-to: 6.3 6.2 5.15 Change-Id: I3cf5655c5450f121005140bdb587fafa083cce6a Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Avoid rubberband artifacts under fractional DPR scalingEirik Aavitsland2022-05-041-1/+1
| | | | | | | | | | Expand the rubberband repaint area with one pixel to account for rounding on screens with fractional device pixel ratio. Fixes: QTBUG-102717 Pick-to: 6.3 6.2 Change-Id: Iede638d48dfbc3156b02ada28dfe99719b9d5efa Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
* QtWidgets: use _L1 for for creating Latin-1 string literalsSona Kurazyan2022-05-024-12/+20
| | | | | | Task-number: QTBUG-98434 Change-Id: I310ea8f19d73a79d985ebfb8bfbff7a02c424360 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* QtWidgets: stop using QLatin1Char constructor for creating char literalsSona Kurazyan2022-04-261-2/+2
| | | | | | | | | | | Required for porting away from QLatin1Char/QLatin1String in scope of QTBUG-98434. As a drive-by, fix qsizetype -> int narrowing conversion warnings for the touched lines. Change-Id: I133b80334b66e0a5ab9546dd8e1ff0631e79601e Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Rest of QtBase: sweep Q_DECLARE_METATYPE → QT_DECL_METATYPE_EXTERNMarc Mutz2022-04-072-5/+3
| | | | | | | | | | | | | | | | It's one of our best tools to improve compile times. In some places, we can't do the change, yet, because there's no .cpp file for the header file. Also mark Q_DECLARE_METATYPE macros that are in the wrong place. We shouldn't have Q_D_M markup for public classes in .cpp or _p.h files. Fixes: QTBUG-102206 Change-Id: Iec0a39e4745571b24d07dacc87593321967c10e3 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
* Graphicsview: Avoid background clearing glitches under fractional DPREirik Aavitsland2022-04-061-0/+5
| | | | | | | | | | | | | | | | | | | QGraphicsView enables autoFillBackground on the viewport widget, so the dirty area is cleared before repaint. Then QGraphicsView fills the same area with the background color. However, under fractional DPR scaling, the scaled version of the dirty rect may end up covering only a fractional part of the pixels on the edges. If antialising is enabled, such pixels will be only partially filled with the background color, leaving the clear color partially visible as glitches. This can be seen in the dragdroprobot example. Fix by disabling AA during background filling, as it has no purpose then anyway. Task-number: QTBUG-96223 Pick-to: 6.3 6.2 5.15 Change-Id: Ica00997141701faa0cf368caced84ae50ba017d0 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Doc: fix documentation for QGraphicsItem::setAcceptedMouseButtons()Christian Ehrlicher2022-04-021-1/+1
| | | | | | | | | | Fix the documentation to pass Qt::NoButton instead 0 to QGraphicsItem::setAcceptedMouseButtons() since 0 is no longer accepted by QFlags. Change-Id: Ib98d509382e5b5407a07c74565adb7ee5afbb35f Pick-to: 6.2 6.3 Reviewed-by: Sze Howe Koh <szehowe.koh@gmail.com>
* Refactor: use lambdas for visitor pattern in QGraphicsSceneBspTreeVolker Hilsheimer2022-03-182-72/+26
| | | | | | | | | | This way, the visitor implementations are directly where they are used, without the need for a virtual function call. The allocation of the visitors on the heap was anyway overkill (they could just have been allocated on the stack where they were used). Change-Id: Ic41fd285e3a45daaf2e17aa5aeee07e754127a00 Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
* When clearing selected items, iterate over a copy of the QSetVolker Hilsheimer2022-03-181-2/+4
| | | | | | | | | | | | | | | | Selection change handlers of the items might call a method that implicitly recreates the selectedItems QSet, which then invalidates the iterators of the ranged for loop, resulting in crashes. Iterate over a copy of the set instead. Add a test case that crashen without the fix. Fixes: QTBUG-101651 Pick-to: 6.3 6.2 Change-Id: I6da6f4043fe1906b0186931a37283f635cb5a404 Reviewed-by: Axel Spoerl <axel.spoerl@qt.io> Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
* Widgets: Do not depend on transitive includesFabian Kosmale2022-03-171-0/+1
| | | | | Change-Id: Idfd7af066264dd38375d45771693a536a1985607 Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
* Don't include qeventpoint_p.h from qevent_p.hMarc Mutz2022-01-142-0/+2
| | | | | | | | | | | The header no longer uses QMutableEventPoint. Fix TUs that relied on the transitive include. Task-number: QTBUG-99615 Pick-to: 6.3 Change-Id: Iae4ff34ea708304fcd365fd763875dd4a97a1cf8 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* QMutableEventPoint: add static overloads of settersMarc Mutz2022-01-082-3/+3
| | | | | | | | | | | | | | These overloads don't require a cast from QEventPoint to QMutableEventPoint, thus avoiding undefined behavior. Port easy users of QMutableEventPosition::(const)from() to the new API. Pick-to: 6.3 Task-number: QTBUG-99615 Change-Id: I4e9228322134ef7c712ca478ee8286466efc3585 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* QGraphicsItem: Update input context after InputMethod eventJarkko Koivikko2021-11-271-0/+1
| | | | | | | | | | | | Without updating the input context, the input method goes out of sync with the text control. Fix by updating the input context after InputMethod event. Fixes: QTBUG-98544 Pick-to: 6.2 5.15 Change-Id: Idfb99bb0f886249cdab923b8dbed96277800c064 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>