GUI::SnapshotClicked()
is a part of GUI thread, which means, while it runs, your GUI is unaccessible. I assume, signal DoSnapshotWork()
is connected with a slot, running in another thread with Qt::QueuedConnection
(or Qt::AutoConnection
). In that case emitting this signal is asynchronous, which means GUI::SnapshotClicked()
is finished long before your slot is done. I guess you should do something like this:
gui.h
public slots:
void onReleaseButton();
gui.cpp
void
GUI::SnapshotClicked()
{
m_oBtnSnapshot.setDisabled( true );
m_oBtnBenchmark.repaint();
m_oBtnBenchmark.update();
emit( DoSnapshotWork() );
}
void
GUI::onReleaseButton()
{
m_oBtnSnapshot.setDisabled( false );
}
Somewhere else:
connect(shapshotWorker, SIGNAL(releaseButton()), gui, SLOT(onReleaseButton()));
...
DoSnapshotWork()
{
...
emit releaseButton();
}
P.S: You need a good reason to use QPushButton::pressed() signal. In most cases you would prefer QPushButton::clicked().