Quantcast
Channel: QtWebEngine
Viewing all articles
Browse latest Browse all 13965

keyPressEvent to string to qlistview

$
0
0
Dear, I would like to read pressed keys and combine them to a string. The string will be checked in a database and the database will send some info back. That info must been show in qlistview. My problem is that I can catch keypresses and enterkey if there is no widget in the screen. But when there is a widget I only can detect a enter. So what should be the problem? Or how can i do it better void Buy::keyPressEvent(QKeyEvent* event) {     int i;     char c;     i = event->key();     c=char(i);     array[n]=c;       n++;     std::string str ;     str=array;       if((event->key() == Qt::Key_Enter)||(event->key() == Qt::Key_Return))         {             //enter or return was pressed             QMessageBox::critical(this,tr("Enter"), tr("Enter"));         } }

Viewing all articles
Browse latest Browse all 13965

Trending Articles