Commit 3816007d authored by Tomaz  Canabrava's avatar Tomaz Canabrava

Enable LogWidget to be used from Designer

For a Widget to be used in designer we need to have a constructor
that takes exactly one argument, the QWidget* parent one.
parent 38451fb0
......@@ -34,9 +34,26 @@ static constexpr QChar _newLine = QChar::fromLatin1('\n');
static constexpr QChar _return = QChar::fromLatin1('\r');
}
LogWidget::LogWidget(QWidget *parent)
: QWidget(parent)
{
logFile = new QTemporaryFile();
initialize();
}
LogWidget::LogWidget(QTemporaryFile *tempFile, QWidget *parent)
: QWidget(parent)
, logFile(tempFile)
{
if (!logFile) {
logFile = new QTemporaryFile();
}
initialize();
}
void LogWidget::initialize()
{
QSize iconSize = QSize(fontMetrics().height(), fontMetrics().height());
auto page = new QWidget(this);
......
......@@ -32,6 +32,7 @@ class ATCOREWIDGETS_EXPORT LogWidget : public QWidget
Q_OBJECT
public:
LogWidget(QTemporaryFile *tempFile, QWidget *parent = nullptr);
LogWidget(QWidget *parent = nullptr);
/**
* @brief Add a message to the log. Should always also be connected to AtCore::atcoreMessage;
......@@ -59,6 +60,8 @@ public:
bool endsWith(const QString &string);
private:
void initialize();
/**
* @brief Return string with actual time
* @return QString
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment