mirror of
				https://github.com/subsurface/subsurface.git
				synced 2025-02-19 22:16:15 +00:00 
			
		
		
		
	Show the number of dives with each tag in the filter panel
This is a rather brute force implementation. It might be worth while caching this information - but I'd like to do some benchmarking, first. Sadly this code also shows that there are some bugs hidden in the selection code when filtering is present. When a trip is selected all dives in the trip get selected, even those that are not visible under the current filter. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
		
							parent
							
								
									f9b9535c69
								
							
						
					
					
						commit
						d06cc2c68e
					
				
					 1 changed files with 3 additions and 1 deletions
				
			
		| 
						 | 
					@ -2268,7 +2268,9 @@ QVariant TagFilterModel::data(const QModelIndex &index, int role) const
 | 
				
			||||||
	if (role == Qt::CheckStateRole) {
 | 
						if (role == Qt::CheckStateRole) {
 | 
				
			||||||
		return checkState[index.row()] ? Qt::Checked : Qt::Unchecked;
 | 
							return checkState[index.row()] ? Qt::Checked : Qt::Unchecked;
 | 
				
			||||||
	} else if (role == Qt::DisplayRole) {
 | 
						} else if (role == Qt::DisplayRole) {
 | 
				
			||||||
		return stringList()[index.row()];
 | 
							QString tag = stringList()[index.row()];
 | 
				
			||||||
 | 
							int count = count_dives_with_tag(tag.toUtf8().data());
 | 
				
			||||||
 | 
							return tag + QString("(%1)").arg(count);
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	return QVariant();
 | 
						return QVariant();
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue