showPopup() -> popupPosition()

makes possible to move the popup
This commit is contained in:
Marco Martin 2011-03-21 19:18:28 +01:00
parent b958bf1480
commit 19ad72af78
2 changed files with 7 additions and 10 deletions

View File

@ -164,18 +164,14 @@ void DialogProxy::setVisible(const bool visible)
} }
} }
void DialogProxy::showPopup(QGraphicsObject *item) QPoint DialogProxy::popupPosition(QGraphicsObject *item) const
{ {
if (m_dialog->isVisible()) { Plasma::Corona *corona = qobject_cast<Plasma::Corona *>(item->scene());
m_dialog->hide(); if (corona) {
return corona->popupPosition(item, m_dialog->size());
} else { } else {
Plasma::Corona *corona = qobject_cast<Plasma::Corona *>(item->scene()); return QPoint();
if (corona) {
m_dialog->move(corona->popupPosition(item, m_dialog->size()));
}
m_dialog->show();
} }
emit visibleChanged();
} }

View File

@ -21,6 +21,7 @@
#include <QObject> #include <QObject>
#include <QWeakPointer> #include <QWeakPointer>
#include <QPoint>
class QGraphicsObject; class QGraphicsObject;
@ -60,7 +61,7 @@ public:
int y() const; int y() const;
void setY(int y); void setY(int y);
Q_INVOKABLE void showPopup(QGraphicsObject *item); Q_INVOKABLE QPoint popupPosition(QGraphicsObject *item) const;
//FIXME:: Qt::WidgetAttribute should be already //FIXME:: Qt::WidgetAttribute should be already
Q_INVOKABLE void setAttribute(int attribute, bool on); Q_INVOKABLE void setAttribute(int attribute, bool on);