diff --git a/widgets/coreWidget/CoreWidget.cc b/widgets/coreWidget/CoreWidget.cc index d3671c227ff0428167e7f0ff32762d62c8871c74..f3a433e4d05501276971f2f9fe95142297e3f950 100644 --- a/widgets/coreWidget/CoreWidget.cc +++ b/widgets/coreWidget/CoreWidget.cc @@ -226,9 +226,7 @@ CoreWidget( QVector& _viewModes, glViewer* examinerWidget = new glViewer(glScene_, glWidget_, PluginFunctions::viewerProperties(0), - centerWidget_, - "Examiner Widget", - statusBar_); + centerWidget_); examiner_widgets_.push_back(examinerWidget); @@ -244,9 +242,7 @@ CoreWidget( QVector& _viewModes, glViewer* newWidget = new glViewer(glScene_, glWidget_, PluginFunctions::viewerProperties(i), - centerWidget_, - "Examiner Widget", - statusBar_); + centerWidget_); examiner_widgets_.push_back(newWidget); @@ -291,6 +287,9 @@ CoreWidget( QVector& _viewModes, this, SLOT(dropEvent(QDropEvent* ))); connect (examiner_widgets_[i], SIGNAL(signalMakeActive ()), this, SLOT(slotActivateExaminer())); + + connect (examiner_widgets_[i], SIGNAL(statusMessage(QString, int)), + statusBar_, SLOT(showMessage(const QString&, int))); } diff --git a/widgets/glWidget/QtBaseViewer.cc b/widgets/glWidget/QtBaseViewer.cc index b8b193b9c2a3d36f156451643e93421191a0df27..3a4305adbff02a24a8a54c32df5ae7813f4cf168 100644 --- a/widgets/glWidget/QtBaseViewer.cc +++ b/widgets/glWidget/QtBaseViewer.cc @@ -63,7 +63,6 @@ #include #include #include -#include #include #include #include @@ -122,11 +121,8 @@ static const char VIEW_MAGIC[] = glViewer::glViewer( QtGLGraphicsScene* _scene, QGLWidget* _glWidget, Viewer::ViewerProperties& _properties, - QGraphicsWidget* _parent, - const char* /* _name */ , - QStatusBar *_statusBar) : + QGraphicsWidget* _parent) : QGraphicsWidget(_parent), - statusbar_(_statusBar), glareaGrabbed_(false), projectionUpdateLocked_(false), blending_(true), @@ -137,7 +133,7 @@ glViewer::glViewer( QtGLGraphicsScene* _scene, { // widget stuff - createWidgets(_statusBar); + createWidgets(); // bind GL context to GL state class glstate_ = new ACG::GLState(); @@ -221,15 +217,6 @@ glViewer::sizeHint() const return QSize( 600, 600 ); } - -//----------------------------------------------------------------------------- - - -void glViewer::setStatusBar(QStatusBar* _sb) -{ - statusbar_ = _sb; -} - //----------------------------------------------------------------------------- @@ -1257,10 +1244,8 @@ void glViewer::actionPasteView() //----------------------------------------------------------------------------- void -glViewer::createWidgets(QStatusBar* _sb) +glViewer::createWidgets() { - setStatusBar(_sb); - // Construct GL context & widget wheelZ_=new ACG::QtWidgets::QtWheel( 0,"wheel-z",ACG::QtWidgets::QtWheel::Vertical); @@ -1940,10 +1925,9 @@ void glViewer::slotAnimation() if (!properties_.updateLocked()) { msecs += frame_time_; if (count >= 10 && msecs >= 500) { - assert(statusbar_!=0); char s[100]; sprintf( s, "%.3f fps", (1000.0 * count / (float)msecs) ); - statusbar_->showMessage(s,2000); + emit statusMessage(s,2000); count = msecs = 0; } else @@ -2034,14 +2018,13 @@ void glViewer::snapshot() bool rval=snapshot.save(fname,format.toUpper().toLatin1()); - assert(statusbar_!=0); if (rval) { - statusbar_->showMessage(QString("snapshot: ")+fname,5000); + emit statusMessage (QString("snapshot: ")+fname,5000); } else { - statusbar_->showMessage(QString("could not save snapshot to ")+fname); + emit statusMessage (QString("could not save snapshot to ")+fname); } } diff --git a/widgets/glWidget/QtBaseViewer.hh b/widgets/glWidget/QtBaseViewer.hh index 0efd942034d4771f9aec68ee99eb07f6ce6dcaca..4480514b9eeaa0ce923504f288babd4ada23b911 100644 --- a/widgets/glWidget/QtBaseViewer.hh +++ b/widgets/glWidget/QtBaseViewer.hh @@ -78,7 +78,6 @@ class QPushButton; class QToolButton; -class QStatusBar; class QSplitter; class QTimer; class QImage; @@ -129,9 +128,7 @@ public: glViewer( QtGLGraphicsScene* _scene, QGLWidget* _glWidget, Viewer::ViewerProperties& _properties, - QGraphicsWidget* _parent=0, - const char* _name=0, - QStatusBar *_statusBar=0); + QGraphicsWidget* _parent=0); /// Destructor. virtual ~glViewer(); @@ -144,12 +141,6 @@ public: virtual QSize sizeHint () const; - /** Set status bar. - Sets the \c QStatusBar widget that is used for information - output, e.g. the frame rate of the rotation animation. - */ - void setStatusBar(QStatusBar* _sb); - /// Makes this widget the current widget for OpenGL operations. virtual void makeCurrent(); /// Swaps the screen contents with the off-screen buffer. @@ -164,6 +155,8 @@ public: signals : void functionMenuUpdate(); + void statusMessage (const QString & message, int timeout = 0); + public: /// Enable/disable mouse tracking (move events with no button press) @@ -450,7 +443,7 @@ private: glViewer& operator=(const glViewer&); // create widgets - void createWidgets(QStatusBar* _sb); + void createWidgets(); /* Recursively draws each node in the scene graph. Called by paintGL(). */ @@ -491,9 +484,6 @@ protected: // helper bool isRotating_; - // current status bar - QStatusBar* statusbar_; - //---------------------------------------------------------------- private data private: