make sure a transparent window

This commit is contained in:
Marco Martin 2013-02-20 15:18:58 +01:00
parent 603c6e4a9b
commit 1928ecce74
3 changed files with 31 additions and 8 deletions

View File

@ -99,12 +99,17 @@ DialogProxy::DialogProxy(QQuickItem *parent)
m_activeWindow(false),
m_location(Plasma::Floating)
{
QSurfaceFormat format;
format.setAlphaBufferSize(8);
setFormat(format);
setClearBeforeRendering(true);
setColor(QColor(Qt::transparent));
setFlags(Qt::FramelessWindowHint);
//m_dialog = new QQuickWindow();
m_margins = new DialogMargins(m_dialog, this);
//m_dialog->installEventFilter(this);
m_flags = flags();
setWindowFlags(Qt::FramelessWindowHint);
setColor(Qt::transparent);
}
DialogProxy::~DialogProxy()
@ -412,6 +417,18 @@ QObject *DialogProxy::margins() const
return m_margins;
}
void DialogProxy::resizeEvent(QResizeEvent *re)
{
if (contentItem()) {
contentItem()->setWidth(re->size().width());
contentItem()->setHeight(re->size().height());
}
if (m_mainItem) {
m_mainItem.data()->setWidth(re->size().width());
m_mainItem.data()->setHeight(re->size().height());
}
}
bool DialogProxy::eventFilter(QObject *watched, QEvent *event)
{
if (watched == this && event->type() == QEvent::Move) {

View File

@ -230,6 +230,7 @@ protected Q_SLOTS:
protected:
bool eventFilter(QObject *watched, QEvent *event);
void resizeEvent(QResizeEvent *re);
private:
QQuickWindow *m_dialog;

View File

@ -36,20 +36,25 @@ Item {
}
Window {
PlasmaCore.Dialog {
id: popupWindow
//windowFlags: Qt.Popup
color: Qt.rgba(0,0,0,0)
visible: plasmoid.expanded
onVisibleChanged: {
if (!visible) {
plasmoid.expanded = false
}
}
width: 200
height: 200
Item {
onWidthChanged: appletParent.width = width
onHeightChanged:appletParent.height = height
mainItem: appletParent
Rectangle {
id: appletParent
width: applet.implicitWidth
height: applet.implicitHeight
width: 200//applet.implicitWidth
height: 200//applet.implicitHeight
onWidthChanged: applet.width = width
onHeightChanged: applet.height = height
}
}
}