attempt to make the panel work

FIXME: setting transparency doesn't seem to work.
it works correctly only if done in the View constructor, not the PanelView one
This commit is contained in:
Marco Martin 2013-02-14 15:46:01 +01:00
parent d105b1bd3f
commit 613f373118
5 changed files with 20 additions and 7 deletions

View File

@ -186,6 +186,7 @@ void DesktopCorona::checkViews()
} else if (m_views.count() < m_desktopWidget->screenCount()) {
for (int i = m_views.count(); i < m_desktopWidget->screenCount(); ++i) {
View *view = new View(this);
view->init();
view->show();
m_views << view;
@ -213,6 +214,8 @@ void DesktopCorona::updateScreenOwner(int wasScreen, int isScreen, Plasma::Conta
if (isScreen >= 0) {
m_panelViews[containment] = new PanelView(this);
m_panelViews[containment]->init();
m_panelViews[containment]->setContainment(containment);
m_panelViews[containment]->show();
} else {
if (m_panelViews.contains(containment)) {

View File

@ -23,9 +23,13 @@
PanelView::PanelView(Plasma::Corona *corona, QWindow *parent)
: View(corona, parent)
{
//FIXME: this works only if done in View
QSurfaceFormat format;
format.setAlphaBufferSize(8);
setFormat(format);
setClearBeforeRendering(true);
setColor(QColor(Qt::transparent));
setFlags(Qt::FramelessWindowHint);
}
PanelView::~PanelView()

View File

@ -25,6 +25,7 @@ import org.kde.plasma.core 0.1 as PlasmaCore
Rectangle {
id: root
color: "red"
radius: 10
width: 640
height: 480

View File

@ -28,12 +28,6 @@ View::View(Plasma::Corona *corona, QWindow *parent)
: QQuickView(parent),
m_corona(corona)
{
if (!m_corona->package().isValid()) {
qWarning() << "Invalid home screen package";
}
setResizeMode(View::SizeRootObjectToView);
setSource(QUrl::fromLocalFile(m_corona->package().filePath("mainscript")));
}
View::~View()
@ -41,7 +35,15 @@ View::~View()
}
void View::init()
{
if (!m_corona->package().isValid()) {
qWarning() << "Invalid home screen package";
}
setResizeMode(View::SizeRootObjectToView);
setSource(QUrl::fromLocalFile(m_corona->package().filePath("mainscript")));
}
void View::setContainment(Plasma::Containment *cont)
{

View File

@ -34,6 +34,9 @@ public:
View(Plasma::Corona *corona, QWindow *parent = 0);
virtual ~View();
//FIXME: not super nice, but we have to be sure qml assignment is done after window flags
void init();
void setContainment(Plasma::Containment *cont);
Plasma::Containment *containment() const;