MCPcopy Create free account
hub / github.com/OpenBoard-org/OpenBoard / insertThumbnail

Method insertThumbnail

src/gui/UBThumbnailScene.cpp:239–270  ·  view source on GitHub ↗

* @brief Insert a thumbnail. * * Insert a thumbnail at the given index. This function assumes that the thumbnail pixmap files * are already moved to provide the necessary space. The pixmap for the new thumbnail can either * be provided in the corresponding pixmap file or it will be created from the scene. * * @param pageIndex Page index of the scene. * @param pageScene Optional scene. If th

Source from the content-addressed store, hash-verified

237 * created from the scene. Otherwise it is assumed that the pixmap file already exists.
238 */
239void UBThumbnailScene::insertThumbnail(int pageIndex, std::shared_ptr<UBGraphicsScene> pageScene)
240{
241 if (pageScene)
242 {
243 UBThumbnailAdaptor::persistScene(mDocument->proxy(), pageScene, pageIndex);
244 }
245
246 if (pageIndex <= mThumbnailItems.size())
247 {
248 if (mThumbnailItems.size() == 1)
249 {
250 thumbnailAt(0)->setDeletable(true);
251 }
252
253 auto thumbnailItem = new UBThumbnail;
254
255 thumbnailItem->setPixmap(UBThumbnailAdaptor::get(mDocument->proxy(), pageIndex));
256 thumbnailItem->setSceneIndex(pageIndex);
257
258 mThumbnailItems.insert(pageIndex, thumbnailItem);
259 addItem(thumbnailItem);
260
261 renumberThumbnails(pageIndex);
262 arrangeThumbnails(pageIndex);
263 }
264
265 if (mLoader)
266 {
267 // restart loading remaining thumbnails
268 createThumbnails(pageIndex);
269 }
270}
271
272void UBThumbnailScene::deleteThumbnail(int pageIndex, bool rearrange)
273{

Callers 4

duplicatePageMethod · 0.45
copyPageMethod · 0.45
insertPageMethod · 0.45
createPageMethod · 0.45

Calls 7

setDeletableMethod · 0.80
setSceneIndexMethod · 0.80
getFunction · 0.50
proxyMethod · 0.45
sizeMethod · 0.45
setPixmapMethod · 0.45
insertMethod · 0.45

Tested by

no test coverage detected