TabBox: Add SwitcherItem to declarative API 3.0

Not sure if this was left out on purpose as a kind of deprecation.

It would be necessary to allow port the tabbox switchers to the newer 3.0 API and use their components (such as `Workspace`)

Probably for `Plasma/5.25` now.
This commit is contained in:
Ismael Asensio 2022-01-04 20:07:45 +00:00
parent 457e9faaa1
commit 088e870d54
2 changed files with 3 additions and 0 deletions

View file

@ -33,6 +33,8 @@ LayoutPreview::LayoutPreview(const QString &path, bool showDesktopThumbnail, QOb
QQmlComponent *component = new QQmlComponent(engine, this);
qmlRegisterType<WindowThumbnailItem>("org.kde.kwin", 2, 0, "ThumbnailItem");
qmlRegisterType<SwitcherItem>("org.kde.kwin", 2, 0, "Switcher");
qmlRegisterType<WindowThumbnailItem>("org.kde.kwin", 3, 0, "WindowThumbnailItem");
qmlRegisterType<SwitcherItem>("org.kde.kwin", 3, 0, "TabBoxSwitcher");
qmlRegisterType<QAbstractItemModel>();
component->loadUrl(QUrl::fromLocalFile(path));
if (component->isError()) {

View file

@ -291,6 +291,7 @@ void TabBoxHandlerPrivate::show()
#ifndef KWIN_UNIT_TEST
if (m_qmlContext.isNull()) {
qmlRegisterType<SwitcherItem>("org.kde.kwin", 2, 0, "Switcher");
qmlRegisterType<SwitcherItem>("org.kde.kwin", 3, 0, "TabBoxSwitcher");
m_qmlContext.reset(new QQmlContext(Scripting::self()->qmlEngine()));
}
if (m_qmlComponent.isNull()) {