This is probably an easy fix but I have spent about an hour trying to figure this out....
what am I doing wrong with my allTime QStringList I am pretty sure I am inserting QStringList time x24 inside of it.
but it doesnt even seem to be updating it keeps the same data as the old ones
ps(I can save every other item in my QTreeDialog well on the close and I can save every item including the times when I append it to the text on the add screen. but if I am removing I would rather not append I need to clear the txt file then add everything back in which I can only add like 90% it keeps the times from index 0 for the times.)
here is the code I am using for times/allTimes
//DIALOG that is adding items
times.clear(); //clearing so it doesnt display anything in the textEdits when I open the dialog.
for(int i = 0; i<24;i++){
if(!addedTimes[i].isEmpty()){
times << addedTimes[i];
} else {
times << "No Food";
}
}
//MAINWINDOW that I want to save the items when i close
for(int i = 0; i<allDates.size();i++){
for(int j = 0; j<24; j++){
allTimes << times[j];
}
}
//DIALOG that is adding items
times.clear(); //clearing so it doesnt display anything in the textEdits when I open the dialog.
for(int i = 0; i<24;i++){
if(!addedTimes[i].isEmpty()){
times << addedTimes[i];
} else {
times << "No Food";
}
}
//MAINWINDOW that I want to save the items when i close
for(int i = 0; i<allDates.size();i++){
for(int j = 0; j<24; j++){
allTimes << times[j];
}
}
To copy to clipboard, switch view to plain text mode
am I not reading in all 24 time QStrings for every date QString I have? because I am saving using that same formula on the add menu and its working fine when im appending.
Added after 6 minutes:
if I put this on the mainWindow
allTimes << times;
allTimes << times;
To copy to clipboard, switch view to plain text mode
instead of the for loop stuff
it crashes instantly adn then doesnt open till I delete the txt file and clean run it.
so it has to be some sort of loop i think to get the 24x QStrings
Bookmarks