Commit b6aa4298 authored by Jan Möbius's avatar Jan Möbius

Dennis: Provide statusMessage signal instead of using QStatusBar directly.

git-svn-id: http://www.openflipper.org/svnrepo/OpenFlipper/branches/Free@6656 383ad7c9-94d9-4d36-a494-682f7c89f535
parent 895e1508
......@@ -226,9 +226,7 @@ CoreWidget( QVector<ViewMode*>& _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<ViewMode*>& _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<ViewMode*>& _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)));
}
......
......@@ -63,7 +63,6 @@
#include <QLayout>
#include <QPushButton>
#include <QLabel>
#include <QStatusBar>
#include <QImage>
#include <QColorDialog>
#include <QFileDialog>
......@@ -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);
}
}
......
......@@ -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:
......
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