Results 1 to 3 of 3

Thread: Aim: Creation of list during runtime

  1. #1
    Join Date
    Nov 2010
    Posts
    4
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Symbian S60 Maemo/MeeGo

    Default Aim: Creation of list during runtime

    Hello there, my fellow programmers!
    Yes, I'm newbie. Okay, straight too it.

    This isn't a programming error, as much as a lack of understanding of where I go next.

    I'm making a program, and among other things, I need to be able to generate a dynamic list during runtime based on parameters which change.
    I want to generate a list of options for the user to choose from, during runtime. This is necessary, because the program needs to propose the best fit as often as possible.

    It's a GPS system, where the user has to pick a predefined "area", or address as the one he occupies. This is done (as opposed to automatically choosing the closest one) because of the margin for fault in such GPSes.

    I've written a class for the addresses, and will have each address as a unique object with a unique position data set.

    These need to be proposed to the user based on the distance between himself and their position data. Simple calculation, but how do I code this without going into a "if / else if" frenzy?
    It's really necessary to modulate it, since I might need about 200 of these objects.

    Also, modulating the code would naturally allow me to add more of these address objects later without going into a fit of corrections.

    Please help me in the right direction of generally what programming methods I would use here.

    Thanks!

    Best regards, QtAlexander

  2. #2
    Join Date
    Sep 2010
    Posts
    145
    Thanks
    1
    Thanked 18 Times in 17 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Aim: Creation of list during runtime

    See Dijkstra's algorithm and think about what type of static data you can use to populate nodes. This is the stuff that GPS maps are made of. You need topology data, and a lot of it (unless you are using 10-digit grid to navigate everywhere - which isn't very user friendly unless you are targeting those with military training).

    The first order of business would be to generate (or find) that static data that you need. Maybe the GPS system has the topology data already and exposes an interface to use it?

    If I seem off-target or vague, that's because your question is extremely vague (and without any type of code). It's unclear if you are implementating GPS software or trying to interact with it.

  3. #3
    Join Date
    Aug 2009
    Location
    Belgium
    Posts
    310
    Thanks
    10
    Thanked 31 Times in 25 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Aim: Creation of list during runtime

    Hi,

    I think your question is that you a list of addresses, but want to show only part of them to the user, or not ?

    Where do you store the instances of your addresses ? You could use a QList< >.
    Then you can easily travers this list, and copy the relevant addresses to a second list that you use to present the user.

    Or you could present the relevant addresses to the user in list or in a QTreeview. You can create a list or treeview with two 'colums' and make the second column hidden. Put the address in the first colum, and put the data you need internally in your program in the second column. This list or treeview is generated dynamically based on the current position and your QList of addresses. When the user makes a selection, take the data from the invisible column to find out which one he selected.

    Hope this helps,
    Regards,
    Marc

Similar Threads

  1. List View with sections for alphabetialy sorted list
    By woodtluk in forum Qt Programming
    Replies: 4
    Last Post: 12th October 2010, 11:50
  2. Replies: 1
    Last Post: 25th September 2010, 08:20
  3. Some questions about Qt and App creation...
    By V I R U S in forum Newbie
    Replies: 6
    Last Post: 3rd September 2010, 15:07
  4. QFileInfo Creation
    By QbelcorT in forum Qt Programming
    Replies: 3
    Last Post: 17th June 2009, 09:01
  5. Msi Creation
    By navi1084 in forum Installation and Deployment
    Replies: 1
    Last Post: 30th December 2008, 13:18

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.