Property Value Initialization Semantics


속성값 초기화 의미



Item {
    property var first:  {}   // nothing = undefined
    property var second: {{}} // empty expression block = undefined
    property var third:  ({}) // empty object
}


'Qt' 카테고리의 다른 글

Embedding C++ Objects into QML with Context Properties[26]  (0) 2015.10.26
Interacting with QML Objects from C++[10_25]  (0) 2015.10.25
Exposing Attributes of C++ Types to QML[QT]  (0) 2015.10.23
git 설치  (0) 2015.06.29
Qt 시그널 슬롯 시스템  (0) 2015.06.27

원문 링크 http://doc.qt.io/qt-5/qtqml-cppintegration-exposecppattributes.html

해석 http://criticalmass.tistory.com/267


세미나 링크 http://www.qt.io/resource-center-qtws15-session-listing/

할것 http://doc.qt.io/qt-5/qtqml-cppintegration-exposecppattributes.html


QML 에서의 C++속성 공개


QML 은 다음과 같은 접근이 가능하다. 

  • Properties
  • Methods (providing they are public slots or flagged with Q_INVOKABLE)
  • Signals


데이터 형식 취급 및 소유권 다음링크 참고

http://doc.qt.io/qt-5/qtqml-cppintegration-data.html#data-ownership


Data Type Conversion Between QML and C++

http://doc.qt.io/qt-5/qtqml-cppintegration-data.html


Exposing Properties (공개)

 QObject - derived class   QObject 에서 파생된 클래스들은 QML에서 접근 가능한다.


C++에서 QML 타입을 정의



Writing QML Extensions with C++

http://doc.qt.io/qt-5/qtqml-tutorials-extending-qml-example.html < -이거 볼것



'Qt' 카테고리의 다른 글

Interacting with QML Objects from C++[10_25]  (0) 2015.10.25
Property Value Initialization Semantics[10_23]  (0) 2015.10.23
git 설치  (0) 2015.06.29
Qt 시그널 슬롯 시스템  (0) 2015.06.27
Qt_6월 27일  (0) 2015.06.27
  • Qt 5.4.2 Reference Documentation

 

Header: #include <QGraphicsItemGroup>
qmake: QT += widgets
Since: Qt 4.2
Inherits: QGraphicsItem.

You define itemList as:

QList<QGraphicsItem *> itemList;

You are then trying to iterate it with:

foreach(QGraphicsItemGroup *item, itemList){
   // ...
}

From the documentation you can see that QGraphicsItemGroup inherits from QGraphicsItem. So every QGraphicsItemGroup "is a" QGraphicsItem. But not every QGraphicsItem "is a" QGraphicsItemGroup.

If you want to iterate that itemList then item will have to be a QGraphicsItem, or itemList will have to be a QGraphicsItemGroup. It seems that since you are testing for specific classes then the former is probably what you want.

 

If you look at the documentation for QGraphicsItem::ItemIsSelectable, it states: -

The item supports selection. Enabling this feature will enable setSelected() to toggle selection for the item. It will also let the item be selected automatically as a result of calling QGraphicsScene::setSelectionArea(), by clicking on an item, or by using rubber band selection in QGraphicsView.

Since QGraphicsItemGroup is derived from QGraphicsItem, I suspect that by default, a QGraphicsItemGroup does not have this flag selected. So, for each group, set this flag and if you only want the groups returned from the rubber band selection, turn off the flags for all the other items.

 

https://stackoverflow.com/questions/23673129/qt-qgraphicsitemgroup-get-coordinate-of-transformed-items

 

 

https://stackoverflow.com/questions/21604159/detecting-clicks-on-a-qgraphicsitemgroup

 

+ Recent posts