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 pop not working
Qt 6.11 is out! See what's new in the release blog

StackView pop not working

Scheduled Pinned Locked Moved Unsolved QML and Qt Quick
1 Posts 1 Posters 302 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.
  • T Offline
    T Offline
    therealmatiss
    wrote on last edited by therealmatiss
    #1

    Hello! I'm trying to control StackView from C++ via signals and I have two major problems.

    First problem: I have all my screens labeled by ID but I can't pass them from C++ as QString

    For example, this is a screen I want to pass to my StackView

    Item {
      id: scr_starting
      
      width: 800
      height: 480
    
      Image {
        source: "qrc:/assets/screens/scr-starting.png"
      }
    }
    

    stackview.qml

    ...
    Connections {
          target: cppStackview
    
          function onPushScreen(screen_id) {
            mainStackview.push(screen_id)
          }
    
         function onPopScreen(screen_id) {
            mainStackview.pop(screen_id)
          }
    ...
    

    So if I emit in C++ pushScreen("scr_starting") - it doesn't work. It only works if I pass the .qml file path.

    So here comes the second issue - I can't pop from C++ via signal if I am passing the .qml file path.
    pushScreen("main/scr_starting.qml"); - works
    pushScreen("main/scr_starting_new.qml"); - works
    popScreen("main/scr_starting.qml"); - doesn't work, even though the path is identical to the first push

    In fact, even empty pop doesn't work
    pushScreen("main/scr_starting.qml"); - works
    pushScreen("main/scr_starting_new.qml"); - works
    pop(); - this does literally mainStackview.pop() from signal - doesn't work

    What am I doing wrong here?

    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