HorizontalHeaderView - textRole & custom delegate
Unsolved
QML and Qt Quick
-
HorizontalHeaderView has property called textRole. & value for this property is role defined in model. However If I define the custom delegate, textRole is not applicable. Delegate takes precedence over the textRole.
Documentation is not very clear about this.
HorizontalHeaderView { id: horizontalHeader width: parent.width height: 100 delegate:del2 textRole: "fone_1" model : myModel columnSpacing: 2 rowSpacing: 2 } Component{ id : del2 Rectangle{ implicitWidth: horizontalHeader.width/4; implicitHeight: 50 width: 200;height: 50;color: "blue"; Text { text : fone_1 } } }
-
Hello!
I'm not quite sure I'm understanding your problem...
If you add this as it is:
Rectangle{ required property string fone_1 implicitWidth: horizontalHeader.width/4; implicitHeight: 50 width: 200;height: 50;color: "blue"; Text { text : fone_1 }
You should change "fone_1" for whatever you have written in your model.
-
Thanks @afalsa. Yes. Output is not an issue. If you specify both delegate & textRole, textRole has no impact. Delegate takes priority. If you remove the delegate, then textRole kicks in. There is no bug also. Need to docs clear about this.