Isn't that what I'm already doing?
Qt Code:
21. Text { 22. font.pixelSize: Funcs.fontHeight(12) 23. text: boatAlphaName 24. horizontalAlignment: Text.AlignHCenter 25. }To copy to clipboard, switch view to plain text mode
Isn't that what I'm already doing?
Qt Code:
21. Text { 22. font.pixelSize: Funcs.fontHeight(12) 23. text: boatAlphaName 24. horizontalAlignment: Text.AlignHCenter 25. }To copy to clipboard, switch view to plain text mode
Post #6 above has the full code.
Ah, then my suggestion in comment #9 still applies.
Cheers,
_
Again... #10.
Aren't I already doing that? If not, then were am I going wrong?
Qt Code:
13. Component { 14. id: boatAlphaDelegate 15. Item { 16. id: boatAlphaContainer 17. width: parent.width 18. anchors.horizontalCenter: parent.horizontalCenter 19. height: Funcs.pointHeight(14) 20. Column { 21. Text { 22. font.pixelSize: Funcs.fontHeight(12) 23. text: boatAlphaName 24. horizontalAlignment: Text.AlignHCenter 25. } 26. } 27. 28. MouseArea { 29. id: boatAlphaMouseArea 30. anchors.fill: parent 31. hoverEnabled: true 32. onClicked: { 33. boatAlphaList.currentIndex = index 34. } 35. } 36. } 37. }To copy to clipboard, switch view to plain text mode
Lines 18 & 24?
Line 18 has no effect, since the item is as wide as its parent.
Line 24 is no anchor and, as previously explained, has no effect since the Text element has just enough width to hold the text.
Basically the same result as line 18.
In order to center something inside something else, the first needs to be smaller than the latter, or the latter needs to be bigger.
So what you have is
- a Text element that is just wide enough to display the text
- a Column element that is just as wide and positioned at 0/0 (default position)
What you want is
- a Column element that is larger than the Text, probably as wide as its parent
- either a Text element horizontally anchored in it or a Text element with the same width and using alignment
Cheers,
_
scgrant327 (15th March 2016)
Thanks for pointing me in the right direction:
What you want is
- a Column element that is larger than the Text, probably as wide as its parent
- either a Text element horizontally anchored in it or a Text element with the same width and using alignment
Bookmarks