void tst_QList::startsWith() const { QList<QString> list; list << "foo" << "bar" << "baz"; // make sure it starts ok QVERIFY(list.startsWith(QLatin1String("foo"))); // remove an item list.removeFirst(); QVERIFY(list.startsWith(QLatin1String("bar"))); }
void VNote::mouseMoveEvent(QGraphicsSceneMouseEvent *event) { if(newnote == false){ if(getNotetype() == ScoreViewModel::whole || getNotetype() == ScoreViewModel::half || getNotetype() == ScoreViewModel::quarter || getNotetype() == ScoreViewModel::eighth){ QList <QGraphicsItem *> colList = this->scene()->collidingItems(this); if(!colList.isEmpty()){ shadow->setOpacity(0.5); //qDebug() << colList; if(colList.last()->parentItem() == this->parentItem() && colList.startsWith(shadow)){ // evade collision with shadow //qDebug() << colList.first()->pos(); if(colList.size() > 1){ shadow->setY((colList.at(1)->pos().y())-10); //qDebug() << colList.at(1)->y()-10; } }else if(colList.first()->parentItem() == this->parentItem()){ //qDebug() << colList.first()->pos(); shadow->setY((colList.first()->pos().y())-10); //qDebug() << colList.first()->y()-10; } } } this->scene()->update(); //this->scene()->update(boundingRect().x()-10,boundingRect().y()-80,boundingRect().right()+10,boundingRect().bottom()); //this->scene()->update(); } QGraphicsItem::mouseMoveEvent(event); }