Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/wix/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
QT,QTML如何添加图像组合框列表_Qt_Qml - Fatal编程技术网

QT,QTML如何添加图像组合框列表

QT,QTML如何添加图像组合框列表,qt,qml,Qt,Qml,我正在使用Qt Quitck Control 2.0。我想在组合框列表中添加图像和文本。图像为左,文本为右。如何执行此操作编写自定义委托: delegate: ItemDelegate { id: delegatRoot width: control.width height: 40 Row { Image { width: delegateRoot.width / 2 height: 40

我正在使用Qt Quitck Control 2.0。我想在组合框列表中添加图像和文本。图像为左,文本为右。如何执行此操作

编写自定义委托:

delegate: ItemDelegate {
    id: delegatRoot
    width: control.width
    height: 40
    Row {
        Image {
            width: delegateRoot.width / 2
            height: 40
            source: 'my/image/path.png'
        }
        Text {
            text: 'myText'
        }
    }
}
与在任何视图中一样,您可以使用
model.roleName
ListModel
中获取值