[Qt-interest] Qkey Press Event

Yuvaraj R yuvaraj at ongobiz.com
Mon Jul 13 15:03:52 CEST 2009


No.. It is working now..

previously i had done mistake in my code ..

Any way thanks for your reply.


Thanks

Yuvaraj R

On Mon, Jul 13, 2009 at 5:18 PM, Chandru... <sekarwagmare at gmail.com> wrote:

> but this code works fine for me ....  may be u are using in QGraphicsView
> ..?
>
> On Mon, Jul 13, 2009 at 5:16 PM, Yuvaraj R <yuvaraj at ongobiz.com> wrote:
>
>> same thing only i have followed ...
>>
>> any other ways.
>>
>> Thanks
>>
>> Yuvaraj R
>>
>>   On Mon, Jul 13, 2009 at 4:24 PM, Chandru... <sekarwagmare at gmail.com>wrote:
>>
>>> use this example ...
>>> bool MyMainWindow :: eventFilter(QObject *ob, QEvent *e)
>>> {
>>>         if(ob == lineedit && e->type() == QEvent::KeyPress) {
>>>                 const QKeyEvent *ke = static_cast<QKeyEvent *>(e);
>>>                 const QKeySequence ks(ke->modifiers() + ke->key());
>>>         lineedit->setText(ks.toString());
>>>         if(ke->key()==Qt::Key_F8)
>>>                 qApp->quit();
>>>
>>>
>>>                 lineedit->setText(ks.toString(QKeySequence::NativeText));
>>>                 return true;
>>>         }
>>>
>>>         return QWidget::eventFilter(0, e);
>>> }
>>>
>>>
>>>   On Mon, Jul 13, 2009 at 3:33 PM, Yuvaraj R <yuvaraj at ongobiz.com>wrote:
>>>
>>>>   Hi All
>>>>
>>>>   My program is detecting thre Enter key only from keyboard..
>>>>
>>>> I am trying with
>>>>
>>>> void MainWindow::keyPressEvent(QKeyEvent *event)
>>>>
>>>> {
>>>>
>>>> if(event->key() == Qt::Key_5)
>>>>
>>>> {
>>>>
>>>> QMessageBox::information(0,"",QString("Numer Key"));
>>>>
>>>> }
>>>>
>>>> }
>>>>
>>>>
>>>>
>>>> this one is not detecting the number key five.
>>>>
>>>> I want use only number keys..
>>>>
>>>>
>>>>
>>>>
>>>>
>>>> what mistake i have done...
>>>>
>>>>
>>>>
>>>> Any Idea ..
>>>>
>>>>
>>>>
>>>> Advance Thanks
>>>>
>>>>
>>>>
>>>>
>>>>
>>>> Yuvaraj R
>>>>
>>>> _______________________________________________
>>>> Qt-interest mailing list
>>>> Qt-interest at trolltech.com
>>>> http://lists.trolltech.com/mailman/listinfo/qt-interest
>>>>
>>>>
>>>
>>>
>>> --
>>> WAGMARE
>>>
>>>
>>>
>>
>
>
> --
> WAGMARE
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20090713/3912ee2d/attachment.html 


More information about the Qt-interest-old mailing list