【发布时间】:2015-03-11 09:37:31
【问题描述】:
我无法在 QML(Windows MSVC2010 OpenGL 下的 Qt 5.2.1)中获取文本。下面是示例代码:
import QtQuick 2.2
import QtQuick.Window 2.1
Window {
visible: true
width: 160
height: 60
Text {
text: qsTr("Hello\nWorld World2 World3")
horizontalAlignment: Text.AlignRight
anchors.centerIn: parent
}
}
这是它在 Qt Creator 的设计器中的外观:
这是在 Qt Creator 的新项目向导生成的“Qt Quick Application”下运行时的外观(仅在 .qml 文件中进行更改,如上所示):
如何让它在应用程序中看起来正确?
这是QTBUG-30896(感谢@Meefte 提供链接),已在 Qt 5.3 中修复。 Qt 5.2.1 的任何合理解决方法(因为在这种情况下升级 Qt 版本有“外部”困难)?
【问题讨论】:
-
看起来像QTBUG-30896。它已在 Qt 5.3.0 中修复
标签: qt qml qt5 text-alignment qt5.2