wxDataViewCtrl: always update the header when col best width changes.
Have an explicit per-column dirty flag and use that to determine whether we need to call wxHeaderCtrl::UpdateColumn(). Previously, the lack of computed best width was used as an indicator, but this didn't work correctly if some code called GetWidth() after invalidation but before wxDataViewCtrl::UpdateColWidths() was called at idle time. This resulted in header's column widths getting out of sync with the control itself. Fixes #14167. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@71335 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -242,10 +242,18 @@ private:
|
||||
void UpdateColWidths();
|
||||
|
||||
wxDataViewColumnList m_cols;
|
||||
// cached column best widths or 0 if not computed, values are for
|
||||
// cached column best widths information, values are for
|
||||
// respective columns from m_cols and the arrays have same size
|
||||
wxVector<int> m_colsBestWidths;
|
||||
// m_colsBestWidths partially invalid, needs recomputing
|
||||
struct CachedColWidthInfo
|
||||
{
|
||||
CachedColWidthInfo() : width(0), dirty(true) {}
|
||||
int width; // cached width or 0 if not computed
|
||||
bool dirty; // column was invalidated, header needs updating
|
||||
};
|
||||
wxVector<CachedColWidthInfo> m_colsBestWidths;
|
||||
// This indicates that at least one entry in m_colsBestWidths has 'dirty'
|
||||
// flag set. It's cheaper to check one flag in OnInternalIdle() than to
|
||||
// iterate over m_colsBestWidths to check if anything needs to be done.
|
||||
bool m_colsDirty;
|
||||
|
||||
wxDataViewModelNotifier *m_notifier;
|
||||
|
Reference in New Issue
Block a user