PDA

View Full Version : QT3 porting to QT4 problem



batileon
5th June 2008, 09:08
In QT3, I can use the following code in the .h file of my class:
typedef QMap < QString, QString > SubNameVariableMap;
typedef QMap < QString, SubNameVariableMap > NameVariableMap;
typedef SubNameVariableMap::value_type SubNameVariableMapValue ;
typedef NameVariableMap::value_type NameVariableMapValue;

but in QT4, a compilation error comes:
error:value_type in class QMap<QString, QString> does not name a type.

Can anyone tell me what's going on?
How can I solve this?

jacek
5th June 2008, 13:15
It's called mapped_type now.

batileon
6th June 2008, 09:10
O....
No.....
I found that in QT3 it's related to

typedef QPair<const key_type, mapped_type> value_type;
in qmap.h

but in QT4 qmap.h, there's no QPair related stuff....
I think what I need is the QPair mapping instead of only having the mapped_type.

Anyone can tell me how to achieve this?

jacek
8th June 2008, 00:58
I think what I need is the QPair mapping instead of only having the mapped_type.
What do you need this for? Anyway you can always use:
typedef QPair< const NameVariableMap::key_type, NameVariableMap::mapped_type > NameVariableMapValue;