macOS: Improve layer delegate setup
We should detect the cases where there's already a delegate, and setting up the delegate before the layer is added makes sense. Change-Id: I67896cbc96d11ce9a3826fd8aa0e5e104a83a21c Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
This commit is contained in:
parent
fd49d5e315
commit
cefd214b1b
@ -160,8 +160,14 @@
|
||||
<< "with" << layer << "due to being" << ([self layerExplicitlyRequested] ? "explicitly requested"
|
||||
: [self shouldUseMetalLayer] ? "needed by surface type" : "enabled by macOS");
|
||||
|
||||
if (layer.delegate && layer.delegate != self) {
|
||||
qCWarning(lcQpaDrawing) << "Layer already has delegate" << layer.delegate
|
||||
<< "This delegate is responsible for all view updates for" << self;
|
||||
} else {
|
||||
layer.delegate = self;
|
||||
}
|
||||
|
||||
[super setLayer:layer];
|
||||
layer.delegate = self;
|
||||
|
||||
// When adding a view to a view hierarchy the backing properties will change
|
||||
// which results in updating the contents scale, but in case of switching the
|
||||
|
Loading…
x
Reference in New Issue
Block a user