1
0
Fork 0
mirror of https://github.com/EdgeTX/edgetx.git synced 2025-07-24 00:35:14 +03:00

Ported from master to next:

#1489: TRACE() output intercepted and shown in Companion (shortcut F6)
#1270: simple Trainer Simulator (shortcut F5)
#1466: telemetry simulator (shorcut F5)
This commit is contained in:
Damjan Adamic 2015-01-04 18:57:45 +01:00
parent a2dc0040b0
commit bb921a0a7f
39 changed files with 865 additions and 96 deletions

View file

@ -0,0 +1,45 @@
#include <QtGui>
#include <stdint.h>
#include "debugoutput.h"
#include "ui_debugoutput.h"
DebugOutput::DebugOutput(QWidget * parent):
QDialog(parent),
ui(new Ui::DebugOutput)
{
ui->setupUi(this);
#ifdef __APPLE__
QFont newFont("Courier", 13);
ui->Output->setFont(newFont);
ui->Output->setAttribute(Qt::WA_MacNormalSize);
#endif
#if defined WIN32 || !defined __GNUC__
QFont newFont("Courier", 9);
ui->Output->setFont(newFont);
#endif
}
DebugOutput::~DebugOutput()
{
delete ui;
}
void DebugOutput::traceCallback(const QString & text)
{
// ui->Output->appendPlainText(text);
QTextCursor cursor(ui->Output->textCursor());
// is the scrollbar at the end?
bool atEnd = (ui->Output->verticalScrollBar()->value() == ui->Output->verticalScrollBar()->maximum());
cursor.movePosition(QTextCursor::End, QTextCursor::MoveAnchor, 1);
cursor.insertText(text);
if (atEnd) {
ui->Output->verticalScrollBar()->triggerAction(QAbstractSlider::SliderToMaximum);
}
}