Reputation: 83
I am trying to save the following modification : to enable the pushButton_4.
void Vessels::SaveSettings()
{
QSettings setting("My_vessels","My_selected_vessels");
setting.beginGroup("Vessels");
setting.setValue("selected",ui->pushButton_4->setEnabled(false));
setting.endGroup();
}
When I run, I get this error: vessels.cpp:838:33: error: reference to type 'const QVariant' could not bind to an rvalue of type 'void' qsettings.h:167:55: note: passing argument to parameter 'value' here
All what I wanna know, is how to setvalue for an object from this window. I mean enabling the button is just an example.
Upvotes: 2
Views: 940
Reputation: 1007
setting.setValue("selected",ui->pushButton_4->setEnabled(false));
QWidget::setEnabled
returns void, which you can't convert to a QVariant
in QSettings::setValue
. Did you mean ui->pushButton_4->isEnabled()
?
Upvotes: 3