qwinwidget.cpp
/*!
    Centers this widget over the native parent window. Use this
    function to have Qt toplevel windows (i.e. dialogs) positioned
    correctly over their native parent windows.

    \code
    QWinWidget qwin(hParent);
    qwin.center();

    QMessageBox::information(&qwin, "Caption", "Information Text");
    \endcode

    This will center the message box over the client area of hParent.
*/
Centers this widget over the native parent window. Use this
function to have Qt toplevel windows  positioned
correctly over their native parent windows.



:information(&qwin, "Caption", "Information Text");
\endcode

This will center the message box over the client area of hParent.
Centers this widget over the native parent window . Use this function to have Qt toplevel windows positioned correctly over their native parent windows . : information ( &qwin " Caption " " Information Text " ) ; \ endcode This will center the message box over the client area of hParent .
void QWinWidget::center()
{
    const QWidget *child = findChild<QWidget*>();
    if (child && !child->isWindow()) {
        qWarning("QWinWidget::center: Call this function only for QWinWidgets with toplevel children");
    }
    RECT r;
    GetWindowRect(m_ParentNativeWindowHandle, &r);
    setGeometry((r.right-r.left)/2+r.left, (r.bottom-r.top)/2+r.top,0,0);
}
void QWinWidget :: center ( ) { const QWidget * child = findChild < QWidget * > ( ) ; if ( child && ! child -> isWindow ( ) ) { qWarning ( " " ) ; } RECT r ; GetWindowRect ( m_ParentNativeWindowHandle , & r ) ; setGeometry ( ( r . right - r . left ) / 2 + r . left , ( r . bottom - r . top ) / 2 + r . top , 0 , 0 ) ; }
Centers this widget over the native parent window.
Centers this widget over the native parent window .