Changeset 561 for trunk/src/gui/graphicsview/qgraphicsitem.h
- Timestamp:
- Feb 11, 2010, 11:19:06 PM (15 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk
-
Property svn:mergeinfo
set to (toggle deleted branches)
/branches/vendor/nokia/qt/4.6.1 merged eligible /branches/vendor/nokia/qt/current merged eligible /branches/vendor/trolltech/qt/current 3-149
-
Property svn:mergeinfo
set to (toggle deleted branches)
-
trunk/src/gui/graphicsview/qgraphicsitem.h
r2 r561 2 2 ** 3 3 ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). 4 ** Contact: Qt Software Information (qt-info@nokia.com) 4 ** All rights reserved. 5 ** Contact: Nokia Corporation (qt-info@nokia.com) 5 6 ** 6 7 ** This file is part of the QtGui module of the Qt Toolkit. … … 21 22 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. 22 23 ** 23 ** In addition, as a special exception, Nokia gives you certain 24 ** additional rights. These rights are described in the Nokia Qt LGPL 25 ** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this 26 ** package. 24 ** In addition, as a special exception, Nokia gives you certain additional 25 ** rights. These rights are described in the Nokia Qt LGPL Exception 26 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. 27 27 ** 28 28 ** GNU General Public License Usage … … 34 34 ** met: http://www.gnu.org/copyleft/gpl.html. 35 35 ** 36 ** If you are unsure which license is appropriate for your use, please37 ** contact the sales department at qt-sales@nokia.com.36 ** If you have questions regarding the use of this file, please contact 37 ** Nokia at qt-info@nokia.com. 38 38 ** $QT_END_LICENSE$ 39 39 ** … … 47 47 #include <QtCore/qvariant.h> 48 48 #include <QtCore/qrect.h> 49 #include <QtCore/qscopedpointer.h> 49 50 #include <QtGui/qpainterpath.h> 50 51 #include <QtGui/qpixmap.h> … … 63 64 class QCursor; 64 65 class QFocusEvent; 66 class QGraphicsEffect; 65 67 class QGraphicsItemGroup; 68 class QGraphicsObject; 66 69 class QGraphicsSceneContextMenuEvent; 67 70 class QGraphicsSceneDragDropEvent; … … 71 74 class QGraphicsSceneWheelEvent; 72 75 class QGraphicsScene; 76 class QGraphicsTransform; 73 77 class QGraphicsWidget; 74 78 class QInputMethodEvent; … … 95 99 ItemIgnoresParentOpacity = 0x40, 96 100 ItemDoesntPropagateOpacityToChildren = 0x80, 97 ItemStacksBehindParent = 0x100 101 ItemStacksBehindParent = 0x100, 102 ItemUsesExtendedStyleOption = 0x200, 103 ItemHasNoContents = 0x400, 104 ItemSendsGeometryChanges = 0x800, 105 ItemAcceptsInputMethod = 0x1000, 106 ItemNegativeZStacksBehindParent = 0x2000, 107 ItemIsPanel = 0x4000, 108 ItemIsFocusScope = 0x8000, // internal 109 ItemSendsScenePositionChanges = 0x10000 110 // NB! Don't forget to increase the d_ptr->flags bit field by 1 when adding a new flag. 98 111 }; 99 112 Q_DECLARE_FLAGS(GraphicsItemFlags, GraphicsItemFlag) … … 126 139 ItemZValueHasChanged, 127 140 ItemOpacityChange, 128 ItemOpacityHasChanged 141 ItemOpacityHasChanged, 142 ItemScenePositionHasChanged 129 143 }; 130 144 … … 135 149 }; 136 150 151 enum PanelModality 152 { 153 NonModal, 154 PanelModal, 155 SceneModal 156 }; 157 137 158 QGraphicsItem(QGraphicsItem *parent = 0 138 159 #ifndef Q_QDOC 139 // obsolete argument160 // ### obsolete argument 140 161 , QGraphicsScene *scene = 0 141 162 #endif … … 147 168 QGraphicsItem *parentItem() const; 148 169 QGraphicsItem *topLevelItem() const; 170 QGraphicsObject *parentObject() const; 149 171 QGraphicsWidget *parentWidget() const; 150 172 QGraphicsWidget *topLevelWidget() const; 151 173 QGraphicsWidget *window() const; 174 QGraphicsItem *panel() const; 152 175 void setParentItem(QGraphicsItem *parent); 153 176 QList<QGraphicsItem *> children() const; // ### obsolete … … 155 178 bool isWidget() const; 156 179 bool isWindow() const; 180 bool isPanel() const; 181 182 QGraphicsObject *toGraphicsObject(); 183 const QGraphicsObject *toGraphicsObject() const; 157 184 158 185 QGraphicsItemGroup *group() const; … … 165 192 CacheMode cacheMode() const; 166 193 void setCacheMode(CacheMode mode, const QSize &cacheSize = QSize()); 194 195 PanelModality panelModality() const; 196 void setPanelModality(PanelModality panelModality); 197 bool isBlockedByModalPanel(QGraphicsItem **blockingPanel = 0) const; 167 198 168 199 #ifndef QT_NO_TOOLTIP … … 197 228 void setOpacity(qreal opacity); 198 229 230 #ifndef QT_NO_GRAPHICSEFFECT 231 // Effect 232 QGraphicsEffect *graphicsEffect() const; 233 void setGraphicsEffect(QGraphicsEffect *effect); 234 #endif //QT_NO_GRAPHICSEFFECT 235 199 236 Qt::MouseButtons acceptedMouseButtons() const; 200 237 void setAcceptedMouseButtons(Qt::MouseButtons buttons); 201 238 202 bool acceptsHoverEvents() const; // obsolete203 void setAcceptsHoverEvents(bool enabled); // obsolete239 bool acceptsHoverEvents() const; // ### obsolete 240 void setAcceptsHoverEvents(bool enabled); // ### obsolete 204 241 bool acceptHoverEvents() const; 205 242 void setAcceptHoverEvents(bool enabled); 243 bool acceptTouchEvents() const; 244 void setAcceptTouchEvents(bool enabled); 245 246 bool filtersChildEvents() const; 247 void setFiltersChildEvents(bool enabled); 206 248 207 249 bool handlesChildEvents() const; 208 250 void setHandlesChildEvents(bool enabled); 251 252 bool isActive() const; 253 void setActive(bool active); 209 254 210 255 bool hasFocus() const; 211 256 void setFocus(Qt::FocusReason focusReason = Qt::OtherFocusReason); 212 257 void clearFocus(); 258 259 QGraphicsItem *focusProxy() const; 260 void setFocusProxy(QGraphicsItem *item); 261 262 QGraphicsItem *focusItem() const; 263 QGraphicsItem *focusScopeItem() const; 213 264 214 265 void grabMouse(); … … 220 271 QPointF pos() const; 221 272 inline qreal x() const { return pos().x(); } 273 void setX(qreal x); 222 274 inline qreal y() const { return pos().y(); } 275 void setY(qreal y); 223 276 QPointF scenePos() const; 224 277 void setPos(const QPointF &pos); … … 240 293 void setTransform(const QTransform &matrix, bool combine = false); 241 294 void resetTransform(); 242 243 void rotate(qreal angle); 244 void scale(qreal sx, qreal sy); 245 void shear(qreal sh, qreal sv); 246 void translate(qreal dx, qreal dy); 295 296 void rotate(qreal angle); // ### obsolete 297 void scale(qreal sx, qreal sy); // ### obsolete 298 void shear(qreal sh, qreal sv); // ### obsolete 299 void translate(qreal dx, qreal dy); // ### obsolete 300 301 void setRotation(qreal angle); 302 qreal rotation() const; 303 304 void setScale(qreal scale); 305 qreal scale() const; 306 307 QList<QGraphicsTransform *> transformations() const; 308 void setTransformations(const QList<QGraphicsTransform *> &transformations); 309 310 QPointF transformOriginPoint() const; 311 void setTransformOriginPoint(const QPointF &origin); 312 inline void setTransformOriginPoint(qreal ax, qreal ay) 313 { setTransformOriginPoint(QPointF(ax,ay)); } 314 247 315 virtual void advance(int phase); 248 316 … … 250 318 qreal zValue() const; 251 319 void setZValue(qreal z); 320 void stackBefore(const QGraphicsItem *sibling); 252 321 253 322 // Hit test … … 337 406 void setData(int key, const QVariant &value); 338 407 408 Qt::InputMethodHints inputMethodHints() const; 409 void setInputMethodHints(Qt::InputMethodHints hints); 410 339 411 enum { 340 412 Type = 1, … … 381 453 QGraphicsItem(QGraphicsItemPrivate &dd, 382 454 QGraphicsItem *parent, QGraphicsScene *scene); 383 Q GraphicsItemPrivate *d_ptr;455 QScopedPointer<QGraphicsItemPrivate> d_ptr; 384 456 385 457 void addToIndex(); … … 394 466 friend class QGraphicsScenePrivate; 395 467 friend class QGraphicsSceneFindItemBspTreeVisitor; 468 friend class QGraphicsSceneBspTree; 396 469 friend class QGraphicsView; 397 470 friend class QGraphicsViewPrivate; 471 friend class QGraphicsObject; 398 472 friend class QGraphicsWidget; 399 473 friend class QGraphicsWidgetPrivate; 400 474 friend class QGraphicsProxyWidgetPrivate; 475 friend class QGraphicsSceneIndex; 476 friend class QGraphicsSceneIndexPrivate; 477 friend class QGraphicsSceneBspTreeIndex; 478 friend class QGraphicsSceneBspTreeIndexPrivate; 479 friend class QGraphicsItemEffectSourcePrivate; 480 friend class QGraphicsTransformPrivate; 481 friend class QGestureManager; 401 482 friend class ::tst_QGraphicsItem; 402 483 friend bool qt_closestLeaf(const QGraphicsItem *, const QGraphicsItem *); … … 405 486 406 487 Q_DECLARE_OPERATORS_FOR_FLAGS(QGraphicsItem::GraphicsItemFlags) 488 Q_DECLARE_INTERFACE(QGraphicsItem, "com.trolltech.Qt.QGraphicsItem") 407 489 408 490 inline void QGraphicsItem::setPos(qreal ax, qreal ay) … … 451 533 { return mapRectFromScene(QRectF(ax, ay, w, h)); } 452 534 535 536 class Q_GUI_EXPORT QGraphicsObject : public QObject, public QGraphicsItem 537 { 538 Q_OBJECT 539 Q_PROPERTY(QGraphicsObject * parent READ parentObject WRITE setParentItem NOTIFY parentChanged DESIGNABLE false) 540 Q_PROPERTY(qreal opacity READ opacity WRITE setOpacity NOTIFY opacityChanged FINAL) 541 Q_PROPERTY(bool enabled READ isEnabled WRITE setEnabled NOTIFY enabledChanged) 542 Q_PROPERTY(bool visible READ isVisible WRITE setVisible NOTIFY visibleChanged FINAL) 543 Q_PROPERTY(QPointF pos READ pos WRITE setPos) 544 Q_PROPERTY(qreal x READ x WRITE setX NOTIFY xChanged) 545 Q_PROPERTY(qreal y READ y WRITE setY NOTIFY yChanged) 546 Q_PROPERTY(qreal z READ zValue WRITE setZValue NOTIFY zChanged) 547 Q_PROPERTY(qreal rotation READ rotation WRITE setRotation NOTIFY rotationChanged) 548 Q_PROPERTY(qreal scale READ scale WRITE setScale NOTIFY scaleChanged) 549 Q_PROPERTY(QPointF transformOriginPoint READ transformOriginPoint WRITE setTransformOriginPoint) 550 Q_INTERFACES(QGraphicsItem) 551 public: 552 QGraphicsObject(QGraphicsItem *parent = 0); 553 554 // ### Qt 5: Disambiguate 555 #ifdef Q_NO_USING_KEYWORD 556 const QObjectList &children() const { return QObject::children(); } 557 #else 558 using QObject::children; 559 #endif 560 561 void grabGesture(Qt::GestureType type, Qt::GestureFlags flags = Qt::GestureFlags()); 562 void ungrabGesture(Qt::GestureType type); 563 564 Q_SIGNALS: 565 void parentChanged(); 566 void opacityChanged(); 567 void visibleChanged(); 568 void enabledChanged(); 569 void xChanged(); 570 void yChanged(); 571 void zChanged(); 572 void rotationChanged(); 573 void scaleChanged(); 574 575 protected: 576 QGraphicsObject(QGraphicsItemPrivate &dd, QGraphicsItem *parent, QGraphicsScene *scene); 577 private: 578 friend class QGraphicsItem; 579 friend class QGraphicsItemPrivate; 580 }; 581 582 453 583 class QAbstractGraphicsShapeItemPrivate; 454 584 class Q_GUI_EXPORT QAbstractGraphicsShapeItem : public QGraphicsItem … … 457 587 QAbstractGraphicsShapeItem(QGraphicsItem *parent = 0 458 588 #ifndef Q_QDOC 459 // obsolete argument589 // ### obsolete argument 460 590 , QGraphicsScene *scene = 0 461 591 #endif … … 487 617 QGraphicsPathItem(QGraphicsItem *parent = 0 488 618 #ifndef Q_QDOC 489 // obsolete argument619 // ### obsolete argument 490 620 , QGraphicsScene *scene = 0 491 621 #endif … … 493 623 QGraphicsPathItem(const QPainterPath &path, QGraphicsItem *parent = 0 494 624 #ifndef Q_QDOC 495 // obsolete argument625 // ### obsolete argument 496 626 , QGraphicsScene *scene = 0 497 627 #endif … … 530 660 QGraphicsRectItem(QGraphicsItem *parent = 0 531 661 #ifndef Q_QDOC 532 // obsolete argument662 // ### obsolete argument 533 663 , QGraphicsScene *scene = 0 534 664 #endif … … 536 666 QGraphicsRectItem(const QRectF &rect, QGraphicsItem *parent = 0 537 667 #ifndef Q_QDOC 538 // obsolete argument668 // ### obsolete argument 539 669 , QGraphicsScene *scene = 0 540 670 #endif … … 542 672 QGraphicsRectItem(qreal x, qreal y, qreal w, qreal h, QGraphicsItem *parent = 0 543 673 #ifndef Q_QDOC 544 // obsolete argument674 // ### obsolete argument 545 675 , QGraphicsScene *scene = 0 546 676 #endif … … 583 713 QGraphicsEllipseItem(QGraphicsItem *parent = 0 584 714 #ifndef Q_QDOC 585 // obsolete argument715 // ### obsolete argument 586 716 , QGraphicsScene *scene = 0 587 717 #endif … … 589 719 QGraphicsEllipseItem(const QRectF &rect, QGraphicsItem *parent = 0 590 720 #ifndef Q_QDOC 591 // obsolete argument721 // ### obsolete argument 592 722 , QGraphicsScene *scene = 0 593 723 #endif … … 595 725 QGraphicsEllipseItem(qreal x, qreal y, qreal w, qreal h, QGraphicsItem *parent = 0 596 726 #ifndef Q_QDOC 597 // obsolete argument727 // ### obsolete argument 598 728 , QGraphicsScene *scene = 0 599 729 #endif … … 642 772 QGraphicsPolygonItem(QGraphicsItem *parent = 0 643 773 #ifndef Q_QDOC 644 // obsolete argument774 // ### obsolete argument 645 775 , QGraphicsScene *scene = 0 646 776 #endif … … 649 779 QGraphicsItem *parent = 0 650 780 #ifndef Q_QDOC 651 // obsolete argument781 // ### obsolete argument 652 782 , QGraphicsScene *scene = 0 653 783 #endif … … 689 819 QGraphicsLineItem(QGraphicsItem *parent = 0 690 820 #ifndef Q_QDOC 691 // obsolete argument821 // ### obsolete argument 692 822 , QGraphicsScene *scene = 0 693 823 #endif … … 695 825 QGraphicsLineItem(const QLineF &line, QGraphicsItem *parent = 0 696 826 #ifndef Q_QDOC 697 // obsolete argument827 // ### obsolete argument 698 828 , QGraphicsScene *scene = 0 699 829 #endif … … 701 831 QGraphicsLineItem(qreal x1, qreal y1, qreal x2, qreal y2, QGraphicsItem *parent = 0 702 832 #ifndef Q_QDOC 703 // obsolete argument833 // ### obsolete argument 704 834 , QGraphicsScene *scene = 0 705 835 #endif … … 749 879 QGraphicsPixmapItem(QGraphicsItem *parent = 0 750 880 #ifndef Q_QDOC 751 // obsolete argument881 // ### obsolete argument 752 882 , QGraphicsScene *scene = 0 753 883 #endif … … 755 885 QGraphicsPixmapItem(const QPixmap &pixmap, QGraphicsItem *parent = 0 756 886 #ifndef Q_QDOC 757 // obsolete argument887 // ### obsolete argument 758 888 , QGraphicsScene *scene = 0 759 889 #endif … … 802 932 class QTextDocument; 803 933 class QTextCursor; 804 class Q_GUI_EXPORT QGraphicsTextItem : public Q Object, public QGraphicsItem934 class Q_GUI_EXPORT QGraphicsTextItem : public QGraphicsObject 805 935 { 806 936 Q_OBJECT … … 811 941 QGraphicsTextItem(QGraphicsItem *parent = 0 812 942 #ifndef Q_QDOC 813 // obsolete argument943 // ### obsolete argument 814 944 , QGraphicsScene *scene = 0 815 945 #endif … … 817 947 QGraphicsTextItem(const QString &text, QGraphicsItem *parent = 0 818 948 #ifndef Q_QDOC 819 // obsolete argument949 // ### obsolete argument 820 950 , QGraphicsScene *scene = 0 821 951 #endif … … 912 1042 QGraphicsSimpleTextItem(QGraphicsItem *parent = 0 913 1043 #ifndef Q_QDOC 914 // obsolete argument1044 // ### obsolete argument 915 1045 , QGraphicsScene *scene = 0 916 1046 #endif … … 918 1048 QGraphicsSimpleTextItem(const QString &text, QGraphicsItem *parent = 0 919 1049 #ifndef Q_QDOC 920 // obsolete argument1050 // ### obsolete argument 921 1051 , QGraphicsScene *scene = 0 922 1052 #endif … … 958 1088 QGraphicsItemGroup(QGraphicsItem *parent = 0 959 1089 #ifndef Q_QDOC 960 // obsolete argument1090 // ### obsolete argument 961 1091 , QGraphicsScene *scene = 0 962 1092 #endif … … 995 1125 #ifndef QT_NO_DEBUG_STREAM 996 1126 Q_GUI_EXPORT QDebug operator<<(QDebug debug, QGraphicsItem *item); 1127 Q_GUI_EXPORT QDebug operator<<(QDebug debug, QGraphicsObject *item); 997 1128 Q_GUI_EXPORT QDebug operator<<(QDebug debug, QGraphicsItem::GraphicsItemChange change); 998 1129 Q_GUI_EXPORT QDebug operator<<(QDebug debug, QGraphicsItem::GraphicsItemFlag flag); … … 1014 1145 1015 1146 #endif // QGRAPHICSITEM_H 1016
Note:
See TracChangeset
for help on using the changeset viewer.