class KButtonBox

Container widget for buttons. More...

Definition#include <kbuttonbox.h>
InheritsQWidget (qk)
List of all Methods
Annotated List
Files
Globals
Hierarchy
Index

Public Types

Public Methods

Protected Types

Protected Methods

Protected Members


Detailed Description

Container widget for buttons.

Uses Qt layout control to place the buttons, can handle both vertical and horizontal button placement. The default border is now 0 (easier to deal with layouts). The space between buttons is now more Motif compliant.

enum {VERTICAL = 1, HORIZONTAL = 2 }

Orientations for the button box.

KButtonBox (QWidget *parent, int _orientation = HORIZONTAL, int border = 0, int _autoborder = 6)

Create an empty container for buttons.

If _orientation is KButtonBox::VERTICAL, the buttons inserted with addButton() are laid out from top to bottom, otherwise they are laid out from left to right.

~KButtonBox ()

The destructor is needed, otherwise gcc 2.7.2.1 may report an internal compiler error.

It does nothing.

QSize sizeHint ()
[const virtual]

This size is calculated by the width/height of all buttons plus border/autoborder.

Returns: The minimum size needed to fit all buttons.

QPushButton * addButton (const QString& text, bool noexpand = FALSE)

Add a new QPushButton.

Parameters:
noexpandIf 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.

void addStretch (int scale = 1)

Add a stretch to the buttonbox.

See also: QBoxLayout, for, details., Can, be, used, to, separate, buttons, (i.e., if, you, add, the, buttons, "OK", "Cancel", add, a, stretch, and, then, add, the, button, "Help", "OK", and, "Cancel", will, be, left-aligned, (or, top-aligned, for, vertical), while, "Help", will, be, right-aligned, (or, bottom-aligned, for, vertical).

void layout ()

This function must be called @bf once after all buttons have been inserted.

It will start layout control.

QSize bestButtonSize ()
[protected const]

Returns: the best size for a button. Checks all buttons and takes the maximum width/height.