-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtimewindow.cpp
More file actions
35 lines (28 loc) · 999 Bytes
/
Copy pathtimewindow.cpp
File metadata and controls
35 lines (28 loc) · 999 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#include "timewindow.h"
#include <QRegion>
#include <QQmlContext>
#include <QQmlEngine>
#include <QStyle>
#include <QApplication>
#include <QDesktopWidget>
#include <QScreen>
TimeWindow::TimeWindow(QWidget *parent)
: QQuickWidget(parent)
{
// set the window to be transparent and not accecpt click events
setWindowFlags(Qt::FramelessWindowHint | Qt::WindowTransparentForInput | Qt::WindowStaysOnTopHint);
setAttribute(Qt::WA_TranslucentBackground);
setClearColor(Qt::transparent);
// set the scale factor for level-2 dpi-awareness
engine()->rootContext()->setContextProperty("scaleFactor", qApp->screens()[0]->logicalDotsPerInch() / 96.0);
setSource(QUrl("qrc:/main.qml"));
// move the window to the top-left area of the screen
setGeometry(QStyle::alignedRect(
Qt::RightToLeft,
Qt::AlignTop,
size(),
qApp->desktop()->availableGeometry()));
}
TimeWindow::~TimeWindow()
{
}