summaryrefslogtreecommitdiffstats
path: root/src/widgets
Commit message (Collapse)AuthorAgeFilesLines
* 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>
* Remove reimplementations of removed featuresPaul Olav Tvete2017-01-252-4/+4
| | | | | | | Avoid the "marked ‘override’, but does not override" compile error. Change-Id: I4b125f1951614045781f3059fbc5cb65dd26775c Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Make sure features are defined before testing themPaul Olav Tvete2017-01-253-9/+9
| | | | | | | | | Include the file defining the feature before testing whether the feature exists. Also use the new feature macro to make sure this bug doesn't happen again. Change-Id: I204836fee59b143a7ce7d256a7aed223c4d0ceb1 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* model-view-programming.qdoc: Add missing list/endlistFriedemann Kleint2017-01-241-0/+2
| | | | | | | | | | | | | Fixes qdoc-warnings: qtbase/src/widgets/doc/src/model-view-programming.qdoc:2076: warning: Command '\li' outside of '\list' and '\table' qtbase/src/widgets/doc/src/model-view-programming.qdoc:2077: warning: Command '\li' outside of '\list' and '\table' qtbase/src/widgets/doc/src/model-view-programming.qdoc:2078: warning: Command '\li' outside of '\list' and '\table' qtbase/src/widgets/doc/src/model-view-programming.qdoc:2079: warning: Command '\li' outside of '\list' and '\table' Amends change 7adfe7494bb4a2c1d3a036fe9dfd946bc00c5d49. Change-Id: Ifa1121ba743c17d7223058e780ad03211565e3ff Reviewed-by: David Faure <david.faure@kdab.com>
* QMacNativeWidget: Remove Carbon reference from documentationGabriel de Dietrich2017-01-231-6/+2
| | | | | Change-Id: Ie1f1064a98f202194cad98aa3fa106e87eba7f39 Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
* QMacCocoaViewContainer: Fix typos, wording in documentationGabriel de Dietrich2017-01-231-22/+17
| | | | | | | | Also removes reference to Carbon and the old dual backend. Change-Id: I01292caa7efcbe85526cd7602ec8ac678fd78eab Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io> Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
* Doc: Remove specific mention of 'Qt 4' from Model/View documentationTopi Reinio2017-01-231-1/+1
| | | | | Change-Id: If2101124d1bc772c9412c3d09d2d7753d9b51569 Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io>
* QQuickWidget: fix drag and dropOleg Yadrov2017-01-201-2/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | QQuickWidget did not receive mouse release events after drag and drop because the logic was so: 1) QWidgetWindow::handleMouseEvent() was called on press and qt_button_down was set to the corresponding QQuickWidget; 2) After drag started, qt_button_down was set to 0 in QApplicationPrivate::notifyDragStarted(); 3) On mouse release QWidgetWindow::handleMouseEvent() was called again, but because qt_button_down was 0 QApplicationPrivate::pickMouseReceiver() returned 0 and as a result QWidgetWindow ignored the event and did not propagate it to QQuickWidget for further processing. The step 2 is a widgets-specific fix for QTBUG-26145 that does not work for QQuickWidget (QtQuick has its own focus system). Note that because Widgets and QtQuick do not share the sources, there is no possibility to cast the pointer to check whether qt_button_down is a QQuickWidget or some other QWidget-derived class object, so we have to use QObject::inherits() method to check that. Task-number: QTBUG-56713 Change-Id: I599b843e903c64329e6178752e0dc49f674bb890 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* QWidget::winId(): Remove documentation bit about macOSGabriel de Dietrich2017-01-191-4/+0
| | | | | | | | The Carbon port has been removed since 5.0, so there's only one framework against which we can build Qt. Change-Id: I38ce410f50cd4eda7abcc50ac4c4c7a23b3e1f45 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* docs: Mention that QWidget::ensurePolished() also affects childrenSergio Martins2017-01-191-2/+2
| | | | | | Change-Id: I083d1c503039010024c89db59003fb6fca050c26 Reviewed-by: David Faure <david.faure@kdab.com> Reviewed-by: Martin Smith <martin.smith@qt.io>
* Make shortcuts work for platform menu barsDmitry Shachnev2017-01-192-5/+16
| | | | | | | | | | | | | | | | | | | | | When a platform menu bar is used, the QMenuBar is hidden, so shortcuts for QActions attached only to it do not work. Extend the macOS-specific code to treat such menubars as visible to other platforms, to make the shortcuts work. The exception is made for internal QMenuBar shortcuts, which are forwarded to the platform menu. A follow-up change will add support for this to QDBusPlatformMenu. The updateGeometries() method is called for platform menu bars too to make sure the internal shortcuts are registered even if the global menu is in use. Add two cases to the tst_QMenuBar::activatedCount() test to test both native and non-native menu bars when possible (it now passes with native menu bars too). Change-Id: I2d7128512719ac199cd3f8f7ba28333d04d84ed4 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>