| # kdeui Library API Documentation
Overview | Class Hierarchy | Classes | Classes (annotated) | Members | Namespaces | Source Files

# KButtonBox Class Reference

Container widget for buttons. More...

`#include <kbuttonbox.h>`

Inheritance diagram for KButtonBox:

[legend]
Collaboration diagram for KButtonBox:

[legend]
List of all members.

## Public Member Functions
| KButtonBox (QWidget *parent, Orientation _orientation=Horizontal, int border=0, int _autoborder=6)
| ~KButtonBox ()
virtual QSize | sizeHint () const
virtual QSizePolicy | sizePolicy () const
virtual void | resizeEvent (QResizeEvent *)
QPushButton * | addButton (const QString &text, bool noexpand=false)
QPushButton * | addButton (const QString &text, QObject *receiver, const char *slot, bool noexpand=false)
QPushButton * | addButton (const KGuiItem &guiitem, bool noexpand=false)
QPushButton * | addButton (const KGuiItem &guiitem, QObject *receiver, const char *slot, bool noexpand=false)
void | addStretch (int scale=1)
void | layout ()
## Protected Member Functions
QSize | bestButtonSize () const
void | placeButtons ()
QSize | buttonSizeHint (QPushButton *) const
virtual void | virtual_hook (int id, void *data)

## Detailed Description

Container widget for buttons.

This class uses Qt layout control to place the buttons; can handle both vertical and horizontal button placement. The default border is now `0` (making it easier to deal with layouts). The space between buttons is now more Motif compliant.

Author:
  Mario Weilguni <mweilguni@sime.com>

Version:
  Id
    kbuttonbox.h 360744 2004-11-05 15:49:23Z coles

Definition at line 42 of file kbuttonbox.h.

## Constructor & Destructor Documentation

KButtonBox::KButtonBox | ( | QWidget * | parent,
|  | Orientation | _orientation = `Horizontal`,
|  | int | border = `0`,
|  | int | _autoborder = `6`
| ) |

| Create an empty container for buttons. If `_orientation` is `Vertical`, the buttons inserted with addButton() are laid out from top to bottom, otherwise they are laid out from left to right. Definition at line 82 of file kbuttonbox.cpp.

KButtonBox::~KButtonBox | ( |  | ) |

| Free private data field. Definition at line 94 of file kbuttonbox.cpp.

## Member Function Documentation

QSize KButtonBox::sizeHint | ( |  | ) | const`[virtual]`

| Returns: The minimum size needed to fit all buttons. This size is calculated by the width/height of all buttons plus border/autoborder. Reimplemented from QWidget. Definition at line 303 of file kbuttonbox.cpp. References bestButtonSize(), QSize::height(), and QSize::width(). Referenced by layout().

QPushButton * KButtonBox::addButton | ( | const QString & | text,
|  | bool | noexpand = `false`
| ) |

  | Add a new QPushButton. Parameters:
  | text | the text of the button to add
  | noexpand | If `noexpand` is `false`, the width of the button is adjusted to fit the other buttons (the maximum of all buttons is taken). If `noexpand` is `true`, the width of this button will be set to the minimum width needed for the given text).
Returns: A pointer to the new button. Definition at line 98 of file kbuttonbox.cpp. References QWidget::updateGeometry(). Referenced by addButton().

QPushButton * KButtonBox::addButton | ( | const QString & | text,
|  | QObject * | receiver,
|  | const char * | slot,
|  | bool | noexpand = `false`
| ) |

  | Add a new QPushButton. Parameters:
  | text | the text of the button to add.
  | receiver | An object to connect to.
  | slot | A Qt slot to connect the 'clicked()' signal to.
  | noexpand | If `noexpand` is `false`, the width of the button is adjusted to fit the other buttons (the maximum of all buttons is taken). If `noexpand` `true`, the width of this button will be set to the minimum width needed for the given text).
Returns: A pointer to the new button. Definition at line 123 of file kbuttonbox.cpp. References addButton(), and QObject::connect().

QPushButton * KButtonBox::addButton | ( | const KGuiItem & | guiitem,
|  | bool | noexpand = `false`
| ) |

  | Add a new QPushButton. Parameters:
  | guiitem | text and icon on the button
  | noexpand | If `noexpand` is `false`, the width of the button is adjusted to fit the other buttons (the maximum of all buttons is taken). If `noexpand` is `true`, the width of this button will be set to the minimum width needed for the given text).
Returns: A pointer to the new button. Since: 3.3 Definition at line 110 of file kbuttonbox.cpp. References QWidget::updateGeometry().

QPushButton * KButtonBox::addButton | ( | const KGuiItem & | guiitem,
|  | QObject * | receiver,
|  | const char * | slot,
|  | bool | noexpand = `false`
| ) |

  | Add a new QPushButton. Parameters:
  | guiitem | text and icon on the button
  | receiver | An object to connect to.
  | slot | A Qt slot to connect the 'clicked()' signal to.
  | noexpand | If `noexpand` is `false`, the width of the button is adjusted to fit the other buttons (the maximum of all buttons is taken). If `noexpand` `true`, the width of this button will be set to the minimum width needed for the given text).
Returns: A pointer to the new button. Since: 3.3 Definition at line 139 of file kbuttonbox.cpp. References addButton(), and QObject::connect().

void KButtonBox::addStretch | ( | int | scale = `1` | ) |

| Add a stretch to the buttonbox. Can be used to separate buttons. That is, if you add the buttons OK and Cancel, add a stretch, and then add the button Help, the buttons OK and Cancel will be left-aligned (or top-aligned for vertical) whereas Help will be right-aligned (or bottom-aligned for vertical). See also: QBoxLayout Definition at line 154 of file kbuttonbox.cpp.

void KButtonBox::layout | ( |  | ) |

| This function must be called once after all buttons have been inserted. It will start layout control. Definition at line 163 of file kbuttonbox.cpp. References bestButtonSize(), QWidget::setMinimumSize(), and sizeHint().

QSize KButtonBox::bestButtonSize | ( |  | ) | const`[protected]`

| Returns: the best size for a button. Checks all buttons and takes the maximum width/height. Definition at line 276 of file kbuttonbox.cpp. References QSize::height(), QSize::setHeight(), QSize::setWidth(), and QSize::width(). Referenced by layout(), and sizeHint().

The documentation for this class was generated from the following files:

- kbuttonbox.h
- kbuttonbox.cpp

This file is part of the documentation for kdeui Library Version 3.4.1.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Sat Jun 11 20:20:41 2005 by doxygen 1.4.1 written by Dimitri van Heesch, © 1997-2003