Frontend to the famous GRBL.

graphicspictureitem.cpp 958B

    /* Part of x2grbl * * Copyright Johann Wilhelm <johann.wilhelm@9mal6.de> 2015 * * see Readme.md for detailed license and usage information! */ #include "graphicspictureitem.h" #include <QPainter> #include <QRectF> GraphicsPictureItem::GraphicsPictureItem(QGraphicsItem *parent) : QGraphicsItem(parent) { setFlags(QGraphicsItem::ItemIsMovable | QGraphicsItem::ItemIsSelectable); } void GraphicsPictureItem::setPicture(QPicture Picture_) { Picture=Picture_; } GraphicsPictureItem::GraphicsPictureItem(QPicture Picture_, QGraphicsItem *parent) : QGraphicsItem(parent) { Picture=Picture_; } QRectF GraphicsPictureItem::boundingRect () const { QRectF rect=Picture.boundingRect(); return rect; } void GraphicsPictureItem::paint ( QPainter * painter, const QStyleOptionGraphicsItem * option, QWidget * widget ) { Picture.play(painter); } void GraphicsPictureItem::clear() { Picture=QPicture(); }