1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245
|
/***************************************************************************
* copyright : (C) 2009-2019 by Pascal Brachet *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/
#include "pointdialog.h"
PointDialog::PointDialog(QWidget *parent, QString variables, QString types )
:QDialog( parent)
{
ui.setupUi(this);
setModal(true);
listeVariables=variables.split("#");
listeTypes=types.split("#");
QFont fontCommande=qApp->font();
fontCommande.setBold(true);
QFont fontCommentaire=qApp->font();
//fontCommentaire.setItalic(true);
#if defined(Q_OS_MAC)
fontCommentaire.setPointSize(10);
#else
fontCommentaire.setPointSize(8);
#endif
QListWidgetItem *commande, *commentaire;
for (int i = 0; i < listeVariables.count(); i++)
{
if (listeTypes.at(i)=="LISTE") listeVarListe.append(listeVariables.at(i)+"[]");
else if (listeTypes.at(i)=="NOMBRE") listeVarNombre.append(listeVariables.at(i));
else if (listeTypes.at(i)=="CHAINE") listeVarChaine.append(listeVariables.at(i));
}
//if (listeVarNombre.count()>0) ui.listWidget->addItems(listeVarNombre);
for (int i = 0; i < listeVarNombre.count(); i++)
{
commande=new QListWidgetItem(ui.listWidget);
commande->setFont(fontCommande);
commande->setText(listeVarNombre.at(i));
commentaire=new QListWidgetItem(ui.listWidget);
commentaire->setFont(fontCommentaire);
commentaire->setText(QString::fromUtf8("-> variable du type Nombre"));
commentaire->setFlags(Qt::ItemIsEnabled);
}
//if (listeVarListe.count()>0) ui.listWidget->addItems(listeVarListe);
for (int i = 0; i < listeVarListe.count(); i++)
{
commande=new QListWidgetItem(ui.listWidget);
commande->setFont(fontCommande);
commande->setText(listeVarListe.at(i));
commentaire=new QListWidgetItem(ui.listWidget);
commentaire->setFont(fontCommentaire);
commentaire->setText(QString::fromUtf8("-> variable du type Liste"));
commentaire->setFlags(Qt::ItemIsEnabled);
}
//if (listeVarChaine.count()>0) ui.listWidget->addItems(listeVarChaine);
for (int i = 0; i < listeVarChaine.count(); i++)
{
commande=new QListWidgetItem(ui.listWidget);
commande->setFont(fontCommande);
commande->setText(listeVarChaine.at(i));
commentaire=new QListWidgetItem(ui.listWidget);
commentaire->setFont(fontCommentaire);
commentaire->setText(QString::fromUtf8("-> variable du type Chaine"));
commentaire->setFlags(Qt::ItemIsEnabled);
}
QStringList commandeList,commentaireList,roleList;
commandeList << "sqrt(x)";
commentaireList << QString::fromUtf8("-> racine carrée de x");
roleList << "sqrt()#5";
commandeList << "pow(x,n)";
commentaireList << QString::fromUtf8("-> x puissance n");
roleList << "pow(,)#4";
commandeList << "x%y";
commentaireList << QString::fromUtf8("-> reste de la division de x par y");
roleList << "%#0";
commandeList << "cos(x)";
commentaireList << QString::fromUtf8("-> cosinus de x");
roleList << "cos()#4";
commandeList << "sin(x)";
commentaireList << QString::fromUtf8("-> sinus de x");
roleList << "sin()#4";
commandeList << "tan(x)";
commentaireList << QString::fromUtf8("-> tangente de x");
roleList << "tan()#4";
commandeList << "exp(x)";
commentaireList << QString::fromUtf8("-> exponentielle de x");
roleList << "exp()#4";
commandeList << "log(x)";
commentaireList << QString::fromUtf8("-> logarithme népérien de x");
roleList << "log()#4";
commandeList << "abs(x)";
commentaireList << QString::fromUtf8("-> valeur absolue de x");
roleList << "abs()#4";
commandeList << "floor(x)";
commentaireList << QString::fromUtf8("-> partie entière de x");
roleList << "floor()#6";
commandeList << "round(x)";
commentaireList << QString::fromUtf8("-> entier le plus proche de x");
roleList << "round()#6";
commandeList << "acos(x)";
commentaireList << QString::fromUtf8("-> arccosinus de x");
roleList << "acos()#5";
commandeList << "asin(x)";
commentaireList << QString::fromUtf8("-> arcsinus de x");
roleList << "asin()#5";
commandeList << "atan(x)";
commentaireList << QString::fromUtf8("-> arctangente de x");
roleList << "atan()#5";
commandeList << "Math.PI";
commentaireList << QString::fromUtf8("-> constante PI");
roleList << "Math.PI#7";
commandeList << "random()";
commentaireList << QString::fromUtf8("-> nombre pseudo-aléatoire entre 0 et 1");
roleList << "random()#7";
commandeList << "ALGOBOX_ALEA_ENT(p,n)";
commentaireList << QString::fromUtf8("-> entier pseudo-aléatoire entre p et n");
roleList << "ALGOBOX_ALEA_ENT(,)#17";
commandeList << "ALGOBOX_COEFF_BINOMIAL(n,p)";
commentaireList << QString::fromUtf8("-> coefficient binomial 'p parmi n'");
roleList << "ALGOBOX_COEFF_BINOMIAL(,)#23";
commandeList << "ALGOBOX_LOI_BINOMIALE(n,p,k)";
commentaireList << QString::fromUtf8("-> p(X=k) pour la loi binomiale de paramètres (n,p)");
roleList << "ALGOBOX_LOI_BINOMIALE(,,)#22";
commandeList << "ALGOBOX_LOI_NORMALE_CR(x)";
commentaireList << QString::fromUtf8("-> p(X<x) pour la loi normale centrée réduite");
roleList << "ALGOBOX_LOI_NORMALE_CR()#23";
commandeList << "ALGOBOX_LOI_NORMALE(esp,ecart,x)";
commentaireList << QString::fromUtf8("-> p(X<x) pour la loi normale d'espérance 'esp' et d'écart-type 'ecart'");
roleList << "ALGOBOX_LOI_NORMALE(,,)#20";
commandeList << "ALGOBOX_INVERSE_LOI_NORMALE_CR(p)";
commentaireList << QString::fromUtf8("-> opération inverse de ALGOBOX_LOI_NORMALE_CR(x)");
roleList << "ALGOBOX_INVERSE_LOI_NORMALE_CR()#31";
commandeList << "ALGOBOX_INVERSE_LOI_NORMALE(esp,ecart,p)";
commentaireList << QString::fromUtf8("-> opération inverse de ALGOBOX_LOI_NORMALE(esp,ecart,x)");
roleList << "ALGOBOX_INVERSE_LOI_NORMALE(,,)#28";
commandeList << "ALGOBOX_FACTORIELLE(n)";
commentaireList << QString::fromUtf8("-> factorielle de n");
roleList << "ALGOBOX_FACTORIELLE()#20";
commandeList << "ALGOBOX_SOMME(liste,p,n)";
commentaireList << QString::fromUtf8("-> somme des termes de liste[p] à liste[n]");
roleList << "ALGOBOX_SOMME(,,)#14";
commandeList << "ALGOBOX_MOYENNE(liste,p,n)";
commentaireList << QString::fromUtf8("-> moyenne des termes de liste[p] à liste[n]");
roleList << "ALGOBOX_MOYENNE(,,)#16";
commandeList << "ALGOBOX_VARIANCE(liste,p,n)";
commentaireList << QString::fromUtf8("-> variance des termes de liste[p] à liste[n]");
roleList << "ALGOBOX_VARIANCE(,,)#17";
commandeList << "ALGOBOX_ECART_TYPE(liste,p,n)";
commentaireList << QString::fromUtf8("-> écart-type des termes de liste[p] à liste[n]");
roleList << "ALGOBOX_ECART_TYPE(,,)#19";
commandeList << "ALGOBOX_MEDIANE(liste,p,n)";
commentaireList << QString::fromUtf8("-> médiane des termes de liste[p] à liste[n]");
roleList << "ALGOBOX_MEDIANE(,,)#16";
commandeList << "ALGOBOX_QUARTILE1(liste,p,n)";
commentaireList << QString::fromUtf8("-> Q1 (calculatrice) des termes de liste[p] à liste[n]");
roleList << "ALGOBOX_QUARTILE1(,,)#18";
commandeList << "ALGOBOX_QUARTILE3(liste,p,n)";
commentaireList << QString::fromUtf8("-> Q3 (calculatrice) des termes de liste[p] à liste[n]");
roleList << "ALGOBOX_QUARTILE3(,,)#18";
commandeList << "ALGOBOX_QUARTILE1_BIS(liste,p,n)";
commentaireList << QString::fromUtf8("-> Q1 (25%) des termes de liste[p] à liste[n]");
roleList << "ALGOBOX_QUARTILE1_BIS(,,)#22";
commandeList << "ALGOBOX_QUARTILE3_BIS(liste,p,n)";
commentaireList << QString::fromUtf8("-> Q3 (75%) des termes de liste[p] à liste[n]");
roleList << "ALGOBOX_QUARTILE3_BIS(,,)#22";
commandeList << "ALGOBOX_MINIMUM(liste,p,n)";
commentaireList << QString::fromUtf8("-> minimum des termes de liste[p] à liste[n]");
roleList << "ALGOBOX_MINIMUM(,,)#16";
commandeList << "ALGOBOX_MAXIMUM(liste,p,n)";
commentaireList << QString::fromUtf8("-> maximum des termes de liste[p] à liste[n]");
roleList << "ALGOBOX_MAXIMUM(,,)#16";
commandeList << "ALGOBOX_POS_MINIMUM(liste,p,n)";
commentaireList << QString::fromUtf8("-> rang du minimum des termes de liste[p] à liste[n]");
roleList << "ALGOBOX_POS_MINIMUM(,,)#20";
commandeList << "ALGOBOX_POS_MAXIMUM(liste,p,n)";
commentaireList << QString::fromUtf8("-> rang du maximum des termes de liste[p] à liste[n]");
roleList << "ALGOBOX_POS_MAXIMUM(,,)#20";
commandeList << "ALGOBOX_ARRONDIR(x,n)";
commentaireList << QString::fromUtf8("-> arrondit x avec n chiffres après la virgule");
roleList << "ALGOBOX_ARRONDIR(,)#17";
for (int i = 0; i < commandeList.count(); i++)
{
commande=new QListWidgetItem(ui.listWidgetOp);
commande->setFont(fontCommande);
commande->setText(commandeList.at(i));
commande->setData(Qt::UserRole,roleList.at(i));
commentaire=new QListWidgetItem(ui.listWidgetOp);
commentaire->setFont(fontCommentaire);
commentaire->setText(commentaireList.at(i));
commentaire->setFlags(Qt::ItemIsEnabled);
}
}
PointDialog::~PointDialog(){
}
|