qml图片闪烁问题,解决

Image
{
id:bookBorder
width: parent.width-26;
height: parent.height-46;
sourceSize.width: width
sourceSize.height: height
source:“qrc:/bookshelf/bookshelf/add_book_background.png”
smooth: true
}

TextInput
{
    id:name
    y:bookBorder.y+bookBorder.height+10;
    anchors.horizontalCenter: bookBorder.horizontalCenter
    text: book_name
    font.pixelSize: 16
    font.family: "微软雅黑"
    color: "#a16f35"
    smooth:true
    enabled: !parent.remove_flag
}



Image
{
    id: face
    parent:bookBorder
    width: bookBorder.width-6;
    height: bookBorder.height-6
    //        anchors.horizontalCenter: bookBorder.horizontalCenter
    x:3;
    sourceSize.width: width
    sourceSize.height: height
    source: face_path
    //        asynchronous: true//注释之后就不在闪烁(意思好像是异步加载图片)
    smooth: true
        }



Image
{
    id:remove_book_icon
    anchors.left: parent.left
    anchors.top: parent.top
    source: "qrc:/bookshelf/bookshelf/del_book.png"
    smooth: true
    visible: (name.text !== "")?(parent.remove_flag):(false)
}

function checked()
{
    face.width -= 10
    face.height -= 20
    bookBorder.width -= 10
    bookBorder.height -= 20
}

function resume()
{
    face.width = bookBorder.width+4;
    face.height =  bookBorder.height+14;
    bookBorder.width += 10
    bookBorder.height += 20
}

你可能感兴趣的:(QT)