summaryrefslogtreecommitdiffstats
path: root/src/widgets/styles
Commit message (Collapse)AuthorAgeFilesLines
* QPushButton/fusion style: don't ignore QIcon::On iconChristian Ehrlicher2021-01-141-8/+0
| | | | | | | | | | | | | | | The fusion style did ignore the QIcon::On icon because it reset State_On to avoid the visual shift of a pressed button. But it's not needed to reset this flag - the shift does not happen because the fusion style does return 0 as offset for PM_ButtonShiftHorizontal/PM_ButtonShiftVertical so no shifting will happen. Fixes: QTBUG-86736 Fixes: QTBUG-82110 Change-Id: Ie2aaddb14bc67874f5a9a23d9f04d7a08c6d070f Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io> Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
* QStyle: add name() to return the name of the styleChristian Ehrlicher2021-01-145-1/+41
| | | | | | | | | | | | Currently there is no way to get the name of the current style to e.g. create a QProxyStyle for a specific widget only. Therefore add QStyle::name() so QProxyStyle(const QString &) can be called without hard-coding the style name. Remove an unused doc snippet as drive-by. Fixes: QTBUG-8004 Change-Id: I466c5e870a5392b238365bdc930f6a2ecee50cdb Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
* Fix read-only pseudo-state in QTextEdit/Browser stylesheetEirik Aavitsland2021-01-131-0/+13
| | | | | | | | | Was implemented for QLineEdit but not QTextEdit. Fixes: QTBUG-83056 Pick-to: 6.0 5.15 Change-Id: I1e67ad0f1c230a062a1e12e8bc0b209c5289dc32 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Set the PlaceholderText color in the palette from the stylesheet as wellAndy Shaw2021-01-121-0/+1
| | | | | | | | | | The color should be used across the board, so the PlaceholderText color should also be respecting the one passed for Text and so on. Fixes: QTBUG-89815 Pick-to: 6.0 5.15 Change-Id: I2accb3db35488f95a1c8ebacf2316a08ee416fac Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Remove the qmake project filesJoerg Bornemann2021-01-071-49/+0
| | | | | | | | | | | | | | | | Remove the qmake project files for most of Qt. Leave the qmake project files for examples, because we still test those in the CI to ensure qmake does not regress. Also leave the qmake project files for utils and other minor parts that lack CMake project files. Task-number: QTBUG-88742 Change-Id: I6cdf059e6204816f617f9624f3ea9822703f73cc Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Kai Koehne <kai.koehne@qt.io>
* QStylesheetStyle: fix push button label alignmentChristian Ehrlicher2020-12-241-1/+1
| | | | | | | | | | | Due to a copy'n'paste error in 01ec11507d7ef3de09bad9d1ef8e6d4a3d6c4428 the valign was not properly determined for text-align bottom. Fixes: QTBUG-89366 Change-Id: I081e1b24bba0edd9dd3754599a111c1658b18746 Pick-to: 6.0 Reviewed-by: Liang Qi <liang.qi@qt.io> Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* QStyleOption: avoid code duplicationChristian Ehrlicher2020-12-231-47/+21
| | | | | | | Use delegate constructors to avoid code duplication Change-Id: I5c7d3764966ec07d1e3d175ccb075c64408d2338 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* QHeaderView: respect the font role while calculating the elided textChristian Ehrlicher2020-12-101-0/+10
| | | | | | | | | | | | | Amends 4d943846128118e1b9932a17ce6f977a0f4127a5: - The macOS style must now elide the text by it's own since it is no longer done by QHeaderView - Add documentation of QStyleOptionHeader::textElideMode - Remove unused variables from QHeaderView::initStyleOptionForIndex() Task-number: QTBUG-86426 Change-Id: I98fc6771c0cd56d6002390125ffbab1269f6dd39 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* QWidget: mark obsolete function isTopLevel() as deprecatedChristian Ehrlicher2020-12-091-1/+1
| | | | | | | | QWidget::isTopLevel() is deprecated and can be replaced 1:1 with isWindow(). Sadly it's was not marked with Q_DECL_DEPRECATED in 5.15 Change-Id: I4508fbde41927f3b82e47a75011179548325029d Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* QHeaderView: respect the font role while calculating the elided textChristian Ehrlicher2020-12-083-8/+13
| | | | | | | | | | | | | | | | | The font role in the header view was not taken into account when the text for an item should be elided. This leads to a wrongly elided text esp. visible when the font size is different to the font of QHeaderView. Fix it by passing the elide mode to the style since only the style knows the used font (e.g. bold or not bold) and available rect. This is now in sync with CE_ItemViewItem where the eliding is also done by the style and not by the item view. [ChangeLog][QtWidgets][QHeaderView] QStyleOptionHeader got a new member textElideMode. Fixes: QTBUG-86426 Change-Id: If6914fe5aaa5d285e6da55d2129f9249d90da3d7 Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
* QStyleAnimation: make sure the last frame of animation is renderedWang Chuan2020-12-071-2/+2
| | | | | | | | | | Amend to 8738f09b9fc1b35e3dc78211368d87069f3071f7. The last frame of animation might be lacked if [_skip < fps]. Fixes: QTBUG-89118 Pick-to: 6.0 5.15 Change-Id: Ia0345e2aff7579afe2d60c4e7495bfaa1f36198c Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
* Use (new) erase()/erase_if() algorithmsMarc Mutz2020-12-051-1/+1
| | | | | Change-Id: I45c18fd45c20b226e44d16315e3ebb6c305d4ab0 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Replace discouraged Q_MOVABLE_TYPE by Q_RELOCATABLE_TYPEAndreas Buhr2020-11-301-1/+1
| | | | | | | | | | | | | | Q_MOVABLE_TYPE was conceived before C++ had move semantics. Now, with move semantics, its name is misleading. Q_RELOCATABLE_TYPE was introduced as a synonym to Q_MOVABLE_TYPE. Usage of Q_MOVABLE_TYPE is discouraged now. This patch replaces all usages of Q_MOVABLE_TYPE by Q_RELOCATABLE_TYPE in QtBase. As the two are synonymous, this patch should have no impact on users. Pick-to: 6.0 Change-Id: Ie653984363198c1aeb1f70f8e0fa189aae38eb5c Reviewed-by: Lars Knoll <lars.knoll@qt.io> Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
* QPushButton: fix support of style sheet rule for text alignmentXiang Xiaojun2020-11-261-2/+4
| | | | | | | Fixes: QTBUG-86857 Pick-to: 5.15 6.0 Change-Id: I7e3e2b5323b1e46f572cacfddae20cb6e7882a47 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Adjust code format, add space after 'if'Zhang Sheng2020-11-165-20/+20
| | | | | | Change-Id: Ice081c891ff7f4b766f49dd4bd5cf18c30237acf Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io> Reviewed-by: hjk <hjk@qt.io>
* Adjust the format of code blocks in function pixelMetric()Xu Shitong2020-11-161-13/+16
| | | | | Change-Id: I1ef3c1beb686af090311297523d5d69380a62fbe Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
* Remove Qt4Compatible paintingAllan Sandfeld Jensen2020-11-122-12/+0
| | | | | Change-Id: Ie54206ca9b509875568f2158e229fca9cb1860a2 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Fix qstylesheetstyle clip border errorLu YaNing2020-11-081-2/+2
| | | | | | | | | | | | The left border path clip error when border size is odd. That because borderClip calc path with border with divide 2. It should be 2.0 that make result to accurately real number. Pick-to: 5.15 Change-Id: I8c6f358afa4f3c8c9e5b263707ee145f6e5491c0 Reviewed-by: David Faure <david.faure@kdab.com> Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com> Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Don't show QPushButton as hovered unless the mouse is within the bevelVolker Hilsheimer2020-10-221-0/+1
| | | | | | | | | | | | | | | Previous fixes made QPushButton correctly respect the style sheet boxing model (as it's documented to do), ignoring clicks that were within the margin area of the button (ie outside the bevel). However, a hover state selector in the style sheet would still be used for the entire widget. Turn on mouse tracking for widgets that have a hover state selector, and handle mouseMoveEvent to set an explicit hovered state only when the mouse hits the button. Use that state to initialize the style option. Fixes: QTBUG-87706 Change-Id: I2f423b760c85cfab9faac4be44a5c7dcf2ba1c23 Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
* Another round of replacing 0 with nullptrAllan Sandfeld Jensen2020-10-071-2/+2
| | | | | | | | | This time based on grepping to also include documentation, tests and examples previously missed by the automatic tool. Change-Id: Ied1703f4bcc470fbc275f759ed5b7c588a5c4e9f Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* Rename the new platform APIs from QPlatformInterface to QNativeInterfaceTor Arne Vestbø2020-10-071-1/+1
| | | | | | | | | | | | We were already using the 'native' nomenclature when referring to these kinds of APIs, e.g. when talking about native handles, or the existing QPlatformNativeInterface on a QPA level. Using 'native' for the user facing APIs also distinguishes them from the 'platform' backend layer in QPA and elsewhere. Change-Id: I0f3273265904f0f19c0b6d62471f8820d3c3232e Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io> Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Fusion: Don't add unnecessarily extra padding for a groupboxAndy Shaw2020-09-251-1/+6
| | | | | | | | | | | | | If there is not a title or an indicator for a groupbox, then there is no reason to add extra padding for it when placing the contents of the groupbox. So this accounts for when one or the other is not set so that the space is used more evenly. Fixes: QTBUG-86411 Change-Id: I536798b57e1195c5a13218f1f82431c4e91f6852 Pick-to: 5.15 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io> Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
* Fix some qdoc warnings: typosVolker Hilsheimer2020-09-211-1/+1
| | | | | | | | It's \reimp, not \reimpl, and this particular textAlignment variable documentation is for QStyleOptionComboBox. Change-Id: I90f1519410a4378c54777e29acce70b55975e70e Reviewed-by: Paul Wicking <paul.wicking@qt.io>
* Fix conversion warnings when setting alpha to QColorFriedemann Kleint2020-09-152-2/+2
| | | | | | | Adapt to 5bb4baae0379d5903f547f0399be9620f5ab06a0. Change-Id: Id65f87740f9de8e0d3624ff63c431dcad642f3a5 Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
* QStyleSheetStyle: Fix push button hit testing with paddingVolker Hilsheimer2020-09-151-2/+5
| | | | | | | | | | | | | Amends f9940b15f7f0fde731431626172939b9821fd660, which amended 6e1d70ae12baae4610356ec7b69635ad75a97b4e. The bevel of the button is not defined by the contentsRect, but by the borderRect that the stylesheet style calculates. Change-Id: I9a0d5bf29a06ce2270014f0d144e33cc3a1a7473 Pick-to: 5.15 Fixes: QTBUG-86587 Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
* Make QStringList an alias to QList<QString>Lars Knoll2020-09-121-1/+0
| | | | | | | | | | | | | | | | | | Fix our API, so that QStringList and QList<QString> are the same thing. This required a bit of refactoring in QList and moving the indexOf(), lastIndexOf() and contains() method into QListSpecialMethods. In addition, we need to ensure that the QStringList(const QString&) constructor is still available for compatibility with Qt 5. Once those two are done, all methods in QStringList can be moved into QListSpecialMethods<QString>. Change-Id: Ib8afbf5b6d9df4d0d47051252233506f62335fa3 Reviewed-by: Andrei Golubev <andrei.golubev@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Doc: Clean up widget snippets projectPaul Wicking2020-09-101-1/+1
| | | | | | | | | | The main snippets project must be a subdirs project. Move some files and update the affected documentation. Task-number: QTBUG-86497 Pick-to: 5.15 Change-Id: I60073d1b8bd53aa09600eeccf06ba8457ac7c708 Reviewed-by: Venugopal Shivashankar <Venugopal.Shivashankar@qt.io>
* Port from devicePixelRatioF() to devicePixelRatio()Morten Johan Sørvig2020-09-103-6/+6
| | | | | | | This ports all of QtBase. Change-Id: If6712da44d7749b97b74f4614a04fac360f69d9e Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* QStyleOptionGraphicsItem: remove deprecated member matrix/levelOfDetailChristian Ehrlicher2020-09-062-36/+2
| | | | | | | | QStyleOptionGraphicsItem::matrix and levelOfDetail are deprecated and not used anywhere anymore. Change-Id: Id4b0fa8ac3ac53d771e858ecda5524a5e690342d Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* QStyle: remove deprecated SH_SpellCheckUnderlineStyleChristian Ehrlicher2020-09-053-7/+0
| | | | | | | | It was deprecated with 88e6f8cff2974c46b1262f3a1a61e1440c664e0c and is not used anywhere anymore so it can be safely removed. Change-Id: If4050ac8bf116fb31491b3b08096554c5ea3e4d5 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Remove QStyleOptionProgressBar::orientation memberVolker Hilsheimer2020-08-297-28/+15
| | | | | | | | | Address ### Qt 6 comment; the information is already stored in the state variable, using the QStyle::State_Horizontal bit. Change-Id: I61d143ba057776f9d622793a0592b5dd4726f25d Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* Port QtBase to the new QIcon::pixmap() APIMorten Johan Sørvig2020-08-292-38/+33
| | | | | | | | | | | | | | The target devicePixelRatio can now be passed to the pixmap() function, instead of a QWindow pointer. This allows us to remove some usage of the QWidget pointer in the styles, since the DPR is accessible from the passed in painter. The QWidget pointer is still used in places where we don't have a painter. Task-number: QTBUG-85885 Change-Id: Ifecc669f5bad655e289a936d71bafe02605f21a4 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* Linux: Fix QLabel content truncated under high dpiChen Bin2020-08-281-1/+1
| | | | | | | | | | Fixed truncation of pixmap content under high device pixel ratio of QLabel. Pick-to: 5.15 Fixes: QTBUG-86170 Change-Id: I795815e0d8a9e57e0dfcca9cf104e86e45027b18 Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
* Rename QStyleOptionMenuItem::tabWidth to reservedShortcutWidthVolker Hilsheimer2020-08-275-7/+9
| | | | | | | As per ### Qt 6 comment, and the documentation for the variable. Change-Id: I58df784a72129dc97c5f13eb54e34cb7feb9748c Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
* macOS: rename 'macintosh' style to 'macos'Richard Moe Gustavsen2020-08-261-1/+7
| | | | | | | | | | | | | | Change the name/key of the style to 'macos'. Besides the name 'macintosh' being archaic, we also need this change to avoid creating 'macintosh' style folders in QtQuickControls, now that we plan to use QPlatformTheme also there to resolve the style. [ChangeLog][Widgets][QStyle] The 'macintosh' style has been renamed to 'macos'. Change-Id: I14b8a8b4dbd369e7a7d16b94e4ad27e501e7e8d0 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* Rename confusingly named QFont/QPalette::resolve overloadsVolker Hilsheimer2020-08-252-13/+13
| | | | | | | | | | | | | | | Having three methods with the same name doing different things is unnecessarily confusing, so follow the standard naming convention in Qt and call the getter of the resolve mask resolveMask, and the setter setResolveMask. These methods were all documented as internal. The publicly documented resolve() method that merges two fonts and palettes based on the respective masks remains as it is, even though 'merge' would perhaps be a better name. Change-Id: If90b1ad800834baccd1dbc38fc6b861540d6df6e Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* Properly deprecate Qt::MidButton in favor of Qt::MiddleButtonEdward Welbourne2020-08-221-1/+1
| | | | | | | | | | | | MidButton had its // ### Qt 5: remove me upgraded to Qt 6 at 5.0; but it dates back to 4.7.0 Replace the many remaining uses of MidButton with MiddleButton in the process. Pick-to: 5.15 Change-Id: Idc1b1b1816673dfdb344d703d101febc823a76ff Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Fix a number of qdoc warningsFriedemann Kleint2020-08-201-2/+0
| | | | | | | | | | | - Remove obsolete functions and enumeration values - Remove QObject * parameter from QMetaProperty accessors - Fix renamed enumerations in QSsl - Fix list items to be \li - Fix function signatures and variable names Change-Id: I37c7e6bf2c8ff92bc7b82620bae0a27796f866ab Reviewed-by: Paul Wicking <paul.wicking@qt.io>
* Don't crop the icon when it is aligned to the leftAndy Shaw2020-08-191-3/+3
| | | | | | | | | | | | When we use double the icon spacing then the area for the pushbutton is not long enough, so in order to account for the gap inbetween then just use half of the icon spacing when positioning the text as it only has spacing on one side of the icon to it. Change-Id: Ib3fe0037835b67efda0fc274421f976ccc98eb06 Pick-to: 5.15 Fixes: QTBUG-85723 Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
* Reset version of QStyleOption types to 1 for Qt 6Volker Hilsheimer2020-08-161-10/+10
| | | | | | | | | Amends 7ff26c776201141e5be87ce24c3c1b1ee96aefcc and 729f1ab9a0b9fe6ffdefc02df490ec546db38d72. Change-Id: I7d3cea42318faffc9dee48d51ae9f890bb1e7a56 Fixes: QTBUG-84221 Reviewed-by: Christian Ehrlicher <ch.ehrlicher@gmx.de>
* Replace Qt CONSTEXPR defines with constexprAllan Sandfeld Jensen2020-08-141-3/+3
| | | | | | | | Both normal and relaxed constexpr are required by our new minimum of C++17. Change-Id: Ic028b88a2e7a6cb7d5925f3133b9d54859a81744 Reviewed-by: Sona Kurazyan <sona.kurazyan@qt.io>
* Fix compiler issues when qreal is floatMichal Klocek2020-08-051-1/+1
| | | | | Change-Id: Ide3b5a3b0f2d93708409edac8aa999eb25c3ab54 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* Windows QPA: Move dark mode handling to the new interfaceFriedemann Kleint2020-07-251-6/+5
| | | | | | | | | | Move options to new interface, making them settable from code on this occasion. Task-number: QTBUG-83252 Change-Id: Idd80667c502a8cde5d7c66d7e597ea34c22738e7 Reviewed-by: André de la Rocha <andre.rocha@qt.io> Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* Compare the showDecorationSelected variable when caching the optionAndy Shaw2020-07-151-1/+2
| | | | | | | | | | | | Since the size of the display rect can change if showDecorationSelected is set then this should be included when seeing if the item is already cached. Change-Id: Ied6182337de5894d879c5ba5d1125b4869a11cc9 Pick-to: 5.15 Fixes: QTBUG-85451 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io> Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Replace use of deprecated Q_OS_MACX in favor of Q_OS_MACOSTor Arne Vestbø2020-07-081-1/+1
| | | | | Change-Id: I1059d56f67be28a4cc1a66b744e81df6d0b5d00d Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Use QList instead of QVector in widgetsJarek Kobus2020-07-024-26/+37
| | | | | | Task-number: QTBUG-84469 Change-Id: I3007734f8e4f164ece9dd8850ef007cbef9e12ef Reviewed-by: Maurice Kalinowski <maurice.kalinowski@qt.io>
* Add keyboardModifiers member to QStyleOptionSlider, and use it for macVolker Hilsheimer2020-07-022-2/+3
| | | | | | | | | | Gets rid of a call to QApplication::keyboardModifiers in a method that is anyway only called from an input event handler, where we have that information already. Task-number: QTBUG-73829 Change-Id: I81753d6bf725e9db4918d831fac5b03a0b1940b9 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* Doc: make paragraph about access of QStyleOption members consistentVolker Hilsheimer2020-07-021-90/+122
| | | | | | | | Slight language simplification, and consistent usage of paragraph for all QStyleOption subclasses. Change-Id: I06a0480fc963d4457d5397b11df3acf62bc6912a Reviewed-by: Paul Wicking <paul.wicking@qt.io>
* Remove deprecated QStyleOption::init()Christian Ehrlicher2020-06-212-9/+2
| | | | | | | | Even it was not marked as deprecated the replacement function initFrom() is available since Qt4 times (and init() is deprecated since then) Change-Id: I09a4ebbf66b01fbe7aec67691dc68d2e42d1cd78 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Remove deprecated QStyleOptionFooVx typedefsChristian Ehrlicher2020-06-202-122/+0
| | | | | | | They were not used the whole Qt5 lifetime. Change-Id: I1452b90d63bbeed3cc9131b04ed5263b38ad89b3 Reviewed-by: Lars Knoll <lars.knoll@qt.io>