[Uml-devel] Please review this patch

Jens Krüger je.krueger at web.de
Tue Oct 15 15:28:03 UTC 2002


Hi Sebastian,

I had a deeper look into your code and I wondered that your deleting code was 
working as expected. But when I saw your 'selecting all' code I was not 
surprised about that what happend:

- at first, wenn you start umbrello with the option 'load last file' (for 
convienence I use it very often) or if you load a existing file, the focus is 
not given on the umlview. It lies on the list view.

- at second, if you select the view the 'selection all' works correctly for 
the user

- at third, if you go to the document window and put a sample text inside you
make select all by pressing CTRL+A the text will be selected and all elements 
in the view.

I looked in the Qt doc and I found the following sentences in the description 
of the accept() function of the QWidget:

"Setting the accept parameter indicates that the receiver of the event wants 
the key event. Unwanted key events are sent to the parent widget. "

The UMLApp is the parent of all our widgets, and therefore it gets all event 
at last of all other widgets, and it seems so, that the ListView and *Edit 
widgets the key events not set as accepted (One have to look into the 
implementation). I think this is the reason of your problems. I think the 
implementation  is not the right way to solve the delete/backspace key and 
CTRL+A problems.

I tried it too to solve these feature request, and I saw the only way to do 
this in a reimplementation of the UMLWidget class. You have to do the 
deleting in this class. If you have the focus you may catch the key events 
and if you 'accept()' this event you may solve this problem.

Similarly to this one has to implement the solution for the CTRL+A key event 
into the UMLView class. (A remark: There must exist an accelerator for the 
CTRL+A event or in the event exists a method 'state' which informs about 
additionally pressed keys CTRL, SHIFT, ALT)

Sorry for the long text, and the short program code, but it's to late tonight 
for me. If I find some time I will try to implement my ideas, or you may do 
it.

Regards and good night

Jens 

Am Dienstag, 15. Oktober 2002 21:40 schrieb Sebastian Stein:
> I'm working on feature request #622957:
>
> "clicking delete/backspace key should delete objects if there is something
> selected.  now it is only possible to delte by right clicking."
>
> The attached patch should solve this problem.
>
> I'm also working on feature request #616896:
>
> "Most wanted:
> [delete] in diasgram view delets the current selection
> [ctrl-A] selects everything in the current diagram
>
> give tools a shortcut key, which shows up in the tooltip."
>
> So ignoring the last line, only ctrl-a is missing. The attached patch
> solves this problem as well, but there is one point missing:
>
> I added a function void UMLView::selectAll() and I added a "shortcut" in
> uml.cpp to call this function. This works fine, but UMLListView also
> catches the Ctrl-A key event and selects all items. I think UMLListView
> catches first.
>
> How can I prevent UMLListView from doing this? I mean it would be good if
> only the window with the focus is catching key events. I think I missed
> something in the source. (And yes the other way around it should work as
> well: UMLView shouldn't catch key event if it hasn't the focus)
>
> Who can help?
>
> Steinchen

-- 






More information about the umbrello-devel mailing list