MCPcopy Index your code
hub / github.com/PyQt5/PyQt / __init__

Method __init__

QtChart/ChartThemes.py:60–120  ·  view source on GitHub ↗
(self, parent=None)

Source from the content-addressed store, hash-verified

58class ThemeWidget(QWidget):
59
60 def __init__(self, parent=None):
61 super(ThemeWidget, self).__init__(parent)
62
63 self.m_charts = []
64 self.m_listCount = 3
65 self.m_valueMax = 10
66 self.m_valueCount = 7
67 self.m_dataTable = self.generateRandomData(self.m_listCount,
68 self.m_valueMax, self.m_valueCount)
69 self.m_themeComboBox = self.createThemeBox()
70 self.m_antialiasCheckBox = QCheckBox("Anti-aliasing")
71 self.m_animatedComboBox = self.createAnimationBox()
72 self.m_legendComboBox = self.createLegendBox()
73
74 self.connectSignals()
75
76 # Create the layout.
77 baseLayout = QGridLayout()
78 settingsLayout = QHBoxLayout()
79 settingsLayout.addWidget(QLabel("Theme:"))
80 settingsLayout.addWidget(self.m_themeComboBox)
81 settingsLayout.addWidget(QLabel("Animation:"))
82 settingsLayout.addWidget(self.m_animatedComboBox)
83 settingsLayout.addWidget(QLabel("Legend:"))
84 settingsLayout.addWidget(self.m_legendComboBox)
85 settingsLayout.addWidget(self.m_antialiasCheckBox)
86 settingsLayout.addStretch()
87 baseLayout.addLayout(settingsLayout, 0, 0, 1, 3)
88
89 # Create the charts.
90 chartView = QChartView(self.createAreaChart())
91 baseLayout.addWidget(chartView, 1, 0)
92 self.m_charts.append(chartView)
93
94 chartView = QChartView(self.createBarChart(self.m_valueCount))
95 baseLayout.addWidget(chartView, 1, 1)
96 self.m_charts.append(chartView)
97
98 chartView = QChartView(self.createLineChart())
99 baseLayout.addWidget(chartView, 1, 2)
100 self.m_charts.append(chartView)
101
102 chartView = QChartView(self.createPieChart())
103 # Funny things happen if the pie slice labels no not fit the screen...
104 chartView.setSizePolicy(QSizePolicy.Ignored, QSizePolicy.Ignored)
105 baseLayout.addWidget(chartView, 2, 0)
106 self.m_charts.append(chartView)
107
108 chartView = QChartView(self.createSplineChart())
109 baseLayout.addWidget(chartView, 2, 1)
110 self.m_charts.append(chartView)
111
112 chartView = QChartView(self.createScatterChart())
113 baseLayout.addWidget(chartView, 2, 2)
114 self.m_charts.append(chartView)
115
116 self.setLayout(baseLayout)
117

Callers

nothing calls this directly

Calls 13

generateRandomDataMethod · 0.95
createThemeBoxMethod · 0.95
createAnimationBoxMethod · 0.95
createLegendBoxMethod · 0.95
connectSignalsMethod · 0.95
createAreaChartMethod · 0.95
createBarChartMethod · 0.95
createLineChartMethod · 0.95
createPieChartMethod · 0.95
createSplineChartMethod · 0.95
createScatterChartMethod · 0.95
updateUIMethod · 0.95

Tested by

no test coverage detected