'void QAbstractButton::clicked(bool)' is protected

1k Views Asked by At

I'm actually working on a project with Qt 5.10.1. I'm using Linux and my partners are using Windows.

We've written this piece of code:

QCheckBox* _survive[9] = {
        ui->survive0, ui->survive1, ui->survive2, ui->survive3,
        ui->survive4, ui->survive5, ui->survive6, ui->survive7, ui->survive8
    };
QCheckBox* _born[9] = {
        ui->born0, ui->born1, ui->born2, ui->born3,
        ui->born4, ui->born5, ui->born6, ui->born7, ui->born8
    };
    std::copy_n(_survive, 9, survive); // because arrays are not directly assignable
    std::copy_n(_born, 9, born);


for (int i = 0; i < 9; i++) {
        connect(born[i], &QCheckBox::clicked, this, &Automate_2D::on_born_i_clicked);
        connect(survive[i], &QCheckBox::clicked, this, &Automate_2D::on_survive_i_clicked);
    }

Where survive0..survive8 and born0..born8 are checkboxes.

When compiling, it doesn't show up an error on Windows, but on Linux I have this error:

void QAbstractButton::clicked(bool)' is protected within this context

connect(born[i], &QCheckBox::clicked, this, &Automate_2D::on_born_i_clicked);

What can I do to fix it ? I don't understand why does it appears only on Linux.

1

There are 1 best solutions below

0
On

I found the solution if it can help someone. In QT I went on the "project" window (on the left), and in

Projetct > Deskop QT 5.11.0 GCC 64Bit > Build

I just changed the file path for the compilation with a new file that I had just created and which was empty.

Then I tried to compile my project again and it worked !

(Thanks for your help)