GCF Application Server


A couple of months back I had visited a customer for making a sales/technology pitch for the use of GCF in developing their software. They had developed a rather extensive visualization application over 10-12 years and they had been intending to move to Qt for quite sometime now. As they were hunting for an application framework based on Qt for building their next generation modular and extensible visualization app; they tumbled upon GCF.

Anyways, during my meeting with them
I figured that they were not really looking for just a port of their existing desktop visualization application to Qt/GCF; but they wanted to have a part of their visualization application on the Web!.

This is where we faced our first road block. We have absolutely no competence on the web and worse we dont know how the 'Web 2.0' apps are developed. So I did my best to convince them that they have sufficient mileage to gain by porting their visualization application to Qt/GCF. I also had to convey to them that we wont be able to offer them anything on the web.
As I returned to my office - I started getting a feeling that they wont even consider us if dont propose a plan for them for the web as well.

That's when we started thinking - 'How do we get Qt, GCF and the Web' together. We started reading up some material about JavaScript and AJAX. We figured that they are not all complicated. Then we looked at GCF and said -
'Hey we already have a neat Interprocess Communication stack in GCF. Why not extend it to support responding to XML messages sent from AJAX/web applications?'

That's when the whole GCF-Application-Server project started.

As a result of all that is http://apps.vcreatelogic.com. Just have a look at it and check out for yourself, the things that are now possible. Please note: We have currently hosted these web-apps on a make-shift Linux server in our office. So you can expect crashes once in a while ;-)

Why is work = giving-presentations?

Have you noticed that almost any ad/movie about a guy or gal doing work has something to do with giving-presentations? And usually the presentation has a chart (line-graph going up or bar chart growing taller) and then everybody in the room listening to the presentation is wearing full 3 piece suit and shining glasses. Each one of these people have a few sheets of papers in front of them. They all have ball-pens; and they are thinking.. After sometime for no reason they all clap and the dude/gal giving the presentation is super-surprised about the adulation.

I know that I work. I know that I work rather good. But I don't give presentations every single day to a room full of people in suits. Perhaps I am not doing any worthwhile work at all! Because the ads sell stuff to "working people" giving presentations and I don't. Perhaps they are targeting only the movie characters that do give presentations all the time at work.

Using vtkRenderWindow with QGraphicsView

We are about to begin on a project that requires us to have floating and transparent widgets over VTK render-window output. About a year back, we had wanted to provide something similar to VTK Designer 2. We wanted users to have the ability to load UI (created using Qt Designer) directly on the VTK output window. At that time (you can follow the thread here) we were unable to come up with something satisfactory.

With the recent changes in Qt, it is now possible for us to have vtkRenderWindow within QGraphicsView. Infact we can now have vtkRenderWindow paint on to a QGLWidget viewport of QGraphicsView. Thats exactly what the vtkQtGraphicsViewRenderWindow class allows us to do.

The class is defined as follows
#ifdef Q_WS_WIN
    #include "vtkWin32OpenGLRenderWindow.h"
    typedef vtkWin32OpenGLRenderWindow vtkRenderWindowClass;
#endif

#ifdef Q_WS_X11
    #include "vtkXOpenGLRenderWindow.h"
    typedef vtkXOpenGLRenderWindow vtkRenderWindowClass;
#endif

class vtkQtGraphicsViewRenderWindow : public QGraphicsView,
                                      public vtkRenderWindowClass
{
    Q_OBJECT

public:
    vtkQtGraphicsViewRenderWindow(QWidget* parent = 0);
    ~vtkQtGraphicsViewRenderWindow();
    ....
};

Since vtkQtGraphicsViewRenderWindow is a subclass of both QGraphicsView and vtkRenderWindow,
- we can add any QGraphicsItem to its scene.
- we can use it as a drop-in replacement for vtkRenderWindow.

For example, take a look at the code below.
vtkRenderer* CreateVTKPipeline()
{
    vtkRenderer* renderer = vtkRenderer::New();

    // Omitted code that create a fractal terrain scene.

    return renderer;
}

int main(int argc, char** argv)
{
    QApplication a(argc, argv);

    vtkRenderer* renderer = CreateVTKPipeline();

    vtkQtGraphicsViewRenderWindow gView;
    gView.AddRenderer( renderer );
    gView.resize(800, 600);
    gView.show();

    QCalendarWidget* calendar = new QCalendarWidget;
    calendar->setWindowOpacity(0.7);

    QGraphicsProxyWidget* sceneWidget = new QGraphicsProxyWidget(0, Qt::Dialog);
    sceneWidget->setWidget(calendar);
    sceneWidget->setPos( -sceneWidget->boundingRect().topLeft() );
    sceneWidget->setFlag(QGraphicsItem::ItemIsMovable);
    sceneWidget->setCacheMode(QGraphicsItem::DeviceCoordinateCache);
    sceneWidget->setWindowTitle("Calendar Widget");

    QGraphicsScene* scene = gView.scene();
    scene->addItem(sceneWidget);

    return a.exec();
}

Output of the above program becomes:

vtkQtGraphicsViewRenderWindow

Whats cooler about the above program is that we can move and resize the translucent QCalendarWidget - and have the background VTK scene updated!

You can checkout a copy of the class and test program from here:
https://svn2.hosted-projects.com/vcreatelogic/VCLTools/vtkQtGraphicsViewRenderWindow
Username: anonymous
Password: anonymous

[Original Post from Abhishek Patil here: http://www.vcreatelogic.com/p/2010/06/using-vtkrenderwindow-with-qgraphicsview/

Possibility of IT Returns!

For the very first time in my life work-life have I noticed someone in my circle actually getting IT returns. I am infact supposed to get some money back from the IT department myself, however I had (until-now) given up hope on actually receiving the returns. Even after repeated follow-ups, I have until now never received returns. I have come to understand one rule about our IT department - “If I dont pay taxes on time, I will get punished. But if the IT department doesnt return on time, there is no penalty for them.” Actually going by the rule book they are supposed to pay 18% interest, but that happens only if they ever pay. How can a 18% interest be paid on nothing????

Anyways, atleast now I know of an actual person at work my office who has received IT returns. So congratulations to him.

Cadence acquires Taray

About a year ago I had blogged about how Taray had signed an OEM deal with Cadence. [http://prashanthudupa.livejournal.com/42294.html]. Today I find out from Ravi, VP of Taray, that Cadence has acquired Taray.

Read the complete news here: http://www.cadence.com/cadence/newsroom/features/pages/feature.aspx?xml=taray

How much they got acquired for is something they are not sharing as yet (or maybe never). But it is wonderful to know that an Indian “product” company has gotten such a beautiful exit. It is even more wonderful to know that our company played a significant part in their product development in the recent past.

My congratulations to Nagesh (CEO), Ravi Vedula (VP), Nishit (FPGA Engineer) and the complete engineering team (made of 18 people in total). You guys rock!

GCFSupport Plugin for Qt SDK

We have recently made available a GCFSupport plugin for Qt SDK 2010.02.01.

GCF 2.3.0 Plugin for Qt Creator 1.3.1 (QtSDK 2010.02.1) [Windows Only]”

Using this plugin it is now possible to get started with GCF super-quickly using Qt Creator. Just unpack the ZIP file and take a look at the README.pdf file for instructions. Within minutes you will have GCFSupport enabled in the Qt Creator bundled with Qt-SDK 2010.02.01.

GCF 2.3 Released

After a bit of a delay, today we announce the release of GCF 2.3. You can download the latest version of GCF from our website. The main new feature in this release is the GCF - Qt Creator integration. With this plugin developers can now use Qt Creator to ease their GCF application development. In addition to this main new feature the latest version comes with several bug-fixes and minor feature additions. Read the change log to find what all has changed in GCF 2.3.0.

We hope you like this release.

Custom Class wizards in Qt Creator

Qt Creator comes built in with a set of project/class/file wizards. These wizards are great to get started with, but I always wished if there were an easy way to add support for more project/file/class wizards. In our projects we frequently write models, delegates and widgets. And the skeleton (or starting point) for most classes look the same. So if there was an easy way to quickly create skeleton for a model/delegate/widget class it would be very useful. With this in mind, I started working on the HintBasedWizard plugin for Qt Creator. You can download the source code by checking out the code from the following SVN location

SVN Location: https://svn2.hosted-projects.com/vcreatelogic/VCLTools/QtCPlugins
Username: anonymous
Password: anonymous


Right now we only have support for class wizards based on hints. The hints are provided in three files


  • Header hint

  • Source hint

  • Description hint


The header-hint for item-model class looks like this (and is saved in a file called ItemModelHeader)

#ifndef {{UPPER_CLASS_NAME}}_H
#define {{UPPER_CLASS_NAME}}_H

#include 

struct {{CLASS_NAME}}Data;
class {{CLASS_NAME}} : public QAbstractItemModel
{
    Q_OBJECT

public:
    {{CLASS_NAME}}(QObject* parent=0);
    ~{{CLASS_NAME}}();

    int rowCount(const QModelIndex& parent=QModelIndex()) const;
    int columnCount(const QModelIndex& parent=QModelIndex()) const;
    QVariant data(const QModelIndex& index, int role=Qt::DisplayRole) const;
    QModelIndex index(int row, int column, const QModelIndex& parent=QModelIndex()) const;
    QModelIndex parent(const QModelIndex& index) const;

private:
    {{CLASS_NAME}}Data* d;
};

#endif // {{UPPER_CLASS_NAME}}_H


The source-hint for the same looks like this (and is stored in a file called ItemModelSource)
#include "{{H_FILE_NAME}}"

struct {{CLASS_NAME}}Data
{

};

{{CLASS_NAME}}::{{CLASS_NAME}}(QObject* parent)
:QAbstractItemModel(parent)
{
    d = new {{CLASS_NAME}}Data;
}

{{CLASS_NAME}}::~{{CLASS_NAME}}()
{
    delete d;
}

int {{CLASS_NAME}}::rowCount(const QModelIndex& parent) const
{
    Q_UNUSED(parent);

    return 0;
}

int {{CLASS_NAME}}::columnCount(const QModelIndex& parent) const
{
    Q_UNUSED(parent);

    return 0;
}

QVariant {{CLASS_NAME}}::data(const QModelIndex& index, int role) const
{
    Q_UNUSED(index);
    Q_UNUSED(role);

    return QVariant();
}

QModelIndex {{CLASS_NAME}}::index(int row, int column, const QModelIndex& parent) const
{
    Q_UNUSED(row);
    Q_UNUSED(column);
    Q_UNUSED(parent);

    return QModelIndex();
}

QModelIndex {{CLASS_NAME}}::parent(const QModelIndex& index) const
{
    Q_UNUSED(index);

    return QModelIndex();
}

The description-hint, which is an XML file, for the same looks like this (and is stored in a file called ItemModelClassHint.xml)
<hint>

    <!-- Meta information about the hints -->
    <title>QAbstractItemModel class</title>
    <type>class</type>
    <name>Model class</name>
    <category>Qt Classes</category>
    <description>Generates a QAbstractItemModel implementation</description>
    <icon></icon>

    <!-- actual hints file -->
    <header>ItemModelHeader</header>
    <implementation>ItemModelSource</implementation>

    <!-- hint fields to ask -->
    <field name="CLASS_NAME" label="Class name">ItemModel</field>

</hint>

I store these files in a folder and launch Qt Creator (with the HintBasedWizard plugin compiled/installed ofcourse). Go to Tools -> Options -> Hints Configuration page and add the newly created hint-description file (ItemModelClassHint.xml) by clicking on the "Add Class Hint" button.



Click on Ok. Now start a new project and try adding a new class using the "File-> New" class wizard.



Select the "QAbstractItemModel class" class under Qt Classes and click "Ok". In the wizard that shows up next, enter appropriate values.



Notice how default values are picked up from the text for <field name="CLASS_NAME"> xml element in ItemModelClassHint.xml file. Click on Next and notice how the class gets generated for you within your project.



I can now create as many class-hints as I want and increase my productivity in programming. The HintBasedWizard plugin comes with class-wizards for the following class types

  • QAbstractItemModel

  • QWidget

  • QAbstractItemDelegate and

  • QGraphicsItem


We plan to add more class-hints in the coming days and also provide support for hint based project and file wizards.

Expand Declarations in Qt Creator

One of the things I dont particularly enjoy is to transfer functions from .h (declaration) to .cpp (implementation), specifying the class scope and then creating open and close brackets. The whole process consumes time and I always thought that it can be automated quite easily in Qt Creator. Just wrote a plugin for Qt Creator that makes it possible.

Consider the following class definition below.



Select the function declarations from constructor all the way down to setCurrentColor(). Copy the code snippet using Ctrl+C. We now have a .cpp file for this class as shown below



With the ExpandDeclarations plugin installed, we can now hit the key-combination Ctrl+Shift+V, to get this dialog box



to get this



This one really saves time, I tell you.

You can grab a copy of the plugin from here: https://svn2.hosted-projects.com/vcreatelogic/VCLTools/QtCPlugins/. Username and password for read-only access is anonymous/anonymous. In the same location you can also find a plugin that provides a project wizard called "Qt Creator Plugin" that automatically generates a Qt Creator Plugin skeleton project for you.

You can now select File -> New project and select the "Qt Creator Plugin" project.



Answer some simple questions



And have a fully functional empty plugin project automatically generated :-).



These plugins are given away under LGPL. So you can use them for any purpose you see fit.