![]() Registered Member ![]()
|
Hi,
first of all, I want to say that I'm new to KDE and Qt. But lets start with my problem. I want to implement the bookmarks of Konqueror in my application. Maybe with a QTreeView? So the user can click on one of his bookmarks and this one is loaded. I searched in the API of KDE but now I have more questions than before. So what is the easiest way to implement this? Any tipps? Thanks. |
![]() KDE Developer ![]()
|
A good starting point is the Bookmark manager class http://api.kde.org/4.x-api/kdelibs-apid ... nager.html
To get an instance managing the user's main bookmarks, you would do something like this
You can either iterate manually over the bookmarks it manages or use a http://api.kde.org/4.x-api/kdelibs-apid ... erser.html Cheers, _
anda_skoa, proud to be a member of KDE forums since 2008-Oct.
|
![]() Registered Member ![]()
|
First of all: thanks.
But how can I iterate? If I want to iterate, I will need a QList, won't I? How can I get such a list from KBookmarkManager? If I write
I will get the Name of the first folder. But I also want to get whats inside. I'm confused, sorry. |
![]() KDE Developer ![]()
|
You can use the next() method or maybe even better the traverser.
Cheers, _
anda_skoa, proud to be a member of KDE forums since 2008-Oct.
|
![]() Registered Member ![]()
|
|
![]() KDE Developer ![]()
|
Sure
![]() The Traverser is an implementation of the Visitor pattern. Which means an instance if it is passed along the internal structure and "visits" all nodes. To use this for your own purpose you need to create a subclass and implement the virtual methods (or in this case only those you want to handle) Lets assume we want to print the "text" property of each node and have the intentation reflect the depth in the bookmark tree.
Cheers, _
anda_skoa, proud to be a member of KDE forums since 2008-Oct.
|
![]() Registered Member ![]()
|
Thanks. I have changed a little bit and now it works.
The first line has to be:
And I added:
|
Registered users: Bing [Bot], Evergrowing, Google [Bot], rblackwell