The Qt documentation in C++ of this class can be read here: http://doc.trolltech.com/4.3/qpushbutton.html
A control for the form object, provides a push button.
The command button, or push button, is perhaps the most commonly used control in any graphical user interface. Push (click) a button to command the computer to perform some action, or to answer a question. Typical buttons are OK, Apply, Cancel, Close, Yes, No and Help.
A command button is rectangular and typically displays a text label describing its action. An underlined character in the label (signified by preceding it with an ampersand in the text) indicates an accelerator key. Command buttons can display a textual label or an icon.
Most important
Please read the control class overview Control as well.
Property AutoDefault As Boolean (ReadWrite)
Property Default As Boolean (ReadWrite)
This property holds whether the CommandButton is the default button.
If it is to true then the CommandButton will be pressed if the user presses the Enter (or Return) key in a dialog.
Regardless of focus, if the user presses Enter: If there is a default button the default button is pressed; otherwise, if there are one or more autoDefault buttons.
The default button behavior is provided only in dialogs. Buttons can always be clicked from the keyboard by pressing Spacebar when the button has focus.
Property Checkable As Boolean (ReadWrite)
If it is true, the CommandButton appears as checkable button. If you would like to group several buttons as auto-exclusive group, set for all buttons the same group name.
Property Checked As Boolean (ReadWrite)
If it is true, the CommandButton is checked.
Property Flat As Boolean (ReadWrite)
If it is true, the CommandButton appears as flat button. This is only useful to change the visual appearance.
Property Icon As String (ReadWrite)
Either an icon or caption is visible on a CommandButton. If you set an icon, the caption will not be displayed. An icon can be an absolute path to an image file (png, jpg,…) like c:\myfolder\myimage.png or can be an relative path to the current project like myimage.png (which is present in the current project directory). Relative paths are recommended.
Might be a String containing binary data. See the binary project example for using.
Example
Dim c As CommandButton c = Control("Button1") ' Button1 is declared as CommandButton in this form c.Icon= "tux.jpg" ' relative path. File exists in current project directory
See also Caption
Property Key As String (ReadWrite)
Holds the information, which key press would raise the event connected to this CommandButton, e.g. Ctrl+O. The strings “Ctrl”, “Shift”, “Alt” and “Meta” are recognized.
Example
Shift+L Alt+U Alt+Shift+U Ctrl+Alt+C Copy
Default keys are
HelpContents | Open help contents |
WhatsThis | Activate whats this. |
Open | Open Document. |
Close | Close Document/Tab. |
Save | Save Document. |
New | Create new Document. |
Delete | Delete. |
Cut | Cut. |
Copy | Copy. |
Paste | Paste. |
Undo | Undo. |
Redo | Redo. |
Back | Navigate back. |
Forward | Navigate forward. |
Refresh | Refresh or reload current document. |
ZoomIn | Zoom in. |
ZoomOut | Zoom out. |
Print document. | |
AddTab | Add new tab. |
NextChild | Navigate to next tab or child window. |
PreviousChild | Navigate to previous tab or child window. |
Find | Find in document. |
FindNext | Find next result. |
FindPrevious | Find previous result. |
Replace | Find and replace. |
SelectAll | Select all text. |
Bold | Bold text. |
Italic | Italic text. |
Underline | Underline text. |
MoveToNextChar | Move cursor to next character. |
MoveToPreviousChar | Move cursor to previous character. |
MoveToNextWord | Move cursor to next word. |
MoveToPreviousWord | Move cursor to previous word. |
MoveToNextLine | Move cursor to next line. |
MoveToPreviousLine | Move cursor to previous line. |
MoveToNextPage | Move cursor to next page. |
MoveToPreviousPage | Move cursor to previous page. |
MoveToStartOfLine | Move cursor to start of line. |
MoveToEndOfLine | Move cursor to end of line. |
MoveToStartOfBlock | Move cursor to start of a block. This shortcut is only used on OS X. |
MoveToEndOfBlock | Move cursor to end of block. This shortcut is only used on the OS X. |
MoveToStartOfDocument | Move cursor to start of document. |
MoveToEndOfDocument | Move cursor to end of document. |
SelectNextChar | Extend selection to next character. |
SelectPreviousChar | Extend selection to previous character. |
SelectNextWord | Extend selection to next word. |
SelectPreviousWord | Extend selection to previous word. |
SelectNextLine | Extend selection to next line. |
SelectPreviousLine | Extend selection to previous line. |
SelectNextPage | Extend selection to next page. |
SelectPreviousPage | Extend selection to previous page. |
SelectStartOfLine | Extend selection to start of line. |
SelectEndOfLine | Extend selection to end of line. |
SelectStartOfBlock | Extend selection to the start of a text block. This shortcut is only used on OS X. |
SelectEndOfBlock | Extend selection to the end of a text block. This shortcut is only used on OS X. |
SelectStartOfDocument | Extend selection to start of document. |
SelectEndOfDocument | Extend selection to end of document. |
DeleteStartOfWord | Delete the beginning of a word up to the cursor. |
DeleteEndOfWord | Delete word from the end of the cursor. |
DeleteEndOfLine |
Property Caption As String (ReadWrite)
Holds the text to be displayed on the CommandButton.
Example
Dim c As CommandButton c = FormControl("Button1") ' Button1 is declared as CommandButton in this form c.Caption = "Hello World!"
If you want the commandbutton to respond to key inputs, set the property Key. The character ”&” is used to underline the key the next character. Double ”&&” shows one ”&” in the caption.
See also Icon
Property Value As String (ReadWrite)
Same as Caption. Provided for easy-use.
Not implemented yet:
AutoRepeat ( bool ) AutoRepeatDelay ( int ) AutoRepeatInterval ( int )
Sub OnEvent()
This event is raised, whenever the user presses the CommandButton, either by mouse or key.
Example
Sub Button1_OnEvent() Print "Button1 pressed" End Sub