PDA

View Full Version : status bar dispaly



bhogasena
30th January 2009, 09:40
hi,
i would like to display coordinates of window at right side corner of statusbar as mouse is moving.
but
[qt code:]statusBar()->showMesssage()[/QUOTE]

showmessage() will take only string. how can i pass float values.
please give me hint so that i'll be thankful to u.

aamer4yu
30th January 2009, 09:48
Have a look at QString::arg . One of the overloaded method takes double as argument .
Hope this helps :)

bhogasena
30th January 2009, 10:14
thnks for ur's quick reply, it's working now. but it is dispalying at leftcorner. i want ar right bottom corner.

Ginsengelf
30th January 2009, 10:37
Hi, try to set LayoutDirection to RightToLeft:

statusBar ()->setLayoutDirection (Qt::RightToLeft);

Ginsengelf

addition: you could also add a spacer widget and a label with your text.

bhogasena
30th January 2009, 11:06
i want to display only latitude and longitude at right corner . some status at middle and some at left corner. could u please send me sample code how to add widgets like labels to status bar.

faldzip
30th January 2009, 17:27
You can make your own widget in Designer and then put it in the status bar. I don't know if it's the best way but I did so in my app and its working good :]
I made my widget as on the attached first picture, and then added it in code like this:


statusWidget = new StatusWidget(this);
statusBar()->addPermanentWidget(statusWidget);

in my main window, and it looks like on the second picture.