Development/Tutorials/Introduction to Goya usage: Difference between revisions

From KDE TechBase
(New page: {{TutorialBrowser| series=Goya Framework| name=Introduction to the Goya Framework usage| pre=[http://mindview.net/Books/TICPP/ThinkingInCPP2e.html C++], [http://www.trolltech.com/produc...)
 
No edit summary
Line 13: Line 13:


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 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==
<code cppqt>
// 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>
</code>

Revision as of 15:34, 13 February 2008

Introduction to the Goya Framework 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

  1. include <goya/goya.h>
  2. include <goya/pushbutton.h>

// Basic Qt includes

  1. include <QPainter>
  2. include <QBoxLayout>
  3. include <QListView>
  4. include <QStringListModel>

// Basic KDE includes

  1. include <kapplication.h>
  2. include <kaboutdata.h>
  3. include <kmessagebox.h>
  4. include <kcmdlineargs.h>
  5. include <klocalizedstring.h>
  6. include <kicon.h>