def _create_label_widget_in_grid(self, string_label: str, font: QtGui.QFont,
grid: QtWidgets.QGridLayout, row: int, col: int,
alignment: Qt.Alignment) -> None:
label = QtWidgets.QLabel()
label.setText(string_label)
label.setFont(font)
label.setContentsMargins(0,0,0,0)
grid.addWidget(label, row, col, alignment)
def updateUI(self):
theme = self.m_themeComboBox.itemData(
self.m_themeComboBox.currentIndex())
if self.m_charts[0].chart().theme() != theme:
for chartView in self.m_charts:
chartView.chart().setTheme(theme)
pal = self.window().palette()
if theme == QChart.ChartThemeLight:
pal.setColor(QPalette.Window, QColor(0xf0f0f0))
pal.setColor(QPalette.WindowText, QColor(0x404044))
elif theme == QChart.ChartThemeDark:
pal.setColor(QPalette.Window, QColor(0x121218))
pal.setColor(QPalette.WindowText, QColor(0xd6d6d6))
elif theme == QChart.ChartThemeBlueCerulean:
pal.setColor(QPalette.Window, QColor(0x40434a))
pal.setColor(QPalette.WindowText, QColor(0xd6d6d6))
elif theme == QChart.ChartThemeBrownSand:
pal.setColor(QPalette.Window, QColor(0x9e8965))
pal.setColor(QPalette.WindowText, QColor(0x404044))
elif theme == QChart.ChartThemeBlueNcs:
pal.setColor(QPalette.Window, QColor(0x018bba))
pal.setColor(QPalette.WindowText, QColor(0x404044))
elif theme == QChart.ChartThemeHighContrast:
pal.setColor(QPalette.Window, QColor(0xffab03))
pal.setColor(QPalette.WindowText, QColor(0x181818))
elif theme == QChart.ChartThemeBlueIcy:
pal.setColor(QPalette.Window, QColor(0xcee7f0))
pal.setColor(QPalette.WindowText, QColor(0x404044))
else:
pal.setColor(QPalette.Window, QColor(0xf0f0f0))
pal.setColor(QPalette.WindowText, QColor(0x404044))
self.window().setPalette(pal)
checked = self.m_antialiasCheckBox.isChecked()
for chartView in self.m_charts:
chartView.setRenderHint(QPainter.Antialiasing, checked)
options = QChart.AnimationOptions(
self.m_animatedComboBox.itemData(
self.m_animatedComboBox.currentIndex()))
if self.m_charts[0].chart().animationOptions() != options:
for chartView in self.m_charts:
chartView.chart().setAnimationOptions(options)
alignment = self.m_legendComboBox.itemData(
self.m_legendComboBox.currentIndex())
for chartView in self.m_charts:
legend = chartView.chart().legend()
if alignment == 0:
legend.hide()
else:
legend.setAlignment(Qt.Alignment(alignment))
legend.show()