Universal Style

The Universal Style is based on the Microsoft Universal Design Guidelines. More...

Import Statement: import Qt.labs.controls.universal 1.0

Attached Properties

Detailed Description

The Universal style is a device-agnostic style based on the Microsoft Universal Design Guidelines. The Universal style has been designed to look good on all devices, from phones and tablets to PCs.

The Universal style in light and dark themes

Note: The Universal style is not a native Windows 10 style. The Universal style is a 100% cross-platform Qt Labs Controls style implementation that follows the Microsoft Universal Design Guidelines. The style runs on any platform, and looks more or less identical everywhere. Minor differences may occur due to differences in available system fonts and font rendering engines.

Customization

The Universal style allows customizing two attributes, theme and accent. The following example illustrates how to create a red stop button with light text:

import QtQuick 2.0
import Qt.labs.controls 1.0
import Qt.labs.controls.universal 1.0

Button {
    text: "Stop"
    highlighted: true

    Universal.accent: Universal.Red
    Universal.theme: Universal.Dark
}

Both attributes can be specified for any window or item, and they automatically propagate to children in the same manner as fonts. In the following example, the window and all three radio buttons appear in the dark theme using a violet accent color:

import QtQuick 2.0
import Qt.labs.controls 1.0
import Qt.labs.controls.universal 1.0

ApplicationWindow {
    visible: true

    Universal.theme: Universal.Dark
    Universal.accent: Universal.Violet

    Column {
        anchors.centerIn: parent

        RadioButton { text: qsTr("Small") }
        RadioButton { text: qsTr("Medium");  checked: true }
        RadioButton { text: qsTr("Large") }
    }
}

Note: The Universal style must be separately imported to gain access to these style-specific attributes. It should be noted that regardless of the references to the Universal style, the same application code runs with any other style. The Universal style-specific attributes only have an effect when the application is run with the Universal style. Furthermore, in case of explicit Universal style-specific references, the Universal style must be deployed with the application.

Note: Types in the Qt.labs module are not guaranteed to remain compatible in future versions.

Attached Property Documentation

Universal.accent : color

This attached property holds the accent color of the theme. The property can be attached to any window or item. The value is propagated to children.

Even though the accent can be any color, it is recommended to use one of the pre-defined accents that have been designed to work well with the rest of the Universal style palette:

ConstantDescription
Universal.LimeLime (#A4C400)
Universal.GreenGreen (#60A917)
Universal.EmeraldEmerald (#008A00)
Universal.TealTeal (#00ABA9)
Universal.CyanCyan (#1BA1E2)
Universal.CobaltCobalt (#3E65FF, default)
Universal.IndigoIndigo (#6A00FF)
Universal.VioletViolet (#AA00FF)
Universal.PinkPink (#F472D0)
Universal.MagentaMagenta (#D80073)
Universal.CrimsonCrimson (#A20025)
Universal.RedRed (#E51400)
Universal.OrangeOrange (#FA6800)
Universal.AmberAmber (#F0A30A)
Universal.YellowYellow (#E3C800)
Universal.BrownBrown (#825A2C)
Universal.OliveOlive (#6D8764)
Universal.SteelSteel (#647687)
Universal.MauveMauve (#76608A)
Universal.TaupeTaupe (#87794E)


Universal.theme : enumeration

This attached property holds whether the theme is light or dark. The property can be attached to any window or item. The value is propagated to children.

Available themes:

ConstantDescription
Universal.LightLight theme (default)
Universal.DarkDark theme


© 2017 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.