Akonadi.ItemView

KDE 4.2 PyKDE API Reference

- KDE's Python API

# ItemView Class Reference

`from PyKDE4.akonadi import *`

Inherits: QTreeView → QAbstractItemView → QAbstractScrollArea → QFrame → QWidget → QObject
Namespace: Akonadi

## Detailed Description

A view to show an item list provided by an ItemModel.

When a KXmlGuiWindow is set, the XMLGUI defined context menu akonadi_itemview_contextmenu is used if available.

Example:

     class MyWindow : public KXmlGuiWindow
     {
       public:
        MyWindow()
          : KXmlGuiWindow()
        {
          Akonadi.ItemView *view = new Akonadi.ItemView( this, this );
          setCentralWidget( view );

          Akonadi.ItemModel *model = new Akonadi.ItemModel( this );
          view->setModel( model );
        }
     }

Author:
  Tobias Koenig <tokoe@kde.org>

## Signals
| activated (Akonadi.Item item)
| currentChanged (Akonadi.Item item)
## Methods
| __init__ (self, QWidget parent=0)
| __init__ (self, KXmlGuiWindow xmlGuiWindow, QWidget parent=0)
| activated (self, Akonadi.Item item)
| contextMenuEvent (self, QContextMenuEvent event)
| currentChanged (self, Akonadi.Item item)
| setModel (self, QAbstractItemModel model)
| setXmlGuiWindow (self, KXmlGuiWindow xmlGuiWindow)

## Method Documentation

__init__ | ( | self, |
|  | QWidget | parent=0
| ) |  |  |

Creates a new item view.

Parameters:

  | parent | The parent widget.

__init__ | ( | self, |
|  | KXmlGuiWindow | xmlGuiWindow,
|  | QWidget | parent=0
| ) |  |  |

Creates a new item view.

Parameters:

  | xmlGuiWindow | The KXmlGuiWindow this is used in. This is needed for the XMLGUI based context menu. Passing 0 is ok and will disable the builtin context menu.
  | parent | The parent widget.

activated | ( | self, |
|  | Akonadi.Item | item
| ) |  |  |

This signal is emitted whenever the user has activated an item in the view.

Parameters:

  | item | The activated item.

Signal syntax:
  `QObject.connect(source, SIGNAL("activated(const Item&)"), target_slot)`

contextMenuEvent | ( | self, |
|  | QContextMenuEvent | event
| ) |  |  |

currentChanged | ( | self, |
|  | Akonadi.Item | item
| ) |  |  |

This signal is emitted whenever the current item in the view has changed.

Parameters:

  | item | The current item.

Signal syntax:
  `QObject.connect(source, SIGNAL("currentChanged(const Item&)"), target_slot)`

setModel | ( | self, |
|  | QAbstractItemModel | model
| ) |  |  |

setXmlGuiWindow | ( | self, |
|  | KXmlGuiWindow | xmlGuiWindow
| ) |  |  |

Sets the KXmlGuiWindow which this view is used in. This is needed if you want to use the built-in context menu.

Parameters:

  | xmlGuiWindow | The KXmlGuiWindow this view is used in.