letsfindaway / OpenBoard

I'm using this fork to contribute features and fixes to the upstream project. In order to create good pull requests, I'm rebasing my feature branches, squashing and reordering commits, etc. If you fork this repository be aware that my development branches may rewrite history without prior notice.
http://openboard.ch/
GNU General Public License v3.0
9 stars 0 forks source link

Can no longer write text in `UBGraphicsTextItem` and `UBGraphicsWidgetItem` #133

Closed kaamui closed 1 year ago

kaamui commented 1 year ago

That's quite a big regression I was not expecting...

I did a git bisect and it seems related to the changes we did in UBGraphicsScene's ownership, as no issue at this point of the branch : 4f49a2fa, and appears at the first commit that compiles after.

QGraphicsScene::keyPressEvent is correctly called, QGraphicsTextItem::keyPressEvent too, so I don't understand what's happening.

I did reproduce it in a macOS and my Linux laptop.

I thought it could be that the scene we're trying to send key press events to is not the good one, but it is the same scene all over the place ...

scene where keyReleaseEvent is called :  UBGraphicsScene(0x55efaf0c9a00, name = "BoardScene")
active scene is :  UBGraphicsScene(0x55efaf0c9a00, name = "BoardScene")
text item scene :  UBGraphicsScene(0x55efaf0c9a00, name = "BoardScene")

Do you see something that could explain this ? I could not find any related issue in the Qt bug tracker.

letsfindaway commented 1 year ago

I only see the keyReleaseEvent, not the keyPressEvent. Will investigate further.

letsfindaway commented 1 year ago

The problematic commit is https://github.com/letsfindaway/OpenBoard/commit/20ed5edb2e0e2d9c3082c96fb89c0a5a5abac7c8 and here line https://github.com/letsfindaway/OpenBoard/blob/a8467306d7397ad3dd6cb76efd5181072ace05da/src/board/UBBoardView.cpp#L206

letsfindaway commented 1 year ago

Just uncomment it again and change it to

QApplication::sendEvent (scene().get(), event); 

and it works again!

kaamui commented 1 year ago

... sorry to have bothered you for this. I just don't know why it was commented. I don't remember at all having done that

Probably a wrong manipulation. Thank you for your help.

kaamui commented 1 year ago

I only see the keyReleaseEvent, not the keyPressEvent. Will investigate further.

I must have gone too fast in my tests and confused the different calls... very sorry to have bothered you with such stupid things. I try to only ask for your help when there is a question of technical interest.

... I just had a 4-day weekend and I found a way to chain the nonsense where I'm supposed to be in great shape to work... :smile:

letsfindaway commented 1 year ago

... I just had a 4-day weekend and I found a way to chain the nonsense where I'm supposed to be in great shape to work... smile

Hehe :) And never mind. I know such things can happen. Once at work I started to implement a new feature, and when I was close to be ready I found out that I had a branch where I already did this two months ago. Just didn't remember. Such things just happen.