align to right
-
Can somebody PLEASE suggest how to align the "appendPlainText " text to the right ?
if(m_TAB_Connect) { // pass to debug window text = "Serial port "; text += m_currentSettings.name; m_TAB_Connect->ui->plainTextEdit->appendPlainText(text); text = "Baud rate "; text += QString::number(m_currentSettings.baudRate); m_TAB_Connect->ui->plainTextEdit->appendPlainText(text); text = "Data bits "; text += QString::number(m_currentSettings.baudRate); m_TAB_Connect->ui->plainTextEdit->appendPlainText(text); text = "Parity "; text += QString::number(m_currentSettings.baudRate); m_TAB_Connect->ui->plainTextEdit->appendPlainText(text); text = "Stop bits "; text += m_ui->parityBox->currentText(); m_TAB_Connect->ui->plainTextEdit->appendPlainText(text); text = "Flow control "; text += m_ui->flowControlBox->currentText(); m_TAB_Connect->ui->plainTextEdit->appendPlainText(text); } else { }
Thank you.
-
@AnneRanch ADDENDUM
I think I found the solution, it needs tweaking...
// BUG runs twice ?? if(m_TAB_Connect) { // pass to debug window text = "Serial port "; int TextLenght = text.size(); text += m_currentSettings.name; m_TAB_Connect->ui->plainTextEdit->appendPlainText(text); int FullTextLenght = text.size(); if( FullTextLenght >TextLenght ) { // BUG process text = " BUG process "; text = "Baud rate "; QString Temp = QString::number(m_currentSettings.baudRate); TODO HERE Temp = Temp.rightJustified(FullTextLenght," ");'' TODO HERE text += Temp; //text += QString::number(m_currentSettings.baudRate); m_TAB_Connect->ui->plainTextEdit->appendPlainText(text); QString s = "apple"; QString t = s.rightJustified(8, '.'); // t == "...apple" }@AnneRanch SOLVED

-
Hi, right-aligning I think does not help so much:
Instead, perhaps you need to split them into 2 columns.@hskoglund Whops,,, wrong description on my part
I need this
Serial port portUSB0
Baud rate align 110align the value (110 ) with (portUSB0) on the right ( so the zeros are in same location - in this example ) , BUT "it" won't let me to type it in aligned...
I thing I need to count the characters , get maximum count and then... what ?
-
You are appending plain text. The word plain implies that it can’t be formatted. See here, how it works. Reading documentation is always good.
-
@hskoglund Whops,,, wrong description on my part
I need this
Serial port portUSB0
Baud rate align 110align the value (110 ) with (portUSB0) on the right ( so the zeros are in same location - in this example ) , BUT "it" won't let me to type it in aligned...
I thing I need to count the characters , get maximum count and then... what ?
@AnneRanch ADDENDUM
I think I found the solution, it needs tweaking...
// BUG runs twice ?? if(m_TAB_Connect) { // pass to debug window text = "Serial port "; int TextLenght = text.size(); text += m_currentSettings.name; m_TAB_Connect->ui->plainTextEdit->appendPlainText(text); int FullTextLenght = text.size(); if( FullTextLenght >TextLenght ) { // BUG process text = " BUG process "; text = "Baud rate "; QString Temp = QString::number(m_currentSettings.baudRate); TODO HERE Temp = Temp.rightJustified(FullTextLenght," ");'' TODO HERE text += Temp; //text += QString::number(m_currentSettings.baudRate); m_TAB_Connect->ui->plainTextEdit->appendPlainText(text); QString s = "apple"; QString t = s.rightJustified(8, '.'); // t == "...apple" } -
@AnneRanch ADDENDUM
I think I found the solution, it needs tweaking...
// BUG runs twice ?? if(m_TAB_Connect) { // pass to debug window text = "Serial port "; int TextLenght = text.size(); text += m_currentSettings.name; m_TAB_Connect->ui->plainTextEdit->appendPlainText(text); int FullTextLenght = text.size(); if( FullTextLenght >TextLenght ) { // BUG process text = " BUG process "; text = "Baud rate "; QString Temp = QString::number(m_currentSettings.baudRate); TODO HERE Temp = Temp.rightJustified(FullTextLenght," ");'' TODO HERE text += Temp; //text += QString::number(m_currentSettings.baudRate); m_TAB_Connect->ui->plainTextEdit->appendPlainText(text); QString s = "apple"; QString t = s.rightJustified(8, '.'); // t == "...apple" }@AnneRanch SOLVED

-
A Anonymous_Banned275 has marked this topic as solved on