QWindowPrivate::setMinOrMaxSize: port to function_ref
The "callbacks" passed to setMinOrMaxSize are not stored and outlive the callee. Therefore, don't use std::function to pass them (by value (!)); instead employ the recently-added function_ref. Change-Id: I37eea020920a76c063265e667c99a6040394d645 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io> Reviewed-by: Marc Mutz <marc.mutz@qt.io>
This commit is contained in:
parent
d0eba2449a
commit
1ffe49dd19
@ -568,12 +568,11 @@ QRectF QWindowPrivate::closestAcceptableGeometry(const QRectF &rect) const
|
||||
}
|
||||
|
||||
void QWindowPrivate::setMinOrMaxSize(QSize *oldSizeMember, const QSize &size,
|
||||
std::function<void()> funcWidthChanged,
|
||||
std::function<void()> funcHeightChanged)
|
||||
qxp::function_ref<void()> funcWidthChanged,
|
||||
qxp::function_ref<void()> funcHeightChanged)
|
||||
{
|
||||
Q_Q(QWindow);
|
||||
Q_ASSERT(oldSizeMember);
|
||||
Q_ASSERT(funcWidthChanged && funcHeightChanged);
|
||||
const QSize adjustedSize =
|
||||
size.expandedTo(QSize(0, 0)).boundedTo(QSize(QWINDOWSIZE_MAX, QWINDOWSIZE_MAX));
|
||||
if (*oldSizeMember == adjustedSize)
|
||||
|
@ -22,6 +22,7 @@
|
||||
|
||||
#include <QtCore/private/qobject_p.h>
|
||||
#include <QtCore/qelapsedtimer.h>
|
||||
#include <QtCore/qxpfunctional.h>
|
||||
#include <QtGui/QIcon>
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
@ -74,8 +75,8 @@ public:
|
||||
virtual QRectF closestAcceptableGeometry(const QRectF &rect) const;
|
||||
|
||||
void setMinOrMaxSize(QSize *oldSizeMember, const QSize &size,
|
||||
std::function<void()> funcWidthChanged,
|
||||
std::function<void()> funcHeightChanged);
|
||||
qxp::function_ref<void()> funcWidthChanged,
|
||||
qxp::function_ref<void()> funcHeightChanged);
|
||||
|
||||
virtual void processSafeAreaMarginsChanged() {}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user