Results 1 to 2 of 2

Thread: How to fill the blocks of the Grid one by one?

  1. #1
    Join Date
    Jan 2007
    Posts
    326
    Thanks
    42
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    MacOS X

    Default How to fill the blocks of the Grid one by one?

    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
    Always Believe in Urself
    Merry

  2. #2
    Join Date
    Jan 2006
    Location
    Munich, Germany
    Posts
    4,714
    Thanks
    21
    Thanked 418 Times in 411 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: How to fill the blocks of the Grid one by one?

    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.
    ==========================signature=============== ==================
    S.O.L.I.D principles (use them!):
    https://en.wikipedia.org/wiki/SOLID_...iented_design)

    Do you write clean code? - if you are TDD'ing then maybe, if not, your not writing clean code.

  3. The following user says thank you to high_flyer for this useful post:

    merry (6th June 2007)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.