jeudi 8 septembre 2016
How To Create Your First Qt Program on Ubuntu Linux
Posted by How To on 07:00 in | Comments : 0
Qt is a cross-stage application system (toolbox) that is broadly utilized for creating GUI applications, furthermore to develop non-GUI projects, for example, order line apparatuses and comforts for servers.
Qt is the basic library in KDE and all the KDE particular applications. Qt permits you to make powerful, very much composed, GUI applications in the briefest timeframe.
The upsides of Qt
Cross stage support
Free on the off chance that you are making GPLed applications.
Moderately less intricate when contrasted with different libraries in the same sort.
A one of a kind method for correspondence between UIs utilizing Signal - Slot system.
A rich gathering of instant gadgets that diminish the improvement time radically.
A decision of Free IDEs that help you accelerate the planning of your applications.
A gathering of Free IDEs for Qt improvement is recorded toward the end of this article.
The most effective method to make a Qt venture
Here is a cool technique for making a Qt venture from a terminal.
The code appeared underneath is a basic C++ program that will show a name with the words "Linux is brilliant" inside its own particular window. On the off chance that you need to give it a shot, duplicate the code appeared beneath into a content manager and spare it as test.cpp. You can give it any name.
#include
#include
int main(int argc, singe *argv[])
{
QApplication app(argc, argv);
QLabel *label = new QLabel("Linux is brilliant", 0);
app.setMainWidget(label);
name >show();
return app.exec();
}
The .cpp expansion of the record name "test.cpp" lets us know that it is a C++ document. For the uninitiated, in Linux, C++ projects are regularly ordered utilizing g++ compiler. On the off chance that you don't have g++ compiler as of now introduced, now is the perfect time to do as such by introducing the assemble key bundle which introduces all the vital compiler apparatuses.
As a rule, you utilize a document by name MakeFile which guides the compiler to accumulate your projects. And you should simply move into the registry containing the "MakeFile" and your project, and run make.
So to aggregate the above project, you need to make a MakeFile first.
Creating a MakeFile
Qt has a simple method for producing a MakeFile. Here is the way you do it.
Step 1: Move into the index containing your code - for our situation it is the document test.cpp.
Step 2: While in this catalog, make a Qt venture by running the accompanying summon -
$ qmake - venture
This will make a task document called test.pro and incorporate our project test.cpp into it.
Step 3: Now run qmake on the venture record to make a stage particular MakeFile as takes after -
$ qmake test.pro
At this stage on the off chance that you do a posting of the substance of the catalog, you will discover a document by name MakeFile .
Arrange the Qt program
To arrange our project, it is currently as basic as running make.
$ make
Executing your gathered project
Subsequent to running make, you will locate an executable document by name test in your registry which when run will show the name in a window.
$ ./test
This is one method for accumulating a straightforward Qt venture. For complex activities, you more often than not utilize specific editors like those recorded above which mechanizes the formation of the venture and the accumulation.
Inscription à :
Publier les commentaires
(
Atom
)
Enregistrer un commentaire