MCPcopy Create free account
hub / github.com/KDE/okular / recalcGeometry

Method recalcGeometry

part/presentationwidget.cpp:92–110  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

90 PresentationFrame &operator=(const PresentationFrame &) = delete;
91
92 void recalcGeometry(int width, int height, float screenRatio)
93 {
94 // calculate frame geometry keeping constant aspect ratio
95 float pageRatio = page->ratio();
96 int pageWidth = width, pageHeight = height;
97 if (pageRatio > screenRatio) {
98 pageWidth = (int)((float)pageHeight / pageRatio);
99 } else {
100 pageHeight = (int)((float)pageWidth * pageRatio);
101 }
102 geometry.setRect((width - pageWidth) / 2, (height - pageHeight) / 2, pageWidth, pageHeight);
103
104 for (VideoWidget *vw : std::as_const(videoWidgets)) {
105 const Okular::NormalizedRect r = vw->normGeometry();
106 QRect vwgeom = r.geometry(geometry.width(), geometry.height());
107 vw->resize(vwgeom.size());
108 vw->move(geometry.topLeft() + vwgeom.topLeft());
109 }
110 }
111
112 const Okular::Page *page;
113 QRect geometry;

Callers 2

notifySetupMethod · 0.80
resizeEventMethod · 0.80

Calls 9

ratioMethod · 0.80
setRectMethod · 0.80
normGeometryMethod · 0.80
topLeftMethod · 0.80
geometryMethod · 0.60
widthMethod · 0.45
heightMethod · 0.45
sizeMethod · 0.45
moveMethod · 0.45

Tested by

no test coverage detected