Qt 以Qml格式显示垂直文本的水平listview
我想创建一个具有水平listview但具有垂直文本的列表。就这样。 我已经编写了代码,如下所示Qt 以Qml格式显示垂直文本的水平listview,qt,qml,Qt,Qml,我想创建一个具有水平listview但具有垂直文本的列表。就这样。 我已经编写了代码,如下所示 ListView { id: listView; orientation: ListView.Horizontal delegate: listDelegate; ScrollBar.horizontal: bar model: ListModel { id: phoneModel; ListElement{
ListView {
id: listView;
orientation: ListView.Horizontal
delegate: listDelegate;
ScrollBar.horizontal: bar
model: ListModel {
id: phoneModel;
ListElement{
name: "wewqeq";
}
ListElement{
name: "rrr";
}
ListElement{
name: "Engine auto stop";
}
ListElement{
name: "wewq";
}
ListElement{
name: "weweqwe";
}
}
}
我的代码显示的结果是
您可以使用垂直
列表视图
并旋转它:
ListView {
id: listView
height: //...
width: //...
transformOrigin: Item.TopLeft
rotation: -90
y: listView.width
orientation: ListView.Vertical
ScrollBar.vertical: ScrollBar{}
}
垂直的
滚动条将在顶部变为水平。如果将文本元素旋转90/270度旋转:90
非常感谢。但在我的例子中,我的列表项资源图像已被旋转!那么,还有其他方法可以旋转文本吗?非常感谢。但在我的例子中,我的列表项资源图像已被旋转!那么,还有其他方法可以旋转文本吗?
ListView {
id: listView
delegate: listDelegate
rotation:-90
model: ListModel {
id: phoneModel;
ListElement{
name: "wewqeq";
}
ListElement{
name: "rrr";
}
ListElement{
name: "Engine auto stop";
}
ListElement{
name: "wewq";
}
ListElement{
name: "weweqwe";
}
}
}