<br><br><div class="gmail_quote">On Jan 16, 2008 11:58 PM, Shakes <<a href="mailto:Shekhar.Chandra@sci.monash.edu.au">Shekhar.Chandra@sci.monash.edu.au</a>> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Hi Jesus,<br><br>Qt has something called Strong Focus (click and keyboard focus) option.<br>All u need to do is to set the FocusPolicy to StrongFocus, also there is<br>a help page for keyboard focusing in Qt Documentation.
</blockquote><div><br>I've already tried doing that. I've set FocusPolicy to StrongFocus but with no success. I don't know what could be wrong<br><br></div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Also if you have<br>multiple windows in workspace, then set active window in QWorkspace. If<br>u have multiple windows in general, then setFocus should work if called<br>from the correct spot.<br><br>Hope that helps.<br><br>
Cheers<br>Shakes<br><div><div></div><div class="Wj3C7c"><br>Jesús Spínola wrote:<br>> Hi,<br>><br>> I have an application with a main "2D View" based upon a QVTKWidget<br>> and I would like to handle keyboard events to control the interaction.
<br>> My problem is that I must click over this QVTKWidget to be aware of<br>> the keyboard events, because until you click, you don't have keyboard<br>> focus.<br>> To avoid this "first-click-to-get-keyboard-focus", I tried to call
<br>> QVTKWidget->setFocus() (inherited from QWidget), which seems to be the<br>> trivial solution, but It does nothing and I have to click the<br>> QVTKWidget still to get the focus. I also tried invoking some vtk
<br>> events, like *ButtonPressEvent, but with no succeess.<br>><br>> Maybe I'm missing something or I'm trying to do something impossible,<br>> I don't know, but it would be nice if someone can give me some hint to
<br>> find out what I'm doing wrong.<br>><br>> So, how can I get the focus automatically?<br>><br>> Thanks in advance!<br></div></div>> ------------------------------------------------------------------------
<br>><br>> _______________________________________________<br>> This is the private VTK discussion list.<br>> Please keep messages on-topic. Check the FAQ at: <a href="http://www.vtk.org/Wiki/VTK_FAQ" target="_blank">
http://www.vtk.org/Wiki/VTK_FAQ</a><br>> Follow this link to subscribe/unsubscribe:<br>> <a href="http://www.vtk.org/mailman/listinfo/vtkusers" target="_blank">http://www.vtk.org/mailman/listinfo/vtkusers</a><br>>
<br><br></blockquote></div><br>