serula
23rd April 2011, 14:05
hi,
im a beginner in programming, im creating a school assignment, such that any keyboard input inside a textedit will be display what type of key entered in the label below.
void MainWindow::keyPressEvent(QKeyEvent *event){
if(event->key() == Qt::Key_0 )
{ui->label->setText("Numbers 0 press");}
.........
.........
else
ui->label->setText("Other keys press");
*attached is the source code.
but the problem is when any key press inside the textedit will not produce any outcome, but if the focus is outside the textedit box (for example by pressing the dummy button) the function will execute.
i search existing thread but doesnt find anything beneficial..
i am highly grateful by any help from u guys
6282
im a beginner in programming, im creating a school assignment, such that any keyboard input inside a textedit will be display what type of key entered in the label below.
void MainWindow::keyPressEvent(QKeyEvent *event){
if(event->key() == Qt::Key_0 )
{ui->label->setText("Numbers 0 press");}
.........
.........
else
ui->label->setText("Other keys press");
*attached is the source code.
but the problem is when any key press inside the textedit will not produce any outcome, but if the focus is outside the textedit box (for example by pressing the dummy button) the function will execute.
i search existing thread but doesnt find anything beneficial..
i am highly grateful by any help from u guys
6282