SET(_other_HEADERS
QtViewer.h
QtViewer_Object.h
+ QtViewer_PainterObject.h
)
# header files / to install
# sources / static
SET(_other_SOURCES
QtViewer_Object.cxx
+ QtViewer_PainterObject.cxx
QtViewer_Scene.cxx
QtViewer_Selector.cxx
QtViewer_ViewFrame.cxx
--- /dev/null
+#include "QtViewer_PainterObject.h"
+
+
+QtViewer_PainterObject::QtViewer_PainterObject()
+{
+}
+
+QtViewer_PainterObject::~QtViewer_PainterObject()
+{
+}
+
+void QtViewer_PainterObject::draw(QPainter* painter)
+{
+/*
+ painter->save();
+ painter->resetTransform();
+ double w1 = h/10.;
+ painter->setPen(QPen(Qt::black));
+ QRectF aRect(w-w1,h/4.,w1, h/2.);
+ painter->fillRect(aRect,QGradient::StarWine);
+ painter->drawRect(aRect);
+ painter->restore();
+*/
+}
--- /dev/null
+#ifndef QTVIEWER_PAINTEROBJECT_H
+#define QTVIEWER_PAINTEROBJECT_H
+
+#include "QtViewer.h"
+#include <QPainter>
+
+class QTVIEWER_API QtViewer_PainterObject
+{
+public:
+
+ QtViewer_PainterObject();
+ ~QtViewer_PainterObject();
+
+ virtual void draw(QPainter* painter);
+};
+#endif
#include "SUIT_ResourceMgr.h"
#include "SUIT_Session.h"
+#include "QtViewer_PainterObject.h"
+
//=======================================================================
// Name : QtViewer_ViewPort
// Purpose : Constructor
zoomCursor = nullptr;
}
+void QtViewer_ViewPort::drawForeground(QPainter *painter, const QRectF &rect)
+{
+ Q_UNUSED(rect);
+
+ for (QtViewer_PainterObject* obj : foregroundObjects)
+ obj->draw(painter);
+}
+
void QtViewer_ViewPort::addItem( QGraphicsItem* theItem )
{
scene()->addItem(theItem);
}
previousPos = currentPos;
-
+ viewport()->update();
}
else if (zooming && (event->buttons() & Qt::LeftButton))
{
zooming = false;
globalPanning = false;
setCursor(Qt::SizeAllCursor);
+ viewport()->update();
}
void QtViewer_ViewPort::activateGlobalPanAction()
#include "QtViewer.h"
#include <QGraphicsView>
+class QtViewer_PainterObject;
class QRubberBand;
/*
QImage dumpView(bool theWholeScene = false, QSizeF theSize = QSizeF());
bool dumpViewToFormat(const QString& fileName, const QString& format);
+ void addForegroundObject(QtViewer_PainterObject* obj) { foregroundObjects.append(obj); }
signals:
void vpMouseEvent(QMouseEvent*);
virtual void wheelEvent(QWheelEvent *event);
virtual void keyPressEvent(QKeyEvent *event);
+ virtual void drawForeground(QPainter *painter, const QRectF &rect);
+
void clearActions();
private:
bool globalPanning;
QPoint previousPos;
QCursor* zoomCursor;
+
+ QList<QtViewer_PainterObject*> foregroundObjects;
};
#endif