Qt logo

QPushButton Class Reference


The QPushButton widget provides a push button with a text or pixmap label. More...

#include <qpushbutton.h>

Inherits QButton.

List of all member functions.

Public Slots

Protected Members


Detailed Description

The QPushButton widget provides a push button with a text or pixmap label.

The push button (command button in Windows parlance) is perhaps the most central widget: Push it to command the computer to perform some action.

Being so central, the widget has grown to accomodate a great many variations in the past decade, and by now the "comand button" chapter of the Microsoft style guide shows about ten different states of Windows push buttons, and the text implies that there are dozens more when all the combinations of features are taken into consideration.

The most important modes or states are, sorted roughly by importance:

In Qt, the QButton class provides most of the modes and other API, and QPushButton provides GUI logic. See QButton for more information about the API.

See also: QRadioButton, QToolButton, GUI Design Handbook: Push Button and Microsoft Style Guide

Examples: xform/xform.cpp layout/layout.cpp drawdemo/drawdemo.cpp popup/popup.cpp qmag/qmag.cpp rot13/rot13.cpp scrollview/scrollview.cpp customlayout/main.cpp


Member Function Documentation

void QPushButton::drawButton ( QPainter * paint ) [virtual protected]

Draws the push button, except its label.

See also: drawButtonLabel().

Reimplemented from QButton.

void QPushButton::drawButtonLabel ( QPainter * paint ) [virtual protected]

Draws the push button label.

See also: drawButton().

Reimplemented from QButton.

void QPushButton::focusInEvent ( QFocusEvent * e ) [virtual protected]

Handles focus in events for the push button.

Reimplemented from QWidget.

void QPushButton::focusOutEvent ( QFocusEvent * e ) [virtual protected]

Handles focus out events for the push button.

Reimplemented from QWidget.

void QPushButton::setOn ( bool enable ) [virtual slot]

Switches a toggle button on if enable is TRUE or off if enable is FALSE.

See also: isOn(), toggle(), toggled() and isToggleButton().

Examples: qmag/qmag.cpp

void QPushButton::toggle () [slot]

Toggles the state of a toggle button.

See also: isOn(), setOn(), toggled() and isToggleButton().


Search the documentation, FAQ, qt-interest archive and more (uses www.troll.no):


This file is part of the Qt toolkit, copyright © 1995-99 Troll Tech, all rights reserved.


Copyright © 1999 Troll TechTrademarks
Qt version 2.00