LeechCraft 0.6.70-19424-g027e980fd1
Modular cross-platform feature rich live environment.
Loading...
Searching...
No Matches
util.cpp
Go to the documentation of this file.
1/**********************************************************************
2 * LeechCraft - modular cross-platform feature rich internet client.
3 * Copyright (C) 2006-2014 Georg Rudoy
4 *
5 * Distributed under the Boost Software License, Version 1.0.
6 * (See accompanying file LICENSE or copy at https://www.boost.org/LICENSE_1_0.txt)
7 **********************************************************************/
8
9#include "util.h"
10#include <QQuickWidget>
11#include <QQmlError>
12#include <QtDebug>
13#include <util/gui/geometry.h>
14
15namespace LC::Util
16{
17 void EnableTransparency (QQuickWidget& widget)
18 {
19 widget.setAttribute (Qt::WA_TranslucentBackground);
20 widget.setClearColor (Qt::transparent);
21 }
22
23 void SetupFullscreenView (QQuickWidget& widget)
24 {
25 widget.setWindowFlags (Qt::Dialog | Qt::WindowStaysOnTopHint | Qt::FramelessWindowHint);
26
27 const auto& rect = ScreenGeometry (QCursor::pos ());
28 widget.setGeometry (rect);
29 widget.setFixedSize (rect.size ());
30
31 widget.setResizeMode (QQuickWidget::SizeRootObjectToView);
32 }
33
34 void WatchQmlErrors (QQuickWidget& view)
35 {
36 QObject::connect (&view,
37 &QQuickWidget::statusChanged,
38 &view,
39 [&view]
40 {
41 if (view.status () == QQuickWidget::Error)
42 {
43 qWarning () << Q_FUNC_INFO
44 << "view errors:";
45 for (const auto& err : view.errors ())
46 qWarning () << "\t"
47 << err.toString ();
48 }
49 });
50 }
51}
void WatchQmlErrors(QQuickWidget &view)
Logs errors from a QML view.
Definition util.cpp:34
void EnableTransparency(QQuickWidget &widget)
Definition util.cpp:17
void SetupFullscreenView(QQuickWidget &widget)
Definition util.cpp:23
QRect ScreenGeometry(const QPoint &p)
Definition geometry.cpp:71