[Qt-interest] Qkey Press Event
Chandru...
sekarwagmare at gmail.com
Mon Jul 13 12:54:59 CEST 2009
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/10ca6de9/attachment.html
More information about the Qt-interest-old
mailing list