connect Not working when widget is disabled
-
Hello,
I am a newbie to Qt, sorry if this might seem trivial.
I am trying to connect two custom widgets on the main window constructor, namely wHead and wpicostepper with the following line
connect(wHead,SIGNAL(enable_view(bool)),wpicostepper,SLOT(enable_all(bool)));
The line is basically enabling and disabling the wpicostepper widget on the basis of the signal emitted from wHead (checkbox checked or not)
In particular the SIGNAL of wHead is emitted through the following methodvoid test_def_widget::on_checkBox_10MHz_clicked()
{
emit enable_view(ui->checkBox_10MHz->isChecked());
}implemented in wHead as a private slot
Everything works fine if I don't start with the wpicostepper disabled.
However if I add the following line
wpicostepper->setDisabled(true)
in the mainwindow constructor (as I want the widget to start as disabled and enable it once the checkbox is pressed), the connect seems not to work anymore.
Could you please help me understanding what's going on?
Thanks a lot
-
@Gaetano03 said in connect Not working when widget is disabled:
the connect seems not to work anymore
I'm sure connect itself works. You can verify this adding a debug output in the slot.
What probably happens is that disabled widget is not updated. But I don't know what you are doing in the slot.