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

Method moveToCenter

ElaWidgetTools/ElaDialog.cpp:104–116  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

102{
103 Q_D(const ElaDialog);
104 return d->_appBar->getAppBarHeight();
105}
106
107void ElaDialog::moveToCenter()
108{
109 if (isMaximized() || isFullScreen())
110 {
111 return;
112 }
113#if QT_VERSION >= QT_VERSION_CHECK(5, 14, 0)
114 auto geometry = screen()->availableGeometry();
115#else
116 auto geometry = qApp->screenAt(this->geometry().center())->geometry();
117#endif
118 setGeometry((geometry.left() + geometry.right() - width()) / 2, (geometry.top() + geometry.bottom() - height()) / 2, width(), height());
119}

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected