KSelectAction Class Reference
from PyKDE4.kdeui import *
Inherits: KAction → QWidgetAction → QAction → QObject
Subclasses: KCodecAction, KFontAction, KFontSizeAction, KRecentFilesAction
Detailed Description
Action for selecting one of several items
Action for selecting one of several items.
This action shows up a submenu with a list of items. One of them can be checked. If the user clicks on an item this item will automatically be checked, the formerly checked item becomes unchecked. There can be only one item checked at a time.
Enumerations | |
ToolBarMode | { MenuMode, ComboBoxMode } |
Signals | |
triggered (QAction action) | |
triggered (int index) | |
triggered (QString text) | |
Methods | |
__init__ (self, QObject parent) | |
__init__ (self, QString text, QObject parent) | |
__init__ (self, KIcon icon, QString text, QObject parent) | |
__init__ (self, KSelectActionPrivate dd, QObject parent) | |
QAction | action (self, int index) |
QAction | action (self, QString text, Qt.CaseSensitivity cs=Qt.CaseSensitive) |
actionTriggered (self, QAction action) | |
[QActio] | actions (self) |
addAction (self, QAction action) | |
KAction | addAction (self, QString text) |
KAction | addAction (self, KIcon icon, QString text) |
changeItem (self, int index, QString text) | |
clear (self) | |
int | comboWidth (self) |
QWidget | createWidget (self, QWidget parent) |
QAction | currentAction (self) |
int | currentItem (self) |
QString | currentText (self) |
deleteWidget (self, QWidget widget) | |
bool | eventFilter (self, QObject watched, QEvent event) |
bool | isEditable (self) |
QStringList | items (self) |
bool | menuAccelsEnabled (self) |
QAction | removeAction (self, QAction action) |
removeAllActions (self) | |
QActionGroup | selectableActionGroup (self) |
setComboWidth (self, int width) | |
bool | setCurrentAction (self, QAction action) |
bool | setCurrentAction (self, QString text, Qt.CaseSensitivity cs=Qt.CaseSensitive) |
bool | setCurrentItem (self, int index) |
setEditable (self, bool a0) | |
setItems (self, QStringList lst) | |
setMaxComboViewCount (self, int n) | |
setMenuAccelsEnabled (self, bool b) | |
setToolBarMode (self, KSelectAction.ToolBarMode mode) | |
setToolButtonPopupMode (self, QToolButton.ToolButtonPopupMode mode) | |
slotToggled (self, bool a0) | |
KSelectAction.ToolBarMode | toolBarMode (self) |
QToolButton.ToolButtonPopupMode | toolButtonPopupMode (self) |
triggered (self, QAction action) | |
triggered (self, int index) | |
triggered (self, QString text) |
Method Documentation
__init__ | ( | self, | ||
QObject | parent | |||
) |
Constructs a selection action with the specified parent.
- Parameters:
-
parent The action's parent object.
Constructs a selection action with text; a shortcut may be specified by the ampersand character (e.g. "&Option" creates a shortcut with key O )
This is the most common KSelectAction used when you do not have a corresponding icon (note that it won't appear in the current version of the "Edit ToolBar" dialog, because an action needs an icon to be plugged in a toolbar...).
- Parameters:
-
text The text that will be displayed. parent The action's parent object.
Constructs a selection action with text and an icon; a shortcut may be specified by the ampersand character (e.g. "&Option" creates a shortcut with key O )
This is the other common KSelectAction used. Use it when you do have a corresponding icon.
- Parameters:
-
icon The icon to display. text The text that will be displayed. parent The action's parent object.
__init__ | ( | self, | ||
KSelectActionPrivate | dd, | |||
QObject | parent | |||
) |
- Internal:
- Creates a new KSelectAction object.
- Parameters:
-
dd the private d member parent The action's parent object.
QAction action | ( | self, | ||
int | index | |||
) |
Returns the action at index, if one exists.
QAction action | ( | self, | ||
QString | text, | |||
Qt.CaseSensitivity | cs=Qt.CaseSensitive | |||
) |
Searches for an action with the specified text, using a search whose case sensitivity is defined by cs.
actionTriggered | ( | self, | ||
QAction | action | |||
) |
This function is called whenever an action from the selections is triggered.
[QActio] actions | ( | self ) |
Returns the list of selectable actions
addAction | ( | self, | ||
QAction | action | |||
) |
Add action to the list of selectable actions.
addAction(QAction* action)
Convenience function which creates an action from text and inserts it into the list of selectable actions.
The newly created action is checkable and not user configurable.
addAction(QAction* action)
Convenience function which creates an action from text and icon and inserts it into the list of selectable actions.
The newly created action is checkable and not user configurable.
changeItem | ( | self, | ||
int | index, | |||
QString | text | |||
) |
Changes the text of item
- Parameters:
-
index to text .
clear | ( | self ) |
Clears up all the items in this action.
- Warning:
- The actions will be deleted for backwards compatibility with KDE3. If you just want to remove all actions, use removeAllActions()
int comboWidth | ( | self ) |
When this action is plugged into a toolbar, it creates a combobox. This returns the maximum width set by setComboWidth
QAction currentAction | ( | self ) |
Returns the current QAction.
- See also:
- setCurrentAction
int currentItem | ( | self ) |
Returns the index of the current item.
@sa currentItem and currentAction
QString currentText | ( | self ) |
Returns the text of the currently selected item.
@sa currentItem and currentAction
deleteWidget | ( | self, | ||
QWidget | widget | |||
) |
Reimplemented from
- See also:
- QWidgetAction.
bool isEditable | ( | self ) |
When this action is plugged into a toolbar, it creates a combobox.
- Returns:
- true if the combo editable.
QStringList items | ( | self ) |
Convenience function which returns the items that can be selected with this action. It is the same as iterating selectableActionGroup()->actions() and looking at each action's text().
bool menuAccelsEnabled | ( | self ) |
Returns whether ampersands passed to methods using QStrings are interpreted as keyboard accelerator indicators or as literal ampersands.
Remove the specified action from this action selector.
You take ownership here, so save or delete it in order to not leak the action.
removeAllActions | ( | self ) |
QActionGroup selectableActionGroup | ( | self ) |
The action group used to create exclusivity between the actions associated with this action.
setComboWidth | ( | self, | ||
int | width | |||
) |
When this action is plugged into a toolbar, it creates a combobox. This gives a _maximum_ size to the combobox. The minimum size is automatically given by the contents (the items).
bool setCurrentAction | ( | self, | ||
QAction | action | |||
) |
Sets the currently checked item.
- Parameters:
-
action the QAction to become the currently checked item.
- Returns:
- true if a corresponding action was found and successfully checked.
bool setCurrentAction | ( | self, | ||
QString | text, | |||
Qt.CaseSensitivity | cs=Qt.CaseSensitive | |||
) |
setCurrentAction(QAction*)
Convenience function to set the currently checked action to be the action which has text as its text().
If there is no action at that index, the currently checked action (if any) will be deselected.
- Returns:
- true if a corresponding action was found, otherwise false
bool setCurrentItem | ( | self, | ||
int | index | |||
) |
setCurrentAction(QAction*)
Convenience function to set the currently checked action to be the action at index index.
If there is no action at that index, the currently checked action (if any) will be deselected.
- Returns:
- true if a corresponding action was found and thus set to the current action, otherwise false
setEditable | ( | self, | ||
bool | a0 | |||
) |
When this action is plugged into a toolbar, it creates a combobox. This makes the combo editable or read-only.
setItems | ( | self, | ||
QStringList | lst | |||
) |
Convenience function to create the list of selectable items. Any previously existing items will be cleared.
setMaxComboViewCount | ( | self, | ||
int | n | |||
) |
Sets the maximum items that are visible at once if the action is a combobox, that is the number of items in the combobox's viewport
setMenuAccelsEnabled | ( | self, | ||
bool | b | |||
) |
Sets whether any occurrence of the ampersand character ( & ) in items should be interpreted as keyboard accelerator for items displayed in a menu or not. Only applies to (overloaded) methods dealing with QStrings, not those dealing with QActions.
Defaults to true.
- Parameters:
-
b true if ampersands indicate a keyboard accelerator, otherwise false.
setToolBarMode | ( | self, | ||
KSelectAction.ToolBarMode | mode | |||
) |
Set the type of widget to be inserted in a toolbar to mode.
setToolButtonPopupMode | ( | self, | ||
QToolButton.ToolButtonPopupMode | mode | |||
) |
Set how this list of actions should behave when in popup mode and plugged into a toolbar.
slotToggled | ( | self, | ||
bool | a0 | |||
) |
For structured menu building. Deselects all items if the action was unchecked by the top menu
KSelectAction.ToolBarMode toolBarMode | ( | self ) |
Returns which type of widget (combo box or button with drop-down menu) will be inserted in a toolbar.
QToolButton.ToolButtonPopupMode toolButtonPopupMode | ( | self ) |
Returns the style for the list of actions, when this action is plugged into a KToolBar. The default value is QToolButton.InstantPopup
\sa QToolButton.setPopupMode()
triggered | ( | self, | ||
QAction | action | |||
) |
This signal is emitted when an item is selected;
- Parameters:
-
action indicates the item selected.
- Signal syntax:
QObject.connect(source, SIGNAL("triggered(QAction*)"), target_slot)
triggered | ( | self, | ||
int | index | |||
) |
This signal is emitted when an item is selected;
- Parameters:
-
index indicates the item selected.
- Signal syntax:
QObject.connect(source, SIGNAL("triggered(int)"), target_slot)
triggered | ( | self, | ||
QString | text | |||
) |
This signal is emitted when an item is selected;
- Parameters:
-
text indicates the item selected.
- Signal syntax:
QObject.connect(source, SIGNAL("triggered(const QString&)"), target_slot)
Enumeration Documentation
ToolBarMode |
Creates a button which pops up a menu when interacted with, as defined by toolButtonPopupMode().
- Enumerator:
-
MenuMode ComboBoxMode