diff --git a/components/mobileshell/shellutil.cpp b/components/mobileshell/shellutil.cpp index a50a9067..8bbc1837 100644 --- a/components/mobileshell/shellutil.cpp +++ b/components/mobileshell/shellutil.cpp @@ -95,26 +95,37 @@ void ShellUtil::launchApp(const QString &storageId) job->start(); } -void ShellUtil::setInputTransparent(QQuickWindow *window, bool transparent) { - if (window) { - Qt::WindowFlags flags = window->flags(); - if (transparent) { - flags |= Qt::WindowTransparentForInput; - } else { - flags &= ~Qt::WindowTransparentForInput; - } - window->setFlags(flags); +void ShellUtil::setInputTransparent(QQuickWindow *window, bool transparent) +{ + if (!window) { + return; } + + Qt::WindowFlags flags = window->flags(); + if (transparent) { + flags |= Qt::WindowTransparentForInput; + } else { + flags &= ~Qt::WindowTransparentForInput; + } + window->setFlags(flags); } -void ShellUtil::setWindowLayer(QQuickWindow *window, LayerShellQt::Window::Layer layer) { - if (window) { - auto layerShellWindow = LayerShellQt::Window::get(window); - layerShellWindow->setLayer(layer); +void ShellUtil::setWindowLayer(QQuickWindow *window, LayerShellQt::Window::Layer layer) +{ + if (!window) { + return; } + + auto layerShellWindow = LayerShellQt::Window::get(window); + layerShellWindow->setLayer(layer); } -void ShellUtil::setInputRegion(QWindow *window, const QRect ®ion) { +void ShellUtil::setInputRegion(QWindow *window, const QRect ®ion) +{ + if (!window) { + return; + } + auto waylandWindow = dynamic_cast(window->handle()); if (!waylandWindow) { qWarning() << "Failed to retrieve Wayland window handle."; @@ -152,6 +163,7 @@ void ShellUtil::setInputRegion(QWindow *window, const QRect ®ion) { wl_surface_commit(surface); } -QString ShellUtil::toPlainText(QString htmlString) { +QString ShellUtil::toPlainText(QString htmlString) +{ return QTextDocumentFragment::fromHtml(htmlString).toPlainText(); }