Replace QModelIndex::child() to avoid a deprecation warning.
authorPhilipp Spitzer <philipp@spitzer.priv.at>
Wed, 14 Jul 2021 19:28:02 +0000 (21:28 +0200)
committerPhilipp Spitzer <philipp@spitzer.priv.at>
Wed, 14 Jul 2021 19:28:46 +0000 (21:28 +0200)
src/mvc/delegate.cpp

index 2d1f08524084873ea61ee03ad94879a50a826960..99da5c166d807ea49d8fae0d4b058a9806ff0586 100644 (file)
@@ -363,7 +363,7 @@ int Delegate::numberOfFavourities(const QModelIndex &index) const
 
     int nrofFavs = 0;
     for(int i=0; i<index.model()->rowCount(index); i++)
 
     int nrofFavs = 0;
     for(int i=0; i<index.model()->rowCount(index); i++)
-        if(static_cast<Event*>(index.child(i,0).internalPointer())->favourite() != Favourite_no)
+        if(static_cast<Event*>(index.model()->index(i, 0, index).internalPointer())->favourite() != Favourite_no)
             nrofFavs++;
 
     return nrofFavs;
             nrofFavs++;
 
     return nrofFavs;
@@ -376,7 +376,7 @@ int Delegate::numberOfAlarms(const QModelIndex &index) const
 
     int nrofAlarms = 0;
     for(int i=0; i<index.model()->rowCount(index); i++)
 
     int nrofAlarms = 0;
     for(int i=0; i<index.model()->rowCount(index); i++)
-        if(static_cast<Event*>(index.child(i,0).internalPointer())->hasAlarm())
+        if(static_cast<Event*>(index.model()->index(i, 0, index).internalPointer())->hasAlarm())
             nrofAlarms++;
 
     return nrofAlarms;
             nrofAlarms++;
 
     return nrofAlarms;