Help with QDialog
-
I did the post originally in the Mobile and Embedded section but there isn't much people going there, so I'll just ask it here again since it's not entirely embedded related.
"Original Post":http://qt-project.org/forums/viewthread/53431/
So far I've realised that the main reason I'm not having events in the QDialog is because I manually generate them with a QSerialPort and send them. Since QDialog stops the main event-loop, and runs a "parallel" one I can't afford to do so, since I'm generating keyboards events there, and also receiving some other data so plot in a QwtPlot, and saving those bytes to a log.
So i've come up with the Idea of leaving the QDialog heritage because of that, since I can't leave the event loop. So I instead created a plain widget
@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; }
@
So in the main-loop I create this widget, and instead of runing "exec()" as a normal QDialog, I run getSelection() . I wait for the condition of accepting this "dialog" and still I attend for all signals and events.
The problem is that still doing it this way, I can't attend the QSerialPort since there's something else blocking that loop.