1 Star 3 Fork 2

loong/BackupConfigure

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
baseitem.h 2.42 KB
一键复制 编辑 原始数据 按行查看 历史
loong 提交于 2021-03-25 18:06 . Initial commit
#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
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/kingofloong/BackupConfigure.git
git@gitee.com:kingofloong/BackupConfigure.git
kingofloong
BackupConfigure
BackupConfigure
master

搜索帮助