Menu

How to start developing Qt?

Help
2008-06-24
2013-04-16
  • German Lado

    German Lado - 2008-06-24

    Hi all!

    I'm new in all this SF.net world and looking for a bit of help. The thing is that I must develop a software pretty much like Superkaramba but for a specific summer project. I tried to convince my supervisor about using Superkaramba but he didn't like that it is not multiplatform. I have doubts about this, if Superkaramba is based on Qt Toolkit, is it not possible to use it under windows?

    I'd really like to contribute to Superkaramba project, but first of all I need to learn how to program in Qt. The project I'm enrolled in is a good way to get to know Superkaramba from its basis.

    This program is some sort of multiplatform Superkaramba but with just one use, lets say just a widget/theme. I think it could be really useful for people that wants to contribute Superkaramba, to know where to start and how it works. As part of my summer project I must create a blog with all the things I'm doing to get the project done. This seems a good way of having everything documented following a time line. If anyone of you find this idea interesting and wants to see the blog just give me a shout, I don't want to spam this forum.

    Knowing this, I would like you to give me a helping hand about where to start. I was recently having a look to the Qt documentation but seems a bit messy. At least for me. It would be great if you could point me in the right direction of how to set up KDevelop to work with Qt and to compile superkaramba, I use Eclipse with the Qt addon to program under windows (I hate this, need to change).

    Another thing I've been trying to understand is how Superkaramba creates the Shaped Windows in the desktop, this is really annoying me, I can't find information about irregular windows using Qt.

    Please help! :-)

     
    • wirr

      wirr - 2008-06-24

      Hi,

      okay, lets see if I can help you ;)

      Thanks to Qt SuperKaramba can be used on all different plattforms. The reason it only works on KDE currently is that there is still some integration into the desktop necessary. Until now no one stepped up to do that.

      The Qt docs are actually pretty good. If you want to learn Qt from a book there are probably a few available.

      I don't use KDevelop so I can't help you much with it, but it should work with basically pointing KDevelop to the SuperKaramba sources.

      Compiling SuperKaramba is pretty easy. First you need to get the sources from the KDE repository. I don't know if you want KDE3 or KDE4, but here are the steps: http://techbase.kde.org/Getting_Started/Sources/Anonymous_SVN. To get SK just check-out the kdeutils module.

      For KDE3 you basically need the development packages for KDE that came with your distribution. Usually called something like kdebase-dev, kdelibs-dev, ...

      For KDE4 you can either use the development packages of you distribution or compile KDE4 yourself. Guide here: http://techbase.kde.org/Getting_Started/Build/KDE4

      How it works on Windows, I have no idea. Some basics are here: http://techbase.kde.org/Getting_Started/Build/KDE4/Windows
      Perhaps you are lucky and someone is already working on getting SK at least to compile on windows. Just talk to the project guys.

      SuperKaramba basically creates a widget without any window borders, etc and then sets it onto the desktop by telling the window manager to keep the widget below all other windows. Besides the sensor reading stuff this is the most plattform specific code in SK.

      I hope that answers your questions. If you have more questions just send me an email, post to the forum or come in our irc channel

      Greetings
      Alex

       
    • German Lado

      German Lado - 2008-06-25

      Hey thanks for the fast answer :-)
      Yesterday I changed my mind about KDevelop, I think is better to use Eclipse both under Linux and Windows. Right now I'm starting with the interface while learning Qt. The very first thing I want to get up and running is the main window with the config and the system tray icon. Luckily I found a good example about tray icons on Qt site: http://doc.trolltech.com/4.4/desktop-systray.html
      After getting that done, I'll continue with the shaped windows. However, do you think it is possible to have the same desktop functionality in windows that in Linux? I mean, use the same code for the gadgets/widgets to be on the desktop and ignore the Window Manager. As you say, this is the most platform specific code...

      Another thing, could you tell me the piece of code where SK handles the shaped windows? or at least the cpp file.

      I'm trying also to compile SK from Eclipse under my Kubuntu, but it seems that Eclipse is doing something I don't understand because the only thing I can get out of it is the base empty window. I think I must modify the code of the .pro file as it seems to be where the calls to the windows are made. I'll keep trying.

      Thanks for the help.

       
      • wirr

        wirr - 2008-06-25

        Hi there,

        to get the main window and the system tray to work should be very easy.

        The option tha set a widget on the desktop or below other windows should work on every plattform. I don't think it can be done without platform specific code. Perhaps there is something in Qt already to do that, but I don' know.

        The best thing would be to refactor that code out and implement it for every plattform in a class hierarchie with one class for every platform. That would just mean to check the platform with cmake and then compile the right class.

        The main code for the widgets is in mainwidget.cpp. Everything else is done in karamba.cpp with various calls to KWindowSystem.

        I don't now what Eclipse does but I would try to get everything compiled without any IDE so it doesn't interfere. If this works then basically you ust need an advanced text editor to work on SK.

         
    • German Lado

      German Lado - 2008-06-25

      Great idea... IDEs sux.

      I'm trying to create a small piece of code to put a icon on the system tray, but I'm a bit lost, this is part of the code:

      void tray::setIcon()
      {
           QIcon icon = QIcon("heart.svg");

      // qDebug(QString(icon));

           trayIcon->setIcon(icon);
           setWindowIcon(icon);
      }

      But it throws this message: QSystemTrayIcon::setVisible: No Icon set
      I know it must be a silly error but I cant find it! I suppose the definition of the icon = QIcon(path_to_file) doesnt work. Any idea how should I pass the file to the icon definition?

      By the way, could you tell me the IRC Channel where you are?

      Thanks again.

       
      • wirr

        wirr - 2008-06-25

        If the code doesn't work try to work with the absolute file name of the icon or check if the icon is really loaded.

        Normally you find some hints on the internet if you google for the error. Otherwise you can stil look in the Qt code, here it says:
        if (d->icon.isNull() && visible)
           Warning("QSystemTrayIcon::setVisible: No Icon set");

        So it seems that the graphic can note beload ed and the QIcon is empty.

        Another idea is to use "new QIcon".

        Our channel is #superkaramba at irc.freenode.org - i am usually online in the evenenigs (european time)

         
    • German Lado

      German Lado - 2008-06-25

      Forget about the icon problem, I've already solved it. But the question about the IRC is still on :-)

       

Log in to post a comment.