Fix a bug : previous year loading does something worse
This commit is contained in:
parent
6fb6f6832c
commit
c78b88b387
|
@ -337,7 +337,7 @@ void AccountPanel::LoadYear(int year, bool showMonth)
|
|||
User* user = _kiss->GetUser();
|
||||
int curMonth = -1;
|
||||
QDate curDate = QDate::currentDate();
|
||||
QTreeWidgetItem* parentNode, *curMonthNode;
|
||||
QTreeWidgetItem* parentNode, *curMonthNode = 0;
|
||||
std::map<int, std::vector<int> > ops ;
|
||||
std::vector<int>::iterator it;
|
||||
|
||||
|
@ -354,16 +354,19 @@ void AccountPanel::LoadYear(int year, bool showMonth)
|
|||
|
||||
parentNode = _tree->currentItem();
|
||||
|
||||
if (!parentNode)
|
||||
parentNode = _tree->topLevelItem(0);
|
||||
|
||||
for (it = ops[year].begin(); it != ops[year].end(); it++)
|
||||
{
|
||||
if (curMonth == -1 || (year == curDate.year() && *it <= curDate.month()))
|
||||
if (!curMonthNode)
|
||||
{
|
||||
curMonth = *it;
|
||||
curMonthNode = new QTreeWidgetItem(QStringList(wxUI::months[*it]));
|
||||
parentNode->addChild(curMonthNode);
|
||||
}
|
||||
else
|
||||
_tree->topLevelItem(0)->addChild(new QTreeWidgetItem(QStringList(wxUI::months[*it])));
|
||||
else
|
||||
parentNode->addChild(new QTreeWidgetItem(QStringList(wxUI::months[*it])));
|
||||
}
|
||||
|
||||
_tree->expandItem(parentNode);
|
||||
|
@ -846,7 +849,7 @@ void AccountPanel::OnTreeChange (QTreeWidgetItem * item, int column)
|
|||
|
||||
// _tree.CollapseAll();
|
||||
// _tree.Expand(event.GetItem());
|
||||
LoadYear(year, false);
|
||||
LoadYear(year, true);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue
Block a user