window: generate qmltypes

This commit is contained in:
outfoxxed 2024-10-31 01:28:06 -07:00
parent 4e48c6eefb
commit 9980f8587e
Signed by untrusted user: outfoxxed
GPG key ID: 4C88A185FB89301E
9 changed files with 51 additions and 8 deletions

View file

@ -11,12 +11,17 @@ qt_add_qml_module(quickshell-window
VERSION 0.1
)
add_library(quickshell-window-init OBJECT init.cpp)
target_link_libraries(quickshell-window PRIVATE ${QT_DEPS} Qt6::QuickPrivate)
target_link_libraries(quickshell-windowplugin PRIVATE ${QT_DEPS})
target_link_libraries(quickshell-window-init PRIVATE ${QT_DEPS})
qs_pch(quickshell-window)
qs_pch(quickshell-windowplugin)
qs_pch(quickshell-window-init)
target_link_libraries(quickshell PRIVATE quickshell-windowplugin)
target_link_libraries(quickshell PRIVATE quickshell-windowplugin quickshell-window-init)
if (BUILD_TESTING)
add_subdirectory(test)

22
src/window/init.cpp Normal file
View file

@ -0,0 +1,22 @@
#include "../core/plugin.hpp"
namespace {
class WindowPlugin: public QuickshellPlugin {
// _Window has to be registered before wayland or x11 modules, otherwise module overlays
// will apply in the wrong order.
QString name() override { return "window"; }
void registerTypes() override {
qmlRegisterModuleImport(
"Quickshell",
QQmlModuleImportModuleAny,
"Quickshell._Window",
QQmlModuleImportLatest
);
}
};
QS_REGISTER_PLUGIN(WindowPlugin);
} // namespace

View file

@ -128,7 +128,9 @@ class PanelWindowInterface: public WindowInterface {
/// Note: On Wayland this property corrosponds to @@Quickshell.Wayland.WlrLayershell.keyboardFocus.
Q_PROPERTY(bool focusable READ focusable WRITE setFocusable NOTIFY focusableChanged);
// clang-format on
QSDOC_NAMED_ELEMENT(PanelWindow);
QML_NAMED_ELEMENT(PanelWindow);
QML_UNCREATABLE("No PanelWindow backend loaded.");
QSDOC_CREATABLE;
public:
explicit PanelWindowInterface(QObject* parent = nullptr): WindowInterface(parent) {}