mirror of
				https://github.com/subsurface/subsurface.git
				synced 2025-02-19 22:16:15 +00:00 
			
		
		
		
	Make esc-key discard the new tag selection
Signed-off-by: Gehad elrobey <gehadelrobey@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
		
							parent
							
								
									53b5e82411
								
							
						
					
					
						commit
						cc2369c5f9
					
				
					 1 changed files with 13 additions and 1 deletions
				
			
		|  | @ -179,7 +179,19 @@ void TagWidget::clear() | |||
| 
 | ||||
| void TagWidget::keyPressEvent(QKeyEvent *e) | ||||
| { | ||||
| 	QPair<int, int> pos; | ||||
| 	QAbstractItemView *popup; | ||||
| 	switch (e->key()) { | ||||
| 	case Qt::Key_Escape: | ||||
| 		pos = getCursorTagPosition(); | ||||
| 		if (pos.first >= 0 && pos.second > 0) { | ||||
| 			setText(text().remove(pos.first, pos.second - pos.first)); | ||||
| 			setCursorPosition(pos.first); | ||||
| 		} | ||||
| 		popup= m_completer->popup(); | ||||
| 		if (popup) | ||||
| 			popup->hide(); | ||||
| 		return; | ||||
| 	case Qt::Key_Return: | ||||
| 	case Qt::Key_Enter: | ||||
| 	case Qt::Key_Tab: | ||||
|  | @ -188,7 +200,7 @@ void TagWidget::keyPressEvent(QKeyEvent *e) | |||
| 		 * closing the QAbstractViewitem | ||||
| 		 */ | ||||
| 		if (m_completer) { | ||||
| 			QAbstractItemView *popup = m_completer->popup(); | ||||
| 			popup = m_completer->popup(); | ||||
| 			if (popup) | ||||
| 				popup->hide(); | ||||
| 		} | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue