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. Qt Quick dynamicaly add page to swipe view
Forum Updated to NodeBB v4.3 + New Features

Qt Quick dynamicaly add page to swipe view

Scheduled Pinned Locked Moved Solved QML and Qt Quick
4 Posts 3 Posters 4.0k Views 2 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.
  • L Offline
    L Offline
    lotin
    wrote on last edited by
    #1

    Hello,
    I have class in c++ for network listenig on multicast that have a function which emits signal:

    public slot:
    void listenOnPort(int port);
    
    signals:
    void multicastReceived(QString msg);
    

    Its just part of bigger software with Gui in qml with swipe view as main part:

        SwipeView {
            id: swipeView
            anchors.fill: parent      
            currentIndex: tabBar.currentIndex
            MainPage {
            }
    .
    .
    .
        }
    

    And I need that when the qml receives the signal from c++. It dynamicaly add new page (just with some text holder) to swipe view where the received message from multicast will be displayed.

    Can someone help me with this dynamic adding to swipe view please. If it's even possible :-)

    Thanks soo much to everyone :-)

    1 Reply Last reply
    0
    • ? Offline
      ? Offline
      A Former User
      wrote on last edited by A Former User
      #2

      Hi! SwipeView is a Container QML Type. So you should be able to pages to it using void addItem(Item item).

      1 Reply Last reply
      0
      • L Offline
        L Offline
        lotin
        wrote on last edited by
        #3

        Great thanks it works. My example solution:

            SwipeView {
                id: swipeView
                anchors.fill: parent    
                MainPage {
                }
        
                function addPage(page) {
                   addItem(page)
                   page.visible = true
                }
        
                function removePage(page) {
                   for (var n = 0; n < count; n++) { if (page === itemAt(n)) { removeItem(n) } }
                   page.visible = false
                }
            }
        
        1 Reply Last reply
        0
        • G Offline
          G Offline
          Gurubaran
          wrote on last edited by
          #4
          This post is deleted!
          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