Results 1 to 20 of 22

Thread: QObject::startTimer: QTimer cannot have a negative interval

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,368
    Thanks
    3
    Thanked 5,018 Times in 4,794 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: QObject::startTimer: QTimer cannot have a negative interval

    What is the datatype you are using to store your "60000 seconds" value? You are aware that 60000 seconds is not one minute, right? So are we talkig about seconds or miliseconds here? What datatypes are you using for those values?
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  2. #2
    Join Date
    Nov 2014
    Location
    Chennai
    Posts
    160
    Thanks
    65
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: QObject::startTimer: QTimer cannot have a negative interval

    am having one text file inside that
    60000
    10000
    after reading this file i assigned to variables..and pass these variables to timeout ();
    i want to display one images for first images for 60 seconds..and second image for 10 seconds.

  3. #3
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,368
    Thanks
    3
    Thanked 5,018 Times in 4,794 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: QObject::startTimer: QTimer cannot have a negative interval

    Quote Originally Posted by iswaryasenthilkumar View Post
    after reading this file i assigned to variables
    What variables? How did you do it? Show the code.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  4. #4
    Join Date
    Nov 2014
    Location
    Chennai
    Posts
    160
    Thanks
    65
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: QObject::startTimer: QTimer cannot have a negative interval

    code:
    Qt Code:
    1. #define configpath "/digital_images/config"
    2. void Widget::readconfigfile()
    3. {
    4. dir.cd(configpath);
    5. QFile file1;
    6. QString configfile="DI_config.txt";
    7. file1.setFileName(dir.absoluteFilePath(configfile));
    8. file1.open(QIODevice::ReadOnly);
    9. QTextStream stream(&file1);
    10. checkremoteseconds=stream.readLine().toInt();
    11. checklocalseconds=stream.readLine().toInt();
    12. }
    To copy to clipboard, switch view to plain text mode 
    this was my code sir
    Last edited by anda_skoa; 13th February 2015 at 12:22. Reason: missing [code] tags

  5. #5
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,368
    Thanks
    3
    Thanked 5,018 Times in 4,794 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: QObject::startTimer: QTimer cannot have a negative interval

    Is it really that hard to read what I write?

    What is the datatype you are using to store your "60000 seconds" value?
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  6. #6
    Join Date
    Nov 2014
    Location
    Chennai
    Posts
    160
    Thanks
    65
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: QObject::startTimer: QTimer cannot have a negative interval

    sorry sir.
    i used datatype as QString

  7. #7
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,368
    Thanks
    3
    Thanked 5,018 Times in 4,794 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: QObject::startTimer: QTimer cannot have a negative interval

    No, you didn't.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  8. #8
    Join Date
    Mar 2009
    Location
    Brisbane, Australia
    Posts
    7,729
    Thanks
    13
    Thanked 1,610 Times in 1,537 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Wiki edits
    17

    Default Re: QObject::startTimer: QTimer cannot have a negative interval

    Wysota is asking: What is the data type of the variables checkremoteseconds and checklocalseconds?

    Since you don't bother to check if the configuration directory exists, the config file exists in the directory, or the file opens successfully I would add:
    What is the actual value you get in those variables?
    What is the value of those variables when you actually use them?

    Why have you chosen to use QObject::startTimer() instead of QTimer?

  9. #9
    Join Date
    Nov 2014
    Location
    Chennai
    Posts
    160
    Thanks
    65
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: QObject::startTimer: QTimer cannot have a negative interval

    i used qint16 for checkremoteseconds and checklocalseconds
    Quote Originally Posted by ChrisW67 View Post
    Wysota is asking: What is the data type of the variables checkremoteseconds and checklocalseconds?

    Since you don't bother to check if the configuration directory exists, the config file exists in the directory, or the file opens successfully I would add:
    What is the actual value you get in those variables?
    What is the value of those variables when you actually use them?

    Why have you chosen to use QObject::startTimer() instead of QTimer?

  10. #10
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,368
    Thanks
    3
    Thanked 5,018 Times in 4,794 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: QObject::startTimer: QTimer cannot have a negative interval

    The largest value qint16 can hold is 2^15-1 = 32767.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  11. The following user says thank you to wysota for this useful post:

    iswaryasenthilkumar (16th February 2015)

  12. #11
    Join Date
    Nov 2014
    Location
    Chennai
    Posts
    160
    Thanks
    65
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: QObject::startTimer: QTimer cannot have a negative interval

    as yu said i did ..bt still i got same error
    qint32 remoteseconds=60000
    QObject::startTimer: QTimer cannot have a negative interval
    Quote Originally Posted by wysota View Post
    The largest value qint16 can hold is 2^15-1 = 32767.

  13. #12
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,368
    Thanks
    3
    Thanked 5,018 Times in 4,794 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: QObject::startTimer: QTimer cannot have a negative interval

    Quote Originally Posted by iswaryasenthilkumar View Post
    as yu said i did ..bt still i got same error
    qint32 remoteseconds=60000
    QObject::startTimer: QTimer cannot have a negative interval
    Are you sure you are using the same variable and not locally shadowing the member/global variable you have elsewhere?
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


Similar Threads

  1. Replies: 6
    Last Post: 4th September 2014, 09:06
  2. Replies: 3
    Last Post: 27th August 2013, 23:25
  3. Freeze using QTimer with interval 0
    By Alundra in forum Qt Programming
    Replies: 22
    Last Post: 7th August 2013, 14:13
  4. Replies: 15
    Last Post: 4th August 2012, 19:11
  5. QTimer QBasicTimer and QObject::startTimer
    By SABROG in forum Qt Programming
    Replies: 7
    Last Post: 15th June 2009, 17:37

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
  •  
Qt is a trademark of The Qt Company.