KDE 4.6 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)
| clicked (Akonadi.Item item)
| currentChanged (Akonadi.Item item)
| doubleClicked (Akonadi.Item item)

## Methods

| __init__ (self, QWidget parent=0)
| __init__ (self, KXmlGuiWindow xmlGuiWindow, QWidget parent=0)
| __init__ (self, KXMLGUIClient xmlGuiClient, QWidget parent=0)
| contextMenuEvent (self, QContextMenuEvent event)
| setModel (self, QAbstractItemModel model)
| setXmlGuiClient (self, KXMLGUIClient xmlGuiClient)
| setXmlGuiWindow (self, KXmlGuiWindow xmlGuiWindow)

## Signal Documentation

activated | ( | 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 Akonadi::Item&)"), target_slot)`

clicked | ( | Akonadi.Item | item
| ) |  |  |

This signal is emitted whenever the user clicked on an item in the view.

Parameters:

  | item | The item the user clicked on.

Since:
  4.3

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

currentChanged | ( | 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 Akonadi::Item&)"), target_slot)`

doubleClicked | ( | Akonadi.Item | item
| ) |  |  |

This signal is emitted whenever the user double clicked on an item in the view.

Parameters:

  | item | The item the user double clicked on.

Since:
  4.3

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

## 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.

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

Creates a new item view.

Parameters:

  | xmlGuiClient | The KXMLGUIClient 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.

Since:
  4.3

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

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

setXmlGuiClient | ( | self, |
|  | KXMLGUIClient | xmlGuiClient
| ) |  |  |

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

Parameters:

  | xmlGuiClient | The KXMLGUIClient this view is used in.

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.