PythonHelper: Add support for bool.
Convert Python bool type from/to C++/QVariant bool (QVariant::Bool) in PythonHelper::variantToPyObject and PythonHelper::variantFromPyObject. This fixes the "override" option and any booleans in the "defaults" list in grubcfg.conf.
This commit is contained in:
parent
1499963920
commit
00604a8bca
@ -53,6 +53,9 @@ variantToPyObject( const QVariant& variant )
|
||||
case QVariant::String:
|
||||
return bp::object( variant.toString().toStdString() );
|
||||
|
||||
case QVariant::Bool:
|
||||
return bp::object( variant.toBool() );
|
||||
|
||||
default:
|
||||
return bp::object();
|
||||
}
|
||||
@ -78,6 +81,9 @@ variantFromPyObject( const boost::python::object& pyObject )
|
||||
else if ( pyType == "str" )
|
||||
return QVariant( QString::fromStdString( bp::extract< std::string >( pyObject ) ) );
|
||||
|
||||
else if ( pyType == "bool" )
|
||||
return QVariant( bp::extract< bool >( pyObject ) );
|
||||
|
||||
else
|
||||
return QVariant();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user