mirror of
				https://github.com/TES3MP/openmw-tes3mp.git
				synced 2025-10-31 14:56:44 +00:00 
			
		
		
		
	reject unsuitable drops to WorldspaceWidget earlier
This commit is contained in:
		
							parent
							
								
									6b626c2954
								
							
						
					
					
						commit
						37a72d1ea6
					
				
					 1 changed files with 35 additions and 4 deletions
				
			
		|  | @ -317,12 +317,38 @@ CSMDoc::Document& CSVRender::WorldspaceWidget::getDocument() | |||
| 
 | ||||
| void CSVRender::WorldspaceWidget::dragEnterEvent (QDragEnterEvent* event) | ||||
| { | ||||
|     event->accept(); | ||||
|     const CSMWorld::TableMimeData* mime = dynamic_cast<const CSMWorld::TableMimeData*> (event->mimeData()); | ||||
|     if (!mime) // May happen when non-records (e.g. plain text) are dragged and dropped
 | ||||
|         return; | ||||
| 
 | ||||
|     if (mime->fromDocument (mDocument)) | ||||
|     { | ||||
|         if (mime->holdsType (CSMWorld::UniversalId::Type_Cell) || | ||||
|             mime->holdsType (CSMWorld::UniversalId::Type_Cell_Missing) || | ||||
|             mime->holdsType (CSMWorld::UniversalId::Type_DebugProfile)) | ||||
|         { | ||||
|             // These drops are handled through the subview object.
 | ||||
|             event->accept(); | ||||
|         } | ||||
|     } | ||||
| } | ||||
| 
 | ||||
| void CSVRender::WorldspaceWidget::dragMoveEvent(QDragMoveEvent *event) | ||||
| { | ||||
|     event->accept(); | ||||
|     const CSMWorld::TableMimeData* mime = dynamic_cast<const CSMWorld::TableMimeData*> (event->mimeData()); | ||||
|     if (!mime) // May happen when non-records (e.g. plain text) are dragged and dropped
 | ||||
|         return; | ||||
| 
 | ||||
|     if (mime->fromDocument (mDocument)) | ||||
|     { | ||||
|         if (mime->holdsType (CSMWorld::UniversalId::Type_Cell) || | ||||
|             mime->holdsType (CSMWorld::UniversalId::Type_Cell_Missing) || | ||||
|             mime->holdsType (CSMWorld::UniversalId::Type_DebugProfile)) | ||||
|         { | ||||
|             // These drops are handled through the subview object.
 | ||||
|             event->accept(); | ||||
|         } | ||||
|     } | ||||
| } | ||||
| 
 | ||||
| 
 | ||||
|  | @ -428,8 +454,13 @@ void CSVRender::WorldspaceWidget::dropEvent (QDropEvent* event) | |||
| 
 | ||||
|     if (mime->fromDocument (mDocument)) | ||||
|     { | ||||
|         emit dataDropped(mime->getData()); | ||||
|     } //not handling drops from different documents at the moment
 | ||||
|         if (mime->holdsType (CSMWorld::UniversalId::Type_Cell) || | ||||
|             mime->holdsType (CSMWorld::UniversalId::Type_Cell_Missing) || | ||||
|             mime->holdsType (CSMWorld::UniversalId::Type_DebugProfile)) | ||||
|         { | ||||
|             emit dataDropped(mime->getData()); | ||||
|         } | ||||
|     } | ||||
| } | ||||
| 
 | ||||
| void CSVRender::WorldspaceWidget::runRequest (const std::string& profile) | ||||
|  |  | |||
		Loading…
	
		Reference in a new issue