Akonadi::EntityTreeView Class
A view to show an item/collection tree provided by an EntityTreeModel. More...
| Header: | #include <Akonadi/EntityTreeView> |
| CMake: | find_package(KPim6 REQUIRED COMPONENTS AkonadiWidgets)target_link_libraries(mytarget PRIVATE KPim6::AkonadiWidgets) |
Public Functions
| EntityTreeView(QWidget *parent = nullptr) | |
| EntityTreeView(KXMLGUIClient *xmlGuiClient, QWidget *parent = nullptr) | |
| virtual | ~EntityTreeView() override |
| bool | isDropActionMenuEnabled() const |
| bool | isManualSortingActive() const |
| void | setDefaultPopupMenu(const QString &name) |
| void | setDropActionMenuEnabled(bool enabled) |
| void | setManualSortingActive(bool active) |
| void | setXmlGuiClient(KXMLGUIClient *xmlGuiClient) |
| KXMLGUIClient * | xmlGuiClient() const |
Reimplemented Public Functions
| virtual void | setModel(QAbstractItemModel *model) override |
Signals
| void | clicked(const Akonadi::Collection &collection) |
| void | clicked(const Akonadi::Item &item) |
| void | currentChanged(const Akonadi::Collection &collection) |
| void | currentChanged(const Akonadi::Item &item) |
| void | doubleClicked(const Akonadi::Collection &collection) |
| void | doubleClicked(const Akonadi::Item &item) |
Detailed Description
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>
Member Function Documentation
[explicit] EntityTreeView::EntityTreeView(QWidget *parent = nullptr)
Creates a new entity tree view.
parent The parent widget.
[explicit] EntityTreeView::EntityTreeView(KXMLGUIClient *xmlGuiClient, QWidget *parent = nullptr)
Creates a new entity tree view.
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.
[override virtual noexcept] EntityTreeView::~EntityTreeView()
Destroys the entity tree view.
[signal] void EntityTreeView::clicked(const Akonadi::Collection &collection)
This signal is emitted whenever the user has clicked a collection in the view.
collection The clicked collection.
Note: This signal is overloaded. To connect to this signal:
// Connect using qOverload: connect(entityTreeView, qOverloadFor more examples and approaches, see connecting to overloaded signals.(&EntityTreeView::clicked), receiver, &ReceiverClass::slot); // Or using a lambda: connect(entityTreeView, qOverload (&EntityTreeView::clicked), this, [](const Akonadi::Collection &collection) { /* handle clicked */ });
[signal] void EntityTreeView::clicked(const Akonadi::Item &item)
This signal is emitted whenever the user has clicked an item in the view.
item The clicked item.
Note: This signal is overloaded. To connect to this signal:
// Connect using qOverload: connect(entityTreeView, qOverloadFor more examples and approaches, see connecting to overloaded signals.(&EntityTreeView::clicked), receiver, &ReceiverClass::slot); // Or using a lambda: connect(entityTreeView, qOverload (&EntityTreeView::clicked), this, [](const Akonadi::Item &item) { /* handle clicked */ });
[signal] void EntityTreeView::currentChanged(const Akonadi::Collection &collection)
This signal is emitted whenever the current collection in the view has changed.
collection The new current collection.
Note: This signal is overloaded. To connect to this signal:
// Connect using qOverload: connect(entityTreeView, qOverloadFor more examples and approaches, see connecting to overloaded signals.(&EntityTreeView::currentChanged), receiver, &ReceiverClass::slot); // Or using a lambda: connect(entityTreeView, qOverload (&EntityTreeView::currentChanged), this, [](const Akonadi::Collection &collection) { /* handle currentChanged */ });
[signal] void EntityTreeView::currentChanged(const Akonadi::Item &item)
This signal is emitted whenever the current item in the view has changed.
item The new current item.
Note: This signal is overloaded. To connect to this signal:
// Connect using qOverload: connect(entityTreeView, qOverloadFor more examples and approaches, see connecting to overloaded signals.(&EntityTreeView::currentChanged), receiver, &ReceiverClass::slot); // Or using a lambda: connect(entityTreeView, qOverload (&EntityTreeView::currentChanged), this, [](const Akonadi::Item &item) { /* handle currentChanged */ });
[signal] void EntityTreeView::doubleClicked(const Akonadi::Collection &collection)
This signal is emitted whenever the user has double clicked a collection in the view.
collection The double clicked collection.
Note: This signal is overloaded. To connect to this signal:
// Connect using qOverload: connect(entityTreeView, qOverloadFor more examples and approaches, see connecting to overloaded signals.(&EntityTreeView::doubleClicked), receiver, &ReceiverClass::slot); // Or using a lambda: connect(entityTreeView, qOverload (&EntityTreeView::doubleClicked), this, [](const Akonadi::Collection &collection) { /* handle doubleClicked */ });
[signal] void EntityTreeView::doubleClicked(const Akonadi::Item &item)
This signal is emitted whenever the user has double clicked an item in the view.
item The double clicked item.
Note: This signal is overloaded. To connect to this signal:
// Connect using qOverload: connect(entityTreeView, qOverloadFor more examples and approaches, see connecting to overloaded signals.(&EntityTreeView::doubleClicked), receiver, &ReceiverClass::slot); // Or using a lambda: connect(entityTreeView, qOverload (&EntityTreeView::doubleClicked), this, [](const Akonadi::Item &item) { /* handle doubleClicked */ });
bool EntityTreeView::isDropActionMenuEnabled() const
Returns whether the drop action menu is enabled and will be shown on drop operation.
bool EntityTreeView::isManualSortingActive() const
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.
void EntityTreeView::setDefaultPopupMenu(const QString &name)
Set the name of the default popup menu (retrieved from the application's XMLGUI file).
This menu is used as a fallback if the context of the menu request is neither an item nor a collection, e.g. the click is on an empty area inside the view. If the click is over an entry in the view, the menu which is applicable to the clicked entry (either an Item or a Collection) is used.
name The name of the popup menu
Note: For backwards compatibility, the default is the standard collection popup menu, "akonadi_collectionview_contextmenu".
See also KXMLGUIClient and KXMLGUIFactory::container().
void EntityTreeView::setDropActionMenuEnabled(bool enabled)
Sets whether the drop action \anu is enabled and will shown on drop operation. enabled enables drop action menu if set as \ true
See also isDropActionMenuEnabled().
void EntityTreeView::setManualSortingActive(bool active)
\attrue if we automatic sorting active enables automatic sorting if set as \ true
See also isManualSortingActive().
[override virtual] void EntityTreeView::setModel(QAbstractItemModel *model)
model the model to set
void EntityTreeView::setXmlGuiClient(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.
xmlGuiClient The KXMLGUIClient the view is used in.
See also xmlGuiClient().
KXMLGUIClient *EntityTreeView::xmlGuiClient() const
Return the XML GUI client which the view is used in.
See also setXmlGuiClient().