| 52 | } |
| 53 | |
| 54 | void ComicsView::updateInfoForIndex(int index) |
| 55 | { |
| 56 | QQmlContext *ctxt = view->rootContext(); |
| 57 | |
| 58 | if (comicDB != nullptr) |
| 59 | delete comicDB; |
| 60 | |
| 61 | if ((index < 0) || (index >= model->rowCount())) { |
| 62 | ctxt->setContextProperty("comic", nullptr); |
| 63 | ctxt->setContextProperty("comicInfo", nullptr); |
| 64 | ctxt->setContextProperty("comic_info_index", -1); |
| 65 | return; |
| 66 | } |
| 67 | |
| 68 | comicDB = new ComicDB(model->getComic(this->model->index(index, 0))); |
| 69 | ComicInfo *comicInfo = &(comicDB->info); |
| 70 | comicInfo->isFavorite = model->isFavorite(model->index(index, 0)); |
| 71 | |
| 72 | ctxt->setContextProperty("comic", comicDB); |
| 73 | ctxt->setContextProperty("comicInfo", comicInfo); |
| 74 | |
| 75 | ctxt->setContextProperty("comic_info_index", index); |
| 76 | } |
| 77 | |
| 78 | void ComicsView::dragEnterEvent(QDragEnterEvent *event) |
| 79 | { |
nothing calls this directly
no test coverage detected