1
Fork 0
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:
Andreas Kling 2020-08-16 16:02:01 +02:00
parent a1e381a0f8
commit f882424869
3 changed files with 16 additions and 2 deletions

View file

@ -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())