Forums

OverviewFelgo 2 Support (Qt 5) › JsonListModel and count = 0

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #23418

    jrrobles79

    I have a JsonListModel, that I use to fill a MapItemView with a list of addresses I got from a RestApi, and also I have two extra components, the first show additional info of the MapQuitItem that represent the task when the user click it, also, if there is data on the list, the closest address to the user is selected as  default. The other component is just a Text that saids ‘No addresses found’. My problem is the next,

     

    When I refresh the listModel, that is  every minute,  I clear the previous data on the model and from a second there the ‘no task’ component show up, this obviously is giving my a glitch that every minute that component is ‘flashing’, is there a way to avoid that?

    AddressInfoCar{
    id: infoCard
    ..
    ...
    ....
    visible: dataModel.availableAddress.count > 0
    
    }

     

    Rectangle{
     id: noAddressFound
    ...
    ...
    ...
    visible: dataModel.availableAddress.count == 0
    }
    

     

     

     

     

    #23427

    Edward

    There may well be a better way,

     

    But when the count changes, you could maybe use a timer to delay the no task component, that way If the connection is interrupted (when the timer is complete after, say 10 seconds) it would correctly show the no task component, but if during the timer’s running the count once again goes above 0, the timer is stopped and may not cause a ‘flashing’ as it just updates with the new values?

    #23466

    Dmitry

    IMHO you should replace jsonlistmodel`s content, not “erase and fill”

    Each time you change model`s source data, signal is being emmited. So you should store your new data in some js variable, and load it into model.

Viewing 3 posts - 1 through 3 (of 3 total)

RSS feed for this thread

You must be logged in to reply to this topic.

Voted #1 for:

  • Easiest to learn
  • Most time saving
  • Best support

Develop Cross-Platform Apps and Games 50% Faster!

  • Voted the best supported, most time-saving and easiest to learn cross-platform development tool
  • Based on the Qt framework, with native performance and appearance on all platforms including iOS and Android
  • Offers a variety of plugins to monetize, analyze and engage users
FREE!
create apps
create games
cross platform
native performance
3rd party services
game network
multiplayer
level editor
easiest to learn
biggest time saving
best support