Unsolved Small Problems with Signal&Slot
-
Hello everyone,
I am trying to implement Signal&Slots. The problem I am having is with the first and third component of the "connect": call to non static member function without an object argument;
if I call it with an argument, then I get the error: no viable conversion from addressEntry to QString.mainwindow.cpp
void MainWindow::on_Button_clicked()
{addressEntry *name = new addressEntry(); name->setName(ui->lineName->text()); connect**(addressEntry::setName(name)**, SIGNAL(entry(QString)), **addressReaderWriter::Write(name),** SLOT(Write(QString)));
}
addressEntry.cppvoid addressEntry::setName(QString name) { mName = name; qDebug() << "setName"; emit entry(name); } QString addressEntry::getName() { return mName; }
addressReaderWriter.cpp
void addressReaderWriter::Write(QString name){ name.getName(); }
Hope Someone can help.
-
@Chaki
Why do you create this new thread when you are already asking in https://forum.qt.io/topic/120793/call-to-non-static-member-function-without-an-object-argument ? What is wrong with the help you are receiving there? You won't get a different answer here! -
@JonB Thx, closed :)