aboutsummaryrefslogtreecommitdiffstats
path: root/src/imports/nativestyle/qstyle/qquickcommonstyle.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Fix ProgressBar on WindowsJan Arve Sæther2020-09-091-4/+1
| | | | | | | | | | | | | | Also remove the two custom progress bars from the manual test where one has a custom background, and the other has a custom contentItem. If you want to customize a progress bar, you need to provide customizations for both the background and the contentItem. You cannot provide a custom background (or contentItem) alone, since its almost impossible to create a custom background that fits well with the contentItem of all the other possible styles it might be using. Change-Id: I82a87513e73f319bcecbfaed341ac4949f64c3bb Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
* Native style: fix warnings in QStyle codeMitch Curtis2020-09-071-2/+3
| | | | | | | | These break the build unless Qt is configured with -no-warnings-are-errors. Change-Id: I4a96efc0b29db60e7945fb9739a13da81f8d4c24 Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
* Native style: add DialRichard Moe Gustavsen2020-06-261-0/+2
| | | | | Change-Id: Iad09b9f6080994528d65dcddc9eda49dbba356f7 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* Make sure the focus rect is drawnJan Arve Sæther2020-06-171-6/+6
| | | | | | | | | | | | | | In windows style, the focus rect is drawn when the button is drawn, but we are only drawing the bevel, so the focus rect was not drawn. We move the logic of drawing the focus rect so that it is drawn when drawing the bevel instead. Also, we have to set the QStyle::State_KeyboardFocusChange in order for the focus rect to be drawn Change-Id: I4463ae1dd0f23ecc5bb0a84c563fda33dc6e93c8 Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
* Native style: add ProgressBarRichard Moe Gustavsen2020-06-171-1/+6
| | | | | Change-Id: Ie48002b083615afd4f8f8ab3b1303a8f5c39f81b Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* Native style: make it possible to set nine patch margins from the styleRichard Moe Gustavsen2020-06-081-0/+16
| | | | | | | | | | | | | | | | | | | Up till now, all images have been scaled using nine patch images with margins set to be at the center. This was doomed to be too simplistic at some point, at that point is now (when working on comboboxes). So instead, calculate the nine patch margins from the style. This will let the different styles set pixel perfect margins per control that matches the image they draw. If left unspecified by a style, the default implementation in QCommonStyle will return the old logic of using the center. We also add support for specifying if an image can be scaled horizontally or vertically by setting the right or bottom nine patch margin to -1 respectively. E.g on macOS, an NSButton cannot be scaled vertically, so the image we draw will not look native if we do. Change-Id: Icaf232748b8d15f06f9b289e164b5c8fb86a6c7b Reviewed-by: Jan Arve Sæther <jan-arve.saether@qt.io>
* Native style: add FrameRichard Moe Gustavsen2020-05-271-0/+7
| | | | | Change-Id: Ide8f2910c54a378c8c9d03554718de54feb9cf20 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* Native style: copy QStyle from widgets, and implement ground work for ↵Richard Moe Gustavsen2020-05-251-0/+6048
creating native styles This is the initial patch for adding native style support to controls2. The gist of the patch is that it copies QStyle from widgets (including the mac plugin style), remove all notions of widgets, tweak it as needed, and make it compile inside the qtquickcontrols2 repository as a separate QML plugin (QtQuick.NativeStyle). The "new" QStyle is then used to draw primitives onto nine-patch-images that can be rendered by the scene graph. Each such primitive/image will be wrapped by a QQuickStyleItem (which is a subclass of QQuickItem). E.g a button background will be implemented by QQuickStyleItemButton.cpp. This item can then be placed anywhere in the QML code to draw a native-looking button background. Controls2 has its own styling API, where a style consist of a set of QML files that extend template controls written in C++. To enable native styling, we simply follow the exact same approach; We create a style folder per platform alongside the other styles in controls2. Each style will contain a set of qml files for the controls (Button.qml, Slider.qml, etc), and inside each control, the style items will be used to draw the default delegates. Since it's likely that each such qml file will be implemented equal in all the desktop styles (but not always), the native style plugin contains a set of default controls (e.g DefaultButton.qml) that a platform style can choose to inherit from and extend as needed. Included is also an example called "DesktopGallery" that can be used to test and view the controls. Change-Id: I8b45aa7d493930f552d3ad2e3e3e7184129a9d6c Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>