We could say Goya is a layer between the view and your delegate that draws widgets with the needed options and that seem to behave as if they were real widgets, but they are fake widgets after all.

We could say Goya is a layer between the view and your delegate that draws widgets with the needed options and that seem to behave as if they were real widgets, but they are fake widgets after all.

−

Goya is so nice mainly because it integrates pretty well with the Model/View design, and uses the Qt powerful signals and slots. Goya widgets will emit signals when something have happened to them, so you will be able to connect those signals to your app slots, and do fancy stuff without complex stuff.

+

Goya is so nice mainly because it integrates pretty well with the Model/View design, and uses the Qt powerful signals and slots. Goya widgets will emit signals when something has happened to them, so you will be able to connect those signals to your app slots, and do fancy stuff without complex stuff.

==A Simple Example==

==A Simple Example==

This example consists on a single window that will contain a list view. There will be pushbuttons only in the odd rows.

This example consists on a single window that will contain a list view. There will be pushbuttons only in the odd rows.

−

<code cppqt>

+

<syntaxhighlight lang="cpp-qt">

// Basic Goya includes

// Basic Goya includes

−

#include <goya/goya.h>

+

#include <goya/kwidgetitemdelegate.h>

−

#include <goya/pushbutton.h>

+

// Basic Qt includes

// Basic Qt includes

Line 38:

Line 37:

#include <kicon.h>

#include <kicon.h>

+

// This is our delegate, it has to inherit KWidgetItemDelegate which inherits

+

// QAbstractItemDelegate. The delegate needs on its constructor first

+

// parameter a view, this is different to a regular QAbstractItemDelegate

+

// because we need to install event filters in order to allow interaction

We are developing some component of our application using Model/View (check prerequisites). At some point on our development, we discover that we actually want to add widgets to our delegate, but the Model/View framework does not provide a powerful and integrated way of doing so. Here is where Goya comes to help out for this task.

We could say Goya is a layer between the view and your delegate that draws widgets with the needed options and that seem to behave as if they were real widgets, but they are fake widgets after all.

Goya is so nice mainly because it integrates pretty well with the Model/View design, and uses the Qt powerful signals and slots. Goya widgets will emit signals when something has happened to them, so you will be able to connect those signals to your app slots, and do fancy stuff without complex stuff.