Add a custom role used to sort the tags with an upcoming proxy model
This commit is contained in:
		
					parent
					
						
							
								fc20d57708
							
						
					
				
			
			
				commit
				
					
						3479c42968
					
				
			
		
					 2 changed files with 7 additions and 0 deletions
				
			
		| 
						 | 
				
			
			@ -56,6 +56,8 @@ QVariant DanbooruTagModel::data(const QModelIndex &index, int role) const
 | 
			
		|||
        return i18np("%1 (%2 post)", "%1 (%2 posts)", tag->name(), tag->count());
 | 
			
		||||
    } else if (role == Qt::ToolTipRole) {
 | 
			
		||||
        return i18n("Tag count: %1", tag->count());
 | 
			
		||||
    } else if (role == TagCountRole) {
 | 
			
		||||
        return tag->count();
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    // TODO: More roles depending on the type of information
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -40,6 +40,11 @@ public:
 | 
			
		|||
    void clear();
 | 
			
		||||
    DanbooruTag* itemAt(int index) const;
 | 
			
		||||
 | 
			
		||||
    enum TagRoles {
 | 
			
		||||
        // Needed for sorting through the proxy model
 | 
			
		||||
        TagCountRole = Qt::UserRole + 4000
 | 
			
		||||
    };
 | 
			
		||||
 | 
			
		||||
private:
 | 
			
		||||
    QVector<DanbooruTag*> m_items;
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue