StackView different pages text display problem



  • Hi,

    I just start to write apps using QML, but I find the text display in StackView is a bit messy, even in the simplest case. Here's the code:
    

    main.qml
    @import QtQuick 2.2
    import QtQuick.Controls 1.1

    ApplicationWindow {
    visible: true
    width: 640
    height: 480
    title: qsTr("Hello World")

    property Component t1: T1 {
        onGotoPage: if (page === "T2") {
                        pageView.pop()
                        pageView.push(t2)
                    }
    }
    
    property Component t2: T2 {
        onGotoPage: if (page === "T1") {
                        pageView.pop()
                        pageView.push(t1)
                    }
    }
    
    StackView {
        id: pageView
        anchors.fill: parent
        focus: true
        initialItem: t1
    }
    

    }@

    T1.qml
    @import QtQuick 2.0

    Rectangle {
    width: 100
    height: 62

    signal gotoPage(string page)
    
    Text {
        anchors.centerIn: parent
        text: "hahahaha"
        MouseArea {
            anchors.fill: parent
            onClicked: gotoPage("T2")
        }
    }
    

    }@

    T2.qml
    @import QtQuick 2.0

    Rectangle {
    width: 100
    height: 62

    signal gotoPage(string page)
    
    Text {
        anchors.centerIn: parent
        text: "appleeeeeeee"
        MouseArea {
            anchors.fill: parent
            onClicked: gotoPage("T1")
        }
    }
    

    }@

    It's ok on desktop and android simulator. But on my phone(android 4.2.2), the initial page T1 is ok, then the weird T2
    !http://i.imgur.com/CvT9nlp.jpg(appleeeeeeee)!
    and go back to T1
    !http://i.imgur.com/HWDjZCr.jpg(hahahaha)!
    It seems it's not refreshed correctly. Is there any way to enforce correct display? Thanks.



  • Finally I find the text is rendered OK when I add
    @renderType: Text.NativeRendering@

    to Text, don't know why the default Text.QtRendering doesn't work. Is it a bug?


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.