2016-09-17 34 views
2

我看到的不一致在不同平臺之間的文本渲染:文本在QML呈現不同翻過平臺

enter image description here

在頂部左側的圖像在android系統產生,並作爲紅色引導線指示它不同於「參考」窗口輸出的垂直位置和斜體角度。

Rectangle { 
    width: 100 
    height: 50 
    color: "grey" 
    Text { 
    x: 4 
    y: 2 
    font.family: sysfont 
    font.pixelSize: 13 
    width: contentWidth 
    color: bgc 
    text: "Type" 
    } 
    Text { 
    x: 5 
    y: 13 
    font.family: sysfont 
    font.pixelSize: 32 
    font.italic: true 
    font.letterSpacing: -1 
    width: contentWidth 
    color: topc 
    style: Text.Sunken 
    styleColor: bgc 
    text: "Name" 
    } 
} 

任何想法是什麼原因造成的?它是相同的字體,相同的代碼。頂部填充和線條高度值在各個平臺上相同。

回答

3

It turns out that it is a bug。因此,它很可能會在某個時候在今後幾年定...

在此之前,以下解決方法應該做的伎倆,當涉及到垂直位置,至少:

property real offset: { 
    switch (Qt.platform.os) { 
    case "android": return androidValue 
    case "windows": return windowsValue 
    // and so on... 
    } 
    } 

我會進行調查,如果不同版本的相同平臺之間存在差異,並在必要時更新答案。

UPDATE: 它可能會變成這裏的例外是窗戶,從機器人輸出和Ubuntu是幾乎相同(是的,兩者基本上是反正LINUX)。我沒有Mac,所以我不能給出任何意見。

enter image description here

+1

我可以確認macOS與android/linux相匹配 – qCring