Hj,
I have a question how to do:
in the notepad (xp) i click F5 and the date and hours appear..
Kjiu
Hj,
I have a question how to do:
in the notepad (xp) i click F5 and the date and hours appear..
Kjiu
Do you mean : How to respond to a keyPressEvent, get the current time, format it into a string, and fill a textedit?
in the menu but the F5 (Shortcut)
like I press the F5 or a go to menu and selected, and the hour and date will be on textedit
So you want to know how to put the date and time into a text edit from a menu press/QAction? Or just date and hour?
Yes, can you can me how to do it.So you want to know how to put the date and time into a text edit from a menu press/QAction?
hi
You get the current time/date by using: QDateTime::currentDateTime(). This class has a toString(format) method, too. Format is also a string, like ("dd.MM.YYYY/hh.mm.ss")
-> you get 13.11.2009/08.04.20
This string you can set in the textEdit field.
like this ?
Qt Code:
public void date() { DateFormat dateFormat = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss"); java.util.Date date = new java.util.Date(); String datetime = dateFormat.format(date); this.editor.insertPlainText(datetime); }To copy to clipboard, switch view to plain text mode
now I haven't errors but when I click on date it doesn't appear at editor
Qt Code:
public void date() { SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss"); java.util.Date date = new java.util.Date(); String datetime = dateFormat.format(date); this.editor.insertPlainText(datetime); }To copy to clipboard, switch view to plain text mode
Your using QtScript?
no, I am using QT Jambi
Bookmarks