I'm having a very silly problem, and I do not know what else to give it, I've tried creating instances but something will be wrong.
I have a static function that collects the value of an external window, and depends on the value of that function, I need you to call other functions.
TareaView.h
class PLUGIN_TAR_EXPORT TareaView
: public BlForm
, public Ui::TareaBase
{
Q_OBJECT
public:
TareaView(BlMainCompany *, QWidget *);
...
static void recogerValor(QString);
void avisarAsignado();
....
}
TareaView.cpp
(static function)
void TareaView::recogerValor(QString v){
if(v==""){
g_s->msgError("Nada seleccionado");
avisarAsignado();
}
if(v=="0"){
g_s->msgError("Madera");
}
if(v=="1"){
g_s->msgError("Metaclilato");
}
if(v=="2"){
g_s->msgError("Ambos");
}
}
(dynamic function)
void TareaView::avisarAsignado(){
m_enviando_email_al_asignado = true;
QString nombre_from = mui_list->dbValue("empleado_solicitante");
QString email_from = mui_list->dbValue("email_empleado_solicitante");
QStringList nombres_to;
QStringList emails_to;
QString id_empleado_asignado = mui_list->dbValue("id_empleado");
avisar(nombre_from, email_from, nombres_to, emails_to);
}
ERROR:
tareaview.cpp. error: cannot call member function ‘void TareaView::avisarAsignado()’ without object avisarAsignado();
Following your recommendations , I have not been able to solve the problem.
Since I do not know exactly where or how to create the instance. I through a static function "collectValue" that is in TaskView.cpp I collect the value of the number of checkboxs selected in TaskViewEquipment, and with the action of the accept button of the window, I pass the collected value to "collectValue" of Tareaview.
From TareaView, I call the window like this:
TareaViewEquipo *bud = new TareaViewEquipo((BlMainCompany *) mainCompany(), this);
bud->show();
The window opens, I select the checkboxes, and when clicking on accept, before close (), I send the value to TaskView in the following way, to the static function.
TareaView::recogerValor(QString(valor),TareaView &tv);
And now he says:
tareaview.cpp:998: error: prototype for ‘void TareaView::recogerValor(QString, TareaView&)’ does not match any in class ‘TareaView’ void TareaView::recogerValor(QString v, TareaView &tv){ ^
Y:
tareaview.h:117: error: candidate is: static void TareaView::recogerValor(QString, TareaView) static void recogerValor(QString, TareaView); ^
Deputy Functions:
TareaView.h
class PLUGIN_TAR_EXPORT TareaView
: public BlForm
, public Ui::TareaBase
{
Q_OBJECT
public:
TareaView(BlMainCompany *, QWidget *);
static void recogerValor(QString, TareaView);
void avisarAsignado();
...
protected:
...
TareaView.cpp
Where I call the window:
TareaViewEquipo *bud = new TareaViewEquipo((BlMainCompany *) mainCompany(), this);
bud->show();
TareaViewEquipo.cpp
(window)
void TareaViewEquipo::on_mui_aceptar_clicked()
{
QString valor;
valor=pasarvalor();
TareaView::recogerValor(QString(valor));
close();
}
TareaView.cpp
(Statical function that collects Window Value)
void TareaView::recogerValor(QString v, TareaView &tv){
//funciones especiales correo equipo produccion.
if(v==""){
g_s->msgError("Nada seleccionado, se envia normal");
tv.avisarAsignado();
}
if(v=="0"){
g_s->msgError("Madera");
}
if(v=="1"){
g_s->msgError("Metaclilato");
}
if(v=="2"){
g_s->msgError("Ambos");
}
}