• Skip to content
  • Skip to link menu
KDE API Reference
  • KDE API Reference
  • kdelibs API Reference
  • KDE Home
  • Contact Us
 

KDEUI

Public Types | Public Slots | Signals | Public Member Functions | Protected Member Functions | Properties | List of all members
KActionSelector Class Reference

#include <kactionselector.h>

Inheritance diagram for KActionSelector:
Inheritance graph
[legend]

Public Types

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

Public Slots

void polish ()
 

Signals

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

Public Member Functions

 KActionSelector (QWidget *parent=0)
 
 ~KActionSelector ()
 
InsertionPolicy availableInsertionPolicy () const
 
QString availableLabel () const
 
QListWidget * availableListWidget () const
 
bool keyboardEnabled () const
 
bool moveOnDoubleClick () const
 
InsertionPolicy selectedInsertionPolicy () const
 
QString selectedLabel () const
 
QListWidget * selectedListWidget () const
 
void setAvailableInsertionPolicy (InsertionPolicy policy)
 
void setAvailableLabel (const QString &text)
 
void setButtonIcon (const QString &icon, MoveButton button)
 
void setButtonIconSet (const QIcon &iconset, MoveButton button)
 
void setButtonsEnabled ()
 
void setButtonTooltip (const QString &tip, MoveButton button)
 
void setButtonWhatsThis (const QString &text, MoveButton button)
 
void setKeyboardEnabled (bool enable)
 
void setMoveOnDoubleClick (bool enable)
 
void setSelectedInsertionPolicy (InsertionPolicy policy)
 
void setSelectedLabel (const QString &text)
 
void setShowUpDownButtons (bool show)
 
bool showUpDownButtons () const
 

Protected Member Functions

bool eventFilter (QObject *, QEvent *)
 
void keyPressEvent (QKeyEvent *)
 

Properties

InsertionPolicy availableInsertionPolicy
 
QString availableLabel
 
bool keyboardEnabled
 
bool moveOnDoubleClick
 
InsertionPolicy selectedInsertionPolicy
 
QString selectedLabel
 
bool showUpDownButtons
 

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

kactionselector.png
KDE Action Selector
Author
Anders Lund ander.nosp@m.s@al.nosp@m.web.d.nosp@m.k

Definition at line 80 of file kactionselector.h.

Member Enumeration Documentation

enum KActionSelector::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.
See also
availableInsertionPolicy(), setAvailableInsertionPolicy(), selectedInsertionPolicy(), setSelectedInsertionPolicy().
Enumerator
BelowCurrent 
Sorted 
AtTop 
AtBottom 

Definition at line 127 of file kactionselector.h.

enum KActionSelector::MoveButton

This enum indentifies the moving buttons.

Enumerator
ButtonAdd 
ButtonRemove 
ButtonUp 
ButtonDown 

Definition at line 108 of file kactionselector.h.

Constructor & Destructor Documentation

KActionSelector::KActionSelector ( QWidget *  parent = 0)
explicit

Definition at line 82 of file kactionselector.cpp.

KActionSelector::~KActionSelector ( )

Definition at line 153 of file kactionselector.cpp.

Member Function Documentation

void KActionSelector::added ( QListWidgetItem *  item)
signal

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

InsertionPolicy KActionSelector::availableInsertionPolicy ( ) const
Returns
The current insertion policy for the available listbox. The default policy for the available listbox is Sorted. See also InsertionPolicy, setAvailableInsertionPolicy().
QString KActionSelector::availableLabel ( ) const
Returns
The text of the label for the available items listbox.
QListWidget * KActionSelector::availableListWidget ( ) const
Returns
The QListWidget holding the available actions

Definition at line 162 of file kactionselector.cpp.

bool KActionSelector::eventFilter ( QObject *  o,
QEvent *  e 
)
protected

Reimplemented for internal reasons.

Definition at line 395 of file kactionselector.cpp.

bool KActionSelector::keyboardEnabled ( ) const
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()
void KActionSelector::keyPressEvent ( QKeyEvent *  e)
protected

Reimplamented for internal reasons.

Definition at line 369 of file kactionselector.cpp.

void KActionSelector::movedDown ( QListWidgetItem *  item)
signal

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

void KActionSelector::movedUp ( QListWidgetItem *  item)
signal

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

bool KActionSelector::moveOnDoubleClick ( ) const
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()
void KActionSelector::polish ( )
slot

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

Reimplemented for internal reasons. (calls setButtonsEnabled())

Definition at line 361 of file kactionselector.cpp.

void KActionSelector::removed ( QListWidgetItem *  item)
signal

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

InsertionPolicy KActionSelector::selectedInsertionPolicy ( ) const
Returns
The current insertion policy for the selected listbox. The default policy for the selected listbox is BelowCurrent. See also InsertionPolicy, setSelectedInsertionPolicy().
QString KActionSelector::selectedLabel ( ) const
Returns
the label of the selected items listbox.
QListWidget * KActionSelector::selectedListWidget ( ) const
Returns
The QListWidget holding the selected actions

Definition at line 167 of file kactionselector.cpp.

void KActionSelector::setAvailableInsertionPolicy ( InsertionPolicy  policy)

Sets the insertion policy for the available listbox.

See also InsertionPolicy, availableInsertionPolicy().

Definition at line 322 of file kactionselector.cpp.

void KActionSelector::setAvailableLabel ( const 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.

Definition at line 302 of file kactionselector.cpp.

void KActionSelector::setButtonIcon ( const QString &  icon,
MoveButton  button 
)

Sets the pixmap of the button button to icon.

It calls SmallIconSet(pm) to generate the icon set.

Definition at line 172 of file kactionselector.cpp.

void KActionSelector::setButtonIconSet ( const QIcon &  iconset,
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).

Definition at line 197 of file kactionselector.cpp.

void KActionSelector::setButtonsEnabled ( )

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

Definition at line 264 of file kactionselector.cpp.

void KActionSelector::setButtonTooltip ( const QString &  tip,
MoveButton  button 
)

Sets the tooltip for the button button to tip.

Definition at line 218 of file kactionselector.cpp.

void KActionSelector::setButtonWhatsThis ( const QString &  text,
MoveButton  button 
)

Sets the whatsthis help for button button to text.

Definition at line 243 of file kactionselector.cpp.

void KActionSelector::setKeyboardEnabled ( bool  enable)

Sets the keyboard enabled depending on enable.

See also
keyboardEnabled()

Definition at line 292 of file kactionselector.cpp.

void KActionSelector::setMoveOnDoubleClick ( bool  enable)

Sets moveOnDoubleClick to enable.

See also
moveOnDoubleClick()

Definition at line 282 of file kactionselector.cpp.

void KActionSelector::setSelectedInsertionPolicy ( InsertionPolicy  policy)

Sets the insertion policy for the selected listbox.

See also InsertionPolicy, selectedInsertionPolicy().

Definition at line 332 of file kactionselector.cpp.

void KActionSelector::setSelectedLabel ( const 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.

Definition at line 312 of file kactionselector.cpp.

void KActionSelector::setShowUpDownButtons ( bool  show)

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

Definition at line 342 of file kactionselector.cpp.

bool KActionSelector::showUpDownButtons ( ) const
Returns
whether the Up and Down buttons should be displayed.

Property Documentation

KActionSelector::InsertionPolicy KActionSelector::availableInsertionPolicy
readwrite

Definition at line 87 of file kactionselector.h.

QString KActionSelector::availableLabel
readwrite

Definition at line 85 of file kactionselector.h.

bool KActionSelector::keyboardEnabled
readwrite

Definition at line 84 of file kactionselector.h.

bool KActionSelector::moveOnDoubleClick
readwrite

Definition at line 83 of file kactionselector.h.

KActionSelector::InsertionPolicy KActionSelector::selectedInsertionPolicy
readwrite

Definition at line 88 of file kactionselector.h.

QString KActionSelector::selectedLabel
readwrite

Definition at line 86 of file kactionselector.h.

bool KActionSelector::showUpDownButtons
readwrite

Definition at line 89 of file kactionselector.h.


The documentation for this class was generated from the following files:
  • kactionselector.h
  • kactionselector.cpp
This file is part of the KDE documentation.
Documentation copyright © 1996-2014 The KDE developers.
Generated on Tue Oct 14 2014 22:49:17 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

KDEUI

Skip menu "KDEUI"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members
  • Modules
  • Related Pages

kdelibs API Reference

Skip menu "kdelibs API Reference"
  • DNSSD
  • Interfaces
  •   KHexEdit
  •   KMediaPlayer
  •   KSpeech
  •   KTextEditor
  • kconf_update
  • KDE3Support
  •   KUnitTest
  • KDECore
  • KDED
  • KDEsu
  • KDEUI
  • KDEWebKit
  • KDocTools
  • KFile
  • KHTML
  • KImgIO
  • KInit
  • kio
  • KIOSlave
  • KJS
  •   KJS-API
  • kjsembed
  •   WTF
  • KNewStuff
  • KParts
  • KPty
  • Kross
  • KUnitConversion
  • KUtils
  • Nepomuk
  • Nepomuk-Core
  • Nepomuk
  • Plasma
  • Solid
  • Sonnet
  • ThreadWeaver

Search



Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal