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. Patview incrementCurrentIndex

Patview incrementCurrentIndex

Scheduled Pinned Locked Moved Unsolved QML and Qt Quick
5 Posts 3 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.
  • DonCoderD Offline
    DonCoderD Offline
    DonCoder
    wrote on last edited by DonCoder
    #1
    function moveText()
    {
        myPathView.incrementCurrentIndex();
        myPathView.incrementCurrentIndex();
    }
    

    I am trying to move my pathview items by 2 lines. So i am calling incrementCurrentIndex twice. But it is getting incemented only once. Why ?

    1 Reply Last reply
    0
    • hskoglundH Offline
      hskoglundH Offline
      hskoglund
      wrote on last edited by
      #2

      Hi, just guessing but maybe you need a processEvents() wedged in, say like this:

      myPathView.incrementCurrentIndex();
      qApp->processEvents();
      myPathView.incrementCurrentIndex();
      
      DonCoderD 1 Reply Last reply
      0
      • hskoglundH hskoglund

        Hi, just guessing but maybe you need a processEvents() wedged in, say like this:

        myPathView.incrementCurrentIndex();
        qApp->processEvents();
        myPathView.incrementCurrentIndex();
        
        DonCoderD Offline
        DonCoderD Offline
        DonCoder
        wrote on last edited by
        #3

        @hskoglund said in Patview incrementCurrentIndex:

        qApp->processEvents();

        @hskoglund : But Calling qApp->processEvents(); explicitly is not a suggested by Qt Best Practices.

        hskoglundH 1 Reply Last reply
        0
        • DonCoderD DonCoder

          @hskoglund said in Patview incrementCurrentIndex:

          qApp->processEvents();

          @hskoglund : But Calling qApp->processEvents(); explicitly is not a suggested by Qt Best Practices.

          hskoglundH Offline
          hskoglundH Offline
          hskoglund
          wrote on last edited by
          #4

          @DonCoder I know, so if you test it and processEvents() helps, then you should refactor/rewrite your code and remove it.

          1 Reply Last reply
          0
          • ibiaI Offline
            ibiaI Offline
            ibia
            wrote on last edited by
            #5

            Are you sure that the index is not incrementing ? Do console.log to see if the index is not updated. The view may not be updated as quickly as the model.

            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