summaryrefslogtreecommitdiffstats
path: root/src/widgets
Commit message (Collapse)AuthorAgeFilesLines
* Windows: Use SM_CXSMICON instead of SM_CXICON for the tray icon sizeFriedemann Kleint2017-11-041-3/+2
| | | | | | | | Partially reverts b465fe759695bb7e1de693c3d4d20acfd2c49779. Task-number: QTBUG-63447 Change-Id: Iaf8a54b59a054e33811f65f64322af3aa746885e Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
* QListView: make sure to respect grid size during dataChanged() handlingChristian Ehrlicher2017-11-041-3/+12
| | | | | | | | | | | | When the dataChanged() signal is handled by QIconModeViewBase, the size of the items are recalculated. During this operation the optional grid size is not taken into account which leads to a screwed up layout. This patch adds the missing check similar it is done in doStaticLayout()/doDynamicLayout(). Task-number: QTBUG-45427 Change-Id: Iba7adb44b1510c511a69c289ccb4f168992a6871 Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
* Disable window shortcuts if there is a window modal dialogElvis Angelaccio2017-11-041-1/+1
| | | | | | | | | | | | | | | | | If a window is blocked by a WindowModal dialog, it should not be possible to trigger window shortcuts on that window if it receives a WindowActivate event. This currently happens if the blocked window gets clicked, because the window becomes the active_window and then QApplication sends it a WindowActivate event (this doesn't happen with application modal dialogs). The correctWidgetContext() function calls QApplicationPrivate::tryModalHelper() only if the shortcut context is ApplicationShortcut. This patch makes it call even if the shortcut context is WindowShortcut. Change-Id: Iff87d85bcae603a6a24128e0cedfa9d33b6485fd Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
* Make sure that QAccessibleWindowContainer::childCount is validFrederik Gladhorn2017-10-251-1/+1
| | | | | | | | | | | When embedding foreign windows, we won't be able to return a valid child accessible interface, so do not report it at all. Supporting foreign windows properly is platform specific and something to consider, but at least we shouldn't crash. Task-number: QTBUG-63451 Change-Id: I19350cf97dc8d0c3f3052411eba0eee5f750dbab Reviewed-by: Jan Arve Sæther <jan-arve.saether@qt.io>
* QWizard: Do not remove the Next button's shortcutMaciej Czarnecki2017-10-241-2/+2
| | | | | | | | | | | Currently on Windows, the Next button's shortcut doesn't work, because QWizard overrides it with an empty key sequence. The key sequence should be changed only if isVistaThemeEnabled() returns true. Task-number: QTBUG-46894 Change-Id: I54f26388b167973cc8065a867d9e771c1e6a2a72 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* QAction: fix ::setData() always emits changed()Yulong Bai2017-10-241-0/+2
| | | | | | | | | | | | QAction::setData() always emits changed() even without actual data change. Original code lacks a guard to check if the data changes. According to http://doc.qt.io/qt-4.8/signalsandslots.html, adding guard also benefits to prevent infinite looping in case of cyclic connections. Task-number: QTBUG-62006 Change-Id: I776369b668082f9f02e4502a36b1ae234ee7e079 Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
* Add clarifying documentation for QLayout::removeWidget()Andy Shaw2017-10-241-1/+2
| | | | | Change-Id: I6c256c6c5cdfed6ceb45758d708fdc8f74d2939f Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io>
* QShortcut: Fall back to cross platform code in absence of QPA menuGabriel de Dietrich2017-10-171-1/+3
| | | | | | | | | | | On macOS, absence of a QPA menu means that we should be using our own internal logic since there's no entity on the QCocoaMenuDelegate to take care of the shortcuts. Change-Id: I35ed8f0b55445f61d0528709d4debb636a502002 Task-number: QTBUG-61039 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io> Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* QSystemTrayIcon/Windows: Fix position of context menu with High DPI scalingFriedemann Kleint2017-10-161-0/+9
| | | | | | | | Apply scale factor of screen. Task-number: QTBUG-63781 Change-Id: I1b5630edbdf6bb356955a7d70458a885af441953 Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* Remove some unused, local variablesJędrzej Nowacki2017-10-142-2/+0
| | | | | Change-Id: I453162d2d396bb3427064d3b1593bb6c71376605 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* QDockWidget - improve resizeThorbjørn Lund Martsum2017-10-101-1/+3
| | | | | | | | | | | | | | | | | | | | | | | | | On high DPI (e.g Apple Retina) user resizes of QDockWidgets (with custom titlebars) could fail. There was a cursor position check in mouse move event bailing out if the cursor pos was not within the widget. The problem was that we could be on the edge (or maybe even cross it?). Furthermore there is (/was) no similar check when setting the cursor to be a resize cursor, so users will obviously expect the resize to occur. This solves a part of QTBUG-63526 [ChangeLog][QtWidgets][QDockWidget] Fixed an issue in QDockWidgets where the widget would not resize despite showing a resize cursor. Task-number: QTBUG-63526 Change-Id: Ifa842a109071552506da3a82822d903dc252c8cd Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com> Reviewed-by: Andy Shaw <andy.shaw@qt.io>
* Fix crash when reparenting window containerPaul Olav Tvete2017-09-281-2/+4
| | | | | | | | | | | | | | | | QWindowContainer assumed that a widget could never change from native to non-native. This is not a fact when the window container is reparented to toplevel and back. In this case, usesNativeWidgets would be stuck at true, and parentWasChanged() would go down the native widget path, triggering an assert. The solution is to always recalculate the usesNativeWidgets bool. Task-number: QTBUG-63168 Change-Id: I88178259878ace9eb5de2ee45ff5e69b170da71c Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io> Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io> Reviewed-by: Błażej Szczygieł <spaz16@wp.pl>
* Return focus to correct widget after showing menuPaul Olav Tvete2017-09-261-1/+2
| | | | | | | | | | | | | | | By the time we call setKeyboardMode(true), the menu may already have taken focus. This change sets keyboardFocusWidget before opening the popup, and makes sure that keyboardFocusWidget is not set to the popup. (We cannot remove the assignment from setKeyboardMode(), since it's called from several places.) [ChangeLog][QtWidgets] Fixed widget losing focus after showing menu second time. Task-number: QTBUG-56860 Change-Id: Ic01726bf694e6f365dd7b601ad555156e0fdf6c5 Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
* Make QDateTimeParser a separate featureEdward Welbourne2017-09-252-4/+11
| | | | | | | | | | | | | | It was being mis-described in some places by a QT_CONFIG(timezone) test, replacing older QT_BOOTSTRAPPED checks; but it has no time-zone dependency (until 5.10). So make it a separate feature in its own right. It turns out QAbstractSpinBox's presumed dependency on datetimeedit was an illusion caused by use of QDATETIMEEDIT_*_MIN symbols actually provided by datetimeparser; so remove its bogus dependency. Change-Id: Ibc12f4a9ee35acb64a39a1c7a15d2934b5710dc0 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QCompleter: Send activated() signal only once on return keyGabriel de Dietrich2017-09-222-12/+21
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Due to the complex event forwarding logic between QCompleter, QComboBox, QLineEdit and QWidgetLineControl, in some cases the same single user return key press could result in duplicated activated() signals being emitted by QComboBox. The first one would be emitted because QLineEdit emitted editingFinished() as a result of QCompleter::eventFilter() having forwarded the return key press event to QComboBox. The second one, would happen right after, as QCompleter::eventFilter() would process the same event on behalf of its popup. (We recall that QCompleter is installed as its own popup event filter. That's also the case for the completer's widget, although the purpose there is limited to focus-out events). The current fix consists on skipping the emit as a result of QLineEdit::editingFinished() if the completer's popup is still active. For this to be accurate, it helps to test whether the completer's popup is visible, so we will not be hiding it in QWidgetLineControl::processKeyEvent() anymore. Indeed, we know that if the popup is visible, that means that processKeyEvent() was called after being forwarded by the completer's popup event filter. Furthermore, the popup will be hidden by its event filter shortly after it returns from said event forwarding call. Based on a patch by Alexey Chernov <4ernov@gmail.com>. Task-number: QTBUG-51858 Task-number: QTBUG-51889 Change-Id: I013f6c3000ae37b5b0ec20eaf5cf7746c9c903e3 Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
* Avoid calling QCompleter::popup() internallyGabriel de Dietrich2017-09-223-11/+18
| | | | | | | | | | QCompleter::popup() is used to lazily create the popup itself. However, we oftentimes call this function only to check if the popup is visible. Change-Id: I55531e1e6810c02a44f5f65124cf641b1a89de69 Reviewed-by: Gabriel de Dietrich <gabriel.dedietrich@qt.io> Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
* QTabWidget: Don't build expensive parts of the style option when hiddenGabriel de Dietrich2017-09-221-34/+49
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We end up calling setUpLayout() quite a few times and, in particular, every time we add a new tab. Even if the tab widget is hidden, we set the layout item margins to ensure that whatever layout will contain the tab widget can get the proper sizing. For all practical purposes, layout item margins don't depend on the contents itself, but are rather a simple constant returned by the style. This means that QStyleOptionTabWidgetFrame ::tabBarSize, among a few other properties, is not needed right away. This property in particular is quite expensive to compute because it requires measuring the text size of each tab. This can lead to a quadratic behavior: the size of each tab's text will be computed for each tab we add. Besides, text size computing has become a relatively expensive function in itself (see QTBUG-53151, for example). The current solution just uses a partially initialized style option object for the sole purpose of getting the tab widget's layout item margins from the style. The performance improvements detailed show the creation time for QTabWidget with the specified amount of tabs (times in ms): Tabs Before After ------------------- 1 6 5 5 6 6 10 8 6 50 57 17 100 178 21 200 673 33 Task-number: QTBUG-55126 Change-Id: I79505dbd0014f6ed185da28047d8b68f9462ba94 Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
* Fix QGraphicsEffect draw error size in decimal scale factorIceyer Lee2017-09-211-1/+1
| | | | | | | | | | When QT_SCALE_FACTOR=1.5 or other decimal, QWidget draw QGraphicsEffect in error size. Use QPaintDevice::devicePixelRatioF instead QPaintDevice::devicePixelRatio() will fix it. Change-Id: I423e224d73b948ecdeca0e6b24c51f12a724a0ba Reviewed-by: Jesus Fernandez <Jesus.Fernandez@qt.io> Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
* Itemviews: Set the WA_InputMethodEnabled attribute correctlyAndy Shaw2017-09-201-10/+8
| | | | | | | | | | When focus is put back onto an itemview and the current item is editable then the WA_InputMethodEnabled attribute should be set. Likewise this should be set/unset when the current index changes too, depending on whether the index is editable or not. Change-Id: Iaea075e669efd21bdaa89a49c500c449272d098b Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
* QGestureManager::filterEventThroughContexts(): Reduce debug outputFriedemann Kleint2017-09-201-2/+35
| | | | | | | | | Log only relevant input events which are ignored. This reduces the output when COIN re-runs failing item view tests with full debug output enabled. Change-Id: Ifce9a56fdf313b7572baff9de8fb298b38e8b33a Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Convert features.menu to QT_[REQUIRE_]CONFIGStephan Binner2017-09-1955-116/+184
| | | | | Change-Id: I031356411294b259ebd2b22c53159c93fd92af6e Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
* Convert features.textedit to QT_[REQUIRE_]CONFIGStephan Binner2017-09-1919-64/+66
| | | | | Change-Id: I0fb0e658796484f374586d8d1f0f1b9167ab30d2 Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
* QMenu: Fix size on high DPI + multi screenThorbjørn Lund Martsum2017-09-132-0/+20
| | | | | | | | | | | | | | | | | When calculating item sizes (used for menu size) the styles consider the widget screen. This widget screen could be a wrong default or an obsolete value. This patch ensures the screen is correct set on popup. [ChangeLog][QtWidgets][QMenu] Fixed menu size issue when using high DPI on multi-screen system. Task-number: QTBUG-59794 Change-Id: I84461441d5d33cb8dc04ab1acb9630fbfc8c5514 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io> Reviewed-by: Morten Kristensen <msk@nullpointer.dk> Reviewed-by: Per Liboriussen <liborius@chelys.dk> Reviewed-by: Gabriel de Dietrich <gabriel.dedietrich@qt.io>
* Convert features.slider to QT_[REQUIRE_]CONFIGStephan Binner2017-09-1214-40/+47
| | | | | Change-Id: I03adb5e34071aa106bbfe7caa2d41a93e8d1e263 Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
* Convert features.lineedit to QT_[REQUIRE_]CONFIGStephan Binner2017-09-1228-59/+80
| | | | | Change-Id: I509977994b11a7fc0c109bfcc83aadeee6c9b0b8 Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
* Convert features.spinbox to QT_[REQUIRE_]CONFIGStephan Binner2017-09-1229-82/+98
| | | | | Change-Id: Idecb6927c20ff009795b0ad94bbb7199df98a8f8 Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
* Convert features.sizegrip to QT_[REQUIRE_]CONFIGStephan Binner2017-09-1214-49/+61
| | | | | Change-Id: Ieac4ae1f0b8b84e943c00da9903346a44e57138c Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
* Convert features.mdiarea to QT_[REQUIRE_]CONFIGStephan Binner2017-09-1115-46/+43
| | | | | Change-Id: I6d2ec035a218869aa6595f5848de94ce491d3124 Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
* Convert features.mainwindow to QT_[REQUIRE_]CONFIGStephan Binner2017-09-1119-44/+59
| | | | | Change-Id: If7efc8c15d8876f5bc5575d48686894ea71bbe62 Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
* Convert features.completer to QT_[REQUIRE_]CONFIGStephan Binner2017-09-0415-62/+66
| | | | | Change-Id: If45a46c08b37d245229a39f3d6ffbb34154934f2 Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
* Convert features.buttongroup to QT_[REQUIRE_]CONFIGStephan Binner2017-09-048-36/+36
| | | | | Change-Id: Id5df397d0aa4cad7f586ef7303902d8ee7b88f1d Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
* Convert features.effects to QT_[REQUIRE_]CONFIGStephan Binner2017-09-047-20/+27
| | | | | Change-Id: I8421b5e81dc21e8f9f6bdd9f714fb3f535618a3c Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
* Convert features.resizehandler to QT_[REQUIRE_]CONFIGStephan Binner2017-09-043-8/+6
| | | | | Change-Id: I44ed1be0cf56daf7dc2a7e4bbd3402419a04a530 Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
* Convert features.scrollarea to QT_[REQUIRE_]CONFIGStephan Binner2017-09-0414-39/+37
| | | | | Change-Id: Ifc7b0a6b025c282234b4aeaf23daecff8a558236 Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
* Convert features.keysequenceedit to QT_[REQUIRE_]CONFIGStephan Binner2017-09-044-15/+12
| | | | | Change-Id: Id8ffd7f0e6ef4bdc43959179c26342ecee75b280 Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
* Convert features.menubar to QT_[REQUIRE_]CONFIGStephan Binner2017-09-0426-88/+114
| | | | | Change-Id: Idbd4978852fa280dd18a5684469d499da3892126 Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
* Convert features.stackedwidget to QT_[REQUIRE_]CONFIGStephan Binner2017-09-046-14/+14
| | | | | Change-Id: I06b7fb9736620dcdfda21fc0a06e13cb02f9a1e7 Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
* QWidgets/CommonStyle: Fix tooltip drawing under HighDPIAlessandro Portale2017-08-291-7/+2
| | | | | | | | | | | Delegating the border painting to qDrawPlainRect ensures that there are no off-by-one pixel issues. Task-number: QTBUG-61849 Change-Id: I56dc849da80fad00d02a0f9c60dbb621e6de7c48 Reviewed-by: Michael Winkelmann <michael.winkelmann@qt.io> Reviewed-by: J-P Nurmi <jpnurmi@qt.io> Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
* QCompleter: Add check before setting the widgetGabriel de Dietrich2017-08-281-0/+4
| | | | | | | | | | | | This prevents unnecessarily removing and reinstalling the completer as event filter on the same widget. This does not prevent what's going on in QComboBox::focusInEvent(), where we'd set the line edit as widget just to immediately override it with combo box itself. Change-Id: I70c081a920f4daf4d7560e5cd7158e4070042d42 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* QMenuPrivate: Fix implicit type conversion warningsGabriel de Dietrich2017-08-251-6/+6
| | | | | | | | As reported within Qt Creator. Change-Id: I9dc06b9fba52936e01e01fb0e8cdf4b216c46551 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QWidget: Call appropriate QWindow method from setGeometry_sys()Gabriel de Dietrich2017-08-231-4/+10
| | | | | | | | | | | | | | | | | | | | | | | When calling resize() from showEvent(), we'd set the full geometry on the widget's QWindow. This resulted in the top-level window being moved to the top-left corner, even though no other call to move() or setGeometry() had happened before. The solution consists on calling the proper QWindow methods depending on whether setGeometry_sys() is called for a move, a resize or both. Furthermore, this needs QWindow::resize() to set its position policy to frame-exclusive. The documentation states that is already the case and we're setting the full geometry on the platform window, so we need to convey that bit of information. This also solves the age-old conundrum: "### why do we have isMove as a parameter?" Change-Id: I2e00fd632929ade14b35ae5e6495ed1ab176d32f Task-number: QTBUG-56277 Reviewed-by: Gabriel de Dietrich <gabriel.dedietrich@qt.io> Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* macOS: Fix padding around tab label with iconEskil Abrahamsen Blomfeldt2017-08-181-1/+6
| | | | | | | | | | | | | | | | | Change c12072c685f7e93d5b84e289ca23106482379eff fixed a problem where tab labels would overlap with the icons if the tab became too small to contain the text. But it did not properly account for the full area occupied by the icon, because the horizontal padding is hardcoded to 4 in the mac style, whereas in the common style (where the icon is drawn) it uses the pixel metric for this. In addition, the change only allocated space on the left side, causing the label to no longer be centered. Task-number: QTBUG-61235 Change-Id: Ieec4f7044584361f92045addbc8bbd81bd5c9fc7 Reviewed-by: Gabriel de Dietrich <gabriel.dedietrich@qt.io>
* QMenu: Prevent torn-off menus from extending behind the taskbarGabriel de Dietrich2017-08-162-12/+14
| | | | | | | | | | On Windows and macOS, that area of the menu can become inaccessible if the menu is tall enough. Since these are not popups but tool windows, the test for UseFullScreenForPopupMenu should not apply for torn-off menus. Change-Id: Ife7836bef568896a5bb67d42a2af412f06a871d6 Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* Convert features.graphicsview to QT_[REQUIRE_]CONFIGStephan Binner2017-08-1576-321/+209
| | | | | Change-Id: I1083097802772624e5d414678b4612308683a56f Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
* Widgets: Fix ImSurroundingText query for a QLineEdit with maskJarkko Koivikko2017-08-112-1/+6
| | | | | | | | | | | | | | | | | | | | | QLineEdit with a mask does not return empty fields with the ImSurroundingText query. This is a problem for the input context that is not aware of the mask and relies on the fact that the cursor position never exceeds the boundaries of the surrounding text. This change fixes the issue by returning unmasked text with the ImSurroundingText query. [ChangeLog][QtWidgets][QLineEdit] Fixed behavior of the ImSurroundingText query. Previously, it returned a masked text whose length may be less than the cursor position. Now it returns unmasked text, so the text length is always greater than or equal to the cursor position. Task-number: QTBUG-60319 Change-Id: I1c8009164836a1baa2e3a45958bf1ea5fa9be38d Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* Convert features.toolbutton to QT_[REQUIRE_]CONFIGStephan Binner2017-08-1018-43/+63
| | | | | Change-Id: I4227e1868da21bded76a8ec55996c436c8a8d763 Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
* Convert features.splitter to QT_[REQUIRE_]CONFIGStephan Binner2017-08-108-14/+19
| | | | | Change-Id: I2eea5004938c581beb5a7c0c01409c576c5e5b39 Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
* Convert features.groupbox to QT_[REQUIRE_]CONFIGStephan Binner2017-08-1011-29/+36
| | | | | Change-Id: I034286043a880ab777ec3f2311572bdc38e7fafc Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
* Convert features.scrollbar to QT_[REQUIRE_]CONFIGStephan Binner2017-08-1025-43/+67
| | | | | Change-Id: Id6ea899c0fddf0de636701cfdc5f01ba20024976 Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
* Convert features.toolbox to QT_[REQUIRE_]CONFIGStephan Binner2017-08-107-20/+18
| | | | | Change-Id: I7abfe0166a021c439f6ed4465631ba62660ef001 Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>