summaryrefslogtreecommitdiffstats
path: root/src/widgets/styles
Commit message (Collapse)AuthorAgeFilesLines
* Never handle scrollbars styled with box or border changes as transientVolker Hilsheimer2021-11-291-0/+10
| | | | | | | | | | | | | | | | If scrollbars are styled with a style sheet that includes a box or removes off the native border, then we never treat them as transient or overlapping. Otherwise, the layout logic in QAbstractScrollArea will show them on top of the viewport, overlapping the content. Add case to the style sheet test baseline test. It's a test for scrollbars in a scroll area, rather than a test for the styling of the scrollbars themselves. Fixes: QTBUG-98289 Pick-to: 6.2 Change-Id: Ic53ad248b3eedd54722ac7b2fe5256a27092dbc1 Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
* Fix and complete style sheet support for QToolButtonVolker Hilsheimer2021-11-261-39/+51
| | | | | | | | | | | | | | | | | | | Amends 2b2e7b2ac50e5b4f6e1888e594f6e32338dd2a80, which rewrote the rendering to remove the conflation of menu arrows and arrow icons, but introduced double rendering of the arrow icons if only the border was styled. Add a baseline test for style sheets, with a test function for QToolButton configured in various ways and styled with different style sheets. The new test case includes a Qt 5 build system so that we can compare Qt 5.15 with Qt 6. Fixes: QTBUG-98286 Pick-to: 6.2 6.2.2 Change-Id: I09cdc829c1a7e7913df4c3768dbe44b6dba4778b Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io> Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
* Initialize QStyleOptionProgressBar with QStyle::State_HorizontalZhang Hao2021-11-081-0/+1
| | | | | | | | | | | | | | In Qt 5, QStyleOptionProgressBar::orientation was Qt::Horizontal by default. In Qt 6, we need to init state with QStyle::State_Horizontal so that code setting up a style option doesn't need to do so explicitly. Amends add8262f72befc4c6a25403a21269030111054d1 Pick-to: 6.2 Fixes: QTBUG-93412 Done-with: Volker Hilsheimer <volker.hilsheimer@qt.io> Change-Id: Iaa311cf0f4bab72c0bacbd8e698ba24660bca6b8 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Fusion: Consistent width calculation and rendering of menu itemsVolker Hilsheimer2021-10-271-39/+45
| | | | | | | | | | | | | | | | | | The width calculation lacked the addition of the windowItemFrame constant, which was added in the rendering code. This resulted in ellision for long items. To make the code easier to follow, const'ify, rename, and reorder some local variables, and use constants from QFusionStylePrivate instead of (now obsolete and removed) constants copied from the Windows style. Break long lines as a drive-by. Fixes: QTBUG-94481 Pick-to: 6.2 Change-Id: I6d3e9d0feebee58fc70beaaf29236b8473242083 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io> Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
* widgets: Fix typos in source code commentsJonas Kvinge2021-10-152-7/+7
| | | | | | Pick-to: 6.2 Change-Id: I22f71a53b0f7f0698450123343e25548c889c3e2 Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
* widgets: Fix typos in documentationJonas Kvinge2021-10-123-8/+9
| | | | | | Pick-to: 5.15 6.2 Change-Id: I6b77f0ec043d08da3b7958d780dce9595daf97a6 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* Add style hint for preventing spin box selection on up/downVolker Hilsheimer2021-10-083-0/+8
| | | | | | | | | | | | | | | | | | | | | | On a mobile device, selecting text in a line edit brings up the text action popup for select/copy/cut. In a spinbox where the user changes the value using the buttons, this can be very irritating, without providing any usability - the user is unlikely to start typing, at least not without first transferring focus into the lineedit first to bring up the keyboard. This style hint allows styles to override the default behavior of QAbstractSpinBox. Implement the customization for the Android style, and add a test case for QSpinBox. [ChangeLog][QtWidgets][QStyle] A new style hint, SH_SpinBox_SelectOnStep, specifies whether pressing the up/down buttons or keys in a spinbox will automatically select the text. Fixes: QTBUG-93366 Change-Id: If06365a7c62087a2213145e13119f56544ac33b5 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io> Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
* Doc: fix qdoc warning, add \inmodule for qdrawutil headerVolker Hilsheimer2021-09-051-0/+1
| | | | | Change-Id: Iddc0273778adf79250b4e767172b1202817507bb Reviewed-by: Paul Wicking <paul.wicking@qt.io>
* Port to QImage and QPixmap deviceIndependentSize()Morten Sørvig2021-09-013-9/+5
| | | | | | | | | Replace the “size() / devicePixelRatio()” pattern with a call to deviceIndependentSize(). Change-Id: I9d9359e80b9e6643e7395028cd43e3261d449ae7 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* Modify the internal rectangle drawing of CE_RubberBandTang Haixiang2021-08-231-4/+7
| | | | | | | | | | | | | | | | | adjusted(1, 1, -2, -2) makes the rectangle smaller, but when rect.x1-rect.x2 = 0. Then x1 + 1, x2-2 leads to x1> x2. This will make the rectangle flip in advance. So there is a difference between the updated area and the drawn area. Add a judgment, when the rectangle we get is large enough, draw the inner rectangle. Fixes: QTBUG-95716 Done-with: Oliver Eftevaag <oliver.eftevaag@qt.io> Done-with: Volker Hilsheimer <volker.hilsheimer@qt.io> Pick-to: 6.2 Change-Id: I0d081a4ad7aee4a563acb988c0ef19a646bf1eea Reviewed-by: Oliver Eftevaag <oliver.eftevaag@qt.io> Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* QStyle: allow styles to control the margin around icons in QLineEditWang Peng2021-08-173-1/+7
| | | | | | | | | The styles can't control the margin of the icon container, and its value is hardcoded to a quarter of the iconSize, which is very unfriendly. Add a PixelMetric enum value to allow styles to control the margin. Change-Id: I21274b68d24150db7be78513fe9125f775aa2b00 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* StyleSheet: Use rule for ComboBox in embedded QLineEditVolker Hilsheimer2021-08-121-6/+5
| | | | | | | | | | | | | | | | | An editable combobox uses an embedded QLineEdit as an implementation detail. That lineedit should use the rules that are set for the combobox to render itself, similar to what was already implemented for the lineedit used in a QAbstractSpinBox. The containerWidget helper function provides the logic for identifying the container of the rendered widget, returning the QAbstractSpinBox or the QComboBox for an embedded QLineEdit. Use that method rather than duplicating the logic. Pick-to: 6.2 6.1 5.15 Fixes: QTBUG-95631 Change-Id: I50bc92a62715608b11c2c923f8f9215f56bfd15e Reviewed-by: Andy Shaw <andy.shaw@qt.io>
* Implement missing support for 'em' and 'ex' lengths in style sheetVolker Hilsheimer2021-08-101-22/+50
| | | | | | | | | | | | | | | | | | | | | | | | The Qt style sheet reference claimed that Length properties can be specified in 'em' or 'ex' units, but that was never implemented. Add the missing implementation. Since the sizes depend on the size of the font of the current element, we cannot convert the units in the CSS parser, but have to do so in the QRenderRule constructor, where we can make a decision about which font to use if the style sheet itself doesn't specify a font. Fall back to the widget font if possible; otherwise it will be the application default font. The implementation translates em into QFontMetrics.height, identical to what is already done in the QCssParser. This is in line with the CSS specification, but contradicts our previous documentation which stated that 'em' means "width of M". Fix the documentation. Fixes: QTBUG-8096 Pick-to: 6.2 Change-Id: I145e2504ae3b19101a0d0dd63653466b6c2cec1d Done-with: Cristian Maureira-Fredes <Cristian.Maureira-Fredes@qt.io> Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io> Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
* Fusion style: TabBar: Use common style to draw a close buttonNodir Temirkhodjaev2021-07-201-11/+0
| | | | | | | | | | Custom tab bar's close button looks outdated in Fusion style. Common style's close button looks much better. Task-number: QTBUG-94752 Change-Id: I9e9aba4a5cd1ee0d3b7fc230306c5e052b6ba3bd Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io> Reviewed-by: David Faure <david.faure@kdab.com>
* QStyle: Add SP_TabCloseButtonVolker Hilsheimer2021-07-203-25/+20
| | | | | | | | | | | | | | Move the static tabBarCloseButtonIcon helper into the standardIcon() implementation, simplified by using QIcon::addFile and the iconResourcePrefix helper. Add corresponding support in standardPixmap(). Use standardIcon() in PE_IndicatorTabClose where tabBarCloseButtonIcon() was previously used to get the icon, leave the caching in place. Fixes: QTBUG-95264 Change-Id: I89c161734553db762caa29f8ab738e3c6e64ea0a Reviewed-by: David Faure <david.faure@kdab.com>
* Respect style sheet rules for checked and selected menu itemsVolker Hilsheimer2021-07-141-1/+1
| | | | | | | | | | | | | | | | With a stylesheet that defines a rule for checked:selected menu items, the rule was never rendered. Instead, the checked rule was used. The 'act' variable was initialized based on State_Selected being set, but that state flags was never set on the temporary QStyleOptionMenuItem used to render the PE_IndicatorMenuCheckMark. Note: QStyleSheetStyle falls back to QWindowsStyle for this draw path. Task-number: QTBUG-73966 Pick-to: 6.2 Change-Id: I3044dbe8f60f1896f79af1afdb26094971704616 Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
* Support styled menu icons in otherwise unstyled menu itemsVolker Hilsheimer2021-07-142-30/+48
| | | | | | | | | | | | | | | | | | | | For a style sheet that defines a rule for the menu icon, but not for the item itself, we ignored the icon rule. Implement a separate rendering path for menu items with an icon. That rule takes precedence over a rule for menu item check indicators, as almost all styles reuse the icon for that. Factor the icon positioning and rendering code out into a private member function that we can reuse. Reduce amount of local variables to make the list of arguments for that member reasonable, the bit checks are cheap enough. Fixes: QTBUG-73966 Pick-to: 6.2 Change-Id: I64b6f5181e35527d0a163d9633a7414b50319829 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io> Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
* Use base style when drawing item view item with only indicator styledVolker Hilsheimer2021-07-141-5/+9
| | | | | | | | | The base style should still draw the item and the selection highlighting. Fixes: QTBUG-83619 Pick-to: 6.2 6.1 Change-Id: I1cd8c4fce48cb5543337415918fc99ffb5e19e00 Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
* QDuplicateTracker: accept the number of elements to reserve as a ctor argumentMarc Mutz2021-07-141-2/+1
| | | | | | | | | | | | This prevents us from first reserve()ing Prealloc elements, and then possibly reserve()ing a larger number, which leaves the first bucket list's memory unused. Consequently, deprecate reserve(). Change-Id: Ifc0a5a021097f4589557e7b5e45d9d0892797ade Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* Add high-resolution pixmaps for macOS dock widget title iconsVolker Hilsheimer2021-07-0521-8/+8
| | | | | | | | | | | The macOS style falls back to the QCommonStyle for those, and that style loads the macstyle pixmaps. Weird, but cleaning that up is for another commit. Fixes: QTBUG-38776 Pick-to: 6.1 6.2 5.15 Change-Id: Ie1fe721387e64cb91ee5fc528667a63e6ddd6eed Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* Put SVG versions of several built-in icons under version controlVolker Hilsheimer2021-06-2424-0/+416
| | | | | | | | | | | This is a collection of SVGs provided in the process of addressing QTBUG-38776. As of now, they are converted to PNGs or XPMs in different resolutions, which are then built into Qt as resources that are loaded into QIcon instances at runtime. Task-number: QTBUG-38776 Change-Id: Ib03f82cf1b1d2dc6260845fc46ad193046aff44c Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* Fix recursion crash when calling setStyleSheet with `qproperty-styleSheet`Zhang Yu2021-06-181-0/+3
| | | | | | | | | | | When calling `setStyleSheet` with property `qproperty-styleSheet`, `QStyleSheetStyle::polish` will call`QStyleSheetStyle::setProperties`, and then`QStyleSheetStyle::setProperties` goes on to call `setProperty`.Because there is property `qproperty-styleSheet`, it will update stylesheet by calling QStyleSheetStyle::polish`. This causes the recursive call to crash. Fixes: QTBUG-94448 Pick-to: 5.15 6.2 Change-Id: I79c51192a939b0b62e5b1d0dcc90d38f79e28222 Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
* Add a style hint to draw the left/top border lines when header is hiddenAndy Shaw2021-06-162-0/+6
| | | | | | | | | | | | Since there is no header then the cells appear with no actual border so it can look a bit strange without it. This ensures that the border is at least shown when there is no header to represent it if the style hint is turned on. This gives an option for those who want it to have it turned on. Fixes: QTBUG-85523 Change-Id: Ib94874bddddd31738fbcd41c6f77a2e0fa2ef443 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Make dockwidget title bar buttons show againVolker Hilsheimer2021-06-141-4/+6
| | | | | | | | | | Amends f61304fc77a622170ef3bbcbcb37c5a90c6f87ea, which renamed the files but didn't adjust the code. Task-number: QTBUG-38776 Pick-to: 6.1 6.2 Change-Id: If54dd986975dd28f147a98628317b1369d0c690f Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* Correctly support style sheet for toolbutton menus and arrowsVolker Hilsheimer2021-06-111-25/+96
| | | | | | | | | | | | | | | | | | | | | | | | | | QToolButton can show an arrow instead of an icon, and that arrow can, as per the documentation, styled via the ::down/up/left/right-arrow pseudo element. This was not working at all, as the implementation confused the down-arrow with the menu arrow. Implement this correctly for all arrow types. A QToolButton can also have different ways to show a menu, either by using a separate section of the button that can be clicked; this section can be styled via ::menu-button and ::menu-arrow. Or by instant or delayed menu popup when clicking the button itself, in which case the button shows an indicator in the button itelf; that indicator can be styled via the ::menu-indicator pseudo element. The old implementation confused the various options, and the name of the PseudeoElement_ToolButonDownArrow didn't help with that. So rename that element to PseudoElement_ToolButtonMenuIndicator, and render it when there is no separate drop down. Fixes: QTBUG-27640 Pick-to: 6.1 6.2 Change-Id: Ia142a5d7498fa717e70f4e5382305e305b29effa Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
* In headers with only the arrow styled, prevent overlapping with textVolker Hilsheimer2021-06-111-2/+19
| | | | | | | | | | | | | | | | | | A style sheet that styles only the header arrow, but not the header section or label, resulted in an overlapped text and header if the text was also right aligned. To prevent this, add the space required by the arrow to the size calculation, and shorten the space accordingly before rendering the right-aligned label. Make corresponding adjustments to vertical headers with bottom-aligned labels. Fixes: QTBUG-84117 Pick-to: 6.2 Change-Id: I782d9538b695ad55d2d70b6d230f66059598768f Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
* Calculate space requirement of menu items based on widest elementsVolker Hilsheimer2021-06-081-4/+5
| | | | | | | | | | | | | | | | | | Since icon, checkmark, text, and shortcut are each rendered aligned within their own column, we need to take the widest of each element into account when calculating the size requirement of each item. Otherwise an item with very long text but no icon will get enough space for the text, but no space for the icon, resulting in the text running over the shortcut or edge of the menu. Fortunately, QStyleOptionMenuItem provides us with the necessary information. Fixes: QTBUG-86754 Pick-to: 5.15 6.1 Change-Id: I0cf0e9adfe480d1004106e7475e498e718bf027b Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
* Doc: Use \deprecated instead of \obsoletePaul Wicking2021-05-261-1/+1
| | | | | | Task-number: QTBUG-93990 Change-Id: I4e512354a49dde6678ca89cabc56bc76ba666bb3 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* Don't draw focus frame if widget has style rules that affect borderDoris Verria2021-05-071-0/+9
| | | | | | | | | | | | | Skip drawing the focus ring if the widget has a custom styled border, custom focus ring, or any rule that affects the border. For QPushButton, if the style rule has a background set, the bevel will be drawn in the Windows style. Skip drawing the Mac focus frame in that case too. Fixes: QTBUG-93032 Pick-to: 5.15 6.1 Change-Id: I7c4d4bf6f6ce7bbcd17cd620586c5efa44f2b8d6 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* QTabBar: take a style sheet's font into account when laying out tabsVolker Hilsheimer2021-05-061-3/+18
| | | | | | | | | | | | | | If a tab has a font assigned to it through a style sheet, then take the font size into account when calculating the contents rectangle. Add a test, which hardcodes the windows style to avoid flaky behavior when e.g. macOS lays tabs out in the center. Fixes: QTBUG-92988 Pick-to: 6.1 Change-Id: Ifb0ac97db7647cc25367972737be8878e50f6040 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
* Fix build without features.texteditTasuku Suzuki2021-04-151-3/+3
| | | | | Change-Id: I3702137451bd5022c454645b1198d63843778214 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Cleanup leftover QWSTasuku Suzuki2021-04-141-2/+1
| | | | | | | QWS is replaced with QPA in Qt5 Change-Id: Iccec38e55ae23a27ebecd8010e1df7bba8aa5a33 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* Fix read-only pseudo-state in QPlainTextEdit stylesheetEirik Aavitsland2021-04-091-1/+7
| | | | | | | | | | Was implemented for the other text edit widgets, but not for QPlainTextEdit. Pick-to: 6.1 6.0 5.15 Fixes: QTBUG-92490 Change-Id: Idd2a1b5c743fc030d3f2d4dd24e98f806b58f4d9 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Fusion style: don't use large icons in QLineEditVolker Hilsheimer2021-04-071-3/+0
| | | | | | | | | Partly revert 24226bb5f595581a239356c18a338783a85349ca by falling through to the QCommonStyle implementation, which defaults to PM_SmallIconSize. Fixes: QTBUG-92460 Change-Id: I82f99e98640a962577fd94556bef04f4da5789e7 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* Fix incorrectly-drawn menu indicator for QPushButton on macOSDoris Verria2021-04-061-1/+2
| | | | | | | | | | | | | Because the QPushButton's bevel rect is smaller than its actual widget's rect, custom styled menu indicators are drawn outside the bevel frame on macOS. Fix this by drawing the menu indicator inside the bevel's rect instead of the widget's rect. Fixes: QTBUG-90250 Pick-to: 5.15 6.0 6.1 Change-Id: Ie63d68d8f564a4a640bdb8e7564f028784faab97 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io> Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
* Fix label margins for pulldowns with custom styled menu indicator on macOSDoris Verria2021-04-061-0/+7
| | | | | | | | | | | | Don't apply the QMacStyle's pulldownButton titlemargins to the QPushButton's contents rect if the button has a custom styled menu indicator. This causes the button's text/icon to be misaligned. Fixes: QTBUG-86134 Pick-to: 5.15 6.0 6.1 Change-Id: I6ef95d51071c1d79f1cc07425a46958f50091b7e Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io> Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
* Add setting the ICON size attribute in lineedit to the style pluginTang Haixiang2021-03-124-0/+11
| | | | | | | | | When the font is large enough, using PM_SmallIconSize will get a large lineedit,but the icon is very small. This is very unsightly, and the style plug-in hopes to be able to define the size of the icon by itself. Change-Id: I0e35b331301472541d3378e748dbcd074d5419a2 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Revert "QPushButton: fix support of style sheet rule for text alignment"Volker Hilsheimer2021-03-111-4/+2
| | | | | | | | | | | | | | | | This reverts commit 6269438af95bbd988ead08829fa3bc9dc25891e8, and adds a test. This change introduced QTBUG-91735, without fixing QTBUG-86857 correctly. The code already interprets the textAlignment values from the rule, also if no icon is set. Adding the same, or some default textAlignment to the text flags if there is no icon doesn't work. Fixes: QTBUG-91735 Task-number: QTBUG-86857 Pick-to: 6.1 6.0 5.15 Change-Id: Iee07e63a40e72909275f32e1caa28b33a595f879 Reviewed-by: Oliver Eftevaag <oliver.eftevaag@qt.io> Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
* Don't access data in moved-from objectVolker Hilsheimer2021-03-031-2/+2
| | | | | | | | | | | | | | It's undefined behavior, esp since we leave it to the compiler to implement a move constructor for the ButtonInfo struct. So read the data that we need first. Fixes static analyzer warning de76eedae524c86f89d6369c0f5af8c7. Pick-to: 6.1 Change-Id: I8fc458b7e9ba8904ec7a3b1c26aac0628e336ea2 Reviewed-by: Doris Verria <doris.verria@qt.io> Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
* Initialize QStyleOptionHeaderV2 with correct versionVolker Hilsheimer2021-02-221-1/+1
| | | | | | | | | Amends 4c6579eacded086ad014b0fd2432095362c1d131 Pick-to: 6.1 Task-number: QTBUG-91224 Change-Id: I9a41db9354bff2fa706cf6053aa229cdca16759e Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
* Complete documentation for QStyleOptionHeaderV2Volker Hilsheimer2021-02-221-22/+33
| | | | | | | | | | | Document the isSectionDragTarget variable, and add \inmodule command. Put code and documentation together. Amends 4c6579eacded086ad014b0fd2432095362c1d131. Pick-to: 6.1 Change-Id: Id8837ca75cd6af13c8dc4c028b304b279e507ade Reviewed-by: Christian Ehrlicher <ch.ehrlicher@gmx.de>
* Unbreak binary compatibility in QStyleOptionHeaderVolker Hilsheimer2021-02-194-13/+52
| | | | | | | | | | | | | | | | | 4d943846128118e1b9932a17ce6f977a0f4127a5 introduced a new data member to QStyleOptionHeader, and reduced the size of the orientation member. This changed the binary layout of class instances, and breaks ABI. 180c662b0790c6eceffdcb4661681d7df1541a2d added another member within the new bitfield. Introduce a new QStyleOptionHeaderV2 class instead with the new members, and use that in QHeaderView, and the styles using the new members. Fixes: QTBUG-91224 Pick-to: 6.1 Change-Id: I47e6841e6652e4b67f247b7b4514e90be5609156 Reviewed-by: David Faure <david.faure@kdab.com>
* QDial: fix painting QDial when the rect has an offsetChristian Ehrlicher2021-01-292-6/+6
| | | | | | | | | | When the QDial should be painted with an offset, the dial was not draw correct. Fixes: QTBUG-89574 Change-Id: I646c3d42fba34e8c603a8f81f363ed827f04d5de Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io> Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
* QHeaderView: Mark the drop section during section moveChristian Ehrlicher2021-01-293-4/+9
| | | | | | | | | | | Currently there is no visual feedback where the section move will end up. Therefore mark the drop section to show where the dragged section will be inserted. Fixes: QTBUG-673 Fixes: QTBUG-1114 Change-Id: I3e45a9a9c0604342bb0286fc7cd4c89c757c28cd Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
* QComboBox/Fusion style: elide text when it's too longChristian Ehrlicher2021-01-231-1/+2
| | | | | | | | | | The fusion style did not elide a very long text in a QComboBox as it's done in other styles / non-popup mode. Fixes: QTBUG-86632 Pick-to: 6.0 5.15 Change-Id: I356a61809220d41717a9039d2b33dd706d034941 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* QPushButton: fix drawing pushbutton with a menuChristian Ehrlicher2021-01-201-8/+9
| | | | | | | | | | | | | | | | | Drawing a QPushButton with a menu results in a clipped label text and a wrong aligned decoration and menu button. The position of the menu button was calculated wrong (spacing has to be subtracted since the start position is the right side). Also the text label alignment was done before it was adjusted for the menu button which results in an unaligned (in constrast to a pushbutton without a menu) label and decoration. Fixes: QTBUG-89619 Change-Id: I872d39ff2d8eb685fe6843e38c7f727868e1ee9a Reviewed-by: Samuel Gaist <samuel.gaist@idiap.ch> Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io> Reviewed-by: Funning <huangyub@uniontech.com> Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
* Make QStyle::proxy() always return the leaf proxySergio Martins2021-01-201-2/+4
| | | | | | | | | | | | | For example: fusion -> proxy1 -> proxy2 Now returns proxy2. Fixes: QTBUG-85556 Pick-to: 6.0 5.15 Change-Id: I2a60329f948b59ef7d0752d273bee3854a200547 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* Correct item indent in checkable menus in stylesheet styleEirik Aavitsland2021-01-201-2/+2
| | | | | | | | | | Not only the checkable items need to be indented, but all items in the same menu, so that they line up. Pick-to: 6.0 5.15 Fixes: QTBUG-90242 Change-Id: I559005f753b5cd19eaeeeb6658178d62de93b4ef Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* control scrolling of QTabBar using StyleHintSophie Kums2021-01-193-0/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Mouse wheel/touchpad scroll signals sent to the tab bar trigger cycling through the tabs. In applications where the tab bar is close to "mouse click hotspots", the cursor may accidentally be left over the tab bar instead of the main content of the window. When the user wants to scroll up/down the main conten, the scroll signals are thus sent to the tab bar and instead of scrolling, the focus switches to another tab. This is confusing to the user, because not only does the application not carry out the desired action (scrolling through the main content), it jumps to a different tab. Two common examples of applications affected by this nuisance are Konsole and any kind of browser (file browser or web browser), where the address bar is right below the tab bar. Moreover, on macOS, scroll events do not have an effect on the tab bar widget of the native UI. Currently, the code makes use of preprocessor directives to achieve consistent behavior on macOS (`#ifndef Q_OS_MAC`). This patch implements the check of a StyleHint in order to determine if scroll events on the tabbar should have an effect. This approach is more consistent with Qt coding style than OS-dependent preprocessor directives and, in addition, makes the behavior configurable according to the user's preferences. [ChangeLog][QtWidgets][QStyle] Added SH_TabBar_AllowWheelScrolling as a style hint to enable/disable cycling through tabs using the scroll wheel. This defaults to true in all styles except the macOS one so there is no change in existing behavior. Change-Id: I99eeb5a1aab03cbc574fac7187d85a8a2d60cf34 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io> Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
* QTabBar/Windows: Fix close button icons being too small on high-res screensFriedemann Kleint2021-01-155-11/+29
| | | | | | | | | | Add 32x32 versions. Move the icon creation to a helper function. Fixes: QTBUG-88230 Pick-to: 6.0 Pick-to: 5.15 Change-Id: I6dda2084e0122234eacea17ac191a19f6855f466 Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>