Results 1 to 3 of 3

Thread: about currentTime()

  1. #1
    Join Date
    Dec 2008
    Location
    tokyo Japan
    Posts
    5
    Thanks
    3
    Qt products
    Qt4
    Platforms
    Windows

    Question about currentTime()

    I use TableView.

    How to show currentTime in Label?
    Last edited by tkms; 30th January 2009 at 02:22.

  2. #2
    Join Date
    Oct 2006
    Location
    New Delhi, India
    Posts
    2,467
    Thanks
    8
    Thanked 334 Times in 317 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: about currentTime()

    And where is this Label ?

    If u are using tableview, you must be having your own model. In the model, return current time using QTime::toString() from data method.

  3. #3
    Join Date
    Jan 2006
    Location
    Sta. Eugènia de Berga (Vic - Barcelona - Spain)
    Posts
    869
    Thanks
    70
    Thanked 59 Times in 57 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: about currentTime()

    Hi,

    Qt Code:
    1. QString qCurrentTime = QTime::currentTime().toString(QString("hh:mm:ss"));
    2. myLabelPointer->setText(qCurrentTime );
    To copy to clipboard, switch view to plain text mode 

    Just take a look at QTime methods and functions
    Òscar Llarch i Galán

  4. The following user says thank you to ^NyAw^ for this useful post:

    tkms (2nd February 2009)

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.