Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Clicking on QPushButton causes force close

Clicking on QPushButton causes force close

Scheduled Pinned Locked Moved General and Desktop
3 Posts 2 Posters 766 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • G Offline
    G Offline
    Gravitaytion
    wrote on last edited by
    #1

    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_OBJECT

    public:
        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()));
    

    }
    @

    1 Reply Last reply
    0
    • raven-worxR Offline
      raven-worxR Offline
      raven-worx
      Moderators
      wrote on last edited by
      #2

      The code looks good. Most probably a issue in your Darlehensgeber implementation.
      Infinite loop, etc. ?

      --- SUPPORT REQUESTS VIA CHAT WILL BE IGNORED ---
      If you have a question please use the forum so others can benefit from the solution in the future

      1 Reply Last reply
      0
      • G Offline
        G Offline
        Gravitaytion
        wrote on last edited by
        #3

        Yes, was an infinite loop, thanks.

        1 Reply Last reply
        0

        • Login

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • Users
        • Groups
        • Search
        • Get Qt Extensions
        • Unsolved