forked from quickshell/quickshell
		
	cleanup(plugin): remove dependency on unstable moc functions
This commit is contained in:
		
							parent
							
								
									3bd587cfcc
								
							
						
					
					
						commit
						c0faebc700
					
				
					 2 changed files with 11 additions and 9 deletions
				
			
		| 
						 | 
					@ -3,9 +3,6 @@
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include <qvector.h> // NOLINT (what??)
 | 
					#include <qvector.h> // NOLINT (what??)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// defined by moc. see below comment.
 | 
					 | 
				
			||||||
void qml_register_types_QuickShell(); // NOLINT
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
static QVector<QuickshellPlugin*> plugins; // NOLINT
 | 
					static QVector<QuickshellPlugin*> plugins; // NOLINT
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void QuickshellPlugin::registerPlugin(QuickshellPlugin& plugin) { plugins.push_back(&plugin); }
 | 
					void QuickshellPlugin::registerPlugin(QuickshellPlugin& plugin) { plugins.push_back(&plugin); }
 | 
				
			||||||
| 
						 | 
					@ -24,11 +21,6 @@ void QuickshellPlugin::initPlugins() {
 | 
				
			||||||
		plugin->init();
 | 
							plugin->init();
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	// This seems incredibly stupid but it appears qt will not register the module types
 | 
					 | 
				
			||||||
	// if types are already defined for the module, meaning qmlRegisterType does not work
 | 
					 | 
				
			||||||
	// unless the module types are already registered.
 | 
					 | 
				
			||||||
	qml_register_types_QuickShell();
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	for (QuickshellPlugin* plugin: plugins) {
 | 
						for (QuickshellPlugin* plugin: plugins) {
 | 
				
			||||||
		plugin->registerTypes();
 | 
							plugin->registerTypes();
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -10,7 +10,17 @@ class WaylandPlugin: public QuickshellPlugin {
 | 
				
			||||||
	bool applies() override { return QGuiApplication::platformName() == "wayland"; }
 | 
						bool applies() override { return QGuiApplication::platformName() == "wayland"; }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	void registerTypes() override {
 | 
						void registerTypes() override {
 | 
				
			||||||
		qmlRegisterType<WaylandPanelInterface>("QuickShell", 1, 0, "PanelWindow");
 | 
							qmlRegisterType<WaylandPanelInterface>("QuickShell._WaylandOverlay", 1, 0, "PanelWindow");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							// If any types are defined inside a module using QML_ELEMENT then all QML_ELEMENT types
 | 
				
			||||||
 | 
							// will not be registered. This can be worked around with a module import which makes
 | 
				
			||||||
 | 
							// the QML_ELMENT module import the old register-type style module.
 | 
				
			||||||
 | 
							qmlRegisterModuleImport(
 | 
				
			||||||
 | 
							    "QuickShell",
 | 
				
			||||||
 | 
							    QQmlModuleImportModuleAny,
 | 
				
			||||||
 | 
							    "QuickShell._WaylandOverlay",
 | 
				
			||||||
 | 
							    QQmlModuleImportLatest
 | 
				
			||||||
 | 
							);
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue