forked from quickshell/quickshell
		
	core/reloader: wrap QQuickItem root nodes in a floating window
Useful for testing
This commit is contained in:
		
							parent
							
								
									c21df95087
								
							
						
					
					
						commit
						57a5d8e1ed
					
				
					 2 changed files with 12 additions and 1 deletions
				
			
		| 
						 | 
					@ -8,9 +8,11 @@
 | 
				
			||||||
#include <qobject.h>
 | 
					#include <qobject.h>
 | 
				
			||||||
#include <qqmlcomponent.h>
 | 
					#include <qqmlcomponent.h>
 | 
				
			||||||
#include <qqmlengine.h>
 | 
					#include <qqmlengine.h>
 | 
				
			||||||
 | 
					#include <qquickitem.h>
 | 
				
			||||||
#include <qtmetamacros.h>
 | 
					#include <qtmetamacros.h>
 | 
				
			||||||
#include <qurl.h>
 | 
					#include <qurl.h>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#include "../window/floatingwindow.hpp"
 | 
				
			||||||
#include "generation.hpp"
 | 
					#include "generation.hpp"
 | 
				
			||||||
#include "qmlglobal.hpp"
 | 
					#include "qmlglobal.hpp"
 | 
				
			||||||
#include "scan.hpp"
 | 
					#include "scan.hpp"
 | 
				
			||||||
| 
						 | 
					@ -73,6 +75,15 @@ void RootWrapper::reloadGraph(bool hard) {
 | 
				
			||||||
		return;
 | 
							return;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						if (auto* item = qobject_cast<QQuickItem*>(newRoot)) {
 | 
				
			||||||
 | 
							auto* window = new FloatingWindowInterface();
 | 
				
			||||||
 | 
							item->setParent(window);
 | 
				
			||||||
 | 
							item->setParentItem(window->contentItem());
 | 
				
			||||||
 | 
							window->setWidth(static_cast<int>(item->width()));
 | 
				
			||||||
 | 
							window->setHeight(static_cast<int>(item->height()));
 | 
				
			||||||
 | 
							newRoot = window;
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	generation->root = newRoot;
 | 
						generation->root = newRoot;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	component.completeCreate();
 | 
						component.completeCreate();
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -8,7 +8,7 @@
 | 
				
			||||||
#include "qmlglobal.hpp"
 | 
					#include "qmlglobal.hpp"
 | 
				
			||||||
#include "reload.hpp"
 | 
					#include "reload.hpp"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
///! Root config element
 | 
					///! Optional root config element, allowing some settings to be specified inline.
 | 
				
			||||||
class ShellRoot: public ReloadPropagator {
 | 
					class ShellRoot: public ReloadPropagator {
 | 
				
			||||||
	Q_OBJECT;
 | 
						Q_OBJECT;
 | 
				
			||||||
	Q_PROPERTY(QuickshellSettings* settings READ settings CONSTANT);
 | 
						Q_PROPERTY(QuickshellSettings* settings READ settings CONSTANT);
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue