Results 1 to 4 of 4

Thread: load list

  1. #1
    Join Date
    Mar 2011
    Posts
    51
    Thanks
    7
    Qt products
    Qt3 Qt4 Qt/Embedded

    Default load list

    hi,

    I'm working on Qt Creator and I am completely new to it. I want to have a list box which is loaded with the data when I run the program and I choose a value from the list box and press button and do some operation on that selected value.

    Also, where to write a code to load the list automatically from the file ?

  2. #2
    Join Date
    Mar 2011
    Location
    Hyderabad, India
    Posts
    1,882
    Thanks
    3
    Thanked 452 Times in 435 Posts
    Qt products
    Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows
    Wiki edits
    15

    Default Re: load list

    I want to have a list box which is loaded with the data when I run the program
    If your list box data is static, (i,.e doest not change over the life of your program) the best place is the ctor of the list. If the list content can change, then it bettter to have some helper functions to load (init) the which you can use over time as required

    Also, where to write a code to load the list automatically from the file ?
    have it in aload / init method, and make it slot and connect to a QTimer, as you already did, or you can call it inside a timerEvent(), or evetn stringforward, have a button for refresh list box....many ways ...

  3. #3
    Join Date
    Mar 2011
    Posts
    51
    Thanks
    7
    Qt products
    Qt3 Qt4 Qt/Embedded

    Default Re: load list

    sir i have checked but ther is no init () method. usually programs has inti method but here i didnt fine any i have no idea where the program started executing this the constructor when i write the code in this it give an error so i dont know where to write the code.

    Qt Code:
    1. analysis::analysis(QWidget *parent) :
    2. QMainWindow(parent),
    3. ui(new Ui::analysis)
    4. {
    5. ui->setupUi(this);
    6. }
    To copy to clipboard, switch view to plain text mode 

  4. #4
    Join Date
    Jan 2006
    Location
    Germany
    Posts
    4,380
    Thanks
    19
    Thanked 1,005 Times in 913 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows Symbian S60
    Wiki edits
    5

    Default Re: load list

    Oh, Goodness! You get an error. You should have mentioned it in your first post. Simply use the "solution" to get rid of it.

    This was sarcasm, if anyone haven't get it. So what's about telling us what the error is and what code actually cause it? And of course you won't find an init function because you have to write it yourself.

Similar Threads

  1. Replies: 1
    Last Post: 23rd April 2011, 17:33
  2. [Tab play list]Load play lists on start
    By petrusPL in forum Qt Programming
    Replies: 0
    Last Post: 18th March 2011, 18:12
  3. 100% CPU load
    By kartun in forum Qt Programming
    Replies: 8
    Last Post: 24th February 2011, 07:11
  4. List View with sections for alphabetialy sorted list
    By woodtluk in forum Qt Programming
    Replies: 4
    Last Post: 12th October 2010, 11:50
  5. Qt4 does not load JPG's.
    By Teuniz in forum Qt Programming
    Replies: 3
    Last Post: 3rd September 2007, 23:06

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.