Qt C++ code for GNU/LINUX to print the directory content of the Home folder and one level recursive traversal

#include <QtCore/QCoreApplication>
int main(int argc, char *argv[])

    QCoreApplication a(argc, argv);
    char homepath[100]="/home/";
    char *usrname=getlogin();
    QString linuxpath(homepath);
    QDir dir;
    QString output;
    qDebug()<< dir.exists(linuxpath);
    foreach(QFileInfo path,dir.drives())
        qDebug() <<  path.absoluteFilePath();

    QDir abpath(linuxpath);
    QDir abcpath;
    foreach(QFileInfo path2,abpath.entryInfoList())
        qDebug()<< path2.absoluteFilePath();
        foreach(QFileInfo path3,abcpath.entryInfoList())
            qDebug()<<"\t"<< path3.absoluteFilePath();


    return a.exec();

Steps for execution

1.Create an QT console project and execute the code
2.Run the executable from the terminal after successfull compilation


Qt Creator:Illustration of signals and slots mechanism b/w Qslider and QSpinbox

ImageCreate a Empty QT C++ Project and compile and run the following code , which clearly illustrates the signals and slots mechanism using Spinbox and Slider widgets .As the horizontal slider value is changed the spinbox value is set to the new value of horizontal slider and vice-versa .


int main(int argc,char **argv)
    QApplication app(argc,argv);
    QWidget *window=new QWidget;
    window->setWindowTitle(“Enter the marks”);
    QSlider *slider=new QSlider(Qt::Horizontal);
    QSpinBox *spinbox=new QSpinBox;
    QHBoxLayout *layout=new QHBoxLayout;
    return app.exec();


End result of the tutorial

QT CREATOR is a very simple , yet powerful tool to create Graphical User Interfaces .But development of effective Application in any operating system is possible only with the help of System programming in that respective environment .In the series of videos to follow , i will take you through the fascinating world of APP making in GNU/LINUX combining System programming  in GNU/LINUX using C and QT creator to creator to GUI using C++.Yes, as you would be knowing by now , the prerequisites are C ,C++ , some knowledge about GNU/LINUX environment,passion to develop apps for GNU/LINUX   and lots and lots of imagination!!!So the process of App-building in any environment is not just about applying the Logic , Its an ART!!Here is the first tutorial of the series which just involves basic concepts of creating GUI using QT.

The preferred OS is UBUNTU 12.04 .To Install QT CREATOR, Just go to SOFTWARE CENTER  or type in “sudo apt-get install qtcreator” from terminal

My First Experience on Creating GUI in GNU/LINUX using QT creator

Every piece of software around us have interfaces , may it be on your mobiles,ATM Machines  ,Music players , Television Sets, not to mention everything on your Computer from Apps to your desktop environment .So creating a Interface for software is no longer a rare requirement , its a part of Almost every Software .Here is my first go at creating GUI based softwares in Linux …..Try QT Creator ,the advantage  with this is that you will be writing  same piece  of code in Windows , Linux and MAc OS to create GUI environment ……Qt creator is very simple and easy to use , Using QT requires Basic knowledge of Object Oriented Programming concepts (If u have programmed previously in JAVA , C++ or in PYTON , you can  easily start learning to program in QT Creator . In Ubuntu Linux , Qt Creator can be directly installed from software centre , or else Qt creator binary is Available for Download at http://qt.nokia.com/downloads .If you are interested in learning GUI programming using QT here is the link for good series of video lectures on it …..http://www.youtube.com/watch?v=6KtOzh0StTc&feature=list_related&playnext=1&list=SP2D1942A4688E9Image

Running the Binary file which was created after building the code in Qt creator  which gave a GUI window with a Push Button by name “MYSTIXZ” !!!

 Image     A look Around QT Creator in GNU/LINUX  -1Image     A look Around QT Creator in GNU/LINUX  -2