forked from quickshell/quickshell
refactor: move reload function to QtShellGlobal
This commit is contained in:
parent
7a18ce8a55
commit
767500b466
4 changed files with 17 additions and 21 deletions
|
@ -3,12 +3,16 @@
|
|||
#include <qcontainerfwd.h>
|
||||
#include <qcoreapplication.h>
|
||||
#include <qguiapplication.h>
|
||||
#include <qlogging.h>
|
||||
#include <qobject.h>
|
||||
#include <qqmlcontext.h>
|
||||
#include <qqmlengine.h>
|
||||
#include <qqmllist.h>
|
||||
#include <qtmetamacros.h>
|
||||
#include <qtypes.h>
|
||||
|
||||
#include "qmlscreen.hpp"
|
||||
#include "rootwrapper.hpp"
|
||||
|
||||
QtShellGlobal::QtShellGlobal(QObject* parent): QObject(parent) {
|
||||
auto* app = QCoreApplication::instance();
|
||||
|
@ -42,6 +46,18 @@ QQmlListProperty<QtShellScreenInfo> QtShellGlobal::screens() {
|
|||
);
|
||||
}
|
||||
|
||||
void QtShellGlobal::reload(bool hard) {
|
||||
auto* rootobj = QQmlEngine::contextForObject(this)->engine()->parent();
|
||||
auto* root = qobject_cast<RootWrapper*>(rootobj);
|
||||
|
||||
if (root == nullptr) {
|
||||
qWarning() << "cannot find RootWrapper for reload, ignoring request";
|
||||
return;
|
||||
}
|
||||
|
||||
root->reloadGraph(hard);
|
||||
}
|
||||
|
||||
void QtShellGlobal::updateScreens() {
|
||||
auto screens = QGuiApplication::screens();
|
||||
this->mScreens.resize(screens.size());
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue