8Observer8
20th April 2013, 13:00
Hello!
If I click on Button nothing is occur.
8972
I created the project in NetBeans with this tutorial: https://netbeans.org/kb/docs/cnd/qt-applications.html
Summa.h
/*
* File: Summa.h
* Author: Ivan
*
* Created on April 19, 2013, 6:28 AM
*/
#ifndef SUMMA_H
#define SUMMA_H
class Summa {
public:
Summa(){m_summa = 0;}
double calcSumma(double a, double b){return a+b;}
double getSumma() {return m_summa;}
private:
double m_summa;
};
#endif /* SUMMA_H */
SummaDialog.h
/*
* File: SummaDialog.h
* Author: Ivan
*
* Created on April 19, 2013, 6:03 AM
*/
#ifndef _SUMMADIALOG_H
#define _SUMMADIALOG_H
#include "ui_SummaDialog.h"
class SummaDialog : public QDialog {
Q_OBJECT
public:
SummaDialog();
virtual ~SummaDialog();
public slots:
void showResult(const double& result);
private:
Ui::SummaDialog widget;
};
#endif /* _SUMMADIALOG_H */
SummaDialog.cpp
/*
* File: SummaDialog.cpp
* Author: Ivan
*
* Created on April 19, 2013, 6:03 AM
*/
#include "SummaDialog.h"
SummaDialog::SummaDialog() {
widget.setupUi(this);
connect(widget.pushButton, SIGNAL(clicked(const double&)),
this, SLOT(showResult(const double&)));
}
SummaDialog::~SummaDialog() {
}
void SummaDialog::showResult(const double& result) {
widget.resultEdit->setText(QString::number(result));
}
main.cpp
/*
* File: main.cpp
* Author: Ivan
*
* Created on April 19, 2013, 6:02 AM
*/
#include <QtGui/QApplication>
#include "SummaDialog.h"
#include "Summa.h"
int main(int argc, char *argv[]) {
// initialize resources, if needed
// Q_INIT_RESOURCE(resfile);
QApplication app(argc, argv);
SummaDialog sd;
sd.show();
return app.exec();
}
If I click on Button nothing is occur.
8972
I created the project in NetBeans with this tutorial: https://netbeans.org/kb/docs/cnd/qt-applications.html
Summa.h
/*
* File: Summa.h
* Author: Ivan
*
* Created on April 19, 2013, 6:28 AM
*/
#ifndef SUMMA_H
#define SUMMA_H
class Summa {
public:
Summa(){m_summa = 0;}
double calcSumma(double a, double b){return a+b;}
double getSumma() {return m_summa;}
private:
double m_summa;
};
#endif /* SUMMA_H */
SummaDialog.h
/*
* File: SummaDialog.h
* Author: Ivan
*
* Created on April 19, 2013, 6:03 AM
*/
#ifndef _SUMMADIALOG_H
#define _SUMMADIALOG_H
#include "ui_SummaDialog.h"
class SummaDialog : public QDialog {
Q_OBJECT
public:
SummaDialog();
virtual ~SummaDialog();
public slots:
void showResult(const double& result);
private:
Ui::SummaDialog widget;
};
#endif /* _SUMMADIALOG_H */
SummaDialog.cpp
/*
* File: SummaDialog.cpp
* Author: Ivan
*
* Created on April 19, 2013, 6:03 AM
*/
#include "SummaDialog.h"
SummaDialog::SummaDialog() {
widget.setupUi(this);
connect(widget.pushButton, SIGNAL(clicked(const double&)),
this, SLOT(showResult(const double&)));
}
SummaDialog::~SummaDialog() {
}
void SummaDialog::showResult(const double& result) {
widget.resultEdit->setText(QString::number(result));
}
main.cpp
/*
* File: main.cpp
* Author: Ivan
*
* Created on April 19, 2013, 6:02 AM
*/
#include <QtGui/QApplication>
#include "SummaDialog.h"
#include "Summa.h"
int main(int argc, char *argv[]) {
// initialize resources, if needed
// Q_INIT_RESOURCE(resfile);
QApplication app(argc, argv);
SummaDialog sd;
sd.show();
return app.exec();
}