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