Bonjour,
J'ai un problème avec mon code : celui-ci s'exécute bien mais à la fermeture de mon application, j'ai une fenêtre "Débogueur juste-à-temps Visual Studio" qui se lance.
Mon code :
.h
.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 #ifndef CAESAR_H #define CAESAR_H #include <QtGui> class Caesar : public QWidget { Q_OBJECT public: Caesar(); ~Caesar(); public slots: // private: // Crypt QTextEdit *m_textToCrypt; QTextEdit *m_textCrypted; QPushButton *m_crypt; QSpinBox *m_substitution; // Uncrypt QTextEdit *m_textToUncrypt; QTextEdit *m_textUncrypted; QPushButton *m_uncrypt; }; #endif // CAESAR_H
Quand je teste mon code en commentant, cette erreur se produit si je laisse ces lignes :
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 #include "Caesar.h" Caesar::Caesar() : QWidget() { setWindowTitle( tr( "Caesar cipher" ) ); QWidget *cryptWidget = new QWidget; QLabel *textToCrypt = new QLabel( tr( "Text to crypt :" ) ); m_textToCrypt = new QTextEdit; m_crypt = new QPushButton( tr( "Crypt" ) ); QLabel *textCrypted = new QLabel( tr( "Text crypted :" ) ); m_textCrypted = new QTextEdit; QVBoxLayout *cryptLayout = new QVBoxLayout; cryptLayout->addWidget( textToCrypt ); cryptLayout->addWidget( m_textToCrypt ); cryptLayout->addWidget( m_crypt ); cryptLayout->addWidget( textCrypted ); cryptLayout->addWidget( m_textCrypted ); cryptWidget->setLayout( cryptLayout ); QTabWidget *tabWidget = new QTabWidget(); tabWidget->addTab( cryptWidget, tr( "Crypt" ) ); //tabWidget->addTab( uncryptWidget ); QVBoxLayout *layout = new QVBoxLayout; layout->addWidget( tabWidget ); setLayout( layout ); } Caesar::~Caesar() { // }
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5 QLabel *textToCrypt = new QLabel( tr( "Text to crypt :" ) ); m_textToCrypt = new QTextEdit; m_crypt = new QPushButton( tr( "Crypt" ) ); QLabel *textCrypted = new QLabel( tr( "Text crypted :" ) ); m_textCrypted = new QTextEdit;
Mon widget est dans une subWindow dans un MdiArea d'un QMainWindow.
EDIT :
Avec ce code le problème survient au lancement du programme (immédiatement) :
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 #include "Caesar.h" Caesar::Caesar() : QWidget() { setWindowTitle( tr( "Caesar cipher" ) ); QWidget *cryptWidget = new QWidget; m_substitution = new QSpinBox; // EN PLUS QFormLayout *substitutionCryptLayout = new QFormLayout; // EN PLUS substitutionCryptLayout->addWidget( m_substitution ); // EN PLUS QLabel *textToCrypt = new QLabel( tr( "Text to crypt :" ) ); m_textToCrypt = new QTextEdit; m_crypt = new QPushButton( tr( "Crypt" ) ); QLabel *textCrypted = new QLabel( tr( "Text crypted :" ) ); m_textCrypted = new QTextEdit; QVBoxLayout *cryptLayout = new QVBoxLayout; cryptLayout->addItem( substitutionCryptLayout ); // EN PLUS cryptLayout->addWidget( textToCrypt ); cryptLayout->addWidget( m_textToCrypt ); cryptLayout->addWidget( m_crypt ); cryptLayout->addWidget( textCrypted ); cryptLayout->addWidget( m_textCrypted ); cryptWidget->setLayout( cryptLayout ); QTabWidget *tabWidget = new QTabWidget(); tabWidget->addTab( cryptWidget, tr( "Crypt" ) ); //tabWidget->addTab( uncryptWidget ); QVBoxLayout *layout = new QVBoxLayout; layout->addWidget( tabWidget ); setLayout( layout ); } Caesar::~Caesar() { // }
Pourquoi y a-t-il ce problème ?
Merci d'avance
Partager