ok .. here's the code:
scene class (not complete..):
/**
*
*
*/
{
Q_OBJECT
public:
~CScene();
CViewHelper* getHelper();
CViewMarker* getMarker();
void clearAll(void);
void clearSelected(void);
void clearAuxiliary(void);
bool isPrinting(void);
protected:
private:
CViewHelper* _helper;
CViewMarker* _marker;
// and some other private attributes ...
};
/**
*
*
*/
class CScene : public QGraphicsScene
{
Q_OBJECT
public:
CScene(QObject* parent = NULL);
~CScene();
CViewHelper* getHelper();
CViewMarker* getMarker();
void clearAll(void);
void clearSelected(void);
void clearAuxiliary(void);
void print(QPrinter* printer);
bool isPrinting(void);
protected:
virtual void drawForeground(QPainter* painter, const QRectF & rect);
virtual void drawBackground(QPainter* painter, const QRectF & rect);
private:
CViewHelper* _helper;
CViewMarker* _marker;
// and some other private attributes ...
};
To copy to clipboard, switch view to plain text mode
the definition of drawForeground:
{
printf(" >>>> SCENE ---> draw foreground\n");
// draw helper
if (_helper->isEnabled())
_helper->draw(painter);
// draw marks
if (_marker->isEnabled())
_marker->draw(painter);
}
void CScene::drawForeground(QPainter* painter, const QRectF & rect)
{
printf(" >>>> SCENE ---> draw foreground\n");
// draw helper
if (_helper->isEnabled())
_helper->draw(painter);
// draw marks
if (_marker->isEnabled())
_marker->draw(painter);
}
To copy to clipboard, switch view to plain text mode
I'am trying to redraw scene foreground by mouse move event (just now, for debugging). CGView is derived from QGraphicsView.
{
_ddirector->mouseMove(event);
scene()->invalidate(scene()->sceneRect(), CScene::ForegroundLayer);
}
void CGView::mouseMoveEvent(QMouseEvent *event)
{
_ddirector->mouseMove(event);
scene()->invalidate(scene()->sceneRect(), CScene::ForegroundLayer);
}
To copy to clipboard, switch view to plain text mode
anyway, thanks for trying me to help ...
Bookmarks