mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 14:28:12 +00:00
LibGUI: Add ModelIndex::data(ModelRole)
This is a convenience API that makes accessing model data easier.
This commit is contained in:
parent
a1e381a0f8
commit
f882424869
3 changed files with 16 additions and 2 deletions
|
@ -25,10 +25,20 @@
|
|||
*/
|
||||
|
||||
#include <AK/String.h>
|
||||
#include <LibGUI/ModelIndex.h>
|
||||
#include <LibGUI/Model.h>
|
||||
#include <LibGUI/Variant.h>
|
||||
|
||||
namespace GUI {
|
||||
|
||||
Variant ModelIndex::data(ModelRole role) const
|
||||
{
|
||||
if (!is_valid())
|
||||
return {};
|
||||
|
||||
ASSERT(model());
|
||||
return model()->data(*this, role);
|
||||
}
|
||||
|
||||
const LogStream& operator<<(const LogStream& stream, const ModelIndex& value)
|
||||
{
|
||||
if (value.internal_data())
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue