Results 1 to 5 of 5

Thread: QtimeEdit

  1. #1
    Join Date
    Jan 2006
    Posts
    976
    Thanks
    53
    Qt products
    Qt3
    Platforms
    Windows

    Default QtimeEdit

    HI, I put a QTimeEdit on app from deisgner; now I need to set its values:
    Qt Code:
    1. timeEdit->setSecond(4);
    To copy to clipboard, switch view to plain text mode 
    but an error incoming. Why?? thanks
    Qt Code:
    1. mymainform.cpp(262): error C2027: use of undefined type 'QTimeEdit'
    2. mymainform.cpp(262): error C2227: left of '->setSecond' must point to class/struct/union
    To copy to clipboard, switch view to plain text mode 
    Regards

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    5,372
    Thanks
    28
    Thanked 976 Times in 912 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QtimeEdit

    Do you have #include <qdatetimeedit.h> at the beginning of mainform.cpp file?

  3. #3
    Join Date
    Jan 2006
    Posts
    976
    Thanks
    53
    Qt products
    Qt3
    Platforms
    Windows

    Default Re: QtimeEdit

    no I don't. Doing a wrong I tried with qdatetime; but now:
    Qt Code:
    1. mymainform.cpp(261): error C2248: 'QTimeEdit::setSecond' : cannot access protected member declared in class 'QTimeEdit'
    To copy to clipboard, switch view to plain text mode 
    How jump this?
    Regards

  4. #4
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    6,264
    Thanks
    36
    Thanked 1,519 Times in 1,389 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Symbian S60 Maemo/MeeGo

    Default Re: QtimeEdit

    As the error states, you will have to subclass QTimeEdit in order to be able to call it's protected methods.
    J-P Nurmi

  5. #5
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    5,372
    Thanks
    28
    Thanked 976 Times in 912 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QtimeEdit

    Just set a new time:
    Qt Code:
    1. QTime time( timeEdit->time() );
    2. time.setHMS( time.hour(), time.minute(), 4 );
    3. timeEdit->setTime( time );
    To copy to clipboard, switch view to plain text mode 

  6. The following user says thank you to jacek for this useful post:

    mickey (11th July 2006)

Similar Threads

  1. There is QTimeEdit another thing in Qt4
    By Krishnacins in forum Qt Programming
    Replies: 1
    Last Post: 26th May 2006, 16:06
  2. How to make QTimeEdit Box readable only
    By Krishnacins in forum Qt Programming
    Replies: 3
    Last Post: 6th March 2006, 08:10

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.