From e507335c017e25b2b3e97eda24296bfd664951fb Mon Sep 17 00:00:00 2001 From: Jean-Paul Chaput Date: Mon, 19 Jan 2009 12:48:53 +0000 Subject: [PATCH] * ./hurricane/src/hviewer : - Change: BreakpointWidget is no longer modal, need to replace the ::exec() by a custom made one. --- hurricane/src/hviewer/BreakpointWidget.cpp | 29 ++++++++++++++++--- hurricane/src/hviewer/Graphics.cpp | 3 +- .../hurricane/viewer/BreakpointWidget.h | 4 +++ 3 files changed, 31 insertions(+), 5 deletions(-) diff --git a/hurricane/src/hviewer/BreakpointWidget.cpp b/hurricane/src/hviewer/BreakpointWidget.cpp index 1c6ecc9b..362040bf 100644 --- a/hurricane/src/hviewer/BreakpointWidget.cpp +++ b/hurricane/src/hviewer/BreakpointWidget.cpp @@ -23,6 +23,7 @@ // x-----------------------------------------------------------------x +#include #include #include #include @@ -37,11 +38,12 @@ namespace Hurricane { BreakpointWidget::BreakpointWidget ( QWidget* parent ) - : QDialog (parent) - , _message (new QLabel()) - , _stopLevel(new QSpinBox()) + : QDialog (parent) + , _message (new QLabel()) + , _stopLevel (new QSpinBox()) + , _isFinished(false) { - setModal ( true ); + setModal ( false ); setWindowTitle ( "Breakpoint" ); setToolTip ( "Crush the Mush to continue..." ); @@ -70,6 +72,25 @@ namespace Hurricane { connect ( ok , SIGNAL(clicked()) , this, SLOT(accept()) ); connect ( _stopLevel, SIGNAL(valueChanged(int)), this, SLOT(updateStopLevel(int)) ); + connect ( this , SIGNAL(finished(int)) , this, SLOT(raiseFinished(int)) ); + } + + + int BreakpointWidget::execNoModal () + { + if ( isVisible() ) return -1; + + _isFinished = false; + show (); + while ( !_isFinished ) + QApplication::processEvents (); + return result(); + } + + + int BreakpointWidget::raiseFinished ( int ) + { + _isFinished = true; } diff --git a/hurricane/src/hviewer/Graphics.cpp b/hurricane/src/hviewer/Graphics.cpp index 77da2c0e..2f39933f 100644 --- a/hurricane/src/hviewer/Graphics.cpp +++ b/hurricane/src/hviewer/Graphics.cpp @@ -280,8 +280,9 @@ namespace Hurricane { if ( !bpw ) bpw = new BreakpointWidget (); bpw->setMessage ( message.c_str() ); + bpw->execNoModal (); - return ( bpw->exec() == QDialog::Accepted ); + return ( bpw->result() == QDialog::Accepted ); } diff --git a/hurricane/src/hviewer/hurricane/viewer/BreakpointWidget.h b/hurricane/src/hviewer/hurricane/viewer/BreakpointWidget.h index adc2ca51..8ad369a6 100644 --- a/hurricane/src/hviewer/hurricane/viewer/BreakpointWidget.h +++ b/hurricane/src/hviewer/hurricane/viewer/BreakpointWidget.h @@ -43,12 +43,16 @@ namespace Hurricane { void setMessage ( const QString& ); int getStopLevel () const; void setStopLevel ( int ); + int execNoModal (); public slots: void updateStopLevel ( int ); + protected slots: + int raiseFinished ( int ); private: QLabel* _message; QSpinBox* _stopLevel; + bool _isFinished; };