# class KActionSelector

###

Module | kdeui
Namespace |
Class | KActionSelector
Inherits | QWidget

A widget for selecting and arranging actions/objects

This widget allows the user to select from a set of objects and arrange the order of the selected ones using two list boxes labeled "Available" and "Used" with horizontal arrows in between to move selected objects between the two, and vertical arrows on the right to arrange the order of the selected objects.

The widget moves objects to the other listbox when doubleclicked if the property moveOnDoubleClick is set to true (default). See moveOnDoubleClick() and setMoveOnDoubleClick().

The user control the widget using the keyboard if enabled (default), see keyboardEnabled.

Note that this may conflist with keyboard selection in the selected list box, if you set that to anything else than QListWidget.Single (which is the default).

To use it, simply construct an instance and then add items to the two listboxes, available through lbAvailable() and lbSelected(). Whenever you want, you can retrieve the selected options using QListWidget methods on lbSelected().

This way, you can use your own QListWidgetItem class, allowing you to easily store object data in those.

When an item is moved to a listbox, it is placed below the current item of that listbox.

Standard arrow icons are used, but you can use icons of your own choice if desired, see setButtonIcon(). It is also possible to set tooltips and whatsthis help for the buttons. See setButtonTooltip() and setButtonWhatsThis().

To set whatsthis or tooltips for the listboxes, access them through availableListWidget() and selectedListWidget().

All the moving buttons are automatically set enabled as expected.

Signals are sent each time an item is moved, allowing you to follow the users actions if you need to. See addedToSelection(), removedFromSelection(), movedUp() and movedDown()

Author Anders Lund <anders@alweb.dk>

### enums

- InsertionPolicy { BelowCurrent, Sorted, AtTop, AtBottom }
- MoveButton { ButtonAdd, ButtonRemove, ButtonUp, ButtonDown }

enum details

### methods

- KActionSelector (parent)

  returns ctor
  KDE 4.1.0 and later only

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

- KActionSelector (a0)

  returns ctor
  Not implemented

  Argument | Type | Default
  --- | --- | ---
  a0 | KActionSelector |

- KActionSelector (a0)

  returns ctor
  before KDE 4.1.0 only

  Argument | Type | Default
  --- | --- | ---
  a0 | QWidget | 0

- added (item)

  returns Nothing
  SIGNAL ("added (QListWidgetItem*)")

  Argument | Type | Default
  --- | --- | ---
  item | QListWidgetItem |

  Emitted when an item is moved to the "selected" listbox.

- availableInsertionPolicy ( )

  returns KActionSelector.InsertionPolicy

  Returns The current insertion policy for the available listbox. The default policy for the available listbox is Sorted. See also InsertionPolicy, setAvailableInsertionPolicy().

- availableLabel ( )

  returns QString

  Returns The text of the label for the available items listbox.

- availableListWidget ( )

  returns QListWidget

  Returns The QListWidget holding the available actions

- eventFilter (a0, a1)

  returns bool

  Argument | Type | Default
  --- | --- | ---
  a0 | QObject |
  a1 | QEvent |

  Reimplemented for internal reasons.

- keyPressEvent (a0)

  returns Nothing

  Argument | Type | Default
  --- | --- | ---
  a0 | QKeyEvent |

  Reimplamented for internal reasons.

- keyboardEnabled ( )

  returns bool

  Returns Weather keyboard control is enabled.

  When Keyboard control is enabled, the widget will react to the following keyboard actions:

- CTRL + Right - simulate clicking the add button
- CTRL + Left - simulate clicking the remove button
- CTRL + Up - simulate clicking the up button
- CTRL + Down - simulate clicking the down button

Additionally, pressing RETURN or ENTER on one of the list boxes will cause the current item of that listbox to be moved to the other listbox.

The keyboard actions are enabled by default.

See also setKeyboardEnabled()

- moveOnDoubleClick ( )

  returns bool

  Returns Whether moveOnDoubleClcik is enabled.

  If enabled, an item in any listbox will be moved to the other one whenever doubleclicked. This feature is enabled by default.

  See also setMoveOnDoubleClick()

- movedDown (item)

  returns Nothing
  SIGNAL ("movedDown (QListWidgetItem*)")

  Argument | Type | Default
  --- | --- | ---
  item | QListWidgetItem |

  Emitted when an item is moved downwards in the "selected" listbox.

- movedUp (item)

  returns Nothing
  SIGNAL ("movedUp (QListWidgetItem*)")

  Argument | Type | Default
  --- | --- | ---
  item | QListWidgetItem |

  Emitted when an item is moved upwards in the "selected" listbox.

- polish ( )

  returns Nothing

  Reimplemented for internal reasons. (calls setButtonsEnabled())

- removed (item)

  returns Nothing
  SIGNAL ("removed (QListWidgetItem*)")

  Argument | Type | Default
  --- | --- | ---
  item | QListWidgetItem |

  Emitted when an item is moved out of the "selected" listbox.

- selectedInsertionPolicy ( )

  returns KActionSelector.InsertionPolicy

  Returns The current insertion policy for the selected listbox. The default policy for the selected listbox is BelowCurrent. See also InsertionPolicy, setSelectedInsertionPolicy().

- selectedLabel ( )

  returns QString

  Returns the label of the selected items listbox.

- selectedListWidget ( )

  returns QListWidget

  Returns The QListWidget holding the selected actions

- setAvailableInsertionPolicy (policy)

  returns Nothing

  Argument | Type | Default
  --- | --- | ---
  policy | KActionSelector.InsertionPolicy |

  Sets the insertion policy for the available listbox. See also InsertionPolicy, availableInsertionPolicy().

- setAvailableLabel (text)

  returns Nothing

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

  Sets the label for the available items listbox to text. Note that this label has the listbox as its buddy, so that if you have a single ampersand in the text, the following character will become the accellerator to focus te listbox.

- setButtonIcon (icon, button)

  returns Nothing

  Argument | Type | Default
  --- | --- | ---
  icon | QString |
  button | KActionSelector.MoveButton |

  Sets the pixmap of the button button to icon. It calls SmallIconSet(pm) to generate the icon set.

- setButtonIconSet (iconset, button)

  returns Nothing

  Argument | Type | Default
  --- | --- | ---
  iconset | QIcon |
  button | KActionSelector.MoveButton |

  Sets the iconset for button button to iconset. You can use this method to et a costum icon set. Either created by QIconSet, or use the application instance of KIconLoader (recommended).

- setButtonTooltip (tip, button)

  returns Nothing

  Argument | Type | Default
  --- | --- | ---
  tip | QString |
  button | KActionSelector.MoveButton |

  Sets the tooltip for the button button to tip.

- setButtonWhatsThis (text, button)

  returns Nothing

  Argument | Type | Default
  --- | --- | ---
  text | QString |
  button | KActionSelector.MoveButton |

  Sets the whatsthis help for button button to text.

- setButtonsEnabled ( )

  returns Nothing

  Sets the enabled state of all moving buttons to reflect the current options.

  Be sure to call this if you add or removes items to either listbox after the widget is show()n

- setKeyboardEnabled (enable)

  returns Nothing

  Argument | Type | Default
  --- | --- | ---
  enable | bool |

  Sets the keyboard enabled depending on enable.

  See also keyboardEnabled()

- setMoveOnDoubleClick (enable)

  returns Nothing

  Argument | Type | Default
  --- | --- | ---
  enable | bool |

  Sets moveOnDoubleClick to enable

  See also moveOnDoubleClick()

- setSelectedInsertionPolicy (policy)

  returns Nothing

  Argument | Type | Default
  --- | --- | ---
  policy | KActionSelector.InsertionPolicy |

  Sets the insertion policy for the selected listbox. See also InsertionPolicy, selectedInsertionPolicy().

- setSelectedLabel (text)

  returns Nothing

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

  Sets the label for the selected items listbox to text. Note that this label has the listbox as its buddy, so that if you have a single ampersand in the text, the following character will become the accellerator to focus te listbox.

- setShowUpDownButtons (show)

  returns Nothing

  Argument | Type | Default
  --- | --- | ---
  show | bool |

  Sets whether the Up and Down buttons should be displayed according to show

- showUpDownButtons ( )

  returns bool

  Returns whether the Up and Down buttons should be displayed.

### enums - detail

- InsertionPolicy { BelowCurrent, Sorted, AtTop, AtBottom }

  This enum defines policies for where to insert moved items in a listbox. The following policies are currently defined:

- BelowCurrent - The item is inserted below the listbox'
currentItem() or at the end if there is no curent item.
- Sorted - The listbox is sort()ed after one or more items are inserted.
- AtTop - The item is inserted at index 0 in the listbox.
- AtBottom - The item is inserted at the end of the listbox.

See also availableInsertionPolicy(), setAvailableInsertionPolicy(), selectedInsertionPolicy(), setSelectedInsertionPolicy().

| BelowCurrent | - | - |
| Sorted | - | - |
| AtTop | - | - |
| AtBottom | - | - |

- MoveButton { ButtonAdd, ButtonRemove, ButtonUp, ButtonDown }

  This enum indentifies the moving buttons

  | ButtonAdd | - | - |
  | ButtonRemove | - | - |
  | ButtonUp | - | - |
  | ButtonDown | - | - |