mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
PdmUiTableViewEditor. Add support for setting column widths
This commit is contained in:
@@ -139,10 +139,14 @@ void PdmUiTableViewEditor::configureAndUpdateUi(const QString& uiConfigName)
|
||||
|
||||
auto childArrayFH = childArrayFieldHandle();
|
||||
|
||||
PdmUiTableViewEditorAttribute editorAttrib;
|
||||
bool editorAttribLoaded = false;
|
||||
|
||||
if ( childArrayFH && childArrayFH->ownerObject() && childArrayFH->ownerObject()->uiCapability() )
|
||||
{
|
||||
PdmUiTableViewEditorAttribute editorAttrib;
|
||||
childArrayFH->ownerObject()->uiCapability()->editorAttribute(childArrayFH, uiConfigName, &editorAttrib);
|
||||
editorAttribLoaded = true;
|
||||
|
||||
this->setSelectionLevel(editorAttrib.selectionLevel);
|
||||
this->enableHeaderText(editorAttrib.enableHeaderText);
|
||||
}
|
||||
@@ -192,6 +196,15 @@ void PdmUiTableViewEditor::configureAndUpdateUi(const QString& uiConfigName)
|
||||
m_previousFieldHandle = childArrayFH;
|
||||
}
|
||||
|
||||
if (editorAttribLoaded)
|
||||
{
|
||||
int colCount = m_tableModelPdm->columnCount();
|
||||
for (int c = 0; c < colCount && c < editorAttrib.columnWidths.size(); c++)
|
||||
{
|
||||
auto w = editorAttrib.columnWidths[c];
|
||||
if (w > 0) m_tableView->setColumnWidth(c, w);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
||||
@@ -87,8 +87,9 @@ public:
|
||||
{
|
||||
}
|
||||
|
||||
int selectionLevel;
|
||||
bool enableHeaderText;
|
||||
int selectionLevel;
|
||||
bool enableHeaderText;
|
||||
std::vector<int> columnWidths;
|
||||
};
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user