2

I am trying to insert an background image to central widget.

My way: Right click on 'centralwidget' -> Change styleSheet -> "background-image: url(:/Resources/bg4.jpg);"

BUT it is applied on each children of central widget.

What the solution of this problem? (I am don't want to do it via code - only via QT designer)

Thank you for your attention!

Matan Marciano
  • 333
  • 4
  • 13

1 Answers1

4

You can use the ID-selector of Qt stylesheets to apply the stylesheet just to this instance with this id (object name).

QWidget#centralwidget
{
    background-image: url(:/Resources/bg4.jpg);
}

With this, you should give your central widget the id/objectname "centralwidget".

You can read more about the Qt Stylesheet syntax here.

Christian G
  • 943
  • 9
  • 16