View Full Version : toolTips?

21st February 2006, 02:27
I see when mouse is on an icon action appear a toolTip (square yellow) and the same text of toolTips appear in the bottom of windows application. Is it possible write a Qstring in the bottom of window? Thanks

21st February 2006, 03:00
I am not exactly sure what you mean. QActions have toolTips and statusTips. By default, if an action has a tooltip, and if no status tip is defined, the action uses the tool tip text to be displayed in the status bar. You can set a different statusTip text using setStatusTip if you want the text displayed in the statusbar to be different than the action's tooltip text.

If you just want to display some text in the statusbar, well, there are various ways of accomplishing this; but the simlpest is to use one of the QStatusBar::message(...) methods.


21st February 2006, 11:37
Just remember that the status bar is available by default only in QMainWindow.

21st February 2006, 11:47
ok. But this change temporary status bar (text on the left). I'd like to take fix a text in the center of status bar when statusbar change text for move mouse on QActions.
is it Possible? I'm looking for a carefully place for a Qstring of max 11 char without using textLabel....

21st February 2006, 11:56
This should help you:

void QStatusBar::message ( const QString & message ) [slot]
Hides the normal status indicators and displays message until clear() or another message() is called.
See also clear().
Example: regexptester/regexptester.cpp.

21st February 2006, 17:17
I don't like hide normal status. I'd like have a normal status text and a blocked text in the center of status bar (not on the left)....

21st February 2006, 20:56
Then insert a label into the status bar and display there.

21st February 2006, 23:14
I prove to insert a label in status bar from designer but it seems impossible..

22nd February 2006, 01:06
Not everything can be done from Designer. You have to do that in init() or in subclass constructor.

23rd February 2006, 16:59
Hi, I insert this in ini costructor:

statusBar()->addWidget (statusLabel,110,FALSE);
It works but the problem is wheen mouse is over action my label is replaced with tooltips....When I move out action my label appears...

23rd February 2006, 17:54
Lets see...

void QStatusBar::addWidget ( QWidget * widget, int stretch = 0, bool permanent = FALSE ) [virtual]
Adds widget to this status bar. widget is reparented if it isn't already a child of the QStatusBar.
widget is permanently visible if permanent is TRUE and may be obscured by temporary messages if permanent is FALSE. The default is FALSE.

If permanent is TRUE, widget is located at the far right of the status bar. If permanent is FALSE (the default), widget is located just to the left of the first permanent widget.

stretch is used to compute a suitable size for widget as the status bar grows and shrinks. The default of 0 uses a minimum of space.

This function may cause some flicker.

See also removeWidget().

23rd February 2006, 20:10
It's works. But every change below dosn't take place (setweight,bold...).Why?

statusLabel = new QLabel (this);
QFont f2( "Arial");