All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Defines
Signals | Public Member Functions | Protected Member Functions
SciFigs::PaintProgress Class Reference

Brief description of class still missing. More...

#include <PaintProgress.h>

Inheritance diagram for SciFigs::PaintProgress:
QGpCoreTools::AbstractProgress

List of all members.

Signals

void repaint ()

Public Member Functions

const QRect & boundingRect () const
bool isActive () const
QString message () const
void paint (QPainter &p, int w, int h)
 PaintProgress (QObject *parent=0)
void setActive (bool a)

Protected Member Functions

virtual void paint (QString caption, int value, int maximum)

Detailed Description

Brief description of class still missing.

Full description of class still missing


Constructor & Destructor Documentation

SciFigs::PaintProgress::PaintProgress ( QObject *  parent = 0)
  : QObject(parent)
{
  _active=false;
  _updateRect.setWidth(1);  // Init the size of rectangle. If not initialized, the
  _updateRect.setHeight(1); // update triggered by GraphContent::paintProgress()
                            // is never achieved.
}

Member Function Documentation

const QRect& SciFigs::PaintProgress::boundingRect ( ) const [inline]

Referenced by SciFigs::GraphContent::setProgressEnd().

{return _updateRect;}
bool SciFigs::PaintProgress::isActive ( ) const [inline]
{return _active;}
QString SciFigs::PaintProgress::message ( ) const [inline]
{return _msg;}
void SciFigs::PaintProgress::paint ( QPainter &  p,
int  w,
int  h 
)
{
  // Called only from gui thread, _msg and _updateRect are only touched by main thread.
  QFont f=p.font();
  f.setPointSize(8);
  p.setFont(f);
  QRect r=p.boundingRect(0, 0, w, h, Qt::TextWordWrap, _msg);
  int x=w/2-r.width()/2;
  int y=h/2-r.height()/2;
  p.setOpacity(0.7);
  p.setBrush(QBrush( Qt::white, Qt::SolidPattern) );
  p.setPen(Qt::NoPen);
  _updateRect.setTop(y-2);
  _updateRect.setLeft(x-2);
  _updateRect.setWidth(r.width()+4);
  _updateRect.setHeight(r.height()+4);
  p.drawRect(_updateRect);
  p.setOpacity(1.0);
  p.setPen(Qt::SolidLine);
  p.drawText(x, y, r.width(), r.height(), Qt::TextWordWrap, _msg);
}
void SciFigs::PaintProgress::paint ( QString  caption,
int  value,
int  maximum 
) [protected, virtual]

Only one function that can be called outside the main gui thread

Implements QGpCoreTools::AbstractProgress.

References repaint(), and QGpCoreTools::AbstractProgress::valueString().

{
  if(caption.isEmpty()) {
    _msg=valueString(value, maximum);
  } else {
    _msg=caption +"\n"+valueString(value, maximum);
  }
  emit repaint();
}

Referenced by paint().

void SciFigs::PaintProgress::setActive ( bool  a) [inline]

Referenced by SciFigs::GraphContent::setProgressEnd().

{_active=a;}

The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Defines