MCPcopy Create free account
hub / github.com/MITK/MITK / SetScaleFactor

Method SetScaleFactor

Modules/QtOverlays/src/QmitkScalarBar.cpp:136–172  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

134}
135
136void QmitkScalarBar::SetScaleFactor(double scale)
137{
138 m_ScaleFactor = scale;
139
140 // Adopt the number of small, intersecting lines to the size of the widget.
141 if (this->parentWidget() != nullptr && this->parentWidget()->parentWidget() != nullptr)
142 {
143 // If the widget is larger than 80% of the size of the parent -> reduce number by two (must not be smaller than 3)
144 if (this->height() > this->parentWidget()->parentWidget()->height() * 0.7 && m_NumberOfSubDivisions >= 3)
145 {
146 m_NumberOfSubDivisions -= 2;
147 }
148 // If the widget is smaller than 30% of the size of the parent -> increase number by two
149 else if (this->height() < this->parentWidget()->parentWidget()->height() * 0.4 &&
150 (m_NumberOfSubDivisions < 7 && m_NumberOfSubDivisions > 0))
151 {
152 m_NumberOfSubDivisions += 2;
153 }
154
155 if (m_NumberOfSubDivisions == 1)
156 {
157 this->resize(0, 0);
158 this->setFixedWidth(0);
159 this->setFixedHeight(0);
160 }
161 else
162 {
163 this->resize(10, (m_NumberOfSubDivisions - 1) * 10 / m_ScaleFactor);
164 this->setFixedWidth(10);
165 this->setFixedHeight((m_NumberOfSubDivisions - 1) * 10 / m_ScaleFactor);
166 this->SetupGeometry(m_Alignment);
167 }
168
169 if (this->height() > this->parentWidget()->parentWidget()->height() * 0.7 && m_NumberOfSubDivisions >= 3)
170 SetScaleFactor(scale);
171 }
172}
173
174void QmitkScalarBar::SetNumberOfSubdivisions(unsigned int subs)
175{

Calls 1

SetupGeometryMethod · 0.95

Tested by

no test coverage detected