Information Computer

Showing posts with label qtcreator. Show all posts
Showing posts with label qtcreator. Show all posts

Thursday, January 5, 2012

Conversion Integer to String [QtCreator]

in the programming world is certainly very important variable. and the variable whose name is very close to the data type. in some programming language is very sensitive to the type of data.

in this post I discuss Integer and string data types. integer data type is a data type for data in the form of integers. while the string data type is a data type for data in the form of text. string data type could be worth number, but can not be calculated as arithmetic. therefore the data must first be converted to an Integer data type.

this time we try to convert the data type Integer to String and vice versa in QtCreator. follow the following steps.

1. The first example we created a variable of type int named number
int var_number = 6;

2. now convertible into QString way.
QString var_str_number= QString::number(var_number);

3. after that follows the example if you want to be converted again to the numbers.
int var_number_again = var_str_number.toint();

any question?? please comment above. good luck :)


need to know! 
Qt Creator is a cross-platform C++ integrated development environment which is part of the Qt SDK. It includes a visual debugger and an integrated GUI layout and forms designer. The editor's features includes syntax highlighting and autocompletion, but not tabs. Qt Creator uses the C++ compiler from the GNU Compiler Collection on Linux and FreeBSD. On Windows it can use MinGW or MSVC with the default install and can also use cdb when compiled from source.
READ MORE >> Conversion Integer to String [QtCreator]

Sunday, January 1, 2012

Make Application In Qt Creator (Ubuntu)

First step : Install Qt Cretor
- sudo apt-get install qtcreator (in terminal)
- or install using ubuntu software center

Second step : Make a New Project
- click Create Project
- choose Qt4 GUI Application, then click ok
- fill Name with name of the project that you create
- Create in is location you will save the project
- Then click Next

Third step : Desain Interface
- to design applications, we enter the editor and double-click mainwindow.ui adding components with drag 'n drop components to the form.
- in this tutorial we need :
   ~ 2 spin box
   ~ 2 Labels
   ~ 1 Push Button
- double-click to edit caption
- to change property of object, we look at side panel

Fourth step : Give Code
- to Give code we click-right object, click go to slot then choose event.
- so we click-right Push Button, Click go to slot then choose clicked()
- give code below MainWindow::on_pushbutton_clicked().

qint8 result= ui­>spinbox­>value() + ui­>spinbox_2­>value();
QString resultString=QString::number(result);
ui­>label­>setText(resultString);

Fiveth step : Running application
- save (CTRL + S)
- run (CTRL + R or F5)


need to know! 
Qt Creator is a cross-platform C++ integrated development environment which is part of the Qt SDK. It includes a visual debugger and an integrated GUI layout and forms designer. The editor's features includes syntax highlighting and autocompletion, but not tabs. Qt Creator uses the C++ compiler from the GNU Compiler Collection on Linux and FreeBSD. On Windows it can use MinGW or MSVC with the default install and can also use cdb when compiled from source.
READ MORE >> Make Application In Qt Creator (Ubuntu)

Followers