Skip to content

Commit 57a5d8e

Browse files
committed
core/reloader: wrap QQuickItem root nodes in a floating window
Useful for testing
1 parent c21df95 commit 57a5d8e

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

src/core/rootwrapper.cpp

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,11 @@
88
#include <qobject.h>
99
#include <qqmlcomponent.h>
1010
#include <qqmlengine.h>
11+
#include <qquickitem.h>
1112
#include <qtmetamacros.h>
1213
#include <qurl.h>
1314

15+
#include "../window/floatingwindow.hpp"
1416
#include "generation.hpp"
1517
#include "qmlglobal.hpp"
1618
#include "scan.hpp"
@@ -73,6 +75,15 @@ void RootWrapper::reloadGraph(bool hard) {
7375
return;
7476
}
7577

78+
if (auto* item = qobject_cast<QQuickItem*>(newRoot)) {
79+
auto* window = new FloatingWindowInterface();
80+
item->setParent(window);
81+
item->setParentItem(window->contentItem());
82+
window->setWidth(static_cast<int>(item->width()));
83+
window->setHeight(static_cast<int>(item->height()));
84+
newRoot = window;
85+
}
86+
7687
generation->root = newRoot;
7788

7889
component.completeCreate();

src/core/shell.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
#include "qmlglobal.hpp"
99
#include "reload.hpp"
1010

11-
///! Root config element
11+
///! Optional root config element, allowing some settings to be specified inline.
1212
class ShellRoot: public ReloadPropagator {
1313
Q_OBJECT;
1414
Q_PROPERTY(QuickshellSettings* settings READ settings CONSTANT);

0 commit comments

Comments
 (0)