Support pressing Return to search all posts
Add a placeholder text and a tool tip to clarify this.
This commit is contained in:
		
					parent
					
						
							
								4550f54f32
							
						
					
				
			
			
				commit
				
					
						c740558ca4
					
				
			
		
					 1 changed files with 3 additions and 4 deletions
				
			
		| 
						 | 
					@ -29,6 +29,9 @@ DanbooruSearchWidget::DanbooruSearchWidget(QWidget *parent): QWidget(parent)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    setupUi(this);
 | 
					    setupUi(this);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    tagLineEdit->setPlaceholderText(i18n("Type search tags."));
 | 
				
			||||||
 | 
					    tagLineEdit->setToolTip(i18n("Type search tags. An empty string searches all posts."));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    connect(searchButton, &QPushButton::clicked, this, &DanbooruSearchWidget::accept);
 | 
					    connect(searchButton, &QPushButton::clicked, this, &DanbooruSearchWidget::accept);
 | 
				
			||||||
    connect(tagLineEdit, &QLineEdit::returnPressed, this, &DanbooruSearchWidget::accept);
 | 
					    connect(tagLineEdit, &QLineEdit::returnPressed, this, &DanbooruSearchWidget::accept);
 | 
				
			||||||
    connect(closeButton, &QPushButton::clicked, [this]() {
 | 
					    connect(closeButton, &QPushButton::clicked, [this]() {
 | 
				
			||||||
| 
						 | 
					@ -49,10 +52,6 @@ QStringList DanbooruSearchWidget::selectedTags() const
 | 
				
			||||||
void DanbooruSearchWidget::accept()
 | 
					void DanbooruSearchWidget::accept()
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if (tagLineEdit->text().isEmpty()) {
 | 
					 | 
				
			||||||
        return;
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    m_tags = tagLineEdit->text().split(",");
 | 
					    m_tags = tagLineEdit->text().split(",");
 | 
				
			||||||
    Q_EMIT(accepted());
 | 
					    Q_EMIT(accepted());
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue