summaryrefslogtreecommitdiffstats
path: root/src/widgets
Commit message (Collapse)AuthorAgeFilesLines
* QTreeView: fetch as many nested entries as fit into the viewVolker Hilsheimer2020-10-021-2/+10
| | | | | | | | | | | | | | | | | | | | | | | | | QAbstractItemModel::canFetchMore and fetchMore implementations might only add a few rows to the model each time they are called. The item views don't generally expect that, and don't call fetchMore repeatedly, even if there would be room in the itemview for more data. This problem cannot be generally solved for all item views, as it would require in repeated expensive laying out of items. For nested indexes in a treeview however, we can try to fetch enough child rows to populate the screen when the item is laid out by repeatedly calling canFetchMore and fetchMore. To calculate how many items have space, apply the same heuristics as in the scrollContentsBy implementation to guess the number of items that can fit into the viewport. Created test case for the fix. Done-with: Doris Verria <doris.verria@qt.io> Fixes: QTBUG-85366 Pick-to: 5.15 Change-Id: I54f95552993873dd4cba80b0f70f4db9d98ddc1d Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io> Reviewed-by: Andy Shaw <andy.shaw@qt.io> Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
* QAbstractItemView: Don't allow CopyAction for InternalMove viewsVolker Hilsheimer2020-10-011-0/+2
| | | | | | | | | | | | | | | Otherwise the default action will be Copy, and the (+) cursor will show when moving items in e.g a QListView/Widget, even though the item will actually be moved. The documentation of InternalMove states clearly that "The view accepts move (not copy) operations only from itself.". Task-number: QTBUG-87057 Pick-to: 5.15 Change-Id: Idaa9e8f84623ced51b1c51a3730466dc0678d6b3 Reviewed-by: David Faure <david.faure@kdab.com> Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
* CMake: Remove old Qt 5 CMake build system filesAlexandru Croitor2020-10-011-31/+0
| | | | | | | | | | | | | | | Remove the stale Qt 5 CMake files. Disable the generation of CMake files by the qmake build system, it wouldn't create usable Qt 6 files anyway. Keep mkspecs/features/create_cmake.prf and mkspecs/features/cmake_functions.prf for now until we can confirm that they are safe to remove. Task-number: QTBUG-86827 Change-Id: Idcf59f4d7d5474171a9bf72904ff19adc8bc74cd Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* Eliminate QDateTimeParser's mutable parameters at lastEdward Welbourne2020-09-301-1/+2
| | | | | | | | | | | | | | | | I noticed that QDTP has a mutable member, text, which gets set at the end of each call to parse(); this makes all the in-out parameters redundant, since relevant methods can simply access - and modify - text, if it's set *at the start* of parse instaed. (There are no early returns to complicate matters.) This also makes StateNode::input redundant. At the same time, rename the mutable member, as several methods shadow it with parameter or local variable names; it is too generic. Change-Id: I2259cd87de5c84201b25c9633d11e59a4a4d57a1 Reviewed-by: Andrei Golubev <andrei.golubev@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Simplify the preamble of QDateTimeEditPrivate::stepBy()Edward Welbourne2020-09-271-11/+3
| | | | | | | | Repetition and needless complexity: eleven lines rewritten in three. Change-Id: I1dadbbc5329b18d3e25f38f73b69abd2d7aac30d Reviewed-by: Mitch Curtis <mitch.curtis@qt.io> Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
* Replace Q_REQUIRED_RESULT with [[nodiscard]]Allan Sandfeld Jensen2020-09-252-3/+3
| | | | | | | It was already used many places directly making the code inconsistent. Change-Id: I3b14bc6c333640fb3ba33c71eba97e78c973e44b Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Fusion: Don't add unnecessarily extra padding for a groupboxAndy Shaw2020-09-251-1/+6
| | | | | | | | | | | | | If there is not a title or an indicator for a groupbox, then there is no reason to add extra padding for it when placing the contents of the groupbox. So this accounts for when one or the other is not set so that the space is used more evenly. Fixes: QTBUG-86411 Change-Id: I536798b57e1195c5a13218f1f82431c4e91f6852 Pick-to: 5.15 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io> Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
* fix QComboBox currentText return placeholderTextWang ChunLin2020-09-251-3/+2
| | | | | | | | | If it does not add item,the currentText should return empty string Fixes: QTBUG-86580 Pick-to: 5.15 Change-Id: I54c3a8b7ececfb1e62bcd7ac592feccaff3f8b48 Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
* fix qcombobox code styleWang ChunLin2020-09-251-2/+2
| | | | | | | | modify some code style Fixes: QTBUG-86793 Change-Id: I263bda1bd16dd34129ea5ae8948ad3eeaf833f3a Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
* Fix redundant emission of editingFinished from QLineEdit with Return keyChristian Heimlich2020-09-234-5/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Current implementation of QLineEdit uses the "edited" bit-field flag to prevent unnecessary emissions of editingFinished() when a line edit loses focus but its contents have not changed since the last time the signal was emitted; however, this flag is only cleared when the signal is fired due to focus loss and not when the Return/Enter key is pressed. This causes an unexpected double emission of the signal when focus is lost following a press of the Return/Enter key if the line edit's text was not further altered between the two actions. This change includes the Return/Enter press as a trigger for clearing the "edited" flag to make editingFinished()'s behavior more consistent and expected. Prevents slots in user code from triggering twice in situations where the line edit's current contents have already been handled, but still allows the end-user to force an emission of the signal via Return/Enter. The effect of the "edited" flag on the signals behavior has also been noted in the signal description as it was previously omitted. [ChangeLog][QtWidgets][QLineEdit][Behavior Change] Pressing the Return/Enter key in a QLineEdit will now also prevent editingFinished() from firing due to focus loss if the contents of the line edit have not changed since the last time the signal was emitted. See - https://forum.qt.io/topic/116902/ Change-Id: I11aadd45341337b7852da8cf5802c7c9efdd614d Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Fix compiler warnings from deprecated QTouchEvent::touchPointsVolker Hilsheimer2020-09-234-38/+36
| | | | | | | | | Replace with QPointerEvent::points(). As a drive-by, turn QEventPoint copies into const references where possible. Change-Id: Ia5e0645493984fe9177dd3ca16afdb4d56e384ee Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* Initialize trayWatcher from QSystemTrayIconPrivateVolker Hilsheimer2020-09-231-1/+1
| | | | | | Coverity-Id: 59488 Change-Id: Ide8d9b62304b72105d2c1d4266ba2a52576ef75a Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* Fix qdoc warnings: QSplitterVolker Hilsheimer2020-09-231-5/+3
| | | | | | | Fix prototypes and parameter names. Change-Id: Ic43c72eaaf06f941f652440e750c91546707b79e Reviewed-by: Paul Wicking <paul.wicking@qt.io>
* Doc: Make widgets snippets a subdirs/lib projectPaul Wicking2020-09-2310-41/+62
| | | | | | | Task-number: QTBUG-86497 Pick-to: 5.15 Change-Id: Ia43f9eb3bf8a3d2f6e76a1932179aaa94266540b Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* CMake: Regenerate projects to use new qt_internal_ APIAlexandru Croitor2020-09-232-184/+184
| | | | | | | | | | | Modify special case locations to use the new API as well. Clean up some stale .prev files that are not needed anymore. Clean up some project files that are not used anymore. Task-number: QTBUG-86815 Change-Id: I9947da921f98686023c6bb053dfcc101851276b5 Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
* CMake: Regenerate projectsAlexandru Croitor2020-09-221-8/+0
| | | | | | | | | Clean up the state of the projects, before changing the internal CMake API function names. Task-number: QTBUG-86815 Change-Id: I90f1b21b8ae4439a4a293872c3bb728dab44a50d Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* Fix some qdoc warnings: typos and qdoc syntaxVolker Hilsheimer2020-09-221-2/+0
| | | | | Change-Id: Idf5c1490330e0f2e5d4bcf920eb03fc9993b3c8a Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* Fix some qdoc warnings: QTableWidgetSelectionRangeVolker Hilsheimer2020-09-211-0/+10
| | | | | | | | | The default constructor was no longer documented, and the documentation of the initializing constructor wasn't tied to the implementation anymore after 33fc6226865ab4b36a452e733e4519e45fea691d. Change-Id: I5354a7e3b249f2128a6421546d4ebb375ae48160 Reviewed-by: Paul Wicking <paul.wicking@qt.io>
* Fix some qdoc warnings: typosVolker Hilsheimer2020-09-212-3/+3
| | | | | | | | It's \reimp, not \reimpl, and this particular textAlignment variable documentation is for QStyleOptionComboBox. Change-Id: I90f1519410a4378c54777e29acce70b55975e70e Reviewed-by: Paul Wicking <paul.wicking@qt.io>
* Fix some qdoc warnings: broken linksVolker Hilsheimer2020-09-212-5/+4
| | | | | | | We can't split a \l{Class::}member over two lines. Change-Id: Id4806402ab349fd20fbf65eee9502e2d08e21dc5 Reviewed-by: Paul Wicking <paul.wicking@qt.io>
* Fix some qdoc warnings: unnamed parametersVolker Hilsheimer2020-09-212-3/+6
| | | | | | | | If we reference a parameter in the documentation, then we have to name it as well in the function declaration. Use Q_UNUSED instead of omitting. Change-Id: Icb32d3bd965f0361d112f62cb3bbbbb2005d378c Reviewed-by: Paul Wicking <paul.wicking@qt.io>
* Cleanup API of QMimeDataLars Knoll2020-09-212-2/+2
| | | | | | | | | | | | | Do not use QVariant::Type anymore, instead use QMetaType For some reason, this pushed the qvariant autotest over the limit where MSVC requires the /bigobj flag, so add that one. [ChangeLog][QtCore][QMimeData] The signature of the virtual retrieveData() function has changed and now takes a QMetaType instead of a QVariant::Type. Change-Id: Ib46773bd731ee2177b1ef74d8162d744be7017ef Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* Add reentrancy guard for processEvents() in QProgressDialog::setValue()Christian Heimlich2020-09-211-1/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Current implementation of QProgressDialog always calls QCoreApplication::processEvents() when the user calls QProgressDialog::setValue() if the PD is modal. For most cases this is fine, but when using a Qt::WindowModal PD with setValue() connected to a signal in another thread using Qt::QueuedConnection a reentrancy issue is present if setValue() is triggered too frequently as the execution of its previous call may not have finished. If this happens too many times in a row a stack overflow will occur. Current documentation notes this potential issue but offers no way it avoid it while still using QProgressDialog (user must implement a custom dialog) without resorting to using Qt::BlockingQueuedConnection, which unnecessarily reduces performance. Introduces the boolean reentrancy guard "processingEvents" that is checked before calling QCoreApplication::processEvents() in a modal PD when setValue() is used. It is set before the first call to processEvents() and cleared after that call returns. This ensures that only one invocation of processEvents() is possible from within setValue() at a time, and thereby minimizes iterations of the main event loop and eliminates the aforementioned stack overflow condition. See - https://forum.qt.io/topic/118292/ Fixes: QTBUG-10561 Pick-to: 5.15 Change-Id: Ifa9b91cbb66881981356954ead0906bdc91fab60 Reviewed-by: Samuel Gaist <samuel.gaist@idiap.ch>
* Doc: Correct link errors qtbaseNico Vertriest2020-09-211-1/+1
| | | | | | Task-number: QTBUG-86295 Change-Id: I27f6bbdadffb08a8794520a14dfe0e2334979575 Reviewed-by: Paul Wicking <paul.wicking@qt.io>
* Doc: Add links to Qt 6 changes files from module indexPaul Wicking2020-09-181-0/+4
| | | | | | Task-number: QTBUG-84051 Change-Id: Iac25df135c9d73a990b41243e08cd38ea78296a4 Reviewed-by: Kai Koehne <kai.koehne@qt.io>
* QGraphicsView:QGraphicstextitem show error after lose focusZhang Hao2020-09-181-1/+5
| | | | | | | | | | | | | The reason for this bug is that after the TextItem loses focus, the focusItem in QGraphicsScene is already empty. When QGraphicsScene responds to the inputMethodEvent event again, since focusItem is already empty,focusItem will no longer deliver events. Fixes:QTBUG-85088 Pick-to:5.15 Change-Id: I329054333c2adec133d35318761612aca3afcf0d Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
* Doc: Add porting guide documentsPaul Wicking2020-09-161-0/+46
| | | | | | | | Also add existing such docs to the new document group Task-number: QTBUG-84051 Change-Id: I76f033f0846e09943f249d2beeb1606869eef382 Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
* Track grab state in QPointingDevicePrivate::activePointsShawn Rutledge2020-09-165-54/+51
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | QQuickEventPoint instances were very long-lived and got reused from one event to the next. That was initially done because they were "heavy" QObjects; but it also became useful to store state in them between events. But this is in conflict with the ubiquitous event replay code that assumes it's OK to hold an event instance (especially a QMouseEvent) for any length of time, and then send it to some widget, item or window. Clearly QEventPoints must be stored in the QPointerEvent, if we are to avoid the need for workarounds to keep such old code working. And now they have d-pointers, so copying is cheap. But replay code will need to detach() their QEventPoints now. QEventPoint is useful as an object to hold state, but we now store the truly persistent state separately in an EventPointData struct, in QPointingDevicePrivate::activePoints. Incoming events merely update the persistent points, then we deliver those instead. Thus when event handler code modifies state, it will be remembered even when the delivery is done and the QPA event is destroyed. This gets us a step closer to supporting multiple simultaneous mice. Within pointer events, the points are moved up to QPointerEvent itself: QList<QEventPoint> m_points; This means pointCount(), point(int i) and points() can be non-virtual. However in any QSinglePointEvent, the list only contains one point. We hope that pessimization is worthwhile for the sake of removing virtual functions, simplifying code in event classes themselves, and enabling the use of the range-for loop over points() with any kind of QPointerEvent, not just QTouchEvent. points() is a nicer API for the sake of range-for looping; but point() is more suited to being non-const. In QML it's expected to be OK to emit a signal with a QPointerEvent by value: that will involve copying the event. But QEventPoint instances are explicitly shared, so calling setAccepted() modifies the instance in activePoints (EventPointData.eventPoint.d->accept); and the grabbers are stored separately and thus preserved between events. In code such as MouseArea { onPressed: mouse.accepted = false } we can either continue to emit the QQuickMouseEvent wrapper or perhaps QEvent::setAccepted() could become virtual and set the eventpoint's accepted flag instead, so that it will survive after the event copy that QML sees is discarded. The grabChanged() signal is useful to keep QQuickWindow informed when items or handlers change exclusive or passive grabbers. When a release happens at a different location than the last move event, Qt synthesizes an additional move. But it would be "boring" if QEventPoint::lastXPosition() accessors in any released eventpoint always returned the same as the current QEventPoint::xPosition()s just because of that; and it would mean that the velocity() must always be zero on release, which would make it hard to use the final velocity to drive an animation. So now we expect the lastPositions to be different than current positions in a released eventpoint. De-inline some functions whose implementations might be subject to change later on. Improve documentation. Since we have an accessor for pressTimestamp(), we might as well add one for timestamp() too. That way users get enough information to calculate instantaneous velocity, since the plan is for velocity() to be somewhat smoothed. Change-Id: I2733d847139a1b1bea33c00275459dcd2a145ffc Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Fix conversion warnings when setting alpha to QColorFriedemann Kleint2020-09-154-4/+4
| | | | | | | Adapt to 5bb4baae0379d5903f547f0399be9620f5ab06a0. Change-Id: Id65f87740f9de8e0d3624ff63c431dcad642f3a5 Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
* CMake: Regenerate configure.cmake filesAlexandru Croitor2020-09-151-1/+1
| | | | | | Change-Id: I844e82b4655cf1967b16a7785b4e1ef777e61c22 Reviewed-by: Simon Hausmann <hausmann@gmail.com> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
* QStyleSheetStyle: Fix push button hit testing with paddingVolker Hilsheimer2020-09-151-2/+5
| | | | | | | | | | | | | Amends f9940b15f7f0fde731431626172939b9821fd660, which amended 6e1d70ae12baae4610356ec7b69635ad75a97b4e. The bevel of the button is not defined by the contentsRect, but by the borderRect that the stylesheet style calculates. Change-Id: I9a0d5bf29a06ce2270014f0d144e33cc3a1a7473 Pick-to: 5.15 Fixes: QTBUG-86587 Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
* QLayout: Make contentsMargins a Q_PROPERTYFriedemann Kleint2020-09-151-0/+1
| | | | | | | | | | It replaces the deprecated int margins property, which was a Q_PROPERTY. This enables Qt for Python users to use property syntax for it. Task-number: PYSIDE-1019 Change-Id: I958d2ef7f8e2afcc2be490e29d4b11c070569fbd Reviewed-by: Christian Tismer <tismer@stackless.com> Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Clean up the last of QT6_(NOT_)?VIRTUALEdward Welbourne2020-09-142-3/+3
| | | | | | | | | This follows up on commit d273076b4474bb473d90e996960c4c773745761a which left a comment asking for the clean-up this finishes. Task-number: QTBUG-85700 Change-Id: I1c6896a42a09b873302ad7ec8273879f2a4a4ce6 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Make QStringList an alias to QList<QString>Lars Knoll2020-09-121-1/+0
| | | | | | | | | | | | | | | | | | Fix our API, so that QStringList and QList<QString> are the same thing. This required a bit of refactoring in QList and moving the indexOf(), lastIndexOf() and contains() method into QListSpecialMethods. In addition, we need to ensure that the QStringList(const QString&) constructor is still available for compatibility with Qt 5. Once those two are done, all methods in QStringList can be moved into QListSpecialMethods<QString>. Change-Id: Ib8afbf5b6d9df4d0d47051252233506f62335fa3 Reviewed-by: Andrei Golubev <andrei.golubev@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Small doc fixLars Knoll2020-09-121-1/+1
| | | | | | | Refer to QMetaType, not QVariant::Type Change-Id: I3e9284742b332095a26c03c68580ad0f6d4f9be7 Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
* QAbstractSpinBox: don't emit update signals twiceRichard Moe Gustavsen2020-09-121-1/+1
| | | | | | | | | | | | | | | | | | | | | | A QAbstractSpinBox has a spinClickThresholdTimer that is detecting if the user is doing a press'n'hold on one of the spin buttons, to activate auto-repeat. But if the valueChanged() handler in the application spends too much time before it returns, the spinClickThresholdTimer will fire before we get a chance to cancel it from the pending mouseRelease event. The result is that the spinbox will think that the user is doing a press'n'hold, and increment the value once more. To avoid this, we start the timer _after_ the call to valueChanged() instead. Pick-to: 5.15 Fixes: QTBUG-86483 Change-Id: Iff5de4f8da562738e02848c98bc1fbc9fe227748 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io> Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* QAbstractItemView: add virtual itemDelegateForIndexVolker Hilsheimer2020-09-127-41/+61
| | | | | | | | | | | | | | | | | | | | | | | | and obsolete itemDelegate(index), which the new function replaces. This allows itemviews to override the item delegate per index. The existing APIs to set delegates for rows and columns doesn't work for tree views, or other views where the delegate should depend on the parent index as well. Adjust all itemview code that accessed the QAIVPrivate's relevant data structures directly to go through the virtual function. [ChangeLog][QtWidgets][QAbstractItemView] The itemDelegate(QModelIndex) member function has been made obsolete, and has been replaced by a new virtual itemDelegateForIndex(QModelIndex) member function that can be overridden to give subclasses control over which item delegate should be used for an index. Change-Id: Ib03529c38797386d3a1d4cf3c5646e911d95daf5 Reviewed-by: Samuel Gaist <samuel.gaist@idiap.ch> Reviewed-by: Lars Knoll <lars.knoll@qt.io> Reviewed-by: Christian Ehrlicher <ch.ehrlicher@gmx.de>
* macos: Rename macos style to macOSRichard Moe Gustavsen2020-09-111-1/+1
| | | | | | | | | This change shouldn't matter much to widgets, since style names there are case insensitive. But for controls style names are case sensitive, and in that case, "macOS" looks more correct. Change-Id: Ia1d442bce465692ff58fecba1cc68ecbb2e52549 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* Doc: Clean up widget snippets projectPaul Wicking2020-09-1014-27/+27
| | | | | | | | | | The main snippets project must be a subdirs project. Move some files and update the affected documentation. Task-number: QTBUG-86497 Pick-to: 5.15 Change-Id: I60073d1b8bd53aa09600eeccf06ba8457ac7c708 Reviewed-by: Venugopal Shivashankar <Venugopal.Shivashankar@qt.io>
* Port from devicePixelRatioF() to devicePixelRatio()Morten Johan Sørvig2020-09-1011-31/+31
| | | | | | | This ports all of QtBase. Change-Id: If6712da44d7749b97b74f4614a04fac360f69d9e Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* Derive some item delegates from QStyledItemDelegateLars Knoll2020-09-102-12/+11
| | | | | | | | | | | Address a ### Qt6 comment from change 283008e123e5eacb83869682528b2024186634f8, and start using QStyledItemDelegate in more places, so those get proper look and feel. Change-Id: I39767ba99b7942faada1fba0ac241deb35563b63 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io> Reviewed-by: Christian Ehrlicher <ch.ehrlicher@gmx.de>
* Disable operator+ and operator- for QFlagsGiuseppe D'Angelo2020-09-091-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | ... and the associated enumeration. Using them is almost always a certain mistake. 1) op+ between two enumerators of the same enumeration yields int, not QFlags, so removing the type safety that QFlags is supposed to give and breaking the semantics of bitwise operations. 2) op+ between two enumerators of different enumerations is deprecated in C++20 (already flagged by GCC10), and again yields int. This is a code smell. Dedicated classes (holding a combination of unrelated enums) should be used instead. 3) op+ between an enumerator and its QFlags loses the semantic meaning of bitwise operations. If the real meaning was to use operator|, then use that instead; operator+ hides the intent, and can introduce bugs by creating a result not expressible via OR combinations of enumerators: enum E { A = 0x01, B = 0x02 }; QFlags<E> f = E::A; f + E::A; // ??? f + E::B; // ??? Identical reasoning applies for operator-. Technically the other arithmetic operators could be disabled as well, but I really don't expect any real-world usage for them. This has spotted bugs in Qt. [ChangeLog][Potentially Source-Incompatible Changes][QFlags] Using operator+ or operator- with a QFlags object or with an enumeration that has a corresponding QFlags object will now result in a compile-time error, because it's a generally unsafe operation. Use the proper bitwise operations instead (|, &, ~); or cast the enumeration to a integral type before attempting arithmetic manipulations on it. Change-Id: I5eabc5195dec3d3082bc9da10dbc8cf5dff3e1eb Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Refactor testlib touch functions into qtestsupport_gui and _widgetsShawn Rutledge2020-09-082-1/+96
| | | | | | | | | | | | | Because we removed public setters from QTouchEvent and QEventPoint in 4e400369c08db251cd489fec1229398c224d02b4 and now it's proposed to give QEventPoint a d-pointer again, the implementation of QTouchEventSequence needs to start using QMutableEventPoint: being a friend will no longer be enough, because the member variables won't be accessible in the future. But because we have separate test libs for Gui and Widgets, it needs to be further refactored into two classes. Change-Id: I0bfc0978fc4187348ac872e1330d95259d557b69 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Deliver Quit event when calling QCoreApplication::quit()Tor Arne Vestbø2020-09-072-10/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Instead of QCoreApplication::quit() directly calling exit(0), which would leave QGuiApplication and client code out of the loop, we now send the Quit event, and let it pass through event delivery, before finally ending up in QCoreApplication::event(), where we call exit(0). This has the advantage that QGuiApplication can ensure all windows are closed before quitting, and if any of those windows ignore the close event the quit will be aborted. This aligns the behavior of synthetic quits via QCoreApplication::quit() with spontaneous quits from the platform via QGuiApplicationPrivate::processApplicationTermination. Clients who wish to exit the application without any event delivery or potential user interaction can call the lower level exit() function directly. [ChangeLog][QtGui] Application termination via qApp->quit() will now deliver Quit events to the application, which in turn will result in application windows being closed as part of the application quit, with an option to cancel the application quit by ignoring the close event. Clients who explicitly want to exit the application without any user interaction should call QCoreApplication::exit() explicitly. Task-number: QTBUG-45262 Task-number: QTBUG-33235 Task-number: QTBUG-72013 Task-number: QTBUG-59782 Change-Id: Id4b3907e329b9ecfd936fe9a5f8a70cb66b76bb7 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io> Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* QStyleOptionGraphicsItem: remove deprecated member matrix/levelOfDetailChristian Ehrlicher2020-09-063-47/+5
| | | | | | | | QStyleOptionGraphicsItem::matrix and levelOfDetail are deprecated and not used anywhere anymore. Change-Id: Id4b0fa8ac3ac53d771e858ecda5524a5e690342d Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Use C++17 [[maybe_unused]]Allan Sandfeld Jensen2020-09-061-1/+1
| | | | | | | In some places needs to be ordered before const/constexpr though. Change-Id: I57a521ac0ad22b5a018761c4d52befbef69d64c0 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Get rid of hasPendingEvents() and flush()Lars Knoll2020-09-061-1/+0
| | | | | | | They are unused. Change-Id: I77383f2be45551401ed9c2f88285511134cc8b0d Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* QCompleterItemDelegate: replace QItemDelegate with QStyledItemDelegateWang Peng2020-09-051-5/+4
| | | | | | | Resolve remaining Qt6 TODOs Change-Id: Ice8dae2f1cbd3ed452ab78d5d7735127d7662900 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* QCalendarDelegate: replace QItemDelegate with QStyledItemDelegateWang Peng2020-09-051-6/+5
| | | | | | | | Resolve remaining Qt6 TODOs Change-Id: I018ef5e3761816dce052a78be3dcd07ede866135 Reviewed-by: JiDe Zhang <zccrs@live.com> Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* QStyle: remove deprecated SH_SpellCheckUnderlineStyleChristian Ehrlicher2020-09-053-7/+0
| | | | | | | | It was deprecated with 88e6f8cff2974c46b1262f3a1a61e1440c664e0c and is not used anywhere anymore so it can be safely removed. Change-Id: If4050ac8bf116fb31491b3b08096554c5ea3e4d5 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>