| 246 | } |
| 247 | static int j = 0; |
| 248 | void ImportWidget::addCoverTest() |
| 249 | { |
| 250 | QPixmap p(QString("c:/temp/%1.jpg").arg(i)); |
| 251 | p = p.scaledToHeight(300, Qt::SmoothTransformation); |
| 252 | auto item = new QGraphicsPixmapItem(p); |
| 253 | item->setPos(previousWidth, 0); |
| 254 | item->setZValue(i / 10000.0); |
| 255 | previousWidth += 10 + p.width(); |
| 256 | coversScene->addItem(item); |
| 257 | if (previousWidth >= coversView->width()) { |
| 258 | QGraphicsItem *last = coversScene->items().last(); |
| 259 | int width = p.width(); |
| 260 | if (j >= 1) { |
| 261 | coversScene->removeItem(last); |
| 262 | delete last; |
| 263 | } else |
| 264 | j++; |
| 265 | |
| 266 | for (auto *itemToMove : coversScene->items()) { |
| 267 | |
| 268 | auto timer = new QTimeLine(/*350*/ 1000); |
| 269 | timer->setFrameRange(0, 60); |
| 270 | |
| 271 | auto animation = new QGraphicsItemAnimation; |
| 272 | animation->setItem(itemToMove); |
| 273 | animation->setTimeLine(timer); |
| 274 | |
| 275 | QPointF point = itemToMove->scenePos(); |
| 276 | float step = (width + 10) / 60.0; |
| 277 | for (int i = 0; i < 60; ++i) |
| 278 | animation->setPosAt(i / 60.0, QPointF(point.x() - ((i + 1) * step), point.y())); |
| 279 | |
| 280 | timer->start(); |
| 281 | } |
| 282 | previousWidth -= 10 + width; |
| 283 | } |
| 284 | |
| 285 | i++; |
| 286 | } |
| 287 | |
| 288 | void ImportWidget::clear() |
| 289 | { |
nothing calls this directly
no test coverage detected