Replace CWnd::PostMessage hackery with actual Qt QEvent handling. Unfortunately this seems to move the note state update outside of the painting in the instrument panel's keyboard, but it is much less hacky than what I previously had implemented.