Hello,
This incomplete func compiles and works. But item->pos().x(); always returns 0 to the variable xxx when run in the debugger (Win 7, mingw release w/ sdk). Note that the following data variables are filled properly from the items so we know that the rest of the mechanism is working. Could this actually be a bug in QT 4.7 or have I misunderstood the value function? I'm stumped on this one. Thanks.
QList<QGraphicsItem*> Note::getNotesInMeasure()
{
QList<QGraphicsItem*>iList;
iList = scene->selectedItems();
if (!( iList.isEmpty() || iList.size() == 0 )){
int sz = iList.size();
int i;
for (i=0; i<sz; i++){
item = iList.value(i);
int xxx = item->pos().x();
QString n
= item
->data
(2).
toString();
QString h
= item
->data
(0).
toString();
if ( n == "Note" ) { msg(h); }
}
}
return iList;
}
QList<QGraphicsItem*> Note::getNotesInMeasure()
{
extern QGraphicsScene* scene;
QList<QGraphicsItem*>iList;
QGraphicsItem* item;
iList = scene->selectedItems();
if (!( iList.isEmpty() || iList.size() == 0 )){
int sz = iList.size();
int i;
for (i=0; i<sz; i++){
item = iList.value(i);
int xxx = item->pos().x();
QString n = item->data(2).toString();
QString h = item->data(0).toString();
if ( n == "Note" ) { msg(h); }
}
}
return iList;
}
To copy to clipboard, switch view to plain text mode
Bookmarks