vv
2nd July 2007, 21:18
Hello
I am trying to insert qtimer in my program but in run time when I enter a function
timer does not go into the slot. I want qtimer to work parallel with the other code in my program. Here is the code:
-----------------------------------------
testplug::testplug(QWidget *parent, Qt::WFlags flags)
: QWidget(parent, flags)
{
ui.setupUi(this);
a = 0;
connect(ui.pushButton,SIGNAL(clicked()),this,SLOT( myclick()));
connect(&mytimer,SIGNAL(timeout()),this,SLOT(deneme()));
mytimer.start(1000);
}
void testplug::deneme()
{
printf("Var is = %d\n",a++);
}
void testplug::myclick()
{
::Sleep(3000);
printf("exiting..");
}
---------------------------------
In the above code when it is in the myclick function, timeout occurs but it does not goes into the deneme() function.
What can be the problem ?
Thanks in advance.
I am trying to insert qtimer in my program but in run time when I enter a function
timer does not go into the slot. I want qtimer to work parallel with the other code in my program. Here is the code:
-----------------------------------------
testplug::testplug(QWidget *parent, Qt::WFlags flags)
: QWidget(parent, flags)
{
ui.setupUi(this);
a = 0;
connect(ui.pushButton,SIGNAL(clicked()),this,SLOT( myclick()));
connect(&mytimer,SIGNAL(timeout()),this,SLOT(deneme()));
mytimer.start(1000);
}
void testplug::deneme()
{
printf("Var is = %d\n",a++);
}
void testplug::myclick()
{
::Sleep(3000);
printf("exiting..");
}
---------------------------------
In the above code when it is in the myclick function, timeout occurs but it does not goes into the deneme() function.
What can be the problem ?
Thanks in advance.