codepad
[
create a new paste
]
login
|
about
Language:
C
C++
D
Haskell
Lua
OCaml
PHP
Perl
Plain Text
Python
Ruby
Scheme
Tcl
Собственно item: template<typename T, EGraphicsItemType K> class AniGraphicsItemTemplate : public AniGraphicsItemBaseClean { public: std::unique_ptr<AniAbstractPainterInterface > controller; private: EGraphicsItemType type; }; template<typename T, EGraphicsItemType K> void AniGraphicsItemTemplate<T, K>::paint(QPainter * painter, const QStyleOptionGraphicsItem * option, QWidget * widget) throw() { // Bouml preserved body begin 000E2F2A controller->paint(this, painter, option, widget); // Bouml preserved body end 000E2F2A } А контроллер объявляется как: template<class T, class K> class AniPaintControllerTemplate : public AniAbstractPainterBase { public: AniPaintControllerTemplate(const T & _dataSource, const AniScaleVector<QPainterPath, std::vector<QPainterPath>> & _path, const AniScaleVector<QPainterPath, std::vector<QPainterPath>> & _shape, const AniScaleVector <QRectF, std::vector<QRectF>> & _rect) throw(); private: T dataSource; QPainterPath shapeFigure; QPainterPathpath; QRectF rect; static K* settings; }; Как можно заметить за функцией отрисовки обращение следует в ещё один шаблонный класс где собственно и объявлена её специализация. С загрузкой path,shape... etc дело обстоит точно так же. template<class T, class K> void AniPaintControllerTemplate<T, K>::paint(QGraphicsItem * item, QPainter * painter, const QStyleOptionGraphicsItem * option, QWidget * widget) throw() { // Bouml preserved body begin 000EE6AA ObjectPainter<T,K>::PaintObject(this, item, painter, option, widget); // Bouml preserved body end 000EE6AA }
Private
[
?
]
Run code
Submit