KDEUI
Go to the documentation of this file.
21#include <QtCore/QEvent>
22#include <QtGui/QApplication>
23#include <QtGui/QHBoxLayout>
24#include <QtGui/QVBoxLayout>
30 QHBoxLayout* layout =
new QHBoxLayout(
this );
31 layout->setSpacing( 0 );
32 layout->setMargin( 0 );
42 QVBoxLayout* layout =
new QVBoxLayout(
this );
43 layout->setSpacing( 0 );
44 layout->setMargin( 0 );
55 switch ( event->type() ) {
56 case QEvent::ChildAdded:
58 QChildEvent*
childEvent =
static_cast<QChildEvent *
>( event );
59 if ( childEvent->child()->isWidgetType() ) {
61 static_cast<QBoxLayout *
>( layout() )->addWidget( widget );
66 case QEvent::ChildRemoved:
68 QChildEvent*
childEvent =
static_cast<QChildEvent *
>( event );
69 if ( childEvent->child()->isWidgetType() ) {
71 static_cast<QBoxLayout *
>( layout() )->removeWidget( widget );
79 QFrame::childEvent(event);
85 QApplication::sendPostedEvents( that, QEvent::ChildAdded );
87 return QFrame::sizeHint();
93 QApplication::sendPostedEvents( that, QEvent::ChildAdded );
95 return QFrame::minimumSizeHint();
100 layout()->setSpacing( spacing );
110 layout()->setMargin( margin );
A container widget which arranges its children horizontally.
virtual void childEvent(QChildEvent *ev)
KHBox(QWidget *parent=0)
Creates a new hbox.
virtual QSize sizeHint() const
Calculate the recommended size for this hbox.
void setStretchFactor(QWidget *widget, int stretch)
Sets the stretch factor of widget to stretch.
virtual QSize minimumSizeHint() const
Calculate the recommended minimum size for this hbox.
void setMargin(int margin)
Sets the margin of the hbox.
void setSpacing(int space)
Sets the spacing between the child widgets to space.
This file is part of the KDE documentation.
Documentation copyright © 1996-2023 The KDE developers.
Generated on Mon Feb 20 2023 00:00:00 by
doxygen 1.9.6 written
by
Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.