How about to scale the whole chess board to fit the window?
On 11 April 2016 at 20:55, Igor Mironchik <igor.mironc...@gmail.com> wrote: > > > On 11.04.2016 15:10, Gian Maxera wrote: > > > On 11 Apr 2016, at 11:44, Igor Mironchik < <igor.mironc...@gmail.com> > igor.mironc...@gmail.com> wrote: > > Hello, > > On 11.04.2016 13:19, Gian Maxera wrote: > > > On 11 Apr 2016, at 11:14, Igor Mironchik <igor.mironc...@gmail.com> wrote: > > > > On 11.04.2016 12:57, Gian Maxera wrote: > > If the Text is inside the generated rectangle into the repeater you don’t > need to generate different Ids, you can do that: > > Repeater { > model: 10 > delegate: Rectangle { > id: cellRect > Text { > anchor.horizontalCenter: cellRect.horizontalCenter > } > } > } > > Even if the delegate has a fixed id and generated 10 times, QML will > resolve correctly it. > > > I want to rewrite my QML with chess board with Repeater. And I want to see > the next: > > <chess.png> > > > I don’t know your current code, but If I would in your shoes, I will use a > model representing where to put the chess items and a Grid to lay out the > items. With Grid Item you can setup a global alignment of the items. > I think it should work in your case. > If you want more help, please share with us some snippet of code so I can > understand what you need to achieve. > > > Model and Grid is fine. I can place chess and rects, fine. But how to put > letters and numbers? > > > > One solution using Column and Row instead of Grid to split Repeaters: > > Column { > spacing: 0 > Row { > // top letters > EmptyItem { // use fixed width here so you can align the text } > Repeater { > model: [“A”, “B”, … “H”] > delegate: DisplayTheLetter { … } > } > EmpyItem { } > } > // Rows with cells > Repeater { > model: 8 > delegate: Row { > // number > Text { > // use fixed width and align left the text > // vertical alignment with anchors > anchors.verticalCenter: parent.verticalCenter > text: index+1 > } > // first row of chess board > Repeater { > model: chessBoardModel[index] > delegate: ASingleCellOfChessBoard { … } > } > } > } > Row { > // bottom letters > EmptyItem { } > Repeater { > model: [“A”, “B”, … “H”] > delegate: DisplayTheLetter { … } > } > EmpyItem { } > } > } > > > Looks like a solution. Only one question is still opened... How to align > letters and numbers in center if chess board should be resizable? I.e. I > can't use x and y properties for that. I need anchor.horizontalCenter which > use AnchorLine, not pixels... > > > > Thank you. > > > > Ciao, > Gianluca. > > } > > On 11 Apr 2016, at 10:49, Igor Mironchik < <igor.mironc...@gmail.com> > igor.mironc...@gmail.com> wrote: > > Look. I want to generate chess board - rectangles (8x8). And I want to > place numbers an letters on the sides. This numbers and letters should be > anchored to centers of rectangles. I.e. I want to have something like: > > Text { > anchor.horizontalCenter: cell00.horizontalCenter > } > > ... > > On 11.04.2016 12:40, Gian Maxera wrote: > > Hello, > I don’t think so. > Why do you need it ? Maybe we can suggest to you an alternative solution. > > Ciao, > Gianluca. > > > On 11 Apr 2016, at 10:38, Igor Mironchik <igor.mironc...@gmail.com> wrote: > > Hello, > > Is it possible to generate id of item in Repeater, for example? > > Thank you. > _______________________________________________ > Interest mailing list > Interest@qt-project.org > http://lists.qt-project.org/mailman/listinfo/interest > > > > > > > > > > _______________________________________________ > Interest mailing list > Interest@qt-project.org > http://lists.qt-project.org/mailman/listinfo/interest > >
_______________________________________________ Interest mailing list Interest@qt-project.org http://lists.qt-project.org/mailman/listinfo/interest