MCPcopy Create free account
hub / github.com/Liniyous/ElaWidgetTools / paintEvent

Method paintEvent

ElaWidgetTools/ElaMenu.cpp:183–196  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

181 subMenuTriggerCenterY = parentActionTopLeft.y() + parentActionRect.height() / 2;
182 const int right = parentBody.right() + 5 - margins.left();
183 const int left = parentBody.left() - 4 - width() + margins.right();
184 bool isLeft = false;
185 if (available.isValid())
186 {
187 isLeft = parentMenu->isRightToLeft()
188 ? (left + margins.left() >= available.left())
189 : (right + width() - margins.right() > available.right() + 1);
190 }
191 position.setX(isLeft ? left : right);
192 const QList<QAction*> actionList = actions();
193 position.setY(parentActionTopLeft.y() - (actionList.isEmpty() ? margins.top() + 3 : actionGeometry(actionList.first()).top()));
194 }
195 else if (popupSource)
196 {
197 const QRect sourceRect(popupSource->mapToGlobal(QPoint(0, 0)), popupSource->size());
198 const bool isAboveSource = initialPos.y() + height() <= sourceRect.top() + 2;
199 if (isAboveSource)

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected