Kdialog progressbar exits immediately if cancel pressed

I’ve found several examples that use the wasCancelled method. For example,

dbusref=$(kdialog --progressbar "running" 10)
while : ;do qdbus $dbusref wasCancelled;sleep 0.2;done

that loops showing false, but if the cancel button is pressed, kdialog exits, so wasCancelled never returns true, and the qdbus fails. Or am I missing something?