Hello, I am using Qt 4.3.3 with visual studio express 2005. I want to disable a pushbutton while the program is doing something, so I tried this:
connect( searchButton, SIGNAL( clicked() ), this, SLOT( listFiles() ) );
connect( searchButton, SIGNAL( clicked() ), this, SLOT( listFiles() ) );
To copy to clipboard, switch view to plain text mode
The behaviour I want is for the searchButton to be disable when the program is searching, so the user doesn't get impatient and press is multiple times (even though there is a progress bar, so they know it is thinking). What happens, is it isn't behaving disabled until AFTER the code has run. The qDebug replies false (correctly) at the correct time, which doesn't reflect the behaviour.
void RoboSearch::listFiles()
{
searchButton->setEnabled(false);
qDebug() << searchButton->isEnabled();
... //code is searching through files, so it takes ~5s
//searchButton->setEnabled(true);
}
void RoboSearch::listFiles()
{
searchButton->setEnabled(false);
qDebug() << searchButton->isEnabled();
... //code is searching through files, so it takes ~5s
//searchButton->setEnabled(true);
}
To copy to clipboard, switch view to plain text mode
I commented the enabling of the button to debug to make sure that it was eventually disabling.
Does anybody know what I'm doing wrong or what I can do to fix it? Thanks
Bookmarks