In .Xsession (or .xinitrc, or whatever):
export GTK_IM_MODULE=scim
export QT_IM_MODULE=scim
export XMODIFIERS="@im=SCIM"
scim -d
Make sure you have scim installed though (and kanna or something). I haven't for the life of me been able to get it to work with KDE/Qt apps though. Any hints?