Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. [SOLVED]QTime::currentTime() Error
Forum Updated to NodeBB v4.3 + New Features

[SOLVED]QTime::currentTime() Error

Scheduled Pinned Locked Moved General and Desktop
3 Posts 2 Posters 1.5k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    saeedhardan
    wrote on 30 Dec 2014, 16:48 last edited by
    #1

    Hi,
    Im trying to get the current time using the function above , but i get the error :

    [quote]
    C:\Qt\Qt5.3.1\5.3\msvc2013\include\QtCore\qdatetime.h:122: error: C2589: '(' : illegal token on right side of '::'
    [/quote]

    My code is :
    @
    QString time = QTime::currentTime().toString("hh:mm:ss");
    ui->console_textEdit->append(time+": ");
    @

    I tried Also :
    @
    QString time = QTime::currentTime().toString();
    ui->console_textEdit->append(time+": ");
    @

    I also included : <QTime>

    What could be the problem ?

    1 Reply Last reply
    0
    • C Offline
      C Offline
      Chris Kawa
      Lifetime Qt Champion
      wrote on 30 Dec 2014, 17:27 last edited by
      #2

      Sounds like "this one":http://qt-project.org/forums/viewthread/22133

      Do you happen to include windows.h or any other windows headers?

      1 Reply Last reply
      0
      • S Offline
        S Offline
        saeedhardan
        wrote on 30 Dec 2014, 17:33 last edited by
        #3

        Thanks yeah that worked .

        1 Reply Last reply
        0

        1/3

        30 Dec 2014, 16:48

        • Login

        • Login or register to search.
        1 out of 3
        • First post
          1/3
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • Users
        • Groups
        • Search
        • Get Qt Extensions
        • Unsolved