14#include <QtCore/qloggingcategory.h>
15#include <QtQml/qqmlinfo.h>
16#include <QtQuick/qquickitem.h>
17#include <QtQuick/private/qquickaccessibleattached_p.h>
18#include <QtQuick/private/qquicktransition_p.h>
19#include <QtQuick/private/qquickitem_p.h>
291 : transitionManager(
this)
307 QObject::connect(
popupItem, &QQuickControl::implicitBackgroundHeightChanged,
q, &QQuickPopup::implicitBackgroundHeightChanged);
325 static const QQuickPopup::ClosePolicy outsideFlags = QQuickPopup::CloseOnPressOutside | QQuickPopup::CloseOnReleaseOutside;
326 static const QQuickPopup::ClosePolicy outsideParentFlags = QQuickPopup::CloseOnPressOutsideParent | QQuickPopup::CloseOnReleaseOutsideParent;
347#if QT_CONFIG(quicktemplates2_multitouch)
383 tryClose(point, QQuickPopup::CloseOnPressOutside | QQuickPopup::CloseOnPressOutsideParent);
397 tryClose(point, QQuickPopup::CloseOnReleaseOutside | QQuickPopup::CloseOnReleaseOutsideParent);
411 if (
p->mouseGrabberPopup ==
q)
412 p->mouseGrabberPopup =
nullptr;
420 switch (
event->type()) {
428 Q_UNREACHABLE_RETURN(
false);
434 switch (
event->type()) {
440 Q_UNREACHABLE_RETURN(
false);
444#if QT_CONFIG(quicktemplates2_multitouch)
447 switch (
event->type()) {
455 switch (point.
state()) {
484 qmlWarning(
q) <<
"cannot find any window to open popup in.";
500 while (ancestor && topPopup) {
501 if (ancestor == topPopup)
503 ancestor = ancestor->
parent();
505 if (topPopup && topPopup !=
q && ancestor) {
506 QQuickItem *topPopupItem = popupStack.first()->popupItem();
516 emit q->aboutToShow();
521 emit q->visibleChanged();
524 if (overlayPrivate->lastActiveFocusItem.isNull())
553 emit q->aboutToHide();
554 emit q->openedChanged();
564 emit q->openedChanged();
583 for (
auto popup : stackingOrderPopups) {
585 && popup->hasFocus()) {
586 nextFocusPopup = popup;
591 if (nextFocusPopup) {
594 auto *appWindow = qobject_cast<QQuickApplicationWindow*>(
window);
595 auto *contentItem = appWindow ? appWindow->contentItem() :
window->
contentItem();
598 if (!contentItem->scopedFocusItem()
599 && !overlayPrivate->lastActiveFocusItem.isNull()) {
604 overlayPrivate->lastActiveFocusItem =
nullptr;
611 emit q->visibleChanged();
628 return QMarginsF(
q->leftMargin(),
q->topMargin(),
q->rightMargin(),
q->bottomMargin());
634 qreal oldMargin =
q->topMargin();
638 emit q->topMarginChanged();
647 qreal oldMargin =
q->leftMargin();
651 emit q->leftMarginChanged();
660 qreal oldMargin =
q->rightMargin();
664 emit q->rightMarginChanged();
673 qreal oldMargin =
q->bottomMargin();
677 emit q->bottomMarginChanged();
754 p->updateLocale(appWindow->locale(),
false);
757 emit q->windowChanged(newWindow);
767 q->setParentItem(
nullptr);
792 if (!
item && popup->isModal())
799 item->setZ(popup->
z());
802 parent->setProperty(
"_q_dimmerItem", QVariant::fromValue<QQuickItem*>(
item));
803 if (popup->isModal()) {
808#if QT_CONFIG(quicktemplates2_hover)
819 <<
"for popup" << popup <<
"with parent" <<
parent <<
"- item is:" <<
item;
831 QQuickOverlayAttached *overlayAttached = qobject_cast<QQuickOverlayAttached *>(qmlAttachedPropertiesObject<QQuickOverlay>(
q,
false));
848 if (dimmerParentItem->property(
"_q_dimmerItem").value<
QQuickItem*>() ==
dimmer)
949QQuickPopup::~QQuickPopup()
952 d->inDestructor =
true;
954 QQuickItem *currentContentItem =
d->popupItem->d_func()->contentItem.data();
955 if (currentContentItem) {
960 setParentItem(
nullptr);
966 d->finalizeExitTransition();
969 d->popupItem =
nullptr;
970 delete d->positioner;
971 d->positioner =
nullptr;
1008 return d->effectiveX;
1011void QQuickPopup::setX(
qreal x)
1027 return d->effectiveY;
1030void QQuickPopup::setY(
qreal y)
1036QPointF QQuickPopup::position()
const
1039 return QPointF(
d->effectiveX,
d->effectiveY);
1042void QQuickPopup::setPosition(
const QPointF &
pos)
1047 if (!xChange && !yChange)
1052 if (
d->popupItem->isVisible()) {
1082 return d->popupItem->z();
1085void QQuickPopup::setZ(
qreal z)
1091 d->popupItem->setZ(
z);
1095void QQuickPopup::resetZ()
1110 return d->popupItem->width();
1117 d->popupItem->setWidth(
width);
1120void QQuickPopup::resetWidth()
1126 d->hasWidth =
false;
1127 d->popupItem->resetWidth();
1128 if (
d->popupItem->isVisible())
1140 return d->popupItem->height();
1146 d->hasHeight =
true;
1147 d->popupItem->setHeight(
height);
1150void QQuickPopup::resetHeight()
1156 d->hasHeight =
false;
1157 d->popupItem->resetHeight();
1158 if (
d->popupItem->isVisible())
1170 return d->popupItem->implicitWidth();
1173void QQuickPopup::setImplicitWidth(
qreal width)
1176 d->popupItem->setImplicitWidth(
width);
1187 return d->popupItem->implicitHeight();
1193 d->popupItem->setImplicitHeight(
height);
1209 return d->popupItem->contentWidth();
1212void QQuickPopup::setContentWidth(
qreal width)
1215 d->popupItem->setContentWidth(
width);
1231 return d->popupItem->contentHeight();
1237 d->popupItem->setContentHeight(
height);
1252 return d->popupItem->availableWidth();
1267 return d->popupItem->availableHeight();
1285 return d->popupItem->spacing();
1294void QQuickPopup::resetSpacing()
1316void QQuickPopup::setMargins(
qreal margins)
1331 if (!
qFuzzyCompare(newMargins.bottom(), oldMargins.bottom()))
1336void QQuickPopup::resetMargins()
1355 if (
d->hasTopMargin)
1356 return d->topMargin;
1360void QQuickPopup::setTopMargin(
qreal margin)
1363 d->setTopMargin(margin);
1366void QQuickPopup::resetTopMargin()
1369 d->setTopMargin(-1,
true);
1386 if (
d->hasLeftMargin)
1387 return d->leftMargin;
1391void QQuickPopup::setLeftMargin(
qreal margin)
1394 d->setLeftMargin(margin);
1397void QQuickPopup::resetLeftMargin()
1400 d->setLeftMargin(-1,
true);
1417 if (
d->hasRightMargin)
1418 return d->rightMargin;
1422void QQuickPopup::setRightMargin(
qreal margin)
1425 d->setRightMargin(margin);
1428void QQuickPopup::resetRightMargin()
1431 d->setRightMargin(-1,
true);
1448 if (
d->hasBottomMargin)
1449 return d->bottomMargin;
1453void QQuickPopup::setBottomMargin(
qreal margin)
1456 d->setBottomMargin(margin);
1459void QQuickPopup::resetBottomMargin()
1462 d->setBottomMargin(-1,
true);
1477 return d->popupItem->padding();
1480void QQuickPopup::setPadding(
qreal padding)
1486void QQuickPopup::resetPadding()
1489 d->popupItem->resetPadding();
1505 return d->popupItem->topPadding();
1508void QQuickPopup::setTopPadding(
qreal padding)
1511 d->popupItem->setTopPadding(
padding);
1514void QQuickPopup::resetTopPadding()
1517 d->popupItem->resetTopPadding();
1533 return d->popupItem->leftPadding();
1536void QQuickPopup::setLeftPadding(
qreal padding)
1539 d->popupItem->setLeftPadding(
padding);
1542void QQuickPopup::resetLeftPadding()
1545 d->popupItem->resetLeftPadding();
1561 return d->popupItem->rightPadding();
1564void QQuickPopup::setRightPadding(
qreal padding)
1567 d->popupItem->setRightPadding(
padding);
1570void QQuickPopup::resetRightPadding()
1573 d->popupItem->resetRightPadding();
1589 return d->popupItem->bottomPadding();
1592void QQuickPopup::setBottomPadding(
qreal padding)
1595 d->popupItem->setBottomPadding(
padding);
1598void QQuickPopup::resetBottomPadding()
1601 d->popupItem->resetBottomPadding();
1614 return d->popupItem->locale();
1617void QQuickPopup::setLocale(
const QLocale &locale)
1620 d->popupItem->setLocale(
locale);
1623void QQuickPopup::resetLocale()
1626 d->popupItem->resetLocale();
1642bool QQuickPopup::isMirrored()
const
1645 return d->popupItem->isMirrored();
1678 return d->popupItem->font();
1681void QQuickPopup::setFont(
const QFont &
font)
1684 d->popupItem->setFont(
font);
1687void QQuickPopup::resetFont()
1690 d->popupItem->resetFont();
1702 return d->popupItem;
1713 return d->parentItem;
1722 if (
d->parentItem) {
1733 }
else if (!
d->inDestructor) {
1741void QQuickPopup::resetParentItem()
1769 return d->popupItem->background();
1772void QQuickPopup::setBackground(
QQuickItem *background)
1804 return d->popupItem->contentItem();
1812 QQuickItem *oldContentItem =
d->complete ?
d->popupItem->d_func()->contentItem.data()
1816 d->popupItem->setContentItem(
item);
1818 QQuickItem *newContentItem =
d->popupItem->d_func()->contentItem.data();
1820 if (oldContentItem != newContentItem)
1842 if (!
p->contentItem)
1843 p->executeContentItem();
1881 return d->popupItem->clip();
1884void QQuickPopup::setClip(
bool clip)
1887 if (
clip ==
d->popupItem->clip())
1889 d->popupItem->setClip(
clip);
1905bool QQuickPopup::hasFocus()
const
1911void QQuickPopup::setFocus(
bool focus)
1928bool QQuickPopup::hasActiveFocus()
const
1931 return d->popupItem->hasActiveFocus();
1955bool QQuickPopup::isModal()
const
1961void QQuickPopup::setModal(
bool modal)
1967 if (
d->complete &&
d->visible)
1995void QQuickPopup::setDim(
bool dim)
2004 if (
d->complete &&
d->visible)
2009void QQuickPopup::resetDim()
2026bool QQuickPopup::isVisible()
const
2029 return d->visible &&
d->popupItem->isVisible();
2040 d->transitionManager.transitionEnter();
2042 d->transitionManager.transitionExit();
2056bool QQuickPopup::isEnabled()
const
2059 return d->popupItem->isEnabled();
2062void QQuickPopup::setEnabled(
bool enabled)
2077bool QQuickPopup::isOpened()
const
2094 return d->popupItem->opacity();
2097void QQuickPopup::setOpacity(
qreal opacity)
2115 return d->popupItem->scale();
2123 d->popupItem->setScale(
scale);
2156 return d->closePolicy;
2159void QQuickPopup::setClosePolicy(ClosePolicy
policy)
2162 d->hasClosePolicy =
true;
2169void QQuickPopup::resetClosePolicy()
2173 d->hasClosePolicy =
false;
2191 return static_cast<TransformOrigin
>(
d->popupItem->transformOrigin());
2194void QQuickPopup::setTransformOrigin(TransformOrigin origin)
2227 if (
d->enter == transition)
2229 d->enter = transition;
2260 if (
d->exit == transition)
2262 d->exit = transition;
2277qreal QQuickPopup::horizontalPadding()
const
2280 return d->popupItem->horizontalPadding();
2283void QQuickPopup::setHorizontalPadding(
qreal padding)
2286 d->popupItem->setHorizontalPadding(
padding);
2289void QQuickPopup::resetHorizontalPadding()
2292 d->popupItem->resetHorizontalPadding();
2306qreal QQuickPopup::verticalPadding()
const
2309 return d->popupItem->verticalPadding();
2312void QQuickPopup::setVerticalPadding(
qreal padding)
2315 d->popupItem->setVerticalPadding(
padding);
2318void QQuickPopup::resetVerticalPadding()
2321 d->popupItem->resetVerticalPadding();
2335qreal QQuickPopup::implicitContentWidth()
const
2338 return d->popupItem->implicitContentWidth();
2352qreal QQuickPopup::implicitContentHeight()
const
2355 return d->popupItem->implicitContentHeight();
2369qreal QQuickPopup::implicitBackgroundWidth()
const
2372 return d->popupItem->implicitBackgroundWidth();
2386qreal QQuickPopup::implicitBackgroundHeight()
const
2389 return d->popupItem->implicitBackgroundHeight();
2400qreal QQuickPopup::topInset()
const
2403 return d->popupItem->topInset();
2406void QQuickPopup::setTopInset(
qreal inset)
2409 d->popupItem->setTopInset(inset);
2412void QQuickPopup::resetTopInset()
2415 d->popupItem->resetTopInset();
2426qreal QQuickPopup::leftInset()
const
2429 return d->popupItem->leftInset();
2432void QQuickPopup::setLeftInset(
qreal inset)
2435 d->popupItem->setLeftInset(inset);
2438void QQuickPopup::resetLeftInset()
2441 d->popupItem->resetLeftInset();
2452qreal QQuickPopup::rightInset()
const
2455 return d->popupItem->rightInset();
2458void QQuickPopup::setRightInset(
qreal inset)
2461 d->popupItem->setRightInset(inset);
2464void QQuickPopup::resetRightInset()
2467 d->popupItem->resetRightInset();
2478qreal QQuickPopup::bottomInset()
const
2481 return d->popupItem->bottomInset();
2484void QQuickPopup::setBottomInset(
qreal inset)
2487 d->popupItem->setBottomInset(inset);
2490void QQuickPopup::resetBottomInset()
2493 d->popupItem->resetBottomInset();
2525bool QQuickPopup::filtersChildMouseEvents()
const
2528 return d->popupItem->filtersChildMouseEvents();
2531void QQuickPopup::setFiltersChildMouseEvents(
bool filter)
2534 d->popupItem->setFiltersChildMouseEvents(
filter);
2550 d->popupItem->forceActiveFocus(reason);
2556 d->complete =
false;
2560 d->popupItem->classBegin();
2566 qCDebug(lcPopup) <<
"componentComplete" <<
this;
2570 if (
d->visible &&
d->window)
2571 d->transitionManager.transitionEnter();
2574 d->popupItem->componentComplete();
2576 if (
auto currentContentItem =
d->popupItem->d_func()->contentItem.data()) {
2608 if (!hasActiveFocus())
2611#if QT_CONFIG(shortcut)
2612 if (
d->closePolicy.testFlag(QQuickPopup::CloseOnEscape)
2614#
if defined(Q_OS_ANDROID)
2639 event->setAccepted(
d->handleMouseEvent(
d->popupItem,
event));
2645 event->setAccepted(
d->handleMouseEvent(
d->popupItem,
event));
2651 event->setAccepted(
d->handleMouseEvent(
d->popupItem,
event));
2668 switch (
event->type()) {
2677#if QT_CONFIG(quicktemplates2_multitouch)
2697#if QT_CONFIG(quicktemplates2_multitouch)
2701 d->handleTouchEvent(
d->popupItem,
event);
2704void QQuickPopup::touchUngrabEvent()
2711#if QT_CONFIG(wheelevent)
2712void QQuickPopup::wheelEvent(QWheelEvent *
event)
2726 qCDebug(lcPopup) <<
"contentSizeChange called on" <<
this <<
"with newSize" << newSize <<
"oldSize" << oldSize;
2743 qCDebug(lcPopup) <<
"geometryChange called on" <<
this <<
"with newGeometry" << newGeometry <<
"oldGeometry" << oldGeometry;
2801 emit horizontalPaddingChanged();
2805 emit verticalPaddingChanged();
2820 emit topInsetChanged();
2822 emit leftInsetChanged();
2824 emit rightInsetChanged();
2826 emit bottomInsetChanged();
2834#if QT_CONFIG(accessibility)
2835QAccessible::Role QQuickPopup::effectiveAccessibleRole()
const
2837 auto *attached = qmlAttachedPropertiesObject<QQuickAccessibleAttached>(
this,
false);
2839 auto role = QAccessible::NoRole;
2840 if (
auto *accessibleAttached = qobject_cast<QQuickAccessibleAttached *>(attached))
2841 role = accessibleAttached->role();
2842 if (role == QAccessible::NoRole)
2843 role = accessibleRole();
2848QAccessible::Role QQuickPopup::accessibleRole()
const
2850 return QAccessible::Dialog;
2853void QQuickPopup::accessibilityActiveChanged(
bool active)
2862 return d->popupItem->accessibleName();
2868 d->popupItem->maybeSetAccessibleName(
name);
2874 return d->popupItem->accessibleProperty(propertyName);
2880 return d->popupItem->setAccessibleProperty(propertyName,
value);
2885#include "moc_qquickpopup_p.cpp"
virtual void reject()
Hides the modal dialog and sets the result code to Rejected.
The QEventPoint class provides information about a point in a QPointerEvent.
int id
the ID number of this event point.
State state
the current state of the event point.
QPointF position
the position of this point.
The QFocusEvent class contains event parameters for widget focus events.
void setOpacity(qreal opacity)
void setAcceptHoverEvents(bool enabled)
void stackBefore(const QGraphicsItem *sibling)
void setParentItem(QGraphicsItem *parent)
Sets this item's parent item to newParent.
QPointF mapToScene(const QPointF &point) const
Maps the point point, which is in this item's coordinate system, to the scene's coordinate system,...
void setAcceptedMouseButtons(Qt::MouseButtons buttons)
Sets the mouse buttons that this item accepts mouse events for.
void setCursor(const QCursor &cursor)
Sets the current cursor shape for the item to cursor.
The QKeyEvent class describes a key event.
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.
static QMetaObject::Connection connect(const typename QtPrivate::FunctionPointer< Func1 >::Object *sender, Func1 signal, const typename QtPrivate::FunctionPointer< Func2 >::Object *receiverPrivate, Func2 slot, Qt::ConnectionType type=Qt::AutoConnection)
static bool disconnect(const typename QtPrivate::FunctionPointer< Func1 >::Object *sender, Func1 signal, const typename QtPrivate::FunctionPointer< Func2 >::Object *receiverPrivate, Func2 slot)
QObject * parent() const
Returns a pointer to the parent object.
static QMetaObject::Connection connect(const QObject *sender, const char *signal, const QObject *receiver, const char *member, Qt::ConnectionType=Qt::AutoConnection)
\threadsafe
bool setProperty(const char *name, const QVariant &value)
Sets the value of the object's name property to value.
void deleteLater()
\threadsafe
The QPalette class contains color groups for each widget state.
\inmodule QtCore\reentrant
The QQmlComponent class encapsulates a QML component definition.
The QQmlContext class defines a context within a QML engine.
static void setContextForObject(QObject *, QQmlContext *)
Sets the QQmlContext for the object to context.
The QQmlListProperty class allows applications to expose list-like properties of QObject-derived clas...
bool write(const QVariant &) const
Sets the property value to value.
static void warnIfCustomizationNotSupported(QObject *control, QQuickItem *item, const QString &propertyName)
static QQuickControlPrivate * get(QQuickControl *control)
void contentItemChanged()
static void data_clear(QQmlListProperty< QObject > *)
static qsizetype children_count(QQmlListProperty< QQuickItem > *)
void removeItemChangeListener(QQuickItemChangeListener *, ChangeTypes types)
static void children_clear(QQmlListProperty< QQuickItem > *)
static qsizetype data_count(QQmlListProperty< QObject > *)
\qmlproperty list<QtObject> QtQuick::Item::data \qmldefault
static QQuickItem * children_at(QQmlListProperty< QQuickItem > *, qsizetype)
static QObject * data_at(QQmlListProperty< QObject > *, qsizetype)
static void children_append(QQmlListProperty< QQuickItem > *, QQuickItem *)
static bool focusNextPrev(QQuickItem *item, bool forward)
QQuickItemPrivate::focusNextPrev focuses the next/prev item in the tab-focus-chain.
void addItemChangeListener(QQuickItemChangeListener *listener, ChangeTypes types)
static void data_append(QQmlListProperty< QObject > *, QObject *)
static QQuickItemPrivate * get(QQuickItem *item)
The QQuickItem class provides the most basic of all visual items in \l {Qt Quick}.
void setSize(const QSizeF &size)
TransformOrigin
\variable QQuickItem::ItemChangeData::realValue The numeric value that has changed: \l {QQuickItem::o...
void setParentItem(QQuickItem *parent)
qreal z
\qmlproperty real QtQuick::Item::z
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...
bool hasActiveFocus() const
virtual Q_INVOKABLE bool contains(const QPointF &point) const
\qmlmethod bool QtQuick::Item::contains(point point)
QQuickWindow * window() const
Returns the window in which this item is rendered.
QQuickItem * parentItem() const
void stackAfter(const QQuickItem *)
Moves the specified sibling item to the index after this item within the list of children.
qreal scale
\qmlproperty real QtQuick::Item::scale This property holds the scale factor for this item.
ItemChange
Used in conjunction with QQuickItem::itemChange() to notify the item about certain types of changes.
@ ItemActiveFocusHasChanged
qreal opacity
\qmlproperty real QtQuick::Item::opacity
bool isAncestorOf(const QQuickItem *child) const
Returns true if this item is an ancestor of child (i.e., if this item is child's parent,...
QList< QQuickPopup * > stackingOrderPopups() const
A window overlay for popups.
void removePopup(QQuickPopup *popup)
void addPopup(QQuickPopup *popup)
static QQuickOverlayPrivate * get(QQuickOverlay *overlay)
static QQuickOverlay * overlay(QQuickWindow *window)
void inheritPalette(const QPalette &parentPalette)
virtual void updateChildrenPalettes(const QPalette &parentPalette)
QPalette parentPalette(const QPalette &fallbackPalette) const override
static QPalette palette(Scope scope)
static QFont font(Scope scope)
void transition(const QList< QQuickStateAction > &, QQuickTransition *transition, QObject *defaultTarget=nullptr)
\qmltype Window \instantiates QQuickWindow \inqmlmodule QtQuick
QQuickItem * contentItem
\qmlattachedproperty Item Window::contentItem
QQuickItem * activeFocusItem
The item which currently has active focus or null if there is no item with active focus.
\inmodule QtCore\reentrant
constexpr qreal height() const noexcept
Returns the height of the rectangle.
constexpr qreal width() const noexcept
Returns the width of the rectangle.
constexpr qreal width() const noexcept
Returns the width.
constexpr qreal height() const noexcept
Returns the height.
\macro QT_RESTRICTED_CAST_FROM_ASCII
The QTouchEvent class contains parameters that describe a touch event.
int width
the width of the window's geometry
int height
the height of the window's geometry
Combined button and popup list for selecting options.
EGLOutputLayerEXT EGLint EGLAttrib value
[5]
bool qFuzzyCompare(qfloat16 p1, qfloat16 p2) noexcept
#define Q_LOGGING_CATEGORY(name,...)
#define qCDebug(category,...)
constexpr const T & qMax(const T &a, const T &b)
n void setPosition(void) \n\
GLuint GLfloat GLfloat GLfloat GLfloat GLfloat z
GLint GLint GLint GLint GLint x
[0]
GLfloat GLfloat GLfloat w
[0]
GLint GLsizei GLsizei height
GLenum GLenum GLsizei const GLuint GLboolean enabled
GLint GLint GLint GLint GLint GLint GLint GLbitfield GLenum filter
GLfloat GLfloat GLfloat GLfloat h
GLfixed GLfixed GLint GLint GLfixed points
GLdouble GLdouble GLdouble GLdouble q
GLenum GLenum GLenum GLenum GLenum scale
static qreal component(const QPointF &point, unsigned int i)
QQmlContext * qmlContext(const QObject *obj)
Q_QML_EXPORT QQmlInfo qmlWarning(const QObject *me)
QQuickItem * qobject_cast< QQuickItem * >(QObject *o)
#define QStringLiteral(str)
myObject disconnect()
[26]
QFileDialog dialog(this)
[1]
IUIAutomationTreeWalker __RPC__deref_out_opt IUIAutomationElement ** parent