mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-02 06:35:52 +08:00
refs #768, allow reselection of values when a view is sorted
* reselect callbacks * remark: Only working in some cases as sorting is part of the model, while selection is part of the view (and sorting can take place without the view knowing the model is sorted) * allow to sort by property index * renamed to m_sortColumn
This commit is contained in:
@@ -47,7 +47,14 @@ namespace BlackGui
|
||||
}
|
||||
|
||||
template <class ModelClass, class ContainerType, class ObjectType, class KeyType>
|
||||
void CViewWithDbObjects<ModelClass, ContainerType, ObjectType, KeyType>::selectDbKeys(const QList<KeyType> &keys)
|
||||
void CViewWithDbObjects<ModelClass, ContainerType, ObjectType, KeyType>::selectDbKey(const KeyType &key)
|
||||
{
|
||||
const QSet<KeyType> set({key});
|
||||
this->selectDbKeys(set);
|
||||
}
|
||||
|
||||
template <class ModelClass, class ContainerType, class ObjectType, class KeyType>
|
||||
void CViewWithDbObjects<ModelClass, ContainerType, ObjectType, KeyType>::selectDbKeys(const QSet<KeyType> &keys)
|
||||
{
|
||||
if (keys.isEmpty()) { return; }
|
||||
this->clearSelection();
|
||||
@@ -64,7 +71,15 @@ namespace BlackGui
|
||||
}
|
||||
|
||||
template <class ModelClass, class ContainerType, class ObjectType, class KeyType>
|
||||
int CViewWithDbObjects<ModelClass, ContainerType, ObjectType, KeyType>::removeDbKeys(const QList<KeyType> &keys)
|
||||
QSet<KeyType> CViewWithDbObjects<ModelClass, ContainerType, ObjectType, KeyType>::selectedDbKeys() const
|
||||
{
|
||||
if (!this->hasSelection()) { return QSet<KeyType>(); }
|
||||
const ContainerType selected(this->selectedObjects());
|
||||
return selected.toDbKeySet();
|
||||
}
|
||||
|
||||
template <class ModelClass, class ContainerType, class ObjectType, class KeyType>
|
||||
int CViewWithDbObjects<ModelClass, ContainerType, ObjectType, KeyType>::removeDbKeys(const QSet<KeyType> &keys)
|
||||
{
|
||||
if (keys.isEmpty()) { return 0; }
|
||||
if (this->isEmpty()) { return 0; }
|
||||
@@ -148,6 +163,15 @@ namespace BlackGui
|
||||
CViewWithDbObjects<ModelClass, ContainerType, ObjectType, KeyType>::customMenu(menuActions);
|
||||
}
|
||||
|
||||
template <class ModelClass, class ContainerType, class ObjectType, class KeyType>
|
||||
void COrderableViewWithDbObjects<ModelClass, ContainerType, ObjectType, KeyType>::reselect(const ContainerType &selectedObjects)
|
||||
{
|
||||
if (!selectedObjects.isEmpty())
|
||||
{
|
||||
this->selectDbKeys(selectedObjects.toDbKeySet());
|
||||
}
|
||||
}
|
||||
|
||||
template <class ModelClass, class ContainerType, class ObjectType, class KeyType>
|
||||
void COrderableViewWithDbObjects<ModelClass, ContainerType, ObjectType, KeyType>::moveSelectedItems(int order)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user