mirror of
				https://github.com/subsurface/subsurface.git
				synced 2025-02-19 22:16:15 +00:00 
			
		
		
		
	In planner / add dive use 'ESC' to hide the gas selection popup
Not sure if there are other keys we should support. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
		
							parent
							
								
									a8888eaf26
								
							
						
					
					
						commit
						5e6ed53e40
					
				
					 2 changed files with 12 additions and 0 deletions
				
			
		|  | @ -164,6 +164,7 @@ DivePlannerGraphics::DivePlannerGraphics(QWidget* parent): QGraphicsView(parent) | ||||||
| 	gasListView->setWindowFlags(Qt::Popup); | 	gasListView->setWindowFlags(Qt::Popup); | ||||||
| 	gasListView->setModel(airTypes()); | 	gasListView->setModel(airTypes()); | ||||||
| 	gasListView->hide(); | 	gasListView->hide(); | ||||||
|  | 	gasListView->installEventFilter(this); | ||||||
| 
 | 
 | ||||||
| 	connect(gasListView, SIGNAL(activated(QModelIndex)), this, SLOT(selectGas(QModelIndex))); | 	connect(gasListView, SIGNAL(activated(QModelIndex)), this, SLOT(selectGas(QModelIndex))); | ||||||
| 	connect(plannerModel, SIGNAL(dataChanged(QModelIndex,QModelIndex)), this, SLOT(drawProfile())); | 	connect(plannerModel, SIGNAL(dataChanged(QModelIndex,QModelIndex)), this, SLOT(drawProfile())); | ||||||
|  | @ -175,6 +176,16 @@ DivePlannerGraphics::DivePlannerGraphics(QWidget* parent): QGraphicsView(parent) | ||||||
| 	setRenderHint(QPainter::Antialiasing); | 	setRenderHint(QPainter::Antialiasing); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | bool DivePlannerGraphics::eventFilter(QObject *object, QEvent* event) | ||||||
|  | { | ||||||
|  | 	if (object == gasListView && event->type() == QEvent::KeyPress) { | ||||||
|  | 		QKeyEvent *ke =  static_cast<QKeyEvent *>(event); | ||||||
|  | 		if (ke->key() == Qt::Key_Escape) | ||||||
|  | 			gasListView->hide(); | ||||||
|  | 	} | ||||||
|  | 	return false; | ||||||
|  | } | ||||||
|  | 
 | ||||||
| void DivePlannerGraphics::pointInserted(const QModelIndex& parent, int start , int end) | void DivePlannerGraphics::pointInserted(const QModelIndex& parent, int start , int end) | ||||||
| { | { | ||||||
| 	DiveHandler *item = new DiveHandler (); | 	DiveHandler *item = new DiveHandler (); | ||||||
|  |  | ||||||
|  | @ -153,6 +153,7 @@ private slots: | ||||||
| 	void selectGas(const QModelIndex& index); | 	void selectGas(const QModelIndex& index); | ||||||
| 	void pointInserted(const QModelIndex&, int start, int end); | 	void pointInserted(const QModelIndex&, int start, int end); | ||||||
| 	void pointsRemoved(const QModelIndex&, int start, int end); | 	void pointsRemoved(const QModelIndex&, int start, int end); | ||||||
|  | 	bool eventFilter(QObject *object, QEvent* event); | ||||||
| private: | private: | ||||||
| 	void moveActiveHandler(const QPointF& MappedPos, const int pos); | 	void moveActiveHandler(const QPointF& MappedPos, const int pos); | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue