Salut tt le monde,mon probleme cest :
jai deuc fenetre dans mon programme Qt,et je veux que lors de faire mes choix,et je clique sur le bouton oui,je veux que ma deuxieme fenetre se ferme et lors que je clique sur no je reste sur le meme fenetre.
voila mon code
Code : Sélectionner tout - Visualiser dans une fenêtre à part
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 // Code .h #ifndef POSTIONWINDOW_H #define POSTIONWINDOW_H #include <QDialog> namespace Ui { class postionwindow; } class postionwindow : public QDialog { Q_OBJECT public: explicit postionwindow(QWidget *parent = 0); ~postionwindow(); private slots: void on_Validation_clicked(); private: Ui::postionwindow *ui; }; #endif // POSTIONWINDOW_Het voila mon main.cpp
Code : Sélectionner tout - Visualiser dans une fenêtre à part
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 // Faichier .cpp #include "postionwindow.h" #include "ui_postionwindow.h" #include<QMessageBox> postionwindow::postionwindow(QWidget *parent) : QDialog(parent), ui(new Ui::postionwindow) { ui->setupUi(this); } postionwindow::~postionwindow() { delete ui; } void postionwindow::on_Validation_clicked() { if(ui->Pos1->isChecked()) QMessageBox::information(this,"Info","Vous avez choisi <strong>la position 1<strong>.",QMessageBox::Yes | QMessageBox::Cancel); if(ui->Pos2->isChecked()) QMessageBox::information(this,"Info","Vous avez choisi <strong>la position 2<strong>.",QMessageBox::Yes | QMessageBox::No); if(ui->Pos3->isChecked()) QMessageBox::information(this,"Info","Vous avez choisi <strong>la position 3<strong>.",QMessageBox::Yes | QMessageBox::No); if(ui->Pos4->isChecked()) QMessageBox::information(this,"Info","Vous avez choisi <strong>la position 4<strong>.",QMessageBox::Yes | QMessageBox::No); if(ui->Pos5->isChecked()) QMessageBox::information(this,"Info","Vous avez choisi <strong>la position 5<strong>.",QMessageBox::Yes | QMessageBox::No); if(ui->Pos6->isChecked()) QMessageBox::information(this,"Info","Vous avez choisi <strong>la position 6<strong>.",QMessageBox::Yes | QMessageBox::No); }
en plus je veux acceder aux resultat des fenetres que jai fermer depuis le fichier cpp de ma fenetre principale, et Merci davance
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22 // main.cpp #include "principalwindow.h" #include <QApplication> #include <QTranslator> #include <QLocale> #include <QLibraryInfo> int main(int argc, char *argv[]) { QApplication a(argc, argv); QString local = QLocale::system().name().section('_', 0, 0); QTranslator translator; translator.load(QString("qt_") + local, QLibraryInfo::location(QLibraryInfo::TranslationsPath)); a.installTranslator(&translator); principalwindow w; w.show(); return a.exec(); }
Partager