Details
-
Bug
-
Resolution: Done
-
P3: Somewhat important
-
5.1.0
-
None
-
Windows 7 64x, Qt 5.1.0 32 bits MinGW version. Using qmlscene.
-
qtdeclarative/dev: 45792359f25813af18b7416e4c18737ed4b20bff
Description
It seems that Canvas variable textBaseline doesn't work properly when set to "middle". It behaves as the default value (alphabetic).
I'm running the code through qmlscene and it happens with both QtQuick 2.0 and QtQuick 2.1.
Sample code:
import QtQuick 2.0 Rectangle { id: root width: 800 height: 600 Canvas { id: canvas anchors.fill: parent onPaint: { var ctx = canvas.getContext("2d"); if (ctx === null) { console.log("ctx = null"); } ctx.clearRect(0, 0, canvas.width, canvas.height); ctx.textBaseline = "middle"; ctx.fillText("Hello Word", mouseArea.mouseX, mouseArea.mouseY); ctx.fill(); } MouseArea { id: mouseArea anchors.fill: parent hoverEnabled: true onClicked: canvas.requestPaint(); } } }
Sorry for my english...