Updated printMsg to prevent possible bugs
This commit is contained in:
parent
1533625411
commit
094d7a04b3
@ -40,6 +40,7 @@ MainWindow::MainWindow(QWidget *parent) :
|
|||||||
recentMenu->setTitle("Recent files");
|
recentMenu->setTitle("Recent files");
|
||||||
ui->menuFile->insertMenu(ui->actionSettings, recentMenu);
|
ui->menuFile->insertMenu(ui->actionSettings, recentMenu);
|
||||||
ui->menuFile->insertSeparator(ui->actionSettings);
|
ui->menuFile->insertSeparator(ui->actionSettings);
|
||||||
|
terminalCursor = ui->terminal->textCursor();
|
||||||
|
|
||||||
//Init baudrate combobox
|
//Init baudrate combobox
|
||||||
ui->baudbox->addItem(QString::number(4800));
|
ui->baudbox->addItem(QString::number(4800));
|
||||||
@ -631,14 +632,14 @@ void MainWindow::printMsg(QString text)
|
|||||||
{
|
{
|
||||||
if(supressWait && text.startsWith("wait")) return;
|
if(supressWait && text.startsWith("wait")) return;
|
||||||
//Get the cursor and set it to the end
|
//Get the cursor and set it to the end
|
||||||
QTextCursor cursor = ui->terminal->textCursor();
|
terminalCursor.movePosition(QTextCursor::End);
|
||||||
cursor.movePosition(QTextCursor::End);
|
|
||||||
|
|
||||||
//Paste the text
|
//Paste the text
|
||||||
cursor.insertText(text);
|
terminalCursor.insertText(text);
|
||||||
|
|
||||||
//Apply
|
//Scroll to the bottom
|
||||||
ui->terminal->setTextCursor(cursor);
|
ui->terminal->verticalScrollBar()->setValue(
|
||||||
|
ui->terminal->verticalScrollBar()->maximum());
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::checkStatus()
|
void MainWindow::checkStatus()
|
||||||
|
|||||||
@ -59,6 +59,7 @@ protected:
|
|||||||
QStringList EEPROMSettings;
|
QStringList EEPROMSettings;
|
||||||
QStringList userHistory;
|
QStringList userHistory;
|
||||||
QSerialPortInfo printerinfo;
|
QSerialPortInfo printerinfo;
|
||||||
|
QTextCursor terminalCursor;
|
||||||
|
|
||||||
void closeEvent(QCloseEvent *event);
|
void closeEvent(QCloseEvent *event);
|
||||||
bool eventFilter(QObject *target, QEvent *event);
|
bool eventFilter(QObject *target, QEvent *event);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user