Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. Warnings on ButtonGroup filled with Repeater of RadioButton, when using data from QStandardItemModel
Qt 6.12 LTS is out! See what's new in the release blog

Warnings on ButtonGroup filled with Repeater of RadioButton, when using data from QStandardItemModel

Scheduled Pinned Locked Moved Solved QML and Qt Quick
3 Posts 2 Posters 63 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • GilboonetG Online
    GilboonetG Online
    Gilboonet
    wrote last edited by
    #1

    Hello, I'm writing my Qt QML/C++ application, replacing datamodels based on subclassed QAbstractListModel using custom structs by datamodels based on QStandardItemModel using custom data Q_GADGET classes. My process has three steps (all working fine with the current datamodel solution using subclassed QAbstractListModel). With the new datamodel solution that I would like to use to replace the first because it's lighter, the first one was using a datamodel to feed a Repeater3D of ProceduralMesh, that step works fine, and I progressed to my second step that is using a datamodel to feed a ButtonGroup made of a repeater of RadioButton. That steps works too, but I'm having 2 warning by row that I was not able to remove.

    Here is the two warnings I have for each row (RadioButton) :

    qrc:/qt/qml/dnew/Main.qml:105:40: QML QQuickRectangle: The current style does not support customization of this control (property: "indicator" item: QQuickRectangle(0x7983c241c0, parent=0x0, geometry=0,0 12x12)). Please customize a non-native style (such as Basic, Fusion, Material, etc). For more information, see: https://doc.qt.io/qt-6/qtquickcontrols2-customize.html#customization-reference
    qrc:/qt/qml/dnew/Main.qml:121:42: QML QQuickText: The current style does not support customization of this control (property: "contentItem" item: QQuickText(0x798796c300, parent=0x0, geometry=0,0 0x0 ⏿)). Please customize a non-native style (such as Basic, Fusion, Material, etc). For more information, see: https://doc.qt.io/qt-6/qtquickcontrols2-customize.html#customization-reference
    

    I read the documentation that the warnings cite, but don't see what I'm doing wrong.

    Here's the QML code snippet concerned :

                    ButtonGroup {
                        id: bgParties
                        buttons: columnParties.children.filter((child) => child !== repListe)
                    }
                    Column {
                        id: columnParties
                        Repeater {
                            id: repListe
                            delegate: RadioButton {
                                width: 90
                                id: control
                                checked: false
                                padding: 2
                                state: edit.num
                                indicator: Rectangle {
                                    implicitWidth: 12
                                    implicitHeight: 12
                                    x: control.leftPadding
                                    y: parent.height/2 - height/2
                                    color: iToC[edit.coul]
                                    state: edit.num
                                    Rectangle {
                                        width:6
                                        height:6
                                        x: parent.width/2 - width/2
                                        y: parent.height/2 - height/2
                                        color: Qt.tint(iToC[edit.coul], "pink")
                                        visible: control.checked
                                    }
                                }
                                contentItem: Text {
                                    font.pointSize: 8
                                    color: darkMode ? "white" : "black"
                                    text : "(" + edit.nb + ") " + (edit.nom === "" ? qsTr("Partie #")+ edit.num : edit.nom)
                                    leftPadding: control.indicator.width +1
                                    font.bold: control.checked
                                }
    
                                MouseArea {
                                    id: rightClickArea
                                    anchors.fill: parent
                                    acceptedButtons: Qt.RightButton
                                    onClicked: {
                                        console.log("menu liste");
                                    }
                                }
    
                                onClicked: {
                                    couleurCourante = control.indicator.state;
                                }
                            }
                        }
                    }
    

    I may need to replace the ButtonGroup by a TableView ? Or maybe change the setData I use to add data to the model from role Qt.EditRole to Qt.DisplayRole or another ? For the moment I'm using edit as prefix to the data, maybe do I need to use something else ? But I don't see what., and using Qt.EditRole for at least the name on the Text control is needed.

    JKSHJ 1 Reply Last reply
    0
    • GilboonetG Gilboonet

      Hello, I'm writing my Qt QML/C++ application, replacing datamodels based on subclassed QAbstractListModel using custom structs by datamodels based on QStandardItemModel using custom data Q_GADGET classes. My process has three steps (all working fine with the current datamodel solution using subclassed QAbstractListModel). With the new datamodel solution that I would like to use to replace the first because it's lighter, the first one was using a datamodel to feed a Repeater3D of ProceduralMesh, that step works fine, and I progressed to my second step that is using a datamodel to feed a ButtonGroup made of a repeater of RadioButton. That steps works too, but I'm having 2 warning by row that I was not able to remove.

      Here is the two warnings I have for each row (RadioButton) :

      qrc:/qt/qml/dnew/Main.qml:105:40: QML QQuickRectangle: The current style does not support customization of this control (property: "indicator" item: QQuickRectangle(0x7983c241c0, parent=0x0, geometry=0,0 12x12)). Please customize a non-native style (such as Basic, Fusion, Material, etc). For more information, see: https://doc.qt.io/qt-6/qtquickcontrols2-customize.html#customization-reference
      qrc:/qt/qml/dnew/Main.qml:121:42: QML QQuickText: The current style does not support customization of this control (property: "contentItem" item: QQuickText(0x798796c300, parent=0x0, geometry=0,0 0x0 ⏿)). Please customize a non-native style (such as Basic, Fusion, Material, etc). For more information, see: https://doc.qt.io/qt-6/qtquickcontrols2-customize.html#customization-reference
      

      I read the documentation that the warnings cite, but don't see what I'm doing wrong.

      Here's the QML code snippet concerned :

                      ButtonGroup {
                          id: bgParties
                          buttons: columnParties.children.filter((child) => child !== repListe)
                      }
                      Column {
                          id: columnParties
                          Repeater {
                              id: repListe
                              delegate: RadioButton {
                                  width: 90
                                  id: control
                                  checked: false
                                  padding: 2
                                  state: edit.num
                                  indicator: Rectangle {
                                      implicitWidth: 12
                                      implicitHeight: 12
                                      x: control.leftPadding
                                      y: parent.height/2 - height/2
                                      color: iToC[edit.coul]
                                      state: edit.num
                                      Rectangle {
                                          width:6
                                          height:6
                                          x: parent.width/2 - width/2
                                          y: parent.height/2 - height/2
                                          color: Qt.tint(iToC[edit.coul], "pink")
                                          visible: control.checked
                                      }
                                  }
                                  contentItem: Text {
                                      font.pointSize: 8
                                      color: darkMode ? "white" : "black"
                                      text : "(" + edit.nb + ") " + (edit.nom === "" ? qsTr("Partie #")+ edit.num : edit.nom)
                                      leftPadding: control.indicator.width +1
                                      font.bold: control.checked
                                  }
      
                                  MouseArea {
                                      id: rightClickArea
                                      anchors.fill: parent
                                      acceptedButtons: Qt.RightButton
                                      onClicked: {
                                          console.log("menu liste");
                                      }
                                  }
      
                                  onClicked: {
                                      couleurCourante = control.indicator.state;
                                  }
                              }
                          }
                      }
      

      I may need to replace the ButtonGroup by a TableView ? Or maybe change the setData I use to add data to the model from role Qt.EditRole to Qt.DisplayRole or another ? For the moment I'm using edit as prefix to the data, maybe do I need to use something else ? But I don't see what., and using Qt.EditRole for at least the name on the Text control is needed.

      JKSHJ Offline
      JKSHJ Offline
      JKSH
      Moderators
      wrote last edited by
      #2

      @Gilboonet you have customized your RadioButton's indicator and contentItem. Your warnings say that your "current style does not support customization.... Please customize a non-native style (such as Basic, Fusion, Material, etc)"

      So, the solution is to choose one of the suggested styles.

      One way to do that is to change import QtQuick.Controls to import QtQuick.Controls.Fusion, for example.

      Qt Doc Search for browsers: forum.qt.io/topic/35616/web-browser-extension-for-improved-doc-searches

      GilboonetG 1 Reply Last reply
      2
      • JKSHJ JKSH

        @Gilboonet you have customized your RadioButton's indicator and contentItem. Your warnings say that your "current style does not support customization.... Please customize a non-native style (such as Basic, Fusion, Material, etc)"

        So, the solution is to choose one of the suggested styles.

        One way to do that is to change import QtQuick.Controls to import QtQuick.Controls.Fusion, for example.

        GilboonetG Online
        GilboonetG Online
        Gilboonet
        wrote last edited by
        #3

        @JKSH Thank you, I changed import QtQuick.Controls to import QtQuick.Controls.Basic and the warnings disappear. I also tested on WASM and it's also ok.

        1 Reply Last reply
        0
        • GilboonetG Gilboonet has marked this topic as solved

        • Login

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • Users
        • Groups
        • Search
        • Get Qt
        • Unsolved