mirror of
https://github.com/OPM/ResInsight.git
synced 2026-10-12 16:32:12 -05:00
PdmUiTableViewEditor. Add support for setting column widths
This commit is contained in:
1 parent
a730237267
commit
1be8d335fa
2 files changed
+17
-3
No files matched your search
@@ -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