10#include <QtCore/qloggingcategory.h>
11#include <QtQml/qqmlinfo.h>
12#include <QtQuick/private/qquickitem_p.h>
91 bool widthAdjusted =
false;
92 bool heightAdjusted =
false;
95 const QQuickItem *centerInParent =
p->anchors ?
p->getAnchors()->centerIn() :
nullptr;
96 const QQuickOverlay *centerInOverlay = qobject_cast<const QQuickOverlay*>(centerInParent);
97 QRectF rect(!centerInParent ?
p->allowHorizontalMove ?
p->
x : popupItem->
x() : 0,
98 !centerInParent ?
p->allowVerticalMove ?
p->
y : popupItem->
y() : 0,
99 !
p->hasWidth && iw > 0 ? iw :
w,
100 !
p->hasHeight && ih > 0 ? ih :
h);
105 if (centerInParent) {
106 if (centerInParent !=
parentItem() && !centerInOverlay) {
107 qmlWarning(
m_popup) <<
"Popup can only be centered within its immediate parent or Overlay.overlay";
111 if (centerInOverlay) {
123 QRectF bounds(qMax<qreal>(0.0, margins.
left()),
124 qMax<qreal>(0.0, margins.
top()),
125 p->window->width() - qMax<qreal>(0.0, margins.
left()) - qMax<qreal>(0.0, margins.
right()),
126 p->window->height() - qMax<qreal>(0.0, margins.
top()) - qMax<qreal>(0.0, margins.
bottom()));
131 if (
p->allowHorizontalFlip && (
rect.left() < bounds.
left() ||
rect.right() > bounds.
right())) {
140 if (
p->allowVerticalFlip && (
rect.top() < bounds.
top() ||
rect.bottom() > bounds.
bottom())) {
149 if (
p->allowVerticalMove) {
150 if (margins.
top() >= 0 &&
rect.top() < bounds.
top())
155 if (
p->allowHorizontalMove) {
165 if (
p->allowHorizontalMove &&
p->allowHorizontalFlip) {
173 if (
p->allowHorizontalResize) {
176 widthAdjusted =
true;
180 widthAdjusted =
true;
183 }
else if (iw > 0 &&
rect.left() >= bounds.
left() &&
rect.right() <= bounds.
right()
187 widthAdjusted =
true;
193 if (
p->allowVerticalMove &&
p->allowVerticalFlip) {
201 if (
p->allowVerticalResize) {
202 if (
rect.top() < bounds.
top()) {
204 heightAdjusted =
true;
208 heightAdjusted =
true;
211 }
else if (ih > 0 &&
rect.top() >= bounds.
top() &&
rect.bottom() <= bounds.
bottom()
215 heightAdjusted =
true;
230 p->effectiveX = effectivePos.
x();
234 p->effectiveY = effectivePos.
y();
238 if (!
p->hasWidth && widthAdjusted &&
rect.width() > 0) {
245 if (!
p->hasHeight && heightAdjusted &&
rect.height() > 0) {
251 qCDebug(lcPopupPositioner) <<
"- new popupItem geometry:"
252 << popupItem->
x() << popupItem->
y() << popupItem->
width() << popupItem->
height();
constexpr qreal right() const noexcept
Returns the right margin.
constexpr qreal left() const noexcept
Returns the left margin.
constexpr qreal top() const noexcept
Returns the top margin.
constexpr qreal bottom() const noexcept
Returns the bottom margin.
\inmodule QtCore\reentrant
constexpr qreal x() const noexcept
Returns the x coordinate of this point.
constexpr qreal y() const noexcept
Returns the y coordinate of this point.
void removeItemChangeListener(QQuickItemChangeListener *, ChangeTypes types)
void updateOrAddItemChangeListener(QQuickItemChangeListener *listener, ChangeTypes types)
void addItemChangeListener(QQuickItemChangeListener *listener, ChangeTypes types)
static QQuickItemPrivate * get(QQuickItem *item)
The QQuickItem class provides the most basic of all visual items in \l {Qt Quick}.
Q_INVOKABLE QPointF mapToItem(const QQuickItem *item, const QPointF &point) const
Maps the given point in this item's coordinate system to the equivalent point within item's coordinat...
qreal x
\qmlproperty real QtQuick::Item::x \qmlproperty real QtQuick::Item::y \qmlproperty real QtQuick::Item...
QPointF mapFromScene(const QPointF &point) const
Maps the given point in the scene's coordinate system to the equivalent point within this item's coor...
qreal y
Defines the item's y position relative to its parent.
qreal width
This property holds the width of this item.
QQuickItem * parentItem() const
qreal height
This property holds the height of this item.
void setPosition(const QPointF &)
qreal scale
\qmlproperty real QtQuick::Item::scale This property holds the scale factor for this item.
void polish()
Schedules a polish event for this item.
\inmodule QtCore\reentrant
constexpr qreal bottom() const noexcept
Returns the y-coordinate of the rectangle's bottom edge.
constexpr qreal height() const noexcept
Returns the height of the rectangle.
constexpr qreal width() const noexcept
Returns the width of the rectangle.
constexpr qreal left() const noexcept
Returns the x-coordinate of the rectangle's left edge.
constexpr qreal top() const noexcept
Returns the y-coordinate of the rectangle's top edge.
constexpr QRectF transposed() const noexcept
QRectF intersected(const QRectF &other) const noexcept
constexpr qreal right() const noexcept
Returns the x-coordinate of the rectangle's right edge.
Combined button and popup list for selecting options.
@ InvertedLandscapeOrientation
bool qFuzzyCompare(qfloat16 p1, qfloat16 p2) noexcept
int qRound(qfloat16 d) noexcept
#define Q_LOGGING_CATEGORY(name,...)
#define qCDebug(category,...)
GLfloat GLfloat GLfloat w
[0]
GLfloat GLfloat GLfloat GLfloat h
Q_QML_EXPORT QQmlInfo qmlWarning(const QObject *me)
IUIAutomationTreeWalker __RPC__deref_out_opt IUIAutomationElement ** parent