KDE 4.5 PyKDE API Reference
  • KDE's Python API
  • Overview
  • PyKDE Home
  • Sitemap
  • Contact Us
 

KActionSelector Class Reference

from PyKDE4.kdeui import *

Inherits: QWidget → QObject

Detailed Description

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

"KDE Action Selector"

Author:
Anders Lund <anders@alweb.dk>


Enumerations

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

Signals

 added (QListWidgetItem item)
 movedDown (QListWidgetItem item)
 movedUp (QListWidgetItem item)
 removed (QListWidgetItem item)

Methods

 __init__ (self, QWidget parent=0)
 __init__ (self, KActionSelector a0)
KActionSelector.InsertionPolicy availableInsertionPolicy (self)
QString availableLabel (self)
QListWidget availableListWidget (self)
bool eventFilter (self, QObject a0, QEvent a1)
 keyPressEvent (self, QKeyEvent a0)
bool keyboardEnabled (self)
bool moveOnDoubleClick (self)
 polish (self)
KActionSelector.InsertionPolicy selectedInsertionPolicy (self)
QString selectedLabel (self)
QListWidget selectedListWidget (self)
 setAvailableInsertionPolicy (self, KActionSelector.InsertionPolicy policy)
 setAvailableLabel (self, QString text)
 setButtonIcon (self, QString icon, KActionSelector.MoveButton button)
 setButtonIconSet (self, QIcon iconset, KActionSelector.MoveButton button)
 setButtonTooltip (self, QString tip, KActionSelector.MoveButton button)
 setButtonWhatsThis (self, QString text, KActionSelector.MoveButton button)
 setButtonsEnabled (self)
 setKeyboardEnabled (self, bool enable)
 setMoveOnDoubleClick (self, bool enable)
 setSelectedInsertionPolicy (self, KActionSelector.InsertionPolicy policy)
 setSelectedLabel (self, QString text)
 setShowUpDownButtons (self, bool show)
bool showUpDownButtons (self)

Signal Documentation

added ( QListWidgetItem  item
)

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

Signal syntax:
QObject.connect(source, SIGNAL("added(QListWidgetItem*)"), target_slot)
movedDown ( QListWidgetItem  item
)

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

Signal syntax:
QObject.connect(source, SIGNAL("movedDown(QListWidgetItem*)"), target_slot)
movedUp ( QListWidgetItem  item
)

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

Signal syntax:
QObject.connect(source, SIGNAL("movedUp(QListWidgetItem*)"), target_slot)
removed ( QListWidgetItem  item
)

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

Signal syntax:
QObject.connect(source, SIGNAL("removed(QListWidgetItem*)"), target_slot)

Method Documentation

__init__ (  self,
QWidget  parent=0
)
__init__ (  self,
KActionSelector  a0
)
KActionSelector.InsertionPolicy availableInsertionPolicy (   self )

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

QString availableLabel (   self )

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

QListWidget availableListWidget (   self )

Returns:
The QListWidget holding the available actions

bool eventFilter (  self,
QObject  a0,
QEvent  a1
)

Reimplemented for internal reasons.

keyPressEvent (  self,
QKeyEvent  a0
)

Reimplamented for internal reasons.

bool keyboardEnabled (   self )

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.

    @sa setKeyboardEnabled()

    bool moveOnDoubleClick (   self )

    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. @sa setMoveOnDoubleClick()

    polish (   self )

    Reimplemented for internal reasons. (calls setButtonsEnabled())

    KActionSelector.InsertionPolicy selectedInsertionPolicy (   self )

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

    QString selectedLabel (   self )

    Returns:
    the label of the selected items listbox.

    QListWidget selectedListWidget (   self )

    Returns:
    The QListWidget holding the selected actions

    setAvailableInsertionPolicy (  self,
    KActionSelector.InsertionPolicy  policy
    )

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

    setAvailableLabel (  self,
    QString  text
    )

    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 (  self,
    QString  icon,
    KActionSelector.MoveButton  button
    )

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

    setButtonIconSet (  self,
    QIcon  iconset,
    KActionSelector.MoveButton  button
    )

    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 (  self,
    QString  tip,
    KActionSelector.MoveButton  button
    )

    Sets the tooltip for the button button to tip.

    setButtonWhatsThis (  self,
    QString  text,
    KActionSelector.MoveButton  button
    )

    Sets the whatsthis help for button button to text.

    setButtonsEnabled (   self )

    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 (  self,
    bool  enable
    )

    Sets the keyboard enabled depending on enable. @sa keyboardEnabled()

    setMoveOnDoubleClick (  self,
    bool  enable
    )

    Sets moveOnDoubleClick to enable @sa moveOnDoubleClick()

    setSelectedInsertionPolicy (  self,
    KActionSelector.InsertionPolicy  policy
    )

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

    setSelectedLabel (  self,
    QString  text
    )

    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 (  self,
    bool  show
    )

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

    bool showUpDownButtons (   self )

    Returns:
    whether the Up and Down buttons should be displayed.


    Enumeration Documentation

    InsertionPolicy

    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.
  • @sa availableInsertionPolicy(), setAvailableInsertionPolicy(), selectedInsertionPolicy(), setSelectedInsertionPolicy().

    Enumerator:
    BelowCurrent 
    Sorted 
    AtTop 
    AtBottom 

    MoveButton

    This enum indentifies the moving buttons

    Enumerator:
    ButtonAdd 
    ButtonRemove 
    ButtonUp 
    ButtonDown 

    • Full Index

    Modules

    • akonadi
    • dnssd
    • kdecore
    • kdeui
    • khtml
    • kio
    • knewstuff
    • kparts
    • kutils
    • nepomuk
    • phonon
    • plasma
    • polkitqt
    • solid
    • soprano
    This documentation is maintained by Simon Edwards.
    KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal