IGOS Nusantara dan Qt: Perbedaan revisi

Dari IGNwiki
Langsung ke: navigasi, cari
Baris 1: Baris 1:
 
+
== Pasang ==
 +
#
 
  yum -y install qt qt-devel
 
  yum -y install qt qt-devel
g++ -o qthello -I/usr/include/QtCore -I/usr/include/QtGui -lQtGui -lQtCore qthello.cpp
 
  
== Unduh ==
+
== Contoh Non GUI ==
Akses ke: http://download.qt-project.org/archive/qt/5.3/5.3.1/
+
Simpan di: /home/igos/qt/qtDunia.cpp
 
+
Unduh:
+
qt-opensource-linux-x86-5.3.1.run 24-Jun-2014 10:31 447M
+
qt-opensource-linux-x64-5.3.1.run 24-Jun-2014 10:30 444M
+
 
+
 
+
Versi single: http://download.qt-project.org/archive/qt/5.3/5.3.1/single/
+
 
+
Unduh:
+
qt-everywhere-opensource-src-5.3.1.tar.xz 24-Jun-2014 10:49 169M Details
+
  
IGN 32 bit
 
 
  $  
 
  $  
  wget download.qt-project.org/official_releases/qt/5.3/5.3.1/qt-opensource-linux-x86-5.3.1.run
+
  cd /home/igos
  sudo chmod +x qt-opensource-linux-x86-5.3.1.run
+
  mkdir qt
  ./qt-opensource-linux-x86-5.3.1.run
+
  cd qt
 
+
  nano qtDunia.cpp
IGN 64 bit
+
  $
+
wget download.qt-project.org/official_releases/qt/5.3/5.3.1/qt-opensource-linux-x64-5.3.1.run
+
chmod +x qt-opensource-linux-x64-5.3.1.run
+
./qt-opensource-linux-x64-5.3.1.run
+
 
+
== Pasang ==
+
#
+
yum install libxcb libxcb-devel xcb-util xcb-util-devel xcb-util-*-devel libX11-devel libXrender-devel libXi-devel
+
 
+
== Contoh Non GUI ==
+
  
 +
Ketik:
 
  #include<QtCore>
 
  #include<QtCore>
 
  int main(){
 
  int main(){
Baris 40: Baris 19:
  
 
== Contoh Program GUI ==
 
== Contoh Program GUI ==
 +
Simpan di: /home/igos/qt/qtGuiDunia1.cpp
  
Contoh1
+
$
 +
cd /home/igos/qt
 +
nano qtGuiDunia1.cpp
  
 
  #include<QApplication>
 
  #include<QApplication>
Baris 54: Baris 36:
 
  }
 
  }
  
 +
Simpan di: /home/igos/qt/qtGuiDunia2.cpp
  
Contoh2
+
$
 +
cd /home/igos/qt
 +
nano qtGuiDunia2.cpp
  
 
  #include <QApplication>
 
  #include <QApplication>
Baris 69: Baris 54:
 
     return app.exec();
 
     return app.exec();
 
  }
 
  }
 +
 +
== Kompilasi ==
 +
$
 +
g++ -I/usr/include/QtCore -I/usr/include/QtGui -lQtGui -lQtCore qtDunia.cpp -o qtDunia
 +
 +
== Jalankan ==
 +
$
 +
./qtDunia

Revisi per 27 Agustus 2014 02.31

Pasang

#
yum -y install qt qt-devel

Contoh Non GUI

Simpan di: /home/igos/qt/qtDunia.cpp

$ 
cd /home/igos
mkdir qt
cd qt
nano qtDunia.cpp

Ketik:

#include<QtCore>
int main(){
   qDebug() << "Halo Dunia\n";
}

Contoh Program GUI

Simpan di: /home/igos/qt/qtGuiDunia1.cpp

$
cd /home/igos/qt
nano qtGuiDunia1.cpp
#include<QApplication>
#include<QLabel>

int main(int argc, char *argv[]){
   QApplication a(argc, argv);
   QLabel    label;
   label.setText("Hello World");
   label.show();
   a.exec();
}

Simpan di: /home/igos/qt/qtGuiDunia2.cpp

$
cd /home/igos/qt
nano qtGuiDunia2.cpp
#include <QApplication>
#include <QPushButton>

int main(int argc, char **argv)
{
   QApplication app (argc, argv);
    
   QPushButton button ("Hello world !");
   button.show();
    
   return app.exec();
}

Kompilasi

$
g++ -I/usr/include/QtCore -I/usr/include/QtGui -lQtGui -lQtCore qtDunia.cpp -o qtDunia

Jalankan

$
./qtDunia