use Plasma::Types::Location

This commit is contained in:
Marco Martin 2013-10-18 16:50:56 +02:00
parent a709c7a64b
commit 9423ad57f2
2 changed files with 8 additions and 29 deletions

View File

@ -38,27 +38,6 @@
#include <QDebug> #include <QDebug>
// just for debugging purposes, FIXME: remove later
QString locString(const Plasma::Types::Location l) {
QString o = "Unknown: " + l;
if (l == Plasma::Types::Floating) {
o = "Floating";
} else if (l == Plasma::Types::Desktop) {
o = "Desktop";
} else if (l == Plasma::Types::FullScreen) {
o = "FullScreen";
} else if (l == Plasma::Types::TopEdge) {
o = "Types::TopEdge";
} else if (l == Plasma::Types::BottomEdge) {
o = "Types::BottomEdge";
} else if (l == Plasma::Types::LeftEdge) {
o = "Types::LeftEdge";
} else if (l == Plasma::Types::RightEdge) {
o = "Types::RightEdge";
}
return o;
}
DialogProxy::DialogProxy(QQuickItem *parent) DialogProxy::DialogProxy(QQuickItem *parent)
: QQuickWindow(parent ? parent->window() : 0), : QQuickWindow(parent ? parent->window() : 0),
m_location(Plasma::Types::TopEdge), m_location(Plasma::Types::TopEdge),
@ -219,7 +198,7 @@ QPoint DialogProxy::popupPosition(QQuickItem *item, Qt::AlignmentFlag alignment)
} }
} }
Plasma::Types::Location l = (Plasma::Types::Location)location(); Plasma::Types::Location l = location();
QPoint topPoint((item->boundingRect().width() - width())/2, QPoint topPoint((item->boundingRect().width() - width())/2,
-height()); -height());
@ -311,17 +290,17 @@ void DialogProxy::setWindowFlags(const int flags)
setFlags(Qt::FramelessWindowHint|m_flags); setFlags(Qt::FramelessWindowHint|m_flags);
} }
int DialogProxy::location() const Plasma::Types::Location DialogProxy::location() const
{ {
return (Plasma::Types::Location)m_location; return m_location;
} }
void DialogProxy::setLocation(int location) void DialogProxy::setLocation(Plasma::Types::Location location)
{ {
if (m_location == location) { if (m_location == location) {
return; return;
} }
m_location = (Plasma::Types::Location)location; m_location = location;
emit locationChanged(); emit locationChanged();
} }

View File

@ -78,7 +78,7 @@ class DialogProxy : public QQuickWindow
/** /**
* Plasma Location of the dialog window. Useful if this dialog is apopup for a panel * Plasma Location of the dialog window. Useful if this dialog is apopup for a panel
*/ */
Q_PROPERTY(int location READ location WRITE setLocation NOTIFY locationChanged) Q_PROPERTY(Plasma::Types::Location location READ location WRITE setLocation NOTIFY locationChanged)
Q_CLASSINFO("DefaultProperty", "mainItem") Q_CLASSINFO("DefaultProperty", "mainItem")
@ -111,8 +111,8 @@ public:
int windowFlags() const; int windowFlags() const;
void setWindowFlags(const int); void setWindowFlags(const int);
int location() const; Plasma::Types::Location location() const;
void setLocation(int location); void setLocation(Plasma::Types::Location location);
QObject *margins() const; QObject *margins() const;