Ref T345, in view added acceptRowSelection

This commit is contained in:
Klaus Basan
2018-09-09 23:31:57 +02:00
parent ad37e67a6b
commit 46c684f04c
4 changed files with 7 additions and 4 deletions

View File

@@ -25,7 +25,7 @@ namespace BlackGui
{ {
const CApplicationInfoList others = CApplicationInfoList::fromOtherSwiftVersionsFromDataDirectories(); const CApplicationInfoList others = CApplicationInfoList::fromOtherSwiftVersionsFromDataDirectories();
this->updateContainer(others); this->updateContainer(others);
m_acceptRowSelected = others.size() > 0; m_acceptRowSelection = others.size() > 0;
return others.size(); return others.size();
} }
} // namespace } // namespace

View File

@@ -24,7 +24,7 @@ namespace BlackGui
{ {
m_menus |= MenuClear; m_menus |= MenuClear;
this->menuRemoveItems(MenuRefresh | MenuBackend | MenuToggleSelectionMode); this->menuRemoveItems(MenuRefresh | MenuBackend | MenuToggleSelectionMode);
m_acceptRowSelected = true; m_acceptRowSelection = true;
this->standardInit(new CStatusMessageListModel(this)); this->standardInit(new CStatusMessageListModel(this));
} }

View File

@@ -1712,7 +1712,7 @@ namespace BlackGui
template <class ModelClass, class ContainerType, class ObjectType> template <class ModelClass, class ContainerType, class ObjectType>
void CViewBase<ModelClass, ContainerType, ObjectType>::ps_rowSelected(const QModelIndex &index) void CViewBase<ModelClass, ContainerType, ObjectType>::ps_rowSelected(const QModelIndex &index)
{ {
if (!m_acceptRowSelected) { return; } if (!m_acceptRowSelection) { return; }
if (!index.isValid()) { return; } if (!index.isValid()) { return; }
emit objectSelected(CVariant::fromValue(at(index))); emit objectSelected(CVariant::fromValue(at(index)));
} }

View File

@@ -250,6 +250,9 @@ namespace BlackGui
//! Accept double click selection //! Accept double click selection
void acceptDoubleClickSelection(bool accept) { m_acceptDoubleClickSelection = accept; } void acceptDoubleClickSelection(bool accept) { m_acceptDoubleClickSelection = accept; }
//! Accept row selection
void acceptRowSelection(bool accept) { m_acceptRowSelection = accept; }
//! Remove given menu items //! Remove given menu items
void menuRemoveItems(Menu menusToRemove); void menuRemoveItems(Menu menusToRemove);
@@ -487,7 +490,7 @@ namespace BlackGui
bool m_showingLoadIndicator = false; //!< showing loading indicator bool m_showingLoadIndicator = false; //!< showing loading indicator
bool m_enabledLoadIndicator = true; //!< loading indicator enabled/disabled bool m_enabledLoadIndicator = true; //!< loading indicator enabled/disabled
bool m_acceptClickSelection = false; //!< clicked bool m_acceptClickSelection = false; //!< clicked
bool m_acceptRowSelected = false; //!< selection changed bool m_acceptRowSelection = false; //!< selection changed
bool m_acceptDoubleClickSelection = false; //!< double clicked bool m_acceptDoubleClickSelection = false; //!< double clicked
bool m_displayAutomatically = true; //!< display directly when loaded bool m_displayAutomatically = true; //!< display directly when loaded
bool m_enableDeleteSelectedRows = false; //!< selected rows can be deleted bool m_enableDeleteSelectedRows = false; //!< selected rows can be deleted