mirror of
https://github.com/GoldenCheetah/GoldenCheetah.git
synced 2026-02-13 16:18:42 +00:00
Model reset fixup to use begin/endResetModel
Which is how you are supposed to reset a model and works on QT 4 as well as QT 5.
This commit is contained in:
@@ -88,6 +88,9 @@ public slots:
|
||||
|
||||
if (!sourceModel()) return; // no model yet!
|
||||
|
||||
// ok, let em know we're about to reset!
|
||||
beginResetModel();
|
||||
|
||||
QDate first = QDate(year, month, 1);
|
||||
// Date array
|
||||
int monthDays = first.daysTo(first.addMonths(1)); // how many days in this month?
|
||||
@@ -135,12 +138,9 @@ public slots:
|
||||
arr->append(j);
|
||||
dateToRows.insert(dateTime.date(), arr);
|
||||
}
|
||||
#if QT_VERSION > 0x050000
|
||||
resetInternalData(); //XXX BROKEN!
|
||||
#else
|
||||
reset();
|
||||
#endif
|
||||
|
||||
// reset completed
|
||||
endResetModel();
|
||||
}
|
||||
|
||||
public:
|
||||
|
||||
@@ -488,13 +488,14 @@ public:
|
||||
|
||||
public slots:
|
||||
void sourceModelChanged() {
|
||||
|
||||
// notify everyone we're changing
|
||||
beginResetModel();
|
||||
|
||||
clearGroups();
|
||||
setGroupBy(groupBy+2); // accomodate virtual columns
|
||||
#if QT_VERSION > 0x050000
|
||||
resetInternalData(); //XXX BROKEN!
|
||||
#else
|
||||
reset();
|
||||
#endif
|
||||
|
||||
endResetModel();// we're clean
|
||||
|
||||
// lets expand column 0 for the groupBy heading
|
||||
for (int i=0; i < groupCount(); i++)
|
||||
|
||||
Reference in New Issue
Block a user