PDA

View Full Version : How to update statusbar and tooltips



aamer4yu
18th December 2006, 11:54
I have a button on toolbar, which when clicked changes the Text, Tooltip and Statustip.
How do I update the same without moving the mouse ??
I tried calling update on mainwindow, and also QCoreApplication::processEvents, but it didnt help :(

Is there anyway to update the tips on button click and show them instantly (without moving mouse ) ??? :confused:

lauranger
18th December 2006, 12:35
Hi
May be sending a tooltip event would help ?
Regards.

wysota
18th December 2006, 12:41
I have a button on toolbar, which when clicked changes the Text, Tooltip and Statustip.
How do I update the same without moving the mouse ??
I tried calling update on mainwindow, and also QCoreApplication::processEvents, but it didnt help :(

Is there anyway to update the tips on button click and show them instantly (without moving mouse ) ??? :confused:

Can we see the code?

aamer4yu
19th December 2006, 04:00
Ok.. here is the code of the function which gets called on button click from the toolbar.


void CMainWindow::OnNextPipelineAction()
{
m_pipeline_stages.HighlightNextStage();

QString s = QString("PL %1").arg(m_pipeline_stages.m_current_stage_number);
nextPipelineAction->setText(s);
nextPipelineAction->setToolTip(m_pipeline_stages.GetCurrentStage().Row sCovered());
nextPipelineAction->setStatusTip(m_pipeline_stages.GetCurrentStage().R owsCovered());

QCoreApplication::processEvents();
update();

}

Here I am setting the text, tooltip and statustip of the button. I want that as soon as the button is pressed, the updated tooltip and statustip are displayed immediately.

the processevents and update are not helping in this regard. What am I missing :confused:

aamer4yu
21st December 2006, 05:10
Helloooo... ne one ther ??

wysota
21st December 2006, 09:49
You can try posting a QHelpEvent as already suggested.

aamer4yu
21st December 2006, 11:34
and how do i post a helpevent ??
sorry i may sound silly, but i have no idea about helpevent :(

wysota
21st December 2006, 11:57
Consult the docs about a QHelpEvent then... You can use QCoreApplication::postEvent() to post an event.

aamer4yu
21st December 2006, 12:12
Thanks, :)
i will try it..

jpn
21st December 2006, 12:38
A tip: post the help event to the widget associated for the action in the toolbar (see QToolBar::widgetForAction()). It won't work if you post the event directly to the toolbar or the action.