I am not sure whether this works properly but here is what came to my mind. I assume Grid is a widget since you didn't furnish these details.
{
Q_OBJECT
public:
{
curRow = 0;
curCol = 0;
timer.setSingleShot(true);
connect(timer,SIGNAL(timeout()),this,SLOT(fillGrid()));
}
public slots:
// This slot connected to push button's clicked signal
void fillGrids()
{
timer.start(100);
}
void fillGrid()
{
grid[curRow][curCol].fill(); // This is just pseudo code
curRow++,curCol++;
if(curRow >= MAX_ROWS || curCol >= MAX_COLS)
return;
timer.start(100);
}
...
}
class Grid : public QWidget
{
Q_OBJECT
public:
Grid(QWidget *par) : QWidget(par)
{
curRow = 0;
curCol = 0;
timer = new QTimer(this);
timer.setSingleShot(true);
connect(timer,SIGNAL(timeout()),this,SLOT(fillGrid()));
}
public slots:
// This slot connected to push button's clicked signal
void fillGrids()
{
timer.start(100);
}
void fillGrid()
{
grid[curRow][curCol].fill(); // This is just pseudo code
curRow++,curCol++;
if(curRow >= MAX_ROWS || curCol >= MAX_COLS)
return;
timer.start(100);
}
...
}
To copy to clipboard, switch view to plain text mode
I may be wrong since I cant test this at the moment. Please do correct me if anything is wrong.
Bookmarks