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

Kross

Kross::ActionCollectionView

Kross::ActionCollectionView Class Reference

The ActionCollectionView class shows a QTreeView where the content of a ActionCollection is displayed and optional actions to run, stop, add, edit and remove scripts are provided. More...

#include <view.h>

Inheritance diagram for Kross::ActionCollectionView:
QTreeView

List of all members.

Public Slots

virtual void slotAdd ()
virtual void slotEdit ()
virtual void slotRemove ()
virtual void slotRun ()
virtual void slotStop ()

Signals

void enabledChanged (const QString &actionname)

Public Member Functions

KActionCollection * actionCollection () const
 ActionCollectionView (QWidget *parent=0)
KPushButton * button (const QString &actionname) const
KPushButton * createButton (QWidget *parentWidget, const QString &actionname)
bool isModified () const
virtual void setModel (QAbstractItemModel *model)
void setModified (bool modified)
virtual ~ActionCollectionView ()

Protected Slots

virtual void slotDataChanged (const QModelIndex &topLeft, const QModelIndex &bottomRight)
virtual void slotEnabledChanged (const QString &actionname)
virtual void slotSelectionChanged ()

Protected Member Functions

QItemSelection itemSelection () const

Detailed Description

The ActionCollectionView class shows a QTreeView where the content of a ActionCollection is displayed and optional actions to run, stop, add, edit and remove scripts are provided.

Example how to create, fill and use an instance of a ActionCollectionView;

 // We like to show the widget in a dialog.
 KDialog d(this);
 // Create the view.
 ActionCollectionView* v = new ActionCollectionView( d.mainWidget() );
 // Create the model.
 ActionCollectionModel::Mode mode( ActionCollectionModel::Icons | ActionCollectionModel::ToolTips | ActionCollectionModel::UserCheckable );
 ActionCollectionModel* m = new ActionCollectionModel(view, Manager::self().actionCollection(), mode);
 // Set the model the view should use.
 v->setModel(m);
 // Show the dialog.
 d.exec();

Definition at line 163 of file view.h.


Constructor & Destructor Documentation

ActionCollectionView::ActionCollectionView ( QWidget *  parent = 0  )  [explicit]

Constructor.

Parameters:
parent The optional parent widget this widget is child of.

Definition at line 285 of file view.cpp.

ActionCollectionView::~ActionCollectionView (  )  [virtual]

Destructor.

Definition at line 341 of file view.cpp.


Member Function Documentation

KActionCollection * ActionCollectionView::actionCollection (  )  const
Returns:
the KActionCollection which is filled with KAction instances this view provides. Per default there are the actions "run" to run a script, "stop" to stop execution, "edit" to edit the selected item, "add" to add a new item or resource, "remove" to remove the selected item and "manager" to call and show the modal Script Manager dialog.

Definition at line 370 of file view.cpp.

KPushButton * ActionCollectionView::button ( const QString &  actionname  )  const
Returns:
the KPushButton instance which has the actionname actionname or NULL if there is not such button.

Definition at line 375 of file view.cpp.

KPushButton * ActionCollectionView::createButton ( QWidget *  parentWidget,
const QString &  actionname 
)

Create and return a new KPushButton instance for the given actionname.

Parameters:
parentWidget The parent widget.
actionname The name of the action. Each button points to an action from within the actionCollection() and triggers that action if the button got clicked.
Returns:
The new KPushButton instance or NULL if e.g. there exist no such action with actionname .

Definition at line 387 of file view.cpp.

void Kross::ActionCollectionView::enabledChanged ( const QString &  actionname  )  [signal]

This signal is emitted if the enabled/disabled state of an action changed.

This happens for example if the slotSelectionChanged() above got called cause another item was selected.

Parameters:
actionname The name of the action that changed. You are able to use actionCollection() to receive the to the name matching KAction instance. You are able to use e.g. a QSignalMapper here to map such changes direct to your e.g. KPushButton instances used to display some of the actions provided with actionCollection() .
bool ActionCollectionView::isModified (  )  const
Returns:
true if the collection was modified.

Definition at line 360 of file view.cpp.

QItemSelection ActionCollectionView::itemSelection (  )  const [protected]

This method provides us access to the QItemSelection.

Compared to the selectionModel()->selection() method this method does also map the selection to the source-model for the case e.g. the ActionCollectionProxyModel proxy-model was used rather then a ActionCollectionModel direct.

Definition at line 380 of file view.cpp.

void ActionCollectionView::setModel ( QAbstractItemModel *  model  )  [virtual]

Set the model this view should use to model .

Use an instance of ActionCollectionModel or ActionCollectionProxyModel as model.

Definition at line 346 of file view.cpp.

void ActionCollectionView::setModified ( bool  modified  ) 

Set the internal modified state of the collection to modified .

Definition at line 365 of file view.cpp.

void ActionCollectionView::slotAdd (  )  [virtual, slot]

Called if the "add" action was triggered and a new item should be added.

Definition at line 522 of file view.cpp.

void ActionCollectionView::slotDataChanged ( const QModelIndex &  topLeft,
const QModelIndex &  bottomRight 
) [protected, virtual, slot]

This slot got called if the data changed.

Definition at line 446 of file view.cpp.

void ActionCollectionView::slotEdit (  )  [virtual, slot]

Called if the "edit" action was triggered and the select item should be edited via the scripts manager editor dialog.

Definition at line 488 of file view.cpp.

void ActionCollectionView::slotEnabledChanged ( const QString &  actionname  )  [protected, virtual, slot]

This slot got called if the enable/disable state of an action changed.

Definition at line 404 of file view.cpp.

void ActionCollectionView::slotRemove (  )  [virtual, slot]

Called if the "remove" action was triggered and the selected item should be removed.

Definition at line 556 of file view.cpp.

void ActionCollectionView::slotRun (  )  [virtual, slot]

Called if the "run" action was triggered and the selected script should be executed.

Definition at line 451 of file view.cpp.

void ActionCollectionView::slotSelectionChanged (  )  [protected, virtual, slot]

This slot got called if the selected item changed.

Definition at line 412 of file view.cpp.

void ActionCollectionView::slotStop (  )  [virtual, slot]

Called if the "stop" action was triggered and the selected script stops execution if running.

Definition at line 472 of file view.cpp.


The documentation for this class was generated from the following files:
  • view.h
  • view.cpp

Kross

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

kdelibs

Skip menu "kdelibs"
  • DNSSD
  • Interfaces
  •   KHexEdit
  •   KMediaPlayer
  •   KSpeech
  •   KTextEditor
  • Kate
  • kconf_update
  • KDE3Support
  •   KUnitTest
  • KDECore
  • KDED
  • KDEsu
  • KDEUI
  • KDocTools
  • KFile
  • KHTML
  • KImgIO
  • KInit
  • kio
  • KIOSlave
  • KJS
  •   KJS-API
  •   WTF
  • kjsembed
  • KNewStuff
  • KParts
  • KPty
  • Kross
  • KUtils
  • Nepomuk
  • Plasma
  • Solid
  • Sonnet
  • ThreadWeaver
Generated for kdelibs by doxygen 1.6.1
This website is maintained by Adriaan de Groot and Allen Winter.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal