#include "graphicsitems.h" #include // 可调整大小的矩形(按钮)实现 ResizableRectangle::ResizableRectangle(qreal x, qreal y, qreal w, qreal h) : ResizableShape(x, y, w, h) { m_name = "按钮"; m_pressedColor = Qt::green; m_releasedColor = Qt::yellow; this->setBrush(m_releasedColor); } // 可调整大小的椭圆(指示灯)实现 ResizableEllipse::ResizableEllipse(qreal x, qreal y, qreal w, qreal h) : ResizableShape(x, y, w, h) { m_name = "指示灯"; m_onColor = Qt::green; m_offColor = Qt::red; this->setBrush(m_onColor); } // 显式实例化模板类 template class ResizableShape; template class ResizableShape;