Qt6 topics merged with General

[PYTHON 3.8] How to set image background like this in Qt?

  • Background image example how I want it to look

    Example: alt text

    How I have: alt text
    I use QLabel with pixmap where image is chosen from Resource.qrc file.

    • take the QLabel with the pixmap, that you already have.
    • create a new Layout
    • set the layout to the label myLabel->setLayout(myLayout);
    • add all the other widgets you want, Labels, EditBoxes... to that layout

  • Setting label picture to formLayout didn't work out for me or I'm doing something wrong?

    self.amdlabel = self.window.findChild(QLabel, "labelAMD")
    self.formlayout = self.window.findChild(QFormLayout, "formLayout")

    labelAMD = alt text
    formLayout = alt text

  • Solved.
    Right-click the label and click the "send-to-back" option.

Log in to reply