代码拉取完成,页面将自动刷新
#ifndef BASEITEM_H
#define BASEITEM_H
#include <QtGui>
#include <QGraphicsItem>
#include <QGraphicsScene>
#include <QGraphicsSceneMouseEvent>
class QMenu;
class RectItem;
class EllipseItem;
class GroupItem;
class BaseItem
: public QGraphicsItem
{
public:
enum HoverPos
{
None, TopLeft, TopCenter, TopRight, LeftCenter, RightCenter, BottomLeft, BottomCenter, BottomRight
};
enum ItemType
{
RectangleItemType, EllipseItemType
};//��ʱû�õ�
BaseItem(QGraphicsItem *parent = nullptr);
// BaseItem()
~BaseItem();
QPen pen() const;
virtual void setPen(const QPen &pen);
virtual void setPen(const QColor &color);
virtual void setPen(const int width);
QBrush brush() const;
virtual void setBrush(const QBrush &brush);
virtual QRectF rect() const;
virtual void setRect(const QRectF &rect);
inline void setRect(qreal x, qreal y, qreal w, qreal h);
void mySetIsMemberOfGroup(bool enabled);
GroupItem *myGroup() const;
void mySetGroup(GroupItem *group);
enum
{
Type = QGraphicsItem::UserType + 2
};
int type() const;
static const QSizeF minSize;
protected:
virtual void hoverMoveEvent(QGraphicsSceneHoverEvent *event);
virtual void contextMenuEvent(QGraphicsSceneContextMenuEvent *event);
virtual void mousePressEvent(QGraphicsSceneMouseEvent *event);
virtual void mouseMoveEvent(QGraphicsSceneMouseEvent *event);
virtual void mouseReleaseEvent(QGraphicsSceneMouseEvent *event);
virtual void mouseDoubleClickEvent(QGraphicsSceneMouseEvent *event);
virtual void paintShape(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget = nullptr);
virtual void paintBoundingRect(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget = nullptr);
virtual void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget = nullptr);
mutable QRectF myBoundingRect;
QRectF myRect;
bool resizeHandlePressed;
HoverPos myHoverPosId;
static const int resizeHandleWidth = 6;
private:
QBrush myBrush;
QPen myPen;
bool IsMemberOfGroup;
};
inline void BaseItem::setRect(qreal ax, qreal ay, qreal w, qreal h)
{ setRect(QRectF(ax, ay, w, h)); }
QDataStream &operator<<(QDataStream &out, const BaseItem &baseitem);
QDataStream &operator>>(QDataStream &in, BaseItem &baseitem);
#endif // BASEITEM_H
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。