PDA

View Full Version : How to fill the blocks of the Grid one by one?



merry
6th June 2007, 13:01
Hi all

Working on Qt4.2 on my Intel MAC.

I had made a grid of 16x16 on a widget,in which there are 256 blocks,
I also used a QPushButton with this.

Now what I wanted to do is this when I click on the button , the first block of the grid should be filled with the colour ,

when I again clicked on the button the second block of the grid should be filled with the colour, and so on;

i.e on every click of the button the blocks of the grid should be filled with the colour.

If anybody understand my problem then Pls Help

Thanx

high_flyer
6th June 2007, 13:20
I had made a grid of 16x16 on a widget,in which there are 256 blocks,
I also used a QPushButton with this.
What do you mean with "grid", a grid layout?
you mean you have 256 buttons in agrid layou on a widget?


If anybody understand my problem then Pls Help
You didn't explain what the problem is, only what you want to do.

If the problem is that you don't know how to do it then:
create a member variable to store the current block number.
Create a slot, and connected it to the clicked() signal of the button.
In the slot, fill the current block with color, and increment the block number.
Done.:)