#3296 caf: Table View: Force redraw when QSelection changes (Qt bug)

Guard against doing anything if table is hidden
This commit is contained in:
Jacob Støren committed 2018-08-31 16:13:46 +02:00
1 parent e26a57011d
commit 26b3065974
1 file changed
+6 -1
@@ -284,7 +284,7 @@ void PdmUiTableViewEditor::setRowSelectionLevel(int selectionLevel)
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
void PdmUiTableViewEditor::onSelectionManagerSelectionChanged( const std::set<int>& changedSelectionLevels ) void PdmUiTableViewEditor::onSelectionManagerSelectionChanged( const std::set<int>& changedSelectionLevels )
{ {
if (m_isBlockingSelectionManagerChanged) return; if (!m_tableView->isVisible() || m_isBlockingSelectionManagerChanged ) return;
if (isSelectionRoleDefined() && (changedSelectionLevels.count(m_rowSelectionLevel) )) if (isSelectionRoleDefined() && (changedSelectionLevels.count(m_rowSelectionLevel) ))
{ {
@@ -313,6 +313,11 @@ void PdmUiTableViewEditor::onSelectionManagerSelectionChanged( const std::set<in
void PdmUiTableViewEditor::slotSelectionChanged(const QItemSelection & selected, const QItemSelection & deselected) void PdmUiTableViewEditor::slotSelectionChanged(const QItemSelection & selected, const QItemSelection & deselected)
{ {
if (!m_isUpdatingSelectionQModel) updateSelectionManagerFromTableSelection(); if (!m_isUpdatingSelectionQModel) updateSelectionManagerFromTableSelection();
// Hack to circumvent missing redraw from Qt in certain situations, when selection has changed
m_tableView->resize(m_tableView->width(), m_tableView->height() +1);
m_tableView->resize(m_tableView->width(), m_tableView->height() -1);
} }
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------