forked from quickshell/quickshell
		
	fix: allow reloadable objects inside of proxy windows
This commit is contained in:
		
							parent
							
								
									d967d56d3b
								
							
						
					
					
						commit
						5e58f0ba9f
					
				
					 1 changed files with 10 additions and 1 deletions
				
			
		| 
						 | 
				
			
			@ -10,6 +10,7 @@
 | 
			
		|||
#include <qwindow.h>
 | 
			
		||||
 | 
			
		||||
#include "region.hpp"
 | 
			
		||||
#include "reload.hpp"
 | 
			
		||||
 | 
			
		||||
ProxyWindowBase::~ProxyWindowBase() {
 | 
			
		||||
	if (this->window != nullptr) {
 | 
			
		||||
| 
						 | 
				
			
			@ -28,10 +29,18 @@ void ProxyWindowBase::onReload(QObject* oldInstance) {
 | 
			
		|||
 | 
			
		||||
	this->setupWindow();
 | 
			
		||||
 | 
			
		||||
	for (auto* child: this->pendingChildren) {
 | 
			
		||||
		Reloadable::reloadRecursive(child, oldInstance);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	auto backer = this->dataBacker();
 | 
			
		||||
	for (auto* child: this->pendingChildren) {
 | 
			
		||||
		// Reparent QQuickItems to the content element,
 | 
			
		||||
		// while leaving QObjects parented to the proxy window.
 | 
			
		||||
		if (qobject_cast<QQuickItem*>(child) != nullptr) {
 | 
			
		||||
			backer.append(&backer, child);
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	this->pendingChildren.clear();
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue