mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -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);
|
auto tvAttribute = dynamic_cast<caf::PdmUiTableViewEditorAttribute*>(attribute);
|
||||||
if (tvAttribute)
|
if (tvAttribute)
|
||||||
{
|
{
|
||||||
tvAttribute->autoResizeColumnsToFillContainer = true;
|
tvAttribute->resizePolicy = caf::PdmUiTableViewEditorAttribute::RESIZE_TO_FILL_CONTAINER;
|
||||||
|
tvAttribute->alwaysEnforceResizePolicy = true;
|
||||||
tvAttribute->minimumHeight = 300;
|
tvAttribute->minimumHeight = 300;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -604,10 +604,15 @@ void RimWellPathGeometryDef::defineEditorAttribute(const caf::PdmFieldHandle* fi
|
|||||||
if (field == &m_wellTargets)
|
if (field == &m_wellTargets)
|
||||||
{
|
{
|
||||||
auto tvAttribute = dynamic_cast<caf::PdmUiTableViewEditorAttribute*>(attribute);
|
auto tvAttribute = dynamic_cast<caf::PdmUiTableViewEditorAttribute*>(attribute);
|
||||||
if (tvAttribute && m_pickPointsEnabled)
|
if (tvAttribute)
|
||||||
{
|
{
|
||||||
tvAttribute->baseColor.setRgb(255, 220, 255);
|
tvAttribute->resizePolicy = caf::PdmUiTableViewEditorAttribute::RESIZE_TO_FIT_CONTENT;
|
||||||
tvAttribute->autoResizeColumnsToFitContent = true;
|
|
||||||
|
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());
|
m_tableHeadingIcon->setPixmap(QPixmap());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_previousFieldHandle != childArrayFH )
|
bool firstTimeConfiguringField = m_previousFieldHandle != childArrayFH;
|
||||||
|
|
||||||
|
if (firstTimeConfiguringField)
|
||||||
{
|
{
|
||||||
if (editorAttrib.minimumHeight > 0)
|
if (editorAttrib.minimumHeight > 0)
|
||||||
{
|
{
|
||||||
m_tableView->setMinimumHeight(editorAttrib.minimumHeight);
|
m_tableView->setMinimumHeight(editorAttrib.minimumHeight);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if ( m_previousFieldHandle != childArrayFH)
|
|
||||||
{
|
|
||||||
int colCount = m_tableModelPdm->columnCount();
|
|
||||||
|
|
||||||
// Set specified widths (if any)
|
// Set specified widths (if any)
|
||||||
if (editorAttribLoaded)
|
if (editorAttribLoaded)
|
||||||
{
|
{
|
||||||
|
int colCount = m_tableModelPdm->columnCount();
|
||||||
for (int c = 0; c < colCount && c < static_cast<int>(editorAttrib.columnWidths.size()); c++)
|
for (int c = 0; c < colCount && c < static_cast<int>(editorAttrib.columnWidths.size()); c++)
|
||||||
{
|
{
|
||||||
auto w = editorAttrib.columnWidths[c];
|
auto w = editorAttrib.columnWidths[c];
|
||||||
if (w > 0) m_tableView->setColumnWidth(c, w);
|
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
|
// Set default column widths
|
||||||
m_tableView->resizeColumnsToContents();
|
m_tableView->resizeColumnsToContents();
|
||||||
}
|
}
|
||||||
|
else if (editorAttrib.resizePolicy == PdmUiTableViewEditorAttribute::RESIZE_TO_FILL_CONTAINER)
|
||||||
if (editorAttrib.autoResizeColumnsToFillContainer)
|
|
||||||
{
|
{
|
||||||
m_tableView->horizontalHeader()->setResizeMode(QHeaderView::Stretch);
|
m_tableView->horizontalHeader()->setResizeMode(QHeaderView::Stretch);
|
||||||
}
|
}
|
||||||
|
@ -81,13 +81,20 @@ private:
|
|||||||
class PdmUiTableViewEditorAttribute : public PdmUiEditorAttribute
|
class PdmUiTableViewEditorAttribute : public PdmUiEditorAttribute
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
enum ResizePolicy
|
||||||
|
{
|
||||||
|
NO_AUTOMATIC_RESIZE,
|
||||||
|
RESIZE_TO_FIT_CONTENT,
|
||||||
|
RESIZE_TO_FILL_CONTAINER
|
||||||
|
};
|
||||||
|
|
||||||
PdmUiTableViewEditorAttribute()
|
PdmUiTableViewEditorAttribute()
|
||||||
: tableSelectionLevel(0)
|
: tableSelectionLevel(0)
|
||||||
, rowSelectionLevel(1)
|
, rowSelectionLevel(1)
|
||||||
, enableHeaderText(true)
|
, enableHeaderText(true)
|
||||||
, minimumHeight(-1)
|
, minimumHeight(-1)
|
||||||
, autoResizeColumnsToFitContent(false)
|
, alwaysEnforceResizePolicy(false)
|
||||||
, autoResizeColumnsToFillContainer(false)
|
, resizePolicy(NO_AUTOMATIC_RESIZE)
|
||||||
{
|
{
|
||||||
QPalette myPalette;
|
QPalette myPalette;
|
||||||
baseColor = myPalette.color(QPalette::Active, QPalette::Base);
|
baseColor = myPalette.color(QPalette::Active, QPalette::Base);
|
||||||
@ -100,8 +107,8 @@ public:
|
|||||||
std::vector<int> columnWidths;
|
std::vector<int> columnWidths;
|
||||||
int minimumHeight; ///< Not used if If < 0
|
int minimumHeight; ///< Not used if If < 0
|
||||||
QColor baseColor;
|
QColor baseColor;
|
||||||
bool autoResizeColumnsToFitContent;
|
bool alwaysEnforceResizePolicy;
|
||||||
bool autoResizeColumnsToFillContainer;
|
ResizePolicy resizePolicy;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user