Hi!
I don't have much experience with Qt but somehow I think this is acting strange. Compiled with VS2005:
class Entry {
public: Entry(const QString& aName, bool checked) :
name(aName), isChecked(checked)
{
// empty
};
public: Entry(const Entry& entry) :
name(entry.name), isChecked(entry.isChecked)
{
// empty
};
public: Entry& operator=(const Entry& entry)
{
name = entry.name;
isChecked = entry.isChecked;
return *this;
}
public: QString name;
public: bool isChecked;
};
typedef QList<conduit::Entry> EntryVector;
When using EntryVector in the following lines, the entry in QList becomes a bad pointer:
void EntryWidget::setEntries(QStringList& names)
{
QStringList::iterator member;
EntryVector list;
for (member = names.begin(); member != names.end(); ++member)
{
Entry entry(*member, false);
list.append(entry);
}
m_model.setEntryData(list);
}
Somehow, entry.name in the list will become a bad pointer. My understanding is that QList should be able to support any data in its template, but for some reason that I yet do not understand this does not work. Everything works just fine if I use a STL Vector.
Any ideas? Thanks