开发者

Qt Mobile image display and user interaction

开发者 https://www.devze.com 2023-03-12 12:56 出处:网络
While creating my Qt mobile开发者_StackOverflow社区 application, i would need the user to touch a particular image and then (the application would) act accordingly.

While creating my Qt mobile开发者_StackOverflow社区 application, i would need the user to touch a particular image and then (the application would) act accordingly.

I was using QLabel until now, but now it turns out it does not have ANY user interaction.

So I need suggestions on how to display images, preferably in a way that allows me to make use of Qt touch events too.

Thanks.


Displaying images and reacting to touch events is very easy to do in QML:

import QtQuick 1.0

Image {
    source: "image.png"

    MouseArea {
        anchors.fill: parent
        onClicked: {
            // React to image clicks here
        }
    }
}
0

精彩评论

暂无评论...
验证码 换一张
取 消