Logo Search packages:      
Sourcecode: qt4-x11 version File versions

void QWidget::setParent ( QWidget parent  )  [inherited]

Sets the parent of the widget to parent, and resets the window flags. The widget is moved to position (0, 0) in its new parent.

If the new parent widget is in a different window, the reparented widget and its children are appended to the end of the {setFocusPolicy()}{tab chain} of the new parent widget, in the same internal order as before. If one of the moved widgets had keyboard focus, setParent() calls clearFocus() for that widget.

If the new parent widget is in the same window as the old parent, setting the parent doesn't change the tab order or keyboard focus.

If the "new" parent widget is the old parent widget, this function does nothing.

Note:
The widget becomes invisible as part of changing its parent, even if it was previously visible. You must call show() to make the widget visible again.
Warning:
It is very unlikely that you will ever need this function. If you have a widget that changes its content dynamically, it is far easier to use QStackedWidget.
See also:
setWindowFlags()

Definition at line 8698 of file qwidget.cpp.

References QWidget::parentWidget().

Referenced by QDialogButtonBox::addButton(), QLayout::addChildWidget(), QAbstractFormBuilder::addItem(), QMdiArea::addSubWindow(), QFormBuilder::createWidget(), Q3DockArea::moveDockWindow(), Q3ToolBar::Q3ToolBar(), QDialogButtonBox::removeButton(), Q3DockArea::removeDockWindow(), QMdiArea::removeSubWindow(), QWizard::setButton(), QProgressDialog::setCancelButton(), Q3ProgressDialog::setCancelButton(), QTabWidget::setCornerWidget(), QAbstractScrollArea::setCornerWidget(), Q3ScrollView::setCornerWidget(), QMenuBar::setCornerWidget(), Q3SpinWidget::setEditWidget(), QDialog::setExtension(), QAbstractItemView::setIndexWidget(), Q3ProgressDialog::setLabel(), QProgressDialog::setLabel(), QWizard::setPage(), QCompleter::setPopup(), QMdiSubWindow::setSystemMenu(), QTabWidget::setTabBar(), QMdiArea::setupViewport(), QScrollArea::setWidget(), QMdiSubWindow::setWidget(), QMessageBox::setWindowModality(), QWidget::setWindowState(), QScrollArea::takeWidget(), and Q3DockWindow::undock().

{
    if (parent == parentWidget())
        return;
    setParent((QWidget*)parent, windowFlags() & ~Qt::WindowType_Mask);
}


Generated by  Doxygen 1.6.0   Back to index