⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 qgraphicsitem.h

📁 奇趣公司比较新的qt/emd版本
💻 H
📖 第 1 页 / 共 3 页
字号:
/******************************************************************************** Copyright (C) 1992-2007 Trolltech ASA. All rights reserved.**** This file is part of the QtGui module of the Qt Toolkit.**** This file may be used under the terms of the GNU General Public** License version 2.0 as published by the Free Software Foundation** and appearing in the file LICENSE.GPL included in the packaging of** this file.  Please review the following information to ensure GNU** General Public Licensing requirements will be met:** http://trolltech.com/products/qt/licenses/licensing/opensource/**** If you are unsure which license is appropriate for your use, please** review the following information:** http://trolltech.com/products/qt/licenses/licensing/licensingoverview** or contact the sales department at sales@trolltech.com.**** In addition, as a special exception, Trolltech gives you certain** additional rights. These rights are described in the Trolltech GPL** Exception version 1.0, which can be found at** http://www.trolltech.com/products/qt/gplexception/ and in the file** GPL_EXCEPTION.txt in this package.**** In addition, as a special exception, Trolltech, as the sole copyright** holder for Qt Designer, grants users of the Qt/Eclipse Integration** plug-in the right for the Qt/Eclipse Integration to link to** functionality provided by Qt Designer and its related libraries.**** Trolltech reserves all rights not expressly granted herein.**** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.******************************************************************************/#ifndef QGRAPHICSITEM_H#define QGRAPHICSITEM_H#include <QtCore/qglobal.h>#include <QtCore/qobject.h>#include <QtCore/qvariant.h>#include <QtCore/qrect.h>#include <QtGui/qpainterpath.h>#include <QtGui/qpixmap.h>QT_BEGIN_HEADERQT_MODULE(Gui)#if !defined(QT_NO_GRAPHICSVIEW) || (QT_EDITION & QT_MODULE_GRAPHICSVIEW) != QT_MODULE_GRAPHICSVIEWclass QBrush;class QCursor;class QFocusEvent;class QGraphicsItemGroup;class QGraphicsSceneContextMenuEvent;class QGraphicsSceneDragDropEvent;class QGraphicsSceneEvent;class QGraphicsSceneHoverEvent;class QGraphicsSceneMouseEvent;class QGraphicsSceneWheelEvent;class QGraphicsScene;class QInputMethodEvent;class QKeyEvent;class QMatrix;class QMenu;class QPainter;class QPen;class QPointF;class QRectF;class QStyleOptionGraphicsItem;class QGraphicsItemPrivate;class Q_GUI_EXPORT QGraphicsItem{public:    enum GraphicsItemFlag {        ItemIsMovable = 0x1,        ItemIsSelectable = 0x2,        ItemIsFocusable = 0x4,        ItemClipsToShape = 0x8,        ItemClipsChildrenToShape = 0x10,        ItemIgnoresTransformations = 0x20    };    Q_DECLARE_FLAGS(GraphicsItemFlags, GraphicsItemFlag)    enum GraphicsItemChange {        ItemPositionChange,        ItemMatrixChange,        ItemVisibleChange,        ItemEnabledChange,        ItemSelectedChange,        ItemParentChange,        ItemChildAddedChange,        ItemChildRemovedChange,        ItemTransformChange,        ItemPositionHasChanged,        ItemTransformHasChanged,        ItemSceneChange    };    QGraphicsItem(QGraphicsItem *parent = 0#ifndef Q_QDOC                  // obsolete argument                  , QGraphicsScene *scene = 0#endif        );    virtual ~QGraphicsItem();    QGraphicsScene *scene() const;    QGraphicsItem *parentItem() const;    QGraphicsItem *topLevelItem() const;    void setParentItem(QGraphicsItem *parent);    QList<QGraphicsItem *> children() const;    QGraphicsItemGroup *group() const;    void setGroup(QGraphicsItemGroup *group);    GraphicsItemFlags flags() const;    void setFlag(GraphicsItemFlag flag, bool enabled = true);    void setFlags(GraphicsItemFlags flags);#ifndef QT_NO_TOOLTIP    QString toolTip() const;    void setToolTip(const QString &toolTip);#endif#ifndef QT_NO_CURSOR    QCursor cursor() const;    void setCursor(const QCursor &cursor);    bool hasCursor() const;    void unsetCursor();#endif    bool isVisible() const;    void setVisible(bool visible);    inline void hide() { setVisible(false); }    inline void show() { setVisible(true); }    bool isEnabled() const;    void setEnabled(bool enabled);    bool isSelected() const;    void setSelected(bool selected);    bool acceptDrops() const;    void setAcceptDrops(bool on);    Qt::MouseButtons acceptedMouseButtons() const;    void setAcceptedMouseButtons(Qt::MouseButtons buttons);    bool acceptsHoverEvents() const;    void setAcceptsHoverEvents(bool enabled);    bool handlesChildEvents() const;    void setHandlesChildEvents(bool enabled);    bool hasFocus() const;    void setFocus(Qt::FocusReason focusReason = Qt::OtherFocusReason);    void clearFocus();    // Positioning in scene coordinates    QPointF pos() const;    inline qreal x() const { return pos().x(); }    inline qreal y() const { return pos().y(); }    QPointF scenePos() const;    void setPos(const QPointF &pos);    inline void setPos(qreal x, qreal y);    inline void moveBy(qreal dx, qreal dy) { setPos(pos().x() + dx, pos().y() + dy); }    void ensureVisible(const QRectF &rect = QRectF(), int xmargin = 50, int ymargin = 50);    inline void ensureVisible(qreal x, qreal y, qreal w, qreal h, int xmargin = 50, int ymargin = 50);    // Local transformation    QMatrix matrix() const;    QMatrix sceneMatrix() const;    void setMatrix(const QMatrix &matrix, bool combine = false);    void resetMatrix();    QTransform transform() const;    QTransform sceneTransform() const;    QTransform deviceTransform(const QTransform &viewportTransform) const;    void setTransform(const QTransform &matrix, bool combine = false);    void resetTransform();        void rotate(qreal angle);    void scale(qreal sx, qreal sy);    void shear(qreal sh, qreal sv);    void translate(qreal dx, qreal dy);    virtual void advance(int phase);    // Stacking order    qreal zValue() const;    void setZValue(qreal z);    // Hit test    virtual QRectF boundingRect() const = 0;    QRectF childrenBoundingRect() const;    QRectF sceneBoundingRect() const;    virtual QPainterPath shape() const;    virtual bool contains(const QPointF &point) const;    virtual bool collidesWithItem(const QGraphicsItem *other, Qt::ItemSelectionMode mode = Qt::IntersectsItemShape) const;    virtual bool collidesWithPath(const QPainterPath &path, Qt::ItemSelectionMode mode = Qt::IntersectsItemShape) const;    QList<QGraphicsItem *> collidingItems(Qt::ItemSelectionMode mode = Qt::IntersectsItemShape) const;    bool isObscured() const;    bool isObscured(const QRectF &rect) const; // ### Qt 5: merge with isObscured(), add QRectF arg to isObscuredBy()    inline bool isObscured(qreal x, qreal y, qreal w, qreal h) const;    virtual bool isObscuredBy(const QGraphicsItem *item) const;    virtual QPainterPath opaqueArea() const;    // Drawing    virtual void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget = 0) = 0;    void update(const QRectF &rect = QRectF());    inline void update(qreal x, qreal y, qreal width, qreal height);    // Coordinate mapping    QPointF mapToItem(const QGraphicsItem *item, const QPointF &point) const;    QPointF mapToParent(const QPointF &point) const;    QPointF mapToScene(const QPointF &point) const;    QPolygonF mapToItem(const QGraphicsItem *item, const QRectF &rect) const;    QPolygonF mapToParent(const QRectF &rect) const;    QPolygonF mapToScene(const QRectF &rect) const;    QPolygonF mapToItem(const QGraphicsItem *item, const QPolygonF &polygon) const;    QPolygonF mapToParent(const QPolygonF &polygon) const;    QPolygonF mapToScene(const QPolygonF &polygon) const;    QPainterPath mapToItem(const QGraphicsItem *item, const QPainterPath &path) const;    QPainterPath mapToParent(const QPainterPath &path) const;    QPainterPath mapToScene(const QPainterPath &path) const;    QPointF mapFromItem(const QGraphicsItem *item, const QPointF &point) const;    QPointF mapFromParent(const QPointF &point) const;    QPointF mapFromScene(const QPointF &point) const;    QPolygonF mapFromItem(const QGraphicsItem *item, const QRectF &rect) const;    QPolygonF mapFromParent(const QRectF &rect) const;    QPolygonF mapFromScene(const QRectF &rect) const;    QPolygonF mapFromItem(const QGraphicsItem *item, const QPolygonF &polygon) const;    QPolygonF mapFromParent(const QPolygonF &polygon) const;    QPolygonF mapFromScene(const QPolygonF &polygon) const;    QPainterPath mapFromItem(const QGraphicsItem *item, const QPainterPath &path) const;    QPainterPath mapFromParent(const QPainterPath &path) const;    QPainterPath mapFromScene(const QPainterPath &path) const;    inline QPointF mapToItem(const QGraphicsItem *item, qreal x, qreal y) const;    inline QPointF mapToParent(qreal x, qreal y) const;    inline QPointF mapToScene(qreal x, qreal y) const;    inline QPolygonF mapToItem(const QGraphicsItem *item, qreal x, qreal y, qreal w, qreal h) const;    inline QPolygonF mapToParent(qreal x, qreal y, qreal w, qreal h) const;    inline QPolygonF mapToScene(qreal x, qreal y, qreal w, qreal h) const;    inline QPointF mapFromItem(const QGraphicsItem *item, qreal x, qreal y) const;    inline QPointF mapFromParent(qreal x, qreal y) const;    inline QPointF mapFromScene(qreal x, qreal y) const;    inline QPolygonF mapFromItem(const QGraphicsItem *item, qreal x, qreal y, qreal w, qreal h) const;    inline QPolygonF mapFromParent(qreal x, qreal y, qreal w, qreal h) const;    inline QPolygonF mapFromScene(qreal x, qreal y, qreal w, qreal h) const;    bool isAncestorOf(const QGraphicsItem *child) const;    // Custom data    QVariant data(int key) const;    void setData(int key, const QVariant &value);    enum {        Type = 1,        UserType = 65536    };    virtual int type() const;    void installSceneEventFilter(QGraphicsItem *filterItem);    void removeSceneEventFilter(QGraphicsItem *filterItem);protected:    virtual bool sceneEventFilter(QGraphicsItem *watched, QEvent *event);    virtual bool sceneEvent(QEvent *event);    virtual void contextMenuEvent(QGraphicsSceneContextMenuEvent *event);    virtual void dragEnterEvent(QGraphicsSceneDragDropEvent *event);    virtual void dragLeaveEvent(QGraphicsSceneDragDropEvent *event);    virtual void dragMoveEvent(QGraphicsSceneDragDropEvent *event);    virtual void dropEvent(QGraphicsSceneDragDropEvent *event);    virtual void focusInEvent(QFocusEvent *event);    virtual void focusOutEvent(QFocusEvent *event);    virtual void hoverEnterEvent(QGraphicsSceneHoverEvent *event);    virtual void hoverMoveEvent(QGraphicsSceneHoverEvent *event);    virtual void hoverLeaveEvent(QGraphicsSceneHoverEvent *event);    virtual void keyPressEvent(QKeyEvent *event);    virtual void keyReleaseEvent(QKeyEvent *event);    virtual void mousePressEvent(QGraphicsSceneMouseEvent *event);    virtual void mouseMoveEvent(QGraphicsSceneMouseEvent *event);    virtual void mouseReleaseEvent(QGraphicsSceneMouseEvent *event);    virtual void mouseDoubleClickEvent(QGraphicsSceneMouseEvent *event);    virtual void wheelEvent(QGraphicsSceneWheelEvent *event);    virtual void inputMethodEvent(QInputMethodEvent *event);    virtual QVariant inputMethodQuery(Qt::InputMethodQuery query) const;    virtual QVariant itemChange(GraphicsItemChange change, const QVariant &value);    enum Extension {        UserExtension = 0x80000000    };    virtual bool supportsExtension(Extension extension) const;    virtual void setExtension(Extension extension, const QVariant &variant);    virtual QVariant extension(const QVariant &variant) const;protected:    QGraphicsItem(QGraphicsItemPrivate &dd,

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -