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. C++ data didn't update in Qml
Forum Updated to NodeBB v4.3 + New Features

C++ data didn't update in Qml

Scheduled Pinned Locked Moved Unsolved QML and Qt Quick
15 Posts 2 Posters 1.1k Views
  • 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.
  • KroMignonK KroMignon

    @dziko147 said in C++ data didn't update in Qml:

    I tried this solution and it doesn't work . :/

    Did you change also change the update method?

    QString Mode= ui->modecommande->currentText(); // this is a combobox
    qDebug() << Mode << "this is Mode select commande" ;
    ui->m_back.setdirectiontext(Mode);
    
    D Offline
    D Offline
    dziko147
    wrote on last edited by
    #5
    This post is deleted!
    KroMignonK 1 Reply Last reply
    0
    • D dziko147

      This post is deleted!

      KroMignonK Offline
      KroMignonK Offline
      KroMignon
      wrote on last edited by
      #6

      @dziko147 said in C++ data didn't update in Qml:

      @KroMignon No ,
      Can you suggest a method ?

      I don't understand what you mean, please be more clear.
      No what?

      • No you don't have change the update method?
      • After changing the update method, the QML didn't be update?

      It is an old maxim of mine that when you have excluded the impossible, whatever remains, however improbable, must be the truth. (Sherlock Holmes)

      1 Reply Last reply
      0
      • D Offline
        D Offline
        dziko147
        wrote on last edited by
        #7

        @KroMignon the update method is in another class .
        So how can get this m_back :)
        i am really new in Qt developpment .
        So excuse meif my question is stupid :)

        KroMignonK 1 Reply Last reply
        0
        • D Offline
          D Offline
          dziko147
          wrote on last edited by
          #8
          This post is deleted!
          1 Reply Last reply
          0
          • D dziko147

            @KroMignon the update method is in another class .
            So how can get this m_back :)
            i am really new in Qt developpment .
            So excuse meif my question is stupid :)

            KroMignonK Offline
            KroMignonK Offline
            KroMignon
            wrote on last edited by
            #9

            @dziko147 said in C++ data didn't update in Qml:

            the update method is in another class .
            So how can get this m_back :)
            i am really new in Qt developpment .
            So excuse meif my question is stupid :)

            I don't want to hurt you, but this has nothing to do with Qt, this is C++ basic.

            Do you have any knowledge about C++ programming?
            Do you know what is a class?
            Do you know what is a class method or member?

            Please take time to got basic knowledge about the programming language you want to use.
            There are many C++ tutorials available, take one and do at least the first step to understand what you are doing.

            Basic C++ knowledge is mandatory if you want to program with Qt which is a C++ framework.

            It is an old maxim of mine that when you have excluded the impossible, whatever remains, however improbable, must be the truth. (Sherlock Holmes)

            1 Reply Last reply
            0
            • D Offline
              D Offline
              dziko147
              wrote on last edited by
              #10

              @KroMignon ok i will :)
              but can you provide a way to create this m_back instance :)

              KroMignonK 1 Reply Last reply
              0
              • D dziko147

                @KroMignon ok i will :)
                but can you provide a way to create this m_back instance :)

                KroMignonK Offline
                KroMignonK Offline
                KroMignon
                wrote on last edited by
                #11

                @dziko147 said in C++ data didn't update in Qml:

                but can you provide a way to create this m_back instance :)

                https://www.w3schools.com/cpp/cpp_classes.asp

                It is an old maxim of mine that when you have excluded the impossible, whatever remains, however improbable, must be the truth. (Sherlock Holmes)

                1 Reply Last reply
                0
                • D Offline
                  D Offline
                  dziko147
                  wrote on last edited by
                  #12

                  @KroMignon I know how to use class/object .
                  I know how to manipulate c++ .
                  But my problem is how can get this in my second class

                  m_ui->quickWidget->rootContext()->setContextProperty("backend", &m_back);
                  
                  KroMignonK 1 Reply Last reply
                  0
                  • D dziko147

                    @KroMignon I know how to use class/object .
                    I know how to manipulate c++ .
                    But my problem is how can get this in my second class

                    m_ui->quickWidget->rootContext()->setContextProperty("backend", &m_back);
                    
                    KroMignonK Offline
                    KroMignonK Offline
                    KroMignon
                    wrote on last edited by
                    #13

                    @dziko147 said in C++ data didn't update in Qml:

                    But my problem is how can get this in my second class

                    I don't understand which second class you are talking about?

                    It is an old maxim of mine that when you have excluded the impossible, whatever remains, however improbable, must be the truth. (Sherlock Holmes)

                    1 Reply Last reply
                    0
                    • D Offline
                      D Offline
                      dziko147
                      wrote on last edited by
                      #14
                      This post is deleted!
                      KroMignonK 1 Reply Last reply
                      0
                      • D dziko147

                        This post is deleted!

                        KroMignonK Offline
                        KroMignonK Offline
                        KroMignon
                        wrote on last edited by
                        #15

                        @dziko147 said in C++ data didn't update in Qml:

                        So my problem is how can i get the m_back in the commande.cpp

                        Again, this is C++ basic => variable scope and life-cycle:

                        • https://en.cppreference.com/w/cpp/language/lifetime
                        • https://www.geeksforgeeks.org/scope-of-variables-in-c/
                        • http://www.mathcs.emory.edu/~cheung/Courses/561/Syllabus/3-C/scoping.html

                        It is an old maxim of mine that when you have excluded the impossible, whatever remains, however improbable, must be the truth. (Sherlock Holmes)

                        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