diff --git a/framework/source/class/qx/ui/mobile/core/Widget.js b/framework/source/class/qx/ui/mobile/core/Widget.js index e5e5c702e98..14435c3cade 100644 --- a/framework/source/class/qx/ui/mobile/core/Widget.js +++ b/framework/source/class/qx/ui/mobile/core/Widget.js @@ -484,8 +484,7 @@ qx.Bootstrap.define("qx.ui.mobile.core.Widget", * @param layout {qx.ui.mobile.layout.Abstract} The new layout or * null to reset the layout. */ - _setLayout : function(layout) - { + _setLayout : function(layout) { if (qx.core.Environment.get("qx.debug")) { if (layout) { qx.core.Assert.assertInstance(layout, qx.ui.mobile.layout.Abstract); @@ -494,6 +493,11 @@ qx.Bootstrap.define("qx.ui.mobile.core.Widget", if (layout) { layout.connectToWidget(this); + } else { + var oldLayout = this.getLayout(); + if (oldLayout) { + oldLayout.disconnectFromWidget(this); + } } this.__layoutManager = layout; diff --git a/framework/source/class/qx/ui/mobile/layout/Abstract.js b/framework/source/class/qx/ui/mobile/layout/Abstract.js index 3dfad605b62..3b6f3bfbfc0 100644 --- a/framework/source/class/qx/ui/mobile/layout/Abstract.js +++ b/framework/source/class/qx/ui/mobile/layout/Abstract.js @@ -155,6 +155,21 @@ qx.Bootstrap.define("qx.ui.mobile.layout.Abstract", }, + /** + * This method is called by the widget to disconnect the widget from + * the layout. + * + * @param widget {qx.ui.mobile.core.Widget} The widget to disconnect from + */ + disconnectFromWidget : function(widget) + { + if (this._widget) { + this._widget.removeClasses(this._getCssClasses()); + this._widget = null; + } + }, + + /** * Connects the layout to a given child widget. Can be overridden in a concrete