Hello,

I'm trying to write me a color picker widget. The idea is, that it folds up from a smaller 'Select Color'-Button, and disappears if the user clickes anything else than the picker widget. So the widget is non-modal. (Think it similar to a drop down listbox.) Additional I would like to keep the applications UI responsive while the user is picking the color, to update the preview in the main view and - this is where the problem comes in - and to do this via an exec()-function containing a message loop (like the QFileDialog).
Qt Code:
  1. bool DropDownColorPickerWidget::exec()
  2. {
  3. m_result = true;
  4. show();
  5. QEventLoop eventLoop( this );
  6. eventLoop.processEvents();
  7.  
  8. activateWindow();
  9. while( isVisible() )
  10. eventLoop.processEvents();
  11.  
  12. return m_result;
  13. }
To copy to clipboard, switch view to plain text mode 
In general this seems to work, but when parent-widget of the picker widget is closed while the application is inside the pickers message loop this causes a crash.
So I´m looking for a possiblity for either preventing the parent widgets (and the application) from closing while the picker is poped up or for a way to exit the message loop before the deletion of the parent objects takes place.

Thanks in advance for any hints or advice.