67 |
67 |
68 QT_BEGIN_NAMESPACE |
68 QT_BEGIN_NAMESPACE |
69 |
69 |
70 /*! |
70 /*! |
71 \qmlclass Transform QGraphicsTransform |
71 \qmlclass Transform QGraphicsTransform |
|
72 \ingroup qml-transform-elements |
72 \since 4.7 |
73 \since 4.7 |
73 \brief The Transform elements provide a way of building advanced transformations on Items. |
74 \brief The Transform elements provide a way of building advanced transformations on Items. |
74 |
75 |
75 The Transform element is a base type which cannot be instantiated directly. |
76 The Transform element is a base type which cannot be instantiated directly. |
76 The following concrete Transform types are available: |
77 The following concrete Transform types are available: |
129 The translation along the Y axis. |
131 The translation along the Y axis. |
130 */ |
132 */ |
131 |
133 |
132 /*! |
134 /*! |
133 \qmlclass Scale QGraphicsScale |
135 \qmlclass Scale QGraphicsScale |
|
136 \ingroup qml-transform-elements |
134 \since 4.7 |
137 \since 4.7 |
135 \brief The Scale element provides a way to scale an Item. |
138 \brief The Scale element provides a way to scale an Item. |
136 |
139 |
137 The Scale element gives more control over scaling than using \l Item's \l{Item::scale}{scale} property. Specifically, |
140 The Scale element gives more control over scaling than using \l Item's \l{Item::scale}{scale} property. Specifically, |
138 it allows a different scale for the x and y axes, and allows the scale to be relative to an |
141 it allows a different scale for the x and y axes, and allows the scale to be relative to an |
170 The scaling factor for the Y axis. |
173 The scaling factor for the Y axis. |
171 */ |
174 */ |
172 |
175 |
173 /*! |
176 /*! |
174 \qmlclass Rotation QGraphicsRotation |
177 \qmlclass Rotation QGraphicsRotation |
|
178 \ingroup qml-transform-elements |
175 \since 4.7 |
179 \since 4.7 |
176 \brief The Rotation object provides a way to rotate an Item. |
180 \brief The Rotation object provides a way to rotate an Item. |
177 |
181 |
178 The Rotation object gives more control over rotation than using \l Item's \l{Item::rotation}{rotation} property. |
182 The Rotation object gives more control over rotation than using \l Item's \l{Item::rotation}{rotation} property. |
179 Specifically, it allows (z axis) rotation to be relative to an arbitrary point. |
183 Specifically, it allows (z axis) rotation to be relative to an arbitrary point. |
223 \qmlproperty real Rotation::angle |
227 \qmlproperty real Rotation::angle |
224 |
228 |
225 The angle to rotate, in degrees clockwise. |
229 The angle to rotate, in degrees clockwise. |
226 */ |
230 */ |
227 |
231 |
228 /*! |
|
229 \internal |
|
230 \class QDeclarativeContents |
|
231 \brief The QDeclarativeContents class gives access to the height and width of an item's contents. |
|
232 |
|
233 */ |
|
234 QDeclarativeContents::QDeclarativeContents(QDeclarativeItem *item) : m_item(item), m_x(0), m_y(0), m_width(0), m_height(0) |
232 QDeclarativeContents::QDeclarativeContents(QDeclarativeItem *item) : m_item(item), m_x(0), m_y(0), m_width(0), m_height(0) |
235 { |
233 { |
236 //### optimize |
234 //### optimize |
237 connect(this, SIGNAL(rectChanged(QRectF)), m_item, SIGNAL(childrenRectChanged(QRectF))); |
235 connect(this, SIGNAL(rectChanged(QRectF)), m_item, SIGNAL(childrenRectChanged(QRectF))); |
238 } |
236 } |
417 } |
415 } |
418 |
416 |
419 |
417 |
420 /*! |
418 /*! |
421 \qmlclass KeyNavigation QDeclarativeKeyNavigationAttached |
419 \qmlclass KeyNavigation QDeclarativeKeyNavigationAttached |
|
420 \ingroup qml-basic-interaction-elements |
422 \since 4.7 |
421 \since 4.7 |
423 \brief The KeyNavigation attached property supports key navigation by arrow keys. |
422 \brief The KeyNavigation attached property supports key navigation by arrow keys. |
424 |
423 |
425 It is common in key-based UIs to use arrow keys to navigate |
424 It is common in key-based UIs to use arrow keys to navigate |
426 between focussed items. The KeyNavigation property provides a |
425 between focused items. The KeyNavigation property provides a |
427 convenient way of specifying which item will gain focus |
426 convenient way of specifying which item will gain focus |
428 when an arrow key is pressed. The following example provides |
427 when an arrow key is pressed. The following example provides |
429 key navigation for a 2x2 grid of items. |
428 key navigation for a 2x2 grid of items. |
430 |
429 |
431 \code |
430 \code |
711 if (!event->isAccepted()) QDeclarativeItemKeyFilter::keyReleased(event, post); |
722 if (!event->isAccepted()) QDeclarativeItemKeyFilter::keyReleased(event, post); |
712 } |
723 } |
713 |
724 |
714 /*! |
725 /*! |
715 \qmlclass Keys QDeclarativeKeysAttached |
726 \qmlclass Keys QDeclarativeKeysAttached |
|
727 \ingroup qml-basic-interaction-elements |
716 \since 4.7 |
728 \since 4.7 |
717 \brief The Keys attached property provides key handling to Items. |
729 \brief The Keys attached property provides key handling to Items. |
718 |
730 |
719 All visual primitives support key handling via the \e Keys |
731 All visual primitives support key handling via the \e Keys |
720 attached property. Keys can be handled via the \e onPressed |
732 attached property. Keys can be handled via the \e onPressed |
1296 |
1308 |
1297 */ |
1309 */ |
1298 |
1310 |
1299 /*! |
1311 /*! |
1300 \qmlclass Item QDeclarativeItem |
1312 \qmlclass Item QDeclarativeItem |
|
1313 \ingroup qml-basic-visual-elements |
1301 \since 4.7 |
1314 \since 4.7 |
1302 \brief The Item is the most basic of all visual items in QML. |
1315 \brief The Item is the most basic of all visual items in QML. |
1303 |
1316 |
1304 All visual items in Qt Declarative inherit from Item. Although Item |
1317 All visual items in Qt Declarative inherit from Item. Although Item |
1305 has no visual appearance, it defines all the properties that are |
1318 has no visual appearance, it defines all the properties that are |
1874 } else { |
1881 } else { |
1875 d->transformOriginDirty = true; |
1882 d->transformOriginDirty = true; |
1876 } |
1883 } |
1877 } |
1884 } |
1878 |
1885 |
|
1886 for(int ii = 0; ii < d->changeListeners.count(); ++ii) { |
|
1887 const QDeclarativeItemPrivate::ChangeListener &change = d->changeListeners.at(ii); |
|
1888 if (change.types & QDeclarativeItemPrivate::Geometry) |
|
1889 change.listener->itemGeometryChanged(this, newGeometry, oldGeometry); |
|
1890 } |
|
1891 |
1879 if (newGeometry.x() != oldGeometry.x()) |
1892 if (newGeometry.x() != oldGeometry.x()) |
1880 emit xChanged(); |
1893 emit xChanged(); |
1881 if (newGeometry.width() != oldGeometry.width()) |
1894 if (newGeometry.width() != oldGeometry.width()) |
1882 emit widthChanged(); |
1895 emit widthChanged(); |
1883 if (newGeometry.y() != oldGeometry.y()) |
1896 if (newGeometry.y() != oldGeometry.y()) |
1884 emit yChanged(); |
1897 emit yChanged(); |
1885 if (newGeometry.height() != oldGeometry.height()) |
1898 if (newGeometry.height() != oldGeometry.height()) |
1886 emit heightChanged(); |
1899 emit heightChanged(); |
1887 |
|
1888 for(int ii = 0; ii < d->changeListeners.count(); ++ii) { |
|
1889 const QDeclarativeItemPrivate::ChangeListener &change = d->changeListeners.at(ii); |
|
1890 if (change.types & QDeclarativeItemPrivate::Geometry) |
|
1891 change.listener->itemGeometryChanged(this, newGeometry, oldGeometry); |
|
1892 } |
|
1893 } |
1900 } |
1894 |
1901 |
1895 void QDeclarativeItemPrivate::removeItemChangeListener(QDeclarativeItemChangeListener *listener, ChangeTypes types) |
1902 void QDeclarativeItemPrivate::removeItemChangeListener(QDeclarativeItemChangeListener *listener, ChangeTypes types) |
1896 { |
1903 { |
1897 ChangeListener change(listener, types); |
1904 ChangeListener change(listener, types); |
2397 void QDeclarativeItemPrivate::focusChanged(bool flag) |
2404 void QDeclarativeItemPrivate::focusChanged(bool flag) |
2398 { |
2405 { |
2399 Q_Q(QDeclarativeItem); |
2406 Q_Q(QDeclarativeItem); |
2400 if (!(flags & QGraphicsItem::ItemIsFocusScope) && parent) |
2407 if (!(flags & QGraphicsItem::ItemIsFocusScope) && parent) |
2401 emit q->activeFocusChanged(flag); //see also QDeclarativeItemPrivate::subFocusItemChange() |
2408 emit q->activeFocusChanged(flag); //see also QDeclarativeItemPrivate::subFocusItemChange() |
2402 |
2409 emit q->focusChanged(flag); |
2403 bool inScope = false; |
2410 } |
2404 QGraphicsItem *p = parent; |
2411 |
2405 while (p) { |
|
2406 if (p->flags() & QGraphicsItem::ItemIsFocusScope) { |
|
2407 inScope = true; |
|
2408 break; |
|
2409 } |
|
2410 p = p->parentItem(); |
|
2411 } |
|
2412 if (!inScope) |
|
2413 emit q->focusChanged(flag); |
|
2414 } |
|
2415 |
|
2416 /*! \internal */ |
|
2417 QDeclarativeListProperty<QObject> QDeclarativeItemPrivate::resources() |
2412 QDeclarativeListProperty<QObject> QDeclarativeItemPrivate::resources() |
2418 { |
2413 { |
2419 return QDeclarativeListProperty<QObject>(q_func(), 0, QDeclarativeItemPrivate::resources_append, |
2414 return QDeclarativeListProperty<QObject>(q_func(), 0, QDeclarativeItemPrivate::resources_append, |
2420 QDeclarativeItemPrivate::resources_count, |
2415 QDeclarativeItemPrivate::resources_count, |
2421 QDeclarativeItemPrivate::resources_at); |
2416 QDeclarativeItemPrivate::resources_at); |
2502 /*! |
2495 /*! |
2503 \property QDeclarativeItem::clip |
2496 \property QDeclarativeItem::clip |
2504 This property holds whether clipping is enabled. |
2497 This property holds whether clipping is enabled. |
2505 |
2498 |
2506 if clipping is enabled, an item will clip its own painting, as well |
2499 if clipping is enabled, an item will clip its own painting, as well |
2507 as the painting of its children, to its bounding rectangle. |
2500 as the painting of its children, to its bounding rectangle. If you set |
|
2501 clipping during an item's paint operation, remember to re-set it to |
|
2502 prevent clipping the rest of your scene. |
2508 |
2503 |
2509 Non-rectangular clipping regions are not supported for performance reasons. |
2504 Non-rectangular clipping regions are not supported for performance reasons. |
2510 */ |
2505 */ |
2511 |
2506 |
2512 /*! |
2507 /*! |
2531 item to its base state by setting its current state to \c ''. |
2526 item to its base state by setting its current state to \c ''. |
2532 |
2527 |
2533 \sa {qmlstates}{States} |
2528 \sa {qmlstates}{States} |
2534 */ |
2529 */ |
2535 |
2530 |
2536 /*! \internal */ |
|
2537 QString QDeclarativeItemPrivate::state() const |
2531 QString QDeclarativeItemPrivate::state() const |
2538 { |
2532 { |
2539 if (!_stateGroup) |
2533 if (!_stateGroup) |
2540 return QString(); |
2534 return QString(); |
2541 else |
2535 else |
2542 return _stateGroup->state(); |
2536 return _stateGroup->state(); |
2543 } |
2537 } |
2544 |
2538 |
2545 /*! \internal */ |
|
2546 void QDeclarativeItemPrivate::setState(const QString &state) |
2539 void QDeclarativeItemPrivate::setState(const QString &state) |
2547 { |
2540 { |
2548 _states()->setState(state); |
2541 _states()->setState(state); |
2549 } |
2542 } |
2550 |
2543 |
2726 } |
2719 } |
2727 } |
2720 } |
2728 } |
2721 } |
2729 break; |
2722 break; |
2730 case ItemChildAddedChange: |
2723 case ItemChildAddedChange: |
2731 if (d->_contents) |
2724 if (d->_contents && d->componentComplete) |
2732 d->_contents->childAdded(qobject_cast<QDeclarativeItem*>( |
2725 d->_contents->childAdded(qobject_cast<QDeclarativeItem*>( |
2733 value.value<QGraphicsItem*>())); |
2726 value.value<QGraphicsItem*>())); |
2734 break; |
2727 break; |
2735 case ItemChildRemovedChange: |
2728 case ItemChildRemovedChange: |
2736 if (d->_contents) |
2729 if (d->_contents && d->componentComplete) |
2737 d->_contents->childRemoved(qobject_cast<QDeclarativeItem*>( |
2730 d->_contents->childRemoved(qobject_cast<QDeclarativeItem*>( |
2738 value.value<QGraphicsItem*>())); |
2731 value.value<QGraphicsItem*>())); |
2739 break; |
2732 break; |
2740 default: |
2733 default: |
2741 break; |
2734 break; |
3128 /*! \internal */ |
3191 /*! \internal */ |
3129 bool QDeclarativeItem::hasActiveFocus() const |
3192 bool QDeclarativeItem::hasActiveFocus() const |
3130 { |
3193 { |
3131 Q_D(const QDeclarativeItem); |
3194 Q_D(const QDeclarativeItem); |
3132 return focusItem() == this || |
3195 return focusItem() == this || |
3133 (d->flags & QGraphicsItem::ItemIsFocusScope && focusItem() != 0) || |
3196 (d->flags & QGraphicsItem::ItemIsFocusScope && focusItem() != 0); |
3134 (!parentItem() && focusItem() != 0); |
|
3135 } |
3197 } |
3136 |
3198 |
3137 /*! |
3199 /*! |
3138 \qmlproperty bool Item::focus |
3200 \qmlproperty bool Item::focus |
3139 This property indicates whether the item has focus within the enclosing focus scope. If true, this item |
3201 This property indicates whether the item has focus within the enclosing focus scope. If true, this item |