sophister
15th June 2009, 07:08
Hi again, I'm faced with the second application's crash.
Here is my code:
void DishManager::initPage1()
{
ui.p1FamilyComboBox->addItems(dishes->getFamilies());
}
where p1FamilyComboBox is a instance of
QComboBox, and dishes is an instance of the following class Record.
const QStringList& Record::getDishNamesByFamily(const QString &family) const
{
QStringList names;
for(int i = 0; i < dishes.size(); i++)
{
if(dishes[i].getFamily() == family)
{
names << dishes[i].getName(); //如果某菜谱属于此菜系,则加入其菜名
}
}
return names;
}I think maybe it's due to the
const QStringList& Record::getDishNamesByFamily
Is there anything wrong with the returning value.
Thanks in advance!!
Here is my code:
void DishManager::initPage1()
{
ui.p1FamilyComboBox->addItems(dishes->getFamilies());
}
where p1FamilyComboBox is a instance of
QComboBox, and dishes is an instance of the following class Record.
const QStringList& Record::getDishNamesByFamily(const QString &family) const
{
QStringList names;
for(int i = 0; i < dishes.size(); i++)
{
if(dishes[i].getFamily() == family)
{
names << dishes[i].getName(); //如果某菜谱属于此菜系,则加入其菜名
}
}
return names;
}I think maybe it's due to the
const QStringList& Record::getDishNamesByFamily
Is there anything wrong with the returning value.
Thanks in advance!!