summaryrefslogtreecommitdiffstats
path: root/src/widgets
Commit message (Collapse)AuthorAgeFilesLines
* Fix QWidget::metric to use widget screen dpr instead of app-dprThorbjørn Lund Martsum2022-05-241-13/+4
| | | | | | | | | | | | | Use the widget screen dpr in calculations rather than qApp->devicePixelRatio(). The screen may have been directly set (without the window handle being initialized) Task-number: QTBUG-103309 Task-number: QTBUG-49663 Task-number: QTBUG-101947 Task-number: QTBUG-102982 Change-Id: I2af2073640b171baf68575e3bc93b29b6a9a471d Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Fix separate delete of window and windowcontainerAllan Sandfeld Jensen2022-05-232-6/+30
| | | | | | | | | | | | The documentation says we can change window parent to avoid the widget deleting the window. That didn't work as the widget didn't get the child-removed event as it wasn't the parent. This patch instead uses an event filter on the set parent. Pick-to: 6.3 6.2 Change-Id: I1f61d1832fcf3257722f305beeefd8f1abf1f656 Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
* Fix QMenu size on first showThorbjørn Lund Martsum2022-05-231-0/+9
| | | | | | | | | | | | QWidget::metric is used to calculate the size of the menu, but it only respects a sceen from a Window handle, so we need to make sure such a thing is created. Task-number: QTBUG-103309 Pick-to: 6.2 6.3 Change-Id: Ie73e362cdcb3b59f46ad51c4901fdbeda7258baa Reviewed-by: Morten Kristensen <me@mortens.dev> Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
* Don't hide a widget that is swapped into a hidden splitterVolker Hilsheimer2022-05-231-2/+10
| | | | | | | | | | | | | | | | | When replacing a widget in a hidden splitter, then we only need to keep the new widget hidden if the previous widget was hidden. If the new widget is not explicitly hidden, and the splitter is already visible, then we need to explicitly show the new widget. Augment test case; the existing test cases already cover swapping out a collapsed or hidden widget. Fixes: QTBUG-102134 Pick-to: 6.3 6.2 Change-Id: I9b60711a5c1cab79777ce4183783114a16ac3394 Reviewed-by: Axel Spoerl <axel.spoerl@qt.io> Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
* Fix crash in tst_qquicktext::implicitSizeEskil Abrahamsen Blomfeldt2022-05-201-1/+1
| | | | | | | | | | | | | This reverts commit 1e938c348b936328fafbcaae4c0c7d91003143e5 and bb2f4d08d9d138e4f70d6d6db46e24e34500becc. bb2f4d08d9d causes the crash, but 1e938c348b93 amends it, so this reverts both. When the cause of the crash has been determined and mitigated, the patches can be recreated. Fixes: QTBUG-103719 Change-Id: Ifc36b3771a96f6c85387a5306a0402d4c508d006 Reviewed-by: David Faure <david.faure@kdab.com>
* windows: make native styles support QT_SCALE_FACTORMorten Sørvig2022-05-191-1/+4
| | | | | | | | | | | | | | Calculate the native metrics scale factor using DPI from the screen instead of using devicePixelRatio from the widget. This way the native metrics scale factor becomes independent of whatever modifications QtGui applies to the DPR. This matches its use case of scaling native metrics returned by win32 API. Task-number: QTBUG-86344 Change-Id: I0d3c73956520e2bc4a56b23ea3cb8e1f0c36fcf1 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io> Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
* QKeySequenceEdit: Extract Method Private::rebuildKeySequence()Marc Mutz2022-05-182-3/+4
| | | | | | | | | | Factor the construction of Private::keySequence from Private::key into a helper function, as we'll need this functionality in more places when we add a maxKeyCount property to the class. Change-Id: I6b08a619c3b6b2a9ff660e9f51b02632c2359a47 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io> Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Stylesheet: Another positioning fix for the menu indicatorVolker Hilsheimer2022-05-181-5/+4
| | | | | | | | | | | | | | | | | Draw tool button menu indicator relative to frame, not content, so that padding added in the stylesheet creates room between text and indicator. Also, prevent another double-arrow by ignoring menu indicator rendering when a menu button subcontrol is used, as the two are mutually exclusive. This amends 1c338e6d07a42631a6603c5bb0bc86f6806addd6. Add problematic case to stylesheet baseline test. Fixes: QTBUG-102866 Pick-to: 6.3 6.2 Change-Id: I5d79e65b33a2e41ac07c8efe0c15697c5be65201 Reviewed-by: Axel Spoerl <axel.spoerl@qt.io> Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
* Make uic generate correct C++ commentsVolker Hilsheimer2022-05-181-2/+2
| | | | | | | | | Revert the change to uic of 05fc3aef53348fb58be6308076e000825b704e58. Task-number: QTBUG-67283 Change-Id: Icfd83bb6d80b91d4e58f1be460f6772ba49a6921 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
* QtWidgets: restore Qt 5 compatibility for save/restore stateGiuseppe D'Angelo2022-05-185-0/+10
| | | | | | | | | | | | | | | | | | | | | | | Several classes in QWidget use QDataStream internally in order to save and restore state. These QDataStream usages were not versioned, meaning that if Qt changes the serialization for some datatype, then the data saved between different Qt versions becomes incompatible. Note that the save/restore API in question just produce opaque blobs as QByteArrays -- the user has no control over the QDataStream objects and thus versions. Fix by version the usages. In QHeaderView this has caused a regression because QBitArray *did* change version between Qt 5 and 6. In general, using QDataStream without explicit versioning is a mistake, so deploy the same fix elsewhere as well. Fixes: QTBUG-99487 Pick-to: 5.15 6.2 6.3 Change-Id: I82bb5c266f4e5dedc0887cbef855dccab1015e29 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io> Reviewed-by: <doctor.whom@gmail.com>
* QTextDocument/QGraphicsTextItem: skip layout in setTextWidth(0)David Faure2022-05-171-1/+1
| | | | | | | | | | | | | | | | | | In a QGraphicsTextItem without a width yet, there's no need to do any layouting. The use case is obviously items with an app-defined size, not the default where text items adapt to their contents. Results: 0.065 msecs to create a QGraphicsTextItem with some text (layouted) 0.036 msecs to set everything up in a QGraphicsTextItem with 0 width QTextEdit was abusing the width 0 to mean "no wrap, width comes from contents", but since the value -1 means that already in QTextDocument, QTextEdit now uses a width of -1 for that meaning. Change-Id: I67ad59c305e5dd34830886e4e6c56dde03c93668 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Widgets: Use effect region bounds when drawing with repaint managerAntti Määttä2022-05-173-3/+6
| | | | | | | | | | | | When drawing widgets with graphics effect using repaint manager, if we do not combine the effect region some child widgets are not affected by the graphics effect since they are not included in the dirty region. However always using region bounds breaks the referenced bug use case. Fixes: QTBUG-102374 Pick-to: 6.3 6.2 5.15 Change-Id: Iaf4eaba34db863500a0600b344e5062f2b36b9bf Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* QWidgetTextControl: don't clear() a new empty documentDavid Faure2022-05-161-1/+1
| | | | | | | | | | | | | | Before: 0.063 msecs per iteration After: 0.054 msecs per iteration clear() takes time because: 1) QTextDocumentLayout::documentChanged() => doLayout() => layoutFrame() 2) QTextDocumentPrivate::init() => insertBlock() => finishEdit() => QTextDocumentLayout::documentChanged() => layoutStep() => ... => doLayout() again Pick-to: 6.3 6.2 Change-Id: I7a13164d06a1ed77226f2b9d7d12e69ce5b31dfe Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Stylesheet: fix toolbutton menu indicator renderingVolker Hilsheimer2022-05-161-12/+17
| | | | | | | | | | | | | | | | | | Turn off native indicators if we have custom rules, and if we drew natively, don't draw custom indicators. This amends ea0e0a865237983b484ed88447b9fc4c473e2759 which turned off custom drawing too aggressively, removing custom indicators also if no custom drop down arrow (which is only relevant for drop down menu buttons) was set. When then drawing the custom indicator, respect positioning rules in the style sheet. Extend baseline test. Fixes: QTBUG-102866 Pick-to: 6.3 6.2 Change-Id: I5ca353f42e704ec3f6e57677c35118a9cb358b0b Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
* Use SPDX license identifiersLucie Gérard2022-05-16559-22344/+1131
| | | | | | | | | | | | | 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>
* Item widgets: clean up treatment of Qt::TextAlignmentRole / CheckStateRoleGiuseppe D'Angelo2022-05-166-8/+112
| | | | | | | | | | | | | | | | | | | | | | | The item widgets all have an API flaw: getters and setters for the text alignment deal with int instead of Qt::Alignment. Deprecate the existing setters and introduce others taking Qt::Alignment. Store the alignment directly into the item widget (now that views know how to handle it). We can't change the getters without cluttering the API, so make that a Qt 7 change. Users can prepare by forcibly casting the return value to Qt::Alignment; this is going to work in Qt 6 and 7. While at it: streamline the handling of Qt::CheckStateRole as well, avoiding to rely on a pointless Qt::CheckState to int conversion through QVariant (the setter stores a Qt::CheckState, but the getter retrieves an int and converts it to a Qt::CheckState). Task-number: QTBUG-75172 Change-Id: I9f29e818e93cb2dc1d8e042bc320162c2f692112 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Add missing header files to the module sourcesAlexey Edelev2022-05-121-1/+2
| | | | | | | | | All module header files should be listed in the corresponding sections of modules SOURCEs to be accessible in CMake routines. Task-number: QTBUG-103196 Change-Id: Ieb77ae70557e35e546a5b00387e1e0aa40338239 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* Add a clear action to QKeySequenceEditLaszlo Papp2022-05-112-2/+36
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This can be really helpful for deleting shortcuts that one may never intend to use so that they do not accidentally get in the way while interacting with the user interface. The workaround is to try to find the QLineEdit child of the QKeySequenceEdit widget, but it is suboptimal. Some first-class citizen API for this would be a more stable and cleaner solution as opposed to poking implementation details as a user of the QKeySequenceEdit API. The clear action would be configurable and opt-in as not everyone may potentially want this to be turned on. Or at least, not by default anyway. Also, not to suddenly change existing QKeySequenceEdit uses with surprising UI changes after a Qt upgrade, this needs to be opt-in. Moreover, some customers may have already used findChild<QLineEdit *>() to add actions to QKeySequenceEdit in this way on the client side. So, if it was enabled by default, they would suddenly get multiple actions potentially for the same clear action. This would be certainly undesirable. The new clear property is based on the corresponding QLineEdit API for consistency. [ChangeLog][QtWidgets][QKeySequenceEdit] Added a clear action to QKeySequenceEdit to be able to remove existing hotkey configurations. Change-Id: I3a90bfacd49bff10c1284abb155d7edd4f537900 Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
* QWidgetTextControl: port to new-style connects (faster)David Faure2022-05-104-30/+30
| | | | | | | | | | | | | | | 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>
* QAbstractItemDelegate: fix rect given to tooltip handingDavid Faure2022-05-091-6/+1
| | | | | | | | | | | | | | | | | | | * The rect passed to QToolTip::showText() is in view coordinates, not in global coordinates. * Determining this rect in the first place doesn't need calling view->visualRect(index) The view already did this before calling this method, and stored it in option.rect, so just use that. * The widget passed to QToolTip::showText() should be the viewport, that's what option.rect is relative to (thanks Giuseppe!). Found these issues when implementing my own tooltip handing (for a subrect of a delegate) by looking at this code. Pick-to: 6.3 6.2 5.15 Change-Id: I852e5409def28da98137cd0c4c996083e5e45706 Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
* Stylesheet: Don't ignore item check indicator stylingVolker Hilsheimer2022-05-062-5/+31
| | | | | | | | | | | | | | | | | | | | | | | Amends cf52d725156811754cd4e094b0984864795d1d58, after which most indicator styling was no longer taken into account unless some other item aspects were styled. Calling the baseStyle to draw the entire item doesn't call back into the style sheet style for the indicator itself. The QCommonStyle code that breaks the item up into individual sub elements cannot be called for each element. E.g. turning off the check indicator feature changes the layout of the item. So if the indicator is styled, then we have to draw an otherwise empty item with the style sheet style, and then clip the already painted rect before calling the base style to draw text and highlighting with the correct palette. Add baseline test for QTreeView with different style sheets. Fixes: QTBUG-102820 Pick-to: 6.3 6.2 Change-Id: I1da5676cc63556230eac525bc550457ebd495a58 Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@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>
* Remove ALIEN_DEBUG statementsDavid Skoland2022-05-032-34/+1
| | | | | | | | These debug statements come from the Nokia import and it seems unlikely that they are being used at all. Change-Id: I3143f83b0acdc5130fb743808003a55b789f2398 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* QtWidgets: replace remaining uses of QL1String with QL1StringViewSona Kurazyan2022-05-0212-23/+26
| | | | | | | Task-number: QTBUG-98434 Change-Id: If20e217e6e4fecd18c7707bf94650f5ba856893f Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Marc Mutz <marc.mutz@qt.io>
* QtWidgets: use _L1 for for creating Latin-1 string literalsSona Kurazyan2022-05-0256-723/+810
| | | | | | Task-number: QTBUG-98434 Change-Id: I310ea8f19d73a79d985ebfb8bfbff7a02c424360 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* QtWidgets: includemocs v2022Marc Mutz2022-04-293-1/+4
| | | | | | | | | | | | | | | This makes mocs_compilation.cpp empty again, removing those moc files that were added after the last sweep in 2016, 0e6ad275498dc8cc60a7d163bac9ed0add8e48d5. Including moc files directly into their classes' TU tends to improve codegen and enables extended compiler warnings, e.g. about unused private functions or fields. Pick-to: 6.3 6.2 5.15 Task-number: QTBUG-102886 Change-Id: Iee35e82d18690469ad889f9b4a7394e706fe037d Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* QAbstractItemView: check the index emitted by the delegate's sizeHintChangedGiuseppe D'Angelo2022-04-283-6/+18
| | | | | | | | The index in question has to belong to the view's model. An erroneous emission shouldn't be silently ignored. Change-Id: I7e037e72affb210f609a9a1029777acafae041f1 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* QAbstractItemView: warn in some erroneous conditionsGiuseppe D'Angelo2022-04-271-2/+6
| | | | | | | | | | | | | If a user or a delegate asks a view to act on an editor that does not belong to the view, report a warning instead of silently ignoring the problem. This erroneous condition can happen for instance if a user installs the same delegate on multiple views (something that the documentation says _not_ to do) and the delegate indeed emits signals related to the editors of one view -- the other views don't know about that editor. Change-Id: I2d10582ebb7aefca4acea306b8a57bcc3162050a Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* QtWidgets: stop using QLatin1Char constructor for creating char literalsSona Kurazyan2022-04-2637-144/+141
| | | | | | | | | | | 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>
* Fix crash when calling QMainWindow::restoreState()André de la Rocha2022-04-241-2/+2
| | | | | | | | | | | | | | | Restoring the state of a window with a dock widget could cause a crash in a multiple display configuration if the scale or screen arrangement in the system had changed after the state was saved. In this case, the original top-left coordinate of the window could now lie outside of any screens, which would result in a NULL QScreen pointer being dereferenced inside QDockAreaLayout::constrainedRect(). Fixes: QTBUG-102718 Fixes: QTBUG-102541 Pick-to: 6.2 6.3 Change-Id: Ie5e3209b82a33a1dc4568611c1b2ee3a6d8830b7 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* QGraphicsScene: Fix popup position for QGraphicsProxyWidgetVolodymyr Zibarov2022-04-223-27/+16
| | | | | | | | | | | | | screenGeometry() for proxy widget was returning visible part of the scene instead of screen geometry for enclosing first view Pass button center position to screenGeometry() to get correct screen for cases when graphics view occupies two screens Fixes: QTBUG-98785 Pick-to: 6.2 6.3 Change-Id: Idaeb3c3faf739751c93624a06fa0fd3d65388236 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Clarify comment for QDockAreaLayout::sepAxel Spoerl2022-04-221-1/+1
| | | | | | | | | QDockAreaLayout::sep represents the visual margin between a dock widget and its frame, i.e. a dock within the main window. The comment 'separator extent' has been replaced by a clearer version. Change-Id: Icfb3d549a5bcb00c5f1cf4558c5a1c4f995e31f0 Reviewed-by: Jan Arve Sæther <jan-arve.saether@qt.io>
* Shrink dock areas if main window width/height is below 160pxAxel Spoerl2022-04-221-11/+16
| | | | | | | | | | | | | | | Empty drop areas have a fixed size of 80 pixels in QDockAreaLayout. If a main window is below 160 pixels wide or high, drop areas start to overlap. If a main window's width or height is 80px or less, drop areas fully overlap. Dock widgets can't be dropped in overlapping areas, because the dock area becomes ambigous. This patch decreases the width and height used to calculate the drop area rectangle by the extent necessary to prevent docking. QDockAreaLayout::sep (margin between a dock widget and its dock) is used as the new minimum height and width. Change-Id: I1db3282cfc7c602b59bb2f20ba616efe1719b0cb Reviewed-by: Jan Arve Sæther <jan-arve.saether@qt.io>
* Rename QGuiApplicationPrivate::notifyThemeChanged to handleThemeChangedTor Arne Vestbø2022-04-212-3/+3
| | | | | | | | The work done by QGuiApplicationPrivate in response to a theme change goes beyond notifying. Change-Id: I27c74adf6549c553e659c7b8e271945ce753031c Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* QApplication: deliver activation events for non-widget windowsRichard Moe Gustavsen2022-04-211-1/+14
| | | | | | | | | | | | | | | | | | Problem: if you create a hybrid Widgets and Quick Controls application, you would need to use QApplication rather than QGuiApplication. But in that case, the QQuickWindows would never receive window activation events from QApplication. And this causes problems for controls, since, for example, the palettes in use there will never update upon activation changes, and instead sometimes get stuck as e.g QPalette::Inactive after application startup. This patch will make sure that we send out activation events also for QWindows that are not QWidgetWindows. Pick-to: 6.3 6.2 Change-Id: I649f5c653081c0c5249f4faf28a7de2c92f17421 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Fix QDockWidget parenting and dock permissionsAxel Spoerl2022-04-196-141/+331
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Check DockWidgetArea permissions of QDockWidgetGroupWindows with single dock widget. Obtain a dock widget's tab position from a dock widget group window if it can't be established otherwise. Remove hardcoded assumption that a dock widget is in the left dock. Both cases have lead to inconsistent entries and dangling pointers in QDockAreaLayoutInfo::item_list. Remove warning: QMainWindowLayout::tabPosition called with out-of-bounds value '0', which becomes obsolete by the fix. Create a QDockWidgetGroup window prepered to become a floating tab, whenever a dock widget is being hovered over. Store it in item_list so it can be found and deleted when required. No longer call e->ignore() after propagating close events to the first dock widget and thus preventing others from receiving the event. Add logging category qt.widgets.dockwidgets Update dock widget autotest with tests to check the fixes mentioned: plugging, unplugging, hiding, showing, closing and deleting. Blackist closeAndDelete, floatingTabs test on macos, QEMU, arm, android due to flaky isFloating() response after a dock widget has been closed or plugged. QSKIP dockPermissions and floatingTabs test on Windows due to mouse simulation malfunction. QSKIP hideAndShow test on Linux in case of xcb error (QTBUG-82059) Fixes: QTBUG-99136 Pick-to: 6.3 6.2 Change-Id: Ibd353e0acc9831a0d67c9f682429ab46b94bdbb0 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Replace uses of _qs with _s in sources and examplesSona Kurazyan2022-04-192-4/+8
| | | | | | Task-number: QTBUG-101408 Change-Id: I48360ba3b23965cd3d90ac243c100a0656a4cde8 Reviewed-by: Marc Mutz <marc.mutz@qt.io>
* TextEdit: Avoid scrolling to cursor during app switch on GNOMEVolodymyr Zibarov2022-04-142-0/+8
| | | | | | | | | | | | | | GNOME sends empty InputMethod event when switching applications with Alt-Tab. As long as this event is empty, we don't need to scroll to cursor, because we're not adding any input text to it. This also fixes "out of scope" bug QTCREATORBUG-26628 Fixes: QTBUG-100039 Task-number: QTCREATORBUG-26628 Pick-to: 6.2 6.3 Change-Id: I3ccfea50ae52f6f0cbf82c29f07944894050e7dd Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* QProxyStyle: reimplement event() handlingGiuseppe D'Angelo2022-04-091-7/+2
| | | | | | | | | | | | | | | | | | | | There is no use case for QProxyStyle to forward events to its base style. QApplication does not send events to it; a style using e.g. timers or so will have them active on *itself*, not on the proxy. Moreover, forwarding *all* events is broken: QTBUG-96213 has been triggered by forwarding DeferredDelete events sent to the proxy (thus accidentally deleting the base style). But one can concoct many other similarly broken situations; for instance, setting a proxy onto a base style will make the style a child of the proxy. That sends a QChildEvent to the proxy (ChildAdded), and that event is then passed on the base style, resulting in the base style receiving an event saying "you have yourself as a child". Change-Id: I3b92bb168ce3c54a32469c36b6d1da4380ed564f Reviewed-by: Rafael Roquetto <rafael.roquetto@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* QProxyStyle: do not pass DeferredDelete to baseStyleTimur Pocheptsov2022-04-071-0/+4
| | | | | | | | | | | | | | | | | Calling deleteLater on an object of type QProxyStyle (or inheriting from QProxyStyle) results in this object never deleted, since it simply passes the event to its base style, which in case of deleteLater is not right. QProxyStyle inherits QCommonStyle which in turn inherits QStyle (which is QObject's descendent). So for the style to be deleted we pass DeferredDelete to its base class - QCommonStyle::event (which means QObject::event, since neither QCommonStyle nor QStyle override QObject::event()). Pick-to: 6.3 Fixes: QTBUG-96213 Change-Id: I99b8f413624e2f18ddae3fb331997f767de219d0 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io> Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Rest of QtBase: sweep Q_DECLARE_METATYPE → QT_DECL_METATYPE_EXTERNMarc Mutz2022-04-077-11/+29
| | | | | | | | | | | | | | | | 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>
* Remove unnecessary type conversionXiao YaoBing2022-04-061-11/+11
| | | | | Change-Id: I09e3e4596a8c79b3ece08c694010c76e05d8a22b Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
* QSplitter: Don't move handle in non-pressed stateNodir Temirkhodjaev2022-04-051-10/+13
| | | | | | | Fixes: QTBUG-102249 Pick-to: 6.2 6.3 Change-Id: Ib1d74447e346760d1fc9960e11486e8dc7ea3bc0 Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
* Correct documentation in QMainWindow in regards to centralwidgetDavid Skoland2022-04-051-4/+1
| | | | | | | | | | | It's quite clear from the code in qmainwindow.cpp and qmainwindowlayout.cpp that centralWidget returns nullptr (not zero) if it's not set. This also seems to be perfectly well supported, contrary to the note given. Change-Id: Ib7ab37f3645089fb85d7262717b7147b5871c1ad Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io> Reviewed-by: Venugopal Shivashankar <Venugopal.Shivashankar@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>
* Remove declared but not defined functionAlbert Astals Cid2022-04-011-1/+0
| | | | | Change-Id: I78a39f87118b3a2d4bc693c2b87a29c46e40032d Reviewed-by: David Faure <david.faure@kdab.com>
* Windows QPA: Fix slowdown with large table/tree views with accessibilityAndré de la Rocha2022-03-312-0/+25
| | | | | | | | | | | | | | The accessibility code for notifying focus changes related to a table/tree view was iterating over all items to find the focused one, which for a very large number of items could cause a major slowdown and UI freeze. This patch avoids the issue by removing the loop and implementing the focusChild() method in the table/tree accessibility classes. Fixes: QTBUG-100997 Pick-to: 6.2 6.3 5.15 Change-Id: I04c847a5e65223b7a93ab82363feb32e1ebab9f3 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Query the QWindow in every test iteration in qWFWExposed(QWidget)Laszlo Agocs2022-03-291-6/+29
| | | | | | Task-number: QTBUG-102030 Change-Id: Ic8aee76570a000709b480ffbe19335518e3f7a7e Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
* QTableView: Document the customizations applied to QHeaderViewSze Howe Koh2022-03-291-0/+2
| | | | | | | | | | | These are non-default options which the user needs to manually set when applying a custom QHeaderView. Task-number: QTBUG-102034 Pick-to: 6.3 6.2 5.15 Change-Id: Ib3396f0a82c358c71a8501fc2d71158f725bc228 Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io> Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io>