MCPcopy Create free account
hub / github.com/YACReader/yacreader / addCoverTest

Method addCoverTest

YACReaderLibrary/import_widget.cpp:248–286  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

246}
247static int j = 0;
248void 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
288void ImportWidget::clear()
289{

Callers

nothing calls this directly

Calls 4

addItemMethod · 0.80
removeItemMethod · 0.80
startMethod · 0.80
QStringClass · 0.70

Tested by

no test coverage detected