QQuickPopup: remove PopupType::Default
PopupType::Default was meant as a way for a developer to let Qt choose the best popup type, based on the run-time (or build-time) environment. But this could also be achieved by just setting the default value of popupType already in the popup constructor (or when resetting popupType) to either Item, Window, or Native, based on the same information. The difference is that the popupType cannot always be decided before the popup is about to open. A menu, for example, can be reparented at run-time into another menu, or into a native menubar. And then the effective popup type needs to be the same as the parent. But this will always be the case, even if the popupType is explicitly set to something else than PopupType::Default. So, at the end of the day, setting popupType to Window or Native should be understood as a hint (or preference). And this might or might not be respected, based on platform capabilities and the run-time state of the application. And leaving it unspecified will give you what is recommended on the platform by default, run-time considerations aside. As a result, PopupType::Default can therefore be removed, since it doesn't offer any extra logic on top of that. Pick-to: 6.8 Change-Id: I174ba70b6553e7fb867d68aa4593eb6cc23aefd3 Reviewed-by: Oliver Eftevaag <oliver.eftevaag@qt.io> Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
This commit is contained in:
parent
8969ac8afd
commit
f8b97e5af5
|
@ -2799,13 +2799,6 @@ QQuickPopup::PopupType QQuickPopup::popupType() const
|
|||
void QQuickPopup::setPopupType(PopupType popupType)
|
||||
{
|
||||
Q_D(QQuickPopup);
|
||||
// If the user tries to use popup windows on a platform or type that doesn't support it, change it back to default.
|
||||
if (popupType == PopupType::Window && (d->popupWindowType() == Qt::Widget
|
||||
|| !QGuiApplicationPrivate::platformIntegration()->hasCapability(QPlatformIntegration::Capability::MultipleWindows))) {
|
||||
popupType = PopupType::Default;
|
||||
qmlWarning(this) << "Popup.Window can not be used by this particular popup type, or on this particular platform.";
|
||||
}
|
||||
|
||||
if (d->m_popupType == popupType)
|
||||
return;
|
||||
|
||||
|
@ -2816,7 +2809,7 @@ void QQuickPopup::setPopupType(PopupType popupType)
|
|||
|
||||
void QQuickPopup::resetPopupType()
|
||||
{
|
||||
setPopupType(PopupType::Default);
|
||||
setPopupType(PopupType::Item);
|
||||
}
|
||||
|
||||
/*!
|
||||
|
|
|
@ -313,7 +313,6 @@ public:
|
|||
void resetBottomInset();
|
||||
|
||||
enum PopupType {
|
||||
Default,
|
||||
Item,
|
||||
Window,
|
||||
Native
|
||||
|
|
|
@ -194,7 +194,7 @@ public:
|
|||
qreal prevOpacity = 0;
|
||||
qreal prevScale = 0;
|
||||
QString m_title;
|
||||
QQuickPopup::PopupType m_popupType = QQuickPopup::Default;
|
||||
QQuickPopup::PopupType m_popupType = QQuickPopup::Item;
|
||||
|
||||
friend class QQuickPopupTransitionManager;
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue