heyy guys wats up !?? i am trying to convert a list(c++) in qt list... i have no idea how i can do that....

the list is a list of employee objects.... (id , name, rate)

i want a list of qtlist which containts the employee objects or at least the id and name of each employee... its really urgent... thanks in advance...

Recommended Answers

All 6 Replies

This will show you how to iterate through an std::list. I don't know about qtlist - if you can send a link to the documentation or something maybe someone can help if you have trouble with that part.

here we go : http://doc.qt.nokia.com/3.3/classes.html

like i knw how to go through a list... but i knw how to make my list of object to a Qlist...

remember my employee list hold three thngs int ID , string name and int rate...

You should not be much effort at all to convert std::list<employeeObject> to QValueList<employeeObject>.

In fact all you need to do is change the type. QT containers are compatible with the STL so you can use pretty much all the STL algorithms on a QValueList as you would on a std::list.

will this function help me to convert the list into a qlist QValueList ( const std::list<T> & l ) ? like i need to put all the employee id, name and rate into a Qlistbox and the qlistbox accept parameter of qlist of type qstring...

What you are saying doesn't make sense, the closest method I can find to what you have described is void QListBox::insertStringList ( const QStringList & list, int index = -1 ); That takes a QStringList which is in fact a QValueList specialised for QStrings

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.