Consistently check for type mismatch in all ports in wxDataViewCtrl.

Move the checks for the type mismatch between the type of the value returned
by wxDataViewModel and the type expected by wxDataViewRenderer into common
code. This avoids duplicating the same code in wxGTK and wxOSX and, more
importantly, means that this check is also performed in wxMSW when using the
generic version, so that the problems such as the one fixed in 3ff8c3c ("add
missing wxDataViewDateRenderer::GetDefaultType()") would be visible there too.
This commit is contained in:
Vadim Zeitlin
2015-08-28 23:58:10 +02:00
parent e8647b4751
commit a49567109a
5 changed files with 78 additions and 41 deletions

View File

@@ -2923,23 +2923,7 @@ static void wxGtkTreeCellDataFunc( GtkTreeViewColumn *WXUNUSED(column),
return;
}
wxVariant value;
wx_model->GetValue( value, item, column );
// It is always possible to leave a cell empty, don't warn about type
// mismatch in this case.
if (!value.IsNull())
{
if (value.GetType() != cell->GetVariantType())
{
wxLogDebug("Wrong type returned from the model: "
"%s required but actual type is %s",
cell->GetVariantType(),
value.GetType());
}
}
cell->SetValue( value );
cell->PrepareValue(wx_model, item, column);
// deal with disabled items
bool enabled = wx_model->IsEnabled( item, column );