If the factory returned null for some dock widget, then the layout would have holes. They need to be turned into placeholders, which will be invisible. Move the test into the QtWidgets guard. There's no point in making it agnostic, since the bug is in the layouting.