PDA

View Full Version : QKeyEvent Gives Odd Response to SpaceBar



GTBuilder
2nd August 2008, 15:28
I'm using the following function:



void Clone::keyPressEvent( QKeyEvent *event)
{
switch ( kbdItem)
{
case getDriveLetter:
driveLetterProcess( event->text());
break;
case okNotMounted:
notMountedProcess();
break;
case okDeleteFolder:
deleteFolderProcess( event->key());
break;
default:
;
}
}


If I press the spacebar, the function ignores the input for the getDriveLetter and okDeleteFolder cases.

For the okNotMounted case, I ask the user to, "Press any key to continue." If spacebar is selected, rather then entering the notMountedProcess(), the function re-enters the driveLetterProcess( event->text()).

Works fine for any other key press.

:confused:

jacek
2nd August 2008, 21:15
Spacebar activates the default button. Make sure that the key event doesn't propagate to parent widget.