Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. StackView different pages text display problem
Qt 6.11 is out! See what's new in the release blog

StackView different pages text display problem

Scheduled Pinned Locked Moved QML and Qt Quick
2 Posts 1 Posters 1.1k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • C Offline
    C Offline
    culiubaicai
    wrote on last edited by
    #1

    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.

    1 Reply Last reply
    0
    • C Offline
      C Offline
      culiubaicai
      wrote on last edited by
      #2

      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?

      1 Reply Last reply
      0

      • Login

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved