AppFwk: Add editor attribute. Object-only SelectionManager use. Use SelectionChangedReceiver. Improve tableview-checkbox selection behaviour and look.

This commit is contained in:
Jacob Støren
2018-06-27 13:28:13 +02:00
parent 08c78471c3
commit 88297bdb9f
4 changed files with 102 additions and 29 deletions

View File

@@ -75,12 +75,28 @@ private:
std::map<QString, QString> m_fieldKeywordAndPushButtonText;
};
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
class PdmUiTableViewEditorAttribute : public PdmUiEditorAttribute
{
public:
PdmUiTableViewEditorAttribute()
: selectionRole(SelectionManager::CURRENT)
, enableHeaderText(true)
{
}
SelectionManager::SelectionRole selectionRole;
bool enableHeaderText;
};
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
class PdmUiTableViewEditor : public PdmUiFieldEditorHandle
class PdmUiTableViewEditor : public PdmUiFieldEditorHandle, public SelectionChangedReceiver
{
Q_OBJECT
CAF_PDM_UI_FIELD_EDITOR_HEADER_INIT;
@@ -105,6 +121,7 @@ public:
protected:
virtual void configureAndUpdateUi(const QString& uiConfigName) override;
virtual void onSelectionManagerSelectionChanged() override;
private:
void selectedUiItems(const QModelIndexList& modelIndexList, std::vector<PdmUiItem*>& objects);
@@ -132,6 +149,7 @@ private:
bool m_useDefaultContextMenu;
SelectionManager::SelectionRole m_selectionRole;
bool m_isBlockingSelectionManagerChanged;
};