Update KDescendantsProxyModel code from KF5 kitemmodels, tag v5.24.0-rc3

parent 05250753
This diff is collapsed.
......@@ -17,7 +17,6 @@
02110-1301, USA.
*/
#ifndef KDESCENDANTSPROXYMODEL_P_H
#define KDESCENDANTSPROXYMODEL_P_H
......@@ -51,11 +50,12 @@ KDescendantEntitiesProxyModel can also display the ancestors of the index in the
@code
// ... Create an entityTreeModel
KDescendantsProxyModel *descProxy = new KDescendantesProxyModel(this);
KDescendantsProxyModel *descProxy = new KDescendantsProxyModel(this);
descProxy->setSourceModel(entityTree);
// #### This is new
descProxy->setDisplayAncestorData(true, QString( " / " ));
descProxy->setDisplayAncestorData(true);
descProxy->setDisplayAncestorSeparator(QString(" / "));
view->setModel(descProxy);
......@@ -68,16 +68,16 @@ view->setModel(descProxy);
*/
class MARBLE_EXPORT KDescendantsProxyModel : public QAbstractProxyModel
{
Q_OBJECT
Q_OBJECT
public:
public:
/**
* Creates a new descendant entities proxy model.
*
* @param parent The parent object.
*/
explicit KDescendantsProxyModel( QObject *parent = 0 );
explicit KDescendantsProxyModel(QObject *parent = 0);
/**
* Destroys the descendant entities proxy model.
......@@ -87,7 +87,16 @@ class MARBLE_EXPORT KDescendantsProxyModel : public QAbstractProxyModel
/**
* Sets the source @p model of the proxy.
*/
virtual void setSourceModel( QAbstractItemModel *model );
void setSourceModel(QAbstractItemModel *model) Q_DECL_OVERRIDE;
#if 0
/**
* @deprecated
*
* This method does nothing.
*/
void setRootIndex(const QModelIndex &index);
#endif
/**
* Set whether to show ancestor data in the model. If @p display is true, then
......@@ -126,7 +135,7 @@ class MARBLE_EXPORT KDescendantsProxyModel : public QAbstractProxyModel
*
* Default is false.
*/
void setDisplayAncestorData( bool display );
void setDisplayAncestorData(bool display);
/**
* Whether ancestor data will be displayed.
......@@ -136,72 +145,64 @@ class MARBLE_EXPORT KDescendantsProxyModel : public QAbstractProxyModel
/**
* Sets the ancestor @p separator used between data of ancestors.
*/
void setAncestorSeparator( const QString &separator );
void setAncestorSeparator(const QString &separator);
/**
* Separator used between data of ancestors.
*/
QString ancestorSeparator() const;
/**
* Returns the number of descendant entries for the given model @p index.
*/
int descendantCount( const QModelIndex &index ) const;
QModelIndex mapFromSource ( const QModelIndex & sourceIndex ) const;
QModelIndex mapToSource ( const QModelIndex & proxyIndex ) const;
QModelIndex mapFromSource(const QModelIndex &sourceIndex) const Q_DECL_OVERRIDE;
QModelIndex mapToSource(const QModelIndex &proxyIndex) const Q_DECL_OVERRIDE;
virtual Qt::ItemFlags flags( const QModelIndex &index ) const;
QVariant data( const QModelIndex & index, int role = Qt::DisplayRole ) const;
virtual int rowCount( const QModelIndex & parent = QModelIndex() ) const;
virtual QVariant headerData(int section, Qt::Orientation orientation, int role) const;
Qt::ItemFlags flags(const QModelIndex &index) const Q_DECL_OVERRIDE;
QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const Q_DECL_OVERRIDE;
int rowCount(const QModelIndex &parent = QModelIndex()) const Q_DECL_OVERRIDE;
QVariant headerData(int section, Qt::Orientation orientation, int role) const Q_DECL_OVERRIDE;
virtual QMimeData* mimeData( const QModelIndexList & indexes ) const;
virtual QStringList mimeTypes() const;
QMimeData *mimeData(const QModelIndexList &indexes) const Q_DECL_OVERRIDE;
QStringList mimeTypes() const Q_DECL_OVERRIDE;
virtual bool hasChildren ( const QModelIndex & parent = QModelIndex() ) const;
virtual QModelIndex index(int, int, const QModelIndex &parent = QModelIndex() ) const;
virtual QModelIndex parent(const QModelIndex&) const;
virtual int columnCount(const QModelIndex& index = QModelIndex()) const;
bool hasChildren(const QModelIndex &parent = QModelIndex()) const Q_DECL_OVERRIDE;
QModelIndex index(int, int, const QModelIndex &parent = QModelIndex()) const Q_DECL_OVERRIDE;
QModelIndex parent(const QModelIndex &) const Q_DECL_OVERRIDE;
int columnCount(const QModelIndex &index = QModelIndex()) const Q_DECL_OVERRIDE;
virtual Qt::DropActions supportedDropActions() const;
Qt::DropActions supportedDropActions() const Q_DECL_OVERRIDE;
/**
Reimplemented to match all descendants.
*/
virtual QModelIndexList match(const QModelIndex& start, int role, const QVariant& value,
int hits = 1, Qt::MatchFlags flags = Qt::MatchFlags( Qt::MatchStartsWith | Qt::MatchWrap ) ) const;
virtual QModelIndexList match(const QModelIndex &start, int role, const QVariant &value,
int hits = 1, Qt::MatchFlags flags = Qt::MatchFlags(Qt::MatchStartsWith | Qt::MatchWrap)) const Q_DECL_OVERRIDE;
private:
Q_DECLARE_PRIVATE( KDescendantsProxyModel )
//@cond PRIVATE
KDescendantsProxyModelPrivate *d_ptr;
Q_PRIVATE_SLOT(d_func(), void sourceRowsAboutToBeInserted(const QModelIndex &, int, int))
Q_PRIVATE_SLOT(d_func(), void sourceRowsInserted(const QModelIndex &, int, int))
Q_PRIVATE_SLOT(d_func(), void sourceRowsAboutToBeRemoved(const QModelIndex &, int, int))
Q_PRIVATE_SLOT(d_func(), void sourceRowsRemoved(const QModelIndex &, int, int))
Q_PRIVATE_SLOT(d_func(), void sourceRowsAboutToBeMoved(const QModelIndex &, int, int, const QModelIndex &, int))
Q_PRIVATE_SLOT(d_func(), void sourceRowsMoved(const QModelIndex &, int, int, const QModelIndex &, int))
Q_PRIVATE_SLOT(d_func(), void sourceModelAboutToBeReset())
Q_PRIVATE_SLOT(d_func(), void sourceModelReset())
Q_PRIVATE_SLOT(d_func(), void sourceLayoutAboutToBeChanged())
Q_PRIVATE_SLOT(d_func(), void sourceLayoutChanged())
Q_PRIVATE_SLOT(d_func(), void sourceDataChanged(const QModelIndex &, const QModelIndex &))
Q_PRIVATE_SLOT(d_func(), void sourceModelDestroyed())
Q_PRIVATE_SLOT(d_func(), void processPendingParents())
// Make these private, they shouldn't be called by applications
Q_DECLARE_PRIVATE(KDescendantsProxyModel)
//@cond PRIVATE
KDescendantsProxyModelPrivate *d_ptr;
Q_PRIVATE_SLOT(d_func(), void sourceRowsAboutToBeInserted(const QModelIndex &, int, int))
Q_PRIVATE_SLOT(d_func(), void sourceRowsInserted(const QModelIndex &, int, int))
Q_PRIVATE_SLOT(d_func(), void sourceRowsAboutToBeRemoved(const QModelIndex &, int, int))
Q_PRIVATE_SLOT(d_func(), void sourceRowsRemoved(const QModelIndex &, int, int))
Q_PRIVATE_SLOT(d_func(), void sourceRowsAboutToBeMoved(const QModelIndex &, int, int, const QModelIndex &, int))
Q_PRIVATE_SLOT(d_func(), void sourceRowsMoved(const QModelIndex &, int, int, const QModelIndex &, int))
Q_PRIVATE_SLOT(d_func(), void sourceModelAboutToBeReset())
Q_PRIVATE_SLOT(d_func(), void sourceModelReset())
Q_PRIVATE_SLOT(d_func(), void sourceLayoutAboutToBeChanged())
Q_PRIVATE_SLOT(d_func(), void sourceLayoutChanged())
Q_PRIVATE_SLOT(d_func(), void sourceDataChanged(const QModelIndex &, const QModelIndex &))
Q_PRIVATE_SLOT(d_func(), void sourceModelDestroyed())
Q_PRIVATE_SLOT(d_func(), void processPendingParents())
// Make these private, they shouldn't be called by applications
// virtual bool insertRows(int , int, const QModelIndex & = QModelIndex());
// virtual bool insertColumns(int, int, const QModelIndex & = QModelIndex());
// virtual bool removeRows(int, int, const QModelIndex & = QModelIndex());
// virtual bool removeColumns(int, int, const QModelIndex & = QModelIndex());
//@endcond
//@endcond
};
#endif
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment