PDA

View Full Version : key Press which key



aekilic
5th May 2009, 18:48
Dear all

How can I write keys that has been pressed to a QLineEdit with plus in between so that I will use them as a shortcut

caduel
5th May 2009, 19:15
how about having a look at designer (its sources, rather)? one of the benefits of open source...

Lykurg
5th May 2009, 19:20
Please verify for me: Key press, insert "+", short cut??? Don't understand...

aekilic
5th May 2009, 19:45
I was not able to find it on the designer codes

Lykurg
5th May 2009, 20:04
Since neither you nor my crystal ball explains the question to my I just talk in the wind: Subclass QLineEdit use the key press event filter and check for QKeySequence or any other shortcut and emit a signal or call a function. Or use textChanged ( const QString & text ) and check if there is a + and then do what ever you want.

aekilic
6th May 2009, 07:07
Is there any example that could help me?

I would like to chacht which key hes been presses on a qlineedit and write it to the line itself.

aekilic
6th May 2009, 09:52
any body can help me for thiss???

spirit
6th May 2009, 09:56
install event filter on your line edit and process QKeyEvent.

Lykurg
6th May 2009, 10:31
or subclass QLineEdit and then:

void YourLineEdit::keyPressEvent(QKeyEvent *e)
{
if (Qt::Key_Plus == e->key())
qDebug("+ was pressed I ignore that")
else
QLineEdit::keyPressEvent(e);
}