Function desc:onResize(f) is only available for drawing port descriptor returned by function qtwidget.newwindow. It ensures that function f(w,h) gets called whenever the widget size changes. The function argument indicate the new widget size. Each call of desc:onResize replaces the previous callback function by f. Calling it with argument nil removes the current callback.