GUI dengan QT
2 posters
Halaman 1 dari 1
perluuuuu
untuk program yang diperlukan :
1. komputer
2. internet
3. google
4 buang bantal dan guling
hehehehe 9X
Maaf aku tidak mengerti dengan pertanyaan anta
1. komputer
2. internet
3. google
4 buang bantal dan guling
hehehehe 9X
Maaf aku tidak mengerti dengan pertanyaan anta
zz- Panglima
- Jumlah posting : 121
Age : 78
Lokasi : france
Registration date : 13.02.09
Rumit??????
Dasar semua ini adalah c++,
The most powerful high programing
The most powerful high programing
zz- Panglima
- Jumlah posting : 121
Age : 78
Lokasi : france
Registration date : 13.02.09
gui
pakah serumit ini,dan mungkin pa gak terlalau banyak untuk gui kan uda jadi biasanya...! ohya aku ingin tanyak nie....? dalam program yang di perluin pa saja...........?
mohon di balas dengan sepat GPL
mohon di balas dengan sepat GPL
GUI dengan QT
#ifndef LUAS_H
#define LUAS_H
#include <QtGui/QWidget>
#include <ui_luas.h>
class luas : public QWidget
{
Q_OBJECT
public :
luas (QWidget *parent=0);//construktor
~luas();//destruktor
public slots :
void kali () ;
void volume ();
private :
Ui::Form ui;//husus form itu tergantung nama object yang ada pada file .ui
};
#endif
//simpan kode diatas di file dengan nama "luas.h" tanda kutip jangan ikut
//lalu.............................................................................................................
#include <luas.h>
luas::luas (QWidget *parent) :QWidget (parent)//constructor
{
ui.setupUi(this);
QObject::connect (ui.tekan, SIGNAL(clicked()), this,SLOT(kali()));
QObject::connect (ui.volume,SIGNAL(clicked()),this,SLOT(volume()));
}
luas::~luas()//destruktor
{
QString strsatu = ui.a->text ();
QString strdua = ui.b->text ();
bool ok;
int satu = strsatu.toInt(&ok);
int dua = strdua.toInt(&ok);
int hasil= satu + dua ;
QString strxxx;
strxxx= strxxx.number(hasil);
ui.c -> setText (strxxx);
}
void luas::kali ()
{
QString strsatu = ui.a->text ();//mengisi str yang bernama satu text di object a
QString strdua = ui.b->text ();//mengisi str yang bernama dua text di object b
bool ok;
double satu = strsatu.toDouble(&ok);//merubah "strsatu" dari string ke double
double dua = strdua.toDouble(&ok);//merubah "dua" dari string ke double
double hasil= satu * dua ;//mengisi "hasil" dengan satu kali dua
QString strxxx;//memperkenalkan string strxxx
strxxx= strxxx.number(hasil);//mengisi "strxx" "dengan hasil"
ui.aaa -> setText (strxxx);//mengisikan "strxxx"ke object c
}
void luas::volume ()
{
QString strsatu = ui.a->text ();//mengisi str yang bernama satu text di object a
QString strdua = ui.b->text ();//mengisi str yang bernama satu text di object b
QString strtiga = ui.c->text ();
bool ok;
double satu = strsatu.toDouble(&ok);//merubah "strsatu" dari string ke double
double dua = strdua.toDouble (&ok);//merubah "dua" dari string ke double
double tiga = strtiga.toDouble(&ok);
double hasil= satu * dua * tiga;//mengisi "hasil" dengan satu kali dua
QString strxxx;//memperkenalkan string strxxx
strxxx= strxxx.number(hasil);//mengisi "strxx" "dengan hasil"
ui.aaa -> setText (strxxx);//mengisikan "strxxx"ke object c
}
//simpan kode diatase dengan nama "luas.cpp", lagi2 tanda kutip dibuang
//lalu.............................................................................................................
#include <luas.h>
#include <QApplication>
#include <QtGui>
int main (int argc,char *argv[])
{
QApplication hhh(argc,argv);
luas w;
w.show();
return hhh.exec();
}
//simpan file barusan dengan nama "main.cpp"
//selesai
/*cara kompilasi kalau di ubuntu adalah, masuk kefolder yang dibuat menyimpan file,
lalu tulis "qmake -project",
setelah itu cari file "namafile.pro" dan ketikkan ke terminal "qmake namafile.pro"
dan akhirnya ketikkan "make"
selesai...
Bagi yang belum menginstall qt dan qt designer silahkan install dulu
*/
//ini file .ui
<ui version="4.0" >
<class>Form</class>
<widget class="QWidget" name="Form" >
<property name="geometry" >
<rect>
<x>0</x>
<y>0</y>
<width>274</width>
<height>177</height>
</rect>
</property>
<property name="windowTitle" >
<string>Form</string>
</property>
<widget class="QPushButton" name="tekan" >
<property name="geometry" >
<rect>
<x>10</x>
<y>80</y>
<width>80</width>
<height>27</height>
</rect>
</property>
<property name="text" >
<string>Luas</string>
</property>
</widget>
<widget class="QLineEdit" name="a" >
<property name="geometry" >
<rect>
<x>10</x>
<y>40</y>
<width>81</width>
<height>27</height>
</rect>
</property>
</widget>
<widget class="QLineEdit" name="b" >
<property name="geometry" >
<rect>
<x>100</x>
<y>40</y>
<width>81</width>
<height>27</height>
</rect>
</property>
</widget>
<widget class="QLineEdit" name="c" >
<property name="geometry" >
<rect>
<x>190</x>
<y>40</y>
<width>71</width>
<height>27</height>
</rect>
</property>
</widget>
<widget class="QLabel" name="label" >
<property name="geometry" >
<rect>
<x>30</x>
<y>10</y>
<width>221</width>
<height>18</height>
</rect>
</property>
<property name="text" >
<string> Menghitung luas / volume balok</string>
</property>
</widget>
<widget class="QPushButton" name="pushButton_2" >
<property name="geometry" >
<rect>
<x>100</x>
<y>110</y>
<width>80</width>
<height>27</height>
</rect>
</property>
<property name="text" >
<string>Back</string>
</property>
</widget>
<widget class="QPushButton" name="huruj" >
<property name="geometry" >
<rect>
<x>10</x>
<y>110</y>
<width>80</width>
<height>27</height>
</rect>
</property>
<property name="text" >
<string>Huruj</string>
</property>
</widget>
<widget class="QPushButton" name="volume" >
<property name="geometry" >
<rect>
<x>100</x>
<y>80</y>
<width>80</width>
<height>27</height>
</rect>
</property>
<property name="text" >
<string>Volume</string>
</property>
</widget>
<widget class="QLineEdit" name="aaa" >
<property name="geometry" >
<rect>
<x>190</x>
<y>80</y>
<width>71</width>
<height>51</height>
</rect>
</property>
</widget>
</widget>
<resources/>
<connections/>
</ui>
//bagi yang ingin tahu programnya silahkan ambil di "server/public/vetra"
ini contoh programnya
http://www.ziddu.com/download/3587891/baloqq.zip.html
#define LUAS_H
#include <QtGui/QWidget>
#include <ui_luas.h>
class luas : public QWidget
{
Q_OBJECT
public :
luas (QWidget *parent=0);//construktor
~luas();//destruktor
public slots :
void kali () ;
void volume ();
private :
Ui::Form ui;//husus form itu tergantung nama object yang ada pada file .ui
};
#endif
//simpan kode diatas di file dengan nama "luas.h" tanda kutip jangan ikut
//lalu.............................................................................................................
#include <luas.h>
luas::luas (QWidget *parent) :QWidget (parent)//constructor
{
ui.setupUi(this);
QObject::connect (ui.tekan, SIGNAL(clicked()), this,SLOT(kali()));
QObject::connect (ui.volume,SIGNAL(clicked()),this,SLOT(volume()));
}
luas::~luas()//destruktor
{
QString strsatu = ui.a->text ();
QString strdua = ui.b->text ();
bool ok;
int satu = strsatu.toInt(&ok);
int dua = strdua.toInt(&ok);
int hasil= satu + dua ;
QString strxxx;
strxxx= strxxx.number(hasil);
ui.c -> setText (strxxx);
}
void luas::kali ()
{
QString strsatu = ui.a->text ();//mengisi str yang bernama satu text di object a
QString strdua = ui.b->text ();//mengisi str yang bernama dua text di object b
bool ok;
double satu = strsatu.toDouble(&ok);//merubah "strsatu" dari string ke double
double dua = strdua.toDouble(&ok);//merubah "dua" dari string ke double
double hasil= satu * dua ;//mengisi "hasil" dengan satu kali dua
QString strxxx;//memperkenalkan string strxxx
strxxx= strxxx.number(hasil);//mengisi "strxx" "dengan hasil"
ui.aaa -> setText (strxxx);//mengisikan "strxxx"ke object c
}
void luas::volume ()
{
QString strsatu = ui.a->text ();//mengisi str yang bernama satu text di object a
QString strdua = ui.b->text ();//mengisi str yang bernama satu text di object b
QString strtiga = ui.c->text ();
bool ok;
double satu = strsatu.toDouble(&ok);//merubah "strsatu" dari string ke double
double dua = strdua.toDouble (&ok);//merubah "dua" dari string ke double
double tiga = strtiga.toDouble(&ok);
double hasil= satu * dua * tiga;//mengisi "hasil" dengan satu kali dua
QString strxxx;//memperkenalkan string strxxx
strxxx= strxxx.number(hasil);//mengisi "strxx" "dengan hasil"
ui.aaa -> setText (strxxx);//mengisikan "strxxx"ke object c
}
//simpan kode diatase dengan nama "luas.cpp", lagi2 tanda kutip dibuang
//lalu.............................................................................................................
#include <luas.h>
#include <QApplication>
#include <QtGui>
int main (int argc,char *argv[])
{
QApplication hhh(argc,argv);
luas w;
w.show();
return hhh.exec();
}
//simpan file barusan dengan nama "main.cpp"
//selesai
/*cara kompilasi kalau di ubuntu adalah, masuk kefolder yang dibuat menyimpan file,
lalu tulis "qmake -project",
setelah itu cari file "namafile.pro" dan ketikkan ke terminal "qmake namafile.pro"
dan akhirnya ketikkan "make"
selesai...
Bagi yang belum menginstall qt dan qt designer silahkan install dulu
*/
//ini file .ui
<ui version="4.0" >
<class>Form</class>
<widget class="QWidget" name="Form" >
<property name="geometry" >
<rect>
<x>0</x>
<y>0</y>
<width>274</width>
<height>177</height>
</rect>
</property>
<property name="windowTitle" >
<string>Form</string>
</property>
<widget class="QPushButton" name="tekan" >
<property name="geometry" >
<rect>
<x>10</x>
<y>80</y>
<width>80</width>
<height>27</height>
</rect>
</property>
<property name="text" >
<string>Luas</string>
</property>
</widget>
<widget class="QLineEdit" name="a" >
<property name="geometry" >
<rect>
<x>10</x>
<y>40</y>
<width>81</width>
<height>27</height>
</rect>
</property>
</widget>
<widget class="QLineEdit" name="b" >
<property name="geometry" >
<rect>
<x>100</x>
<y>40</y>
<width>81</width>
<height>27</height>
</rect>
</property>
</widget>
<widget class="QLineEdit" name="c" >
<property name="geometry" >
<rect>
<x>190</x>
<y>40</y>
<width>71</width>
<height>27</height>
</rect>
</property>
</widget>
<widget class="QLabel" name="label" >
<property name="geometry" >
<rect>
<x>30</x>
<y>10</y>
<width>221</width>
<height>18</height>
</rect>
</property>
<property name="text" >
<string> Menghitung luas / volume balok</string>
</property>
</widget>
<widget class="QPushButton" name="pushButton_2" >
<property name="geometry" >
<rect>
<x>100</x>
<y>110</y>
<width>80</width>
<height>27</height>
</rect>
</property>
<property name="text" >
<string>Back</string>
</property>
</widget>
<widget class="QPushButton" name="huruj" >
<property name="geometry" >
<rect>
<x>10</x>
<y>110</y>
<width>80</width>
<height>27</height>
</rect>
</property>
<property name="text" >
<string>Huruj</string>
</property>
</widget>
<widget class="QPushButton" name="volume" >
<property name="geometry" >
<rect>
<x>100</x>
<y>80</y>
<width>80</width>
<height>27</height>
</rect>
</property>
<property name="text" >
<string>Volume</string>
</property>
</widget>
<widget class="QLineEdit" name="aaa" >
<property name="geometry" >
<rect>
<x>190</x>
<y>80</y>
<width>71</width>
<height>51</height>
</rect>
</property>
</widget>
</widget>
<resources/>
<connections/>
</ui>
//bagi yang ingin tahu programnya silahkan ambil di "server/public/vetra"
ini contoh programnya
http://www.ziddu.com/download/3587891/baloqq.zip.html
Terakhir diubah oleh zz tanggal Sat Feb 21, 2009 12:51 pm, total 1 kali diubah
zz- Panglima
- Jumlah posting : 121
Age : 78
Lokasi : france
Registration date : 13.02.09
Halaman 1 dari 1
Permissions in this forum:
Anda tidak dapat menjawab topik
|
|