Clicking on QPushButton causes force close
-
Everytime I click on my Push Button it stays clicked and the application crashes. I added it with the ui designer.
This is the header of the class that uses the ui:
@#ifndef DARLEHENSRECHNER_H
#define DARLEHENSRECHNER_H#include <QMainWindow>
#include "Darlehensgeber.h"namespace Ui {
class Darlehensrechner;
}class Darlehensrechner : public QMainWindow
{
Q_OBJECTpublic: explicit Darlehensrechner(QWidget *parent = 0); ~Darlehensrechner();
private slots:
void on_berechnenButton_clicked();private:
Ui::Darlehensrechner *ui;
Darlehensgeber dg;
};#endif // DARLEHENSRECHNER_H
@And this is the cpp:
@#include "darlehensrechner.h"
#include "ui_darlehensrechner.h"Darlehensrechner::Darlehensrechner(QWidget *parent) :
QMainWindow(parent),
ui(new Ui::Darlehensrechner),
dg()
{
ui->setupUi(this);
}Darlehensrechner::~Darlehensrechner()
{
delete ui;
}void Darlehensrechner::on_berechnenButton_clicked()
{
dg.takeLoan(ui->kreditEdit->text().toFloat(),
ui->ratenEdit->text().toFloat(),
ui->zinsEdit->text().toFloat());ui->dauerLabel_2->setText(QString::number(dg.getAmountOfInstallments())); ui->betragLabel_2->setText(QString::number(dg.getAmount()));
}
@ -
The code looks good. Most probably a issue in your Darlehensgeber implementation.
Infinite loop, etc. ? -
Yes, was an infinite loop, thanks.