The MidiKeyboardComponent and MidiKeyboardState are separate, so the state can live in the AudioProcessor and the Component lives in the AudioProcessorEditor.
You simply need to call processNextMidiBuffer (midi) on the state, and a connected MidiKeyboardComponent will show the pressed keys.
You can decide, if events from the screen keyboard shall be added to the MidiBuffer or not by setting a flag.
You need access to the state, but it doesn’t have to be owned by the editor.
The state is the backend, that is continuously getting midi events. Imagine you hold a key down on your physical keyboard and open then the editor. You would have missed the noteOn event, if the state was defined in the editor.
Make the keyboardState a member of the processor. Either make it public or define an access method returning a reference to the state.
You use that reference to connect your MidiKeyboardComponent in the editor to it.