furskytl
28th September 2011, 09:46
Hello,every one!I want to implement one effect in my application :when the mouse is on a certain item of the menu,the statusbar will show the toollip message accordingly,and when the mouse is out,the statusbar show nothing! I think of it like this:
connect(Ui_MainWindow::menuBar,SIGNAL(hovered(QAct ion*)),this,SLOT(updateBar(QAction*)));
and
void MainWindow::updateBar(QAction * action)
{
if(action != NULL)
{
statusBar()->showMessage(action->toolTip(),5000);
}
}
However,it doesn't work!And I happen to find that some messages flash quickly on the statusbar when I move my mouse over the menubar.I think maybe the signal hovered() is always emitting while my mouse stops on one of the actions of the menubar,right?What should I do?Thanks very much!
connect(Ui_MainWindow::menuBar,SIGNAL(hovered(QAct ion*)),this,SLOT(updateBar(QAction*)));
and
void MainWindow::updateBar(QAction * action)
{
if(action != NULL)
{
statusBar()->showMessage(action->toolTip(),5000);
}
}
However,it doesn't work!And I happen to find that some messages flash quickly on the statusbar when I move my mouse over the menubar.I think maybe the signal hovered() is always emitting while my mouse stops on one of the actions of the menubar,right?What should I do?Thanks very much!