Results 1 to 2 of 2

Thread: QTimer issue

  1. #1
    Join Date
    Mar 2006
    Posts
    26
    Thanks
    6
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default QTimer issue

    Here's my code:

    Qt Code:
    1. double Interval = 0;
    2. int arrValues[256] = {0};
    3.  
    4. *timer = new QTimer(&messager);
    5. connect(timer, SIGNAL(timeout()), &messager, SLOT(GetIt(arrValues)));
    6.  
    7. Interval = 1.0 / (double)ui.cbInterval->currentText.toInt() * 1000 ;
    8. timer->start((int)Interval);
    To copy to clipboard, switch view to plain text mode 

    I keep getting to following error everytime I complie.

    Qt Code:
    1. decksimulator.cpp:738: error: no match for 'operator=' in '*timer = (((QTimer*)operator new(24u)), (<anonymous>->QTimer::QTimer(((QObject*)(((Messager*)((DeckSimulator*)this)) + 652u))), <anonymous>))'
    2. /usr/local/Trolltech/Qt-4.1.1/include/QtCore/qtimer.h:75: note: candidates are: QTimer& QTimer::operator=(const QTimer&)
    3. decksimulator.cpp:741: error: insufficient contextual information to determine type
    To copy to clipboard, switch view to plain text mode 

    Is there something I need to cast? Do I need to inherit something into my messager class.

    HELP PLEASE!

    Rob

  2. #2
    Join Date
    Jan 2006
    Location
    Catalonia
    Posts
    266
    Thanks
    44
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: QTimer issue

    How have you declared the variable "timer"? I think that the sentence
    *timer = new QTimer(&messager);
    should be
    Qt Code:
    1. timer = new QTimer(&messager)
    To copy to clipboard, switch view to plain text mode 
    if you have declared "timer" like this:
    QTimer *timer;

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

    qball2k5 (31st March 2006)

Similar Threads

  1. Replies: 8
    Last Post: 27th March 2013, 11:51
  2. Extending QTimer()
    By rishid in forum Qt Programming
    Replies: 3
    Last Post: 7th August 2009, 01:59
  3. QTimer ->start(0) + OpenGL + resize/move window => crash
    By anthibug in forum Qt Programming
    Replies: 5
    Last Post: 8th July 2008, 11:01
  4. QThread/QObject and QTimer
    By swiety in forum Qt Programming
    Replies: 2
    Last Post: 25th January 2008, 08:37
  5. Replies: 5
    Last Post: 6th March 2007, 05:34

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.