I have a mainwindow and I’m trying to show in statusarea message when user is trying open file that don’t exist.
void MainWindow::onOpenClicked(){
if(QFile(ui->lineEditCapture->text()).exists()){
// allow opening for analyze
}else{
setStatusTip("Can't open file, check if the file name is correct");
}
}
The problem is that the statustip is shown only after the mouse pointer leaves the window and return.
Also when I do
setStatusTip("Can't open file, check if the file name is correct");
in constructor then the statustip is shown right away.
What could be wrong?
EDIT:
It looks like if I do setStatusTip in slot then it’s not working as it should, however if the setStatusTip is in normal method then it works as expected.
Use the
showMessagefunction instead of thesetStatusTip. This way you can control how long the message will be displayed: