Posts Tagged ‘kde’

How to use Qt’s .pro file variable in C++ code

Thursday, July 28th, 2011

So today my colleague ask me ” I have a variable VERSION in .pro file (qmake project file) I want to use that variable in my C++ code, How to do that?”

After a little search on Google I figured that we have export project files variable as a macro for C/C++ code and it very easy.

As the per problem we want VERSION variable in C++ code. So in  project file we write

DEFINES += VERSION=\\\"$$VERSION\\\"

and in C/C++ code just

qDebug()<< VERSION ;

this is just a awesome.

conf.kde.in : Only 15 Days to go!!!

Tuesday, February 22nd, 2011

I am contributing to KDE from last 1 yr. The community has given me lots of things :

1) Good Friends.

2) Metors.

3) Knowledge.

and many more.

And I want all of you to be a part of this community and grow this community.  you have a great change to get the live experience of all this things and be a part of the community by attending India’s 1st ever KDE conference conf.kde.in.

Only 15 days remain for the conference and ONLY 3 days left for discounted online registration. After that the registration fees goes up so hurry up register your seat http://kde.in/conf/register .

I am almost ready with my slides for the talk and excited to meet all the KDE hacker,  here I invite all of you to come and join us.

enjoy!!

conf.kde.in : I am attending !! are you ?

Saturday, February 5th, 2011

If you are a KDE or Qt Developer or Opensource enthusiast then DON’T miss India’s fist ever KDE conference.

My 2 talks got selected for conf.kde.in 1) Writing Kate Plugins 2 ) Getting started with Qt programming (with Prashanth Udupa) and there are many more interesting talks by really cool speakers. Here is the list ->  http://kde.in/conf/talks/ .

If you have’t yet register then do it now (http://kde.in/conf/register/)  if you are a student or professor you got a discount too ;) and for student how needs to provide participation letter to there college here it is http://kde.in/conf/letter-for-participation/ hurry up secure your sit, lock you calendar and  plan your trip :) .  See you there.

Cheers !!

Good News About KDE!!

Friday, December 31st, 2010

In my last post I mention about the disappointment I got because of No KDE day at Foss.in/2010.

But here’s the GOOD NEWS instead of KDE day we all (Kde developer’s team Kde India ) decided to have a KDE conference in India hurry!! :) .

Team KdeIndia

Photo credit Dinesh Sai

So we have First Ever KDE conference in India details are as follow:

Website : http://conf.kde.in

When:  9 – 13 March.

Where : R V College Of Engineering,
R V Vidyanikethan Post,
Mysore Road,
Bengaluru – 560004,
Karnataka, India

So lock your calendars, apply for leaves and get prepare for the event!

All are welcome from newbies to Old contributors.

See you there Enjoy :) .

My first Open-Source conference Presentation

Thursday, December 30th, 2010

I attend India’s Biggest Open-Source conference FOSS.IN from 2007, and in 2009, in the same conference, I started contributing to KDE/Kate project.

I wrote Tabify plugin for Kate editor and also submitted a few patches to kate and KDE. Then I got lazy and didn’t do much significant contributions.

And again the Foss.in season arrived and I thought why not give a talk on Kate plugin in Foss.in KDE day. There are not much Kate contributors in India and I can share what I learnt and we can get more contributors in Kate too. That seemed to be an inspiring idea.

But I got disappointed since this year KDE day’s plan was dropped and I decided to drop my plan as well!! But thanks to people at my office ( VCL team ) for forcing me to do the presentation and finally I applied for the talk.

Eventually my talk got selected and I became a speaker at Foss.in. On 16th Dec 2010 at 11 am I gave my talk on “Writing plugins for Kate and enhancing Kate”.

Here is the presentation.

Writing plugins for Kate and enhancing Kate

Firefox to Internet Explorer ;)

Monday, October 18th, 2010

Dear Internet Explorer,
People use you only to download me.

Yours truly,

Firefox

*courtesy: Poonam #FB

Using vtkRenderWindow with QGraphicsView

Friday, June 11th, 2010

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 : http://www.vcreatelogic.com/p/2010/06/using-vtkrenderwindow-with-qgraphicsview/ ]

KDE: Kate Tabify Plugin

Tuesday, March 30th, 2010

Well this was my own wish list to have normal Tab Bar in Kate.
And finally I wrote a Tab Bar Plugin – Tabify (this is for now mostly will changed it to TabBar Extension in svn later)

This is how it looks

Here is the patch and this is the “Tar” for the folder.

enjoy :)

Installing Qt for Symbian SDK 4.6.2 on Linux

Saturday, March 20th, 2010

As we all know now Qt can run on Symbian Phones but there is one problem all SDK’s and Tool chain of this officially supports windows.

So how about people like us(who’s default OS is Linux) cant we develop for Symbian using Qt?

In answer to this question I found many articles/blogpost how to install Qt for Symbian on Linux but this is the one which work for me http://lizardo.wordpress.com/2010/02/18/installing-qt-for-symbian-sdk-4-6-2-on-linux/ .

I followed this post every thing was perfect except 2 things

1) creating .sis(the Symbian executable) file.

2) creating installer.sis(the Symbian executable installer) file.

and i figured out how to do that too.

I re-witting the basic installation from http://lizardo.wordpress.com/2010/02/18/installing-qt-for-symbian-sdk-4-6-2-on-linux/ . plus my Hacks/Tricks .

Tool-Chain:

Download all required files to a single directory (e.g. “~/downloads”):

For building the native tools from gnupoc, you will need:

  • the GCC C/C++ compilers
  • development files for zlib
  • development files for openssl

On Ubuntu, you can install these using the following command:

sudo apt-get install build-essential zlib1g-dev libssl-dev

Installation

First, install GnuPoc + S60 SDK + the Open C/C++ plugin:

./gnupoc_1.15_installer_v2.sh \
<download-dir> \
<gnupoc-dir>\
<x.y>

Replace <download-dir> with the location of all files downloaded in previous section (e.g. “~/downloads”), <gnupoc-dir> with the destination directory for GnuPoc and the SDK files (e.g. “~/gnupoc”) and <x.y> (Note that this is not the directory) with the SDK version you want to install (e.g. “3.1″ or “5.0″). Note that both directories must have absolute paths.

If installation was successful, you should see an output like:

Installation has finished. Before using the GnuPoc SDK, run these commands on the console:

export PATH=<gnupoc-dir>/bin:$PATH
export EPOCROOT=<gnupoc-dir>/symbian-sdks/5.0/ # trailing “/” is required!

(These commands must be run again every time a new console is opened.)

Run the commands as instructed on the message. Next, install Qt for Symbian:

./qt_for_symbian_4.6.2_linux_installer_v3.sh \
<download-dir> \
<qt-s60-dir>

Replace <download-dir> with the location of all files downloaded in previous section (e.g. “~/downloads”), and <qt-s60-dir> with the destination directory for the Qt files (e.g. “~/gnupoc/qt-4.6.2″). Note that both directories must have absolute paths.

If installation was successful, you should see an output like:
Installation has finished. Before using the Qt for Symbian SDK, run this command on the console:

export PATH=<qt-s60-dir>/bin:$PATH
unset QMAKESPEC    # make sure there is no QMAKESPEC variable set

(This command must be run again every time a new console is opened.)

Before using Qt for Symbian, you should run the command as instructed on the message above.

Usage example

Install Nokia Smart Installer :

  1. Unzip Nokia Smart Installer  on top of your installed Qt for Symbian folder in <qt-s60-dir>

To test the installation, I will describe how to build the “colliding mice” example.

  1. cd into the example source:
  2. cd <qt-s60-dir>/examples/graphicsview/collidingmice/

  3. Now build the example and generate the SIS file
  4. qmake
    make debug-gcce
    make sis
    make installer_sis

Chnages/Hack/Tricks

You will notice that when  you do make installer_sis
there is some error related to “createpackage.bat” file this is batch file what we have to do is open

Makefile

search for ok_installer_sis:

and change createpackage.bat to createpackage.sh

createpackage.sh is already there just that its not getting reflected in Makefile .

and now if you do make installer_sis you will get collidingmice_installer.sis

I have also created one bash function as follow:

function qtsis {
export PATH=<gnupoc-dir>/bin:$PATH
export EPOCROOT=<gnupoc-dir>/symbian-sdks/5.0/ # trailing "/" is required!
export PATH=<qt-s60-dir>/bin:$PATH
unset QMAKESPEC    # make sure there is no QMAKESPEC variable set
}

Add this function in your .bashrc file with proper path which you get after installation.

and do source ~/.bashrc

now when ever you want to compile your qt code for Symbian 1st execute qtsis command on your terminal then other qt commands :)

A few notes:

  • Make sure Qt is installed on the device before installing Qt applications. The easiest way to install it is to copy the “qt_installer.sis” package found under <qt-s60-dir> over bluetooth and open the received message to begin the installation.
  • Only the “debug-gcce” (if you are using the GCCE toolchain AKA “CodeSourcery toolchain”) or “debug-armv5″ (if you are using RVCT) will work, because the current Qt releases only ship debug versions of the libraries

enjoy :)

KDE: Kate add a file by right-click in Filesystem Browser

Thursday, January 28th, 2010

One more Kate wish completed by me :) .  Bug no. 93230 and this will also be in KDE4.5 :) .

Problem/Wish: There is no way to add a file by rightclicking to a folder in Filesystem Broswer(filebrowser plugin).

Solution: Updated the KDirOperator with KNewFileMenu wrapper “setNewFileMenuSupportedMimeTypes” which will Only show the files in a given set of mimetypes it Internally uses  KNewFileMenu::setSupportedMimeTypes. In general now we can restrict options to be shown in Create New, this is useful in specialized applications like kate etc.  while file managers, on  the other hand, want to show all mimetypes.  (thanks to David Faure for moving KNewMenu to kdelibs as KNewFileMenu).

* for more details  here is the bug description.

This is how the new context menu of kate Filesystem Browser will look:

To download patch click here.