# class KSelectAction

###

Module | kdeui
Namespace |
Class | KSelectAction
Inherits | KAction

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.

### enums

- ToolBarMode { MenuMode, ComboBoxMode }

enum details

### methods

- KSelectAction (parent)

  returns ctor
  KDE 4.1.0 and later only

  Argument | Type | Default
  --- | --- | ---
  parent | QObject |

  Constructs a selection action with the specified parent.

  parent - The action's parent object.

- KSelectAction (text, parent)

  returns ctor

  Argument | Type | Default
  --- | --- | ---
  text | QString |
  parent | QObject |

  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...).

  text - The text that will be displayed.

  parent - The action's parent object.

- KSelectAction (icon, text, parent)

  returns ctor

  Argument | Type | Default
  --- | --- | ---
  icon | KIcon |
  text | QString |
  parent | QObject |

  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.

  icon - The icon to display.

  text - The text that will be displayed.

  parent - The action's parent object.

- KSelectAction (dd, parent)

  returns ctor
  Not implemented

  Argument | Type | Default
  --- | --- | ---
  dd | KSelectActionPrivate |
  parent | QObject |

  Internal Creates a new KSelectAction object.

  dd - the private d member

  parent - The action's parent object.

- KSelectAction (a0)

  returns ctor
  before KDE 4.1.0 only

  Argument | Type | Default
  --- | --- | ---
  a0 | QObject |

- action (index)

  returns QAction

  Argument | Type | Default
  --- | --- | ---
  index | int |

  Returns the action at index, if one exists.

- action (text, cs)

  returns QAction

  Argument | Type | Default
  --- | --- | ---
  text | QString |
  cs | Qt.CaseSensitivity | Qt.CaseSensitive

  Searches for an action with the specified text, using a search whose case sensitivity is defined by cs.

- actionTriggered (action)

  returns Nothing

  Argument | Type | Default
  --- | --- | ---
  action | QAction |

  This function is called whenever an action from the selections is triggered.

- actions ( )

  returns QList<QAction

  Returns the list of selectable actions

- addAction (action)

  returns Nothing

  Argument | Type | Default
  --- | --- | ---
  action | QAction |

  Add action to the list of selectable actions.

- addAction (text)

  returns KAction

  Argument | Type | Default
  --- | --- | ---
  text | QString |

  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 (icon, text)

  returns KAction

  Argument | Type | Default
  --- | --- | ---
  icon | KIcon |
  text | QString |

  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 (index, text)

  returns Nothing

  Argument | Type | Default
  --- | --- | ---
  index | int |
  text | QString |

  Changes the text of item index - to text - .

- clear ( )

  returns Nothing

  Clears up all the items in this action. The actions will be deleted for backwards compatibility with KDE3. If you just want to remove all actions, use removeAllActions()

- comboWidth ( )

  returns int

  When this action is plugged into a toolbar, it creates a combobox. This returns the maximum width set by setComboWidth

- createWidget (parent)

  returns QWidget

  Argument | Type | Default
  --- | --- | ---
  parent | QWidget |

  Reimplemented from

  See also QWidgetAction.

- currentAction ( )

  returns QAction

  Returns the current QAction.

  See also setCurrentAction

- currentItem ( )

  returns int

  Returns the index of the current item.

  See also currentItem and currentAction

- currentText ( )

  returns QString

  Returns the text of the currently selected item.

  See also currentItem and currentAction

- deleteWidget (widget)

  returns Nothing

  Argument | Type | Default
  --- | --- | ---
  widget | QWidget |

  Reimplemented from

  See also QWidgetAction.

- eventFilter (watched, event)

  returns bool

  Argument | Type | Default
  --- | --- | ---
  watched | QObject |
  event | QEvent |

- isEditable ( )

  returns bool

  When this action is plugged into a toolbar, it creates a combobox. Returns true if the combo editable.

- items ( )

  returns QStringList

  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().

- menuAccelsEnabled ( )

  returns bool

  Returns whether ampersands passed to methods using QStrings are interpreted as keyboard accelerator indicators or as literal ampersands.

- removeAction (action)

  returns QAction

  Argument | Type | Default
  --- | --- | ---
  action | QAction |

  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 ( )

  returns Nothing

- selectableActionGroup ( )

  returns QActionGroup

  The action group used to create exclusivity between the actions associated with this action.

- setComboWidth (width)

  returns Nothing

  Argument | Type | Default
  --- | --- | ---
  width | int |

  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).

- setCurrentAction (action)

  returns bool

  Argument | Type | Default
  --- | --- | ---
  action | QAction |

  Sets the currently checked item.

  action - the QAction to become the currently checked item.

  Returns true if a corresponding action was found and successfully checked.

- setCurrentAction (text, cs)

  returns bool

  Argument | Type | Default
  --- | --- | ---
  text | QString |
  cs | Qt.CaseSensitivity | 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

- setCurrentItem (index)

  returns bool

  Argument | Type | Default
  --- | --- | ---
  index | int |

  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 (a0)

  returns Nothing

  Argument | Type | Default
  --- | --- | ---
  a0 | bool |

  When this action is plugged into a toolbar, it creates a combobox. This makes the combo editable or read-only.

- setItems (lst)

  returns Nothing

  Argument | Type | Default
  --- | --- | ---
  lst | QStringList |

  Convenience function to create the list of selectable items. Any previously existing items will be cleared.

- setMaxComboViewCount (n)

  returns Nothing

  Argument | Type | Default
  --- | --- | ---
  n | int |

  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 (b)

  returns Nothing

  Argument | Type | Default
  --- | --- | ---
  b | bool |

  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.

  b - true if ampersands indicate a keyboard accelerator, otherwise false.

- setToolBarMode (mode)

  returns Nothing

  Argument | Type | Default
  --- | --- | ---
  mode | KSelectAction.ToolBarMode |

  Set the type of widget to be inserted in a toolbar to mode.

- setToolButtonPopupMode (mode)

  returns Nothing

  Argument | Type | Default
  --- | --- | ---
  mode | QToolButton.ToolButtonPopupMode |

  Set how this list of actions should behave when in popup mode and plugged into a toolbar.

- slotToggled (a0)

  returns Nothing

  Argument | Type | Default
  --- | --- | ---
  a0 | bool |

  For structured menu building. Deselects all items if the action was unchecked by the top menu

- toolBarMode ( )

  returns KSelectAction.ToolBarMode

  Returns which type of widget (combo box or button with drop-down menu) will be inserted in a toolbar.

- toolButtonPopupMode ( )

  returns QToolButton.ToolButtonPopupMode

  Returns the style for the list of actions, when this action is plugged into a KToolBar. The default value is QToolButton.InstantPopup

  See also QToolButton.setPopupMode()

- triggered (action)

  returns Nothing
  SIGNAL ("triggered (QAction*)")

  Argument | Type | Default
  --- | --- | ---
  action | QAction |

  This signal is emitted when an item is selected; action - indicates the item selected.

- triggered (index)

  returns Nothing
  SIGNAL ("triggered (int)")

  Argument | Type | Default
  --- | --- | ---
  index | int |

  This signal is emitted when an item is selected; index - indicates the item selected.

- triggered (text)

  returns Nothing
  SIGNAL ("triggered (const QString&)")

  Argument | Type | Default
  --- | --- | ---
  text | QString |

  This signal is emitted when an item is selected; text - indicates the item selected.

### enums - detail

- ToolBarMode { MenuMode, ComboBoxMode }

  Creates a button which pops up a menu when interacted with, as defined by toolButtonPopupMode().

  | MenuMode | - | - |
  | ComboBoxMode | - | - |