Styles
Select a built-in style at startup or in QML, configure Material
and Universal attached properties, or replace control parts.
Use styles to switch the look and metrics of your controls across the whole application or within individual QML files, or to customise specific controls by setting attached theme properties or replacing their visual parts.
Every control (
Button, SpinBox, ComboBox, and the rest) is present in all five built-in style modules:QtQuick.Controls.BasicQtQuick.Controls.FusionQtQuick.Controls.MaterialQtQuick.Controls.UniversalQtQuick.Controls.macOSWhen your QML files import the unstyled
QtQuick.Controls module, Ljós chooses the active style at startup in this order:1.
The
-style command-line option2.
The
QT_QUICK_CONTROLS_STYLE environment variable3.
The
[Controls] Style= key in the configuration file that QT_QUICK_CONTROLS_CONF names (a qtquickcontrols2.conf sitting beside your files is not read on its own)4.
The platform style, which is Fusion on Linux
If a QML file imports a style module by name—such as
import QtQuick.Controls.Material—it always uses that style regardless of the startup setting or platform default.Each style brings its own default control sizes:
Fusion:
Button is 80 × 24 with padding: 4Material:
Button is 64 × 52 and TextField is 120 × 56Universal:
Button is 32 × 32macOS:
Button is 64 × 21 empty or with a short one-line label, and grows with larger content; it is a small rounded rectangle, and a flat button has no plate until held down, checked or highlighted, which is the shape of a toolbar itemWhen you use the Material or Universal style, you can configure themes and colours on any item, window, or control using attached properties. Those properties propagate down the item tree to child controls, update derived colours automatically when the theme changes, and reset to their inherited value when assigned
undefined.For
Material:Material.theme: Material.Light (0), Material.Dark (1), or Material.System (2), which follows the platform's colour schemeMaterial.accent, Material.primary, and Material.foreground: inherited down the item tree (including named colours such as Material.Teal 8 or hex colour strings)Material.elevation: stays local to the control it is set on and is not inherited by child controlsWrite this as
Main.qml and run ljos check on its directory:Both the
Button and the Switch inherit the dark theme and teal accent attached to the enclosing Pane, which paints the dark theme's background behind them. You can also set Material.primary and Material.foreground on a container; a Pane with Material.theme: Material.Light paints the light background the dark foreground is read on, whatever the reader's scheme:For
Universal, Universal.theme accepts Universal.Light, Universal.Dark (1), or Universal.System (the platform's colour scheme), and Universal.accent sets the accent colour:You can customise an individual control without writing a full style:
Palettes and fonts: Colours and fonts set or bound on a control (including controls instantiated later by a
Loader) propagate to the items inside it and update whenever a binding changes.Replacing
background, contentItem, or padding: Assigning your own item to background or contentItem replaces that part of the active style. If you assign it when the control is declared, the style's default part is never created; if you swap a contentItem later, the previous item is hidden and its parent is cleared.To build a custom style for your application, create a
qmldir module containing QML files named after the controls you want to restyle—for example, a Button.qml whose root item is T.Button from QtQuick.Templates. When your custom style is selected, its Button replaces the one in QtQuick.Controls, and any control your module does not define is taken from its fallback style (which defaults to Basic). To name another fallback style, set the QT_QUICK_CONTROLS_FALLBACK_STYLE environment variable or FallbackStyle= in the [Controls] group of the configuration file.There are no Windows or iOS styles; on Linux the platform style is Fusion.
The macOS style differs from Qt's: Qt ships it only on macOS, drawn with native frameworks, and falls back to Fusion for the controls it does not support yet. Ljós compiles it on every platform, draws
Button itself and takes every other control from Basic. An icon.name naming an SF Symbol shows nothing, because Ljós has no icon theme and no SF Symbols; give the button an icon.source, or let its text be its tooltip and accessible name, as a toolbar item does. A program that chooses no style on macOS still gets Basic, where Qt's default there is its macOS style: Ljós's draws only Button so far, so it is used only when a program imports it or names it in QT_QUICK_CONTROLS_STYLE.Material's
variant and shade() are not available, and the built-in styles draw Basic's shapes in each style's metrics and colours rather than the full Material or Fluent visual effects.

