本文整理汇总了Python中PyQt5.QtCore.Qt.Alignment方法的典型用法代码示例。如果您正苦于以下问题:Python Qt.Alignment方法的具体用法?Python Qt.Alignment怎么用?Python Qt.Alignment使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PyQt5.QtCore.Qt
的用法示例。
在下文中一共展示了Qt.Alignment方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _create_label_widget_in_grid
# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import Alignment [as 别名]
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)
示例2: updateUI
# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import Alignment [as 别名]
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()