Commit ef8fcc77 authored by Stéphane Albert's avatar Stéphane Albert

REFAC: #1778: Removed experimental event-filter code in owTvQtWidgetShow.

parent e790c0ac
......@@ -36,9 +36,6 @@ using otb::Wrapper::QtWidgetView;
using otb::Wrapper::QtWidgetProgressReport;
#define USE_EVENT_FILTER 0
struct static_finalizer
{
~static_finalizer()
......@@ -54,32 +51,6 @@ namespace
}
#if USE_EVENT_FILTER
struct CloseEventFilter : public QObject
{
CloseEventFilter( QObject * parent =nullptr ) : QObject( parent ) {}
bool
eventFilter( QObject * o, QEvent * e ) override
{
assert( o );
assert( e );
if( o==qApp && e->type()==QEvent::User )
{
assert( qApp );
qApp->quit();
}
return true;
}
};
#endif // USE_EVENT_FILTER
int
otbWrapperQtWidgetShowWidget( int argc, char* argv[] )
{
......@@ -164,36 +135,8 @@ otbWrapperQtWidgetShowWidget( int argc, char* argv[] )
// Show the main window
main_window.show();
#if USE_EVENT_FILTER
{
qt_app.installEventFilter( new CloseEventFilter( &qt_app ) );
// Post user event to signal end of programm to Qt application.
// qt_app.postEvent(
// &qt_app,
// new QEvent( QEvent::User ),
// Qt::LowEventPriority
// );
QTimer::singleShot(
1000,
&qt_app,
[ & qt_app ]()
{
qt_app.postEvent(
&qt_app,
new QEvent( QEvent::User ),
Qt::LowEventPriority
);
}
);
}
#else
QTimer::singleShot( 1000, &qt_app, SLOT( quit() ) );
#endif
// Start event processing loop
if( qt_app.exec() )
{
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment