1
0
mirror of https://gitlab.com/kelteseth/ScreenPlay.git synced 2024-09-18 16:32:33 +02:00

Add wallpaper qml creation

This commit is contained in:
kelteseth 2017-07-06 18:06:28 +02:00
parent b4fc3ad5d7
commit 28f6d820a2
3 changed files with 11 additions and 2 deletions

View File

@ -96,7 +96,7 @@ void ProfileListModel::loadProfiles()
m_profileList.append(tmpProfile);
}
qDebug() << m_profileList.size();
}
bool ProfileListModel::getProfileByName(QString id, Profile* profile)

View File

@ -20,7 +20,7 @@ Wallpaper::Wallpaper(QWindow* parent)
Wallpaper::Wallpaper(Profile profile)
{
qDebug() << "Creating Wallpaper" << profile.m_rect;
m_profile = profile;
this->setX(m_profile.m_rect.x());
this->setY(m_profile.m_rect.y());
@ -28,6 +28,11 @@ Wallpaper::Wallpaper(Profile profile)
this->setHeight(m_profile.m_rect.height());
this->m_hwnd = (HWND)this->winId();
this->m_quickRenderer = new QQuickView(this);
m_quickRenderer->setWidth(m_profile.m_rect.width());
m_quickRenderer->setHeight(m_profile.m_rect.height());
m_context = m_quickRenderer->rootContext();
HWND progman_hwnd = FindWindowW(L"Progman", L"Program Manager");
// Spawn new worker window below desktop (using some undocumented Win32 magic)
@ -49,6 +54,8 @@ Wallpaper::Wallpaper(Profile profile)
Qt::WindowFlags flags = this->flags();
this->setFlags(flags | Qt::FramelessWindowHint | Qt::WindowStaysOnBottomHint);
m_quickRenderer->setSource(QUrl("qrc:/qml/Components/Screens/ScreenVideo.qml"));
m_quickRenderer->show();
this->show();
ShowWindow(m_hwnd, SW_SHOWDEFAULT);
}

View File

@ -7,6 +7,7 @@
#include <QRect>
#include <QWindow>
#include <qt_windows.h>
#include <QUrl>
#include "profile.h"
@ -15,6 +16,7 @@ class Wallpaper : public QWindow {
public:
explicit Wallpaper(QWindow* parent = 0);
Wallpaper(Profile profile);
~Wallpaper();
QQmlContext* context() const;