[C++] Comment installer et se servir de Qt so

moii51 Messages postés 14 Date d'inscription   Statut Membre Dernière intervention   -  
 rom1504 -
Bonsoir,

après avoir apris le c++ (depuis quelque temps) je voudrais m'intéraisser à Qt.
Mais je ne comprend pas langlais et donc comment on installe Qt et comment on s'en sert.

Mon but final est de faire un logiciel comme bloc note et puis de l'améliorer par la suite.
Mais pour le moment faudrait déjà que je sache me servir de Qt et en tout premier lieu l'installer.

Donc si quelqu'un a le courage je l'en remercie!
A voir également:

9 réponses

mamiemando Messages postés 33778 Date d'inscription   Statut Modérateur Dernière intervention   7 884
 
Pour installer Devcpp
http://www.bloodshed.net/

Pour installer QT (version mingw)
http://trolltech.com/developer/downloads/qt/windows

Pour voir comment faire
https://nicolasj.developpez.com/articles/qt4/

Bonne chance
0
moii51 Messages postés 14 Date d'inscription   Statut Membre Dernière intervention  
 
Après avoir suivi le tutorial: https://nicolasj.developpez.com/articles/qt4/

Dev c++ ne veux pas compiller. Voici ce qu'il dit:

Compilateur: Default compiler
Building Makefile: "D:\Documents and Settings\Propriétaire\Mes documents\programme test C-C++\test qt marche sous dev c++\Makefile.win"
Exécution de  make...
make.exe -f "D:\Documents and Settings\Propriétaire\Mes documents\programme test C-C++\test qt marche sous dev c++\Makefile.win" all
g++.exe -c main.cpp -o main.o -I"C:/Dev-Cpp/lib/gcc/mingw32/3.4.2/include"  -I"C:/Dev-Cpp/include/c++/3.4.2/backward"  -I"C:/Dev-Cpp/include/c++/3.4.2/mingw32"  -I"C:/Dev-Cpp/include/c++/3.4.2"  -I"C:/Dev-Cpp/include"  -O2 -O2 -frtti -fexceptions -Wall -DUNICODE -DQT_LARGEFILE_SUPPORT -DQT_DLL -DQT_NO_DEBUG -DQT_CORE_LIB -DQT_GUI_LIB -DQT_THREAD_SUPPORT -DQT_NEEDS_QMAIN -I"C:\Qt\4.3.0\include\QtGui" -I"C:\Qt\4.3.0\include\QtCore" -I"C:\Qt\4.3.0\include" -I"." -I"C:\Qt\4.3.0\include\ActiveQt" -I"tmp\moc\release_shared" -I"." -I"C:\Qt\4.3.0\mkspecs\win32-g++" 

windres.exe -i Projet1_private.rc --input-format=rc -o Projet1_private.res -O coff 

windres.exe: no resources

make.exe: *** [Projet1_private.res] Error 1

Exécution terminée


Je ne comprend pas..

Qt.template


[Template]
ver=1
Name=Qt
Icon=C:\Qt\4.3.0\demos\qtdemo\qtdemo.ico
Description=Create a GUI using the Qt library.
Catagory=GUI

[Unit0]
CppName=main.cpp
Cpp=Qt_cpp.txt

[Project]
UnitCount=1
Type=1
IsCpp=1
CppCompiler=-O2 -O2 -frtti -fexceptions -Wall -DUNICODE -DQT_LARGEFILE_SUPPORT -DQT_DLL -DQT_NO_DEBUG -DQT_CORE_LIB -DQT_GUI_LIB -DQT_THREAD_SUPPORT -DQT_NEEDS_QMAIN -I"C:\Qt\4.3.0\include\QtGui" -I"C:\Qt\4.3.0\include\QtCore" -I"C:\Qt\4.3.0\include" -I"." -I"C:\Qt\4.3.0\include\ActiveQt" -I"tmp\moc\release_shared" -I"." -I"C:\Qt\4.3.0\mkspecs\win32-g++"
Linker=-mthreads -Wl,-enable-stdcall-fixup -Wl,-enable-auto-import -Wl,-enable-runtime-pseudo-reloc -Wl,-s -Wl,-s -Wl,-subsystem,windows -L"C:\Qt\4.3.0\lib" -L"C:\Qt\4.3.0\lib" -lmingw32 -lqtmain -lQtCore4 -lQtGui4
ProjectIcon=Qt.ico


Merci de votre aide si vous arrivez à trouver le bug.. lol
0
moii51 Messages postés 14 Date d'inscription   Statut Membre Dernière intervention  
 
Je ne trouve toujours pas j'ai passé l'aprèmidis à faire plein de test différent mais ça ne change rien.
Personne ne trouve?
0
moii51 Messages postés 14 Date d'inscription   Statut Membre Dernière intervention  
 
Voici le code qui ne compile pas:

#include <QApplication>
#include <QPushButton>

int main(int argc, char *argv[])
{
    QApplication app(argc, argv);

    QPushButton hello("Hello world!");
    hello.resize(100, 30);

    hello.show();
    return app.exec();
}
0

Vous n’avez pas trouvé la réponse que vous recherchez ?

Posez votre question
mamiemando Messages postés 33778 Date d'inscription   Statut Modérateur Dernière intervention   7 884
 
Quel est le message d'erruer quand tu compiles ?

Le tutoriel donné ici :
http://doc.trolltech.com/3.3/tutorial1-01.html
donne le code suivant :
/****************************************************************
**
** Qt tutorial 1
**
****************************************************************/

#include <qapplication.h>
#include <qpushbutton.h>


int main( int argc, char **argv )
{
    QApplication a( argc, argv );

    QPushButton hello( "Hello world!", 0 );
    hello.resize( 100, 30 );

    a.setMainWidget( &hello );
    hello.show();
    return a.exec();
}

En particulier il est primordial de respecter les majuscules/minuscules dans les noms de headers et de classe et de mettre le .h, chose que tu n'as pas fait. A noter que sauf exceptions, seuls les headers de la STL ne prennent pas de ".h" au bout.

Bonne chance
0
moii51
 
Voici l'erreur obtenu (avec ton code):

Compilateur: Default compiler
Building Makefile: "D:\Documents and Settings\Propriétaire\Mes documents\programme test C-C++\test qt marche sous dev c++\Makefile.win"
Exécution de  make...
make.exe -f "D:\Documents and Settings\Propriétaire\Mes documents\programme test C-C++\test qt marche sous dev c++\Makefile.win" all
g++.exe -c main.cpp -o main.o -I"C:/Dev-Cpp/lib/gcc/mingw32/3.4.2/include"  -I"C:/Dev-Cpp/include/c++/3.4.2/backward"  -I"C:/Dev-Cpp/include/c++/3.4.2/mingw32"  -I"C:/Dev-Cpp/include/c++/3.4.2"  -I"C:/Dev-Cpp/include"  -O2 -O2 -frtti -fexceptions -Wall -DUNICODE -DQT_LARGEFILE_SUPPORT -DQT_DLL -DQT_NO_DEBUG -DQT_CORE_LIB -DQT_GUI_LIB -DQT_THREAD_SUPPORT -DQT_NEEDS_QMAIN -I"C:\Qt\4.3.0\include\QtGui" -I"C:\Qt\4.3.0\include\QtCore" -I"C:\Qt\4.3.0\include" -I"." -I"C:\Qt\4.3.0\include\ActiveQt" -I"tmp\moc\release_shared" -I"." -I"C:\Qt\4.3.0\mkspecs\win32-g++" 

main.cpp: In function `int qMain(int, char**)':
main.cpp:8: error: 'class QApplication' has no member named 'setMainWidget'

make.exe: *** [main.o] Error 1

Exécution terminée


<b>main.cpp</b>


 #include <qapplication.h>
 #include <qpushbutton.h>    
 int main( int argc, char **argv )
 {    
      QApplication a( argc, argv );      
      QPushButton hello( "Hello world!", 0 );    
      hello.resize( 100, 30 );      
      a.setMainWidget( &hello );    /*************** ERREUR A CETTE LIGNE   ********************/
      hello.show();    
      return a.exec();
 }
 


Merci de ton aide :)
0
mamiemando Messages postés 33778 Date d'inscription   Statut Modérateur Dernière intervention   7 884
 
http://doc.trolltech.com/4.3/qapplication-qt3.html#setMainWidget

La fonction setMainWidget attend un QWidget et apparemment un QPushButton n'en hérite pas... L'exemple ne marche apparemment pour qt4.3 ?
0
moii51
 
Je sais qu'il y a eu beaucoup de modification sur Qt 4 et c'est pour ça que j'ai beaucoup de mal lol..
Merci de ton aide. :)
0
mamiemando Messages postés 33778 Date d'inscription   Statut Modérateur Dernière intervention   7 884
 
Essaye a.setMainWidget(hello); à tout hasard, ça me paraîtrait plus logique que &hello. Car en fait si ca se trouve le QButton hérite bien de QWidget.
0
rom1504
 
0