I'm getting a compile error when trying to use a method defined as having and option argument. The error message is this:
error: no matching function for call to 'ConsoleWidget::logInfo(const char [32])'consoleWidget->logInfo("This is logging an info message");
Below are my files.
(header) .h
#ifndef CONSOLEWIDGET_H
#define CONSOLEWIDGET_H
#include <QTextEdit>
#include <QAction>
#include <QColor>
class ConsoleWidget : public QTextEdit
{
Q_OBJECT
public:
explicit ConsoleWidget(QWidget *parent = nullptr);
public slots:
void logInfo(const QString& text, const bool includeTimestamp /*=false*/);
};
#endif // CONSOLEWIDGET_H
cpp (.cpp)
void ConsoleWidget::logInfo(const QString &text, bool includeTimestamp = false)
{
...
}
(main) .cpp
auto *consoleWidget = new ConsoleWidget(this);
consoleWidget->logInfo("This is logging a message!");