I’m trying to use the default Qfontcombobox in my qt app to change the font of a text edit, and i am getting this error for some reason.
Here is my definition for my mainwindow.cpp
#include "mainwindow.h"
#include "ui_mainwindow.h"
MainWindow::MainWindow(QWidget *parent)
: QMainWindow(parent)
, ui(new Ui::MainWindow)
{
ui->setupUi(this);
connect(ui->fontComboBox,&QFontComboBox::currentFontChanged,this,&MainWindow::fontChanged);
}
void MainWindow::fontChanged(QFont &f) {
ui->textEdit->setFont(f);
}
MainWindow::~MainWindow()
{
delete ui;
}
and here is the code for the mainwindow header
#include <QMainWindow>
#include <QComboBox>
#include <QObject>
QT_BEGIN_NAMESPACE
namespace Ui {
class MainWindow;
}
QT_END_NAMESPACE
class MainWindow : public QMainWindow
{
Q_OBJECT
public:
MainWindow(QWidget *parent = nullptr);
~MainWindow();
public slots:
void fontChanged(QFont &f);
private:
Ui::MainWindow *ui;
};
#endif // MAINWINDOW_H
Thank you