PDA

View Full Version : QT QListView (as icons)



Majdi
1st January 2009, 10:40
Hello all,
I'm web developer and also I used to write C++ code, Now I need to do a project for document clustering by using QT. I don't have experience with Qt , I read much and still have more than much to read, but because of the time, and I have to deliver this project for my university I need some help.

I'm sure that all the people here have more experience in QT than me , and maybe not only in QT :D

What I'm trying to do now is the interface.
I want to create QT QListView (as icons) but I did not find examples or tutorials to do this,
The image attached show what I want to do , so please if you have idea or which part of QT help I need to read tell me.

I just want the direction to do it , so tell me what should I read because really QT is sea .. and I don't want to be lost

Thanks a lot

spirit
1st January 2009, 10:52
look at this property QListView::viewMode (http://doc.trolltech.com/4.4/qlistview.html#viewMode-prop).

Majdi
1st January 2009, 11:06
Hi spirit, thanks for your fast response,

yes I already found the Property for switch mode.. now I'm trying to add Item for that list..

How to add Item ? can you give me example ?

Thanks

spirit
1st January 2009, 11:33
you can use list-model, see QStringListModel (http://doc.trolltech.com/4.4/qstringlistmodel.html#details) or QStandardItemModel then set this model to view using setModel method of view. anyway, I suggest you to read Model view programming (http://doc.trolltech.com/4.4/model-view-programming.html) for more information.

wysota
1st January 2009, 15:23
If you need something simple or do not feel proficient enough to use complex solutions, use QListWidget instead of QListView.

Majdi
2nd January 2009, 19:00
thanks guys I go to model / view , its nice but its need long time to learn so i used QListWidget as wysota said, its much much easier.

Now for that QListWidgetI want to create pop-up menu , so when someone click right click he can get the list to add items, so I go thought QMenu but I did not understand it in the right way... So anyone can gives me some hints ?
I search in the examples but I'm confused because the menu examples handle all type of menu so I did not understand where is the code that responsible for creating the Pop-up menu , can someone give me small example .... Thanks :)

Sorry guys , I'm really new

spirit
2nd January 2009, 19:04
look at this post context menu.

Majdi
2nd January 2009, 23:30
spirit, Thanks man its work 100%, let me continue working in the project and see where i will get stuck lol, I really want to learn this QT but i think its need time, The logic of programming in my head is right, even sometimes I do guessing and its work but I need to practice more... I just start QT from 1 month a go and most of time busy in my work as web developer....

Please spirit , how long you have been programming with QT ?

Thanks again

spirit
3rd January 2009, 06:38
spirit, Thanks man its work 100%, let me continue working in the project and see where i will get stuck lol, I really want to learn this QT but i think its need time, The logic of programming in my head is right, even sometimes I do guessing and its work but I need to practice more... I just start QT from 1 month a go and most of time busy in my work as web developer....

Please spirit , how long you have been programming with QT ?

Thanks again

4 years :)

Majdi
6th January 2009, 09:38
so its normal I keep ask questions :D heheh

I'm stuck here , I want to delay the execution of the program in the main.cpp file


#include<QTestEventList >
....
QTestEventList events;
events.addDelay(200);

QLineEdit *lineEdit = new QLineEdit(myParent);

events.simulate(lineEdit);
but did not work .
also i use this


#include <QTest>
...
QTest *wait=new QTest();
wait->qWait(250);


but also did not work .... ! how to do it ?... thanks

jillian
2nd March 2010, 23:22
Try:
QTest::qWait(250);