aboutsummaryrefslogtreecommitdiffstats
path: root/src/imports/nativestyle/qstyle
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: fix namespace buildsRichard Moe Gustavsen2020-09-071-0/+4
| | | | | Change-Id: I7ef28cc93fd4acad9849fecb3d4c2cab79f0acdb Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* Native style: increase combobox minimum sizeRichard Moe Gustavsen2020-08-131-1/+1
| | | | | | | | | | After testing on Big Sur, it becomes clear that the minimum size (which is also the size of the nine patch image) needs to be larger in order for the combobox to render correctly. Change-Id: Iac70efa348afb7efb0af9453dd392b40ba3a9f89 Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
* Native style: increase text field minimum sizeRichard Moe Gustavsen2020-08-111-3/+3
| | | | | | | | | | After testing on Big Sur, it becomes clear that the minimum size (which is also the size of the nine patch image) needs to be larger in order for the text field to render correctly. Change-Id: I74ede6415545f0ddee3fc2175772c1b07c2c3999 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* Native style: fix leaks in qquickmacstyleRichard Moe Gustavsen2020-08-101-0/+14
| | | | | | | | | | | After running the "leaks" app in Instruments, several places showed up to leak memory. This patch will add auto release pools at those places to stop that from happening. Change-Id: If7f49290fde60e71d1a40c10bc3d538df6c1da5c Reviewed-by: Mitch Curtis <mitch.curtis@qt.io> Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
* Native style: support building with cmakeRichard Moe Gustavsen2020-07-301-1/+1
| | | | | | Change-Id: Idec0507a8bbdfc345e731a9e376ef8dd00534946 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io> Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* Native style: add DialRichard Moe Gustavsen2020-06-262-0/+3
| | | | | 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-173-78/+27
| | | | | Change-Id: Ie48002b083615afd4f8f8ab3b1303a8f5c39f81b Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* NativeStyle: add ScrollBarRichard Moe Gustavsen2020-06-122-14/+19
| | | | | Change-Id: Ied2055866a67798ce60105e7251740a3e66b38db Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* Remove qdrawutil.*Jan Arve Sæther2020-06-104-1315/+1
| | | | | | | | This was wrongly added in 2275a0896c7b7e648641f4c6977a02006a581577, but I didn't realize we already had qquickdrawutil.*. Change-Id: I873c0e2fcd2cb6df46966c59882db3eff33bc744 Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
* NativeStyle: add ComboBoxRichard Moe Gustavsen2020-06-092-18/+74
| | | | | | Change-Id: Ia6387857ba012ba7f6df453e64dd9419f7979db8 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io> Reviewed-by: Jan Arve Sæther <jan-arve.saether@qt.io>
* Native style: make it possible to set nine patch margins from the styleRichard Moe Gustavsen2020-06-083-0/+20
| | | | | | | | | | | | | | | | | | | 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>
* Initial "port" of QQC2::QWindowsStyleJan Arve Sæther2020-06-0813-0/+11384
| | | | | | | | It also includes qwindowsxpstyle and qwindowsvistastyle, but they do not compile at the moment Change-Id: Ie9ce0bf99d620d65534c2660150117e4747f5c86 Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
* Native style: let DefaultTextField have correct contentRect and sizeRichard Moe Gustavsen2020-06-041-0/+23
| | | | | | | | | | | Set implicitWidth/Height to be the same as in TextField.qml in the default style (and the same for TextArea). And fix the mac style to return correct values when calculating the minimum size. Combined, this should ensure that we improve how we take the content size into account when calculting the implicit size of a TextField (especially on macOS). Change-Id: I39bc8bb0f238dd29d5fe33fc32d888b82d020b0e Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* Native style: draw Frame on macOS with correct line width and colorRichard Moe Gustavsen2020-05-271-5/+6
| | | | | | | This old code was especially wrong when using Dark Mode on macOS. Change-Id: Ia75b7868a03867cf9b6105f8b99dfb328ab00c41 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* Native style: add FrameRichard Moe Gustavsen2020-05-272-0/+8
| | | | | 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-2520-0/+18190
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>