You are not logged in.

Dear visitor, welcome to QtForum.org. If this is your first visit here, please read the Help. It explains in detail how this page works. To use all features of this page, you should consider registering. Please use the registration form, to register here or read more information about the registration process. If you are already registered, please login here.

1

Sunday, May 20th 2012, 9:05pm

QTreeWidget, i cant see the items

I add items to a treewidget but i cannot see them

i am usings qtjambi, here is the code, the libraryTree is the QTreeWidget I add the items.
i release that it never get past the second line until i close the window

Source code

1
System.out.println("Add item");QTreeWidgetItem allItem = new QTreeWidgetItem(libraryTree);System.out.println("1");allItem.setText(1, "All");System.out.println("2");libraryTree.addTopLevelItem(allItem);System.out.println("The item has been added");


output:

Source code

1
2
Add item//here i close the window after 1 minute
QObject::startTimer: QTimer can only be used with threads started with QThreadQObject::startTimer: QTimer can only be used with threads started with QThread12The item has been added

2

Monday, May 21st 2012, 8:47am

Something is stopping your program from running. Since you dont show anything else about your code it is hard to say...
If you have a problem, CUT and PASTE your code. Do not retype or simplify it. Give a COMPLETE and COMPILABLE example of your problem. Otherwise we are all guessing the problem from a fabrication where relevant details are often missing.

3

Monday, May 21st 2012, 9:01am

the problem is that its a lot of code interact with other code and etc etc etc....
i think it will be difficult for you to understand all the code to find the problem but here is the project --> deleted

i am trying to make a music player, i created the GUI with Qt Jambi (file /src/yamp/ui/YampMainWindow.java) and i am trying to list the artists in a QTreeWidget, the last line of main() in the previous file is

Source code

1
window.setLibrary(artists_songs);
with this i call the the setLibrary() which will add the artists in the QTreeWidget

to get the artists a use mostly the code at /src/yamp/musiclibrary/LibraryManagement.java calling from /src/yamp/YampLibrary.java


if you have any question or anything tell me, sorry if i am not very understandable :(

edit: i commented line

Source code

1
MultiMap artists_songs = m.YampLibrary();
in main and

Source code

1
2
Set artists = map.keySet();
TreeSet artistsSorted = new TreeSet(artists);
in setLibrary() and i change the

Source code

1
window.setLibrary(artists_songs);
with

Source code

1
window.setLibrary(null);
so it doesn't execute other code but still i can't see the "All" and i still get the

Source code

1
2
3
4
5
6
Add item
QObject::startTimer: QTimer can only be used with threads started with QThread
QObject::startTimer: QTimer can only be used with threads started with QThread
1
2
The item has been added

This post has been edited 2 times, last edit by "clepto" (May 26th 2012, 7:42pm)


4

Tuesday, May 22nd 2012, 8:22am

i'd look for code that uses startTimer/Qtimer
If you have a problem, CUT and PASTE your code. Do not retype or simplify it. Give a COMPLETE and COMPILABLE example of your problem. Otherwise we are all guessing the problem from a fabrication where relevant details are often missing.

5

Tuesday, May 22nd 2012, 11:32am

i haven't written any code which use those...
maybe is under the hood of some function...

if you have any question tell me.

I appreciate it :)

6

Tuesday, May 22nd 2012, 1:25pm

i solved it!
look here http://stackoverflow.com/questions/74500…ed-with-qthread
i change the two last lines in main so

Source code

1
window.setLibrary(null);
will execute before

Source code

1
QApplication.exec();

7

Tuesday, May 22nd 2012, 6:51pm

Funny how a line that you didnt show us was the problem...


this is why I always try and insist on complete examples, not snippets. It's a waste of time...
If you have a problem, CUT and PASTE your code. Do not retype or simplify it. Give a COMPLETE and COMPILABLE example of your problem. Otherwise we are all guessing the problem from a fabrication where relevant details are often missing.

8

Tuesday, May 22nd 2012, 7:27pm

i agree with you