parent popups to the view, change the parenting when the parent changes

svn path=/trunk/KDE/kdebase/workspace/libs/plasma/; revision=857619
This commit is contained in:
Aaron J. Seigo 2008-09-05 20:44:43 +00:00
parent fa32b0f2b6
commit 9907d96b11
2 changed files with 11 additions and 1 deletions

View File

@ -206,7 +206,7 @@ void PopupApplet::constraintsEvent(Plasma::Constraints constraints)
}
if (!d->dialog) {
d->dialog = new Plasma::Dialog();
d->dialog = new Plasma::Dialog(view());
//no longer use Qt::Popup since that seems to cause a lot of problem when you drag
//stuff out of your Dialog (extenders). Monitor WindowDeactivate events so we can
@ -263,6 +263,15 @@ bool PopupApplet::eventFilter(QObject *watched, QEvent *event)
return Applet::eventFilter(watched, event);
}
QVariant PopupApplet::itemChange(GraphicsItemChange change, const QVariant &value)
{
if (change == QGraphicsItem::ItemParentHasChanged && d->dialog) {
d->dialog->setParent(view());
}
return Applet::itemChange(change, value);
}
void PopupApplet::showPopup(uint popupDuration)
{
if (d->dialog && (formFactor() == Horizontal || formFactor() == Vertical)) {

View File

@ -103,6 +103,7 @@ public Q_SLOTS:
protected:
void constraintsEvent(Plasma::Constraints constraints);
bool eventFilter(QObject *watched, QEvent *event);
QVariant itemChange(GraphicsItemChange change, const QVariant &value);
private:
Q_PRIVATE_SLOT(d, void togglePopup())