1 year ago
#344617
KiDo
Qt Designer Showing Black Calendar Widget
I'm trying to build an app using Qt Designer for Python, but I'm having a problem where the Calendar appears to be in black color making all the days invisible!
The Calendar is new, I'm simply dragging then dropping it on the Main Window, there's nothing in the styleSheet for the calendar, but I did change the background color for the Main Window by using this styleSheet:
background-color: qlineargradient(spread:pad, x1:0, y1:0, x2:0, y2:1, stop:0 rgba(45, 67, 241, 0.8), stop:1 rgba(172, 247, 255, 0.8));
border-radius:10px;
Removing the styleSheet for the Main Window solves the problem, but I need it as the background colors are required.
Here's the Python code if needed:
class Ui_MainWindow(object):
def setupUi(self, MainWindow):
MainWindow.setObjectName("MainWindow")
MainWindow.setStyleSheet("background-color: qlineargradient(spread:pad, x1:0, y1:0, x2:0, y2:1, stop:0 rgba(45, 67, 241, 0.8), stop:1 rgba(172, 247, 255, 0.8));border-radius:10px;")
MainWindow.showMaximized()
self.centralwidget = QtWidgets.QWidget(MainWindow)
self.centralwidget.setObjectName("centralwidget")
self.wFHWidget = QtWidgets.QWidget(self.centralwidget)
self.wFHWidget.setGeometry(QtCore.QRect(30, 570, 471, 571))
self.wFHWidget.setObjectName("wFHWidget")
self.calendarWidget = QtWidgets.QCalendarWidget(self.wFHWidget)
self.calendarWidget.setGeometry(QtCore.QRect(70, 40, 264, 183))
self.calendarWidget.setObjectName("calendarWidget")
The Widget which the calendar is part of (wFHWidget) also has some styleSheet, but when I removed it, the calendar remained in black so I assumed it's not the cause for the issue. Also, removing the styleSheet from the Main Window while keeping the styleSheet in the wFHWidget returns the calendar to its default view (not black) which is another confirmation that the issue is only with the Main Window styleSheet.
Here's what the Main Window, Widget & Calendar look like at the end:
Here's a short video of the process in case it's needed for further showing the issue: https://photos.app.goo.gl/VZetLUv2WKV8ck46A
sorry for the video's low quality, using work's PC and I don't have a screen recorder installed.
css
python-3.x
qt
pyqt5
designer
0 Answers
Your Answer