All about programming in GNU/LINUX

My simple Qt creations in GNU/LINUX

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

#include <QtCore/QCoreApplication>
#include<QDebug>
#include<QDir>
#include<QFileInfo>
#include<QString>
#include<unistd.h>
int main(int argc, char *argv[])
{

    QCoreApplication a(argc, argv);
    char homepath[100]="/home/";
    char *usrname=getlogin();
    strcat(homepath,usrname);
    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();
        output=path2.absoluteFilePath();
        abcpath.setPath(output);
        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 .

 

#include<QApplication>
#include<QHBoxLayout>
#include<QWidget>
#include<QSlider>
#include<QSpinBox>
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;
    spinbox->setRange(0,100);;
    slider->setRange(0,100);
    QObject::connect(spinbox,SIGNAL(valueChanged(int)),slider,SLOT(setValue(int)));
    QObject::connect(slider,SIGNAL(valueChanged(int)),spinbox,SLOT(setValue(int)));
    spinbox->setValue(35);
    QHBoxLayout *layout=new QHBoxLayout;
    layout->addWidget(slider);
    layout->addWidget(spinbox);
    window->setLayout(layout);
    window->showNormal();
    return app.exec();
}


ART OF APP BUILDING IN GNU/LINUX-1:CREATING LAYOTS , SIGNALS AND SLOTS , TABS AND BUDDIES USING QT

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


Image

SIMPLE TEMPORARY TEXT EDITOR USING QT IN GNU/LINUX

HACKINTOSH EDITOR

This text editor doesnt contain any options like saving the file or other editor ….Its just a simplest one of its kind


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