How can I display trme as a string ?
Could someone give me some code to be able to do that ?
I am using a TimeEdit window. So suppose someone edits it. I would like the editted time to show up in a mesage box.
How can I display trme as a string ?
Could someone give me some code to be able to do that ?
I am using a TimeEdit window. So suppose someone edits it. I would like the editted time to show up in a mesage box.
QString str = "time";
sorry couldn't resist.
RTFM
Qt has really good documentation. From within Qt Creator, Click on Help-Index and type QDateTime - that should help you on your way.
Hi
Hers the code for you
Well it does it . It displays 12:00 in a message box.
But it does not display the update time when the user edits the EditTime box.
I triedBut it gave a parameter error on timeChanged .Qt Code:
To copy to clipboard, switch view to plain text mode
I am flumoxed here.
You can't use timeChanged() the way you do.
It's a [signal] and you must connect it to a [slot].
ok. What i need is some way to retrieve the text from QTimeEdit and display it in a messagebox.
A pointer of QTimeEdit in the messagebox![]()
Here is the code:
Qt Code:
void calendartime:: display_message() { QMessageBox msgbox; QTimeEdit *timeEdit; msgbox.setText(timeInString) ; msgbox.exec(); }To copy to clipboard, switch view to plain text mode
I get the following error:
calendartime.cpp:44: error: request for member 'time' in 'timeEdit', which is of non-class type 'QTimeEdit*'
Try
(Note "timeEdit->" instead of "timeEdit.".)Qt Code:
To copy to clipboard, switch view to plain text mode
I get calendartime.cpp:44: error: base operand of '->' has non-pointer type 'QTimeEdit'
Then I tried this code
and it crashed withc process id 4192. I suspect this has to something with the pointer to QTimeEdit.Qt Code:
void calendartime:: display_message() { QMessageBox msgbox; QTimeEdit *timeEdit; msgbox.setText(text); msgbox.exec(); }To copy to clipboard, switch view to plain text mode
I am starting to think it can't be done..![]()
Last edited by Petr_Kropotkin; 27th January 2010 at 22:41.
Bookmarks