Results 1 to 6 of 6

Thread: Get typed time from QTimeEdit

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    May 2015
    Posts
    12
    Thanks
    1
    Qt products
    Qt5
    Platforms
    Unix/X11 Windows Android

    Default Get typed time from QTimeEdit

    Hi,
    I am developing an adnroid app which can calculate the time in other time zones.
    For displaying the time I am useing the QTimeEdit element.
    Now I want to that the user also can type in a time.
    But I don't get it to work that it get's the typed time.

    I tried it like that:

    Qt Code:
    1. void WeltZeit::on_ENtimeEdit_timeChanged(const QTime &time)
    2. {
    3. QTime enTime = ui->ENtimeEdit->time();
    4. enTime.addSecs(3600); //adds an hour
    5. ui->DEtimeEdit->setTime(enTime);
    6. }
    To copy to clipboard, switch view to plain text mode 

  2. #2
    Join Date
    Mar 2008
    Location
    Kraków, Poland
    Posts
    1,536
    Thanked 284 Times in 279 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Get typed time from QTimeEdit

    Line 3 and 4 should be :
    Qt Code:
    1. QTime enTime = ui->ENtimeEdit->time().addSecs(3600); //adds an hour
    To copy to clipboard, switch view to plain text mode 
    addSecs() does not modify the source object only returns new object.

Similar Threads

  1. QTimeEdit : displayformat
    By snakerst in forum Qt Programming
    Replies: 0
    Last Post: 3rd March 2010, 14:11
  2. QTimeEdit maximum time to 24h (24:00:00)
    By doijunior in forum Qt Programming
    Replies: 3
    Last Post: 26th February 2010, 11:50
  3. Qt designer Vs Typed code
    By URPradhan in forum Newbie
    Replies: 1
    Last Post: 22nd January 2010, 11:02
  4. Replies: 1
    Last Post: 15th April 2009, 09:00
  5. QtimeEdit
    By mickey in forum Qt Programming
    Replies: 4
    Last Post: 11th July 2006, 18:04

Tags for this Thread

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.