Development/Tutorials/Introduction to Goya usage
Tutorial Series | Goya Framework |
Previous | C++, Qt, Model/View Qt Framework, KDE4 development environment |
What's Next | n/a |
Further Reading | n/a |
Abstract
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 have 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
// Basic Goya includes
- include <goya/goya.h>
- include <goya/pushbutton.h>
// Basic Qt includes
- include <QPainter>
- include <QBoxLayout>
- include <QListView>
- include <QStringListModel>
// Basic KDE includes
- include <kapplication.h>
- include <kaboutdata.h>
- include <kmessagebox.h>
- include <kcmdlineargs.h>
- include <klocalizedstring.h>
- include <kicon.h>