Basic support for tooltips in the tag widget
This commit is contained in:
		
					parent
					
						
							
								2623fee54d
							
						
					
				
			
			
				commit
				
					
						428c1bae91
					
				
			
		
					 1 changed files with 6 additions and 1 deletions
				
			
		| 
						 | 
				
			
			@ -19,7 +19,9 @@
 | 
			
		|||
 | 
			
		||||
#include "danboorutagmodel.h"
 | 
			
		||||
#include "libdanbooru/danboorutag.h"
 | 
			
		||||
#include <QDebug>
 | 
			
		||||
 | 
			
		||||
#include <KLocalizedString>
 | 
			
		||||
 | 
			
		||||
namespace Danbooru {
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -51,7 +53,10 @@ QVariant DanbooruTagModel::data(const QModelIndex &index, int role) const
 | 
			
		|||
    DanbooruTag* tag = m_items.at(index.row());
 | 
			
		||||
 | 
			
		||||
    if (role == Qt::DisplayRole) {
 | 
			
		||||
        return tag->name();
 | 
			
		||||
        QString text("%1 (%2)");
 | 
			
		||||
        return text.arg(tag->name()).arg(tag->count());
 | 
			
		||||
    } else if (role == Qt::ToolTipRole) {
 | 
			
		||||
        return i18n("Tag count: %1", tag->count());
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    // TODO: More roles depending on the type of information
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue