00001 #ifndef COMPLETER_H 00002 #define COMPLETER_H 00003 00011 #include <QCompleter> 00012 #include <QKeyEvent> 00013 #include <QStringList> 00014 #include <QFile> 00015 00016 #include "erreur.h" 00017 00018 class QAbstractItemModel; 00019 class QComboBox; 00020 class QCompleter; 00021 class QLabel; 00022 class QLineEdit; 00023 class QProgressBar; 00024 class QTextEdit; 00025 00026 using namespace std; 00027 00028 class Editeur; 00029 00042 class Completer : public virtual QCompleter 00043 { 00044 Q_OBJECT 00045 00046 private: 00047 00048 Erreur erreur; 00050 Editeur * parent; 00051 QStringList words; 00052 QString chemin_fichier_variables; 00053 QString ancien_mot; 00055 int nb_lettre; 00056 bool completer_actif; 00061 void majListeVariables(); 00062 00068 QAbstractItemModel *modelFromFile(); 00069 00070 public slots : 00071 00076 void insertCompletion(const QString &completion); 00077 00078 public : 00079 00083 QStringList getWords() const; 00084 00092 Completer(Editeur* parent); 00093 00099 ~Completer(); 00100 00104 void mettreAJourListe(); 00105 00111 void verifVariable(); 00112 00120 void activeComplete(QKeyEvent *e); 00121 00127 QString textUnderCursor() const; 00128 00134 void setListeDeCompletion(QStringList nouvelle_liste); 00135 00143 void setAncienMot(QString mot); 00144 00150 void setNbLettre(int nb); 00151 00157 void setActif(bool actif); 00158 00166 void ajouteListeCompletion(QStringList liste_ajout); 00167 00175 void ajouteMotCompletion(QString mot_ajout); 00176 00184 void ajouteVariable(QString var_ajout); 00185 00186 }; 00187 00188 #endif 00189