Good Morning d_stranz! First excuse me to bother u whith my poor nknowledge in english.I get a similar problem: My Qt program crashe whithout the warning or error of the compiler after running perfectly in Qt creator.My program consist of ask names of five students using a QInputDialgue and try to put those names in a vertical alignment in a window, using a QFormLayout of QLabel and QDoubleSpinBox.This is the code :
#include <QObject>
#include <QApplication>
#include <QWidget>
#include <QBoxLayout>
#include <QDoubleSpinBox>
#include <QLabel>
#include <QInputDialog>
#include <QString>
#include <QFormLayout>
#include <QHBoxLayout>
#include <QVector>
#include <QVBoxLayout>
int main(int argc, char *argv[])
{
QVector<QFormLayout*> layout(5);
QVector<QDoubleSpinBox*> note(5);
QVector<QString> liste(5);
bool ok(false);
int i(0);
if(ok&&!eleve.isEmpty()){liste[i]=eleve;}
else {i--;}}
for(i=0;i<5;i++){(layout.at(i))->addRow(liste.at(i),note.at(i));}for(i=0;i<5;i++){vlayout->addLayout(layout.at(i));}
fenetre.setLayout(vlayout);
fenetre.show();
return app.exec();
}
#include <QObject>
#include <QApplication>
#include <QWidget>
#include <QBoxLayout>
#include <QDoubleSpinBox>
#include <QLabel>
#include <QInputDialog>
#include <QString>
#include <QFormLayout>
#include <QHBoxLayout>
#include <QVector>
#include <QVBoxLayout>
int main(int argc, char *argv[])
{
QApplication app(argc, argv);
QWidget fenetre;
QVector<QFormLayout*> layout(5);
QVector<QDoubleSpinBox*> note(5);
QVector<QString> liste(5);
QVBoxLayout *vlayout=new QVBoxLayout;
QString eleve;
bool ok(false);
int i(0);
for(i=0;i<5;i++){eleve=QInputDialog::getText(&fenetre,
"Question","Saisissez le nom de l'eleve",QLineEdit::Normal,QString(),&ok);
if(ok&&!eleve.isEmpty()){liste[i]=eleve;}
else {i--;}}
for(i=0;i<5;i++){(layout.at(i))->addRow(liste.at(i),note.at(i));}for(i=0;i<5;i++){vlayout->addLayout(layout.at(i));}
fenetre.setLayout(vlayout);
fenetre.show();
return app.exec();
}
To copy to clipboard, switch view to plain text mode
This is the message displayed after i've put all names required by the QInputDialogue:
Démarrage de C:\Users\yayah\Documents\build-TEST-Desktop_Qt_5_6_2_MinGW_32bit-Debug\debug\TEST.exe...
Le programme s'est terminé subitement.
C:\Users\yayah\Documents\build-TEST-Desktop_Qt_5_6_2_MinGW_32bit-Debug\debug\TEST.exe crashed.
Démarrage de C:\Users\yayah\Documents\build-TEST-Desktop_Qt_5_6_2_MinGW_32bit-Debug\debug\TEST.exe...
Le programme s'est terminé subitement.
C:\Users\yayah\Documents\build-TEST-Desktop_Qt_5_6_2_MinGW_32bit-Debug\debug\TEST.exe crashed.
To copy to clipboard, switch view to plain text mode
Please help me!!!!!
Bookmarks