revert int -> Qt::AlignmentFlag for location

This commit is contained in:
Sebastian Kügler 2013-02-25 17:49:49 +01:00
parent e00f0b10bb
commit e2a2a9f6d2
2 changed files with 12 additions and 11 deletions

View File

@ -42,7 +42,7 @@
DialogProxy::DialogProxy(QQuickItem *parent) DialogProxy::DialogProxy(QQuickItem *parent)
: QQuickWindow(), : QQuickWindow(),
m_activeWindow(false), m_activeWindow(false),
m_location(Qt::AlignCenter) m_location(Plasma::TopEdge)
{ {
QSurfaceFormat format; QSurfaceFormat format;
format.setAlphaBufferSize(8); format.setAlphaBufferSize(8);
@ -215,6 +215,7 @@ QPoint DialogProxy::popupPosition(QQuickItem *item, Qt::AlignmentFlag alignment)
int _x = 0; int _x = 0;
int _y = 0; int _y = 0;
/*
if (location() == Qt::AlignBottom) { if (location() == Qt::AlignBottom) {
_y = item->y() + item->height(); _y = item->y() + item->height();
} else if (location() == Qt::AlignTop) { } else if (location() == Qt::AlignTop) {
@ -233,7 +234,7 @@ QPoint DialogProxy::popupPosition(QQuickItem *item, Qt::AlignmentFlag alignment)
qDebug() << "Neither left nor right. I'm confused."; qDebug() << "Neither left nor right. I'm confused.";
} }
} }
*/
// Correct position for screen geometry // Correct position for screen geometry
if (alignment == Qt::AlignCenter) { if (alignment == Qt::AlignCenter) {
@ -286,17 +287,17 @@ void DialogProxy::setWindowFlags(const int flags)
setFlags(Qt::FramelessWindowHint|m_flags); setFlags(Qt::FramelessWindowHint|m_flags);
} }
Qt::AlignmentFlag DialogProxy::location() const int DialogProxy::location() const
{ {
return (Qt::AlignmentFlag)m_location; return (Plasma::Location)m_location;
} }
void DialogProxy::setLocation(Qt::AlignmentFlag location) void DialogProxy::setLocation(int location)
{ {
if (m_location == location) { if (m_location == location) {
return; return;
} }
m_location = (Qt::AlignmentFlag)location; m_location = (Plasma::Location)location;
emit locationChanged(); emit locationChanged();
} }
@ -412,5 +413,5 @@ void DialogProxy::focusOutEvent(QFocusEvent *ev)
emit activeWindowChanged(); emit activeWindowChanged();
} }
#include "moc_dialog.cpp" #include "dialog.moc"

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(Qt::AlignmentFlag location READ location WRITE setLocation NOTIFY locationChanged) Q_PROPERTY(int location READ location WRITE setLocation NOTIFY locationChanged)
//This won't be available on windows, but should be used only by kwin and never by applets anyways //This won't be available on windows, but should be used only by kwin and never by applets anyways
#ifndef Q_WS_WIN #ifndef Q_WS_WIN
/** /**
@ -118,8 +118,8 @@ public:
int windowFlags() const; int windowFlags() const;
void setWindowFlags(const int); void setWindowFlags(const int);
Qt::AlignmentFlag location() const; int location() const;
void setLocation(Qt::AlignmentFlag location); void setLocation(int location);
QObject *margins() const; QObject *margins() const;
@ -167,7 +167,7 @@ private:
QWeakPointer<QQuickItem> m_mainItem; QWeakPointer<QQuickItem> m_mainItem;
QWeakPointer<QQuickItem> m_visualParent; QWeakPointer<QQuickItem> m_visualParent;
bool m_activeWindow; bool m_activeWindow;
Qt::AlignmentFlag m_location; Plasma::Location m_location;
Plasma::FrameSvgItem *m_frameSvgItem; Plasma::FrameSvgItem *m_frameSvgItem;
}; };