mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-27 02:55:44 +08:00
Minor mapping tool improvements, including scrollTo first highlighted row
This commit is contained in:
@@ -551,15 +551,15 @@ namespace BlackGui
|
|||||||
}
|
}
|
||||||
|
|
||||||
QAction *a = new QAction(CIcons::appDistributors16(), "Apply distributor preferences", this);
|
QAction *a = new QAction(CIcons::appDistributors16(), "Apply distributor preferences", this);
|
||||||
connect(a, &QAction::triggered, ownModelSetComp, &CDbOwnModelSetComponent::distributorPreferencesChanged);
|
connect(a, &QAction::triggered, ownModelSetComp, &CDbOwnModelSetComponent::distributorPreferencesChanged, Qt::QueuedConnection);
|
||||||
m_setActions.append(a);
|
m_setActions.append(a);
|
||||||
|
|
||||||
a = new QAction(CIcons::delete16(), "Reduce models (remove duplicates)", this);
|
a = new QAction(CIcons::delete16(), "Reduce models (remove duplicates)", this);
|
||||||
connect(a, &QAction::triggered, ownModelSetComp, &CDbOwnModelSetComponent::reduceModels);
|
connect(a, &QAction::triggered, ownModelSetComp, &CDbOwnModelSetComponent::reduceModels, Qt::QueuedConnection);
|
||||||
m_setActions.append(a);
|
m_setActions.append(a);
|
||||||
|
|
||||||
a = new QAction(CIcons::delete16(), "Remove excluded models", this);
|
a = new QAction(CIcons::delete16(), "Remove excluded models", this);
|
||||||
connect(a, &QAction::triggered, ownModelSetComp, &CDbOwnModelSetComponent::removeExcludedModels);
|
connect(a, &QAction::triggered, ownModelSetComp, &CDbOwnModelSetComponent::removeExcludedModels, Qt::QueuedConnection);
|
||||||
m_setActions.append(a);
|
m_setActions.append(a);
|
||||||
}
|
}
|
||||||
menuActions.addMenuModelSet();
|
menuActions.addMenuModelSet();
|
||||||
|
|||||||
@@ -182,6 +182,10 @@ namespace BlackGui
|
|||||||
this->setHighlight(true);
|
this->setHighlight(true);
|
||||||
this->setHighlightColor(Qt::red);
|
this->setHighlightColor(Qt::red);
|
||||||
this->setHighlightModels(invaliddModels);
|
this->setHighlightModels(invaliddModels);
|
||||||
|
|
||||||
|
const int r = this->rowOf(invaliddModels.front());
|
||||||
|
const QModelIndex i = m_model->index(r, 0);
|
||||||
|
this->scrollTo(i);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -218,6 +218,32 @@ namespace BlackGui
|
|||||||
return m_model->container();
|
return m_model->container();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template<class T>
|
||||||
|
QList<int> CViewBase<T>::rowsOf(const ContainerType &container) const
|
||||||
|
{
|
||||||
|
QList<int> rows;
|
||||||
|
for (const ObjectType &o : container)
|
||||||
|
{
|
||||||
|
const int i = this->rowOf(o);
|
||||||
|
if (i >= 0) { rows.push_back(i); }
|
||||||
|
}
|
||||||
|
return rows;
|
||||||
|
}
|
||||||
|
|
||||||
|
template<class T>
|
||||||
|
int CViewBase<T>::rowOf(const ObjectType &obj) const
|
||||||
|
{
|
||||||
|
//! \fixme KB 4-19 any smarter solution?
|
||||||
|
const ContainerType objects = m_model->containerOrFilteredContainer();
|
||||||
|
int i = 0;
|
||||||
|
for (const ObjectType &o : objects)
|
||||||
|
{
|
||||||
|
if (o == obj) { return i; }
|
||||||
|
++i;
|
||||||
|
}
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
template <class T>
|
template <class T>
|
||||||
const typename CViewBase<T>::ContainerType &CViewBase<T>::containerOrFilteredContainer(bool *filtered) const
|
const typename CViewBase<T>::ContainerType &CViewBase<T>::containerOrFilteredContainer(bool *filtered) const
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -660,6 +660,12 @@ namespace BlackGui
|
|||||||
//! Access to container
|
//! Access to container
|
||||||
const ContainerType &container() const;
|
const ContainerType &container() const;
|
||||||
|
|
||||||
|
//! The rows of the given objects
|
||||||
|
QList<int> rowsOf(const ContainerType &container) const;
|
||||||
|
|
||||||
|
//! The row of the given object
|
||||||
|
int rowOf(const ObjectType &obj) const;
|
||||||
|
|
||||||
//! \copydoc BlackGui::Models::CListModelBase::containerOrFilteredContainer
|
//! \copydoc BlackGui::Models::CListModelBase::containerOrFilteredContainer
|
||||||
const ContainerType &containerOrFilteredContainer(bool *filtered = nullptr) const;
|
const ContainerType &containerOrFilteredContainer(bool *filtered = nullptr) const;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user