I am trying to apply a stylesheet to a custom stylesheet but cannot get the styling to be applied.
class FooterButtonsWidget(QWidget):
# Footer widget with buttons + icons to other views
def __init__(self):
super().__init__()
self.setObjectName("footerButtonsWidget") # Set obj name to apply CSS stylesheet directly
layout = QHBoxLayout(self)
self.dragon_button = self.create_icon_button("images/spacex_images/dragon-button-icon.png")
self.fh_button = self.create_icon_button("images/spacex_images/fh-button-icon.png")
self.apod_button = self.create_icon_button("images/nasa_images/nasa-button.png")
self.rover_button = self.create_icon_button("images/nasa_images/rover-button-icon.png")
self.spacex_button = self.create_icon_button("images/spacex_images/spacex-button-icon.png")
layout.addWidget(self.dragon_button)
layout.addWidget(self.fh_button)
layout.addWidget(self.apod_button)
layout.addWidget(self.rover_button)
layout.addWidget(self.spacex_button)
self.setMinimumHeight(100)
# Have also tried just #footerButtonsWidget, without the QWidget
self.setStyleSheet("""
QWidget#footerButtonsWidget {
border-top: 2px solid white;
border-right: 2px solid white;
border-left: 2px solid white;
}
""")
I want a border around the footerButtonsWidget
widget, so I can have a border around the whole layout, except the bottom. The image below is what I currently have:
Image of what the footerButtonsWidget looks like
And this is what I want to achieve:
Image of what I want footerButtonsWidget to look like
I was able to apply styling to a widget within footerButtonsWidget
(following this similar question) by doing
self.widget = QWidget(self)
layout.addWidget(self.widget)
self.widget.setStyleSheet("""
QWidget {
border-top: 2px solid white;
}
""")
Which gave the border styling like I wanted, but I need the styling to be applied to the whole widget itself and not the widget elements inside of the footerButtonsWidget