I haven't thought how, but it seem a pity that this is a clone of the code from getWorkUnitsSorted, adjusted for WUQS*
There looks to be a lot in common between the two areas that deal with filters and sortorders..

I know the way sortorders/filters/filterbuf are handled was pre-existing, but it seems very verbose (especially as now in 2 places).

I am wondering whether the underlying work that getWorkUnitsSorted and getQuerySetQueriesSorted does should be further generalized, so for example they call a common routine to do their work which builds on e.g. the idea of an abstract IElementsPaged that allows arbitrary sort orders and filters to be added.

e.g. 
interface IElementsPager : extends IInterface
> {
>    virtual IRemoteConnection *getElements(IArrayOf<IPropertyTree> &elements) = 0;
>    virtual void addFilter(...)
>    virtual void addSortOrder(...)
> }


Might be too large a change for this commit though, worth opening a sub issue if so.