Skip to content
Permalink
Browse files

implement roleNames for QgsLocatorModel

  • Loading branch information
3nids committed Nov 2, 2018
1 parent 20d8db9 commit 6a9d7a69d8c1bb610d1c7faab0665239b9301d3a
@@ -67,6 +67,8 @@ which may occur if the model is being updated quickly multiple times as a result

virtual Qt::ItemFlags flags( const QModelIndex &index ) const;

virtual QHash<int, QByteArray> roleNames() const;


public slots:

@@ -179,6 +179,19 @@ Qt::ItemFlags QgsLocatorModel::flags( const QModelIndex &index ) const
return flags;
}

QHash<int, QByteArray> QgsLocatorModel::roleNames() const
{
QHash<int, QByteArray> roles;
roles[ResultDataRole] = "ResultData";
roles[ResultTypeRole] = "ResultType";
roles[ResultFilterPriorityRole] = "ResultFilterPriority";
roles[ResultScoreRole] = "ResultScore";
roles[ResultFilterNameRole] = "ResultFilterName";
roles[ResultFilterGroupSortingRole] = "ResultFilterGroupSorting";
roles[Qt::DisplayRole] = "Text";
return roles;
}

void QgsLocatorModel::addResult( const QgsLocatorResult &result )
{
mDeferredClearTimer.stop();
@@ -81,6 +81,7 @@ class CORE_EXPORT QgsLocatorModel : public QAbstractTableModel
int columnCount( const QModelIndex &parent = QModelIndex() ) const override;
QVariant data( const QModelIndex &index, int role = Qt::DisplayRole ) const override;
Qt::ItemFlags flags( const QModelIndex &index ) const override;
QHash<int, QByteArray> roleNames() const override;

public slots:

0 comments on commit 6a9d7a6

Please sign in to comment.
You can’t perform that action at this time.