PDA

View Full Version : QtimeEdit



mickey
11th July 2006, 16:54
HI, I put a QTimeEdit on app from deisgner; now I need to set its values:


timeEdit->setSecond(4);

but an error incoming. Why?? thanks


mymainform.cpp(262): error C2027: use of undefined type 'QTimeEdit'
mymainform.cpp(262): error C2227: left of '->setSecond' must point to class/struct/union

jacek
11th July 2006, 16:59
Do you have #include <qdatetimeedit.h> at the beginning of mainform.cpp file?

mickey
11th July 2006, 18:52
no I don't. Doing a wrong I tried with qdatetime; but now:


mymainform.cpp(261): error C2248: 'QTimeEdit::setSecond' : cannot access protected member declared in class 'QTimeEdit'

How jump this?

jpn
11th July 2006, 18:57
As the error states, you will have to subclass QTimeEdit in order to be able to call it's protected methods.

jacek
11th July 2006, 19:04
Just set a new time:
QTime time( timeEdit->time() );
time.setHMS( time.hour(), time.minute(), 4 );
timeEdit->setTime( time );