techartorg / bqt

A Blender add-on to support & manage Qt Widgets in Blender (PySide2)
https://github.com/techartorg/bqt/wiki
Mozilla Public License 2.0
162 stars 23 forks source link

fix alt tab bug with blender qt wrapping #32

Closed hannesdelbeke closed 1 year ago

hannesdelbeke commented 1 year ago

this PR fixes the alt-tab bug with embedding blender in QT.

build on top of @friedererdmann his PR

new stuff:

alt tab fix with keyboard

friedererdmann did a setup to run the release alt ctrl key etc when blender gets focus. however it checked if the event type was matching the key that was stuck. if the alt key is stuck, i cant copy paste (ctrl-v). however since i dont press alt, the fix event wont run. a simple solution is to have any event type, trigger the fix event. now when i type ctrl-v, this will run the fix once, undoing the alt key being stuck.

ensure fix stays in place when opening new scene

there was a logic issue where the focus handle did not run on a new scene. because it piggy backed on the existing create_global_app handle. which removed itself after running once. causing the on focus also to be removed. solution is moving to different handle

hannesdelbeke commented 1 year ago

note there is some weirdness going on with order of registering handles. blender doesn't invoke the operator if i first register bqt, then focus but works when registering focus and then bqt.

this is the only issue i dont understand why it happens.

hannesdelbeke commented 1 year ago

consider to remove instantiate_application from bqt startup since it's called twice (second time doesn't do anything) wonder if this is on purpose since as mentioned above there are weird things going on with relying on post_load default invole/execute?

hannesdelbeke commented 1 year ago

pushed a bug-fix for when the keys we release didn't work when they were the first pressed on blender refocus. e.g. when you alt tab back in blender, and the first thing you press is ctrl-v this resulted in just v being run, since we forced a release of ctrl

hannesdelbeke commented 1 year ago

this is now ready to review & merge

hannesdelbeke commented 1 year ago

TODO add support for windows key, has same issue as alt and ctrl etc.