KDE 4.9 PyKDE API Reference

- KDE's Python API

# EntityTreeView Class Reference

`from PyKDE4.akonadi import *`

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

## Detailed Description

A view to show an item/collection tree provided by an EntityTreeModel.

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

Example:

     using namespace Akonadi;

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

          EntityTreeModel *model = new EntityTreeModel( ... );
          view->setModel( model );
        }
     }

Author:
  Volker Krause <vkrause@kde.org>

Author:
  Stephen Kelly <steveire@gmail.com>

Since:
  4.4

## Signals

| clicked (Akonadi.Collection collection)
| clicked (Akonadi.Item item)
| currentChanged (Akonadi.Collection collection)
| currentChanged (Akonadi.Item item)
| doubleClicked (Akonadi.Collection collection)
| doubleClicked (Akonadi.Item item)

## Methods

| __init__ (self, QWidget parent=0)
| __init__ (self, KXMLGUIClient xmlGuiClient, QWidget parent=0)
| contextMenuEvent (self, QContextMenuEvent event)
| dragMoveEvent (self, QDragMoveEvent event)
| dropEvent (self, QDropEvent event)
bool | isDropActionMenuEnabled (self)
bool | isManualSortingActive (self)
| setDropActionMenuEnabled (self, bool enabled)
| setManualSortingActive (self, bool active)
| setModel (self, QAbstractItemModel model)
| setXmlGuiClient (self, KXMLGUIClient xmlGuiClient)
| startDrag (self, Qt::DropActions supportedActions)
| timerEvent (self, QTimerEvent event)

## Signal Documentation

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

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

Parameters:

  | item | The clicked item.

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

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

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

Parameters:

  | item | The clicked item.

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

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

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

Parameters:

  | item | The new current item.

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

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

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

Parameters:

  | item | The new current item.

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

doubleClicked | ( | Akonadi.Collection | collection
| ) |  |  |

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

Parameters:

  | item | The double clicked item.

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

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

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

Parameters:

  | item | The double clicked item.

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

## Method Documentation

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

Creates a new entity tree view.

Parameters:

  | parent | The parent widget.

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

Creates a new entity tree 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
| ) |  |  |

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

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

bool isDropActionMenuEnabled | ( |  | self ) |

Returns whether the drop action menu is enabled and will be shown on drop operation.

Since:
  4.5

bool isManualSortingActive | ( |  | self ) |

Return true if we use an manual sorting Necessary to fix dnd menu We must show just move when we move item between two items When automatic no show dnd menu between two items.

Since:
  4.8.1

setDropActionMenuEnabled | ( | self, |
|  | bool | enabled
| ) |  |  |

Sets whether the drop action menu is enabled and will be shown on drop operation.

Since:
  4.5

setManualSortingActive | ( | self, |
|  | bool | active
| ) |  |  |

Set true if we automatic sorting

Since:
  4.8.1

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

@reimplemented

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

Sets the XML GUI client 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.

startDrag | ( | self, |
|  | Qt::DropActions | supportedActions
| ) |  |  |

timerEvent | ( | self, |
|  | QTimerEvent | event
| ) |  |  |