hi everyone
I'm new to Qt
look at this code:
Code:
int node1; QMap< int,QList<int> > map; QList<int> adjacent = map.values(node1);
when i run it: boom
error: conversion from 'QList<QList<int> >' to non-scalar type 'QList<int>' requested
Printable View
hi everyone
I'm new to Qt
look at this code:
Code:
int node1; QMap< int,QList<int> > map; QList<int> adjacent = map.values(node1);
when i run it: boom
error: conversion from 'QList<QList<int> >' to non-scalar type 'QList<int>' requested
Look at the documentation: QMap::values() returns a QList of T's (in your case T is a QList<int>)
So you need to decide if you really need a QMap<int, QList<int> > then values(...) returns a QList<QList<int> > or use the value(...) member function to return a QList<int>