PDA

View Full Version : Time in textBrowser



NewLegend
11th October 2010, 12:20
Hi
I want to put the hours in qt creator.
Then prints the time in the textBrowser.

Thank

tbscope
11th October 2010, 12:31
Hi
I want to put the hours in qt creator.

You can link to QUniverseCoreLib, it contains a pointer to QUniverseTime. Be aware that it is abstract. You need to subclass QUniverseTime to something like QEarthTime to make it more useful.

Also note that linking to QUniverseCoreLibd (the debug version that is) might take a little bit more space (no pun intended).


Then prints the time in the textBrowser.
Use the classes QDateTime or QTime
See their documentation. You might want to use the function toString(...)

If you expected a better answer, I expected a better question.

NewLegend
11th October 2010, 12:35
Will it be like this 5301

tbscope
11th October 2010, 13:02
I guess you want to have something like in the screenshot?


QTextBrowser textBrowser;
textBrowser.append(QTime::currentTime().toString("hh:mm:ss"));

NewLegend
11th October 2010, 13:14
I guess you want to have something like in the screenshot?


QTextBrowser textBrowser;
textBrowser.append(QTime::currentTime().toString("hh:mm:ss"));

Thank
But I using qt creator.
so, when using

ui->textBrowser->append(QTime::currentTime().toString("hh:mm:ss"));
i see this error
'.toString' must have class/struct
'currentTime' identifier not found

tbscope
11th October 2010, 13:27
Include QTime and QString

NewLegend
11th October 2010, 13:38
Include QTime and QString

You are wonderful
But How to Make a digital clock
as, 5303

secend, Can I increase the clock time ??
as,

ui->textBrowser->append(QTime::currentTime().toString("hh:mm:ss") + "I want to increase a minute of time");

If the time is now 15:44:00
I want to aggravated 15:45:00

tbscope
11th October 2010, 13:42
Use a QTimer (note the difference with QTime).
Set an interval (example: 1 second)
Connect a slot to the timeout() signal
in that slot, clear the contents of the textbox and set it to the current time.

NewLegend
11th October 2010, 13:50
What about Make a digital clock
as, 5304

I can not use timeEdit
Because it is Input not display.

NewLegend
11th October 2010, 13:59
Use a QTimer (note the difference with QTime).
Set an interval (example: 1 second)
Connect a slot to the timeout() signal
in that slot, clear the contents of the textbox and set it to the current time.

I want to increase the time is not decreased.

If the time is now 15:44:00
I want to see in textBrowser 15:45:00

tbscope
11th October 2010, 15:14
I suggest a good course in English if you want to do computer programming.

Jeneo W.
11th October 2010, 22:31
I suggest a good course in English if you want to do computer programming.

:mad:
???????????????????

Jeneo W.
11th October 2010, 22:32
secend, Can I increase the clock time ??
as,

ui->textBrowser->append(QTime::currentTime().toString("hh:mm:ss") + "I want to increase a minute of time");

If the time is now 15:44:00
I want change to 15:45:00

using

ui->textBrowser->append( QTime::currentTime().addSecs(60).toString("hh:mm:ss") );

tbscope
12th October 2010, 04:37
:mad:
???????????????????

Maybe you don't know this, but most tools for creating software are in English and so is the documentation. Learn it to understand it. There's no point explaining it again in English if the person doesn't understand it.