summaryrefslogtreecommitdiffstats
path: root/src/widgets
Commit message (Collapse)AuthorAgeFilesLines
* Fix menu position when highdpi scalingMorten Johan Sørvig2017-04-061-2/+3
| | | | | | | | | | | | | | | | | | | | Certain display and scale factor configurations would cause menus to pop up in incorrect locations or not be shown at all. This was due to QDesktopWidget::screenNumber() having a toNativePixels(QRect, QWindow) call which requires that QWindow::screen() returns the correct screen. Break the circular dependency by converting coordinates the other way for the intersection test: transform screen geometry to device independent coordinates. Task-number: QTBUG-58329 Change-Id: I5621de89a9a2b8df44bdae528baf011fc111eba3 Reviewed-by: Paolo Angelelli <paolo.angelelli@qt.io> Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* GCC 7: fix -Werror=implicit-fallthroughGiuseppe D'Angelo2017-04-048-3/+21
| | | | | | | | More fallthrough-are-errors fixed. Change-Id: I9a6cb6efe988400ed3f9cb95d1e426dac317e6c4 Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io> Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
* QtWidgets: Fix white text color on tabs on macOS for non-macOS stylesBłażej Szczygieł2017-03-301-3/+2
| | | | | | | | | | Apply white text only for macOS style. Amends 2c0033983bc53e906eab3f4b2fae836ff8472713 Task-number: QTBUG-59784 Change-Id: I9e66e929699efd715ed4565394f1aba763aeb32a Reviewed-by: Jake Petroules <jake.petroules@qt.io>
* Annotate more implicit fallthroughsAllan Sandfeld Jensen2017-03-275-0/+6
| | | | | | | Reduces our number of gcc 7 warnings Change-Id: I792d658cbc11cad15cf45da3a36fc93fcdcc67ea Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
* Make sure QDBusMenuBar is restored when the window is hidden and shownDmitry Shachnev2017-03-271-0/+11
| | | | | | Task-number: QTBUG-58723 Change-Id: Ib4c3dac8a8cce717f4d47ab619c05b9e1719f311 Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* Fix propagation of locale from widget to its childrenEdward Welbourne2017-03-241-1/+1
| | | | | | | | | | | | | | | | | | | | | | | Fix the condition in QWidgetPrivate::resolveLocale() to decide whether to propagate locale: make it match setLocale_helper()'s condition when deciding whether to propagate to descendants. This lead to a QDateTimeEdit's calendar popup not getting told what locale to use correctly, unless we setLocale() on it overtly, which then blocked propagation of locale changes to it unless QDateTimeEdit manually propagated the changes. Fix the documentation of WA_WindowPropagation to mention locale as also being propagated (which it was in several places, only neglecting this one in resolveLocale). [ChangeLog][QWidget][Qt::WA_WindowPropagation] Propagate locale consistently, along with font and palette, within the widget hierarchy. Previously, locale was propagated on ancestral setLocale(), but not on creation of the descendant. Task-number: QTBUG-59106 Change-Id: I92270f7789c8eda66a458274a658c84c7b0df754 Reviewed-by: David Faure <david.faure@kdab.com>
* Fix floating dock widget having the wrong parentOlivier Goffart2017-03-221-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When dragging out a tabbed group which contains placeholder for floating QDockWidget, the floating QDockWidget would not be reparented to the new QDockWidgetGroupWindow. That's because QDockAreaLayoutInfo::reparentWidgets does not reparent floating widget (because of the item.skip test) However, we need to be careful when reparenting to pass the flags so it does not get docked. Also do not reparent QDockWidgetGroupWindow which may end up temporarily in the layout during animation when dragging a QDockWidgetGroupWindow onto another. Step to reproduce a crash that if fixed by this patch (with the mainwindow example): 1. Enable QMainWindow::GroupedDragging from the "Main window" menu 2. Add a new dock widget, "Foo", from the "Dock Widgets" 3. Tab "Foo" together with the black dock widget 4. Drag "Foo" out. (Now, Foo is still a child of the QMainWindow, and is still in the layout as tabbed, but is skipped) 5. Drag the black dockwidget out. (This, in fact, crates a QDockWidgetGroupWindow which contains the black dockwidget and the floating "Foo", but since "Foo" is floating, it is not reparented) 6. Destroy "Foo" using the "Dock Widgets" menu. (Since Foo's parent is the QMainWindow, it is not removed from the QDockWidgetGroupWindow's layout, which will cause crash on the next relayout)" This commits amends commits d57bb19902f863fc6db07674f6bd8881b0886b39 and 0feeb6f6d2cfaa964763ca1fcab65672812b4eef Change-Id: I600a56cdd889435b83d2b740598a24d81059bf44 Reviewed-by: Sérgio Martins <sergio.martins@kdab.com>
* QToolBox: fix potential UB (invalid cast) in Private::_q_widgetDestroyed()Marc Mutz2017-03-211-6/+4
| | | | | | | | | | | Don't cast an expiring QObject down to QWidget. Cast the QWidgets stored internally up to QObject to perform the comparison. The result is the same, but no invalid casts are possible anymore. Found by independent review. Change-Id: Iffa8a66cf5cab0270961befe982637ac8e4f0f7b Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* Fix char format of preedit text in empty text blockEskil Abrahamsen Blomfeldt2017-03-201-2/+45
| | | | | | | | | | | | | | | | | | | | | | | | When a text block is empty, and we are adding preedit text to it, we need to merge the format of the preedit text with the current format of the cursor, otherwise we will use a default format and then suddenly switch to the proper one when the text is committed. The reason this becomes a bit complex is that there are no rules preventing someone from using several ime attributes to specify formats for isolated parts of the text, and no rules defining the order of such attributes. So even if the common case is one text format attribute for the entire string, we need to make sure we also handle the other cases gracefully, e.g. when we are setting different formats for different substrings and then providing these out of order. To make sure we have these corner cases covered, we also add a set of autotests. [ChangeLog][Qt Widgets][TextEdit] Fixed initial char format of input method text as it is in pre-edit mode. Task-number: QTBUG-59196 Change-Id: I1e37928e3bd1395fec1b5591908d4c69b84eb618 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Fix item keeping hover highlight even when mouse has left itDan Cape2017-03-131-0/+1
| | | | | | | | | | Made change to clear the hover index when the mouse leaves the widget. This will ensure the component does not think the item still has the mouse over it. Task-number: QTBUG-46785 Change-Id: I34b7f0e171e9cf07ca23150af1b0e6e59a10a58a Reviewed-by: David Faure <david.faure@kdab.com>
* Use QT_CONFIG(library) instead of QT_NO_LIBRARYUlf Hermann2017-03-064-4/+0
| | | | | | | | | | | | | For the windows file system engine, we add an extra macro to use library loading if configured to do so, but avoid it on WinRT, as none of the symbols would be found. We also QT_REQUIRE_CONFIG(library) in the library headers and exclude the sources from the build if library loading is disabled. This, in turn, makes it necessary to clean up some header inclusions. Change-Id: I2b152cb5b47a2658996b6f4702b038536a5704ec Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
* QMenu: make wide submenu appear on the same screen with its parent menuOleg Yadrov2017-03-041-2/+13
| | | | | | | | | | | On a multi-display system wide submenu might either appear on wrong screen or not appear at all (depending on the specific display configuration). Task-number: QTBUG-56917 Change-Id: I40013b0bee340a01ae1c08a5e074afa63da4dbfd Reviewed-by: Gabriel de Dietrich <gabriel.dedietrich@qt.io> Reviewed-by: Błażej Szczygieł <spaz16@wp.pl>
* Wide QMenu: fix size and positionOleg Yadrov2017-03-042-30/+16
| | | | | | | | | | | | | | | | | | | This patch fixes 2 issues related to wide menus: 1) Menu took on full screen height when menu width was larger than screen width; 2) On a multi-display system wide menu might appear on wrong monitor (not the one where show event was triggered). The idea is we limit parent menu and all its submenus within the screen where it was opened. Note that this patch fixes only geometry-related issues and there are also some style flaws which need to be addressed (for example, currently the text does not elide if it doesn’t fit to the menu’s width). Task-number: QTBUG-56917 Change-Id: I7e9ff4a48bf03060d76e34d33a13ad6cc890c133 Reviewed-by: Gabriel de Dietrich <gabriel.dedietrich@qt.io>
* QMacStyle::sizeFromContents(CT_Menu): take proxy style into accountOleg Yadrov2017-03-031-1/+9
| | | | | | | This is missed in 10d0f4cba99d2386db28a3afd71832e35992b797 Change-Id: If3566eb4b1f00f6882c290c83e10e51e1bf1d6d9 Reviewed-by: Gabriel de Dietrich <gabriel.dedietrich@qt.io>
* Fix UB in QWidgetItemV2::~QWidgetItemV2Olivier Goffart2017-03-021-1/+1
| | | | | | | | | We might get there because 'wid' is already partially deleted (called from ~QObject). In that case, it is an undefined behavior to call a QWidget member function on it. Use QObjectPrivate::get instead. Change-Id: I6da314bf8385684d1332aa031a2d92012941303b Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
* QDialogButtonGroup: Fix removal of deleted buttonsOlivier Goffart2017-03-021-3/+2
| | | | | | | | | | As the destroyed() signal is emitted from ~QObject, it is not allowed to use static_cast to a QAbstractButton on that pointer anymore. And the qobject_cast will also fail which will keep a dangling pointer in the hash. Change-Id: If0d22fcc30cde87e771e70914c3afb04ea207289 Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
* Fix UB in QWidgetResizeHandler::eventFilterOlivier Goffart2017-02-271-5/+6
| | | | | | | | Unconditional cast to a QMouseEvent while the event might also be a QKeyEvent. Change-Id: If5eb6fbad6e4440c167ff95298f51efde1834217 Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
* Properly use the "process" featureUlf Hermann2017-02-271-1/+0
| | | | | | | | | | | | Replace all QT_NO_PROCESS with QT_CONFIG(process), define it in qconfig-bootstrapped.h, add QT_REQUIRE_CONFIG(process) to the qprocess headers, exclude the sources from compilation when switched off, guard header inclusions in places where compilation without QProcess seems supported, drop some unused includes, and fix some tests that were apparently designed to work with QT_NO_PROCESS but failed to. Change-Id: Ieceea2504dea6fdf43b81c7c6b65c547b01b9714 Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
* Fix documentation typosChristian Gagneraud2017-02-251-1/+1
| | | | | | | | | | This patch fixes 2 simple typos in QGraphicsItem and QPainter documentation and a copy/paste error between QAbstractItemModel's beginRemoveColumns and beginRemoveRows documentation. Change-Id: I32bdc4dc69154a40fe30a5b8c08d0c3a001853f8 Reviewed-by: Harri Porten <porten@froglogic.com> Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
* QDockWidget: Fix memory leak when dragging a tab outside of a floating tab ↵Olivier Goffart2017-02-241-1/+2
| | | | | | | | | | | | | | | window A QDockWidgetItem will be leaked if a QDockWidget is dragged out of a floating tab window, and then plugged back somewhere. The problem is that QMainWindowLayout::unplug was not returning the QDockWidgetItem* from the floating tab's layout. When that's the case, a new QDockWidgetItem is created in QDockWidgetPrivate::startDrag and will be put into the layout, leaking the old QDockWidgetItem. Change-Id: Ifb9c1c562cb74383ebff1df0f91ee225c5cdb296 Reviewed-by: Sérgio Martins <sergio.martins@kdab.com>
* dockwidgets: recalculate the press position if the window resizesSergio Martins2017-02-222-0/+14
| | | | | | | | | A window can resize while dragging, this happens on Windows when dragging across screens, to a screen with a bigger scale factor. When that occurs it might lead to the press pos being outside of the window. Change-Id: Ic61ec7088c8fa81395d43ce665952dbd2eecba39 Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
* Fix crash while dropping a tabbed group into a single floating QDockWidgetOlivier Goffart2017-02-212-5/+3
| | | | | | | | | | | | | | | | The problem was caused by commit 0feeb6f6d2cfaa964763ca1fcab65672812b4eef which fixed QTBUG-58036. It reparented widget that used to be skiped. In particular, floating widgets are skiped. But seting the parent of a floating widget docks it. And so as a result it would not be skiped anymore. This has two side effect: This breaks the animation (as the widget is docked too early; and cause crash when QDockWidgetGroupWindow get reparented as this breaks invariant that these are always floating. So restore the skip from before commit 0feeb6f6d2cfaa964763ca1fcab65672812b4eef, and explicitly set the parent in all cases when the animation finishes. Change-Id: I0e3e29ad22d6ffe4d62242d48a18dadb916fc14f Reviewed-by: Sérgio Martins <sergio.martins@kdab.com>
* QMacStyle::sizeFromContents: don't do anything in CT_Menu caseOleg Yadrov2017-02-171-6/+1
| | | | | | | | | | In this case we can safely return the same QSize which we accept since it is already contains the right size for the given menu and this size will be bounded to screen geometry before QMenu will be displayed anyway. We also get rid of one dependency on HITheme. Change-Id: I7502a96d180fc4a41ce3dfabe8a200b886016348 Reviewed-by: Gabriel de Dietrich <gabriel.dedietrich@qt.io>
* QFileDialog: Protect against nullptr dereferenceKevin Funk2017-02-151-1/+1
| | | | | | | | | | | | | | When the QFileDialog receives a language change event, and native dialogs are used, this code path dereference a nullptr in the qFileDialogUi member. Protect by checking the return value of QFileDialogPrivate::usingWidgets() as done in other places deferencing qFileDialogUi. Fixes a crash in GammaRay Change-Id: I3e9eb81c75d9fc983519a58c5ec06e316ac80263 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io> Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
* QFormLayout: take the correct row in takeRow()Marc Mutz2017-02-081-9/+4
| | | | | | | | | | | | | | | | | | | | | | | | I didn't even try to understand what the old code was trying to do; once you're told by a user that the code is wrong, you see that it is. Fixed by just using the row as passed to takeRow() instead of trying to do some storage-index calculations. The m_matrix indexing operator does it all for us. Added a test that checks that the expected field widget gets returned. Fixed expected test data that was wrong, and just checking that the implementation behaves as implemented, instead of as documented. Amends change 8fbae648db3bc51bafacfe1f88e40561d357e60a. [ChangeLog][QtWidget][QFormLayout] The functions takeRow() and removeRow(), new in 5.8.0, now take and remove the correct row. Task-number: QTBUG-58693 Task-number: QTBUG-15990 Change-Id: I7185ccbc6c03e2579741cad5c0c821d3ed165474 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* Fix result handling in QDialog::doneSamuel Gaist2017-02-071-1/+1
| | | | | | | | | | | | | | | | | | The setData method of an item view would get an incorrect value of a QDialog's result. This patch changes the order of functions called to fix that. [ChangeLog][QtWidgets][QDialog] Fixed a bug where accessing the result of QDialog's result could yield an incorrect value in some situation like using it as a delegate for item views. Task-number: QTBUG-6018 Task-number: QTBUG-12156 Task-number: QTBUG-14430 Change-Id: I6ee4b6e8cacf6a806631c05c6c5dbcff925df65e Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io> Reviewed-by: Jesus Fernandez <Jesus.Fernandez@qt.io> Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
* QInputDialog: prevent crash in static get*() functions when parent gets deletedMarc Mutz2017-02-062-65/+59
| | | | | | | | | | | | | | | | | | | | | | | As explained in https://blogs.kde.org/2009/03/26/how-crash-almost-every-qtkde-application-and-how-fix-it-0 creating dialogs on the stack is a bad idea if the application or the dialog's parent window can be closed by means other than user interaction (such as a timer or an IPC call). Since we cannot know whether Qt is used to build such an application, we must assume it is, create the dialog on the heap, and monitor its lifetime with a QPointer. Instead of using manual resource management, add a minimal implementation of QAutoPointer, and use that in all static get*() functions. Task-number: QTBUG-54693 Change-Id: I6157dca18608e02be1ea2c2defbc31641defc9d1 Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com> Reviewed-by: David Faure <david.faure@kdab.com>
* Clear dock indicator when not over a floating dock group windowSergio Martins2017-02-012-5/+27
| | | | | | | | | | | | The rubberband is shown depending if there's a current hovered dock widget, but there were a few places that were not calling updateGapIndicator(). Additionally, the rubberband will also disappear if the currentHoveredFloat is destroyed externally (would leave a ghost rubber band behind). Task-number: QTBUG-58049 Change-Id: Iafdf234aa04b0ee280e51f8fa2fd212c86610cd1 Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
* Doc: Normalize \since usageTopi Reinio2017-01-313-3/+3
| | | | | | | | | | | Although it's permitted to specify the project name together with a version number for \since, it's unnecessary for Qt classes and functions. This change also normalizes the version formatting: '<major>.<minor>' Change-Id: Ie5a43662077d13c31e241bcde8a7a2849d27d330 Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io>
* Fix build with -no-feature-animationPaul Olav Tvete2017-01-302-1/+8
| | | | | Change-Id: Ieecb9cdbf4373e295148ae5b3d59c43aaf46175e Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* QKeySequenceEdit: Allow for the case where pressing SHIFT+letter gives a ↵Andy Shaw2017-01-271-9/+23
| | | | | | | | | | | | | | different letter On some keyboard layouts it is possible that pressing SHIFT+letter does not give the upper case version of the character. So we depend on QKeyMapper here to give us the right keysequence as then it will compare against a shortcut created with this combination then. Task-number: QTBUG-57928 Task-number: QTBUG-57931 Change-Id: I9421f3ab4d3f8d1ee42f9680200d4b017d551057 Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
* Fix dock widget having the wrong parent after a dragSergio Martins2017-01-261-2/+4
| | | | | | | | | | | | | | | | When dragging a dock widget from a floating group to the main window reparentWidgets() is supposed to be called. It's usually triggered by some unrelated event, like a LayoutRequest. Instead of relying on luck for reparentWidgets() to get called be explicit, otherwise the dock widget that was dropped into main window will still have as parent the floating group window. The item.skip() condition seems overly restrictive. Task-number: QTBUG-58036 Change-Id: I65b5699e1acb6ca9bedb10620daa055fa9d91943 Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
* Remove duplicated feature definitionPaul Olav Tvete2017-01-261-7/+1
| | | | | | | The "spinbox" feature was defined twice, and in two different ways. Change-Id: Iabc8939036e2166c5c5a417181ae8fb244829123 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Fix build with -no-feature-lineeditPaul Olav Tvete2017-01-261-0/+4
| | | | | Change-Id: I171aed5d134db88f211da0e1a6ce236e32f3c35c Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Fix build with -no-feature-whatsthisPaul Olav Tvete2017-01-251-0/+2
| | | | | Change-Id: I2f31357e91b01f826ef44710f477b80fde1f3fbf Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Fix build with -no-feature-treewidgetPaul Olav Tvete2017-01-251-2/+2
| | | | | | | Make sure the feature is defined before testing it. Change-Id: I4d4b555c9f2629c8a3ca58cf52efff279f6a78f5 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Compile with -no-feature-tooltipPaul Olav Tvete2017-01-253-0/+6
| | | | | Change-Id: I6093559dd7b8df578ebd050655fb9bd07e5f6809 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Fix build with -no-feature-toolbuttonPaul Olav Tvete2017-01-253-2/+12
| | | | | Change-Id: I16495548fa3ed24409883fadab08ddb8545efd0d Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Fix build with -no-feature-tabbarPaul Olav Tvete2017-01-254-5/+26
| | | | | Change-Id: I97c5345f2627743876aa05a94ffc03f2a6012b6c Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Fix build with -no-feature-tabwidgetPaul Olav Tvete2017-01-251-11/+9
| | | | | Change-Id: I0fbabdfec763f1647bf85582afe088a3e5b42e1f Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Fix build with -no-feature-sliderPaul Olav Tvete2017-01-252-1/+3
| | | | | Change-Id: I36e5c850068c2f9ac2ae078a3734ddb88d88c532 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Fix build with -no-feature-texteditPaul Olav Tvete2017-01-252-1/+5
| | | | | Change-Id: I4a75c134803043180c57287ca352e26e3422204c Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Fix styles compilation with features removed, round 2Paul Olav Tvete2017-01-254-11/+72
| | | | | Change-Id: I8f09a8844e5edc1ad3e3dfd39eca9f3b42c5c828 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Fix build with -no-feature-rubberbandPaul Olav Tvete2017-01-251-1/+2
| | | | | Change-Id: Ida6698c4868507ccbf5b4c5e3eb1d2f5a7109f53 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Fix build with -no-feature-menubarPaul Olav Tvete2017-01-251-2/+9
| | | | | Change-Id: I23b23fcaf6fcc655d38a06495127b108975f4a58 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Fix build with -no-feature-menuPaul Olav Tvete2017-01-253-2/+10
| | | | | Change-Id: I8f9d5ef6b7f7102e56816677f1d3a5b5144b7083 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Compile with -no-feature-itemviewsPaul Olav Tvete2017-01-253-5/+11
| | | | | Change-Id: I23506f06df35f124f5eb9fcc8426c63b407a0872 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Fix build with -no-feature-graphicsviewPaul Olav Tvete2017-01-251-0/+3
| | | | | Change-Id: I9ae724ddf90efc9e951d475e3332083e6f8207d6 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Fix build with -no-feature-dockwidgetPaul Olav Tvete2017-01-251-4/+20
| | | | | Change-Id: Id484b54fd7191715e61ba6708247357b83159f28 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Fix style compilation with -no-feature-...Paul Olav Tvete2017-01-255-6/+41
| | | | | Change-Id: Ic7fadf0622f98d339322a4a1d4d5c36908f4f7f6 Reviewed-by: Lars Knoll <lars.knoll@qt.io>