I am using the Qt add in for visual studio. Now I made a simple push button using Qt designer, and I want to use that push button so that it runs a function with a certain inputparameter when it is pressed, and then displays the result that is printed by the function.
The function that I want to run uses the eigen
library so requires #include <Eigen/Dense>
and should be called as follows:
void coef(Eigen::Matrix<long double, Dynamic, Dynamic> vector, Eigen::Matrix<long double, Dynamic, Dynamic> Matrix)
After I made the push button in Qt designer it automatically already added some code to my header file. Now I adjusted this header file to the following:
#ifndef QTDEMO_H
#define QTDEMO_H
#include <QtWidgets/QMainWindow>
#include "ui_qtdemo.h"
class qtdemo : public QMainWindow
{
Q_OBJECT
public:
qtdemo(QWidget *parent = 0);
~qtdemo();
private:
Ui::qtdemoClass ui;
// begin new code
public slots:
void on_btnHello_clicked() {
ui.btnHello->coef(v, A); // v and A are defined in main.cpp, so not in this header file
}
// end new code
};
#endif // QTDEMO_H
I know this would of course not work because
- the Eigen libary is unknown to this header,
- v and A are unknown to this header
- 3) the function coef() is unknown to this header file.
However, I am unexperienced with using header files, so I don't know what to do to make it work. Could anyone please help? Thanks in advance.