---
name: "QwtPushButton"
section: "3"
platform: "linux"
package: "libqwt-doc"
version: "4.2.0-6"
release: "Debian 6.0 (Squeeze)"
platforms: ["linux"]
url: "https://new.carta.tech/QwtPushButton"
---

# QwtPushButton(3)

## NAME

QwtPushButton -

## SYNOPSIS

Inherited by **QwtLegendButton**.

## Detailed Description

A push button that allows alignment of button labels, and use of rich texts, as provided by QLabel.

**Warning:**

The layout of the text label might be broken for a couple of styles. At least the KDE 3.3 Keramik style is known.

Definition at line 24 of file qwt\_push\_button.h.

### Public Member Functions

**QwtPushButton** (QWidget \*=NULL, const char \*name=NULL)\
 **QwtPushButton** (const QString &text, QWidget \*=NULL, const char \*name=NULL)\
 **QwtPushButton** (const QIconSet &, const QString &, QWidget \*=NULL, const char \*name=NULL)\
 TextFormat **textFormat** () const\
 void **setTextFormat** (TextFormat)\
 virtual Qt::TextFormat **usedTextFormat** () const\
 int **alignment** () const\
 virtual void **setAlignment** (int alignment)\
 void **setIndent** (int)\
 int **indent** () const\
 virtual QSize **sizeHint** () const\
 virtual int **heightForWidth** (int) const\

### Protected Member Functions

virtual void **drawButtonLabel** (QPainter \*)\

## Constructor & Destructor Documentation

### QwtPushButton::QwtPushButton (QWidget \* parent = `NULL`, const char \* name = `NULL`)

Constructs a push button with no text. Definition at line 217 of file qwt\_push\_button.cpp.

### QwtPushButton::QwtPushButton (const QString & text, QWidget \* parent = `NULL`, const char \* name = `NULL`)

Constructs a push button called name with the parent parent and the text text. Definition at line 227 of file qwt\_push\_button.cpp.

### QwtPushButton::QwtPushButton (const QIconSet & iconSet, const QString & text, QWidget \* parent = `NULL`, const char \* name = `NULL`)

Constructs a push button with an icon and a text. Definition at line 237 of file qwt\_push\_button.cpp.

## Member Function Documentation

### int QwtPushButton::alignment () const

**Returns:**

Alignment of the button label's contents.

**See also:**

**QwtPushButton::setAlignment**

Definition at line 301 of file qwt\_push\_button.cpp.

Referenced by QwtLegendButton::titleText().

### void QwtPushButton::drawButtonLabel (QPainter \*)` [protected, virtual]`

Draws the button text or pixmap.

Definition at line 417 of file qwt\_push\_button.cpp.

### int QwtPushButton::heightForWidth (int width) const` [virtual]`

Find the preferred height, given the width w.

**Parameters:**

*width* Width

**Returns:**

preferred height

Definition at line 352 of file qwt\_push\_button.cpp.

References QwtText::boundingRect(), QwtText::heightForWidth(), QwtText::makeText(), sizeHint(), and usedTextFormat().

### int QwtPushButton::indent () const

**Returns:**

Indent of the button label's contents.

**See also:**

**QwtPushButton::setIndent**

Definition at line 325 of file qwt\_push\_button.cpp.

### void QwtPushButton::setAlignment (int alignment)` [virtual]`

Sets the alignment of the button label´s contents.

The default format is Qt::AlignCenter \| Qt::ExpandTabs \| Qt::WordBreak.

**Parameters:**

*alignment* Bitwise OR of Qt::AlignmentFlags and Qt::TextFlags values.

**See also:**

**QwtPushButton::alignment()**

Definition at line 315 of file qwt\_push\_button.cpp.

### void QwtPushButton::setIndent (int indent)

Sets the button label's contents indent in pixels.

The default value is 4 pixels.

**Parameters:**

*indent* Indent

**See also:**

**QwtPushButton::indent()**

Definition at line 340 of file qwt\_push\_button.cpp.

### void QwtPushButton::setTextFormat (TextFormat textFormat)

Sets the button label's text format. The default format is AutoText.

**Parameters:**

*textFormat* Text format for the button label text

**See also:**

**QwtPushButton::textFormat()**

Definition at line 291 of file qwt\_push\_button.cpp.

### QSize QwtPushButton::sizeHint () const` [virtual]`

Return sizeHint.

Definition at line 370 of file qwt\_push\_button.cpp.

References QwtRichText::boundingRect(), textFormat(), and usedTextFormat().

Referenced by heightForWidth().

### Qt::TextFormat QwtPushButton::textFormat () const

**Returns:**

The button label's text format

**See also:**

**QwtPushButton::setTextFormat**

Definition at line 277 of file qwt\_push\_button.cpp.

Referenced by sizeHint().

### Qt::TextFormat QwtPushButton::usedTextFormat () const` [virtual]`

Find the text format that is used for painting the button label.

In case of Qt::AutoText the format is found by evaluating text(), otherwise it is **textFormat()**

**Returns:**

Text format that is used for painting

**See also:**

**textFormat()**, **setTextFormat()**, QStyleSheet::mightBeRichText()

Definition at line 262 of file qwt\_push\_button.cpp.

Referenced by heightForWidth(), sizeHint(), and QwtLegendButton::titleText().

## Author

Generated automatically by Doxygen for Qwt User's Guide from the source code.
