Added sceneSize function to UBGraphicsScene

preferencesAboutTextFull
Craig Watson 8 years ago
parent 5d48d55c7f
commit b7f5cc2714
  1. 18
      src/domain/UBGraphicsScene.cpp
  2. 2
      src/domain/UBGraphicsScene.h

@ -2257,6 +2257,24 @@ QSize UBGraphicsScene::nominalSize()
return mNominalSize;
}
/**
* @brief Return the scene's boundary size, including any background item
*
* If no background item is present, this returns nominalSize()
*/
QSize UBGraphicsScene::sceneSize()
{
UBGraphicsPDFItem *pdfItem = qgraphicsitem_cast<UBGraphicsPDFItem*>(backgroundObject());
if (pdfItem) {
QRectF targetRect = pdfItem->sceneBoundingRect();
return targetRect.size().toSize();
}
else
return nominalSize();
}
void UBGraphicsScene::setNominalSize(const QSize& pSize)
{
if (nominalSize() != pSize)

@ -277,6 +277,8 @@ class UBGraphicsScene: public UBCoreGraphicsScene, public UBItem
QSize nominalSize();
QSize sceneSize();
void setNominalSize(const QSize& pSize);
void setNominalSize(int pWidth, int pHeight);

Loading…
Cancel
Save