0

I discovered a very curious thing. I have a big MainWindow class that does a lot of computations with a GUI. In order to keep the GUI responsive, I created a thread for a QTimer that updates the GUI every n milliseconds and another thread for the computations, and now all is very smooth and fast.

A simple problem I noticed is that when calling this

connect (_worker, &RRTWorker::finished, [=]()
{
    ui->stopButton->setEnabled(false);
});

, that is, when the worker emits the signal finished (when it has ended computations), both with [=] and [&] the stopButton gets disabled BUT the label inside is still black (not with that greyish filter as normal disabled buttons). If you need some feedback, here is a picture: Bad disabled Stop button

As you can clearly see, the Start button gets grayed out completely, and that is done in the on_startButtonclicked() via the statement ui->startButton->setEnabled(false). So, is this a bug, or am I doing something wrong?

Michael
  • 876
  • 9
  • 29
  • Are you sure you are not having a custom stylesheet set for the stop button which prevents the color change? Have you tried disabling the button with a non-lambda funtion? – Cybran Nov 23 '15 at 21:33
  • @DevCybran: Yes, from a non-lambda function all works normally. I just wondered why from a lambda-function this strange event would occur. – Michael Nov 23 '15 at 21:57

0 Answers0