Search code examples
c++qtqplaintextedit

How to add a myOwn-background image to QPlainTextEdit?


For example, if you create a simple plaintextedit, the background is just white. How do I change white background with my own image?


Solution

  • In design edit, you can set the styleSheet in properties of QWidget. In c++ code you can set the background using QSS, for example, setting ‍‍‍‍background-image: URL("path/image.png");:

    myWidget->setStyleSheet("background-image: URL('path/image.png')");