mirror of
https://github.com/OPM/ResInsight.git
synced 2025-01-08 23:23:01 -06:00
#3589 Fix regression in column width for table in well path creation.
This commit is contained in:
parent
683ac7ea1e
commit
0d3b205dac
@ -135,7 +135,8 @@ void RimWellPathAttributeCollection::defineEditorAttribute(const caf::PdmFieldHa
|
||||
auto tvAttribute = dynamic_cast<caf::PdmUiTableViewEditorAttribute*>(attribute);
|
||||
if (tvAttribute)
|
||||
{
|
||||
tvAttribute->autoResizeColumnsToFillContainer = true;
|
||||
tvAttribute->resizePolicy = caf::PdmUiTableViewEditorAttribute::RESIZE_TO_FILL_CONTAINER;
|
||||
tvAttribute->alwaysEnforceResizePolicy = true;
|
||||
tvAttribute->minimumHeight = 300;
|
||||
}
|
||||
}
|
||||
|
@ -604,10 +604,15 @@ void RimWellPathGeometryDef::defineEditorAttribute(const caf::PdmFieldHandle* fi
|
||||
if (field == &m_wellTargets)
|
||||
{
|
||||
auto tvAttribute = dynamic_cast<caf::PdmUiTableViewEditorAttribute*>(attribute);
|
||||
if (tvAttribute && m_pickPointsEnabled)
|
||||
if (tvAttribute)
|
||||
{
|
||||
tvAttribute->baseColor.setRgb(255, 220, 255);
|
||||
tvAttribute->autoResizeColumnsToFitContent = true;
|
||||
tvAttribute->resizePolicy = caf::PdmUiTableViewEditorAttribute::RESIZE_TO_FIT_CONTENT;
|
||||
|
||||
if (m_pickPointsEnabled)
|
||||
{
|
||||
tvAttribute->baseColor.setRgb(255, 220, 255);
|
||||
tvAttribute->alwaysEnforceResizePolicy = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -201,35 +201,35 @@ void PdmUiTableViewEditor::configureAndUpdateUi(const QString& uiConfigName)
|
||||
m_tableHeadingIcon->setPixmap(QPixmap());
|
||||
}
|
||||
|
||||
if (m_previousFieldHandle != childArrayFH )
|
||||
bool firstTimeConfiguringField = m_previousFieldHandle != childArrayFH;
|
||||
|
||||
if (firstTimeConfiguringField)
|
||||
{
|
||||
if (editorAttrib.minimumHeight > 0)
|
||||
{
|
||||
m_tableView->setMinimumHeight(editorAttrib.minimumHeight);
|
||||
}
|
||||
}
|
||||
|
||||
if ( m_previousFieldHandle != childArrayFH)
|
||||
{
|
||||
int colCount = m_tableModelPdm->columnCount();
|
||||
|
||||
// Set specified widths (if any)
|
||||
if (editorAttribLoaded)
|
||||
{
|
||||
int colCount = m_tableModelPdm->columnCount();
|
||||
for (int c = 0; c < colCount && c < static_cast<int>(editorAttrib.columnWidths.size()); c++)
|
||||
{
|
||||
auto w = editorAttrib.columnWidths[c];
|
||||
if (w > 0) m_tableView->setColumnWidth(c, w);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (editorAttrib.autoResizeColumnsToFitContent)
|
||||
if (firstTimeConfiguringField || editorAttrib.alwaysEnforceResizePolicy)
|
||||
{
|
||||
if (editorAttrib.resizePolicy == PdmUiTableViewEditorAttribute::RESIZE_TO_FIT_CONTENT)
|
||||
{
|
||||
// Set default column widths
|
||||
m_tableView->resizeColumnsToContents();
|
||||
}
|
||||
|
||||
if (editorAttrib.autoResizeColumnsToFillContainer)
|
||||
else if (editorAttrib.resizePolicy == PdmUiTableViewEditorAttribute::RESIZE_TO_FILL_CONTAINER)
|
||||
{
|
||||
m_tableView->horizontalHeader()->setResizeMode(QHeaderView::Stretch);
|
||||
}
|
||||
|
@ -81,13 +81,20 @@ private:
|
||||
class PdmUiTableViewEditorAttribute : public PdmUiEditorAttribute
|
||||
{
|
||||
public:
|
||||
enum ResizePolicy
|
||||
{
|
||||
NO_AUTOMATIC_RESIZE,
|
||||
RESIZE_TO_FIT_CONTENT,
|
||||
RESIZE_TO_FILL_CONTAINER
|
||||
};
|
||||
|
||||
PdmUiTableViewEditorAttribute()
|
||||
: tableSelectionLevel(0)
|
||||
, rowSelectionLevel(1)
|
||||
, enableHeaderText(true)
|
||||
, minimumHeight(-1)
|
||||
, autoResizeColumnsToFitContent(false)
|
||||
, autoResizeColumnsToFillContainer(false)
|
||||
, alwaysEnforceResizePolicy(false)
|
||||
, resizePolicy(NO_AUTOMATIC_RESIZE)
|
||||
{
|
||||
QPalette myPalette;
|
||||
baseColor = myPalette.color(QPalette::Active, QPalette::Base);
|
||||
@ -100,8 +107,8 @@ public:
|
||||
std::vector<int> columnWidths;
|
||||
int minimumHeight; ///< Not used if If < 0
|
||||
QColor baseColor;
|
||||
bool autoResizeColumnsToFitContent;
|
||||
bool autoResizeColumnsToFillContainer;
|
||||
bool alwaysEnforceResizePolicy;
|
||||
ResizePolicy resizePolicy;
|
||||
};
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user