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

Method setBookmarks

YACReader/bookmarks_dialog.cpp:102–137  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

100}
101
102void BookmarksDialog::setBookmarks(const Bookmarks &bm)
103{
104 lastPage = bm.getLastPage();
105 if (lastPage > 0) {
106 QPixmap p = QPixmap::fromImage(bm.getLastPagePixmap());
107 if (p.isNull()) {
108 images.at(0)->setAlignment(Qt::AlignHCenter | Qt::AlignVCenter);
109 images.at(0)->setText(tr("Loading..."));
110 } else {
111 images.at(0)->setAlignment(Qt::AlignHCenter | Qt::AlignBottom);
112 images.at(0)->setPixmap(p.scaled(coverSize, Qt::KeepAspectRatio, Qt::SmoothTransformation));
113 }
114 } else {
115 images.at(0)->setAlignment(Qt::AlignHCenter | Qt::AlignVCenter);
116 images.at(0)->setPixmap(QPixmap(":/images/notCover.png").scaled(coverSize, Qt::KeepAspectRatio, Qt::SmoothTransformation));
117 }
118
119 QList<int> l = bm.getBookmarkPages();
120 int s = l.count();
121 for (int i = 0; i < s; i++) {
122 pages.at(i + 1)->setText(QString::number(l.at(i) + 1));
123 QPixmap p = QPixmap::fromImage(bm.getBookmarkPixmap(l.at(i)));
124 if (p.isNull()) {
125 images.at(i + 1)->setAlignment(Qt::AlignHCenter | Qt::AlignVCenter);
126 images.at(i + 1)->setText(tr("Loading..."));
127 } else {
128 images.at(i + 1)->setAlignment(Qt::AlignHCenter | Qt::AlignBottom);
129 images.at(i + 1)->setPixmap(p.scaled(coverSize, Qt::KeepAspectRatio, Qt::SmoothTransformation));
130 }
131 }
132 for (int i = s; i < 3; i++) {
133 pages.at(i + 1)->setText("-");
134 images.at(i + 1)->setAlignment(Qt::AlignHCenter | Qt::AlignVCenter);
135 images.at(i + 1)->setPixmap(QPixmap(":/images/notCover.png").scaled(coverSize, Qt::KeepAspectRatio, Qt::SmoothTransformation));
136 }
137}
138
139bool BookmarksDialog::eventFilter(QObject *obj, QEvent *event)
140{

Callers

nothing calls this directly

Calls 7

QPixmapClass · 0.85
getLastPageMethod · 0.80
getLastPagePixmapMethod · 0.80
setPixmapMethod · 0.80
getBookmarkPagesMethod · 0.80
getBookmarkPixmapMethod · 0.80
setTextMethod · 0.45

Tested by

no test coverage detected