Red de conocimiento informático - Material del sitio web - ¿Cómo instalar QT4 en Ubuntu?

¿Cómo instalar QT4 en Ubuntu?

Ejecutar:

i. $ sudo apt-get install libqt4-dev libqt4-debug libqt4-gui

libqt4-sql qt4-dev-tools qt4-doc qt4-designer qt4-qtconfig

qt4-dev- herramientas

Incluidas herramientas como Qt Assistant y Qt Linguist, estas herramientas no necesitan instalarse por separado. Además, qt4-doc

es un archivo de ayuda que contiene descripciones detalladas de la biblioteca Qt y una gran cantidad de programas de ejemplo, que se pueden leer usando la herramienta Qt Assistant

. qt4-qtconfig es un cuadro de diálogo para configurar el entorno Qt, mientras que qt4-demos

contiene una gran cantidad de archivos ejecutables ejecutables y código fuente. qt4-designer es un diseñador utilizado para diseñar interfaces GUI

II.$ sudo apt-get install libqt4-debug Al instalar el software, el sistema le preguntará:

Leer la lista de paquetes de software ...Completo

Analizar el árbol de dependencias del paquete de software

Leer información de estado...

Completo

En tercer lugar, escribir el código fuente.

Cree una nueva carpeta qt4hello y luego cree un nuevo archivo Qthello.cpp en ella, con el siguiente contenido cpp, con el siguiente contenido:

#include

#include

int main(int argc, char *argv[])

{

aplicación QApplication(argc, argv

<); p> QPushButton hola ("¡Hola Ubuntu!");

hola.resize(100, 30);

hola.show();

devolver aplicación; .exec() ;

}

Escriba en la terminal: $ gedit Qthello.cpp (ingrese al programa anterior)

$qmake -project (genera Qt proyecto)

$qmake (generar archivo MAKE)

$make

G++ -c -pipe -g -Wall -W -D_REENTRANT -DQT_GUI_LIB -DQT_CORE_LIB

-I/usr/share/qt4/mkspecs/linux-g++ -I.-I/usr/include/qt4/QtCore

-I/usr/include/qt4/QtCore - I/ usr/include/qt4/QtGui

-I/usr/include/qt4/QtGui -I/usr/ include/qt4 -I.-I.-I.-o

QtHello.o QtHello.cpp

g++ -o qtsrc QtHello.o -L/usr/lib -lQtGui -lQtCore -lpthread

Finalmente

$ ls

Makefile qt4hello

qt4hello.pro Qthello.cpp

Qthello.o

Fin

$ . /qt4hello Se muestra una pequeña ventana de saludo en la pantalla y se completa la instalación