This commit is contained in:
maicss 2016-10-09 15:36:17 +08:00
commit 96a62dab49

View File

@ -155,7 +155,7 @@ if __name__ == '__main__':
ex = Example() ex = Example()
sys.exit(app.exec_()) sys.exit(app.exec_())
``` ```
In our example, we have a QSlider and a custom widget. A slider controls the custom widget. This widget shows graphically the total capacity of a medium and the free space available to us. The minimum value of our custom widget is 1, the maximum is 750. If we reach value 700, we begin drawing in red colour. This normally indicates overburning. 本例中,我们使用了`QSlider`和一个自定义组件。 and a custom widget. A slider controls the custom widget. This widget shows graphically the total capacity of a medium and the free space available to us. The minimum value of our custom widget is 1, the maximum is 750. If we reach value 700, we begin drawing in red colour. This normally indicates overburning.
The burning widget is placed at the bottom of the window. This is achieved using one QHBoxLayout and one QVBoxLayout. The burning widget is placed at the bottom of the window. This is achieved using one QHBoxLayout and one QVBoxLayout.
``` ```
@ -202,5 +202,4 @@ def changeValue(self, value):
``` ```
When we move the slider, the changeValue() method is called. Inside the method, we send a custom updateBW signal with a parameter. The parameter is the current value of the slider. The value is later used to calculate the capacity of the Burning widget to be drawn. The custom widget is then repainted. When we move the slider, the changeValue() method is called. Inside the method, we send a custom updateBW signal with a parameter. The parameter is the current value of the slider. The value is later used to calculate the capacity of the Burning widget to be drawn. The custom widget is then repainted.
The burning widget ![burning widget](./image/10-burning.png)
Figure: The burning widget