mirror of
				https://github.com/RGBCube/serenity
				synced 2025-10-31 11:22:45 +00:00 
			
		
		
		
	Ladybird: Accept file drops
This commit is contained in:
		
							parent
							
								
									731fec525e
								
							
						
					
					
						commit
						f3c6510b83
					
				
					 3 changed files with 26 additions and 0 deletions
				
			
		|  | @ -45,6 +45,7 @@ | |||
| #include <QInputDialog> | ||||
| #include <QLineEdit> | ||||
| #include <QMessageBox> | ||||
| #include <QMimeData> | ||||
| #include <QMouseEvent> | ||||
| #include <QPaintEvent> | ||||
| #include <QPainter> | ||||
|  | @ -58,6 +59,7 @@ WebContentView::WebContentView(StringView webdriver_content_ipc_path) | |||
|     : m_webdriver_content_ipc_path(webdriver_content_ipc_path) | ||||
| { | ||||
|     setMouseTracking(true); | ||||
|     setAcceptDrops(true); | ||||
| 
 | ||||
|     setFocusPolicy(Qt::FocusPolicy::StrongFocus); | ||||
| 
 | ||||
|  | @ -312,6 +314,19 @@ void WebContentView::mouseReleaseEvent(QMouseEvent* event) | |||
|     client().async_mouse_up(to_content(position), button, buttons, modifiers); | ||||
| } | ||||
| 
 | ||||
| void WebContentView::dragEnterEvent(QDragEnterEvent* event) | ||||
| { | ||||
|     if (event->mimeData()->hasUrls()) | ||||
|         event->acceptProposedAction(); | ||||
| } | ||||
| 
 | ||||
| void WebContentView::dropEvent(QDropEvent* event) | ||||
| { | ||||
|     VERIFY(event->mimeData()->hasUrls()); | ||||
|     emit urls_dropped(event->mimeData()->urls()); | ||||
|     event->acceptProposedAction(); | ||||
| } | ||||
| 
 | ||||
| void WebContentView::keyPressEvent(QKeyEvent* event) | ||||
| { | ||||
|     switch (event->key()) { | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Karol Kosek
						Karol Kosek