当前位置: 代码迷 >> QT开发 >> QtQuick项目界面跳转怎样实现解决方法
  详细解决方案

QtQuick项目界面跳转怎样实现解决方法

热度:102   发布时间:2016-04-25 03:16:40.0
QtQuick项目界面跳转怎样实现
想要模拟手机屏幕的设计,点击不同按键打开不同界面,并能对界面进行操作。
我个人目前只会实现到点击不同按键打开相同界面,想向各位请教一下
下面是我的代码,再怎样实现,求解决
main.qml
import QtQuick 1.0
import com.nokia.symbian 1.0
import "connect"//引入connect进行关联

Window {
    id: window

    StatusBar {
        id: statusBar
        width: 360
        height: 45
        anchors.top: window.top
       }
    Rectangle {
        id: bluetooth
        x: 0
        y: 45
        width: 360; height: 595
        color: "black"
        ListModel {
            id:viewModel
            ListElement {title: "开启蓝牙"}
            ListElement {title: "本机可见性"}
            ListElement {title: "配对设备"}
            ListElement {title: "我的手机名"}
            ListElement {title: "帮助"}
        }
        ListView {
            id: listView
            visible: true
            anchors.fill: parent
            model:viewModel//调用与之相关的model
            delegate: ViewModel{}
        }
    }
}

ViewModel.qml
import QtQuick 1.0

Component {//组件
    id: menuDelegate
    Item {
        id: menu
        property real detailsOpacity : 0
        width: listView.width
        height: 70

        Rectangle {
            id: background
            x: 2;
            y: 2;
            width: parent.width - x*2;
            height: parent.height - y*2
            color: "ivory"
            border.color: "red"
            radius: 5
        }
        MouseArea {//鼠标感应区
            anchors.fill: parent
            onClicked: menu.state = 'View';//当点击按键时执行View状态
        }

        Text {//主界面上的字体显示
            text: title
            font.bold: true;
            verticalAlignment: Text.AlignVCenter;
            horizontalAlignment: Text.AlignHCenter;
            font.pointSize: 16
            color: "blue"
        }

        states: State {
            name: "View"
            PropertyChanges {
                target: menu;
                detailsOpacity: 1;
                x: 0
            } //更改可见性,只使需要展现的menu可见
            PropertyChanges {
                target: menu;
  相关解决方案