Solved How to set QTextBrowser Alignment in setStyleSheet() ?
-
Change all the text to center like:
ui->textBrowser->setStyleSheet("text-align:center;");
Restore all the text to left:
ui->textBrowser->setStyleSheet("");
-
Hi
The text alignment is part of the html/rich text inserted into the widget
and since each paragraph can have its own alignment ,
i dont think its possible via Style sheet. -
ui->textBrowser->selectAll(); ui->textBrowser->setAlignment(Qt::AlignCenter); ...... ui->textBrowser->selectAll(); ui->textBrowser->setAlignment(Qt::AlignLeft);