Important: Please read the Qt Code of Conduct -

Changing just one style aspect of Qt Quick Control

  • Hi there,

    Suppose I create a Qt Quick Control element in QML, for example a CheckBox. The documentation suggests that any styling changes need to be done through CheckBoxStyle. So for example, to change the border color, I would use:

    CheckBox {
      id: my_checkbox
      style: CheckBoxStye {
        indicator: Rectangle {
          implicitWidth: 16
          implicitHeight: 16
          radius: 3
          border.color: "red"

    However, this seems like an overly complicated way to just change the color. Creating something from scratch that looks like the original seems rather crude and it will probably break badly when targeting a different platform.
    It would make much more sense to me to re-use the already existing indicator element and change just one aspect of it, like the color. Is there a way to do that?

  • Hi, welcome to the Qt forum.

    @Mr.-Pi said:

    Is there a way to do that?


  • Is using Qt Quick Controls 2 an option? It was first released as a tech preview in Qt 5.6 under a working title Qt Labs Controls, and the first official release in Qt 5.7. The new Qt Quick Controls 2 module takes quite different approach to styling. They are built upon customizable templates, where you can replace basically any part of any control without losing the rest of the style. Besides the minimalist default style, we offer Material and Universal styles that allow you to easily tweak colors and themes.

  • Ok, thanks for the clear answers.

Log in to reply