mirror of
https://github.com/qgis/QGIS.git
synced 2025-10-18 00:06:00 -04:00
Make additional sort caches accessible
This commit is contained in:
parent
2325fe5a39
commit
9963892790
@ -194,14 +194,18 @@ Specify -1 as column to invalidate the cache
|
|||||||
void prefetchSortData( const QString &expression, unsigned long cacheIndex = 0 );
|
void prefetchSortData( const QString &expression, unsigned long cacheIndex = 0 );
|
||||||
%Docstring
|
%Docstring
|
||||||
Prefetches the entire data for one expression. Based on this cached information
|
Prefetches the entire data for one expression. Based on this cached information
|
||||||
the sorting can later be done in a performant way.
|
the sorting can later be done in a performant way. A ``cacheIndex`` can be specified
|
||||||
|
if multiple caches should be filled. In this case, the caches will be available
|
||||||
|
as ``QgsAttributeTableModel.SortRole + cacheIndex``.
|
||||||
|
|
||||||
:param expression: The expression to cache
|
:param expression: The expression to cache
|
||||||
%End
|
%End
|
||||||
|
|
||||||
QString sortCacheExpression() const;
|
QString sortCacheExpression( unsigned long cacheIndex = 0 ) const;
|
||||||
%Docstring
|
%Docstring
|
||||||
The expression which was used to fill the sorting cache
|
The expression which was used to fill the sorting cache at index \cacheIndex.
|
||||||
|
|
||||||
|
.. seealso:: :py:func:`prefetchSortData`
|
||||||
%End
|
%End
|
||||||
|
|
||||||
void setRequest( const QgsFeatureRequest &request );
|
void setRequest( const QgsFeatureRequest &request );
|
||||||
|
@ -908,13 +908,14 @@ void QgsAttributeTableModel::prefetchSortData( const QString &expressionString,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
QString QgsAttributeTableModel::sortCacheExpression() const
|
QString QgsAttributeTableModel::sortCacheExpression( unsigned long cacheIndex ) const
|
||||||
{
|
{
|
||||||
Q_ASSERT( !mSortCaches.empty() );
|
|
||||||
|
|
||||||
QString expressionString;
|
QString expressionString;
|
||||||
|
|
||||||
const QgsExpression &expression = mSortCaches.begin()->sortCacheExpression;
|
if ( cacheIndex >= mSortCaches.size() )
|
||||||
|
return expressionString;
|
||||||
|
|
||||||
|
const QgsExpression &expression = mSortCaches[cacheIndex].sortCacheExpression;
|
||||||
|
|
||||||
if ( expression.isValid() )
|
if ( expression.isValid() )
|
||||||
expressionString = expression.expression();
|
expressionString = expression.expression();
|
||||||
|
@ -200,16 +200,20 @@ class GUI_EXPORT QgsAttributeTableModel: public QAbstractTableModel
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Prefetches the entire data for one expression. Based on this cached information
|
* Prefetches the entire data for one expression. Based on this cached information
|
||||||
* the sorting can later be done in a performant way.
|
* the sorting can later be done in a performant way. A \a cacheIndex can be specified
|
||||||
|
* if multiple caches should be filled. In this case, the caches will be available
|
||||||
|
* as ``QgsAttributeTableModel::SortRole + cacheIndex``.
|
||||||
*
|
*
|
||||||
* \param expression The expression to cache
|
* \param expression The expression to cache
|
||||||
*/
|
*/
|
||||||
void prefetchSortData( const QString &expression, unsigned long cacheIndex = 0 );
|
void prefetchSortData( const QString &expression, unsigned long cacheIndex = 0 );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The expression which was used to fill the sorting cache
|
* The expression which was used to fill the sorting cache at index \cacheIndex.
|
||||||
|
*
|
||||||
|
* \see prefetchSortData
|
||||||
*/
|
*/
|
||||||
QString sortCacheExpression() const;
|
QString sortCacheExpression( unsigned long cacheIndex = 0 ) const;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set a request that will be used to fill this attribute table model.
|
* Set a request that will be used to fill this attribute table model.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user