[Qt-interest] Qkey Press Event

Yuvaraj R yuvaraj at ongobiz.com
Mon Jul 13 13:46:46 CEST 2009


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
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20090713/99e140d0/attachment.html 


More information about the Qt-interest-old mailing list