Can't send events to a Modal QDialog!



  • I have class that generates QKeyEvent and sends them to the qApp->activeWidget(), but when I'm in a modal QDialog qApp->activeWidget() returns only 0!

    I've tried to do qApp->activeModalWidget() but I also get 0, so I can't send "fake" keyboard events to my Dialog, so I just stays there. I can't even close it ¬¬



  • I've implemented an "exec()" like function, that doesn't leaves the main event-loop, but still it does!

    @int QSelectionDialog::getSelection(void){
    setModal(false);
    show();
    isDone=false;
    while ( !isDone ){
    qApp->processEvents();
    }
    int ret_val;
    ret_val = eleccion->text().toInt();
    if ( ret_val > last->count() )
    ret_val = 0;

        hide();
        return ret_val;
    

    }@

    What am I doing wrong?


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.