mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-01 21:56:43 +08:00
refs #568, allow to stash from DB data view (model view)
* added required signal slots * moved models for stashing into aircraft model view * allow to unselect when stashed * fixed DB object highlighting and resize row height automatically
This commit is contained in:
@@ -70,21 +70,35 @@ namespace BlackGui
|
||||
return delta;
|
||||
}
|
||||
|
||||
template <class ModelClass, class ContainerType, class ObjectType, class KeyType>
|
||||
int CViewWithDbObjects<ModelClass, ContainerType, ObjectType, KeyType>::replaceOrAddObjectsByKey(const ContainerType &container)
|
||||
{
|
||||
if (container.isEmpty()) { return 0; }
|
||||
ContainerType copy(this->container());
|
||||
int c = copy.replaceOrAddObjectsByKey(container);
|
||||
if (c == 0) { return 0; }
|
||||
this->updateContainerMaybeAsync(copy);
|
||||
return c;
|
||||
}
|
||||
|
||||
template <class ModelClass, class ContainerType, class ObjectType, class KeyType>
|
||||
void CViewWithDbObjects<ModelClass, ContainerType, ObjectType, KeyType>::customMenu(QMenu &menu) const
|
||||
{
|
||||
CViewBase<ModelClass, ContainerType, ObjectType>::customMenu(menu);
|
||||
if (this->m_menus.testFlag(CViewBase<ModelClass, ContainerType, ObjectType>::MenuHighlightDbData))
|
||||
{
|
||||
menu.addSeparator();
|
||||
QAction *a = menu.addAction(CIcons::database16(), "Highlight DB data", this, SLOT(ps_toggleDbData()));
|
||||
if (!menu.isEmpty())
|
||||
{
|
||||
menu.addSeparator();
|
||||
}
|
||||
QAction *a = menu.addAction(CIcons::database16(), "Highlight DB data", this, SLOT(ps_toggleHighlightDbData()));
|
||||
a->setCheckable(true);
|
||||
a->setChecked(this->derivedModel()->highlightDbData());
|
||||
}
|
||||
}
|
||||
|
||||
template <class ModelClass, class ContainerType, class ObjectType, class KeyType>
|
||||
void CViewWithDbObjects<ModelClass, ContainerType, ObjectType, KeyType>::ps_toggleDbData()
|
||||
void CViewWithDbObjects<ModelClass, ContainerType, ObjectType, KeyType>::ps_toggleHighlightDbData()
|
||||
{
|
||||
bool h = this->derivedModel()->highlightDbData();
|
||||
this->derivedModel()->setHighlightDbData(!h);
|
||||
|
||||
Reference in New Issue
Block a user