##// END OF EJS Templates
Correction on package.cmake to include COPYING file instead of LICENCE File. Remove message from cmake
Correction on package.cmake to include COPYING file instead of LICENCE File. Remove message from cmake

File last commit:

r146:f61d116e8daa
r242:070194309ffd
Show More
DataSourceItem.h
73 lines | 2.1 KiB | text/x-c | CLexer
Alexandre Leroux
Define a data source item
r35 #ifndef SCIQLOP_DATASOURCEITEM_H
#define SCIQLOP_DATASOURCEITEM_H
#include <Common/spimpl.h>
#include <QVariant>
#include <QVector>
Alexandre Leroux
Defines actions for a data source items...
r144 class DataSourceItemAction;
Alexandre Leroux
Adds type for a data source item...
r79 /**
* Possible types of an item
*/
enum class DataSourceItemType { NODE, PRODUCT };
Alexandre Leroux
Define a data source item
r35 /**
* @brief The DataSourceItem class aims to represent a structure element of a data source.
* A data source has a tree structure that is made up of a main DataSourceItem object (root)
* containing other DataSourceItem objects (children).
* For each DataSourceItem can be associated a set of data representing it.
*/
class DataSourceItem {
public:
Alexandre Leroux
Adds type for a data source item...
r79 explicit DataSourceItem(DataSourceItemType type, QVector<QVariant> data = {});
Alexandre Leroux
Define a data source item
r35
Alexandre Leroux
Defines actions for a data source items...
r144 /// @return the actions of the item as a vector
QVector<DataSourceItemAction *> actions() const noexcept;
/**
* Adds an action to the item. The item takes ownership of the action, and the action is
* automatically associated to the item
* @param action the action to add
*/
void addAction(std::unique_ptr<DataSourceItemAction> action) noexcept;
Alexandre Leroux
Define a data source item
r35 /**
* Adds a child to the item. The item takes ownership of the child.
* @param child the child to add
*/
void appendChild(std::unique_ptr<DataSourceItem> child) noexcept;
/**
* Returns the item's child associated to an index
* @param childIndex the index to search
* @return a pointer to the child if index is valid, nullptr otherwise
*/
DataSourceItem *child(int childIndex) const noexcept;
int childCount() const noexcept;
/**
* Get the data associated to an index
* @param dataIndex the index to search
* @return the data found if index is valid, default QVariant otherwise
*/
QVariant data(int dataIndex) const noexcept;
Alexandre Leroux
Adds action in the mock plugin to load products
r146 QString name() const noexcept;
Alexandre Leroux
Define a data source item
r35 /**
* Get the item's parent
* @return a pointer to the parent if it exists, nullptr if the item is a root
*/
DataSourceItem *parentItem() const noexcept;
Alexandre Leroux
Adds type for a data source item...
r79 DataSourceItemType type() const noexcept;
Alexandre Leroux
Define a data source item
r35 private:
class DataSourceItemPrivate;
spimpl::unique_impl_ptr<DataSourceItemPrivate> impl;
};
#endif // SCIQLOP_DATASOURCEITEMMODEL_H