Tutorial Page Five
In this project we will make a self playing animation was well as play and stop
buttons with some simple utilization of the Qt drawing tools.
Hopefully you're coming from the previous demo, if it bored you and you came
here you can pull up from that last from you QtEZ distribution in the
demos/tutorial/ directory.
Anyway, assuming you're coming from the last demo, we'll continue. Go ahead
and move all the widgets we currently have up to the top left corner. Do this
by holding down shift and clicking on all the widgets (you may have to middle
click on the frames so you can select them, and then move to the back). Then
drag them all up to the top left corner. Now move the stop button over so it's
closer to the play button. We do this to make room for another button, so from
the ToolBar. Then line the new button up horizontally with the others, but
to the right of the stop button. On this go ahead and give some unique colours
and set the caption to "&Quit". Make the toplevel widget (project1) quite a bit
taller, and then as you did before select all three buttons, and drag them down.
Then inbetween the label(s) and the button(s) create a slider, from the toolbar.
Also put an lcd number below the buttons. Now size them both so they fit into
the space as apropriatly, and set attributes in them as you have before to
you liking. Now we have to add a few members to project1,
since you know how to do this, create the following slots:
    void endProgram()
    void gotoFrame(int x)
Then go into the main header (from the
Globals Editor) and add
"#include ". Now go into the slot endProgram(), and enter:
    exit(1);
Then go into gotoFrame(int x) and enter:
    frame = x;
    lcd1->display(x);
    label[frame]->raise();
Now go into showNext() and append:
    lcd1->display(frame);
    slide1->setValue(frame);
What you have done is integrated a display so you can tell what frame you're
on, and a slider so you can drag between frames, or go directly to a frame.
You are done with writing source code now, your final step is to make the
signal to slot connections. Pull up the
Signal/Slot Editor. Then pull the slider1 into the signal combobox, and
click on the valueChanged(int) signal. Now select project1 in the slot combobox
and you'll notice only our new slot is compatible (signified with a white
check box) connect this signal to the compatible slot. Then you have complete
this set of tutorial! Select "run | run" from the
MenuBar.
Project Screen Shot |
Next | Previous |
Contents