mirror of
				https://github.com/TES3MP/openmw-tes3mp.git
				synced 2025-10-31 20:56:42 +00:00 
			
		
		
		
	added scene tool mode context menu feature
This commit is contained in:
		
							parent
							
								
									0305ae3693
								
							
						
					
					
						commit
						eee972a1a4
					
				
					 2 changed files with 28 additions and 0 deletions
				
			
		|  | @ -3,10 +3,24 @@ | |||
| #include <QHBoxLayout> | ||||
| #include <QFrame> | ||||
| #include <QSignalMapper> | ||||
| #include <QMenu> | ||||
| #include <QContextMenuEvent> | ||||
| 
 | ||||
| #include "scenetoolbar.hpp" | ||||
| #include "modebutton.hpp" | ||||
| 
 | ||||
| void CSVWidget::SceneToolMode::contextMenuEvent (QContextMenuEvent *event) | ||||
| { | ||||
|     QMenu menu (this); | ||||
|     if (createContextMenu (&menu)) | ||||
|         menu.exec (event->globalPos()); | ||||
| } | ||||
| 
 | ||||
| bool CSVWidget::SceneToolMode::createContextMenu (QMenu *menu) | ||||
| { | ||||
|     return false; | ||||
| } | ||||
| 
 | ||||
| void CSVWidget::SceneToolMode::adjustToolTip (const ModeButton *activeMode) | ||||
| { | ||||
|     QString toolTip = mToolTip; | ||||
|  | @ -15,6 +29,9 @@ void CSVWidget::SceneToolMode::adjustToolTip (const ModeButton *activeMode) | |||
| 
 | ||||
|     toolTip += "<p>(left click to change mode)"; | ||||
| 
 | ||||
|     if (createContextMenu (0)) | ||||
|         toolTip += "<br>(right click to access context menu)"; | ||||
| 
 | ||||
|     setToolTip (toolTip); | ||||
| } | ||||
| 
 | ||||
|  |  | |||
|  | @ -6,6 +6,7 @@ | |||
| #include <map> | ||||
| 
 | ||||
| class QHBoxLayout; | ||||
| class QMenu; | ||||
| 
 | ||||
| namespace CSVWidget | ||||
| { | ||||
|  | @ -29,6 +30,16 @@ namespace CSVWidget | |||
| 
 | ||||
|             void adjustToolTip (const ModeButton *activeMode); | ||||
| 
 | ||||
|             virtual void contextMenuEvent (QContextMenuEvent *event); | ||||
| 
 | ||||
|             /// Add context menu items to \a menu. Default-implementation: return false
 | ||||
|             ///
 | ||||
|             /// \attention menu can be a 0-pointer
 | ||||
|             ///
 | ||||
|             /// \return Have there been any menu items to be added (if menu is 0 and there
 | ||||
|             /// items to be added, the function must return true anyway.
 | ||||
|             virtual bool createContextMenu (QMenu *menu); | ||||
| 
 | ||||
|         public: | ||||
| 
 | ||||
|             SceneToolMode (SceneToolbar *parent, const QString& toolTip); | ||||
|  |  | |||
		Loading…
	
		Reference in a new issue