Akonadi.CollectionView

KDE 4.9 PyKDE API Reference

- KDE's Python API

# CollectionView Class Reference

`from PyKDE4.akonadi import *`

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

## Detailed Description

A view to show a collection tree provided by a CollectionModel.

When a KXmlGuiWindow is passed to the constructor, the XMLGUI defined context menu akonadi_collectionview_contextmenu is used if available.

Example:

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

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

Author:
  Volker Krause <vkrause@kde.org>

## Signals
| clicked (Akonadi.Collection collection)
| currentChanged (Akonadi.Collection collection)
## Methods
| __init__ (self, QWidget parent=0)
| __init__ (self, KXmlGuiWindow xmlGuiWindow, QWidget parent=0)
| __init__ (self, KXMLGUIClient xmlGuiClient, QWidget parent=0)
| contextMenuEvent (self, QContextMenuEvent event)
| dragLeaveEvent (self, QDragLeaveEvent event)
| dragMoveEvent (self, QDragMoveEvent event)
| dropEvent (self, QDropEvent event)
| setModel (self, QAbstractItemModel model)
| setXmlGuiClient (self, KXMLGUIClient xmlGuiClient)
| setXmlGuiWindow (self, KXmlGuiWindow xmlGuiWindow)

## Signal Documentation

clicked | ( | Akonadi.Collection | collection
| ) |  |  |

This signal is emitted whenever the user has clicked a collection in the view.

Parameters:

  | collection | The clicked collection.

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

currentChanged | ( | Akonadi.Collection | collection
| ) |  |  |

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

Parameters:

  | collection | The new current collection.

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

## Method Documentation

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

Creates a new collection view.

Parameters:

  | parent | The parent widget.

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

Creates a new collection view.

Parameters:

  | xmlGuiWindow | The KXmlGuiWindow the view 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 collection view.

Parameters:

  | xmlGuiClient | The KXmlGuiClient the view 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.

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

dragLeaveEvent | ( | self, |
|  | QDragLeaveEvent | event
| ) |  |  |

dragMoveEvent | ( | self, |
|  | QDragMoveEvent | event
| ) |  |  |

dropEvent | ( | self, |
|  | QDropEvent | event
| ) |  |  |

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

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

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

Parameters:

  | xmlGuiClient | The KXMLGUIClient the view is used in.

Since:
  4.3

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

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

Parameters:

  | xmlGuiWindow | The KXmlGuiWindow the view is used in.