How to Change the background color of QTextEdit,
but it does nothing;Code:QColor = QColorDialog:: getColor (Qt:: white, this); feild () -> setHtml ( "<html> <body bgcolor= \" #QColor \"> <body> <html>");
How to Change the background color of QTextEdit,
but it does nothing;Code:QColor = QColorDialog:: getColor (Qt:: white, this); feild () -> setHtml ( "<html> <body bgcolor= \" #QColor \"> <body> <html>");
You must change the QPalette your textedit and save the color you want in Base or White, or use a stylesheet (see doc) Function setPaper() is not for setting the background color, rather for setting a brush that will draw a complex background (something more complex than a single color).
Code:QColor = QColorDialog:: getColor (Qt:: white, this); QTextEdit * Texte = new QTextEdit (this); Texte -> setText (Active () -> toPlainText ()); TextFormatting QString = QString:: fromLatin1 ( "<html> <body %1 bgcolor =>% 2 <body> <html>"). Arg (QColor. Name ()). Arg (Texte -> toPlainText ()); Active () -> setHtml (TextFormatting);
Code:setBackgroundRole(QPalette::ColorRole role) in QWidget> For a red background ...Code:setStyleSheet ( "background-color: red;")
Bookmarks