diff options
author | Johan Klokkhammer Helsing <johan.helsing@qt.io> | 2016-06-06 12:41:11 +0200 |
---|---|---|
committer | Johan Helsing <johan.helsing@qt.io> | 2016-06-07 08:51:30 +0000 |
commit | ba26e9b329641c8dc9b9396bcc0ba152f2bb9ea0 (patch) | |
tree | c2f21853099e12a472d048ca822f8616517f43ae /src/compositor/extensions/qwaylandxdgshell.cpp | |
parent | 497ff96106197a19dba85930b03e3084c0dbd0e7 (diff) |
Add position property to QWaylandXdgPopup
Change-Id: I29c48ae9c44fc5601200a6bb6f6a7dbd9c8baba3
Reviewed-by: Paul Olav Tvete <paul.tvete@theqtcompany.com>
Diffstat (limited to 'src/compositor/extensions/qwaylandxdgshell.cpp')
-rw-r--r-- | src/compositor/extensions/qwaylandxdgshell.cpp | 33 |
1 files changed, 28 insertions, 5 deletions
diff --git a/src/compositor/extensions/qwaylandxdgshell.cpp b/src/compositor/extensions/qwaylandxdgshell.cpp index ad3a1fc90..6e3185bde 100644 --- a/src/compositor/extensions/qwaylandxdgshell.cpp +++ b/src/compositor/extensions/qwaylandxdgshell.cpp @@ -199,7 +199,7 @@ void QWaylandXdgShellPrivate::xdg_shell_get_xdg_popup(Resource *resource, uint32 if (!xdgPopup) { // A QWaylandXdgPopup was not created in response to the createXdgPopup signal, so we // create one as fallback here instead. - xdgPopup = new QWaylandXdgPopup(q, surface, parentSurface, xdgPopupResource); + xdgPopup = new QWaylandXdgPopup(q, surface, parentSurface, position, xdgPopupResource); } registerXdgPopup(xdgPopup); @@ -949,10 +949,10 @@ QWaylandXdgPopup::QWaylandXdgPopup() * given \a parentSurface and \a resource. */ QWaylandXdgPopup::QWaylandXdgPopup(QWaylandXdgShell *xdgShell, QWaylandSurface *surface, - QWaylandSurface *parentSurface, const QWaylandResource &resource) + QWaylandSurface *parentSurface, const QPoint &position, const QWaylandResource &resource) : QWaylandCompositorExtensionTemplate<QWaylandXdgPopup>(*new QWaylandXdgPopupPrivate) { - initialize(xdgShell, surface, parentSurface, resource); + initialize(xdgShell, surface, parentSurface, position, resource); } /*! @@ -966,13 +966,14 @@ QWaylandXdgPopup::QWaylandXdgPopup(QWaylandXdgShell *xdgShell, QWaylandSurface * * Initializes the QWaylandXdgPopup, associating it with the given \a shell \a surface, * \a parentSurface and \a resource. */ -void QWaylandXdgPopup::initialize(QWaylandXdgShell *shell, QWaylandSurface *surface, - QWaylandSurface *parentSurface, const QWaylandResource &resource) +void QWaylandXdgPopup::initialize(QWaylandXdgShell *shell, QWaylandSurface *surface, QWaylandSurface *parentSurface, + const QPoint& position, const QWaylandResource &resource) { Q_D(QWaylandXdgPopup); d->m_surface = surface; d->m_parentSurface = parentSurface; d->m_xdgShell = shell; + d->m_position = position; d->init(resource.resource()); setExtensionContainer(surface); emit surfaceChanged(); @@ -1015,6 +1016,28 @@ QWaylandSurface *QWaylandXdgPopup::parentSurface() const return d->m_parentSurface; } + +/*! + * \qmlproperty object QtWaylandCompositor::XdgPopup::position + * + * This property holds the location of the upper left corner of the surface + * relative to the upper left corner of the parent surface, in surface local + * coordinates. + */ + +/*! + * \property QWaylandXdgPopup::position + * + * This property holds the location of the upper left corner of the surface + * relative to the upper left corner of the parent surface, in surface local + * coordinates. + */ +QPoint QWaylandXdgPopup::position() const +{ + Q_D(const QWaylandXdgPopup); + return d->m_position; +} + /*! * \internal */ |