This forum has been archived. All content is frozen. Please use KDE Discuss instead.

TreeWidget change signals

Tags: None
(comma "," separated)
pollastri
Registered Member
Posts
2
Karma
0

TreeWidget change signals

Tue Jan 13, 2009 11:08 am
Hello all,
I'm trying to capture all signals from a TreeWidget indicating that something in the logical structure of data displayed by widget is changed. Expanded and collapsed status don't care.
In particular, I am looking for signals activated when
1: items are sorted
2: items are reordered by internal drag and drop
4: item added, deleted by external drag and drop
5: item added
6: item deleted
7: item changed

The same problem with qt3 widget QListView.

Thanks in advance for any help.
User avatar
msoeken
Mentor
Posts
300
Karma
4
OS

RE: TreeWidget change signals

Tue Jan 13, 2009 11:47 am
Have a look at the signals emitted by the underlying model, especially the layoutChanged signal.

You can access the model via
Code: Select all
treeView->model()

where treeView is a instance of QTreeWidget class.


Image
[size=x-small]code | [url=cia.vc/stats/author/msoeken]cia.vc[/url] | [url=kde.org/support]donating KDE[/url] | [url=tinyurl.com/cto4ns]wishlist[/url][/size]
pollastri
Registered Member
Posts
2
Karma
0

RE: TreeWidget change signals

Tue Jan 13, 2009 2:02 pm
With these model signals "layoutChanged", "dataChanged", "headerDataChanged", "rowsInserted", "rowsRemoved", it works for sorting (sortingEnabled=True), but does not work with drag and drop.

Another question: if sorting is enabled, Qt4 applies sorting at every item change/insertion into the model. It is possible to sort only when user clicks on a column header (the same behavior of Qt3).
User avatar
msoeken
Mentor
Posts
300
Karma
4
OS

RE: TreeWidget change signals

Tue Jan 13, 2009 5:33 pm
pollastri wrote:With these model signals "layoutChanged", "dataChanged", "headerDataChanged", "rowsInserted", "rowsRemoved", it works for sorting (sortingEnabled=True), but does not work with drag and drop.


Try to extend from QTreeView and override the drag and drop functions in here.


Image
[size=x-small]code | [url=cia.vc/stats/author/msoeken]cia.vc[/url] | [url=kde.org/support]donating KDE[/url] | [url=tinyurl.com/cto4ns]wishlist[/url][/size]


Bookmarks



Who is online

Registered users: Bing [Bot], Evergrowing, Google [Bot], rblackwell