[Qt-interest] Timer objects conflicting
Yuvaraj R
yuvaraj at ongobiz.com
Tue Aug 11 22:30:22 CEST 2009
Hi All
I have 10 items in list view.. Each widget containing the push button and
label..
when push button is clicked the Timer is running ..suppose if click the
first item push button timer value is display at label..After some times
again i am clicking second push button... this item value also i have to
display..
whenever user clicking the button, new object will be creating for
QTimer..Here my problem is objects are conflicting..
My code is
void Form::get_timer(int id)
{
static int count;
qDebug() << "yuvaraj";
time[count] = new QTimer;
time[count]->start(1000);
QObject::connect(time[count],SIGNAL(timeout()),this,SLOT(run_timer()));
count++;
}
void Form::run_timer()
{
qDebug() << "yuvaraj 1";
QString time_count;
if(b==59 )
{
b=0;
a++;
}
if(a<10 && b<10 )
{
time_count = QString(QString::number(0)+QString::number(a) +
":"+QString::number(0)+QString::number(b));
}
if(a<10 && b >=10)
{
time_count = QString(QString::number(0)+QString::number(a) +
":"+QString::number(b));
}
if(a>=10 && b <10)
{
time_count = QString(QString::number(a) +
":"+QString::number(0)+QString::number(b));
}
if(a>=10 && b>=10)
{
time_count = QString(QString::number(0)+QString::number(a) +
":"+QString::number(b));
}
b++;
emit send_timer(count,time_count);
}
// slot for send_timer signal
void MainWindow:: get_timer(int item,QString str)
{
qDebug() << "yuvaraj" << str << item;
for(int i=0;i<list.size();i++)
{
if(i == list_item_id[item])
{
list.at(i)->m_ui->set_time->setText(str);
}
}
Please help me ,how do avoid the object conflicting
Thanks
Yuvaraj R
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20090812/acdf2970/attachment.html
More information about the Qt-interest-old
mailing list