Warnings on ButtonGroup filled with Repeater of RadioButton, when using data from QStandardItemModel
-
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-referenceI 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.
-
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-referenceI 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.
@Gilboonet you have customized your RadioButton's
indicatorandcontentItem. 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.Controlstoimport QtQuick.Controls.Fusion, for example. -
@Gilboonet you have customized your RadioButton's
indicatorandcontentItem. 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.Controlstoimport QtQuick.Controls.Fusion, for example. -
G Gilboonet has marked this topic as solved