LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 09-01-2003, 07:02 PM   #1
dfuse
Member
 
Registered: May 2003
Location: Leuven, Belgium
Distribution: Gentoo Linux
Posts: 42

Rep: Reputation: 15
how to use QPtrDict in C++/Qt?


Hey,
I built a QPtrDict with QString as keys, and an object as value (irrelevant what kind of object). I know I filled the dictionary correctly because I can iterate it with a QPtrDictIterator and I see the correct content. My problem is I can't extract a value out of it by using a key, I think I'm doing someting wrong...

This is how I fill the dictionary:
exts.insert( new QString(ext), new ExtDescr(ext, descr, icon, open, casesensitive));

where exts is declared as:
QPtrDict<ExtDescr> exts;

and ext is a QString. If I just put ext instead of new QString(ext), I get an error from gcc: invalid conversion from const *void to *void

I try to get the value like this:
ExtDescr *extDescr = exts[ new QString(getFileExtension(fi)) ];

but ExtDescr is always null.

The documentation says the keys must be void pointer but I do not quite understand what that means, and how I can correctly use them. If anybody would know how to use a QPtrDict, I'd be very grateful!
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 11:32 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration