[Qt-interest] [Fwd: [Fwd: Problem with focusNextChild and QPlainTextEdit]]

Stefano Rosellini s.rosellini at iv-srl.it
Fri Mar 27 11:49:32 CET 2009


Hi. First of all, thanks for your help.

focusNextChild returns false.
I tried to:
 - avoid call to QPlainTextEdit::keyPressEvent making a return.
 - call QPlainTextEdit::keyPressEvent before focusNextChild.
 - call QPlainTextEdit::keyPressEvent after focusNextChild.
In all of this cases the behavior is the same: the focus remains on 
QPlainTextEdit. The same happens on QTextEdit.

I thinked to find next focus widget myself, but I'm not sure what is the 
correct way.

Stefano Rosellini
Informatica Valdinievole


Ian Thomson ha scritto:
> Hi,
>
> Does focusNextChild return true or false? It should return true if it 
> succeeds.
>
> Also, could it be that calling the QPlainTextEdit::keyPressEvent after 
> checking for F8 means that it takes the focus back? What happens if you 
> check for F8 after running QPlainTextEdit::keyPressEvent?
>
> Cheers,
> Ian.
>
> Stefano Rosellini wrote:
>   
>> Last call for help... Really no one?!?
>>
>> I suspect that problem is about the tab key but I haven't found any simple solution.
>>
>>
>> --- Original message ---
>>
>> No one?
>>
>> --- Original message ---
>>
>> If I use focusNextChild on a QLineEdit, it works, but on QPlainTextEdit 
>> the focus remain on this widget. Does someone know why?
>>
>> I used this overload for keyPressEvent (that works perfectly for QLineEdit).
>>
>> void PEditorWidget::keyPressEvent(QKeyEvent *event) {
>>   if (event->key()==Qt::Key_F8) {
>>     focusNextChild();
>>     return;
>>   }
>>   QPlainTextEdit::keyPressEvent(event);
>> }
>>
>>
>> Thanks.
>>
>> Stefano Rosellini
>> Informatica Valdinievole
>>
>> _______________________________________________
>> Qt-interest mailing list
>> Qt-interest at trolltech.com
>> http://lists.trolltech.com/mailman/listinfo/qt-interest
>>
>>
>> _______________________________________________
>> Qt-interest mailing list
>> Qt-interest at trolltech.com
>> http://lists.trolltech.com/mailman/listinfo/qt-interest
>>
>>
>>
>>     
>
> _______________________________________________
> Qt-interest mailing list
> Qt-interest at trolltech.com
> http://lists.trolltech.com/mailman/listinfo/qt-interest
>
>   



More information about the Qt-interest-old mailing list